waitForRecoveryKey method

  1. @override
Future<RecoveryResult<Map<String, Map<CardinalRsaPublicKey, CardinalRsaPrivateKey>>>> waitForRecoveryKey(
  1. String referenceId,
  2. RecoveryDataKey recoveryKey,
  3. bool autoDelete,
  4. int waitSeconds,
  5. int cancellationToken,
)
override

Implementation

@override
Future<RecoveryResult<Map<String, Map<CardinalRsaPublicKey, CardinalRsaPrivateKey>>>> waitForRecoveryKey(
	String referenceId,
	RecoveryDataKey recoveryKey,
	bool autoDelete,
	int waitSeconds,
	int cancellationToken
) async {
	final res = await _methodChannel.invokeMethod<String>(
			'KeyPairRecoverer.waitForRecoveryKey',
			{
				"cancellationToken": cancellationToken.toString(),
				"referenceId": referenceId,
				"recoveryKey": jsonEncode(RecoveryDataKey.encode(recoveryKey)),
				"autoDelete": jsonEncode(autoDelete),
				"waitSeconds": jsonEncode(waitSeconds),
			}
	).catchError(convertPlatformException);
	if (res == null) throw AssertionError("received null result from platform method recoverKeyPairsWaitingForCreation");
	final parsedResJson = jsonDecode(res);
	return RecoveryResult.fromJSON(
		parsedResJson,
		(x1) {
			return (x1 as Map<String, dynamic>).map((k2, v2) => MapEntry(
				(k2 as String),
				(v2 as Map<String, dynamic>).map((k3, v3) => MapEntry(
					CardinalRsaPublicKey.fromSpkiHex(k3),
					CardinalRsaPrivateKey.fromPkcs8Base64(v3)
				))
			));
		},
	);
}