@vvlad1973/crypto - v2.4.0
    Preparing search index...

    Function verifyPassword

    • Verify a plaintext password against a hash produced by hashPassword.

      The stored parameters and salt are read back from stored, the candidate is re-derived with them, and the two keys are compared with timingSafeEqual to avoid leaking information through comparison timing. Any structurally invalid or non-scrypt stored value (empty string, wrong field count, unknown algorithm, bad hex) yields false rather than throwing, so it is safe on an auth path.

      Parameters

      • plain: string

        The candidate plaintext password.

      • stored: string

        The stored hash string to check against.

      Returns Promise<boolean>

      true when the password matches, false otherwise.