Final Class Headless view model for the SDK’s email + OTP sign-in flow. Owns the state machine (current step, loading flag, error, OTP challenge id, resend cooldown) and the authentication calls againstDocumentation Index
Fetch the complete documentation index at: https://docs.crossmint.com/llms.txt
Use this file to discover all available pages before exploring further.
CrossmintAuthClient, so the default-UI CrossmintEmailSignIn widget can become a thin presentational layer and headless consumers can reuse the same state machine behind their own design system.
sendOtp / confirmOtp / resend and own their own input widgets.
Lifecycle: consumers must call dispose when the view model is no longer
needed so the internal resend-cooldown timer is cancelled.
Constructors
CrossmintEmailSignInViewModel
Properties
cooldownDuration
step
isLoading
error
null if the flow is in a clean state.
emailId
CrossmintAuthClient.sendEmailOtp, required for the subsequent confirm call. null until sendOtp succeeds.
submittedEmail
sendOtp succeeds.
cooldownRemaining
resend becomes available again. Zero when the cooldown is not active.
canResend
resend can be invoked: the cooldown has elapsed and no operation is currently in flight.
Methods
sendOtp
email. On success, transitions to CrossmintEmailSignInStep.otpInput and starts the resend cooldown. On failure, stores the error message on error and stays on the email-input step.
confirmOtp
code. Returns true if the verification succeeded, false if the code was rejected, and rethrows on a non-validation error (after storing the error on error and notifying listeners).
resend
error and the cooldown is not touched.
goBackToEmail
submittedEmail / emailId in case the consumer wants to re-use them (e.g. for a “wrong email” confirmation dialog).

