Password field SDK
A small JavaScript library for sign-up and change-password forms. It checks a new password the way NIST SP 800-63B-4 tells a verifier to: by length and against breach data, with no rules about uppercase letters or symbols. It is under 6 KB, has no dependencies, works with any form, and the password never leaves the browser.
What it checks, and the clause behind each check
| Check | What the SDK does | Clause |
|---|---|---|
| Length | Refuses a password shorter than your minimum (15 by default, for a password that is the only sign-in factor; 8 is allowed where it is one factor of MFA). | SP 800-63B-4 3.1.1.2 |
| Long passwords | Always accepts at least 64 characters, whatever maximum you set. | SP 800-63B-4 3.1.1.2 |
| No composition rules | Never asks for an uppercase letter, a digit or a symbol. Any characters are allowed, including spaces. | SP 800-63B-4 3.1.1.2 |
| Breach blocklist | Looks the password up in Pwned Passwords and says why it was refused. Only the first 5 characters of its SHA-1 hash are sent, with padding so the size of the answer reveals nothing. | SP 800-63B-4 3.1.1.2 |
| Words about the person | Refuses a password that contains the person's name, their email or your organisation's name. | SP 800-63B-4 3.1.1.2 |
| Unicode | Normalises with NFKC before counting and hashing, and counts code points, so an emoji or an accented letter is one character. | SP 800-63B-4 3.1.1.2 |
Checked against SP 800-63B-4 (final) on 2026-11-28. The same rules for other frameworks are in the framework comparison.
Try it
A sign-up form with the SDK attached to the password field. Type a name, then try a password that contains it, a short one, a common one such as a keyboard run, and four random words. Nothing here is saved; the only request is the 5-character hash prefix sent to Pwned Passwords.
This form's code
Add it to a form
Import the module from this site and attach it to your password input. It adds a list of reasons under the input, announced politely to screen readers, and stops the form submitting a refused password. The module's address is /__cptools/sdk/v1/cp-password.js under this site's app address; the box in the demo above shows it in full.
- As a module:
import { attachPasswordField, checkPassword } from "<this site>/__cptools/sdk/v1/cp-password.js". - As a script tag: load
/__cptools/sdk/v1/cp-password.min.jsand callCorporatePassword.attachPasswordField(input, options). - With your own interface: call
checkPassword(password, options)and showresult.reasonsyourself. - Style the feedback with the class
.cp-password-feedback. The SDK adds no styles of its own.
Options
| Option | Default | What it does |
|---|---|---|
minLength | 15 | Minimum length in characters (code points after NFKC). |
maxLength | 256 | Maximum length. A value under 64 is treated as 64. |
contextWords | none | Words to refuse inside a password, such as your organisation's name. Words under 4 characters are ignored. |
blocklist | "pwned-k-anonymity" | Check breach data. "none" turns it off. |
normalise | "NFKC" | The Unicode form used for counting and hashing. |
onBreachCheckFailure | "open" | When the breach service cannot be reached: "open" accepts the password and reports the check as unavailable; "closed" refuses until it can be checked. |
strength | false | Also return a strength estimate. Loads the estimator, a much larger file, on first use. |
contextFields | none | attachPasswordField only: other inputs (name, email) whose values must not appear in the password. |
showStrength | false | attachPasswordField only: show a one-line strength estimate under the reasons. |
These are the same names the policy builder writes in its Code tab, so the config it gives you for your policy can be passed straight in.
The result
ok: true when the password may be accepted.reasons: why it is refused, in plain words you can show.codesholds the same reasons as stable identifiers.breachCheck:"clear","found","unavailable"or"skipped".notessays "Breach check unavailable" when the service could not be reached and the password was accepted anyway.strength: the score from 0 to 4, the estimated guesses and crack times, when you asked for it.
Check it on your server too
A check in the browser can be skipped by anyone who posts to your server directly. Run the same rules where the password is saved. The policy builder's Code tab writes that check for your policy in Node (TypeScript), Python and C#, and each one stores nothing: hash the accepted password with Argon2id or bcrypt before you save it (Argon2 hash generator).
Common questions
Does the password leave the browser?
No. The SDK hashes it in the browser and sends only the first 5 characters of the SHA-1 hash to Pwned Passwords, which returns every hash that starts that way. The match is made in the browser. Nothing is sent to this site.
What happens when the breach service is down?
By default the password is accepted and the result says the breach check was unavailable, so a third-party outage does not stop people signing up. Set onBreachCheckFailure: "closed" to refuse instead.
Why does it not ask for a symbol or a capital letter?
Because NIST says verifiers shall not impose composition rules. They produce predictable passwords such as a capitalised word with a digit and an exclamation mark. Length and the breach check stop far more weak passwords.
Is the version stable?
The address contains the major version. Version 1 keeps its options and result fields; a change that breaks them will be published under a new address and version 1 will keep working.
Writing the policy this enforces? Build it against NIST, the ISM or PCI DSS, then audit the settings your directory enforces.