register method
Future<RegisterResponseType>
register(
- String challenge,
- RelyingPartyType relyingParty,
- UserType user,
- AuthenticatorSelectionType authSelectionType,
- List<
PubKeyCredParamType> ? pubKeyCredParams, - int? timeout,
- String? attestation,
Creates a new passkey and stores it on the device.
Returns a solution to the challenge from relyingParty
Implementation
Future<RegisterResponseType> register(
String challenge,
RelyingPartyType relyingParty,
UserType user,
AuthenticatorSelectionType authSelectionType,
List<PubKeyCredParamType>? pubKeyCredParams,
int? timeout,
String? attestation,
) async {
try {
final r = await _platform.register(
challenge,
relyingParty,
user,
authSelectionType,
pubKeyCredParams,
timeout,
attestation,
);
return r;
} on PlatformException catch (e) {
switch (e.code) {
case 'cancelled':
throw PasskeyAuthCancelledException();
case 'android-missing-google-sign-in':
throw MissingGoogleSignInException();
case 'android-sync-account-not-available':
throw SyncAccountNotAvailableException();
default:
rethrow;
}
}
}