pdf-lite - v1.0.1
    Preparing search index...
    • Validates a password against a stored hash using the Algorithm 2.B hash.

      Parameters

      • password: ByteArray

        The password to validate.

      • key: ByteArray

        The stored key containing the hash (first 32 bytes) and validation salt (bytes 32-40).

      • Optionalextra: ByteArray

        Extra data for owner password validation (user key).

      Returns Promise<ByteArray>

      A promise that resolves to the computed hash if validation succeeds.

      Error if the password is invalid or salt/hash lengths are incorrect.

      try {
      await validatePasswordHash(password, storedKey)
      console.log('Password is valid')
      } catch (e) {
      console.log('Invalid password')
      }