Skip to main content

MdkMemoryStorage

Struct MdkMemoryStorage 

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

A memory-based storage implementation for MDK.

This struct implements both the OpenMLS StorageProvider<1> trait and MDK storage traits directly, providing unified storage for MLS cryptographic state and MDK-specific data (groups, messages, welcomes).

§Unified Storage Architecture

This implementation stores all MLS and MDK state in-memory, providing:

  • Snapshot/restore operations for rollback scenarios
  • Thread-safe access through RwLock protected data structures
  • LRU caching for frequently accessed MDK objects

Concurrency: Snapshot and restore operations are atomic. create_snapshot() acquires a global read lock and restore_snapshot() acquires a global write lock on the storage state, ensuring consistency in multi-threaded environments.

§Caching Strategy

This implementation uses an LRU (Least Recently Used) caching mechanism to store frequently accessed objects in memory for faster retrieval. The caches are protected by RwLocks to ensure thread safety while allowing concurrent reads.

  • Each cache has a configurable size limit (default: 1000 items)
  • When a cache reaches its size limit, the least recently used items will be evicted

§Thread Safety

All caches are protected by RwLocks, which allow:

  • Multiple concurrent readers (for find/get operations)
  • Exclusive writers (for create/save/delete operations)

This approach optimizes for read-heavy workloads while still ensuring data consistency.

§Configurable Validation Limits

You can customize validation limits using ValidationLimits:

use mdk_memory_storage::{MdkMemoryStorage, ValidationLimits};

let limits = ValidationLimits::default()
    .with_cache_size(2000)
    .with_max_messages_per_group(5000);

let storage = MdkMemoryStorage::with_limits(limits);

Implementations§

Source§

impl MdkMemoryStorage

Source

pub fn new() -> Self

Creates a new MdkMemoryStorage with the default configuration.

§Returns

A new instance of MdkMemoryStorage with the default cache size.

Source

pub fn with_cache_size(cache_size: NonZeroUsize) -> Self

Creates a new MdkMemoryStorage with the specified cache size.

§Arguments
  • cache_size - The maximum number of items to store in each LRU cache.
§Returns

A new instance of MdkMemoryStorage with the specified cache size.

Source

pub fn with_limits(limits: ValidationLimits) -> Self

Creates a new MdkMemoryStorage with the provided validation limits.

§Arguments
  • limits - Custom validation limits for memory exhaustion protection.
§Returns

A new instance of MdkMemoryStorage.

Source

pub fn create_snapshot(&self) -> MemoryStorageSnapshot

Creates a snapshot of all in-memory state.

This enables rollback functionality similar to SQLite savepoints.

§Concurrency

This operation is atomic. It acquires a global read lock on the storage state, ensuring a consistent snapshot even in multi-threaded environments.

§Returns

A MemoryStorageSnapshot containing cloned copies of all state.

Source

pub fn restore_snapshot(&self, snapshot: MemoryStorageSnapshot)

Restores state from a previously created snapshot.

This replaces all current in-memory state with the state from the snapshot.

§Concurrency

This operation is atomic. It acquires a global write lock on the storage state, ensuring that the restore is consistent even in multi-threaded environments.

§Arguments
  • snapshot - The snapshot to restore from.
Source

pub fn create_group_scoped_snapshot( &self, group_id: &GroupId, ) -> GroupScopedSnapshot

Creates a snapshot containing only data for a specific group.

This is used by the MdkStorageProvider::create_group_snapshot trait method to create rollback points that don’t affect other groups. Unlike create_snapshot() which captures ALL data, this only captures data belonging to the specified group.

§Concurrency

This operation is atomic. It acquires a global read lock on the storage state, ensuring a consistent snapshot even in multi-threaded environments.

§Arguments
  • group_id - The group to create a snapshot for.
§Returns

A GroupScopedSnapshot containing cloned copies of all state for that group.

Source

pub fn restore_group_scoped_snapshot(&self, snapshot: GroupScopedSnapshot)

Restores state for a specific group from a previously created group-scoped snapshot.

This replaces all current in-memory state for the specified group with the state from the snapshot, leaving all other groups unaffected.

§Concurrency

This operation is atomic. It acquires a global write lock on the storage state, ensuring that the restore is consistent even in multi-threaded environments.

§Arguments
  • snapshot - The group-scoped snapshot to restore from.
Source

pub fn limits(&self) -> &ValidationLimits

Returns the current validation limits.

Trait Implementations§

Source§

impl Debug for MdkMemoryStorage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MdkMemoryStorage

Source§

fn default() -> Self

Creates a new MdkMemoryStorage with default configuration.

§Returns

A new instance of MdkMemoryStorage with the default cache size.

Source§

impl GroupStorage for MdkMemoryStorage

Source§

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

Save a group
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 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 MdkMemoryStorage

Implementation of MdkStorageProvider for memory-based storage.

Source§

fn backend(&self) -> Backend

Returns the backend type.

§Returns

Backend::Memory indicating this is a memory-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 MdkMemoryStorage

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 find_processed_message_by_event_id( &self, event_id: &EventId, ) -> Result<Option<ProcessedMessage>, MessageError>

Find a processed message by event ID
Source§

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

Save a processed message
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 MdkMemoryStorage

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 MdkMemoryStorage

Source§

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

Save a welcome
Source§

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

Get pending welcomes with optional pagination Read more
Source§

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

Find a welcome by event ID
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, 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<P> StorageProvider for P
where P: StorageProvider<openmls::::storage::{impl#0}::{constant#0}>,