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 is String) && (info.iv is String)) {
      return client.nativeImplementations.checkSecretStorageKey(
        CheckSecretStorageKeyArgs(
          key: key,
          iv: info.iv!,
          mac: info.mac!,
        ),
      );
    } else {
      // no real information about the key, assume it is valid
      return true;
    }
  } else {
    throw InvalidPassphraseException('Unknown Algorithm');
  }
}