Documentation Index
Fetch the complete documentation index at: https://docs.crossmint.com/llms.txt
Use this file to discover all available pages before exploring further.
Final Class
Drives OTP challenges raised by non-custodial email and phone signers.
final class CrossmintWalletOtpController
Exposed on CrossmintWalletController.otp. When the signer flow requests
authentication, the controller populates pendingChallenge and exposes
sendOtp / verifyOtp / reject to drive it. UI code observes
challengeListenable to show a prompt.
ValueListenableBuilder<CrossmintOtpChallenge?>(
valueListenable: walletController.otp.challengeListenable,
builder: (context, challenge, _) {
if (challenge == null) return const SizedBox.shrink();
return MyOtpDialog(
onSubmit: walletController.otp.verifyOtp,
onCancel: walletController.otp.reject,
);
},
);
Properties
needsAuth
true when an OTP challenge is outstanding.
pendingChallenge
CrossmintOtpChallenge? get pendingChallenge
The active challenge, or null when no OTP is pending.
challengeListenable
ValueListenable<CrossmintOtpChallenge?> get challengeListenable
Reactive handle on the pending challenge — subscribe to drive OTP UI.
Methods
onAuthRequired
Future<void> onAuthRequired(
String signerType,
String signerLocator,
bool needsAuth,
CrossmintOtpSendCallback sendOtp,
CrossmintOtpVerifyCallback verifyOtp,
CrossmintOtpRejectCallback reject,
)
Entry point the SDK calls when a signer needs authentication. Normally invoked by the signer auto-recovery machinery — you should not need to call this yourself.
sendOtp
Requests that the Crossmint API (re-)send the OTP to the user. Throws CrossmintSignerException when no challenge is pending.
verifyOtp
Future<void> verifyOtp(String otp)
Submits the OTP the user entered. On success, clears the pending challenge. Throws CrossmintSignerException when no challenge is pending.
reject
void reject([Object? error])
Cancels the pending OTP flow, surfacing error (if any) to the signer request that raised the challenge.
clear
Clears any pending challenge without notifying the signer. Prefer verifyOtp or reject to resolve a challenge cleanly.
dispose
Releases the underlying ValueNotifier. Called automatically when the parent CrossmintWalletController is disposed.