Skip to main content

MdkSqliteStorage

Struct MdkSqliteStorage 

Source
pub struct MdkSqliteStorage { /* private fields */ }
Expand description

A SQLite-based storage implementation for MDK.

This struct implements the MdkStorageProvider trait for SQLite databases. It directly interfaces with a SQLite database for storing MLS data, using a single unified connection for both MLS cryptographic state and MDK-specific data (groups, messages, welcomes).

§Unified Storage Architecture

This implementation provides atomic transactions across all MLS and MDK state by using a single database connection. This enables proper rollback for commit race resolution as required by the Marmot Protocol.

§Encryption

All databases are encrypted by default using SQLCipher. Keys are stored securely in the platform’s native keyring (Keychain, Keystore, etc.).

§Example

use mdk_sqlite_storage::MdkSqliteStorage;

// Create encrypted storage (production - recommended)
let storage = MdkSqliteStorage::new(
    "/path/to/db.sqlite",
    "com.example.myapp",
    "mdk.db.key.default"
)?;

Implementations§

Source§

impl MdkSqliteStorage

Source

pub fn new<P>( file_path: P, service_id: &str, db_key_id: &str, ) -> Result<Self, Error>
where P: AsRef<Path>,

Creates a new encrypted MdkSqliteStorage with automatic key management.

This is the recommended constructor for production use. The database encryption key is automatically retrieved from (or generated and stored in) the platform’s native keyring (Keychain on macOS/iOS, Keystore on Android, etc.).

§Prerequisites

The host application must initialize a platform-specific keyring store before calling this method. See the module documentation for setup instructions.

§Arguments
  • file_path - Path to the SQLite database file.
  • service_id - A stable, host-defined application identifier (e.g., reverse-DNS like "com.example.myapp"). This should be unique per application.
  • db_key_id - A stable identifier for this database’s key (e.g., "mdk.db.key.default" or "mdk.db.key.<profile_id>" for multi-profile apps).
§Key Management
  • If no key exists for the given identifiers, a new 32-byte key is generated using cryptographically secure randomness and stored in the keyring.
  • On subsequent calls with the same identifiers, the existing key is retrieved.
§Errors

Returns an error if:

  • No keyring store has been initialized
  • The keyring is unavailable or inaccessible
  • An existing database cannot be decrypted with the stored key
  • The database file cannot be created or opened
§Example
use mdk_sqlite_storage::MdkSqliteStorage;

// First, initialize the platform keyring (do this once at app startup)
// keyring_core::set_default_store(platform_specific_store);

// Then create storage with automatic key management
let storage = MdkSqliteStorage::new(
    "/path/to/db.sqlite",
    "com.example.myapp",
    "mdk.db.key.default"
)?;
Source

pub fn new_with_key<P>( file_path: P, config: EncryptionConfig, ) -> Result<Self, Error>
where P: AsRef<Path>,

Creates a new encrypted MdkSqliteStorage with a directly provided encryption key.

Use this method when you want to manage encryption keys yourself rather than using the platform keyring. For most applications, prefer Self::new which handles key management automatically.

§Arguments
  • file_path - Path to the SQLite database file.
  • config - Encryption configuration containing the 32-byte key.
§Errors

Returns an error if:

  • The encryption key is invalid
  • An existing database cannot be decrypted with the provided key
  • An existing database was created without encryption
  • The database file cannot be created or opened
  • File permissions cannot be set
§Example
use mdk_sqlite_storage::{EncryptionConfig, MdkSqliteStorage};

let key = [0u8; 32]; // Your securely stored key
let config = EncryptionConfig::new(key);
let storage = MdkSqliteStorage::new_with_key("/path/to/db.sqlite", config)?;
Source

pub fn new_unencrypted<P>(file_path: P) -> Result<Self, Error>
where P: AsRef<Path>,

Creates a new unencrypted MdkSqliteStorage with the provided file path.

⚠️ WARNING: This creates an unencrypted database. Sensitive MLS state including exporter secrets will be stored in plaintext. Only use this for development or testing.

For production use, use Self::new or Self::new_with_key instead.

§Arguments
  • file_path - Path to the SQLite database file.
§Returns

A Result containing a new instance of MdkSqliteStorage or an error.

§Example
use mdk_sqlite_storage::MdkSqliteStorage;

