AuthClient class

Authentication: email OTP login, session lifecycle. (SMS/social/passkeys follow the same shapes.) Instances share the root client's state. NOTE: not yet thread-safe.

Properties

authToken → String?
Current auth token, if a session is active.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isDeviceRegistrationRequired → bool
Checks whether the current user must register this device.
no setter
isPendingMfaRecoveryCodesAcknowledgment → bool
True when the user has recovery codes but hasn't yet confirmed saving them (user.mfaBackupCodeAcknowledgement == 'pending') — drive a 'please save your recovery codes' prompt from this.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
socialProviders → List<Provider>?
The social login providers enabled for this environment (from project settings). Pass one's provider to signInWithSocial.
no setter
user → SdkUser?
The locally cached authenticated user, if loaded (signin caches it; after a session restore call refreshUser first).
no setter

Methods

acknowledgeMfaRecoveryCodes() → Future<void>
Marks recovery codes as acknowledged and clears the local prompt state.
authenticateMfaRecoveryCode(String code, [String? scope, List<String>? requestedScopes]) → Future<VerifyResponse>
Consumes a recovery code for MFA and optional scoped elevation.
authenticatePasskeyMFA([String? scope, List<String>? requestedScopes]) → Future<VerifyResponse>
Performs scoped MFA elevation with an enrolled passkey. Does not register a new factor.
authenticateTotpMfaDevice(String code, [String? deviceId, List<String>? requestedScopes]) → Future<VerifyResponse>
Authenticates or confirms a TOTP device and updates the session.
checkStepUp(String scope) → Future<StepUpCheckResponse>
Checks whether an operation scope (e.g. 'wallet:sign') needs step-up, and returns the credentials that can satisfy it — drive a step-up prompt from this, like expo-demo.
completeDeviceRegistration(String deviceToken) → Future<VerifyResponse>
Completes device registration without changing an existing user identity.
completeEmailOtpStepUp(String verificationUuid, String code, String scope) → Future<void>
Completes an email-OTP step-up (see sendStepUpEmailOtp), requesting a scope-scoped elevated access token so the gated operation can proceed — the no-MFA-registered fallback to completeTotpStepUp.
completeTotpStepUp(String code, String scope) → Future<void>
Verifies a six-digit TOTP code and refreshes the session token with scope-specific elevation.
consumeMfaToken() → String?
Returns and clears the legacy single-use MFA token.
createNewMfaRecoveryCodes() → Future<MfaRecoveryCodesResponse>
Generates a new set of MFA recovery (backup) codes, replacing any existing ones — the old set stops working. Show the new codes to the user and call acknowledgeMfaRecoveryCodes once they confirm they saved them.
deleteMfaDevice(String deviceId, [String? mfaAuthToken]) → Future<void>
Deletes an MFA device with credential:unlink elevation or a legacy MFA token.
deletePasskey(String passkeyId, [String? mfaAuthToken]) → Future<void>
Deletes a passkey with scoped elevation or an in-progress MFA token.
deleteUser() → Future<void>
Permanently deletes the current account and clears its local session.
detectDeviceRegistrationRedirect(String url) → bool
Checks whether a URL is a device registration redirect, meaning it carries a deviceRegistrationToken that is not blank.
expireSession(int expiresAtMs) → Future<void>
Clears an expired session only if its deadline still matches. Used by the client expiration timer.
getCaptchaSettings() → CaptchaSettingsResult?
Uses security.captcha, falling back to legacy security.hCaptcha. The default provider is hcaptcha; the host UI supplies the token.
getDeviceRegistrationTokenFromUrl(String url) → String
Extracts the deviceRegistrationToken from a device registration redirect URL. Throws InvalidDeviceRegistrationRedirectError when the URL has none or it is blank.
getMfaDevices() → Future<List<MfaDevice>>
Lists registered MFA devices.
getMfaMethods() → Future<MfaMethodsResponse>
Gets verified MFA devices and passkeys.
getMfaRecoveryCodes() → Future<MfaRecoveryCodesResponse>
The user's current MFA recovery (backup) codes. The server creates a fresh set on first call if none exist yet — no separate enrollment step.
getPasskeys() → Future<List<UserPasskey>>
The user's registered passkeys (metadata only — id/alias/device info, never credential secrets).
getRegisteredDevices() → Future<List<DeviceRegistration>>
Lists registered sign-in devices.
getSignedSessionId() → Future<String>
Builds the signed-session-id proof required by privileged operations (WaaS create/sign): session-key signatures over the sessionId and a fresh nonce, joined as sessionSignature/nonceSignature/nonce.
getUserSocialAccounts() → List<SocialAccount>
Lists social identities linked to the current user.
handleUnauthorizedSession(String sessionId) → Future<void>
Clears the session reported as unauthorized by a wallet engine. Notifications from an older session are ignored.
initialize() → Future<void>
Loads project settings (required before OTP calls) and restores a persisted, unexpired session from secure storage, including re-fetching the user object (never itself persisted) from the server.
isMfaRequiredForAction(String action) → Future<bool>
Checks project requirements and the user’s verified MFA methods.
isUserMissingMfaAuth() → bool
Checks whether the signed-in user needs additional MFA.
mergeUserAccounts([List<MergeUserConflictResolution>? conflictResolutions]) → Future<SdkUser>
Completes a pending account merge using the user’s conflict resolutions.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refreshAuth() → Future<VerifyResponse>
Rotates the auth token and updates the user.
refreshUser() → Future<SdkUser>
Fetches the current user and updates local state. initialize also runs this for a restored session.
registerPasskey() → Future<void>
Registers a passkey with biometric or PIN approval. Sends cached credential:link elevation when available; the server decides whether it is required. Refreshes the session token.
registerTotpMfaDevice() → Future<MfaTotpRegistration>
Starts TOTP enrollment. Never log the returned secret or URI.
requestExternalAuthElevatedToken(String jwt) → Future<ExternalAuthAssertionResponse>
Exchanges an assertion with scope and jti claims for elevation using the configured JWKS. Requires a prior BYOA sign-in.
resendEmailOtp(String verificationUuid, String email) → Future<SendEmailOtpResult>
Re-sends the one-time code for a pending email verification.
revokeAllRegisteredDevices() → Future<void>
Revokes all registered devices and signs out.
revokeRegisteredDevice(String deviceRegistrationId) → Future<void>
Revokes a device and signs out if it is the current device.
sendEmailOtp(String email) → Future<SendEmailOtpResult>
Step 1 of email login: sends a one-time code to the given address.
sendSmsOtp(String isoCountryCode, String phoneCountryCode, String phoneNumber) → Future<SendSmsOtpResult>
Sends an SMS code. Supply matching phoneCountryCode (dialing code) and isoCountryCode values.
sendStepUpEmailOtp() → Future<SendEmailOtpResult>
Sends an MFA fallback code to the signed-in user's email. Pass the returned UUID to the verification flow.
setCaptchaToken(String captchaToken) → void
Stores a captcha token a host-implemented widget resolved, for the next captcha-gated call to consume (sendEmailOtp, resendEmailOtp, signInWithSocial, sendSmsOtp) — single-use, mirrors dynamic-js-sdk's setCaptchaToken() exactly.
setDefaultMfaDevice(String deviceId) → Future<void>
Selects the default MFA device.
signInWithExternalJwt(String jwt) → Future<SdkUser>
Signs in with an external JWT using the configured issuer and JWKS. sub identifies the user; the JWT is forwarded without client-side decoding or logging.
signInWithPasskey() → Future<UserSession>
Signs in without an existing session. Empty allowCredentials lets the authenticator offer any passkey for the relying party.
signInWithSocial(String provider, [List<String>? requestedScopes]) → Future<SdkUser>
Signs in or links a social identity through a system browser with state validation and PKCE.
signOut() → Future<void>
Clears the in-memory session and removes it from secure storage.
toString() → String
A string representation of this object.
inherited
unlinkSocialAccount(String verifiedCredentialId) → Future<VerifyResponse>
Unlinks a social identity with credential:unlink elevation when required.
updateUser([String? alias, String? firstName, String? lastName, String? jobTitle, String? username, String? country]) → Future<SdkUser>
Updates non-verification profile fields. Null or omitted fields remain unchanged; email and phone changes require their OTP flows.
verifyEmailIdentity(String verificationUuid, String code, [List<String>? requestedScopes]) → Future<VerifyResponse>
Verifies an email identity after sign-in.
verifyEmailOtp(String verificationUuid, String code, [bool? allowNewMfaLinking]) → Future<UserSession>
Step 2 of email login: verifies the code and signs the user in. Performs the device-nonce signature required by the signin endpoint in header (non-cookie) mode.
verifySmsIdentity(String verificationUuid, String code, [List<String>? requestedScopes]) → Future<VerifyResponse>
Verifies an SMS identity after sign-in.
verifySmsOtp(String verificationUuid, String code, [bool? allowNewMfaLinking]) → Future<UserSession>
Verifies an SMS code with a device-signed nonce. CAPTCHA is consumed only when sending the code.

Operators

operator ==(Object other) → bool
The equality operator.
inherited