add argon2 kdf fields

This commit is contained in:
Helmut K. C. Tessarek
2023-01-31 21:26:23 -05:00
parent 9366e31452
commit 68bcc7a4b8
16 changed files with 131 additions and 25 deletions

View File

@@ -44,6 +44,8 @@ db_object! {
pub client_kdf_type: i32,
pub client_kdf_iter: i32,
pub client_kdf_memory: Option<i32>,
pub client_kdf_parallelism: Option<i32>,
pub api_key: Option<String>,
@@ -58,6 +60,11 @@ db_object! {
}
}
pub enum UserKdfType {
Pbkdf2 = 0,
Argon2id = 1,
}
enum UserStatus {
Enabled = 0,
Invited = 1,
@@ -73,7 +80,7 @@ pub struct UserStampException {
/// Local methods
impl User {
pub const CLIENT_KDF_TYPE_DEFAULT: i32 = 0; // PBKDF2: 0
pub const CLIENT_KDF_TYPE_DEFAULT: i32 = UserKdfType::Pbkdf2 as i32;
pub const CLIENT_KDF_ITER_DEFAULT: i32 = 600_000;
pub fn new(email: String) -> Self {
@@ -113,6 +120,8 @@ impl User {
client_kdf_type: Self::CLIENT_KDF_TYPE_DEFAULT,
client_kdf_iter: Self::CLIENT_KDF_ITER_DEFAULT,
client_kdf_memory: None,
client_kdf_parallelism: None,
api_key: None,