// ⚠️ Unencrypted - for development only
let storage = MdkSqliteStorage::new_unencrypted("/path/to/db.sqlite")?;

Trait Implementations§

Source§

impl GroupStorage for MdkSqliteStorage

Source§

fn all_groups(&self) -> Result<Vec<Group>, GroupError>

Get all groups
Source§

fn find_group_by_mls_group_id( &self, mls_group_id: &GroupId, ) -> Result<Option<Group>, GroupError>

Find a group by MLS group ID
Source§

fn find_group_by_nostr_group_id( &self, nostr_group_id: &[u8; 32], ) -> Result<Option<Group>, GroupError>

Find a group by Nostr group ID
Source§

fn save_group(&self, group: Group) -> Result<(), GroupError>

Save a group
Source§

fn messages( &self, mls_group_id: &GroupId, pagination: Option<Pagination>, ) -> Result<Vec<Message>, GroupError>

Get messages for a group with optional pagination and sort order Read more
Source§

fn last_message( &self, mls_group_id: &GroupId, sort_order: MessageSortOrder, ) -> Result<Option<Message>, GroupError>

Get the most recent message in a group according to the given sort order. Read more
Source§

fn admins( &self, mls_group_id: &GroupId, ) -> Result<BTreeSet<PublicKey>, GroupError>

Get all admins for a group
Source§

fn group_relays( &self, mls_group_id: &GroupId, ) -> Result<BTreeSet<GroupRelay>, GroupError>

Get all relays for a group
Source§

fn replace_group_relays( &self, group_id: &GroupId, relays: BTreeSet<RelayUrl>, ) -> Result<(), GroupError>

Replace all relays for a group with the provided set This operation is atomic - either all relays are replaced or none are changed
Source§

fn get_group_exporter_secret( &self, mls_group_id: &GroupId, epoch: u64, ) -> Result<Option<GroupExporterSecret>, GroupError>

Get a MIP-03 group-event exporter secret for a group and epoch. Read more
Source§

fn save_group_exporter_secret( &self, group_exporter_secret: GroupExporterSecret, ) -> Result<(), GroupError>

Save a MIP-03 group-event exporter secret for a group and epoch.
Source§

fn get_group_mip04_exporter_secret( &self, mls_group_id: &GroupId, epoch: u64, ) -> Result<Option<GroupExporterSecret>, GroupError>

Get a MIP-04 encrypted-media exporter secret for a group and epoch. Read more
Source§

fn save_group_mip04_exporter_secret( &self, group_exporter_secret: GroupExporterSecret, ) -> Result<(), GroupError>

Save a MIP-04 encrypted-media exporter secret for a group and epoch.
Source§

fn prune_group_exporter_secrets_before_epoch( &self, group_id: &GroupId, min_epoch_to_keep: u64, ) -> Result<(), GroupError>

Prune exporter secrets older than min_epoch_to_keep for the group. Read more
Source§

fn groups_needing_self_update( &self, threshold_secs: u64, ) -> Result<Vec<GroupId>, GroupError>

Returns active groups that need a self-update: either because self_update_state is SelfUpdateState::Required (post-join requirement per MIP-02) or because the last self-update is older than threshold_secs seconds ago (periodic rotation per MIP-00).
Source§

impl MdkStorageProvider for MdkSqliteStorage

Implementation of MdkStorageProvider for SQLite-based storage.

Source§

fn backend(&self) -> Backend

Returns the backend type.

§Returns

Backend::SQLite indicating this is a SQLite-based storage implementation.

Source§

fn create_group_snapshot( &self, group_id: &GroupId, name: &str, ) -> Result<(), MdkStorageError>

Create a snapshot of a group’s state before applying a commit. Read more
Source§

fn rollback_group_to_snapshot( &self, group_id: &GroupId, name: &str, ) -> Result<(), MdkStorageError>

Rollback a group’s state to a previously created snapshot. Read more
Source§

fn release_group_snapshot( &self, group_id: &GroupId, name: &str, ) -> Result<(), MdkStorageError>

Release a snapshot that is no longer needed. Read more
Source§

fn list_group_snapshots( &self, group_id: &GroupId, ) -> Result<Vec<(String, u64)>, MdkStorageError>

List all snapshots for a specific group with their creation timestamps. Read more
Source§

