Save new credentials after trust migration, level up 1 -> 2
This commit is contained in:
parent
a3bf510c44
commit
21cae179fd
|
@ -98,9 +98,9 @@ async fn main() {
|
||||||
(cred, bl)
|
(cred, bl)
|
||||||
};
|
};
|
||||||
|
|
||||||
if matches.opt_present("L") {
|
let lox_cred = if matches.opt_present("L") {
|
||||||
// If trust level is 0, do trust promotion, otherwise level up.
|
// If trust level is 0, do trust promotion, otherwise level up.
|
||||||
if lox_cred.trust_level == Scalar::zero() {
|
let cred = if lox_cred.trust_level == Scalar::zero() {
|
||||||
let migration_cred =
|
let migration_cred =
|
||||||
trust_promotion(&server_addr, &lox_cred, get_lox_pub(&lox_auth_pubkeys)).await;
|
trust_promotion(&server_addr, &lox_cred, get_lox_pub(&lox_auth_pubkeys)).await;
|
||||||
let cred = trust_migration(
|
let cred = trust_migration(
|
||||||
|
@ -111,6 +111,7 @@ async fn main() {
|
||||||
get_migration_pub(&lox_auth_pubkeys),
|
get_migration_pub(&lox_auth_pubkeys),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
cred
|
||||||
} else {
|
} else {
|
||||||
let encbuckets = get_reachability_credential(&server_addr).await;
|
let encbuckets = get_reachability_credential(&server_addr).await;
|
||||||
let cred = level_up(
|
let cred = level_up(
|
||||||
|
@ -121,6 +122,11 @@ async fn main() {
|
||||||
get_reachability_pub(&lox_auth_pubkeys),
|
get_reachability_pub(&lox_auth_pubkeys),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
cred
|
||||||
}
|
};
|
||||||
|
save_object(&cred, &lox_cred_filename);
|
||||||
|
cred
|
||||||
|
} else {
|
||||||
|
lox_cred
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,7 +149,13 @@ pub async fn level_up(
|
||||||
&reachcred,
|
&reachcred,
|
||||||
lox_pub,
|
lox_pub,
|
||||||
reachability_pub,
|
reachability_pub,
|
||||||
today(Duration::ZERO),
|
//today(Duration::ZERO),
|
||||||
|
|
||||||
|
// The following line adds 31 days (from initial trust migration)
|
||||||
|
// plus 85 days for first level up.
|
||||||
|
// The server's testing code keeps track of time added as the
|
||||||
|
// program runs. This should be adapted to do that as well.
|
||||||
|
today(Duration::from_secs(60 * 60 * 24 * (31 + 85))), // FOR TESTING ONLY
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
let encoded_req: Vec<u8> = serde_json::to_vec(&req).unwrap();
|
let encoded_req: Vec<u8> = serde_json::to_vec(&req).unwrap();
|
||||||
|
|
Loading…
Reference in New Issue