refactor(accounts): switched from deprecated function `base64::encode()` to `base64::Engine::encode()`

This commit is contained in:
antifallobst 2023-09-10 02:04:14 +02:00
parent 8fd807e450
commit f7e02dc794
Signed by: antifallobst
GPG Key ID: 2B4F402172791BAF
2 changed files with 49 additions and 3 deletions

View File

@ -0,0 +1,46 @@
{
"db_name": "PostgreSQL",
"query": "SELECT * FROM Projects WHERE id = $1;",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Int8"
},
{
"ordinal": 1,
"name": "name",
"type_info": "Varchar"
},
{
"ordinal": 2,
"name": "description",
"type_info": "Text"
},
{
"ordinal": 3,
"name": "created",
"type_info": "Timestamp"
},
{
"ordinal": 4,
"name": "members",
"type_info": "Int8Array"
}
],
"parameters": {
"Left": [
"Int8"
]
},
"nullable": [
false,
false,
false,
false,
false
]
},
"hash": "bdcf043d394bc561cd8c7dcdb27943e04b4b796f18f6d1abb0608d5dae3bc0cd"
}

View File

@ -3,7 +3,7 @@ use argon2::{
password_hash::{rand_core::OsRng, PasswordHash, PasswordHasher, PasswordVerifier, SaltString},
Argon2,
};
use base64;
use base64::{Engine, engine::general_purpose::STANDARD as Base64Engine};
use sha2::{Digest, Sha256};
use sqlx::{postgres::PgPool, types::chrono as sqlx_chrono};
@ -74,7 +74,7 @@ impl Account {
let email_hash = {
let mut hasher = Sha256::new();
hasher.update(email.as_bytes());
base64::encode(hasher.finalize())
Base64Engine.encode(hasher.finalize())
};
let joined = sqlx_chrono::Utc::now().naive_utc();
@ -154,7 +154,7 @@ impl Account {
let email_hash = {
let mut hasher = Sha256::new();
hasher.update(email.as_bytes());
base64::encode(hasher.finalize())
Base64Engine.encode(hasher.finalize())
};
match sqlx::query_as!(