verifyRegistration method
Completes the registration of a new passkey.
challengeId is the ID returned by startRegistration.
credential is the credential created by the platform's passkey API,
serialized in the W3C RegistrationResponseJSON format (the format
produced by PublicKeyCredential.toJSON() and passkey plugins).
Returns the newly registered Passkey. Its friendly name is generated by the server from the authenticator that created the credential and can be changed with update.
Implementation
Future<Passkey> verifyRegistration({
required String challengeId,
required Map<String, dynamic> credential,
}) async {
final accessToken = await _client._userAccessToken();
final data = await _fetch.requestObject(
'${_client._url}/passkeys/registration/verify',
HttpMethod.post,
options: AuthRequestOptions(
headers: _client._headers,
body: {
'challenge_id': challengeId,
'credential': credential,
},
jwt: accessToken,
),
);
return Passkey.fromJson(data);
}