verifyPassword static method

bool verifyPassword({
  1. required String key,
  2. String? hash,
})

Verifies a plain-text password against a stored hash.

Parameters:

  • key: The plain-text password to verify.
  • hash: The stored password hash.

Returns true when the password matches the hash; otherwise false.

Example:

final hash = Auth.hashPassword(key: 'super-secret-password');
final matches = Auth.verifyPassword(
  key: 'super-secret-password',
  hash: hash,
);

print(matches); // true

Implementation

static bool verifyPassword({required String key, String? hash}) {
  return Hasher.check(key: key, hash: hash);
}