Leaked passwords
Check Have I Been Pwned from a Server Action.
← All examples·pwned
Preview
// app/signup/pwned-action.ts
"use server";
import { checkPwned, type PwnedResult } from "@virastack/password/pwned";
// From the server, Have I Been Pwned never sees the user's IP.
// Only the first 5 characters of the SHA-1 hash are sent.
export async function checkPassword(password: string): Promise<PwnedResult> {
return checkPwned(password, { timeout: 3000 });
}Details
- Only the first 5 characters of the SHA-1 hash leave the server.
- Calling it from the server keeps the user's IP away from HIBP.
- On any failure the status is unknown; never block the user.
For the hook API see useViraPassword(), for styling and icons see customization.
