diff --git a/xmtp_mls/src/storage/encrypted_store/user_preferences.rs b/xmtp_mls/src/storage/encrypted_store/user_preferences.rs index 98170d52f..dbde2948c 100644 --- a/xmtp_mls/src/storage/encrypted_store/user_preferences.rs +++ b/xmtp_mls/src/storage/encrypted_store/user_preferences.rs @@ -1,14 +1,12 @@ -use crate::{ - groups::device_sync::preference_sync::UserPreferenceUpdate, storage::StorageError, - subscriptions::LocalEvents, Store, -}; - use super::{ schema::user_preferences::{self, dsl}, DbConnection, }; +use crate::{ + groups::device_sync::preference_sync::UserPreferenceUpdate, storage::StorageError, + subscriptions::LocalEvents, Store, +}; use diesel::prelude::*; -use rand::{rngs::OsRng, RngCore}; use tokio::sync::broadcast::Sender; #[derive(Identifiable, Queryable, AsChangeset, Debug, Clone, PartialEq, Eq, Default)] @@ -61,8 +59,7 @@ impl StoredUserPreferences { ) -> Result, StorageError> { let mut preferences = Self::load(conn)?; - let mut hmac_key = vec![0; 32]; - OsRng.fill_bytes(&mut hmac_key); + let hmac_key = xmtp_common::rand_vec::<32>(); preferences.hmac_key = Some(hmac_key.clone()); // Sync the new key to other devices