@lacspace/password
Password hashing & verification — PBKDF2-HMAC-SHA256 (OWASP iterations) with a portable PHC string + a strength estimator. Isomorphic over Web Crypto.
npm i @lacspace/passwordUsage
import { hash, verify, needsRehash, strength } from "@lacspace/password";
const stored = await hash("correct horse battery staple");
// "$pbkdf2-sha256$i=600000$<salt>$<hash>" — store this string
await verify("correct horse battery staple", stored); // true
await verify("wrong", stored); // false
if (needsRehash(stored)) { /* re-hash with current params after a successful login */ }
strength("password"); // { score: 0, warnings: ["This is a very common password."] }
strength("Tr0ub4dour&3xy"); // { score: 4, warnings: [] }Exports 4
hashneedsRehashstrengthverifyKeywords
More in Security Kit
Issue & verify API keys the right way — prefixed high-entropy keys, store only the SHA-256 hash, constant-time verify, last-4 display. Isomorphic over Web Crypto.
@lacspace/cryptoSafe, boring cryptography over Web Crypto — authenticated AES-256-GCM, PBKDF2 key derivation, SHA-256, HMAC, secure random and constant-time compare. Isomorphic (Node, edge, browser, RN).
@lacspace/headersSecure HTTP headers & a typed Content-Security-Policy builder — HSTS, X-Frame-Options, Referrer-Policy, Permissions-Policy. Framework-agnostic + Next.js. Zero-dependency, isomorphic.
@lacspace/jwtJSON Web Tokens (HS256/384/512) with strict expiry/issuer/audience checks + secure random & CSRF tokens. Isomorphic over Web Crypto — Node, edge, browser.
@lacspace/lockAccount lockout & brute-force protection (server lock) — N-strikes, exponential backoff, self-resetting window, pluggable store. Zero-dependency, isomorphic.
@lacspace/mfaOrchestrate multi-factor auth — combine password + TOTP + passkeys into 2FA/3FA step-up flows with NIST assurance levels (AAL). Zero-dependency (bar @lacspace/otp), isomorphic.