Save new credentials after trust migration, level up 1 -> 2

This commit is contained in:
Vecna 2023-03-25 14:53:53 -04:00
parent a3bf510c44
commit 21cae179fd
2 changed files with 17 additions and 5 deletions

View File

@ -98,9 +98,9 @@ async fn main() {
(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 lox_cred.trust_level == Scalar::zero() {
let cred = if lox_cred.trust_level == Scalar::zero() {
let migration_cred =
trust_promotion(&server_addr, &lox_cred, get_lox_pub(&lox_auth_pubkeys)).await;
let cred = trust_migration(
@ -111,6 +111,7 @@ async fn main() {
get_migration_pub(&lox_auth_pubkeys),
)
.await;
cred
} else {
let encbuckets = get_reachability_credential(&server_addr).await;
let cred = level_up(
@ -121,6 +122,11 @@ async fn main() {
get_reachability_pub(&lox_auth_pubkeys),
)
.await;
}
}
cred
};
save_object(&cred, &lox_cred_filename);
cred
} else {
lox_cred
};
}

View File

@ -149,7 +149,13 @@ pub async fn level_up(
&reachcred,
lox_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();
let encoded_req: Vec<u8> = serde_json::to_vec(&req).unwrap();