Skip to main content

UserStore

Trait UserStore 

Source
pub trait UserStore:
    Sealed
    + Send
    + Sync {
Show 20 methods // Required methods fn get_profile<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<UserProfile>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn register<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn set_profile<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, patch: UserProfilePatch, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn remove<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list_users<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn search<'life0, 'life1, 'async_trait>( &'life0 self, filter: &'life1 UserFilter, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, UserProfile)>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn set_active<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, active: bool, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn list_pubkeys<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<PubkeyEntry>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn add_pubkey<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, pubkey: VerifyingKey, label: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn add_pubkey_hybrid<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, pubkey: VerifyingKey, ml_dsa_vk: Vec<u8>, label: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn remove_pubkey<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, username: &'life1 str, fingerprint: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; fn get_pubkey_user<'life0, 'life1, 'async_trait>( &'life0 self, fingerprint: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait; fn touch_pubkey<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, username: &'life1 str, fingerprint: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait; // Provided methods fn resolve_or_bind_external_idp<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _issuer: &'life1 str, _subject: &'life2 str, _username: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<ExternalIdentityResolution>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait { ... } fn bind_existing_external_idp_to_hosted_account<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, _issuer: &'life1 str, _subject: &'life2 str, _username: &'life3 str, _expected_hosted_did: &'life4 str, ) -> Pin<Box<dyn Future<Output = Result<ExternalIdentityResolution>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait { ... } fn provision_hosted_account<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _username: &'life1 str, _atproto_did: &'life2 str, _pubkey: VerifyingKey, _custody: AccountKeyCustody, ) -> Pin<Box<dyn Future<Output = Result<HostedAccountProvisioning, HostedAccountProvisionError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn activate_hosted_account<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _username: &'life1 str, _atproto_did: &'life2 str, _fingerprint: &'life3 str, _custody: AccountKeyCustody, ) -> Pin<Box<dyn Future<Output = Result<(), HostedAccountProvisionError>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait { ... } fn list_external_identities<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<ExternalIdentityBinding>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... } fn get_external_identity_user<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, issuer: &'life1 str, subject: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait { ... } fn get_username_by_atproto_did<'life0, 'life1, 'async_trait>( &'life0 self, did: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait { ... }
}
Expand description

Abstraction over user credential stores.

Supports profile CRUD and multi-pubkey management (like GitHub SSH keys).

Required Methods§

Source

fn get_profile<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<UserProfile>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Get a user’s profile (OIDC claims).

Source

fn register<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Register a new user. Returns the generated subject UUID.

Source

fn set_profile<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, patch: UserProfilePatch, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update a user’s profile fields with tri-state patch semantics.

Source

fn remove<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove a user and all their pubkeys.

Source

fn list_users<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all registered usernames.

Source

fn search<'life0, 'life1, 'async_trait>( &'life0 self, filter: &'life1 UserFilter, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, UserProfile)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Search users with SCIM-aligned filtering, sorting, and pagination.

Source

fn set_active<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, active: bool, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Set a user’s active status.

Source

fn list_pubkeys<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<PubkeyEntry>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List all pubkeys for a user.

Source

fn add_pubkey<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, pubkey: VerifyingKey, label: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Add a classical Ed25519 pubkey to a user. Returns the fingerprint.

Records KeyAlgorithm::Ed25519 with no PQ component. For post-quantum hybrid enrollment use add_pubkey_hybrid.

Source

fn add_pubkey_hybrid<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, pubkey: VerifyingKey, ml_dsa_vk: Vec<u8>, label: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Add a post-quantum hybrid identity key: the Ed25519 anchor plus its bound ML-DSA-65 verifying key (#439). Returns the fingerprint (of the Ed25519 anchor — the PQ vk does not change the kid).

Records KeyAlgorithm::HybridEd25519MlDsa65 with pq_pubkey = Some(..). If a classical Ed25519 record for the same anchor already exists, this is the in-place upgrade path (Ed25519 → Hybrid for the same fingerprint); the reverse transition is rejected.

ml_dsa_vk must be the ~1952-byte ML-DSA-65 verifying key encoding (pq::ml_dsa_vk_bytes). Required of every backend — no fail-open default that could silently drop the PQ binding.

Source

fn remove_pubkey<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, username: &'life1 str, fingerprint: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Remove a pubkey by fingerprint.

Source

fn get_pubkey_user<'life0, 'life1, 'async_trait>( &'life0 self, fingerprint: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Reverse lookup: find username by pubkey fingerprint (for auth).

Source

fn touch_pubkey<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, username: &'life1 str, fingerprint: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Update last_used_at timestamp for a pubkey.

Provided Methods§

Source

fn resolve_or_bind_external_idp<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _issuer: &'life1 str, _subject: &'life2 str, _username: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<ExternalIdentityResolution>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Atomically resolve an existing external identity or create a new candidate username bound to it. A username that already belongs to a local account must never be claimed by a new external identity.

Existing (issuer, subject) bindings are authoritative and are never rebound to the candidate. Empty identifiers, dangling references, and non-exact uniqueness races must fail closed.

Source

fn bind_existing_external_idp_to_hosted_account<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, _issuer: &'life1 str, _subject: &'life2 str, _username: &'life3 str, _expected_hosted_did: &'life4 str, ) -> Pin<Box<dyn Future<Output = Result<ExternalIdentityResolution>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Atomically bind a verified external identity to the named, active, already-provisioned hosted account whose authority-resolved DID is expected_hosted_did.

This operation must never create an account. Existing identical (issuer, subject) bindings are idempotent only when they point to the same DID owner; identity or issuer/account conflicts fail closed.

Source

fn provision_hosted_account<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _username: &'life1 str, _atproto_did: &'life2 str, _pubkey: VerifyingKey, _custody: AccountKeyCustody, ) -> Pin<Box<dyn Future<Output = Result<HostedAccountProvisioning, HostedAccountProvisionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Atomically create a hosted AS account and its first authentication key.

Implementations must not overwrite either an existing username or an existing key reverse-index entry. The account profile, DID mapping, custody discriminator, empty external-binding collection, public key, and reverse index become visible together. Repeating the exact same (username, DID, key, custody) returns Ok with resumed = true.

Conflict errors are trustworthy recovery signals: implementations may return them only when the conflicting profile, key, and reverse index form a complete usable hosted-account binding. Partial/corrupt state is a backend error and must fail closed.

Source

fn activate_hosted_account<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _username: &'life1 str, _atproto_did: &'life2 str, _fingerprint: &'life3 str, _custody: AccountKeyCustody, ) -> Pin<Box<dyn Future<Output = Result<(), HostedAccountProvisionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Atomically mark an exactly matching staged hosted binding active after its durable PDS genesis is known to exist.

Source

fn list_external_identities<'life0, 'life1, 'async_trait>( &'life0 self, username: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<ExternalIdentityBinding>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

List the normalized external identities bound to one local account. Cold signup always returns an empty list.

Source

fn get_external_identity_user<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, issuer: &'life1 str, subject: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Resolve a normalized external (issuer, subject) identity to its local account. The cold-signup demo never populates these bindings; this interface is reserved for the later OIDC RP.

Source

fn get_username_by_atproto_did<'life0, 'life1, 'async_trait>( &'life0 self, did: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Resolve a unique local username from its authority-bound hosted DID.

This reverse lookup is used only after a browser session has already established that DID. Implementations must reject duplicate matches; callers still have to recheck active status and authority ownership before using the result for account binding.

Implementors§