mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2024-12-26 23:25:56 -05:00
Remove get_random_64()
Its uses are replaced by get_randm_bytes() or encode_random_bytes().
This commit is contained in:
parent
d0baa23f9a
commit
7445ee40f8
@ -981,8 +981,7 @@ impl Config {
|
|||||||
if let Some(akey) = self._duo_akey() {
|
if let Some(akey) = self._duo_akey() {
|
||||||
akey
|
akey
|
||||||
} else {
|
} else {
|
||||||
let akey = crate::crypto::get_random_64();
|
let akey_s = crate::crypto::encode_random_bytes::<64>(data_encoding::BASE64);
|
||||||
let akey_s = data_encoding::BASE64.encode(&akey);
|
|
||||||
|
|
||||||
// Save the new value
|
// Save the new value
|
||||||
let builder = ConfigBuilder {
|
let builder = ConfigBuilder {
|
||||||
|
@ -37,10 +37,6 @@ pub fn hmac_sign(key: &str, data: &str) -> String {
|
|||||||
// Random values
|
// Random values
|
||||||
//
|
//
|
||||||
|
|
||||||
pub fn get_random_64() -> Vec<u8> {
|
|
||||||
get_random_bytes::<64>().to_vec()
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Return an array holding `N` random bytes.
|
/// Return an array holding `N` random bytes.
|
||||||
pub fn get_random_bytes<const N: usize>() -> [u8; N] {
|
pub fn get_random_bytes<const N: usize>() -> [u8; N] {
|
||||||
use ring::rand::{SecureRandom, SystemRandom};
|
use ring::rand::{SecureRandom, SystemRandom};
|
||||||
|
@ -81,7 +81,7 @@ impl Send {
|
|||||||
|
|
||||||
if let Some(password) = password {
|
if let Some(password) = password {
|
||||||
self.password_iter = Some(PASSWORD_ITER);
|
self.password_iter = Some(PASSWORD_ITER);
|
||||||
let salt = crate::crypto::get_random_64();
|
let salt = crate::crypto::get_random_bytes::<64>().to_vec();
|
||||||
let hash = crate::crypto::hash_password(password.as_bytes(), &salt, PASSWORD_ITER as u32);
|
let hash = crate::crypto::hash_password(password.as_bytes(), &salt, PASSWORD_ITER as u32);
|
||||||
self.password_salt = Some(salt);
|
self.password_salt = Some(salt);
|
||||||
self.password_hash = Some(hash);
|
self.password_hash = Some(hash);
|
||||||
|
@ -93,7 +93,7 @@ impl User {
|
|||||||
email_new_token: None,
|
email_new_token: None,
|
||||||
|
|
||||||
password_hash: Vec::new(),
|
password_hash: Vec::new(),
|
||||||
salt: crypto::get_random_64(),
|
salt: crypto::get_random_bytes::<64>().to_vec(),
|
||||||
password_iterations: CONFIG.password_iterations(),
|
password_iterations: CONFIG.password_iterations(),
|
||||||
|
|
||||||
security_stamp: crate::util::get_uuid(),
|
security_stamp: crate::util::get_uuid(),
|
||||||
|
Loading…
Reference in New Issue
Block a user