iOSgenerateAttestation method

  1. @override
Future<GenerateAttestationResponse?> iOSgenerateAttestation(
  1. String challenge
)
override

iOS only
Creates a key pair and verifies it using the challenge, which creates an attestation. Returns the corresponding attestation and keyID to be sent to the server.

The attestation can be seen as a public key for later integrity checks. See this iOS official doc for more details and further implementation instructions.

challenge is a nonce generated by the server, used to avoid replay attacks.
The challenge should be at least 16 bytes in length to ensure sufficient entropy to ensure guessing them is infeasible.

This method will throw if used on an unsupported iOS device.

Returns null only when used on Android.

Implementation

@override
Future<GenerateAttestationResponse?> iOSgenerateAttestation(
  String challenge,
) async {
  final response = await AppAttestIntegrityApi().iOSgenerateAttestation(
    challenge,
  );
  if (response == null) {
    return null;
  }
  return GenerateAttestationResponse(
    attestation: response.attestation,
    keyId: response.keyId,
  );
}