authenticate method

Future<AuthenticateResponseType> authenticate(
  1. String relyingPartyId,
  2. String challenge,
  3. int? timeout,
  4. String? userVerification,
  5. List<AllowCredentialType>? allowCredentials,
)

Returns a solution to the challenge from relyingParty

Implementation

Future<AuthenticateResponseType> authenticate(
  String relyingPartyId,
  String challenge,
  int? timeout,
  String? userVerification,
  List<AllowCredentialType>? allowCredentials,
) async {
  try {
    final r = await _platform.authenticate(
      relyingPartyId,
      challenge,
      timeout,
      userVerification,
      allowCredentials,
    );

    return r;
  } on PlatformException catch (e) {
    switch (e.code) {
      case 'cancelled':
        throw PasskeyAuthCancelledException();
      case 'android-no-credential':
        throw MissingGoogleSignInException();
      default:
        if (e.code.startsWith('android-unhandled')) {
          throw UnhandledAuthenticatorException(e.code, e.message, e.details);
        } else if (e.code.startsWith('ios-unhandled')) {
          throw UnhandledAuthenticatorException(e.code, e.message, e.details);
        } else {
          rethrow;
        }
    }
  }
}