Skip to main content

OrgKeyDirectory

Trait OrgKeyDirectory 

Source
pub trait OrgKeyDirectory {
    // Required methods
    fn publish_wrapped(
        &mut self,
        wrapped: &WrappedOrgKey,
    ) -> Result<(), OrgKeyDirectoryError>;
    fn fetch_wrapped(
        &self,
        epoch: u64,
        recipient_user_id: &str,
    ) -> Result<Option<WrappedOrgKey>, OrgKeyDirectoryError>;
    fn fetch_wrapped_for(
        &self,
        recipient_user_id: &str,
    ) -> Result<Vec<WrappedOrgKey>, OrgKeyDirectoryError>;
    fn publish_pubkey(
        &mut self,
        account_id: &str,
        public_hex: &str,
    ) -> Result<(), OrgKeyDirectoryError>;
    fn fetch_pubkeys(
        &self,
    ) -> Result<Vec<MemberPublicKey>, OrgKeyDirectoryError>;
}
Expand description

The publish/fetch surface for one org’s directory.

Single-directory (no org param) — one handle serves one org, mirroring crate::relay::Relay. &mut self because the fs-backed reference takes an exclusive file lock and persists on write.

Required Methods§

Source

fn publish_wrapped( &mut self, wrapped: &WrappedOrgKey, ) -> Result<(), OrgKeyDirectoryError>

Publish (or replace) the wrap for (wrapped.epoch, wrapped.recipient). Last-write-wins — re-publishing a fresh wrap of the same K_org (a new ephemeral each time) for a recipient is expected and benign.

Source

fn fetch_wrapped( &self, epoch: u64, recipient_user_id: &str, ) -> Result<Option<WrappedOrgKey>, OrgKeyDirectoryError>

Fetch the wrap addressed to recipient_user_id at exactly epoch, if one has been published. Reads are pure (&self) — unlike crate::relay::Relay, this type has no per-call roster/checkpoint reconciliation, so a fetch never rewrites state (the fs reference takes a shared lock and returns; no fsync-on-read).

Source

fn fetch_wrapped_for( &self, recipient_user_id: &str, ) -> Result<Vec<WrappedOrgKey>, OrgKeyDirectoryError>

Every wrap addressed to recipient_user_id, newest epoch first — the client picks the highest epoch it can crate::crypto::unwrap_org_key.

Source

fn publish_pubkey( &mut self, account_id: &str, public_hex: &str, ) -> Result<(), OrgKeyDirectoryError>

Publish (or replace) account_id’s X25519 public key.

Source

fn fetch_pubkeys(&self) -> Result<Vec<MemberPublicKey>, OrgKeyDirectoryError>

Every member public key in this directory, ordered by account_id.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§