Skip to main content

FamilyInvitationStore

Trait FamilyInvitationStore 

Source
pub trait FamilyInvitationStore: Send + Sync {
    // Required methods
    fn create_invitation<'life0, 'async_trait>(
        &'life0 self,
        family_id: FamilyId,
        inviter_id: UserId,
        target_identity: Option<InvitationTargetIdentity>,
        expires_at: DateTime<Utc>,
    ) -> Pin<Box<dyn Future<Output = Result<(FamilyInvitationSummary, InvitationToken), InvitationStorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_invitations<'life0, 'async_trait>(
        &'life0 self,
        family_id: FamilyId,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<FamilyInvitationSummary>, InvitationStorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn revoke_invitation<'life0, 'async_trait>(
        &'life0 self,
        family_id: FamilyId,
        invitation_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<FamilyInvitationSummary, InvitationStorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn validate_invitation<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        token: &'life1 InvitationToken,
        accepting_identity: &'life2 InvitationTargetIdentity,
    ) -> Pin<Box<dyn Future<Output = Result<(), InvitationStorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn accept_invitation<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        token: &'life1 InvitationToken,
        accepting_identity: &'life2 InvitationTargetIdentity,
        user_id: UserId,
        relationship: FamilyRelationship,
    ) -> Pin<Box<dyn Future<Output = Result<FamilyMember, InvitationStorageError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Invitation operations. Acceptance and membership creation must be one atomic operation in every backend.

Required Methods§

Source

fn create_invitation<'life0, 'async_trait>( &'life0 self, family_id: FamilyId, inviter_id: UserId, target_identity: Option<InvitationTargetIdentity>, expires_at: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<(FamilyInvitationSummary, InvitationToken), InvitationStorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Creates an invitation and returns the raw token exactly once.

Source

fn list_invitations<'life0, 'async_trait>( &'life0 self, family_id: FamilyId, ) -> Pin<Box<dyn Future<Output = Result<Vec<FamilyInvitationSummary>, InvitationStorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns metadata only. Neither hashes nor raw tokens are exposed.

Source

fn revoke_invitation<'life0, 'async_trait>( &'life0 self, family_id: FamilyId, invitation_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<FamilyInvitationSummary, InvitationStorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn validate_invitation<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, token: &'life1 InvitationToken, accepting_identity: &'life2 InvitationTargetIdentity, ) -> Pin<Box<dyn Future<Output = Result<(), InvitationStorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Checks token validity and identity binding without consuming the invitation. Acceptance repeats all checks atomically to protect against races.

Source

fn accept_invitation<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, token: &'life1 InvitationToken, accepting_identity: &'life2 InvitationTargetIdentity, user_id: UserId, relationship: FamilyRelationship, ) -> Pin<Box<dyn Future<Output = Result<FamilyMember, InvitationStorageError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Validates the token and optional identity binding, then creates the membership and marks the invitation accepted under one transaction. Repeated acceptance by the same EME user is idempotent.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§