AuthRepository

Provider-agnostic authentication repository combining AuthStateProvider, AnonymousAuth, EmailPasswordAuth, and SocialAuth. Bridge this to Firebase Auth, Supabase Auth, or any other auth backend.

For consumers that only need a subset of capabilities (e.g. only session observation or only email authentication), depend on the narrower interfaces directly.

Properties

Link copied to clipboard
abstract val currentUser: AuthUser?

The currently authenticated user, or null if unauthenticated.

Link copied to clipboard
abstract val isAnonymous: Boolean

Whether the currently authenticated user is anonymous.

Link copied to clipboard
abstract val isAuthenticated: Boolean

Whether a user is currently authenticated (either anonymously or with credentials).

Functions

Link copied to clipboard
abstract fun authStateFlow(): Flow<AuthUser?>

Emits authentication state changes over time.

Link copied to clipboard
abstract suspend fun createAccountWithEmailAndPassword(email: String, password: String): Result<AuthUser>

Creates a new account with email and password.

Link copied to clipboard
abstract suspend fun deleteAccount(): Result<Unit>

Deletes the currently authenticated user's account.

Link copied to clipboard
abstract suspend fun sendPasswordResetEmail(email: String): Result<Unit>

Sends a password reset email to email.

Link copied to clipboard
abstract suspend fun sendSignInLinkToEmail(email: String, continueUrl: String): Result<Unit>

Sends a passwordless sign-in link to email.

Link copied to clipboard
abstract suspend fun signInAnonymously(): Result<AuthUser>

Signs in anonymously without persistent credentials.

Link copied to clipboard
abstract suspend fun signInWithApple(activity: Activity): Result<AuthUser>

Signs in using Apple authentication on activity.

Link copied to clipboard
abstract suspend fun signInWithEmailAndPassword(email: String, password: String): Result<AuthUser>

Signs in with an existing email and password.

Link copied to clipboard
abstract suspend fun signInWithGoogle(idToken: String): Result<AuthUser>

Signs in using a Google ID token.

Link copied to clipboard
abstract fun signOut()

Signs out the current user and clears authentication state.