fn prune_expired_snapshots( &self, min_timestamp: u64, ) -> Result<usize, MdkStorageError>

Prune all snapshots created before the given Unix timestamp. Read more
Source§

impl MessageStorage for MdkSqliteStorage

Source§

fn save_message(&self, message: Message) -> Result<(), MessageError>

Save a message
Source§

fn find_message_by_event_id( &self, mls_group_id: &GroupId, event_id: &EventId, ) -> Result<Option<Message>, MessageError>

Find a message by event ID within a specific group Read more
Source§

fn save_processed_message( &self, processed_message: ProcessedMessage, ) -> Result<(), MessageError>

Save a processed message
Source§

fn find_processed_message_by_event_id( &self, event_id: &EventId, ) -> Result<Option<ProcessedMessage>, MessageError>

Find a processed message by event ID
Source§

fn invalidate_messages_after_epoch( &self, group_id: &GroupId, epoch: u64, ) -> Result<Vec<EventId>, MessageError>

Mark messages with epoch > target as EpochInvalidated Returns EventIds of invalidated messages
Source§

fn invalidate_processed_messages_after_epoch( &self, group_id: &GroupId, epoch: u64, ) -> Result<Vec<EventId>, MessageError>

Mark processed_messages with epoch > target as EpochInvalidated Returns wrapper EventIds of invalidated records
Source§

fn find_invalidated_messages( &self, group_id: &GroupId, ) -> Result<Vec<Message>, MessageError>

Find messages in EpochInvalidated state (for UI filtering or reprocessing)
Source§

fn find_invalidated_processed_messages( &self, group_id: &GroupId, ) -> Result<Vec<ProcessedMessage>, MessageError>

Find processed_messages in EpochInvalidated state
Source§

fn find_failed_messages_for_retry( &self, group_id: &GroupId, ) -> Result<Vec<EventId>, MessageError>

Find failed processed messages that may be retryable after a rollback. Read more
Source§

fn mark_processed_message_retryable( &self, event_id: &EventId, ) -> Result<(), MessageError>

Mark a processed message as retryable. Read more
Source§

fn find_message_epoch_by_tag_content( &self, group_id: &GroupId, content_substring: &str, ) -> Result<Option<u64>, MessageError>

Find the epoch of a message whose tags contain the given substring. Read more
Source§

impl StorageProvider<STORAGE_PROVIDER_VERSION> for MdkSqliteStorage

Source§

type Error = MdkStorageError

An opaque error returned by all methods on this trait.
Source§

