appleGenerateAttestationKey method
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:
- PlatformException if key generation fails or if App Attestation is not supported
- MissingPluginException if the platform implementation is not available
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;
}