set_master_pass now asks for the master password twice

This commit is contained in:
2023-08-07 13:22:47 +03:00
parent 1cc486bdc5
commit 857f268f1d
5 changed files with 128 additions and 42 deletions

View File

@ -1,4 +1,5 @@
use crate::prelude::*;
use cryptography::hashing::HashedBytes;
use log::error;
use tokio::task::spawn_blocking;
@ -14,8 +15,9 @@ async fn check_master_pass(
let is_valid = match model {
Some(model) => {
let hash: HashedBytes<_, _> = model.into();
let master_pass = master_pass.to_owned();
spawn_blocking(move || model.verify(&master_pass)).await?
spawn_blocking(move || hash.verify(master_pass.as_bytes())).await?
}
None => {
error!("User was put into the GetMasterPass state with no master password set");