fn write_mls_join_config<GroupId, MlsGroupJoinConfig>( &self, group_id: &GroupId, config: &MlsGroupJoinConfig, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, MlsGroupJoinConfig: MlsGroupJoinConfig<STORAGE_PROVIDER_VERSION>,

Writes the MlsGroupJoinConfig for the group with given id to storage
Source§

fn append_own_leaf_node<GroupId, LeafNode>( &self, group_id: &GroupId, leaf_node: &LeafNode, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, LeafNode: LeafNode<STORAGE_PROVIDER_VERSION>,

Adds an own leaf node for the group with given id to storage
Source§

fn queue_proposal<GroupId, ProposalRef, QueuedProposal>( &self, group_id: &GroupId, proposal_ref: &ProposalRef, proposal: &QueuedProposal, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, ProposalRef: ProposalRef<STORAGE_PROVIDER_VERSION>, QueuedProposal: QueuedProposal<STORAGE_PROVIDER_VERSION>,

Enqueue a proposal. Read more
Source§

fn write_tree<GroupId, TreeSync>( &self, group_id: &GroupId, tree: &TreeSync, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, TreeSync: TreeSync<STORAGE_PROVIDER_VERSION>,

Write the TreeSync tree.
Source§

fn write_interim_transcript_hash<GroupId, InterimTranscriptHash>( &self, group_id: &GroupId, interim_transcript_hash: &InterimTranscriptHash, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, InterimTranscriptHash: InterimTranscriptHash<STORAGE_PROVIDER_VERSION>,

Write the interim transcript hash.
Source§

fn write_context<GroupId, GroupContext>( &self, group_id: &GroupId, group_context: &GroupContext, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, GroupContext: GroupContext<STORAGE_PROVIDER_VERSION>,

Write the group context.
Source§

fn write_confirmation_tag<GroupId, ConfirmationTag>( &self, group_id: &GroupId, confirmation_tag: &ConfirmationTag, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, ConfirmationTag: ConfirmationTag<STORAGE_PROVIDER_VERSION>,

Write the confirmation tag.
Source§

fn write_group_state<GroupState, GroupId>( &self, group_id: &GroupId, group_state: &GroupState, ) -> Result<(), Self::Error>
where GroupState: GroupState<STORAGE_PROVIDER_VERSION>, GroupId: GroupId<STORAGE_PROVIDER_VERSION>,

Writes the MlsGroupState for group with given id.
Source§

fn write_message_secrets<GroupId, MessageSecrets>( &self, group_id: &GroupId, message_secrets: &MessageSecrets, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, MessageSecrets: MessageSecrets<STORAGE_PROVIDER_VERSION>,

Writes the MessageSecretsStore for the group with the given id.
Source§

fn write_resumption_psk_store<GroupId, ResumptionPskStore>( &self, group_id: &GroupId, resumption_psk_store: &ResumptionPskStore, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, ResumptionPskStore: ResumptionPskStore<STORAGE_PROVIDER_VERSION>,

Writes the ResumptionPskStore for the group with the given id.
Source§

fn write_own_leaf_index<GroupId, LeafNodeIndex>( &self, group_id: &GroupId, own_leaf_index: &LeafNodeIndex, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, LeafNodeIndex: LeafNodeIndex<STORAGE_PROVIDER_VERSION>,

Writes the own leaf index inside the group for the group with the given id.
Source§

fn write_group_epoch_secrets<GroupId, GroupEpochSecrets>( &self, group_id: &GroupId, group_epoch_secrets: &GroupEpochSecrets, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, GroupEpochSecrets: GroupEpochSecrets<STORAGE_PROVIDER_VERSION>,

Writes the GroupEpochSecrets for the group with the given id.
Source§

fn write_signature_key_pair<SignaturePublicKey, SignatureKeyPair>( &self, public_key: &SignaturePublicKey, signature_key_pair: &SignatureKeyPair, ) -> Result<(), Self::Error>
where SignaturePublicKey: SignaturePublicKey<STORAGE_PROVIDER_VERSION>, SignatureKeyPair: SignatureKeyPair<STORAGE_PROVIDER_VERSION>,

Store a signature key. Read more
Source§

fn write_encryption_key_pair<EncryptionKey, HpkeKeyPair>( &self, public_key: &EncryptionKey, key_pair: &HpkeKeyPair, ) -> Result<(), Self::Error>
where EncryptionKey: EncryptionKey<STORAGE_PROVIDER_VERSION>, HpkeKeyPair: HpkeKeyPair<STORAGE_PROVIDER_VERSION>,

Store an HPKE encryption key pair. This includes the private and public key Read more
Source§

fn write_encryption_epoch_key_pairs<GroupId, EpochKey, HpkeKeyPair>( &self, group_id: &GroupId, epoch: &EpochKey, leaf_index: u32, key_pairs: &[HpkeKeyPair], ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, EpochKey: EpochKey<STORAGE_PROVIDER_VERSION>, HpkeKeyPair: HpkeKeyPair<STORAGE_PROVIDER_VERSION>,

Store a list of HPKE encryption key pairs for a given epoch. This includes the private and public keys.
Source§

fn write_key_package<HashReference, KeyPackage>( &self, hash_ref: &HashReference, key_package: &KeyPackage, ) -> Result<(), Self::Error>
where HashReference: HashReference<STORAGE_PROVIDER_VERSION>, KeyPackage: KeyPackage<STORAGE_PROVIDER_VERSION>,

Store key packages. Read more
Source§

fn write_psk<PskId, PskBundle>( &self, psk_id: &PskId, psk: &PskBundle, ) -> Result<(), Self::Error>
where PskId: PskId<STORAGE_PROVIDER_VERSION>, PskBundle: PskBundle<STORAGE_PROVIDER_VERSION>,

Store a PSK. Read more
Source§

fn mls_group_join_config<GroupId, MlsGroupJoinConfig>( &self, group_id: &GroupId, ) -> Result<Option<MlsGroupJoinConfig>, Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, MlsGroupJoinConfig: MlsGroupJoinConfig<STORAGE_PROVIDER_VERSION>,

Returns the MlsGroupJoinConfig for the group with given id
Source§

fn own_leaf_nodes<GroupId, LeafNode>( &self, group_id: &GroupId, ) -> Result<Vec<LeafNode>, Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, LeafNode: LeafNode<STORAGE_PROVIDER_VERSION>,

Returns the own leaf nodes for the group with given id
Source§

fn queued_proposal_refs<GroupId, ProposalRef>( &self, group_id: &GroupId, ) -> Result<Vec<ProposalRef>, Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, ProposalRef: ProposalRef<STORAGE_PROVIDER_VERSION>,

Returns references of all queued proposals for the group with group id group_id, or an empty vector of none are stored.
Source§

fn queued_proposals<GroupId, ProposalRef, QueuedProposal>( &self, group_id: &GroupId, ) -> Result<Vec<(ProposalRef, QueuedProposal)>, Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, ProposalRef: ProposalRef<STORAGE_PROVIDER_VERSION>, QueuedProposal: QueuedProposal<STORAGE_PROVIDER_VERSION>,

Returns all queued proposals for the group with group id group_id, or an empty vector of none are stored.
Source§

fn tree<GroupId, TreeSync>( &self, group_id: &GroupId, ) -> Result<Option<TreeSync>, Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, TreeSync: TreeSync<STORAGE_PROVIDER_VERSION>,

Returns the TreeSync tree for the group with group id group_id.
Source§

fn group_context<GroupId, GroupContext>( &self, group_id: &GroupId, ) -> Result<Option<GroupContext>, Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, GroupContext: GroupContext<STORAGE_PROVIDER_VERSION>,

Returns the group context for the group with group id group_id.
Source§

fn interim_transcript_hash<GroupId, InterimTranscriptHash>( &self, group_id: &GroupId, ) -> Result<Option<InterimTranscriptHash>, Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, InterimTranscriptHash: InterimTranscriptHash<STORAGE_PROVIDER_VERSION>,

Returns the interim transcript hash for the group with group id group_id.
Source§

fn confirmation_tag<GroupId, ConfirmationTag>( &self, group_id: &GroupId, ) -> Result<Option<ConfirmationTag>, Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, ConfirmationTag: ConfirmationTag<STORAGE_PROVIDER_VERSION>,

Returns the confirmation tag for the group with group id group_id.
Source§

fn group_state<GroupState, GroupId>( &self, group_id: &GroupId, ) -> Result<Option<GroupState>, Self::Error>
where GroupState: GroupState<STORAGE_PROVIDER_VERSION>, GroupId: GroupId<STORAGE_PROVIDER_VERSION>,

Returns the group state for the group with group id group_id.
Source§

fn message_secrets<GroupId, MessageSecrets>( &self, group_id: &GroupId, ) -> Result<Option<MessageSecrets>, Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, MessageSecrets: MessageSecrets<STORAGE_PROVIDER_VERSION>,

Returns the MessageSecretsStore for the group with the given id.
Source§

fn resumption_psk_store<GroupId, ResumptionPskStore>( &self, group_id: &GroupId, ) -> Result<Option<ResumptionPskStore>, Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, ResumptionPskStore: ResumptionPskStore<STORAGE_PROVIDER_VERSION>,

Returns the ResumptionPskStore for the group with the given id. Read more
Source§

fn own_leaf_index<GroupId, LeafNodeIndex>( &self, group_id: &GroupId, ) -> Result<Option<LeafNodeIndex>, Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, LeafNodeIndex: LeafNodeIndex<STORAGE_PROVIDER_VERSION>,

Returns the own leaf index inside the group for the group with the given id.
Source§

fn group_epoch_secrets<GroupId, GroupEpochSecrets>( &self, group_id: &GroupId, ) -> Result<Option<GroupEpochSecrets>, Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, GroupEpochSecrets: GroupEpochSecrets<STORAGE_PROVIDER_VERSION>,

Returns the GroupEpochSecrets for the group with the given id.
Source§

fn signature_key_pair<SignaturePublicKey, SignatureKeyPair>( &self, public_key: &SignaturePublicKey, ) -> Result<Option<SignatureKeyPair>, Self::Error>
where SignaturePublicKey: SignaturePublicKey<STORAGE_PROVIDER_VERSION>, SignatureKeyPair: SignatureKeyPair<STORAGE_PROVIDER_VERSION>,

Get a signature key based on the public key. Read more
Source§

fn encryption_key_pair<HpkeKeyPair, EncryptionKey>( &self, public_key: &EncryptionKey, ) -> Result<Option<HpkeKeyPair>, Self::Error>
where HpkeKeyPair: HpkeKeyPair<STORAGE_PROVIDER_VERSION>, EncryptionKey: EncryptionKey<STORAGE_PROVIDER_VERSION>,

Get an HPKE encryption key pair based on the public key. Read more
Source§

fn encryption_epoch_key_pairs<GroupId, EpochKey, HpkeKeyPair>( &self, group_id: &GroupId, epoch: &EpochKey, leaf_index: u32, ) -> Result<Vec<HpkeKeyPair>, Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, EpochKey: EpochKey<STORAGE_PROVIDER_VERSION>, HpkeKeyPair: HpkeKeyPair<STORAGE_PROVIDER_VERSION>,

Get a list of HPKE encryption key pairs for a given epoch. This includes the private and public keys.
Source§

fn key_package<HashReference, KeyPackage>( &self, hash_ref: &HashReference, ) -> Result<Option<KeyPackage>, Self::Error>
where HashReference: HashReference<STORAGE_PROVIDER_VERSION>, KeyPackage: KeyPackage<STORAGE_PROVIDER_VERSION>,

Get a key package based on its hash reference.
Source§

fn psk<PskBundle, PskId>( &self, psk_id: &PskId, ) -> Result<Option<PskBundle>, Self::Error>
where PskBundle: PskBundle<STORAGE_PROVIDER_VERSION>, PskId: PskId<STORAGE_PROVIDER_VERSION>,

Get a PSK based on the PSK identifier.
Source§

fn remove_proposal<GroupId, ProposalRef>( &self, group_id: &GroupId, proposal_ref: &ProposalRef, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, ProposalRef: ProposalRef<STORAGE_PROVIDER_VERSION>,

Removes an individual proposal from the proposal queue of the group with the provided id
Source§

fn delete_own_leaf_nodes<GroupId>( &self, group_id: &GroupId, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>,

Deletes own leaf nodes for the given id from storage
Source§

fn delete_group_config<GroupId>( &self, group_id: &GroupId, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>,

Deletes the MlsGroupJoinConfig for the given id from storage
Source§

fn delete_tree<GroupId>(&self, group_id: &GroupId) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>,

Deletes the tree from storage
Source§

fn delete_confirmation_tag<GroupId>( &self, group_id: &GroupId, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>,

Deletes the confirmation tag from storage
Source§

fn delete_group_state<GroupId>( &self, group_id: &GroupId, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>,

Deletes the MlsGroupState for group with given id.
Source§

fn delete_context<GroupId>(&self, group_id: &GroupId) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>,

Deletes the group context for the group with given id
Source§

fn delete_interim_transcript_hash<GroupId>( &self, group_id: &GroupId, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>,

Deletes the interim transcript hash for the group with given id
Source§

fn delete_message_secrets<GroupId>( &self, group_id: &GroupId, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>,

Deletes the MessageSecretsStore for the group with the given id.
Source§

fn delete_all_resumption_psk_secrets<GroupId>( &self, group_id: &GroupId, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>,

Deletes the ResumptionPskStore for the group with the given id.
Source§

fn delete_own_leaf_index<GroupId>( &self, group_id: &GroupId, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>,

Deletes the own leaf index inside the group for the group with the given id.
Source§

fn delete_group_epoch_secrets<GroupId>( &self, group_id: &GroupId, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>,

Deletes the GroupEpochSecrets for the group with the given id.
Source§

fn clear_proposal_queue<GroupId, ProposalRef>( &self, group_id: &GroupId, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, ProposalRef: ProposalRef<STORAGE_PROVIDER_VERSION>,

Clear the proposal queue for the group with the given id.
Source§

fn delete_signature_key_pair<SignaturePublicKey>( &self, public_key: &SignaturePublicKey, ) -> Result<(), Self::Error>
where SignaturePublicKey: SignaturePublicKey<STORAGE_PROVIDER_VERSION>,

Delete a signature key pair based on its public key Read more
Source§

fn delete_encryption_key_pair<EncryptionKey>( &self, public_key: &EncryptionKey, ) -> Result<(), Self::Error>
where EncryptionKey: EncryptionKey<STORAGE_PROVIDER_VERSION>,

Delete an encryption key pair for a public key. Read more
Source§

fn delete_encryption_epoch_key_pairs<GroupId, EpochKey>( &self, group_id: &GroupId, epoch: &EpochKey, leaf_index: u32, ) -> Result<(), Self::Error>
where GroupId: GroupId<STORAGE_PROVIDER_VERSION>, EpochKey: EpochKey<STORAGE_PROVIDER_VERSION>,

Delete a list of HPKE encryption key pairs for a given epoch. This includes the private and public keys.
Source§

fn delete_key_package<HashReference>( &self, hash_ref: &HashReference, ) -> Result<(), Self::Error>
where HashReference: HashReference<STORAGE_PROVIDER_VERSION>,

Delete a key package based on the hash reference. Read more
Source§

fn delete_psk<PskId>(&self, psk_id: &PskId) -> Result<(), Self::Error>
where PskId: PskId<STORAGE_PROVIDER_VERSION>,

Delete a PSK based on an identifier.
Source§

fn version() -> u16

Get the version of this provider.
Source§

impl WelcomeStorage for MdkSqliteStorage

Source§

fn save_welcome(&self, welcome: Welcome) -> Result<(), WelcomeError>

Save a welcome
Source§

fn find_welcome_by_event_id( &self, event_id: &EventId, ) -> Result<Option<Welcome>, WelcomeError>

Find a welcome by event ID
Source§

fn pending_welcomes( &self, pagination: Option<Pagination>, ) -> Result<Vec<Welcome>, WelcomeError>

Get pending welcomes with optional pagination Read more
Source§

fn save_processed_welcome( &self, processed_welcome: ProcessedWelcome, ) -> Result<(), WelcomeError>

Save a processed welcome
Source§

fn find_processed_welcome_by_event_id( &self, event_id: &EventId, ) -> Result<Option<ProcessedWelcome>, WelcomeError>

Find a processed welcome by event ID

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, const VERSION: u16> PublicStorageProvider<VERSION> for T
where T: StorageProvider<VERSION>,

Source§

type PublicError = <T as StorageProvider<VERSION>>::Error

An opaque error returned by all methods on this trait.
Source§

fn write_tree<GroupId, TreeSync>( &self, group_id: &GroupId, tree: &TreeSync, ) -> Result<(), <T as PublicStorageProvider<VERSION>>::PublicError>
where GroupId: GroupId<VERSION>, TreeSync: TreeSync<VERSION>,

Write the TreeSync tree.
Source§

fn write_interim_transcript_hash<GroupId, InterimTranscriptHash>( &self, group_id: &GroupId, interim_transcript_hash: &InterimTranscriptHash, ) -> Result<(), <T as PublicStorageProvider<VERSION>>::PublicError>
where GroupId: GroupId<VERSION>, InterimTranscriptHash: InterimTranscriptHash<VERSION>,

Write the interim transcript hash.
Source§

fn write_context<GroupId, GroupContext>( &self, group_id: &GroupId, group_context: &GroupContext, ) -> Result<(), <T as PublicStorageProvider<VERSION>>::PublicError>
where GroupId: GroupId<VERSION>, GroupContext: GroupContext<VERSION>,

Write the group context.
Source§

fn write_confirmation_tag<GroupId, ConfirmationTag>( &self, group_id: &GroupId, confirmation_tag: &ConfirmationTag, ) -> Result<(), <T as PublicStorageProvider<VERSION>>::PublicError>
where GroupId: GroupId<VERSION>, ConfirmationTag: ConfirmationTag<VERSION>,

Write the confirmation tag.
Source§

fn queue_proposal<GroupId, ProposalRef, QueuedProposal>( &self, group_id: &GroupId, proposal_ref: &ProposalRef, proposal: &QueuedProposal, ) -> Result<(), <T as PublicStorageProvider<VERSION>>::PublicError>
where GroupId: GroupId<VERSION>, ProposalRef: ProposalRef<VERSION>, QueuedProposal: QueuedProposal<VERSION>,

Enqueue a proposal.
Source§

fn queued_proposals<GroupId, ProposalRef, QueuedProposal>( &self, group_id: &GroupId, ) -> Result<Vec<(ProposalRef, QueuedProposal)>, <T as PublicStorageProvider<VERSION>>::PublicError>
where GroupId: GroupId<VERSION>, ProposalRef: ProposalRef<VERSION>, QueuedProposal: QueuedProposal<VERSION>,

Returns all queued proposals for the group with group id group_id, or an empty vector of none are stored.
Source§

fn tree<GroupId, TreeSync>( &self, group_id: &GroupId, ) -> Result<Option<TreeSync>, <T as PublicStorageProvider<VERSION>>::PublicError>
where GroupId: GroupId<VERSION>, TreeSync: TreeSync<VERSION>,

Returns the TreeSync tree for the group with group id group_id.
Source§

fn group_context<GroupId, GroupContext>( &self, group_id: &GroupId, ) -> Result<Option<GroupContext>, <T as PublicStorageProvider<VERSION>>::PublicError>
where GroupId: GroupId<VERSION>, GroupContext: GroupContext<VERSION>,

Returns the group context for the group with group id group_id.
Source§

fn interim_transcript_hash<GroupId, InterimTranscriptHash>( &self, group_id: &GroupId, ) -> Result<Option<InterimTranscriptHash>, <T as PublicStorageProvider<VERSION>>::PublicError>
where GroupId: GroupId<VERSION>, InterimTranscriptHash: InterimTranscriptHash<VERSION>,

Returns the interim transcript hash for the group with group id group_id.
Source§

fn confirmation_tag<GroupId, ConfirmationTag>( &self, group_id: &GroupId, ) -> Result<Option<ConfirmationTag>, <T as PublicStorageProvider<VERSION>>::PublicError>
where GroupId: GroupId<VERSION>, ConfirmationTag: ConfirmationTag<VERSION>,

Returns the confirmation tag for the group with group id group_id.
Source§

fn delete_tree<GroupId>( &self, group_id: &GroupId, ) -> Result<(), <T as PublicStorageProvider<VERSION>>::PublicError>
where GroupId: GroupId<VERSION>,

Deletes the tree from storage
Source§

fn delete_confirmation_tag<GroupId>( &self, group_id: &GroupId, ) -> Result<(), <T as PublicStorageProvider<VERSION>>::PublicError>
where GroupId: GroupId<VERSION>,

Deletes the confirmation tag from storage
Source§

fn delete_context<GroupId>( &self, group_id: &GroupId, ) -> Result<(), <T as PublicStorageProvider<VERSION>>::PublicError>
where GroupId: GroupId<VERSION>,

Deletes the group context for the group with given id
Source§

fn delete_interim_transcript_hash<GroupId>( &self, group_id: &GroupId, ) -> Result<(), <T as PublicStorageProvider<VERSION>>::PublicError>
where GroupId: GroupId<VERSION>,

Deletes the interim transcript hash for the group with given id
Source§

fn remove_proposal<GroupId, ProposalRef>( &self, group_id: &GroupId, proposal_ref: &ProposalRef, ) -> Result<(), <T as PublicStorageProvider<VERSION>>::PublicError>
where GroupId: GroupId<VERSION>, ProposalRef: ProposalRef<VERSION>,

Removes an individual proposal from the proposal queue of the group with the provided id
Source§

fn clear_proposal_queue<GroupId, ProposalRef>( &self, group_id: &GroupId, ) -> Result<(), <T as PublicStorageProvider<VERSION>>::PublicError>
where GroupId: GroupId<VERSION>, ProposalRef: ProposalRef<VERSION>,

Clear the proposal queue for the group with the given id.
Source§

fn version() -> u16

Get the version of this provider.
Source§

impl<P> PublicStorageProvider for P
where P: PublicStorageProvider<openmls::::storage::{impl#1}::{constant#0}>,

Source§

type Error = <P as PublicStorageProvider<openmls::::storage::{impl#1}::{constant#0}>>::PublicError

An opaque error returned by all methods on this trait. Matches PublicError from openmls_traits::storage::PublicStorageProvider.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<P> StorageProvider for P
where P: StorageProvider<openmls::::storage::{impl#0}::{constant#0}>,