Added command to add master password

This commit is contained in:
2023-04-27 17:40:49 +03:00
parent e8fc43f9ad
commit 3f8adb96f9
6 changed files with 192 additions and 4 deletions

View File

@ -11,7 +11,7 @@ pub struct Model {
pub user_id: u64,
#[sea_orm(column_type = "Binary(BlobSize::Blob(Some(64)))")]
pub salt: Vec<u8>,
#[sea_orm(column_type = "Binary(BlobSize::Blob(Some(128)))")]
#[sea_orm(column_type = "Binary(BlobSize::Blob(Some(64)))")]
pub password_hash: Vec<u8>,
}
@ -28,9 +28,9 @@ impl ActiveModel {
Params::RECOMMENDED_LOG_N,
Params::RECOMMENDED_R,
Params::RECOMMENDED_P,
128,
64,
)?;
let mut password_hash = vec![0; 128];
let mut password_hash = vec![0; 64];
scrypt(password.as_ref(), &salt, &params, &mut password_hash)?;
Ok(Self {
user_id: Set(user_id),