sign method

Implementation

Future<Fido2Assertion> sign(UserActionChallenge challenge) async {
  final fido2Assertion = await PasskeyAuthenticator().authenticate(
    AuthenticateRequestType(
      relyingPartyId: challenge.rp.id,
      challenge: challenge.challenge,
      timeout: options?.timeout ?? defaultWaitTimeout,
      userVerification: challenge.userVerification,
      allowCredentials:
          List<CredentialType>.from(challenge.allowCredentials.webauthn.map(
        (e) => CredentialType(
          type: e.type,
          id: e.id,
          transports: [],
        ),
      )),
      mediation: MediationType.Required,
    ),
  );

  return Fido2Assertion(
    'Fido2',
    Fido2AssertionData(
      fido2Assertion.clientDataJSON,
      fido2Assertion.rawId,
      fido2Assertion.signature,
      fido2Assertion.authenticatorData,
      fido2Assertion.userHandle,
    ),
  );
}