PhoneNumber
The PhoneNumber
object is a model around a phone number entity.
Phone numbers can be used as a proof of identification for users, or simply as a means of contacting users.
Phone numbers must be verified to ensure that they can be assigned to their rightful owners. The PhoneNumber
object holds all the necessary state around the verification process.
The verification process always starts with the
prepareVerification()
method, which will send a one-time verification code via an SMS message.The second and final step involves an attempt to complete the verification by calling the
attemptVerification(code:)
method, passing the one-time code as a parameter.
Finally, phone numbers can be used as part of multi-factor authentication. During sign-in, users can opt in to an extra verification step where they will receive an SMS message with a one-time code. This code must be entered to complete the sign-in process.
Properties
A list of backup codes in case of lost phone number access.
A boolean indicating whether this phone number is the default second factor.
Convenience function for telling whether or not the phone number is the primary one
Convenience function for telling whether or not the phone number is verified
The phone number value.
A boolean indicating whether this phone number is reserved for second factor authentication.
An object holding information on the verification of this phone number.
Functions
Attempts to verify this phone number using the provided verification code.
Deletes this phone number from the user's account.
Initiates the phone number verification process by sending a verification code via SMS.
Updates the properties of this phone number.