KavachOS integrates with the HaveIBeenPwned Pwned Passwords API to detect compromised passwords at sign-up and password change. It uses the k-anonymity model, only the first 5 characters of the SHA-1 hash are sent to the API. Your users’ actual passwords never leave your server.Documentation Index
Fetch the complete documentation index at: https://docs.kavachos.com/llms.txt
Use this file to discover all available pages before exploring further.
Setup
lib/kavach.ts
check() and enforce()
The module exposes two methods with different failure modes:Manual usage
check() is useful when you want to warn the user without blocking them. enforce() integrates directly into the password validation lifecycle and blocks the request.
How k-anonymity works
Custom API key
The HIBP Passwords API is free and does not require authentication, but a paid key removes rate limits:lib/kavach.ts
If the HIBP API is unreachable,
check() returns { breached: false } and enforce() passes through. The default behavior is fail-open so a slow network does not block your users from registering. Set failClosed: true to change this.Configuration reference
Optional HIBP API key for higher rate limits.
Milliseconds to wait for the HIBP API before giving up.
Reject the password if HIBP is unreachable instead of passing through.
Minimum breach count before a password is considered compromised.