Skip to content

Commit

Permalink
xmtp_common exists now
Browse files Browse the repository at this point in the history
  • Loading branch information
codabrink committed Dec 13, 2024
1 parent bdffe8b commit e6f71ef
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions xmtp_mls/src/storage/encrypted_store/user_preferences.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down Expand Up @@ -61,8 +59,7 @@ impl StoredUserPreferences {
) -> Result<Vec<u8>, 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
Expand Down

0 comments on commit e6f71ef

Please sign in to comment.