quickauth_flutter library

QuickAuth Flutter SDK — phone OTP (SMS / WhatsApp) and WhatsApp marketing attribution.

await QuickAuth.init(
  onTokenExpiry: () async => (await myApi.fetch('/api/quickauth-token')).sessionToken,
);
final session = await QuickAuth.auth.startOTP(phone: '+919876543210');
final result  = await QuickAuth.auth.verifyOTP(
  sessionId: session.sessionId,
  code: '123456',
);

Classes

AttributionResult
Result of POST /v1/sdk/attribution/launch.
AuthErrorEvent
Transport / rate-limit / unexpected failure. Final for this attempt.
AuthEvent
Typed lifecycle events emitted by the headless auth state machine.
OtpAutoReadEvent
Inbound SMS auto-read (Android SMS Retriever). The SDK does NOT auto-submit — the merchant decides whether to forward to submitOtp.
OtpFailedEvent
Submitted code was rejected. SDK stays in awaiting-OTP state so the user can retry.
OtpSentEvent
Backend dispatched an OTP. Render the input UI.
QuickAuth
Top-level access point for the QuickAuth SDK.
QuickAuthAttributionService
Headless attribution API. Available as QuickAuth.attribution.
QuickAuthColors
Brand colours used by the bundled QuickAuth widgets. Sourced from quickauth-website/src/styles/tokens.css.
QuickAuthConfig
Immutable runtime configuration for the QuickAuth SDK.
QuickAuthConsent
Tracks DPDP / GDPR analytics consent.
QuickAuthLoginButton
One-tap "Continue with QuickAuth" button.
QuickAuthOtpField
Pin-style OTP input — N cells, single digit each, auto-advance, paste distribution, and Android observeOTP() auto-fill.
QuickAuthOtpService
Headless auth state machine. Available as QuickAuth.auth.
QuickAuthTextStyles
Typography presets matching the site (Inter Tight + Instrument Serif + JetBrains Mono).
SmsChannel
Channel names, in one place so Dart and Kotlin cannot drift apart.
TokenManager
Manages the ephemeral session JWT used for Authorization: Bearer ....
VerifiedEvent
User is authenticated. Covers fresh OTP success AND silent device-trust re-auth. Forward requestId to the merchant backend for server-to- server confirmation.
WhatsAppLogin
Launches the system WhatsApp deep-link for a "Login with WhatsApp" flow.
WhatsAppOtpRetriever
Receives a WhatsApp zero-tap or one-tap authentication code.

Enums

OtpChannel
OTP delivery channel sent to /v1/sdk/auth/initiate.
QuickAuthButtonStyle
Visual variant of QuickAuthLoginButton.

Extensions

OtpChannelWire on OtpChannel
Wire-format mapper for OtpChannel.
QuickAuthAuthWhatsApp on QuickAuthOtpService
Convenience extension so existing callers can write QuickAuth.auth.startWhatsAppLogin(...).

Typedefs

AuthEventHandler = void Function(AuthEvent event)
Signature for the merchant-supplied auth event handler.
ConsentQueuedRunner = Future<void> Function()
A queued event waiting for consent before it can be flushed to the API.
TokenProvider = Future<String> Function()
Signature for the customer-supplied callback that mints a fresh QuickAuth session JWT. The SDK invokes this whenever the cached token is missing, expired, or about to expire (~30s before exp). The callback is expected to call the customer's own backend (which holds the QuickAuth client secret) and return the sessionToken from POST /v1/sdk/session.

Exceptions / Errors

QuickAuthApiException
Raised by QuickAuthApiClient when the backend returns a non-2xx status or a transport-level error occurs.