registerPasskey method
Future<Passkey>
registerPasskey(
- PasskeyAuthenticatorInterface authenticator, {
- String? friendlyName,
Registers a new passkey for the signed in user.
Starts the registration with the Supabase server, calls authenticator to
create a credential on the device, and verifies it with the server.
friendlyName is the account label the authenticator shows for the
passkey when the server does not provide one. See
AuthPasskeyApi.startRegistration.
Requires a signed in (non-anonymous) user. Returns the newly registered Passkey.
Implementation
Future<Passkey> registerPasskey(
PasskeyAuthenticatorInterface authenticator, {
String? friendlyName,
}) async {
final registration = await passkey.startRegistration(
friendlyName: friendlyName,
);
final response = await authenticator.register(
passkeyRegisterRequestFromOptions(registration.options),
);
return passkey.verifyRegistration(
challengeId: registration.challengeId,
credential: response.toJson(),
);
}