Removed inlines

This commit is contained in:
2024-05-13 13:58:56 +03:00
parent 064ec22e51
commit 25b02ba99a
42 changed files with 0 additions and 100 deletions

View File

@@ -10,7 +10,6 @@ pub struct Cipher {
impl Cipher {
/// Creates a new cipher from a master password and the salt
#[inline]
#[must_use]
pub fn new(password: &[u8], salt: &[u8]) -> Self {
let key = pbkdf2_hmac_array::<Sha256, 32>(password, salt, 480_000);
@@ -21,7 +20,6 @@ impl Cipher {
}
/// Encrypts the value with the current cipher. The 12 byte nonce is appended to the result
#[inline]
pub fn encrypt(&self, value: &mut Vec<u8>) {
let nonce = ChaCha20Poly1305::generate_nonce(&mut OsRng);
self.chacha.encrypt_in_place(&nonce, b"", value).unwrap();
@@ -33,7 +31,6 @@ impl Cipher {
/// # Errors
///
/// Returns an error if the tag doesn't match the ciphertext
#[inline]
#[allow(clippy::missing_panics_doc)]
pub fn decrypt(&self, value: &mut Vec<u8>) -> super::Result<()> {
if value.len() <= 12 {
@@ -61,7 +58,6 @@ impl Decrypted {
/// # Errors
///
/// Returns an error if the tag doesn't match the ciphertext or if the decrypted data isn't valid UTF-8
#[inline]
pub fn from_account(mut account: Account, master_pass: &str) -> super::Result<Self> {
let cipher = Cipher::new(master_pass.as_bytes(), &account.salt);
cipher.decrypt(&mut account.enc_login)?;
@@ -75,7 +71,6 @@ impl Decrypted {
}
/// Constructs `ActiveModel` with eath field Set by encrypting `self`
#[inline]
#[must_use]
pub fn into_account(self, user_id: u64, master_pass: &str) -> Account {
let mut enc_login = self.login.into_bytes();
@@ -97,7 +92,6 @@ impl Decrypted {
}
/// Returns true if the account's fields are valid
#[inline]
#[must_use]
pub fn validate(&self) -> bool {
[

View File

@@ -10,7 +10,6 @@ pub const SALT_LENGTH: usize = 64;
static PARAMS: Lazy<Params> = Lazy::new(|| Params::new(14, 8, 1, HASH_LENGTH).unwrap());
/// Hashes the bytes with Scrypt with the given salt
#[inline]
#[must_use]
#[allow(clippy::missing_panics_doc)]
pub fn hash_scrypt(bytes: &[u8], salt: &[u8]) -> [u8; HASH_LENGTH] {
@@ -30,7 +29,6 @@ where
}
impl HashedBytes<[u8; HASH_LENGTH], [u8; SALT_LENGTH]> {
#[inline]
#[must_use]
pub fn new(bytes: &[u8]) -> Self {
let mut salt = [0; 64];
@@ -47,7 +45,6 @@ where
T: AsRef<[u8]>,
U: AsRef<[u8]>,
{
#[inline]
#[must_use]
pub fn verify(&self, bytes: &[u8]) -> bool {
let hash = hash_scrypt(bytes, self.salt.as_ref());
@@ -56,7 +53,6 @@ where
}
impl<'a> From<&'a MasterPass> for HashedBytes<&'a [u8], &'a [u8]> {
#[inline]
fn from(value: &'a MasterPass) -> Self {
HashedBytes {
hash: &value.password_hash,

View File

@@ -24,7 +24,6 @@ bitflags::bitflags! {
/// Returns true if the generated master password is valid.
/// It checks that it has at least one lowercase, one uppercase, one number and one punctuation char
#[inline]
#[must_use]
fn check_generated_password<const LENGTH: usize>(password: &[u8; LENGTH]) -> bool {
let mut flags = PasswordFlags::empty();
@@ -46,7 +45,6 @@ fn check_generated_password<const LENGTH: usize>(password: &[u8; LENGTH]) -> boo
}
/// Continuously generates the password until it passes the checks
#[inline]
#[must_use]
fn generate_password<R, const LENGTH: usize>(rng: &mut R) -> ArrayString<LENGTH>
where
@@ -60,7 +58,6 @@ where
}
}
#[inline]
#[must_use]
#[allow(clippy::module_name_repetitions)]
pub fn generate_passwords<const AMOUNT: usize, const LENGTH: usize>(
@@ -69,7 +66,6 @@ pub fn generate_passwords<const AMOUNT: usize, const LENGTH: usize>(
array::from_fn(|_| generate_password(&mut rng))
}
#[inline]
#[must_use]
pub fn check_master_pass(password: &str) -> PasswordValidity {
let mut count = 0;