checkKey method

Future<bool> checkKey(
  1. Uint8List key,
  2. SecretStorageKeyContent info
)

Implementation

Future<bool> checkKey(Uint8List key, SecretStorageKeyContent info) async {
  if (info.algorithm == AlgorithmTypes.secretStorageV1AesHmcSha2) {
    if (info.mac != null && info.iv != null) {
      return client.nativeImplementations.checkSecretStorageKey(
        CheckSecretStorageKeyArgs(key: key, iv: info.iv!, mac: info.mac!),
      );
    } else {
      // mac or iv is missing. Assume it is invalid:
      return false;
    }
  } else {
    throw InvalidPassphraseException('Unknown Algorithm');
  }
}