getRestoreCredential method
Signs the challenge in request with the restore credential (restore
key) on the device.
Call this on the first launch after the app was restored on a new device.
request is the same PublicKeyCredentialRequestOptions your relying
party server produces for authenticate, and the returned
AuthenticateResponseType is verified by the server exactly like a
passkey assertion. Nothing is shown to the user.
Throws NoCredentialsAvailableException when there is no restore key on the device, and RestoreCredentialUnsupportedException on platforms without restore credentials.
Implementation
@override
Future<AuthenticateResponseType> getRestoreCredential(
AuthenticateRequestType request,
) async {
if (debugMode) {
await _doctor?.check(request.relyingPartyId);
}
try {
_isValidChallenge(request.challenge);
if (request.allowCredentials != null) {
for (final credential in request.allowCredentials!) {
_isValidCredentialID(credential.id);
}
}
return await _platform.getRestoreCredential(request);
} on PlatformException catch (e, stackTrace) {
_mapRestoreCredentialException(e, stackTrace);
}
}