diff options
Diffstat (limited to 'src/api/auth/account.rs')
-rw-r--r-- | src/api/auth/account.rs | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/api/auth/account.rs b/src/api/auth/account.rs index 9d2a19e..8f3ac55 100644 --- a/src/api/auth/account.rs +++ b/src/api/auth/account.rs @@ -100,10 +100,9 @@ pub(crate) async fn create( let key_fetch_token = if keys { let key_fetch_token = KeyFetchToken::generate(); let req = KeyFetchReq::derive_from(&key_fetch_token); - let wrapped = req.derive_resp().wrap_keys(&KeyBundle { - ka: ka.clone(), - wrap_kb: stretched.decrypt_wwkb(&wrapwrap_kb), - }); + let wrapped = req + .derive_resp() + .wrap_keys(&KeyBundle { ka, wrap_kb: stretched.decrypt_wwkb(&wrapwrap_kb) }); db.add_key_fetch(req.token_id, &req.req_hmac_key, &wrapped).await?; Some(key_fetch_token) } else { @@ -120,8 +119,7 @@ pub(crate) async fn create( verified: false, }) .await?; - let auth_at = - db.add_session(session.token_id.clone(), &uid, session.req_hmac_key, false, None).await?; + let auth_at = db.add_session(session.token_id, &uid, session.req_hmac_key, false, None).await?; let verify_code = hex::encode(&random_bytes::<16>()); db.add_verify_code(&uid, &session.token_id, &verify_code).await?; // NOTE we send the email in this context rather than a spawn to signal @@ -215,13 +213,7 @@ pub(crate) async fn login( let verify_code = format!("{:06}", thread_rng().gen_range(0..=999999)); let auth_at = db - .add_session( - session.token_id.clone(), - &uid, - session.req_hmac_key, - false, - Some(&verify_code), - ) + .add_session(session.token_id, &uid, session.req_hmac_key, false, Some(&verify_code)) .await?; // NOTE we send the email in this context rather than a spawn to signal // send errors to the client. |