From 5c6ae1f837805c9f3c1f73f599d314bea1ee4ad3 Mon Sep 17 00:00:00 2001 From: Xiretza Date: Wed, 27 Apr 2022 11:12:51 +0200 Subject: [PATCH] feat(Account): don't create an unused hash when signing up with key The hash is only used to generate the main_key when signing up/logging in with a password; when main_key is supplied directly, it is unused. --- src/service.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/service.rs b/src/service.rs index cf3933c..7209808 100644 --- a/src/service.rs +++ b/src/service.rs @@ -25,8 +25,8 @@ use super::{ LoginChallange, LoginResponseUser, User, UserProfile, }, utils::{ - buffer_unpad, from_base64, randombytes, randombytes_array, to_base64, MsgPackSerilization, - StrBase64, SYMMETRIC_KEY_SIZE, + buffer_unpad, from_base64, randombytes_array, to_base64, MsgPackSerilization, StrBase64, + SYMMETRIC_KEY_SIZE, }, }; @@ -124,9 +124,7 @@ impl Account { .try_into() .map_err(|_| Error::ProgrammingError("Key should be exactly 32 bytes long."))?; - let salt = randombytes(32); - - Self::signup_common(client, user, main_key, &salt) + Self::signup_common(client, user, main_key, &[]) } fn signup_common(