2024 edition

This commit is contained in:
2025-02-21 16:40:42 +03:00
parent d064b8d571
commit 777ad8e311
14 changed files with 205 additions and 166 deletions

View File

@@ -1,7 +1,7 @@
use crate::entity::account::Account;
use chacha20poly1305::{AeadCore, AeadInPlace, ChaCha20Poly1305, KeyInit};
use pbkdf2::pbkdf2_hmac_array;
use rand::{rngs::OsRng, RngCore};
use rand::{RngCore, rngs::OsRng};
use sha2::Sha256;
pub struct Cipher {

View File

@@ -1,6 +1,6 @@
use crate::entity::master_pass::MasterPass;
use rand::{rngs::OsRng, RngCore};
use scrypt::{scrypt, Params};
use rand::{RngCore, rngs::OsRng};
use scrypt::{Params, scrypt};
use std::sync::LazyLock;
use subtle::ConstantTimeEq;

View File

@@ -1,5 +1,5 @@
use arrayvec::ArrayString;
use rand::{seq::SliceRandom, thread_rng, CryptoRng, Rng};
use rand::{CryptoRng, Rng, seq::SliceRandom, thread_rng};
use std::array;
const CHARS: &[u8] = br##"!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_abcdefghijklmnopqrstuvwxyz{|}~"##;
@@ -60,8 +60,8 @@ where
#[must_use]
#[allow(clippy::module_name_repetitions)]
pub fn generate_passwords<const AMOUNT: usize, const LENGTH: usize>(
) -> [ArrayString<LENGTH>; AMOUNT] {
pub fn generate_passwords<const AMOUNT: usize, const LENGTH: usize>()
-> [ArrayString<LENGTH>; AMOUNT] {
let mut rng = thread_rng();
array::from_fn(|_| generate_password(&mut rng))
}