Skip to content

Commit

Permalink
refactor: use Entity derive macro for tables with hex ids
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonThormeyer committed Feb 5, 2025
1 parent 84075c8 commit 8809379
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 773 deletions.
12 changes: 9 additions & 3 deletions keystore/src/entities/mls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ use openmls_traits::types::SignatureScheme;
use zeroize::Zeroize;

/// Entity representing a persisted `MlsGroup`
#[derive(Debug, Clone, PartialEq, Eq, Zeroize)]
#[derive(Debug, Clone, PartialEq, Eq, Zeroize, core_crypto_macros::Entity)]
#[zeroize(drop)]
#[entity(collection_name = "mls_groups")]
#[cfg_attr(
any(target_family = "wasm", feature = "serde"),
derive(serde::Serialize, serde::Deserialize)
)]
pub struct PersistedMlsGroup {
#[id(hex, column = "id_hex")]
pub id: Vec<u8>,
pub state: Vec<u8>,
pub parent_id: Option<Vec<u8>>,
Expand Down Expand Up @@ -158,10 +160,12 @@ pub struct MlsEncryptionKeyPair {
}

/// Entity representing a list of [MlsEncryptionKeyPair]
#[derive(Debug, Clone, PartialEq, Eq, Zeroize)]
#[derive(Debug, Clone, PartialEq, Eq, Zeroize, core_crypto_macros::Entity)]
#[zeroize(drop)]
#[entity(collection_name = "mls_epoch_encryption_keypairs")]
#[cfg_attr(target_family = "wasm", derive(serde::Serialize, serde::Deserialize))]
pub struct MlsEpochEncryptionKeyPair {
#[id(hex, column = "id_hex")]
pub id: Vec<u8>,
pub keypairs: Vec<u8>,
}
Expand All @@ -179,13 +183,15 @@ pub struct MlsPskBundle {
}

/// Entity representing a persisted `KeyPackage`
#[derive(Debug, Clone, PartialEq, Eq, Zeroize)]
#[derive(Debug, Clone, PartialEq, Eq, Zeroize, core_crypto_macros::Entity)]
#[zeroize(drop)]
#[entity(collection_name = "mls_keypackages")]
#[cfg_attr(
any(target_family = "wasm", feature = "serde"),
derive(serde::Serialize, serde::Deserialize)
)]
pub struct MlsKeyPackage {
#[id(hex, column = "keypackage_ref_hex")]
pub keypackage_ref: Vec<u8>,
pub keypackage: Vec<u8>,
}
Expand Down
182 changes: 0 additions & 182 deletions keystore/src/entities/platform/generic/mls/epoch_encryption_keypair.rs

This file was deleted.

Loading

0 comments on commit 8809379

Please sign in to comment.