verifyPassword function

Future<bool> verifyPassword(
  1. String algo,
  2. String hash,
  3. String password, {
  4. LibLoader? libLoader,
})

Implementation

Future<bool> verifyPassword(String algo, String hash, String password, {LibLoader? libLoader}) async {
  if (algo == 'argon2') {
    try {
      bool isPasswordMatch = await DArgon2Native(
        libLoader ?? OpenruntimeLibLoader(),
      ).verifyHashString(
        password,
        hash,
        type: Argon2Type.id,
      );
      return isPasswordMatch;
    } catch (e) {
      return false;
    }
  }

  throw UnimplementedError('$algo not implemented');
}