appleGenerateAttestationKey method

  1. @override
Future<String> appleGenerateAttestationKey()
override

Generates a new Apple App Attestation key in the device's Secure Enclave.

This method creates a new cryptographic key pair specifically for App Attestation. The private key remains secured in the Secure Enclave and cannot be extracted, while the public key can be used for attestation verification.

Returns a Future that completes with a String representing the unique identifier for the generated attestation key.

Throws:

Example:

try {
  final keyId = await device.appleGenerateAttestationKey();
  print('Generated key ID: $keyId');
  // Store keyId for future attestation operations
} catch (e) {
  print('Key generation failed: $e');
}

Implementation

@override
Future<String> appleGenerateAttestationKey() async {
  final result = await methodChannel.invokeMethod(
    "appleGenerateAttestationKey",
  );
  return result as String;
}