Updated to Rust 1.80 and changed to LazyLock

This commit is contained in:
StNicolay 2024-07-25 17:45:36 +03:00
parent 4121857854
commit 5c789533e3
Signed by: StNicolay
GPG Key ID: 9693D04DCD962B0D
4 changed files with 6 additions and 11 deletions

8
Cargo.lock generated
View File

@ -1078,9 +1078,9 @@ dependencies = [
[[package]] [[package]]
name = "object" name = "object"
version = "0.36.1" version = "0.36.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "081b846d1d56ddfc18fdf1a922e4f6e07a11768ea1b92dec44e42b72712ccfce" checksum = "3f203fa8daa7bb185f760ae12bd8e097f63d17041dcdcaf675ac54cdf863170e"
dependencies = [ dependencies = [
"memchr", "memchr",
] ]
@ -1090,9 +1090,6 @@ name = "once_cell"
version = "1.19.0" version = "1.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
dependencies = [
"parking_lot_core",
]
[[package]] [[package]]
name = "opaque-debug" name = "opaque-debug"
@ -1150,7 +1147,6 @@ dependencies = [
"futures", "futures",
"hex", "hex",
"itertools 0.13.0", "itertools 0.13.0",
"once_cell",
"parking_lot", "parking_lot",
"pbkdf2", "pbkdf2",
"rand", "rand",

View File

@ -29,7 +29,6 @@ dotenvy = "0.15"
futures = "0.3" futures = "0.3"
hex = "0.4" hex = "0.4"
itertools = "0.13" itertools = "0.13"
once_cell = { version = "1", features = ["parking_lot"] }
parking_lot = "0.12" parking_lot = "0.12"
pbkdf2 = { version = "0.12", features = ["parallel"] } pbkdf2 = { version = "0.12", features = ["parallel"] }
rand = { version = "0.8", default-features = false, features = [ rand = { version = "0.8", default-features = false, features = [

View File

@ -107,10 +107,10 @@ impl Decrypted {
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
use once_cell::sync::Lazy; use std::sync::LazyLock;
const TESTING_MASTER_PASSWORD: &str = "VeryStr^n#M@$terP@$$!word"; const TESTING_MASTER_PASSWORD: &str = "VeryStr^n#M@$terP@$$!word";
static CIPHER: Lazy<Cipher> = Lazy::new(|| { static CIPHER: LazyLock<Cipher> = LazyLock::new(|| {
let mut salt = [0; 64]; let mut salt = [0; 64];
OsRng.fill_bytes(&mut salt); OsRng.fill_bytes(&mut salt);

View File

@ -1,13 +1,13 @@
use crate::entity::master_pass::MasterPass; use crate::entity::master_pass::MasterPass;
use once_cell::sync::Lazy;
use rand::{rngs::OsRng, RngCore}; use rand::{rngs::OsRng, RngCore};
use scrypt::{scrypt, Params}; use scrypt::{scrypt, Params};
use std::sync::LazyLock;
use subtle::ConstantTimeEq; use subtle::ConstantTimeEq;
pub const HASH_LENGTH: usize = 64; pub const HASH_LENGTH: usize = 64;
pub const SALT_LENGTH: usize = 64; pub const SALT_LENGTH: usize = 64;
static PARAMS: Lazy<Params> = Lazy::new(|| Params::new(14, 8, 1, HASH_LENGTH).unwrap()); static PARAMS: LazyLock<Params> = LazyLock::new(|| Params::new(14, 8, 1, HASH_LENGTH).unwrap());
/// Hashes the bytes with Scrypt with the given salt /// Hashes the bytes with Scrypt with the given salt
#[must_use] #[must_use]