Updated cryptography functions to be in-place

This commit is contained in:
2023-11-19 15:54:01 +03:00
parent bfd68194e6
commit e4e33f52b1
11 changed files with 110 additions and 121 deletions

View File

@@ -20,9 +20,14 @@ async fn get_master_pass(
let user_id = msg.from().ok_or(NoUserInfo)?.id.0;
let account = spawn_blocking(move || {
account::ActiveModel::from_unencrypted(user_id, name, &login, &password, &master_pass)
DecryptedAccount {
name,
login,
password,
}
.into_account(user_id, &master_pass)
})
.await??;
.await?;
account.insert(&db).await?;
ids.alter_message(&bot, "Success", deletion_markup(), None)

View File

@@ -17,7 +17,7 @@ async fn encrypt_account(
) {
let name = account.name.clone();
match spawn_blocking(move || account.into_account(user_id, &master_pass)).await {
Ok(Ok(account)) => match account.insert(db).await {
Ok(account) => match account.insert(db).await {
Ok(_) => (),
Err(_) => failed.lock().push(name),
},