import { validateRegistration } from "#fune/auth.validate-registration@^1";
Suites · auth
User accounts and authentication
Sign-up and login forms, password policy and hashing, login lockout, signed access tokens, two-factor codes, email verification and reset tokens, account linking and roles.
42 capabilities (13 core, 29 optional) and 13 gaps, in build order. Put each line in the file that calls it, then fune build.
Core coverage: 50%
13 of 26 needs met by verified capabilities. The needs are this suite's 13 core members and its 13 named gaps; a core member counts when a version of it is verified (by the sandbox, or the registry's seed) and not yanked, and a gap never counts. Optional members are not needs.
Baseline: a hand-written app with no suite meets 0 of the same 26. Method fune-coverage/1, computed 2026-11-22T21:02:27.772Z.
1. Sign-up and login forms
Check what people type into the account forms, the same way in the browser and the API.
import { validateLogin } from "#fune/auth.validate-login@^1";
import { normaliseEmail } from "#fune/auth.normalise-email@^1";
import { validatePasswordChange } from "#fune/auth.validate-password-change@^1";
2. Passwords
Decide what passwords are acceptable and store them safely.
import { passwordPolicy, checkPassword } from "#fune/auth.password-policy@^1";
import { hashPassword, verifyPassword, passwordNeedsRehash } from "#fune/auth.password-hash@^1";
import { pbkdf2Sha256 } from "#fune/crypto.pbkdf2-sha256@^1";
import { constantTimeEqual } from "#fune/crypto.constant-time-equal@^1";
- breached-passwords Checking passwords against a breach corpus (Have I Been Pwned's range API) is network work; the policy's common-password list is built in.
3. Login protection
Slow down password guessing.
import { loginThrottle } from "#fune/auth.login-throttle@^1";
import { retryAfterSeconds } from "#fune/http.retry-after@^1";
- ip-rate-limiting Rate limiting by IP address across accounts, with its shared counter store (Redis, a database).
4. Tokens
Issue and check signed tokens for an API or a single-page app.
import { issueAccessToken, readAccessToken, confirmAccessToken } from "#fune/auth.access-token@^1";
import { parseBearerToken } from "#fune/auth.bearer-token@^1";
import { signJwt, verifyJwt, decodeJwt } from "#fune/auth.jwt@^1";
import { hmacSha256 } from "#fune/crypto.hmac-sha256@^1";
import { sha256 } from "#fune/crypto.sha256@^1";
import { base64Encode, base64Decode, base64UrlEncode, base64UrlDecode } from "#fune/encoding.base64@^1";
import { countdown } from "#fune/time.countdown@^1";
- sessions Server-side session stores and CSRF tokens are yours; auth.oauth-sign-in signs a stateless session cookie with Secure/HttpOnly/SameSite set.
- asymmetric-jwt RS256/ES256 tokens and JWKS key sets (for third-party identity providers): auth.jwt is HS256 only.
5. Sign-in with an identity provider
Let people sign in with Google, Microsoft, GitHub or any OpenID Connect provider, and keep them signed in.
import { beginSignIn, completeSignIn, createSession, readSession, sessionCookie } from "#fune/auth.oauth-sign-in@^1";
import { decideAccountLink } from "#fune/auth.account-link@^1";
- identity-links The table of provider identities linked to accounts, and the unlink page, are yours; auth.account-link decides.
6. Email verification, password reset and magic links
Prove someone owns an address with a single-use link that expires.
import { generateEmailToken, hashEmailToken, checkEmailToken, consumeEmailToken } from "#fune/auth.email-token@^1";
import { sendEmail } from "#fune/email.send@^1";
- email-token-table The table the hashed tokens live in (token_hash, purpose, subject, expires_at, used_at) is yours.
7. Two-factor sign-in
Ask for a second factor after the password: an authenticator app code, or a recovery code.
import { totpSecret, totpUri, hotpCode, totpCode, verifyTotp } from "#fune/auth.totp@^1";
import { generateRecoveryCodes, normaliseRecoveryCode, hashRecoveryCode, consumeRecoveryCode } from "#fune/auth.recovery-codes@^1";
- passkeys-sms Passkeys/WebAuthn and SMS codes are not in Functional Weave.
8. Roles and permissions
Decide who may do what, and test it.
import { resolveRoles, hasPermission, checkAccess, accessMatrix } from "#fune/auth.rbac@^1";
- org-membership Organisations, invitations and membership tables are yours to model.
9. Forms in React
Accessible account pages in a React front end (TypeScript only).
import { passwordChecklist, PasswordField } from "#fune/react.form.password-field@^1";
import { TextField } from "#fune/react.form.text-field@^1";
import { ValidatedInput } from "#fune/react.form.validated-input@^1";
import { errorSummaryItems, ErrorSummary } from "#fune/react.form.error-summary@^1";
import { initialFormState, formReducer, visibleErrors } from "#fune/form.state@^1";
10. Contact details from validation-basics
Check and normalise a person's contact details before storing them.
import { isEmail } from "#fune/validation.email@^1";
import { validatePhoneE164 } from "#fune/validation.phone-e164@^2";
import { validateUkPostcode } from "#fune/validation.uk-postcode@^2";
import { normaliseName } from "#fune/text.normalise-name@^1";
11. Bank details from validation-basics
Check payee and customer bank details before money moves.
import { isIban } from "#fune/validation.iban@^1";
import { validateBic } from "#fune/validation.bic@^1";
import { validateUkSortCodeAccount } from "#fune/validation.uk-sort-code-account@^3";
import { parseUkModulusTable } from "#fune/validation.uk-modulus-table@^1";
12. Identifiers and check digits from validation-basics
Catch mistyped reference numbers by their check digits.
import { isLuhn } from "#fune/validation.luhn@^1";
import { validateUkCompanyNumber } from "#fune/validation.uk-company-number@^2";
import { validateLei } from "#fune/validation.lei@^1";
import { validateGtin } from "#fune/validation.gtin@^1";
13. Displaying sensitive values from validation-basics
Show stored identifiers without exposing them.
import { mask } from "#fune/text.mask@^1";
Gaps
What this kind of app usually needs that Functional Weave does not have yet: write these yourself, or use a service.
- email-wording The wording of the verification, reset and magic-link emails; email.send sends them.
- user-storage The users table, unique email index, migrations and account deletion.
- address-lookup Turning a postcode into a list of addresses (Royal Mail PAF or a lookup API) is network work and not in caps.
- email-deliverability Whether a mailbox exists (MX lookups, a confirmation email): validation.email checks the syntax only.
- vocalink-data The Vocalink modulus tables themselves: download them from Pay.UK under its terms; caps parses them but does not ship them.