pub struct AllsourceAuthAdapter { /* private fields */ }Expand description
Allsource-backed DatabaseAdapter for better-auth-rs.
Each auth entity is stored as an Allsource event stream:
- Entity ID pattern:
auth-{type}:{id}(e.g.,auth-user:abc123) - Each create/update appends a full-state snapshot event
- Deletes append a
_deleted: truemarker - Reads fetch the latest event and deserialize the payload
This gives you event-sourced auth with full history and time-travel.
Implementations§
Trait Implementations§
Source§impl AccountOps for AllsourceAuthAdapter
impl AccountOps for AllsourceAuthAdapter
type Account = Account
fn create_account<'life0, 'async_trait>(
&'life0 self,
input: CreateAccount,
) -> Pin<Box<dyn Future<Output = AuthResult<Account>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_account<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
provider: &'life1 str,
provider_account_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<Account>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_user_accounts<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Vec<Account>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_account<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
update: UpdateAccount,
) -> Pin<Box<dyn Future<Output = AuthResult<Account>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_account<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl ApiKeyOps for AllsourceAuthAdapter
impl ApiKeyOps for AllsourceAuthAdapter
type ApiKey = ApiKey
fn create_api_key<'life0, 'async_trait>(
&'life0 self,
input: CreateApiKey,
) -> Pin<Box<dyn Future<Output = AuthResult<ApiKey>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_api_key_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<ApiKey>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_api_key_by_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<ApiKey>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_api_keys_by_user<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Vec<ApiKey>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_api_key<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
update: UpdateApiKey,
) -> Pin<Box<dyn Future<Output = AuthResult<ApiKey>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_api_key<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn delete_expired_api_keys<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = AuthResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete_expired_api_keys<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = AuthResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete all API keys whose
expires_at is in the past. Returns the count of deleted keys.Source§impl InvitationOps for AllsourceAuthAdapter
impl InvitationOps for AllsourceAuthAdapter
type Invitation = Invitation
fn create_invitation<'life0, 'async_trait>(
&'life0 self,
input: CreateInvitation,
) -> Pin<Box<dyn Future<Output = AuthResult<Invitation>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_invitation_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<Invitation>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_pending_invitation<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
organization_id: &'life1 str,
email: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<Invitation>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn update_invitation_status<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
status: InvitationStatus,
) -> Pin<Box<dyn Future<Output = AuthResult<Invitation>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_organization_invitations<'life0, 'life1, 'async_trait>(
&'life0 self,
organization_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Vec<Invitation>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_user_invitations<'life0, 'life1, 'async_trait>(
&'life0 self,
email: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Vec<Invitation>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl MemberOps for AllsourceAuthAdapter
impl MemberOps for AllsourceAuthAdapter
type Member = Member
fn create_member<'life0, 'async_trait>(
&'life0 self,
input: CreateMember,
) -> Pin<Box<dyn Future<Output = AuthResult<Member>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_member<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
organization_id: &'life1 str,
user_id: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<Member>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_member_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<Member>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_member_role<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
member_id: &'life1 str,
role: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Member>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_member<'life0, 'life1, 'async_trait>(
&'life0 self,
member_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_organization_members<'life0, 'life1, 'async_trait>(
&'life0 self,
organization_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Vec<Member>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn count_organization_members<'life0, 'life1, 'async_trait>(
&'life0 self,
organization_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn count_organization_owners<'life0, 'life1, 'async_trait>(
&'life0 self,
organization_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl OrganizationOps for AllsourceAuthAdapter
impl OrganizationOps for AllsourceAuthAdapter
type Organization = Organization
fn create_organization<'life0, 'async_trait>(
&'life0 self,
input: CreateOrganization,
) -> Pin<Box<dyn Future<Output = AuthResult<Organization>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_organization_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<Organization>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_organization_by_slug<'life0, 'life1, 'async_trait>(
&'life0 self,
slug: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<Organization>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_organization<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
update: UpdateOrganization,
) -> Pin<Box<dyn Future<Output = AuthResult<Organization>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_organization<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_user_organizations<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Vec<Organization>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl PasskeyOps for AllsourceAuthAdapter
impl PasskeyOps for AllsourceAuthAdapter
type Passkey = Passkey
fn create_passkey<'life0, 'async_trait>(
&'life0 self,
input: CreatePasskey,
) -> Pin<Box<dyn Future<Output = AuthResult<Passkey>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_passkey_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<Passkey>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_passkey_by_credential_id<'life0, 'life1, 'async_trait>(
&'life0 self,
credential_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<Passkey>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_passkeys_by_user<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Vec<Passkey>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_passkey_counter<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
counter: u64,
) -> Pin<Box<dyn Future<Output = AuthResult<Passkey>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_passkey_name<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
id: &'life1 str,
name: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Passkey>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_passkey<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl SessionOps for AllsourceAuthAdapter
impl SessionOps for AllsourceAuthAdapter
type Session = Session
fn create_session<'life0, 'async_trait>(
&'life0 self,
input: CreateSession,
) -> Pin<Box<dyn Future<Output = AuthResult<Session>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_session<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<Session>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_user_sessions<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Vec<Session>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_session_expiry<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
expires_at: DateTime<Utc>,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_session<'life0, 'life1, 'async_trait>(
&'life0 self,
token: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_user_sessions<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_expired_sessions<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = AuthResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_session_active_organization<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
token: &'life1 str,
organization_id: Option<&'life2 str>,
) -> Pin<Box<dyn Future<Output = AuthResult<Session>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§impl TwoFactorOps for AllsourceAuthAdapter
impl TwoFactorOps for AllsourceAuthAdapter
type TwoFactor = TwoFactor
fn create_two_factor<'life0, 'async_trait>(
&'life0 self,
input: CreateTwoFactor,
) -> Pin<Box<dyn Future<Output = AuthResult<TwoFactor>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_two_factor_by_user_id<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<TwoFactor>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_two_factor_backup_codes<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
backup_codes: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<TwoFactor>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_two_factor<'life0, 'life1, 'async_trait>(
&'life0 self,
user_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl UserOps for AllsourceAuthAdapter
impl UserOps for AllsourceAuthAdapter
type User = User
fn create_user<'life0, 'async_trait>(
&'life0 self,
input: CreateUser,
) -> Pin<Box<dyn Future<Output = AuthResult<User>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_user_by_id<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<User>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_user_by_email<'life0, 'life1, 'async_trait>(
&'life0 self,
email: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<User>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_user_by_username<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<User>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update_user<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
update: UpdateUser,
) -> Pin<Box<dyn Future<Output = AuthResult<User>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_user<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn list_users<'life0, 'async_trait>(
&'life0 self,
params: ListUsersParams,
) -> Pin<Box<dyn Future<Output = AuthResult<(Vec<User>, usize)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_users<'life0, 'async_trait>(
&'life0 self,
params: ListUsersParams,
) -> Pin<Box<dyn Future<Output = AuthResult<(Vec<User>, usize)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List users with optional filtering, sorting, and pagination.
Returns
(users, total_count).Source§impl VerificationOps for AllsourceAuthAdapter
impl VerificationOps for AllsourceAuthAdapter
type Verification = Verification
fn create_verification<'life0, 'async_trait>(
&'life0 self,
input: CreateVerification,
) -> Pin<Box<dyn Future<Output = AuthResult<Verification>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_verification<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
identifier: &'life1 str,
value: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<Verification>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_verification_by_value<'life0, 'life1, 'async_trait>(
&'life0 self,
value: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<Verification>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_verification_by_identifier<'life0, 'life1, 'async_trait>(
&'life0 self,
identifier: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<Verification>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§fn consume_verification<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
identifier: &'life1 str,
value: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<Verification>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn consume_verification<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
identifier: &'life1 str,
value: &'life2 str,
) -> Pin<Box<dyn Future<Output = AuthResult<Option<Verification>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Atomically consume a verification token identified by
(identifier, value). Read morefn delete_verification<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = AuthResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_expired_verifications<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = AuthResult<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl Freeze for AllsourceAuthAdapter
impl !RefUnwindSafe for AllsourceAuthAdapter
impl Send for AllsourceAuthAdapter
impl Sync for AllsourceAuthAdapter
impl Unpin for AllsourceAuthAdapter
impl UnsafeUnpin for AllsourceAuthAdapter
impl !UnwindSafe for AllsourceAuthAdapter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more