createKeys method

  1. @override
Future<Map<String, dynamic>?> createKeys(
  1. AndroidConfig androidConfig,
  2. IosConfig iosConfig, {
  3. required KeyFormat keyFormat,
})
override

Creates a key pair using the supplied platform-specific configuration.

Implementation

@override
Future<Map<String, dynamic>?> createKeys(
  AndroidConfig androidConfig,
  IosConfig iosConfig, {
  required KeyFormat keyFormat,
}) async {
  try {
    if (Platform.isAndroid) {
      final response = await methodChannel
          .invokeMethod<dynamic>('createKeys', {
            'useDeviceCredentials': androidConfig.useDeviceCredentials,
            'useEc': androidConfig.signatureType.isEc,
            'keyFormat': keyFormat.wireValue,
          });
      return _normalizeMapResponse(response);
    } else {
      final response = await methodChannel
          .invokeMethod<dynamic>('createKeys', {
            'useDeviceCredentials': iosConfig.useDeviceCredentials,
            'useEc': iosConfig.signatureType.isEc,
            'keyFormat': keyFormat.wireValue,
          });
      return _normalizeMapResponse(response);
    }
  } on PlatformException {
    rethrow;
  }
}