PhoneNumberPlugin<TContext> class
final
Phone-number OTP authentication as an opt-in server plugin.
Constructors
-
PhoneNumberPlugin({required AuthPhoneNumberCodeSender<
TContext> sendCode, required String codeHashKey, AuthPhoneNumberPolicy phoneNumberPolicy = const AuthE164PhoneNumberPolicy(), int codeLength = 6, Duration expiresIn = const Duration(minutes: 5), int allowedAttempts = 3, bool allowSignUp = false, AuthPhoneNumberUserFactory<TContext> ? createUser, AuthPhoneNumberVerifiedCallback<TContext> ? onVerified, String generateCode(int length)?}) - Creates a phone-number plugin with an application-owned code sender.
Properties
- allowedAttempts → int
-
Maximum failed attempts allowed for one code.
final
- allowSignUp → bool
-
Whether an unknown phone number may create a user.
final
-
authenticationMethodKinds
→ Set<
AuthAuthenticationMethodKind> -
Method kinds that this store can report authoritatively.
no setteroverride
- authenticationMethodNamespace → String
-
Stable namespace owned by this contributor.
no setteroverride
- authenticationMethodStore → Object
-
Store or coordinator that owns this contributor's method data.
no setteroverride
-
clientOperations
→ Iterable<
AuthClientOperationDescriptor> -
Client operations declared by the plugin.
no setteroverride
- codeLength → int
-
Number of decimal digits in generated verification codes.
final
-
createUser
→ AuthPhoneNumberUserFactory<
TContext> ? -
Builds a candidate user when sign-up is enabled.
final
- dataContract → AuthServerPluginDataContract
-
Declares data and destructive routes owned by this plugin.
no setteroverride
-
endpoints
→ Iterable<
AuthEndpointDescriptor< TContext> > -
Runtime endpoints contributed by the plugin.
no setteroverride
- expiresIn → Duration
-
Duration for which an issued code remains valid.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- id → String
-
Stable plugin identifier.
no setteroverride
-
onVerified
→ AuthPhoneNumberVerifiedCallback<
TContext> ? -
Callback invoked after the phone identity is committed.
final
-
persistenceSchemas
→ Iterable<
AuthPersistenceSchema> -
Persistence schemas declared by the plugin.
no setteroverride
- phoneNumberPolicy → AuthPhoneNumberPolicy
-
Policy used to normalize and validate phone input.
final
-
rateLimitOperations
→ Iterable<
AuthRateLimitOperation> -
Rate-limit operations declared by the plugin.
no setteroverride
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
sendCode
→ AuthPhoneNumberCodeSender<
TContext> -
Callback that delivers each generated verification code.
final
- userDataNamespace → String
-
The namespace used for plugin-owned user data.
no setteroverride
Methods
-
authenticationMethodsForUser(
String userId) → Future< AuthAuthenticationMethodSnapshot> -
Returns the usable methods for
userId.override -
configure(
AuthServerPluginContext< TContext> context) → void -
Configures this plugin against the shared runtime context.
override
-
createUserDeletionPlan(
AuthUser user) → AuthUserDeletionPlan -
Creates user deletion plan.
override
-
issueCode(
{required TContext context, required String phoneNumber, DateTime? now}) → Future< AuthPhoneNumberCodeIssued> - Issues a verification code and delivers it through sendCode.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removePhoneNumber(
{required String userId}) → Future< void> - Removes the current phone identity only when another usable method remains.
-
toString(
) → String -
A string representation of this object.
inherited
-
verifyCode(
{required TContext context, required String phoneNumber, required String code, String? name, DateTime? now}) → Future< AuthPhoneNumberSignInResult> - Verifies a code and returns the authenticated user.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited