validateHashFromString method

Future<bool> validateHashFromString({
  1. required String secret,
  2. required String hashString,
})

Verify whether the hashString is valid for the given secret (String).

hashString should be a PHC-formatted string: $argon2id$v=19$m={memory},t={iterations},p={lanes}${base64Salt}${base64Hash}

Tries the primary pepper first, then falls back to the fallback peppers if provided.

Implementation

Future<bool> validateHashFromString({
  required final String secret,
  required final String hashString,
}) async {
  final secretBytes = utf8.encode(secret);
  return _validateHashFromHashedString(
    secret: secretBytes,
    hashString: hashString,
  );
}