1
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-08-26 12:43:20 +00:00

refactor: replace static with const for global constants

This commit is contained in:
Integral 2024-12-07 22:09:14 +08:00
commit 8c1e8ce840
No known key found for this signature in database
GPG key ID: 06313911057DD5A8
2 changed files with 3 additions and 3 deletions

View file

@ -6,7 +6,7 @@ use std::num::NonZeroU32;
use data_encoding::{Encoding, HEXLOWER};
use ring::{digest, hmac, pbkdf2};
static DIGEST_ALG: pbkdf2::Algorithm = pbkdf2::PBKDF2_HMAC_SHA256;
const DIGEST_ALG: pbkdf2::Algorithm = pbkdf2::PBKDF2_HMAC_SHA256;
const OUTPUT_LEN: usize = digest::SHA256_OUTPUT_LEN;
pub fn hash_password(secret: &[u8], salt: &[u8], iterations: u32) -> Vec<u8> {

View file

@ -81,7 +81,7 @@ impl UserOrgType {
impl Ord for UserOrgType {
fn cmp(&self, other: &UserOrgType) -> Ordering {
// For easy comparison, map each variant to an access level (where 0 is lowest).
static ACCESS_LEVEL: [i32; 4] = [
const ACCESS_LEVEL: [i32; 4] = [
3, // Owner
2, // Admin
0, // User
@ -197,7 +197,7 @@ impl Organization {
// The number 128 should be fine, it is well within the range of an i32
// The same goes for the database where we only use INTEGER (the same as an i32)
// It should also provide enough room for 100+ types, which i doubt will ever happen.
static ACTIVATE_REVOKE_DIFF: i32 = 128;
const ACTIVATE_REVOKE_DIFF: i32 = 128;
impl UserOrganization {
pub fn new(user_uuid: String, org_uuid: String) -> Self {