mirror of
https://github.com/danbulant/Portfolio
synced 2026-05-26 21:41:50 +00:00
refactor: remove some unwraps from crypto
This commit is contained in:
parent
e1ee5b796a
commit
54e88de2a9
1 changed files with 2 additions and 2 deletions
|
|
@ -126,7 +126,7 @@ pub async fn decrypt_password(
|
||||||
password_cipher_text: String,
|
password_cipher_text: String,
|
||||||
key: String,
|
key: String,
|
||||||
) -> Result<String, ServiceError> {
|
) -> Result<String, ServiceError> {
|
||||||
let input = base64::decode(password_cipher_text).unwrap();
|
let input = base64::decode(password_cipher_text)?;
|
||||||
let plain = tokio::task::spawn_blocking(move || {
|
let plain = tokio::task::spawn_blocking(move || {
|
||||||
let aes_key_nonce = convert_key_aes256(&key);
|
let aes_key_nonce = convert_key_aes256(&key);
|
||||||
|
|
||||||
|
|
@ -139,7 +139,7 @@ pub async fn decrypt_password(
|
||||||
})
|
})
|
||||||
.await??;
|
.await??;
|
||||||
|
|
||||||
Ok(String::from_utf8(plain).unwrap())
|
Ok(String::from_utf8(plain)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[deprecated(note = "Too slow, use AES instead")]
|
#[deprecated(note = "Too slow, use AES instead")]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue