@nxgt/janus 0.25.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/README.md +22 -5
  2. package/dist/auth/config/reserved.d.ts +1 -1
  3. package/dist/auth/config/reserved.d.ts.map +1 -1
  4. package/dist/auth/email-flows/any-type-change-email.d.ts +18 -0
  5. package/dist/auth/email-flows/any-type-change-email.d.ts.map +1 -0
  6. package/dist/auth/email-flows/change-email-token.d.ts +6 -1
  7. package/dist/auth/email-flows/change-email-token.d.ts.map +1 -1
  8. package/dist/auth/email-flows/change-email.d.ts +6 -0
  9. package/dist/auth/email-flows/change-email.d.ts.map +1 -1
  10. package/dist/auth/index.d.ts +1 -1
  11. package/dist/auth/index.d.ts.map +1 -1
  12. package/dist/auth/janus.d.ts.map +1 -1
  13. package/dist/auth/sign-in-attempts.d.ts +5 -0
  14. package/dist/auth/sign-in-attempts.d.ts.map +1 -1
  15. package/dist/auth/types/change-email.d.ts +31 -0
  16. package/dist/auth/types/change-email.d.ts.map +1 -1
  17. package/dist/auth/types/index.d.ts +1 -1
  18. package/dist/auth/types/index.d.ts.map +1 -1
  19. package/dist/auth/types/janus.d.ts +9 -2
  20. package/dist/auth/types/janus.d.ts.map +1 -1
  21. package/dist/auth/types/password.d.ts +8 -2
  22. package/dist/auth/types/password.d.ts.map +1 -1
  23. package/dist/auth/users/change-password.d.ts +13 -0
  24. package/dist/auth/users/change-password.d.ts.map +1 -1
  25. package/dist/index.js +470 -450
  26. package/dist/index.js.map +20 -19
  27. package/docs/README.md +1 -1
  28. package/docs/guide/email-flows.md +14 -0
  29. package/docs/guide/passwords.md +8 -2
  30. package/docs/guide/users.md +3 -3
  31. package/docs/roadmap.md +11 -27
  32. package/docs/troubleshooting.md +15 -12
  33. package/package.json +1 -1
package/dist/index.js.map CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/auth/hashers.ts", "../src/time/clock.ts", "../src/auth/config/normalize.ts", "../src/auth/config/reserved.ts", "../src/time/duration.ts", "../src/auth/config/names.ts", "../src/auth/config/resolve-cookie.ts", "../src/auth/sealing.ts", "../src/auth/config/resolve-devices.ts", "../src/auth/config/resolve-second-factor.ts", "../src/auth/config/resolve-throttle.ts", "../src/auth/config/resolve-type.ts", "../src/auth/config/resolve-config.ts", "../src/auth/config/warn-throttle-window.ts", "../src/auth/context/create-context.ts", "../src/auth/context/logins.ts", "../src/auth/outage.ts", "../src/auth/context/password.ts", "../src/auth/context/user.ts", "../src/auth/context/records.ts", "../src/auth/context/validate-fields.ts", "../src/auth/events.ts", "../src/auth/port/assert-stores.ts", "../src/auth/devices/token.ts", "../src/auth/derived-keys.ts", "../src/auth/devices/hint.ts", "../src/auth/devices/report.ts", "../src/auth/secrets.ts", "../src/auth/sessions/open-session.ts", "../src/auth/sessions/presented-token.ts", "../src/auth/sessions/standing.ts", "../src/auth/sessions/authenticate.ts", "../src/auth/sessions/collect-expired.ts", "../src/auth/sessions/cookie.ts", "../src/auth/sessions/shared-api.ts", "../src/auth/counter-key.ts", "../src/auth/one-time/codes.ts", "../src/auth/one-time/refusals.ts", "../src/auth/one-time/spend.ts", "../src/auth/one-time/issue.ts", "../src/auth/one-time/window.ts", "../src/auth/mail-requests.ts", "../src/auth/users/fields-patch.ts", "../src/auth/email-flows/change-email-token.ts", "../src/auth/email-flows/change-email.ts", "../src/auth/password-written.ts", "../src/auth/prepared.ts", "../src/auth/email-flows/email-token.ts", "../src/auth/email-flows/reset-password.ts", "../src/auth/totp.ts", "../src/auth/second-factor/factor.ts", "../src/auth/first-proof.ts", "../src/auth/email-flows/prove-first.ts", "../src/auth/email-flows/verify-email.ts", "../src/auth/email-flows/flows.ts", "../src/auth/email-sign-in.ts", "../src/auth/magic-link.ts", "../src/auth/proven-sign-in.ts", "../src/auth/sign-in-attempts.ts", "../src/auth/second-factor/redeem.ts", "../src/auth/second-factor/challenge.ts", "../src/auth/second-factor/codes-left.ts", "../src/auth/second-factor/recovery-codes.ts", "../src/auth/second-factor/refusal.ts", "../src/auth/second-factor/activate.ts", "../src/auth/second-factor/disable.ts", "../src/auth/second-factor/enroll.ts", "../src/auth/second-factor/app-code-attempts.ts", "../src/auth/second-factor/regenerate.ts", "../src/auth/second-factor/lifecycle.ts", "../src/auth/second-factor/recovery.ts", "../src/auth/second-factor/flows.ts", "../src/auth/sign-in-code.ts", "../src/auth/step-up/codes.ts", "../src/auth/step-up/open.ts", "../src/auth/step-up/request.ts", "../src/auth/step-up/flows.ts", "../src/auth/users/find-by-email.ts", "../src/auth/users/by-login.ts", "../src/auth/users/insert.ts", "../src/auth/users/find-or-create.ts", "../src/auth/users/change-password.ts", "../src/auth/users/sign-in.ts", "../src/auth/users/password-flows.ts", "../src/auth/users/delete.ts", "../src/auth/users/find-many.ts", "../src/auth/users/update.ts", "../src/auth/users/record-flows.ts", "../src/auth/users/type-api.ts", "../src/auth/janus.ts", "../src/auth/sessions/fresh.ts"],
3
+ "sources": ["../src/auth/hashers.ts", "../src/time/clock.ts", "../src/auth/config/normalize.ts", "../src/auth/config/reserved.ts", "../src/time/duration.ts", "../src/auth/config/names.ts", "../src/auth/config/resolve-cookie.ts", "../src/auth/sealing.ts", "../src/auth/config/resolve-devices.ts", "../src/auth/config/resolve-second-factor.ts", "../src/auth/config/resolve-throttle.ts", "../src/auth/config/resolve-type.ts", "../src/auth/config/resolve-config.ts", "../src/auth/config/warn-throttle-window.ts", "../src/auth/context/create-context.ts", "../src/auth/context/logins.ts", "../src/auth/outage.ts", "../src/auth/context/password.ts", "../src/auth/context/user.ts", "../src/auth/context/records.ts", "../src/auth/context/validate-fields.ts", "../src/auth/events.ts", "../src/auth/derived-keys.ts", "../src/auth/counter-key.ts", "../src/auth/one-time/codes.ts", "../src/auth/secrets.ts", "../src/auth/one-time/refusals.ts", "../src/auth/one-time/spend.ts", "../src/auth/one-time/issue.ts", "../src/auth/one-time/window.ts", "../src/auth/mail-requests.ts", "../src/auth/users/fields-patch.ts", "../src/auth/email-flows/change-email-token.ts", "../src/auth/email-flows/change-email.ts", "../src/auth/email-flows/any-type-change-email.ts", "../src/auth/port/assert-stores.ts", "../src/auth/devices/token.ts", "../src/auth/devices/hint.ts", "../src/auth/devices/report.ts", "../src/auth/sessions/open-session.ts", "../src/auth/sessions/presented-token.ts", "../src/auth/sessions/standing.ts", "../src/auth/sessions/authenticate.ts", "../src/auth/sessions/collect-expired.ts", "../src/auth/sessions/cookie.ts", "../src/auth/sessions/shared-api.ts", "../src/auth/password-written.ts", "../src/auth/prepared.ts", "../src/auth/email-flows/email-token.ts", "../src/auth/email-flows/reset-password.ts", "../src/auth/totp.ts", "../src/auth/second-factor/factor.ts", "../src/auth/first-proof.ts", "../src/auth/email-flows/prove-first.ts", "../src/auth/email-flows/verify-email.ts", "../src/auth/email-flows/flows.ts", "../src/auth/email-sign-in.ts", "../src/auth/magic-link.ts", "../src/auth/proven-sign-in.ts", "../src/auth/sign-in-attempts.ts", "../src/auth/second-factor/redeem.ts", "../src/auth/second-factor/challenge.ts", "../src/auth/second-factor/codes-left.ts", "../src/auth/second-factor/recovery-codes.ts", "../src/auth/second-factor/refusal.ts", "../src/auth/second-factor/activate.ts", "../src/auth/second-factor/disable.ts", "../src/auth/second-factor/enroll.ts", "../src/auth/second-factor/app-code-attempts.ts", "../src/auth/second-factor/regenerate.ts", "../src/auth/second-factor/lifecycle.ts", "../src/auth/second-factor/recovery.ts", "../src/auth/second-factor/flows.ts", "../src/auth/sign-in-code.ts", "../src/auth/step-up/codes.ts", "../src/auth/step-up/open.ts", "../src/auth/step-up/request.ts", "../src/auth/step-up/flows.ts", "../src/auth/users/find-by-email.ts", "../src/auth/users/by-login.ts", "../src/auth/users/insert.ts", "../src/auth/users/find-or-create.ts", "../src/auth/users/change-password.ts", "../src/auth/users/sign-in.ts", "../src/auth/users/password-flows.ts", "../src/auth/users/delete.ts", "../src/auth/users/find-many.ts", "../src/auth/users/update.ts", "../src/auth/users/record-flows.ts", "../src/auth/users/type-api.ts", "../src/auth/janus.ts", "../src/auth/sessions/fresh.ts"],
4
4
  "sourcesContent": [
5
5
  "import { randomBytes, scrypt, timingSafeEqual } from 'node:crypto';\nimport type { PasswordHasher } from './config';\n\n/**\n * scrypt through `node:crypto` — the hasher that runs **everywhere**: Node and\n * Bun both implement it, and it needs no dependency.\n *\n * Measured before choosing it: `bun build --target node` leaves `Bun.password`\n * in the output as it is — a target changes the bundle's format, not which\n * APIs exist — and `crypto.argon2` is absent from Node 22. scrypt is the one\n * memory-hard function both runtimes ship.\n *\n * The defaults are OWASP's: N = 2^17, r = 8, p = 1, about 128 MiB per hash.\n * The parameters are written into the hash —\n * `$scrypt$ln=17,r=8,p=1$<salt>$<key>` — and read back from it to verify, so\n * raising `cost` later leaves every existing hash readable.\n *\n * `cost` is log2(N). Lower it only in tests: 10 is fast and still exercises\n * every line.\n *\n * A hash written with other parameters than these is rewritten with these the\n * next time its owner signs in (`needsRehash`), so raising `cost` reaches every\n * active user without a migration.\n */\nexport function scryptHasher(options?: {\n\treadonly cost?: number;\n}): PasswordHasher {\n\tconst cost = options?.cost ?? 17;\n\tif (!Number.isInteger(cost) || cost < 10 || cost > 20) {\n\t\tthrow new TypeError(\n\t\t\t'scryptHasher: cost is log2(N), an integer from 10 to 20 — 17 is the recommended value',\n\t\t);\n\t}\n\n\treturn {\n\t\tprefix: SCRYPT_PREFIX,\n\t\tasync hash(plain) {\n\t\t\tconst salt = randomBytes(16);\n\t\t\tconst key = await derive(plain, salt, cost, 8, 1);\n\t\t\treturn `${SCRYPT_PREFIX}ln=${cost},r=8,p=1$${salt.toString('base64')}$${key.toString('base64')}`;\n\t\t},\n\t\tasync verify(plain, hash) {\n\t\t\tconst parsed = SCRYPT_HASH.exec(hash);\n\t\t\t// A hash this hasher cannot parse is not a wrong password, and not\n\t\t\t// something to guess at: the core picked this verifier by prefix, so\n\t\t\t// the stored hash is corrupt.\n\t\t\tif (parsed === null) {\n\t\t\t\tthrow new TypeError(\n\t\t\t\t\t'scryptHasher: the stored hash has the $scrypt$ prefix and not its format',\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst [, ln, r, p, salt, key] = parsed as unknown as [\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t\tstring,\n\t\t\t];\n\t\t\tconst expected = Buffer.from(key, 'base64');\n\t\t\tconst actual = await derive(\n\t\t\t\tplain,\n\t\t\t\tBuffer.from(salt, 'base64'),\n\t\t\t\tNumber(ln),\n\t\t\t\tNumber(r),\n\t\t\t\tNumber(p),\n\t\t\t\texpected.length,\n\t\t\t);\n\t\t\treturn timingSafeEqual(actual, expected);\n\t\t},\n\t\tneedsRehash(hash) {\n\t\t\tconst parsed = SCRYPT_HASH.exec(hash);\n\t\t\t// Unparseable is verify's refusal to make, not a reason to rewrite.\n\t\t\tif (parsed === null) return false;\n\t\t\tconst [, ln, r, p] = parsed;\n\t\t\treturn Number(ln) !== cost || r !== '8' || p !== '1';\n\t\t},\n\t};\n}\n\nconst SCRYPT_PREFIX = '$scrypt$';\nconst SCRYPT_HASH =\n\t/^\\$scrypt\\$ln=(\\d+),r=(\\d+),p=(\\d+)\\$([A-Za-z0-9+/=]+)\\$([A-Za-z0-9+/=]+)$/;\n\nfunction derive(\n\tplain: string,\n\tsalt: Buffer,\n\tln: number,\n\tr: number,\n\tp: number,\n\tlength = 32,\n): Promise<Buffer> {\n\t// Node's camelCase aliases for N, r and p: this repository has no other\n\t// casing, and Node accepts both spellings.\n\tconst n = 2 ** ln;\n\treturn new Promise((resolve, reject) => {\n\t\t// maxmem: Node's default (32 MiB) is below what N = 2^17, r = 8 needs.\n\t\t// `error` is null on Node and undefined on Bun when there is none —\n\t\t// measured: testing `=== null` rejected every hash under Bun.\n\t\tscrypt(\n\t\t\tplain,\n\t\t\tsalt,\n\t\t\tlength,\n\t\t\t{ cost: n, blockSize: r, parallelization: p, maxmem: 256 * n * r },\n\t\t\t(error, key) => (error ? reject(error) : resolve(key)),\n\t\t);\n\t});\n}\n\n/**\n * argon2id through `Bun.password`.\n *\n * **Loaded only when named**: nothing reads `Bun` until this function is called,\n * so the package imports cleanly under Node. On Node, `scryptHasher()` is the\n * hasher; a hash written here reads anywhere a verifier for `$argon2id$` is\n * wired, so a database can move between the two runtimes.\n */\nexport function bunHasher(): PasswordHasher {\n\t// `typeof` on an undeclared global is 'undefined' rather than a throw, so\n\t// this line is safe under Node.\n\tconst password: BunPassword | undefined =\n\t\ttypeof Bun === 'undefined' ? undefined : Bun.password;\n\n\tif (password === undefined) {\n\t\tthrow new TypeError(\n\t\t\t'bunHasher: Bun.password is not available — this runtime is not Bun; wire scryptHasher() instead',\n\t\t);\n\t}\n\n\treturn {\n\t\tprefix: '$argon2id$',\n\t\thash: (plain) => password.hash(plain, ARGON2ID),\n\t\tverify: (plain, hash) => password.verify(plain, hash),\n\t\tneedsRehash: (hash) => !hash.startsWith(ARGON2ID_PARAMETERS),\n\t};\n}\n\n/**\n * Pinned rather than left to `Bun.password`'s defaults — which they equal\n * today, measured: `$argon2id$v=19$m=65536,t=2,p=1$` — so that a change of\n * default in a Bun release is a rehash this package decided, not one it\n * inherited.\n */\nconst ARGON2ID = {\n\talgorithm: 'argon2id',\n\tmemoryCost: 65_536,\n\ttimeCost: 2,\n} as const;\nconst ARGON2ID_PARAMETERS = '$argon2id$v=19$m=65536,t=2,p=1$';\n\ninterface BunPassword {\n\thash(plain: string, options: typeof ARGON2ID): Promise<string>;\n\tverify(plain: string, hash: string): Promise<boolean>;\n}\n",
6
6
  "/**\n * Where `now` comes from.\n *\n * Injected rather than read from `Date` directly, for one practical reason:\n * every expiry in this package — sessions, one-time tokens, refresh windows —\n * is a comparison against the current time, and a spec that has to move the\n * real clock to test one is a spec that needs fake timers, leaks them, and\n * fails differently under load. A `Clock` makes those specs synchronous and\n * exact.\n *\n * It is also the seam an application needs if it ever has to reason about a\n * store's clock rather than its own: MongoDB stamps a TTL against the server's\n * time, not the process's.\n */\nexport interface Clock {\n\tnow(): Date;\n}\n\n/** The process's own clock. The default everywhere. */\nexport const systemClock: Clock = {\n\tnow: () => new Date(),\n};\n\n/**\n * A clock a spec drives by hand.\n *\n * Shipped rather than kept in `test/`: a consumer writing their own tests\n * against this package needs exactly this, and writing it again is how two\n * subtly different versions of \"advance time\" come to exist.\n */\nexport function fixedClock(start: Date | number = 0): Clock & {\n\tadvance(ms: number): void;\n\tset(at: Date | number): void;\n} {\n\tlet ms = start instanceof Date ? start.getTime() : start;\n\n\treturn {\n\t\tnow: () => new Date(ms),\n\t\tadvance: (by) => {\n\t\t\tms += by;\n\t\t},\n\t\tset: (at) => {\n\t\t\tms = at instanceof Date ? at.getTime() : at;\n\t\t},\n\t};\n}\n",
7
7
  "/**\n * How a login, and an e-mail, is normalised before any store sees it: the\n * rules `password.normalize` may name, and the one an e-mail always uses.\n */\n\n/**\n * How a login is normalised before any store sees it. `'lowercaseTrim'` when\n * absent — right for an e-mail and for most usernames.\n *\n * A function is accepted for anything else. It must be deterministic: the same\n * rule normalises at sign-up and at sign-in.\n */\nexport type Normalize =\n\t| 'none'\n\t| 'lowercase'\n\t| 'lowercaseTrim'\n\t| 'nfkcLowercaseTrim'\n\t| ((value: string) => string);\n\nconst NORMALIZERS = {\n\tnone: (value: string) => value,\n\tlowercase: (value: string) => value.toLowerCase(),\n\tlowercaseTrim: (value: string) => value.toLowerCase().trim(),\n\tnfkcLowercaseTrim: (value: string) =>\n\t\tvalue.normalize('NFKC').toLowerCase().trim(),\n} as const satisfies Record<string, (value: string) => string>;\n\n/** How an e-mail is compared: always the same rule, whatever the login's. */\nexport const normalizeEmail = NORMALIZERS.lowercaseTrim;\n\n/** The function a {@link Normalize} rule names, or a wiring refusal. */\nexport function normalizer(\n\trule: Normalize,\n\twhere: string,\n): (value: string) => string {\n\tif (typeof rule === 'function') return rule;\n\tif (typeof rule === 'string' && Object.hasOwn(NORMALIZERS, rule)) {\n\t\treturn NORMALIZERS[rule];\n\t}\n\n\tthrow new TypeError(\n\t\t`${where} must be \"none\", \"lowercase\", \"lowercaseTrim\", \"nfkcLowercaseTrim\" or a function`,\n\t);\n}\n",
8
- "/**\n * The names `janus` keeps for itself: the single-type form's type name, the\n * keys it sets on every user, and the methods on its answer.\n */\n\n/** The type name the single-type form gives its users. */\nexport const SINGLE_TYPE = 'user';\n\n/**\n * Keys `janus` sets on every user, so a schema may not declare them.\n * `password` too: it is taken beside the fields, and never stored among them.\n */\nexport const RESERVED_FIELDS = [\n\t'id',\n\t'type',\n\t'emailVerified',\n\t'active',\n\t'hasPassword',\n\t'hasSecondFactor',\n\t'version',\n\t'createdAt',\n\t'updatedAt',\n\t'password',\n] as const;\n\n/** Names on `janus()`'s answer, so a user type may not take one. */\nexport const RESERVED_TYPES = [\n\t'authenticate',\n\t'signOut',\n\t'signOutEverywhere',\n\t'findUser',\n\t'getUser',\n\t'cookie',\n\t'collectExpired',\n\t'types',\n] as const;\n",
8
+ "/**\n * The names `janus` keeps for itself: the single-type form's type name, the\n * keys it sets on every user, and the methods on its answer.\n */\n\n/** The type name the single-type form gives its users. */\nexport const SINGLE_TYPE = 'user';\n\n/**\n * Keys `janus` sets on every user, so a schema may not declare them.\n * `password` too: it is taken beside the fields, and never stored among them.\n */\nexport const RESERVED_FIELDS = [\n\t'id',\n\t'type',\n\t'emailVerified',\n\t'active',\n\t'hasPassword',\n\t'hasSecondFactor',\n\t'version',\n\t'createdAt',\n\t'updatedAt',\n\t'password',\n] as const;\n\n/** Names on `janus()`'s answer, so a user type may not take one. */\nexport const RESERVED_TYPES = [\n\t'authenticate',\n\t'signOut',\n\t'signOutEverywhere',\n\t'findUser',\n\t'getUser',\n\t'cookie',\n\t'collectExpired',\n\t'types',\n\t'changeEmail',\n] as const;\n",
9
9
  "/**\n * A span of time, written the way a configuration file writes one: `'15m'`,\n * `'720h'`, `'30d'`. A plain number is milliseconds.\n *\n * Strings rather than milliseconds everywhere, because `2592000000` in a config\n * object is a number nobody reads back correctly, and Ory's own configuration\n * uses exactly this notation — so a team moving across recognises it.\n */\nexport type Duration = number | `${number}${'ms' | 's' | 'm' | 'h' | 'd'}`;\n\nconst UNITS = {\n\tms: 1,\n\ts: 1_000,\n\tm: 60_000,\n\th: 3_600_000,\n\td: 86_400_000,\n} as const;\n\nconst PATTERN = /^(\\d+(?:\\.\\d+)?)(ms|s|m|h|d)$/;\n\n/**\n * The duration in milliseconds.\n *\n * `where` names the option the consumer wrote — `session.lifespan`, not\n * `parseDuration` — because this package has half a dozen durations and a\n * message that does not say which one leaves the reader to guess.\n *\n * A bare `TypeError`: durations are written when the application is wired, so\n * this cannot come from a request, and no handler should answer it. The refusal\n * reports the **shape** expected and not the value's own bytes beyond echoing\n * it, which is the rule this repository inherits.\n */\nexport function parseDuration(value: Duration, where: string): number {\n\tif (typeof value === 'number') {\n\t\tif (!Number.isFinite(value) || value <= 0) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`${where}: a duration in milliseconds must be a finite number above zero`,\n\t\t\t);\n\t\t}\n\t\treturn value;\n\t}\n\n\tconst match = PATTERN.exec(value);\n\n\tif (!match) {\n\t\tthrow new TypeError(\n\t\t\t`${where}: \"${value}\" is not a duration; write a number followed by ms, s, m, h or d — for example \"15m\" or \"720h\"`,\n\t\t);\n\t}\n\n\tconst amount = Number(match[1]);\n\tconst unit = match[2] as keyof typeof UNITS;\n\tconst ms = amount * UNITS[unit];\n\n\tif (ms <= 0) {\n\t\tthrow new TypeError(`${where}: a duration must be above zero`);\n\t}\n\n\treturn ms;\n}\n",
10
10
  "/**\n * The names a configuration gives: a user type's, and the fields it points\n * at — each camelCase, and none of them one `janus` sets itself.\n */\n\nimport { RESERVED_FIELDS } from './reserved';\n\n/** A type name, or a field name: camelCase, as every key in this package. */\nexport const NAME = /^[A-Za-z][A-Za-z0-9]*$/;\n\n/** The field a configuration key names, or a wiring refusal. */\nexport function fieldName(field: unknown, where: string): string {\n\tif (typeof field !== 'string' || !NAME.test(field)) {\n\t\tthrow new TypeError(\n\t\t\t`${where} must name a top-level field of the schema, such as \"email\"`,\n\t\t);\n\t}\n\tif ((RESERVED_FIELDS as readonly string[]).includes(field)) {\n\t\tthrow new TypeError(`${where}: \"${field}\" is a field janus sets itself`);\n\t}\n\treturn field;\n}\n",
11
11
  "/** Resolves the session cookie: the strict defaults, and a name browsers take. */\n\nimport type { CookieConfig } from './janus-config';\nimport type { ResolvedConfig } from './resolved-config';\n\n/** RFC 6265's cookie-name token: no control character, space, or separator. */\nconst COOKIE_NAME = /^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$/;\n\nexport function resolveCookie(\n\tcookie: CookieConfig,\n\twhere: string,\n): ResolvedConfig['cookie'] {\n\tconst name = cookie.name ?? 'janus-session';\n\tif (!COOKIE_NAME.test(name)) {\n\t\tthrow new TypeError(\n\t\t\t`${where}: cookie.name must be a cookie-name token — letters, digits and !#$%&'*+-.^_\\`|~, with no space, \";\" or \"=\"`,\n\t\t);\n\t}\n\tconst sameSite = cookie.sameSite ?? 'lax';\n\tconst secure = cookie.secure ?? true;\n\tif (sameSite === 'none' && !secure) {\n\t\tthrow new TypeError(\n\t\t\t`${where}: cookie.sameSite \"none\" requires cookie.secure — browsers refuse the cookie otherwise`,\n\t\t);\n\t}\n\n\treturn {\n\t\tname,\n\t\tdomain: cookie.domain ?? null,\n\t\tpath: cookie.path ?? '/',\n\t\tsameSite,\n\t\tsecure,\n\t};\n}\n",
@@ -24,12 +24,23 @@
24
24
  "/**\n * Reading a user's record by id — an absence is `null`, `getRecord` makes it\n * `NOT_FOUND` — and the one write that follows such a read, under a version.\n */\n\nimport { NotFoundError, StoreConflict } from '../../errors/janus-error';\nimport { isId } from '../../ids/id';\nimport type { ResolvedType } from '../config';\nimport { required } from '../outage';\nimport type { UserPatch, UserRecord } from '../port/types';\nimport type { UserRef, WriteOptions } from '../types';\nimport type { Context } from './create-context';\nimport { idOf } from './user';\n\nconst notFound = (where: string, id: string, type: string | null) =>\n\tnew NotFoundError(\n\t\t`${where}: no ${type ?? 'user'} has this id`,\n\t\ttype === null\n\t\t\t? { userId: id, operation: where }\n\t\t\t: { userId: id, userType: type, operation: where },\n\t);\n\n/**\n * The user — of this type, when one is given — or `null`. A malformed id is an\n * absence decided without reaching the store: it arrives off a URL, and it is\n * \"no such user\", not a query and not an outage. A user of another type is\n * absent too: `auth.staff.find(patientId)` finds nobody.\n */\nexport async function findRecord(\n\tcontext: Context,\n\tid: string,\n\ttype: string | null,\n): Promise<UserRecord | null> {\n\tif (!isId(id)) return null;\n\tconst record = await context.store.users.findUser(id);\n\treturn record !== null && (type === null || record.type === type)\n\t\t? record\n\t\t: null;\n}\n\n/** The user, or `NOT_FOUND`. */\nexport async function getRecord(\n\tcontext: Context,\n\tid: string,\n\ttype: string | null,\n\twhere: string,\n): Promise<UserRecord> {\n\treturn required(await findRecord(context, id, type), () =>\n\t\tnotFound(where, id, type),\n\t);\n}\n\n/**\n * One write that follows a read, under a version: the core reads the user,\n * checks `ifVersion` against what it read, computes the patch from the record,\n * and writes under the version it read. A user who changed in between is\n * `VERSION_CONFLICT`, and nothing is written.\n */\nexport async function writeUser(\n\tcontext: Context,\n\tuser: UserRef,\n\ttype: ResolvedType,\n\toptions: WriteOptions | undefined,\n\twhere: string,\n\tpatchOf: (\n\t\trecord: UserRecord,\n\t\tnow: Date,\n\t) => Omit<UserPatch, 'updatedAt'> | Promise<Omit<UserPatch, 'updatedAt'>>,\n): Promise<UserRecord> {\n\tconst id = idOf(user);\n\tconst record = await getRecord(context, id, type.name, where);\n\tconst ifVersion = options?.ifVersion;\n\n\tif (ifVersion !== undefined && ifVersion !== record.version) {\n\t\tthrow new StoreConflict(\n\t\t\t'version',\n\t\t\t`${where}: expected version ${ifVersion}, found ${record.version}`,\n\t\t\t{\n\t\t\t\tuserId: id,\n\t\t\t\texpectedVersion: ifVersion,\n\t\t\t\tactualVersion: record.version,\n\t\t\t\toperation: where,\n\t\t\t},\n\t\t);\n\t}\n\n\tconst now = context.clock.now();\n\tconst patch = await patchOf(record, now);\n\treturn context.store.users.updateUser(\n\t\trecord.id,\n\t\t{ ...patch, updatedAt: now },\n\t\trecord.version,\n\t);\n}\n",
25
25
  "/**\n * A user's fields, validated against the type's schema and answered as the\n * port holds them — or refused, reporting where and never the values.\n */\n\nimport { type Issue, UserInvalidError } from '../../errors/janus-error';\nimport { isStorable, UNSTORABLE } from '../../stores/storable';\nimport { RESERVED_FIELDS, type ResolvedType } from '../config';\nimport type { Json, JsonObject } from '../port/types';\nimport type { StandardSchemaV1 } from '../standard-schema';\n\n/**\n * Validates fields against the type's schema, and answers them as the port\n * holds them: an `undefined` property dropped, at every depth.\n */\nexport async function validateFields(\n\ttype: ResolvedType,\n\tinput: unknown,\n\twhere: string,\n): Promise<JsonObject> {\n\tconst result = await type.schema['~standard'].validate(input);\n\n\tconst issues: Issue[] =\n\t\tresult.issues === undefined\n\t\t\t? []\n\t\t\t: result.issues.map((issue) => ({\n\t\t\t\t\tpath: storablePrefix((issue.path ?? []).map(segmentKey)),\n\t\t\t\t\tmessage: issue.message,\n\t\t\t\t}));\n\n\t// A schema that passes unknown keys through would let a request set `id` or\n\t// `active` among the fields. `toUser` would shadow them anyway; refusing\n\t// them says so to whoever sent them.\n\tif (result.issues === undefined) {\n\t\tconst value = result.value as Record<string, unknown>;\n\t\tfor (const key of RESERVED_FIELDS) {\n\t\t\tif (Object.hasOwn(value, key)) {\n\t\t\t\tissues.push({ path: [key], message: 'set by janus, not by a request' });\n\t\t\t}\n\t\t}\n\t\tunstorableIn(value, [], issues);\n\t}\n\n\tif (issues.length > 0) {\n\t\t// The message reports how many and where, never the values: a field may\n\t\t// be anything the application chose to store, including something\n\t\t// private.\n\t\tthrow new UserInvalidError(\n\t\t\t`${where}: the fields do not match the ${type.name} schema (${issues.length} issue${issues.length === 1 ? '' : 's'}, at ${issues.map((i) => i.path.join('.') || '(root)').join(', ')})`,\n\t\t\t{ issues, userType: type.name },\n\t\t);\n\t}\n\n\treturn withoutUndefined((result as { value: unknown }).value) as JsonObject;\n}\n\n/** Pushes an issue for every key and every string no store can keep. */\nfunction unstorableIn(\n\tvalue: unknown,\n\tpath: (string | number)[],\n\tissues: Issue[],\n): void {\n\tif (typeof value === 'string') {\n\t\tif (!isStorable(value)) issues.push({ path, message: UNSTORABLE });\n\t\treturn;\n\t}\n\tif (Array.isArray(value)) {\n\t\tfor (const [index, inner] of value.entries()) {\n\t\t\tunstorableIn(inner, [...path, index], issues);\n\t\t}\n\t\treturn;\n\t}\n\tif (typeof value === 'object' && value !== null) {\n\t\tfor (const [key, inner] of Object.entries(value)) {\n\t\t\t// The key itself stays out of the path: the path reaches the message,\n\t\t\t// and a NUL has no business in a log line.\n\t\t\tif (!isStorable(key)) {\n\t\t\t\tissues.push({ path, message: `a key ${UNSTORABLE}` });\n\t\t\t} else {\n\t\t\t\tunstorableIn(inner, [...path, key], issues);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/**\n * A path up to its first key no store can keep: the path reaches the message,\n * and a NUL has no business in a log line.\n */\nfunction storablePrefix(path: (string | number)[]): (string | number)[] {\n\tconst cut = path.findIndex(\n\t\t(segment) => typeof segment === 'string' && !isStorable(segment),\n\t);\n\treturn cut === -1 ? path : path.slice(0, cut);\n}\n\nfunction segmentKey(\n\tsegment: PropertyKey | StandardSchemaV1.PathSegment,\n): string | number {\n\tconst key = typeof segment === 'object' ? segment.key : segment;\n\treturn typeof key === 'number' ? key : String(key);\n}\n\nfunction withoutUndefined(value: unknown): Json {\n\tif (Array.isArray(value)) return value.map(withoutUndefined);\n\n\tif (typeof value === 'object' && value !== null) {\n\t\tconst out: Record<string, Json> = {};\n\t\tfor (const [key, inner] of Object.entries(value)) {\n\t\t\tif (inner !== undefined) out[key] = withoutUndefined(inner);\n\t\t}\n\t\treturn out;\n\t}\n\n\treturn value as Json;\n}\n",
26
26
  "import { type Id, mintId } from '../ids/id';\nimport type { Context } from './context';\n\n/**\n * What happened to a user, once it is written:\n *\n * - `user.created` — by `create` or `signUp`;\n * - `user.emailVerified` — by `verifyEmail.confirm`, or by the link of\n * `resetPassword.confirm`, `magicLink.confirm` or `changeEmail.confirm`, or the code of\n * `signInCode.confirm`, which prove the e-mail too; never for an e-mail\n * already verified;\n * - `user.passwordReset` — by `resetPassword.confirm`;\n * - `user.passwordChanged` — by `changePassword` and `setPassword`, and by\n * `signInCode.confirm` and `magicLink.confirm` when their first proof of\n * the e-mail dropped a password, after `user.emailVerified`; never by a\n * reset, which is `user.passwordReset` alone;\n * - `user.emailChanged` — by `update` and `changeEmail.confirm`, when they\n * changed the e-mail — compared\n * normalised, the same test that makes the new one unverified. The one\n * event that carries more than the user: `formerEmail`;\n * - `user.secondFactorEnabled` — by `secondFactor.activate`, once the factor\n * is active: not by `enroll`, which leaves it waiting for its first code;\n * - `user.secondFactorDisabled` — by `secondFactor.disable`, when it removed\n * an active factor, and by `signInCode.confirm` and `magicLink.confirm`\n * when their first proof of the e-mail removed one, after\n * `user.emailVerified` and any `user.passwordChanged`; never for a user who\n * had none, or one still waiting;\n * - `user.recoveryCodesRegenerated` — by `secondFactor.regenerateRecoveryCodes`:\n * the codes the user held stopped working. Not by `activate`, whose codes\n * come with `user.secondFactorEnabled`;\n * - `user.recoveryCodeUsed` — by `secondFactor.recover`, once the code is\n * spent: a sign-in without the user's phone;\n * - `user.newDeviceSignedIn` — by a sign-in that opened a session from a\n * device the user had not signed in from: `signIn`, `secondFactor.confirm`,\n * `secondFactor.recover`, `signInCode.confirm`, `magicLink.confirm` and\n * `signInProven`, when given a `device` its token did not prove. Never by\n * `signUp`, nor without a `device`. Carries `sessionId`;\n * - `user.deleted` — by `delete`, once; a replay that finds nobody is none.\n */\nexport type UserEventType =\n\t| 'user.created'\n\t| 'user.emailVerified'\n\t| 'user.passwordReset'\n\t| 'user.passwordChanged'\n\t| 'user.emailChanged'\n\t| 'user.secondFactorEnabled'\n\t| 'user.secondFactorDisabled'\n\t| 'user.recoveryCodesRegenerated'\n\t| 'user.recoveryCodeUsed'\n\t| 'user.newDeviceSignedIn'\n\t| 'user.deleted';\n\n/**\n * A user event: **the user named by id, and nothing else** — no login, no\n * field, no password, no token. Whoever receives it reads the rest from where\n * it is kept, if they may. Two exceptions: `formerEmail` on\n * `user.emailChanged` — once the write landed, the old address is kept\n * nowhere — and `sessionId` on `user.newDeviceSignedIn`, the session the new\n * device holds.\n */\nexport interface UserEvent {\n\t/** A UUIDv7 minted for this event: the key to deliver it once. */\n\treadonly id: Id;\n\treadonly type: UserEventType;\n\t/**\n\t * When the write landed: the `createdAt` or `updatedAt` it wrote, or, for\n\t * a deletion, the time read just before it — not when the listener ran.\n\t */\n\treadonly occurredAt: Date;\n\treadonly userId: Id;\n\treadonly userType: string;\n\t/**\n\t * On `user.emailChanged` only: the address the user had before, as it was\n\t * stored — `null` when they had none. So a notice can reach the inbox the\n\t * account was just taken from; the new address is on the user. Absent\n\t * from every other type, and from an event a webhook delivered.\n\t */\n\treadonly formerEmail?: string | null;\n\t/**\n\t * On `user.newDeviceSignedIn` only: the session the new device opened —\n\t * to sign it out from a \"this wasn't me\" page. Absent from every other\n\t * type, and from an event a webhook delivered.\n\t */\n\treadonly sessionId?: string;\n}\n\n/** What an event carries beyond the user, on the two types that do. */\nexport type EventExtras = Pick<UserEvent, 'formerEmail' | 'sessionId'>;\n\n/**\n * What `janus({ events })` takes: called once per event, **after** the write\n * landed and before the flow answers — awaited, so a queue that stores the\n * event durably has done so by then. A listener that throws fails nothing:\n * the write happened, and the flow answers as it would have. The failure is a\n * `JANUS_EVENT_FAILED` warning naming the event, never silence.\n */\nexport type UserEventListener = (event: UserEvent) => void | Promise<void>;\n\n/** The listener given to `janus()`, or a wiring refusal for a JavaScript caller. */\nexport function resolveEvents(\n\tevents: unknown,\n\twhere: string,\n): UserEventListener | null {\n\tif (events === undefined) return null;\n\tif (typeof events !== 'function') {\n\t\tthrow new TypeError(\n\t\t\t`${where}: events must be a function that takes a user event — webhooks({ … }) from @nxgt/janus-webhooks, or your own`,\n\t\t);\n\t}\n\treturn events as UserEventListener;\n}\n\n/**\n * Hands one event to the listener after the write it reports. A flow whose\n * steps after the write matter to the listener — a reset's revocation, a\n * deletion's cleanup — runs them in a `try` and emits from its `finally`, so\n * an outage there does not lose the event for good. Its failure is the application's, not the flow's: warned about, with what\n * it takes to send the event again — never thrown, since the write has landed.\n */\nexport async function emit(\n\tcontext: Context,\n\ttype: UserEventType,\n\tuser: { readonly id: Id; readonly type: string },\n\toccurredAt: Date,\n\textras: EventExtras = {},\n): Promise<void> {\n\tconst listener = context.events;\n\tif (listener === null) return;\n\n\tconst event: UserEvent = Object.freeze({\n\t\tid: mintId(occurredAt.getTime()),\n\t\ttype,\n\t\t// A copy: the record's own Date is also the user the flow answers.\n\t\toccurredAt: new Date(occurredAt.getTime()),\n\t\tuserId: user.id,\n\t\tuserType: user.type,\n\t\t...extras,\n\t});\n\ttry {\n\t\tawait listener(event);\n\t} catch (failure) {\n\t\tprocess.emitWarning(\n\t\t\t`janus: the events listener failed on ${type} ${event.id} for user ${user.id}: ${failure instanceof Error ? failure.name : typeof failure}`,\n\t\t\t{ code: 'JANUS_EVENT_FAILED' },\n\t\t);\n\t}\n}\n",
27
+ "import { createHmac, hkdfSync } from 'node:crypto';\nimport type { Sealer } from './sealing';\n\n/**\n * Keys derived from the sealing keys, one per purpose — never the key that\n * seals a secret itself — and the keyed hashes made with them: a recovery\n * code's, and the names of the counts of attempts. Each caller keeps its own\n * purpose: renamed, what it hashed no longer matches.\n */\n\nconst derived = new WeakMap<Sealer, Map<string, Buffer>>();\n\n/**\n * The key `keyId` lends `purpose` — the first key by default — derived once\n * per key, or `undefined` when the sealer no longer holds that key.\n */\nexport function derivedKey(\n\tsealer: Sealer,\n\tpurpose: string,\n\tkeyId: string = sealer.sealWith,\n): Buffer | undefined {\n\tlet keys = derived.get(sealer);\n\tif (keys === undefined) {\n\t\tkeys = new Map();\n\t\tderived.set(sealer, keys);\n\t}\n\tconst name = `${purpose}\\u0000${keyId}`;\n\tlet key = keys.get(name);\n\tif (key === undefined) {\n\t\tconst secret = sealer.keys.get(keyId);\n\t\tif (secret === undefined) return undefined;\n\t\tkey = Buffer.from(hkdfSync('sha256', secret, Buffer.alloc(0), purpose, 32));\n\t\tkeys.set(name, key);\n\t}\n\treturn key;\n}\n\n/** HMAC-SHA256 of `parts`, joined by a NUL — which no part may hold. */\nexport function keyedHash(key: Buffer, parts: readonly string[]): Buffer {\n\treturn createHmac('sha256', key).update(parts.join('\\u0000')).digest();\n}\n",
28
+ "/**\n * The key that names a count of attempts stored under no user — the\n * passwords tried at a login (`sign-in-attempts.ts`), the e-mails asked for\n * an address (`mail-requests.ts`) — and the keyed hashes made with it.\n *\n * Derived from the sealing keys when `secondFactor` is configured; without\n * them it is a fixed one, and the hash only keeps the login or the address\n * out of plain sight — safe because a `secondFactor` token is redeemed only\n * by the second factor's flows, which do not exist without the keys.\n */\n\nimport type { Context } from './context';\nimport { derivedKey, keyedHash } from './derived-keys';\n\n/**\n * The key `purpose` names its counts with. Renamed, a purpose's every count\n * in progress would start over.\n */\nexport function counterKey(context: Context, purpose: string): Buffer {\n\tconst sealer = context.config.secondFactor?.sealer;\n\t// The first key is always held: resolveSealer names it from the keys.\n\treturn sealer === undefined\n\t\t? Buffer.from(purpose)\n\t\t: (derivedKey(sealer, purpose) as Buffer);\n}\n\n/** A keyed hash of `parts`, base64url: a name, never a secret. */\nexport const keyed = (key: Buffer, parts: readonly string[]): string =>\n\tkeyedHash(key, parts).toString('base64url');\n",
29
+ "/**\n * The six-digit code a challenge carries — a second factor's or an e-mailed\n * one: its attempts, counted before anything is compared, its hash, keyed by\n * the challenge, and the refusal of one that does not match.\n */\n\nimport { timingSafeEqual } from 'node:crypto';\nimport { TokenError } from '../../errors/janus-error';\nimport type { Context } from '../context';\nimport type { TokenKind, TokenRecord } from '../port/types';\nimport { hashSecret } from '../secrets';\nimport { refuseUnusable, unknownOneTime } from './refusals';\nimport { burnOneTime } from './spend';\n\n/**\n * How many codes one challenge takes — a second factor's or an e-mail\n * code's. A six-digit code has a million values: five attempts is a\n * one-in-200,000 chance **per challenge**, and the attempts are counted by\n * the store in one write, never read then written.\n */\nexport const CODE_ATTEMPTS = 5;\n\n/**\n * Counts one attempt at a challenge's code, before anything is compared: a\n * guess that fails for any reason has still cost one. Refuses a challenge\n * that cannot be used, and one past its last attempt — a call that raced the\n * one that spent it — unread.\n */\nexport async function countCodeAttempt(\n\tcontext: Context,\n\tsecret: string,\n\tkind: TokenKind,\n\twhere: string,\n\tuserType: string,\n): Promise<{ readonly token: TokenRecord; readonly attemptsLeft: number }> {\n\tconst token = await context.store.tokens.countAttempt(\n\t\thashSecret(secret),\n\t\tkind,\n\t);\n\trefuseUnusable(token, context.clock.now(), where, 'challenge');\n\tif (token.attempts > CODE_ATTEMPTS) {\n\t\tthrow codeInvalid(where, token.userId, userType, 0);\n\t}\n\treturn { token, attemptsLeft: CODE_ATTEMPTS - token.attempts };\n}\n\n/**\n * A code that does not match — a second factor's or an e-mailed one — or a\n * TOTP code already used. `attemptsLeft` only when a challenge counted it.\n */\nexport function codeInvalid(\n\twhere: string,\n\tuserId: string,\n\tuserType: string,\n\tattemptsLeft?: number,\n): TokenError {\n\treturn new TokenError(\n\t\t'CODE_INVALID',\n\t\t`${where}: the code does not match, or was already used`,\n\t\t{\n\t\t\toperation: where,\n\t\t\tuserId,\n\t\t\tuserType,\n\t\t\t...(attemptsLeft === undefined ? {} : { attemptsLeft }),\n\t\t},\n\t);\n}\n\n/**\n * The refusal for a challenge whose user is gone, or of another type — the\n * API of the wrong type compares no code. Its attempt was counted all the\n * same, before the type was known, so the last one spends the challenge, as\n * a wrong code would: past it, every call answers `TOKEN_SPENT`.\n */\nexport async function unknownChallenge(\n\tcontext: Context,\n\ttoken: TokenRecord,\n\tsecret: string,\n\twhere: string,\n): Promise<TokenError> {\n\tif (token.attempts === CODE_ATTEMPTS) {\n\t\tawait burnOneTime(context, secret, token.kind);\n\t}\n\treturn unknownOneTime(where, 'challenge');\n}\n\n/**\n * A code's hash, **keyed by its challenge**: the tokens alone — a dump, a\n * log of the table — do not reveal the code, since a million guesses at it\n * each need the challenge, which only the visitor holds.\n */\nexport const hashCode = (challenge: string, code: string): string =>\n\thashSecret(`${challenge}${code}`);\n\n/** Whether `code` is the one whose hash the token holds, compared in constant time. */\nexport function codeMatches(\n\ttoken: TokenRecord,\n\tchallenge: string,\n\tcode: string,\n): boolean {\n\tif (token.codeHash === null || !/^\\d{6}$/.test(code)) return false;\n\tconst given = Buffer.from(hashCode(challenge, code));\n\tconst held = Buffer.from(token.codeHash);\n\treturn given.length === held.length && timingSafeEqual(given, held);\n}\n",
30
+ "import { createHash, randomBytes } from 'node:crypto';\n\n/**\n * A fresh secret: 32 random bytes, base64url — safe in a header, a cookie and a\n * URL without escaping.\n *\n * Given to the application **once**. No store ever holds it.\n */\nexport function mintSecret(): string {\n\treturn randomBytes(32).toString('base64url');\n}\n\n/**\n * What a store holds instead of the secret: `sha256`, hex.\n *\n * SHA-256 and not argon2, on purpose. The secret carries 256 bits of entropy, so\n * there is nothing to brute-force, and an argon2 per request would put ~50 ms on\n * every authenticated call. What the hash buys is that a dump of the store\n * cannot be replayed.\n */\nexport function hashSecret(secret: string): string {\n\treturn createHash('sha256').update(secret).digest('hex');\n}\n",
31
+ "/**\n * The refusals of a one-time token that could not be used: none, spent,\n * lapsed, or sent to an e-mail the user no longer has.\n */\n\nimport { TokenError } from '../../errors/janus-error';\nimport { normalizeEmail, type ResolvedType } from '../config';\nimport { emailOf } from '../context';\nimport type { TokenRecord, UserRecord } from '../port/types';\n\n/**\n * `noun` is what the messages call it: `token` for a link, `challenge` for\n * what `signIn` answers. No message names the secret or its hash.\n */\nexport type OneTimeNoun = 'token' | 'challenge';\n\n/**\n * Refuses a token sent to an e-mail the user no longer has: redeeming it\n * would prove an address nobody holds any more.\n */\nexport function refuseStale(\n\ttype: ResolvedType,\n\tuser: UserRecord,\n\ttoken: TokenRecord,\n\twhere: string,\n\tnoun: 'token' | 'code',\n): void {\n\tconst email = emailOf(type, user.fields);\n\tif (\n\t\temail === null ||\n\t\tnormalizeEmail(email) !== normalizeEmail(token.address)\n\t) {\n\t\tthrow new TokenError(\n\t\t\t'TOKEN_STALE',\n\t\t\t`${where}: the ${noun} was sent to an e-mail the user no longer has`,\n\t\t\t{ operation: where, userId: user.id, userType: type.name },\n\t\t);\n\t}\n}\n\n/**\n * Refuses a token that cannot be used: none, spent, or lapsed. What a store\n * answered — before a `consumeToken`, after a `countAttempt` — is read the\n * same way: `spentAt` set means somebody else used it.\n */\nexport function refuseUnusable(\n\ttoken: TokenRecord | null,\n\tnow: Date,\n\twhere: string,\n\tnoun: OneTimeNoun,\n): asserts token is TokenRecord {\n\tif (token === null) {\n\t\tthrow new TokenError('TOKEN_UNKNOWN', `${where}: no such ${noun}`, {\n\t\t\toperation: where,\n\t\t});\n\t}\n\tif (token.spentAt !== null) {\n\t\tthrow new TokenError(\n\t\t\t'TOKEN_SPENT',\n\t\t\t`${where}: the ${noun} was already used`,\n\t\t\t{ operation: where },\n\t\t);\n\t}\n\tif (token.expiresAt.getTime() <= now.getTime()) {\n\t\tthrow new TokenError('TOKEN_EXPIRED', `${where}: the ${noun} has expired`, {\n\t\t\toperation: where,\n\t\t});\n\t}\n}\n\n/** The refusal for a token whose user is gone, or of another type. */\nexport const unknownOneTime = (where: string, noun: OneTimeNoun) =>\n\tnew TokenError('TOKEN_UNKNOWN', `${where}: no such ${noun}`, {\n\t\toperation: where,\n\t});\n",
32
+ "/**\n * Spending a one-time token: once when it is redeemed, and once more when its\n * last attempt failed.\n */\n\nimport type { Context } from '../context';\nimport type { TokenKind, TokenRecord } from '../port/types';\nimport { hashSecret } from '../secrets';\nimport { type OneTimeNoun, refuseUnusable } from './refusals';\n\n/**\n * Spends a token, and refuses it when this call did not: the store answers it\n * **as it was before**, so exactly one call ever reads `spentAt: null`. A\n * lapsed token is spent all the same, so it cannot be retried.\n */\nexport async function spendOneTime(\n\tcontext: Context,\n\tsecret: string,\n\tkind: TokenKind,\n\twhere: string,\n\tnoun: OneTimeNoun,\n): Promise<TokenRecord> {\n\tconst now = context.clock.now();\n\tconst token = await context.store.tokens.consumeToken(\n\t\thashSecret(secret),\n\t\tkind,\n\t\tnow,\n\t);\n\trefuseUnusable(token, now, where, noun);\n\treturn token;\n}\n\n/**\n * Spends a token whose last attempt failed. Its answer is not read: a racing\n * call that spent it first changes nothing for this one, which is refused\n * for its code either way.\n */\nexport async function burnOneTime(\n\tcontext: Context,\n\tsecret: string,\n\tkind: TokenKind,\n): Promise<void> {\n\tawait context.store.tokens.consumeToken(\n\t\thashSecret(secret),\n\t\tkind,\n\t\tcontext.clock.now(),\n\t);\n}\n",
33
+ "/**\n * Issuing a one-time token — a link's, or a challenge carrying a code for a\n * person to type. The secret is given back once; the store holds its hash.\n */\n\nimport { randomInt } from 'node:crypto';\nimport type { Context } from '../context';\nimport type { TokenKind } from '../port/types';\nimport { hashSecret, mintSecret } from '../secrets';\nimport { hashCode } from './codes';\n\ninterface OneTimeRequest {\n\treadonly kind: TokenKind;\n\treadonly userId: string;\n\treadonly address: string;\n\treadonly ttlMs: number;\n\t/**\n\t * The secret to issue under, minted beforehand — a sign-in code's\n\t * challenge, handed to the visitor by `prepare` before the lookup. A\n\t * fresh one by default.\n\t */\n\treadonly secret?: string;\n}\n\n/**\n * Issues a one-time token: 32 random bytes, given back once, and only their\n * hash stored.\n */\nexport async function issueOneTime(\n\tcontext: Context,\n\ttoken: OneTimeRequest & {\n\t\t/**\n\t\t * What the token is bound to, stored as its `codeHash`: `changeEmail`\n\t\t * binds the address it replaces. `null` by default.\n\t\t */\n\t\treadonly boundHash?: string;\n\t},\n): Promise<{ readonly secret: string; readonly expiresAt: Date }> {\n\treturn insertOneTime(context, token, null, token.boundHash ?? null);\n}\n\n/**\n * Issues a one-time token with a six-digit code for a person to type: the\n * token is the challenge, and only the code's hash is stored, keyed by it.\n */\nexport async function issueCode(\n\tcontext: Context,\n\ttoken: OneTimeRequest,\n): Promise<{\n\treadonly secret: string;\n\treadonly expiresAt: Date;\n\treadonly code: string;\n}> {\n\tconst code = String(randomInt(1_000_000)).padStart(6, '0');\n\treturn { ...(await insertOneTime(context, token, code, null)), code };\n}\n\nasync function insertOneTime(\n\tcontext: Context,\n\ttoken: OneTimeRequest,\n\tcode: string | null,\n\tboundHash: string | null,\n): Promise<{ readonly secret: string; readonly expiresAt: Date }> {\n\tconst now = context.clock.now();\n\tconst secret = token.secret ?? mintSecret();\n\tconst expiresAt = new Date(now.getTime() + token.ttlMs);\n\n\tawait context.store.tokens.insertToken({\n\t\ttokenHash: hashSecret(secret),\n\t\tkind: token.kind,\n\t\tuserId: token.userId,\n\t\taddress: token.address,\n\t\tcodeHash: code === null ? boundHash : hashCode(secret, code),\n\t\tattempts: 0,\n\t\texpiresAt,\n\t\tspentAt: null,\n\t\tcreatedAt: now,\n\t});\n\treturn { secret, expiresAt };\n}\n",
34
+ "/**\n * Attempts counted by the store in fixed windows of the clock — what bounds\n * the codes tried at an app outside a sign-in (`second-factor/app-code-attempts.ts`)\n * and the passwords tried at one login (`../sign-in-attempts.ts`).\n *\n * **No port of its own.** The count is a one-time token of kind\n * `secondFactor`, counted by `countAttempt` like a challenge's: one\n * conditional write per attempt, never read then written, so twenty guesses\n * at once are twenty distinct counts. Its secret is never given out: each\n * caller names it by a keyed hash of what the count is for, so it cannot be\n * redeemed as a challenge.\n *\n * A token once spent counts nothing more. So the count is a **chain** of\n * links, and what a spent link means is the caller's to say: `carry`, and the\n * next link carries on from the attempts it holds — a password written, which\n * spends every `secondFactor` token of the user, buys no guess; `restart`,\n * and the next link starts from zero — a sign-in that succeeded spends the\n * link it counted on, and the login's count starts again.\n */\n\nimport type { Context } from '../context';\nimport type { TokenRecord } from '../port/types';\n\n/**\n * More links than this in one window, for `carry`: more passwords written\n * than guesses, and the count is past any limit.\n */\nexport const MAX_LINKS = 32;\n\n/**\n * Probes enough for 2^30 sign-ins in one window, for `restart`: past them, the\n * store answers links nobody stored, and the count fails closed.\n */\nconst MAX_PROBES = 64;\n\n/** What {@link countInWindow} counts, and how. */\nexport interface AttemptWindow {\n\t/** How long one window lasts, in milliseconds. */\n\treadonly windowMs: number;\n\t/** What a spent link means: its attempts carried on, or a count started again. */\n\treadonly spent: 'carry' | 'restart';\n\t/** The `userId` each link is stored under. */\n\treadonly userId: string;\n\t/** A link's token hash in one window: never given out, and never a secret. */\n\treadonly linkHash: (window: number, link: number) => string;\n\t/** What to throw when a link is gone right after it was stored, or the links never end. */\n\treadonly vanished: () => Error;\n}\n\n/** One attempt, counted. */\nexport interface CountedAttempt {\n\t/** The attempts of this window, this one included. */\n\treadonly attempts: number;\n\t/** The link it was counted on — what spending restarts — or `null` past the last one. */\n\treadonly link: string | null;\n\t/** When the window ends, in milliseconds since the epoch. */\n\treadonly endsAt: number;\n}\n\ninterface Links {\n\treadonly context: Context;\n\treadonly counting: AttemptWindow;\n\treadonly window: number;\n\treadonly now: number;\n\treadonly expiresAt: number;\n}\n\n/** Counts one attempt in the current window, before anything is compared. */\nexport async function countInWindow(\n\tcontext: Context,\n\tcounting: AttemptWindow,\n): Promise<CountedAttempt> {\n\tconst now = context.clock.now().getTime();\n\tconst window = Math.floor(now / counting.windowMs);\n\t// A window of slack: a store whose clock runs ahead of this one must not\n\t// drop a link before its window ends. The window is in the hash, so a\n\t// link never counts for the next one.\n\tconst expiresAt = (window + 2) * counting.windowMs;\n\tconst links = { context, counting, window, now, expiresAt };\n\tconst counted =\n\t\tcounting.spent === 'carry'\n\t\t\t? await countCarrying(links)\n\t\t\t: await countRestarting(links);\n\treturn { ...counted, endsAt: (window + 1) * counting.windowMs };\n}\n\n/** Every link from the first, each spent one's attempts carried on. */\nasync function countCarrying(\n\tlinks: Links,\n): Promise<Omit<CountedAttempt, 'endsAt'>> {\n\tlet carried = 0;\n\tfor (let link = 0; link < MAX_LINKS; link += 1) {\n\t\tconst hash = links.counting.linkHash(links.window, link);\n\t\tconst counted = await countLink(links, hash);\n\t\tconst attempts = carried + counted.attempts;\n\t\tif (counted.spentAt === null) return { attempts, link: hash };\n\t\tcarried = attempts;\n\t}\n\treturn { attempts: Number.POSITIVE_INFINITY, link: null };\n}\n\n/**\n * The one unspent link, found by probing rather than walked to: a link is\n * stored only once the one before it is spent, so every link below it is\n * spent and none above it is stored. Probing a spent link or one never\n * stored writes nothing; probing the unspent one counts the attempt. So a\n * login signed in to a thousand times in one window costs twenty probes,\n * not a thousand — and no number of sign-ins turns the count off.\n */\nasync function countRestarting(\n\tlinks: Links,\n): Promise<Omit<CountedAttempt, 'endsAt'>> {\n\tconst tokens = links.context.store.tokens;\n\tlet spent = -1;\n\tlet absent = Number.POSITIVE_INFINITY;\n\tfor (let probes = 0; probes < MAX_PROBES; probes += 1) {\n\t\tconst next = absent === spent + 1;\n\t\tconst link = next\n\t\t\t? absent\n\t\t\t: absent === Number.POSITIVE_INFINITY\n\t\t\t\t? 2 * spent + 2\n\t\t\t\t: Math.floor((spent + absent) / 2);\n\t\tconst hash = links.counting.linkHash(links.window, link);\n\t\tconst counted = next\n\t\t\t? await insertLink(links, hash)\n\t\t\t: await tokens.countAttempt(hash, 'secondFactor');\n\t\tif (counted === null) absent = link;\n\t\telse if (counted.spentAt === null) {\n\t\t\treturn { attempts: counted.attempts, link: hash };\n\t\t} else {\n\t\t\tspent = link;\n\t\t\t// Spent by a sign-in that raced this one: look further on.\n\t\t\tif (absent <= spent) absent = Number.POSITIVE_INFINITY;\n\t\t}\n\t}\n\t// A store whose links never end: it cannot be counting what it stores.\n\tthrow links.counting.vanished();\n}\n\n/** One attempt on one link: inserted on the first, and counted. */\nasync function countLink(\n\tlinks: Links,\n\ttokenHash: string,\n): Promise<TokenRecord> {\n\tconst tokens = links.context.store.tokens;\n\tconst counted = await tokens.countAttempt(tokenHash, 'secondFactor');\n\treturn counted ?? insertLink(links, tokenHash);\n}\n\n/** A link stored — idempotent: of two first attempts at once, one inserts — and counted. */\nasync function insertLink(\n\tlinks: Links,\n\ttokenHash: string,\n): Promise<TokenRecord> {\n\tconst tokens = links.context.store.tokens;\n\tawait tokens.insertToken({\n\t\ttokenHash,\n\t\tkind: 'secondFactor',\n\t\tuserId: links.counting.userId,\n\t\taddress: '',\n\t\tcodeHash: null,\n\t\tattempts: 0,\n\t\texpiresAt: new Date(links.expiresAt),\n\t\tspentAt: null,\n\t\tcreatedAt: new Date(links.now),\n\t});\n\tconst inserted = await tokens.countAttempt(tokenHash, 'secondFactor');\n\tif (inserted !== null) return inserted;\n\tthrow links.counting.vanished();\n}\n",
35
+ "/**\n * The requests that hand out something to e-mail, counted by the store per\n * window — `janus({ mail: { throttle } })`, five per ten minutes by\n * default. Past the last one, the request answers `MAIL_THROTTLED` with\n * `retryAfter`, and **issues nothing**: no token is minted, so there is\n * nothing to send — and **nothing is spent**: counted before anything is\n * issued, a refused request never reaches the step that spends the earlier\n * tokens, so the last link or code sent still works. Nothing locks past a\n * window. With the default lifetimes, the window (`'10m'`) is no longer than\n * any token's, so the last one sent — issued in the window — outlives the\n * refusal: somebody who asks for an address in a loop mails its owner real\n * links, and the last of them signs in.\n *\n * **Each flow counts on its own**, so a loop on one — a sign-in link asked\n * for again and again — never shuts another, and what one address can be\n * sent is bounded per flow:\n *\n * - **per address**, for the requests anybody can make with an e-mail —\n * `magicLink.request`, `signInCode.request`, `resetPassword.request`.\n * Counted **before anything is looked up**, the address normalised, and\n * whatever the user type: an address nobody holds is counted, and refused\n * past the limit, as a registered one is, so being throttled never tells\n * who has an account;\n * - **per user**, for the requests the application makes for a user it\n * knows — `verifyEmail.send`, `changeEmail.send` (and, for the address it\n * names, per address too), and `stepUp.request` when it e-mails a code.\n * Nobody without the user's session or the application's call can spend\n * that count, so a loop on their address leaves their own requests alone;\n * and whatever addresses one user moves through, they are sent at most as\n * many.\n *\n * Counted in an attempt window (`one-time/window.ts`), in `secondFactor`\n * tokens stored under no user: the `userId` of each is a keyed hash of the\n * flow and the address or the user (`counter-key.ts`). Nothing spends a\n * link, and one that is spent carries its count on: the count never starts\n * again before its window ends.\n *\n * A store that cannot count throws `STORE_FAILED`: never a refusal, and\n * never a request let through uncounted.\n */\n\nimport { MailThrottledError, StoreFailure } from '../errors/janus-error';\nimport { normalizeEmail, type ResolvedType } from './config';\nimport type { Context } from './context';\nimport { counterKey, keyed } from './counter-key';\nimport { countInWindow } from './one-time';\nimport { hashSecret } from './secrets';\n\n/** What the key is derived for. Renamed, every count in progress would start over. */\nconst PURPOSE = 'janus/mail/requests/v1';\n\n/** The flows that hand out something to e-mail, each counted on its own. */\nexport type MailFlow =\n\t| 'magicLink'\n\t| 'signInCode'\n\t| 'resetPassword'\n\t| 'verifyEmail'\n\t| 'stepUp'\n\t| 'changeEmail';\n\n/**\n * Who a request is counted for: the address it names (and, when the request\n * is a user's, the user it is made for, carried by a refusal), or the user.\n */\ntype Counted =\n\t| { readonly address: string; readonly userId?: string }\n\t| { readonly userId: string };\n\n/**\n * Counts one request of `flow` for `email` — before it is looked up — and\n * refuses past the last one, whether anybody holds the address or not.\n * `userId`, for a request made for a user (`changeEmail.send`), is only\n * carried by the refusal; the count stays the address's.\n */\nexport async function countMailByAddress(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tflow: MailFlow,\n\temail: string,\n\twhere: string,\n\tuserId?: string,\n): Promise<void> {\n\tawait countMail(\n\t\tcontext,\n\t\ttype,\n\t\tflow,\n\t\t{\n\t\t\taddress: normalizeEmail(email),\n\t\t\t...(userId === undefined ? {} : { userId }),\n\t\t},\n\t\twhere,\n\t);\n}\n\n/** Counts one request of `flow` for the user `userId`, and refuses past the last one. */\nexport async function countMailByUser(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tflow: MailFlow,\n\tuserId: string,\n\twhere: string,\n): Promise<void> {\n\tawait countMail(context, type, flow, { userId }, where);\n}\n\nasync function countMail(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tflow: MailFlow,\n\tcounted: Counted,\n\twhere: string,\n): Promise<void> {\n\tconst throttle = context.config.mailThrottle;\n\tif (throttle === null) return;\n\tconst key = counterKey(context, PURPOSE);\n\tconst subject =\n\t\t'address' in counted\n\t\t\t? keyed(key, [flow, 'address', counted.address])\n\t\t\t: keyed(key, [flow, 'user', counted.userId]);\n\tconst { attempts, endsAt } = await countInWindow(context, {\n\t\twindowMs: throttle.windowMs,\n\t\tspent: 'carry',\n\t\tuserId: subject,\n\t\tlinkHash: (window, link) =>\n\t\t\thashSecret(keyed(key, [subject, String(window), String(link)])),\n\t\t// A store that lost what it just stored cannot count: an outage.\n\t\tvanished: () =>\n\t\t\tnew StoreFailure(\n\t\t\t\t`${where}: the store dropped the requests it had just counted`,\n\t\t\t\t{ slot: 'tokens', operation: 'countAttempt' },\n\t\t\t),\n\t});\n\tif (attempts <= throttle.attempts) return;\n\n\tconst now = context.clock.now().getTime();\n\tthrow new MailThrottledError(\n\t\t`${where}: too many e-mails asked for this ${'address' in counted ? 'address' : 'user'} — the last one sent still works; use it, or wait for the next window`,\n\t\t{\n\t\t\tuserType: type.name,\n\t\t\t...(counted.userId === undefined ? {} : { userId: counted.userId }),\n\t\t\tretryAfter: Math.max(1, Math.ceil((endsAt - now) / 1000)),\n\t\t},\n\t);\n}\n",
36
+ "import { normalizeEmail, type ResolvedType } from '../config';\nimport { emailOf, loginsOf, validateFields } from '../context';\nimport type { JsonObject, UserRecord } from '../port/types';\nimport type { Input } from './flow-types';\n\nconst normalized = (email: string | null) =>\n\temail === null ? null : normalizeEmail(email);\n\n/**\n * Whether the e-mail differs between two sets of fields, compared normalised:\n * `Ada@Example.com` for `ada@example.com` is no change. The one test behind\n * both the new e-mail's verification reset and `user.emailChanged`.\n */\nexport function emailChanged(\n\ttype: ResolvedType,\n\tbefore: JsonObject,\n\tafter: JsonObject,\n): boolean {\n\treturn normalized(emailOf(type, before)) !== normalized(emailOf(type, after));\n}\n\n/**\n * What `update` writes: the patch merged over the stored fields, the whole\n * result validated, and the logins derived again from it.\n */\nexport async function fieldsPatch(\n\ttype: ResolvedType,\n\trecord: UserRecord,\n\tpatch: Input,\n\twhere: string,\n) {\n\tconst fields = await validateFields(\n\t\ttype,\n\t\t{ ...record.fields, ...patch },\n\t\twhere,\n\t);\n\n\treturn {\n\t\tfields,\n\t\tlogins: loginsOf(type, fields, where),\n\t\tschemaVersion: type.schemaVersion,\n\t\t// A new e-mail is an unproven one.\n\t\t...(emailChanged(type, record.fields, fields)\n\t\t\t? { emailVerifiedAt: null }\n\t\t\t: {}),\n\t};\n}\n",
37
+ "/**\n * The token a change of e-mail sends and redeems: issued for the NEW\n * address, bound to the address it replaces, and refused when the user's\n * e-mail is no longer that one.\n *\n * `address` holds the new address; `codeHash` holds the former one, keyed by\n * the token's secret (`TokenRecord.codeHash`), so the port needs no field and\n * a dump of the store reveals neither.\n */\n\nimport { TokenError, UserInvalidError } from '../../errors/janus-error';\nimport { normalizeEmail, type ResolvedType } from '../config';\nimport { type Context, emailOf, findRecord, validateFields } from '../context';\nimport { issueOneTime, spendOneTime, unknownOneTime } from '../one-time';\nimport type { TokenRecord, UserRecord } from '../port/types';\nimport { hashSecret, mintSecret } from '../secrets';\nimport type { IssuedToken } from '../types';\n\n/** What binds a token to the address it replaces. */\nexport const formerHash = (secret: string, former: string | null): string =>\n\thashSecret(\n\t\t`janus/changeEmail/former\\0${secret}\\0${normalizeEmail(former ?? '')}`,\n\t);\n\n/**\n * Validates `email` as the user's new address — by the type's own schema, the\n * other fields as they are — and gives it back as the schema left it. An\n * address equal to the current one once normalised is `USER_INVALID`: moving\n * to where the user already is means nothing (`verifyEmail` proves it).\n */\nexport async function newAddressOf(\n\ttype: ResolvedType,\n\tuser: UserRecord,\n\temail: string,\n\twhere: string,\n): Promise<string> {\n\tconst fields = await validateFields(\n\t\ttype,\n\t\t{ ...user.fields, [type.email]: email },\n\t\twhere,\n\t);\n\tconst address = emailOf(type, fields);\n\tif (address === null) {\n\t\tthrow new TypeError(\n\t\t\t`janus: email \"${type.email}\" did not name a string in validated ${type.name} fields — the schema must keep the e-mail field a required string`,\n\t\t);\n\t}\n\tif (\n\t\tnormalizeEmail(address) === normalizeEmail(emailOf(type, user.fields) ?? '')\n\t) {\n\t\tthrow new UserInvalidError(\n\t\t\t`${where}: the new e-mail is the user's current one — a change moves to another address; verifyEmail proves the current one`,\n\t\t\t{\n\t\t\t\tissues: [\n\t\t\t\t\t{ path: [type.email], message: 'is the current e-mail of the user' },\n\t\t\t\t],\n\t\t\t\tuserType: type.name,\n\t\t\t},\n\t\t);\n\t}\n\treturn address;\n}\n\n/**\n * Issues the token for the validated new `address`, bound to the address the\n * user has now, and spends the user's earlier ones.\n */\nexport async function issueChangeEmailToken(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tuser: UserRecord,\n\taddress: string,\n): Promise<IssuedToken> {\n\tconst secret = mintSecret();\n\tconst { expiresAt } = await issueOneTime(context, {\n\t\tkind: 'changeEmail',\n\t\tuserId: user.id,\n\t\taddress,\n\t\tttlMs: context.config.tokenTtlMs.changeEmail,\n\t\tsecret,\n\t\tboundHash: formerHash(secret, emailOf(type, user.fields)),\n\t});\n\t// One live link per user: issued first, spent after, as for a reset, so\n\t// requests that race leave at most one live — never one each.\n\tawait context.store.tokens.spendUserTokens(\n\t\tuser.id,\n\t\t'changeEmail',\n\t\tcontext.clock.now(),\n\t\thashSecret(secret),\n\t);\n\treturn { token: secret, email: address, expiresAt };\n}\n\n/**\n * Refuses a token asked from an address the user has left: the link would\n * move somebody who is no longer where the request came from.\n */\nexport function refuseMoved(\n\ttype: ResolvedType,\n\tuser: UserRecord,\n\ttoken: TokenRecord,\n\tsecret: string,\n\twhere: string,\n): void {\n\tif (token.codeHash !== formerHash(secret, emailOf(type, user.fields))) {\n\t\tthrow new TokenError(\n\t\t\t'TOKEN_STALE',\n\t\t\t`${where}: the token was asked from an e-mail the user no longer has`,\n\t\t\t{ operation: where, userId: user.id, userType: type.name },\n\t\t);\n\t}\n}\n\n/**\n * Spends a change's token and says why it cannot be used, when it cannot. A\n * user gone since, or of another type, is as good as no token; a user who\n * moved since the link was asked is stale.\n *\n * With `type` null the user's own type answers — whichever it is, provided it\n * has an e-mail: a page that does not know the type confirms the link, and\n * `type` in the answer is the one the user has.\n */\nexport async function redeemChangeEmailToken(\n\tcontext: Context,\n\ttype: ResolvedType | null,\n\tsecret: string,\n\twhere: string,\n): Promise<{ token: TokenRecord; user: UserRecord; type: ResolvedType }> {\n\tconst token = await spendOneTime(\n\t\tcontext,\n\t\tsecret,\n\t\t'changeEmail',\n\t\twhere,\n\t\t'token',\n\t);\n\tconst user = await findRecord(context, token.userId, type?.name ?? null);\n\tconst owner = type ?? context.config.types.get(user?.type ?? '');\n\tif (user === null || owner === undefined)\n\t\tthrow unknownOneTime(where, 'token');\n\t// A type with no e-mail field has no changeEmail: its users are as good as\n\t// unknown here, as through their own type, which has no such flow.\n\tif (emailOf(owner, user.fields) === null)\n\t\tthrow unknownOneTime(where, 'token');\n\n\trefuseMoved(owner, user, token, secret, where);\n\treturn { token, user, type: owner };\n}\n",
38
+ "/**\n * Changing a user's e-mail: send a token to the NEW address, then redeem it\n * to move the user there — verified, since the link reached its inbox.\n */\n\nimport { UserInactiveError } from '../../errors/janus-error';\nimport type { At } from '../at';\nimport type { ResolvedType } from '../config';\nimport {\n\ttype AnyUser,\n\ttype Context,\n\temailOf,\n\tgetRecord,\n\tidOf,\n\ttoUser,\n\twriteUser,\n} from '../context';\nimport { emit } from '../events';\nimport { countMailByAddress, countMailByUser } from '../mail-requests';\nimport type { UserRecord } from '../port/types';\nimport type { ChangeEmailApi } from '../types';\nimport { emailChanged, fieldsPatch } from '../users/fields-patch';\nimport {\n\tissueChangeEmailToken,\n\tnewAddressOf,\n\tredeemChangeEmailToken,\n\trefuseMoved,\n} from './change-email-token';\n\nconst inactive = (type: ResolvedType, user: UserRecord, where: string) =>\n\tnew UserInactiveError(`${where}: the user is inactive`, {\n\t\tuserId: user.id,\n\t\tuserType: type.name,\n\t});\n\n/** `changeEmail` of one user type: `send` to the new address, then `confirm`. */\nexport function changeEmailFlows(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tat: At,\n): ChangeEmailApi<AnyUser>['changeEmail'] {\n\treturn {\n\t\tasync send(user, email) {\n\t\t\tconst where = at('changeEmail.send');\n\t\t\tconst record = await getRecord(context, idOf(user), type.name, where);\n\t\t\tif (!record.active) throw inactive(type, record, where);\n\t\t\t// Validated first — a USER_INVALID spends nothing — then the user is\n\t\t\t// counted, then the address, all before anything is issued. The user\n\t\t\t// first: an account past its own count spends no address's, so one\n\t\t\t// account can exhaust at most one address per window. An address\n\t\t\t// other people exhausted costs the asking user one of their own.\n\t\t\tconst address = await newAddressOf(type, record, email, where);\n\t\t\tawait countMailByUser(context, type, 'changeEmail', record.id, where);\n\t\t\tawait countMailByAddress(\n\t\t\t\tcontext,\n\t\t\t\ttype,\n\t\t\t\t'changeEmail',\n\t\t\t\taddress,\n\t\t\t\twhere,\n\t\t\t\trecord.id,\n\t\t\t);\n\t\t\treturn issueChangeEmailToken(context, type, record, address);\n\t\t},\n\n\t\tasync confirm(secret) {\n\t\t\treturn confirmChange(context, type, secret, at('changeEmail.confirm'));\n\t\t},\n\t};\n}\n\n/**\n * Redeems a change's token: the write, then the events it earned. `asked` is\n * the type whose `confirm` was called, or null for the root's, where the\n * user's own type answers.\n */\nexport async function confirmChange(\n\tcontext: Context,\n\tasked: ResolvedType | null,\n\tsecret: string,\n\twhere: string,\n): Promise<AnyUser> {\n\tconst { token, user, type } = await redeemChangeEmailToken(\n\t\tcontext,\n\t\tasked,\n\t\tsecret,\n\t\twhere,\n\t);\n\tif (!user.active) throw inactive(type, user, where);\n\n\t// The record the write replaced, read in its callback, as `update` does.\n\tconst seen: { replaced: UserRecord | null } = { replaced: null };\n\tconst written = await writeUser(\n\t\tcontext,\n\t\tuser.id,\n\t\ttype,\n\t\tundefined,\n\t\twhere,\n\t\tasync (record, now) => {\n\t\t\t// Checked again on the record written, as for verifyEmail.\n\t\t\tif (!record.active) throw inactive(type, record, where);\n\t\t\trefuseMoved(type, record, token, secret, where);\n\t\t\tseen.replaced = record;\n\t\t\tconst patch = await fieldsPatch(\n\t\t\t\ttype,\n\t\t\t\trecord,\n\t\t\t\t{ [type.email]: token.address },\n\t\t\t\twhere,\n\t\t\t);\n\t\t\t// Verified by the link that reached the new address. `send` refuses\n\t\t\t// the current address and an `update` spends the link, so the address\n\t\t\t// always moves here; the test is a guard, not a path.\n\t\t\tconst proved =\n\t\t\t\trecord.emailVerifiedAt === null ||\n\t\t\t\temailChanged(type, record.fields, patch.fields);\n\t\t\treturn proved ? { ...patch, emailVerifiedAt: now } : patch;\n\t\t},\n\t);\n\tconst { replaced } = seen;\n\tconst moved =\n\t\treplaced !== null && emailChanged(type, replaced.fields, written.fields);\n\tif (replaced !== null && moved) {\n\t\tawait emit(context, 'user.emailChanged', written, written.updatedAt, {\n\t\t\tformerEmail: emailOf(type, replaced.fields),\n\t\t});\n\t}\n\tif (moved || replaced?.emailVerifiedAt === null) {\n\t\tawait emit(context, 'user.emailVerified', written, written.updatedAt);\n\t}\n\treturn toUser(written);\n}\n",
39
+ "/**\n * The confirmation of a change of e-mail at the root of an instance with\n * several user types: for the page that follows the link and does not know\n * the user's type.\n */\n\nimport type { AnyUser, Context } from '../context';\nimport { confirmChange } from './change-email';\n\n/**\n * `{ changeEmail: { confirm } }`. Built whatever the types, as each type's\n * flows are; the types show it only when one has an e-mail, and a user of a\n * type without one is `TOKEN_UNKNOWN`. `send` stays on each type: it needs the\n * user's type to validate the address.\n */\nexport function anyTypeChangeEmail(context: Context): {\n\treadonly changeEmail: { confirm(token: string): Promise<AnyUser> };\n} {\n\treturn {\n\t\tchangeEmail: {\n\t\t\tconfirm: (secret) =>\n\t\t\t\tconfirmChange(context, null, secret, 'changeEmail.confirm'),\n\t\t},\n\t};\n}\n",
27
40
  "import type { JanusStores, StoreCapabilities } from './types';\n\n/**\n * The methods each slot must answer, in the order the port declares them.\n *\n * Kept beside the interfaces rather than derived from them: a type does not\n * exist at runtime, and this list is the net for the JavaScript caller the\n * compiler never saw.\n */\nconst REQUIRED = {\n\tusers: [\n\t\t'insertUser',\n\t\t'findUser',\n\t\t'findUserByLogin',\n\t\t'listUsers',\n\t\t'updateUser',\n\t\t'deleteUser',\n\t],\n\tsessions: [\n\t\t'insertSession',\n\t\t'findSessionByTokenHash',\n\t\t'extendSession',\n\t\t'reauthenticateSession',\n\t\t'revokeSession',\n\t\t'revokeUserSessions',\n\t\t'deleteUserSessions',\n\t],\n\ttokens: [\n\t\t'insertToken',\n\t\t'consumeToken',\n\t\t'countAttempt',\n\t\t'spendUserTokens',\n\t\t'deleteUserTokens',\n\t],\n} as const satisfies Record<keyof JanusStores, readonly string[]>;\n\n/**\n * Checks that every slot answers every method the port declares, and reports\n * the optional capabilities found.\n *\n * TypeScript already refuses a partial store and names the missing method;\n * this is the net for a JavaScript caller, and for a store assembled from\n * `any`. A bare `TypeError`, because a missing method can only come from how\n * the application was wired — no request produces one, and no handler should\n * answer one.\n *\n * `where` names the call the consumer wrote — `janus` — so the\n * sentence says which call to fix and which slot to change.\n */\nexport function assertStores(\n\tstores: unknown,\n\twhere: string,\n): StoreCapabilities {\n\tif (typeof stores !== 'object' || stores === null) {\n\t\tthrow new TypeError(\n\t\t\t`${where}: store must be an object with users, sessions and tokens`,\n\t\t);\n\t}\n\n\tfor (const slot of Object.keys(REQUIRED) as (keyof typeof REQUIRED)[]) {\n\t\tconst store: unknown = (stores as Record<string, unknown>)[slot];\n\n\t\tif (typeof store !== 'object' || store === null) {\n\t\t\tthrow new TypeError(`${where}: store.${slot} is missing`);\n\t\t}\n\n\t\tfor (const method of REQUIRED[slot]) {\n\t\t\tif (typeof (store as Record<string, unknown>)[method] !== 'function') {\n\t\t\t\tthrow new TypeError(\n\t\t\t\t\t`${where}: store.${slot} has no method ${method}, which the port requires`,\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\t}\n\n\tconst slots = stores as Record<\n\t\tkeyof typeof REQUIRED,\n\t\tRecord<string, unknown>\n\t>;\n\treturn {\n\t\tcollectExpired: optional(slots, 'sessions', 'deleteExpiredSessions', where),\n\t\tcollectExpiredTokens: optional(\n\t\t\tslots,\n\t\t\t'tokens',\n\t\t\t'deleteExpiredTokens',\n\t\t\twhere,\n\t\t),\n\t\tfindUsers: optional(slots, 'users', 'findUsers', where),\n\t};\n}\n\n/**\n * Whether an optional method is there. Present but not a function is a wiring\n * mistake, not an absent capability: reporting it as \"unsupported\" would send\n * the reader to the wrong fix.\n */\nfunction optional(\n\tstores: Record<keyof typeof REQUIRED, Record<string, unknown>>,\n\tslot: keyof typeof REQUIRED,\n\tmethod: string,\n\twhere: string,\n): boolean {\n\tconst found = stores[slot][method];\n\tif (found !== undefined && typeof found !== 'function') {\n\t\tthrow new TypeError(\n\t\t\t`${where}: store.${slot}.${method} must be a function or absent`,\n\t\t);\n\t}\n\treturn found !== undefined;\n}\n",
28
41
  "import { randomBytes, timingSafeEqual } from 'node:crypto';\nimport { derivedKey, keyedHash } from '../derived-keys';\nimport type { Sealer } from '../sealing';\n\n/**\n * A device token: `d1.<key id>.<device id>.<mac>`, the last two in\n * base64url. The device id is 16 random bytes; the mac is an HMAC-SHA256 of\n * the user's id and the device id, under a key derived for this purpose from\n * `devices.keys`. **Nothing is stored**: the token is its own proof that this\n * user signed in on this device before, and a token copied onto another user\n * proves nothing.\n *\n * Every character is a cookie-value character, so it goes in a cookie as is.\n */\n\n/** What the key is derived for. Renamed, every device would be new again. */\nconst PURPOSE = 'janus/devices/v1';\n\nconst TOKEN =\n\t/^d1\\.([A-Za-z0-9_-]{1,64})\\.([A-Za-z0-9_-]{22})\\.([A-Za-z0-9_-]{43})$/;\n\nfunction macOf(key: Buffer, userId: string, deviceId: string): Buffer {\n\treturn keyedHash(key, [userId, deviceId]);\n}\n\nfunction signed(sealer: Sealer, userId: string, deviceId: string): string {\n\t// The first key is always held: resolveSealer names it from the keys.\n\tconst key = derivedKey(sealer, PURPOSE) as Buffer;\n\tconst mac = macOf(key, userId, deviceId).toString('base64url');\n\treturn `d1.${sealer.sealWith}.${deviceId}.${mac}`;\n}\n\n/** A token for a device never seen: a fresh device id, signed with the first key. */\nexport function mintDeviceToken(sealer: Sealer, userId: string): string {\n\treturn signed(sealer, userId, randomBytes(16).toString('base64url'));\n}\n\n/**\n * The token to hand back when `presented` proves this user signed in on this\n * device before — itself, or the same device signed again with the first key\n * when an older key signed it — or `null` when it proves nothing: malformed,\n * another user's, forged, or signed with a key no longer held.\n *\n * `presented` comes from a request, so nothing here throws.\n */\nexport function knownDeviceToken(\n\tsealer: Sealer,\n\tuserId: string,\n\tpresented: string,\n): string | null {\n\tconst [, keyId, deviceId, mac] = TOKEN.exec(presented) ?? [];\n\tif (keyId === undefined || deviceId === undefined || mac === undefined) {\n\t\treturn null;\n\t}\n\tconst key = derivedKey(sealer, PURPOSE, keyId);\n\tif (key === undefined) return null;\n\n\tconst expected = macOf(key, userId, deviceId);\n\tconst given = Buffer.from(mac, 'base64url');\n\tif (given.length !== expected.length || !timingSafeEqual(given, expected)) {\n\t\treturn null;\n\t}\n\treturn keyId === sealer.sealWith\n\t\t? presented\n\t\t: signed(sealer, userId, deviceId);\n}\n",
29
- "import { createHmac, hkdfSync } from 'node:crypto';\nimport type { Sealer } from './sealing';\n\n/**\n * Keys derived from the sealing keys, one per purpose — never the key that\n * seals a secret itself — and the keyed hashes made with them: a recovery\n * code's, and the names of the counts of attempts. Each caller keeps its own\n * purpose: renamed, what it hashed no longer matches.\n */\n\nconst derived = new WeakMap<Sealer, Map<string, Buffer>>();\n\n/**\n * The key `keyId` lends `purpose` — the first key by default — derived once\n * per key, or `undefined` when the sealer no longer holds that key.\n */\nexport function derivedKey(\n\tsealer: Sealer,\n\tpurpose: string,\n\tkeyId: string = sealer.sealWith,\n): Buffer | undefined {\n\tlet keys = derived.get(sealer);\n\tif (keys === undefined) {\n\t\tkeys = new Map();\n\t\tderived.set(sealer, keys);\n\t}\n\tconst name = `${purpose}\\u0000${keyId}`;\n\tlet key = keys.get(name);\n\tif (key === undefined) {\n\t\tconst secret = sealer.keys.get(keyId);\n\t\tif (secret === undefined) return undefined;\n\t\tkey = Buffer.from(hkdfSync('sha256', secret, Buffer.alloc(0), purpose, 32));\n\t\tkeys.set(name, key);\n\t}\n\treturn key;\n}\n\n/** HMAC-SHA256 of `parts`, joined by a NUL — which no part may hold. */\nexport function keyedHash(key: Buffer, parts: readonly string[]): Buffer {\n\treturn createHmac('sha256', key).update(parts.join('\\u0000')).digest();\n}\n",
30
42
  "import type { Context } from '../context';\nimport type { SignInOptions } from '../types';\nimport { knownDeviceToken, mintDeviceToken } from './token';\n\n/**\n * What a sign-in was told of the device: `undefined` when nothing — devices\n * are not tracked for that call — `null` for a device holding no token yet,\n * or the token it presented.\n */\nexport type DeviceHint = string | null | undefined;\n\n/** What a session-opening answer says of the device. */\nexport interface DeviceOutcome {\n\treadonly newDevice: boolean;\n\treadonly deviceToken: string | null;\n}\n\n/** No device given: nothing tracked, nothing minted. */\nexport const UNTRACKED: DeviceOutcome = Object.freeze({\n\tnewDevice: false,\n\tdeviceToken: null,\n});\n\n/**\n * The device a sign-in's options name. A JavaScript caller's options that\n * are not an object (the token itself), a `device` of another type, and a\n * device given to a `janus()` wired without `devices`, are wiring\n * mistakes — bare `TypeError`s. The value itself, whatever it holds, is the\n * client's, and never refused.\n */\nexport function deviceHint(\n\tcontext: Context,\n\toptions: SignInOptions | undefined,\n\twhere: string,\n): DeviceHint {\n\tif (\n\t\toptions !== undefined &&\n\t\t(typeof options !== 'object' || options === null)\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`${where}: options must be { device }, or left out — the token goes under device`,\n\t\t);\n\t}\n\tconst device = options?.device;\n\tif (device === undefined) return undefined;\n\tif (device !== null && typeof device !== 'string') {\n\t\tthrow new TypeError(\n\t\t\t`${where}: options.device must be the device token the client holds, or null when it holds none`,\n\t\t);\n\t}\n\tif (context.config.devices === null) {\n\t\tthrow new TypeError(\n\t\t\t`${where}: a device was given, but janus() has no devices — pass devices: { keys }`,\n\t\t);\n\t}\n\treturn device;\n}\n\n/**\n * Whether a session opening for `userId` comes from a new device, and the\n * token the client keeps from now on. A sign-up mints a token and is never\n * new: the account has no device to be new against.\n */\nexport function deviceOutcome(\n\tcontext: Context,\n\tuserId: string,\n\thint: DeviceHint,\n\tsignUp: boolean,\n): DeviceOutcome {\n\tconst sealer = context.config.devices?.sealer;\n\tif (hint === undefined || sealer === undefined) return UNTRACKED;\n\n\tconst known =\n\t\thint === null || signUp ? null : knownDeviceToken(sealer, userId, hint);\n\tif (known !== null) return { newDevice: false, deviceToken: known };\n\treturn {\n\t\tnewDevice: !signUp,\n\t\tdeviceToken: mintDeviceToken(sealer, userId),\n\t};\n}\n",
31
43
  "import type { AnyUser, Context } from '../context';\nimport { emit } from '../events';\nimport type { SignInResult } from '../types';\n\n/**\n * Sends `user.newDeviceSignedIn` for a session a new device just opened —\n * once the sign-in is complete, so a sign-in refused after its session\n * opened (a password written meanwhile) reports nothing. A challenge, and a\n * session from a known device or with no device given, report nothing\n * either.\n */\nexport async function reportNewDevice(\n\tcontext: Context,\n\tresult: SignInResult<AnyUser>,\n): Promise<void> {\n\tif (result.status !== 'signedIn' || !result.newDevice) return;\n\tawait emit(\n\t\tcontext,\n\t\t'user.newDeviceSignedIn',\n\t\tresult.user,\n\t\tresult.session.createdAt,\n\t\t{ sessionId: result.session.id },\n\t);\n}\n",
32
- "import { createHash, randomBytes } from 'node:crypto';\n\n/**\n * A fresh secret: 32 random bytes, base64url — safe in a header, a cookie and a\n * URL without escaping.\n *\n * Given to the application **once**. No store ever holds it.\n */\nexport function mintSecret(): string {\n\treturn randomBytes(32).toString('base64url');\n}\n\n/**\n * What a store holds instead of the secret: `sha256`, hex.\n *\n * SHA-256 and not argon2, on purpose. The secret carries 256 bits of entropy, so\n * there is nothing to brute-force, and an argon2 per request would put ~50 ms on\n * every authenticated call. What the hash buys is that a dump of the store\n * cannot be replayed.\n */\nexport function hashSecret(secret: string): string {\n\treturn createHash('sha256').update(secret).digest('hex');\n}\n",
33
44
  "/**\n * Opening a session once a user proved who they are, and the session as\n * application code sees it.\n */\n\nimport { mintId } from '../../ids/id';\nimport type { ResolvedType } from '../config';\nimport { type AnyUser, type Context, toUser } from '../context';\nimport { type DeviceHint, deviceOutcome } from '../devices';\nimport type { SessionRecord, UserRecord } from '../port/types';\nimport { hashSecret, mintSecret } from '../secrets';\nimport type { Session, SignedIn } from '../types';\n\n/** A session as application code sees it: everything but the token's hash. */\nexport function toSession(record: SessionRecord): Session {\n\tconst { tokenHash: _, ...session } = record;\n\treturn session;\n}\n\n/**\n * Opens a session for a user who just proved who they are. The token is in\n * the answer and nowhere else: the store holds its hash.\n *\n * `device` is what the sign-in was told of the device, and the answer says\n * whether it is new to the user; `signUp` mints a first token and is never\n * new. Reporting a new device is the caller's, once its sign-in is complete\n * (`reportNewDevice`).\n */\nexport async function openSession(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tuser: UserRecord,\n\tdevice: DeviceHint,\n\tsignUp = false,\n): Promise<SignedIn<AnyUser>> {\n\tconst now = context.clock.now();\n\tconst token = mintSecret();\n\tconst record: SessionRecord = {\n\t\tid: mintId(now.getTime()),\n\t\ttokenHash: hashSecret(token),\n\t\tuserId: user.id,\n\t\tauthenticatedAt: now,\n\t\texpiresAt: new Date(now.getTime() + type.lifespanMs),\n\t\trevokedAt: null,\n\t\tcreatedAt: now,\n\t};\n\n\tawait context.store.sessions.insertSession(record);\n\treturn {\n\t\tstatus: 'signedIn',\n\t\tuser: toUser(user),\n\t\tsession: toSession(record),\n\t\ttoken,\n\t\t...deviceOutcome(context, user.id, device, signUp),\n\t};\n}\n",
34
45
  "/**\n * Reading the session token a request presents, whatever shape the request\n * arrives in.\n */\n\nimport type { HeaderRecord, RequestLike } from '../types';\n\n/**\n * The session token a request presents: `Authorization: Bearer`, then\n * `X-Session-Token`, then the cookie.\n *\n * **The first credential present wins, not the first valid one.** A browser\n * sending a lapsed bearer beside a live cookie is anonymous, and should fix its\n * header rather than be rescued in silence — the rule `resolve` in `nxgt-ory`'s\n * SDK learned. An `Authorization` header of another scheme (`Basic`) is not a\n * session credential, and does not count as one.\n */\nexport function presentedToken(\n\trequest: RequestLike,\n\tcookieName: string,\n): string | null {\n\tconst headers = headersOf(request);\n\tconst read = (name: string): string | null => {\n\t\tif (headers instanceof Headers) return headers.get(name);\n\t\tfor (const [key, value] of Object.entries(headers)) {\n\t\t\tif (key.toLowerCase() !== name || value === undefined) continue;\n\t\t\treturn typeof value === 'string' ? value : value.join(', ');\n\t\t}\n\t\treturn null;\n\t};\n\n\tconst authorization = read('authorization');\n\tif (authorization !== null) {\n\t\tconst match = /^bearer(?:\\s+(.*))?$/i.exec(authorization.trim());\n\t\tif (match) return match[1]?.trim() ?? '';\n\t}\n\n\tconst header = read('x-session-token');\n\tif (header !== null) return header.trim();\n\n\tconst cookie = read('cookie');\n\tif (cookie !== null) {\n\t\tfor (const pair of cookie.split(';')) {\n\t\t\tconst at = pair.indexOf('=');\n\t\t\tif (at !== -1 && pair.slice(0, at).trim() === cookieName) {\n\t\t\t\treturn pair.slice(at + 1).trim();\n\t\t\t}\n\t\t}\n\t}\n\n\treturn null;\n}\n\n/**\n * The headers of whatever was passed: a `Request`, `Headers`, anything with a\n * `headers` property — Node's `IncomingMessage` — or a plain record.\n */\nfunction headersOf(request: RequestLike): Headers | HeaderRecord {\n\tif (request instanceof Headers) return request;\n\tconst inner = (request as { headers?: unknown }).headers;\n\tif (inner instanceof Headers) return inner;\n\tif (typeof inner === 'object' && inner !== null) return inner as HeaderRecord;\n\treturn request as HeaderRecord;\n}\n",
35
46
  "/**\n * The standing session a request presents — one rule for `authenticate` and\n * `stepUp.confirm`, so the two never disagree on what \"signed in\" means.\n */\n\nimport type { Context } from '../context';\nimport type { SessionRecord } from '../port/types';\nimport { hashSecret } from '../secrets';\nimport type { RequestLike } from '../types';\nimport { presentedToken } from './presented-token';\n\n/** A standing session, and the session token that presented it. */\nexport interface Presented {\n\treadonly token: string;\n\treadonly session: SessionRecord;\n}\n\n/**\n * Answers the session `request` presents, with its token — or `null` when\n * none stands: no token, or a session gone, revoked or lapsed. Expiry is\n * decided here, against the context's clock: a store may still hold a\n * session past its term.\n */\nexport async function standingSession(\n\tcontext: Context,\n\trequest: RequestLike,\n): Promise<Presented | null> {\n\tconst token = presentedToken(request, context.config.cookie.name);\n\tif (token === null) return null;\n\n\tconst session = await context.store.sessions.findSessionByTokenHash(\n\t\thashSecret(token),\n\t);\n\tconst now = context.clock.now().getTime();\n\treturn session === null ||\n\t\tsession.revokedAt !== null ||\n\t\tsession.expiresAt.getTime() <= now\n\t\t? null\n\t\t: { token, session };\n}\n",
@@ -37,16 +48,6 @@
37
48
  "/**\n * `collectExpired()`: the lapsed sessions and the lapsed one-time tokens, from\n * whichever of the two stores implements its collector.\n */\n\nimport { UnsupportedError } from '../../errors/janus-error';\nimport type { Context } from '../context';\n\n/**\n * Deletes what has lapsed at `clock.now()` and answers how many in all.\n *\n * Sessions first, then tokens, one after the other: both deletions are\n * idempotent, so a token failure after the sessions went leaves a call that can\n * simply be repeated. `UNSUPPORTED` only when neither store has a collector.\n */\nexport async function collectExpired(context: Context): Promise<number> {\n\tconst { store, clock, capabilities } = context;\n\tconst sessions = capabilities.collectExpired\n\t\t? store.sessions.deleteExpiredSessions\n\t\t: undefined;\n\tconst tokens = capabilities.collectExpiredTokens\n\t\t? store.tokens.deleteExpiredTokens\n\t\t: undefined;\n\n\tif (sessions === undefined && tokens === undefined) {\n\t\tthrow new UnsupportedError(\n\t\t\t'collectExpired: store.sessions does not implement deleteExpiredSessions, nor store.tokens deleteExpiredTokens — their stores expire records on their own, or implement the methods',\n\t\t\t{ slot: 'sessions', operation: 'deleteExpiredSessions' },\n\t\t);\n\t}\n\n\tconst before = clock.now();\n\tconst collected = sessions === undefined ? 0 : await sessions(before);\n\treturn collected + (tokens === undefined ? 0 : await tokens(before));\n}\n",
38
49
  "/**\n * The session cookie: its name, and the `Set-Cookie` values that set and\n * clear it, under the attributes the configuration resolved.\n */\n\nimport type { AnyUser, Context } from '../context';\nimport type { Session, SharedApi } from '../types';\n\n/** The session cookie's name, and how to set it for a session and clear it. */\nexport function cookieOf(context: Context): SharedApi<AnyUser>['cookie'] {\n\tconst { name, domain, path, sameSite, secure } = context.config.cookie;\n\tconst attributes = [\n\t\t`Path=${path}`,\n\t\t...(domain === null ? [] : [`Domain=${domain}`]),\n\t\t'HttpOnly',\n\t\t`SameSite=${sameSite[0]?.toUpperCase()}${sameSite.slice(1)}`,\n\t\t...(secure ? ['Secure'] : []),\n\t].join('; ');\n\n\treturn {\n\t\tname,\n\t\tserialize: (token: string, session: Session) =>\n\t\t\t`${name}=${token}; Expires=${session.expiresAt.toUTCString()}; ${attributes}`,\n\t\tclear: () =>\n\t\t\t`${name}=; Expires=Thu, 01 Jan 1970 00:00:00 GMT; Max-Age=0; ${attributes}`,\n\t};\n}\n",
39
50
  "/**\n * What `janus()` answers whatever its user types: authenticating a request,\n * signing out, finding a user by id, the cookie, and collecting expired\n * sessions and one-time tokens.\n */\n\nimport { isId } from '../../ids/id';\nimport {\n\ttype AnyUser,\n\ttype Context,\n\tfindRecord,\n\tgetRecord,\n\tidOf,\n\ttoUser,\n} from '../context';\nimport { hashSecret } from '../secrets';\nimport type { Authenticated, RequestLike, SharedApi } from '../types';\nimport { authenticate } from './authenticate';\nimport { collectExpired } from './collect-expired';\nimport { cookieOf } from './cookie';\nimport { presentedToken } from './presented-token';\n\n/** `SharedApi`, degenericised: `janus()` casts it to the typed form once. */\nexport type InternalSharedApi = Omit<SharedApi<AnyUser>, 'authenticate'> & {\n\tauthenticate(\n\t\trequest: RequestLike,\n\t\toptions?: { readonly type?: string },\n\t): Promise<Authenticated<AnyUser> | null>;\n};\n\n/** Everything `janus()` answers whatever its user types. */\nexport function sharedApi(context: Context): InternalSharedApi {\n\tconst { store, clock, config } = context;\n\n\treturn {\n\t\tasync authenticate(request, options) {\n\t\t\treturn authenticate(context, request, options);\n\t\t},\n\n\t\tasync signOut(request) {\n\t\t\tconst token = presentedToken(request, config.cookie.name);\n\t\t\tif (token === null) return false;\n\n\t\t\tconst session = await store.sessions.findSessionByTokenHash(\n\t\t\t\thashSecret(token),\n\t\t\t);\n\t\t\tif (session === null) return false;\n\t\t\treturn store.sessions.revokeSession(session.id, clock.now());\n\t\t},\n\n\t\tasync signOutEverywhere(user, options) {\n\t\t\tconst id = idOf(user);\n\t\t\tif (!isId(id)) return 0;\n\t\t\t// An `except` that is no id this package minted names no session:\n\t\t\t// every session goes, as it would for an unknown one.\n\t\t\treturn options?.except === undefined || !isId(options.except)\n\t\t\t\t? store.sessions.revokeUserSessions(id, clock.now())\n\t\t\t\t: store.sessions.revokeUserSessions(id, clock.now(), options.except);\n\t\t},\n\n\t\tasync findUser(id) {\n\t\t\tconst record = await findRecord(context, id, null);\n\t\t\treturn record === null ? null : toUser(record);\n\t\t},\n\n\t\tasync getUser(id) {\n\t\t\treturn toUser(await getRecord(context, id, null, 'getUser'));\n\t\t},\n\n\t\tcookie: cookieOf(context),\n\n\t\tasync collectExpired() {\n\t\t\treturn collectExpired(context);\n\t\t},\n\n\t\ttypes: [...config.types.keys()],\n\t};\n}\n",
40
- "/**\n * The key that names a count of attempts stored under no user — the\n * passwords tried at a login (`sign-in-attempts.ts`), the e-mails asked for\n * an address (`mail-requests.ts`) — and the keyed hashes made with it.\n *\n * Derived from the sealing keys when `secondFactor` is configured; without\n * them it is a fixed one, and the hash only keeps the login or the address\n * out of plain sight — safe because a `secondFactor` token is redeemed only\n * by the second factor's flows, which do not exist without the keys.\n */\n\nimport type { Context } from './context';\nimport { derivedKey, keyedHash } from './derived-keys';\n\n/**\n * The key `purpose` names its counts with. Renamed, a purpose's every count\n * in progress would start over.\n */\nexport function counterKey(context: Context, purpose: string): Buffer {\n\tconst sealer = context.config.secondFactor?.sealer;\n\t// The first key is always held: resolveSealer names it from the keys.\n\treturn sealer === undefined\n\t\t? Buffer.from(purpose)\n\t\t: (derivedKey(sealer, purpose) as Buffer);\n}\n\n/** A keyed hash of `parts`, base64url: a name, never a secret. */\nexport const keyed = (key: Buffer, parts: readonly string[]): string =>\n\tkeyedHash(key, parts).toString('base64url');\n",
41
- "/**\n * The six-digit code a challenge carries — a second factor's or an e-mailed\n * one: its attempts, counted before anything is compared, its hash, keyed by\n * the challenge, and the refusal of one that does not match.\n */\n\nimport { timingSafeEqual } from 'node:crypto';\nimport { TokenError } from '../../errors/janus-error';\nimport type { Context } from '../context';\nimport type { TokenKind, TokenRecord } from '../port/types';\nimport { hashSecret } from '../secrets';\nimport { refuseUnusable, unknownOneTime } from './refusals';\nimport { burnOneTime } from './spend';\n\n/**\n * How many codes one challenge takes — a second factor's or an e-mail\n * code's. A six-digit code has a million values: five attempts is a\n * one-in-200,000 chance **per challenge**, and the attempts are counted by\n * the store in one write, never read then written.\n */\nexport const CODE_ATTEMPTS = 5;\n\n/**\n * Counts one attempt at a challenge's code, before anything is compared: a\n * guess that fails for any reason has still cost one. Refuses a challenge\n * that cannot be used, and one past its last attempt — a call that raced the\n * one that spent it — unread.\n */\nexport async function countCodeAttempt(\n\tcontext: Context,\n\tsecret: string,\n\tkind: TokenKind,\n\twhere: string,\n\tuserType: string,\n): Promise<{ readonly token: TokenRecord; readonly attemptsLeft: number }> {\n\tconst token = await context.store.tokens.countAttempt(\n\t\thashSecret(secret),\n\t\tkind,\n\t);\n\trefuseUnusable(token, context.clock.now(), where, 'challenge');\n\tif (token.attempts > CODE_ATTEMPTS) {\n\t\tthrow codeInvalid(where, token.userId, userType, 0);\n\t}\n\treturn { token, attemptsLeft: CODE_ATTEMPTS - token.attempts };\n}\n\n/**\n * A code that does not match — a second factor's or an e-mailed one — or a\n * TOTP code already used. `attemptsLeft` only when a challenge counted it.\n */\nexport function codeInvalid(\n\twhere: string,\n\tuserId: string,\n\tuserType: string,\n\tattemptsLeft?: number,\n): TokenError {\n\treturn new TokenError(\n\t\t'CODE_INVALID',\n\t\t`${where}: the code does not match, or was already used`,\n\t\t{\n\t\t\toperation: where,\n\t\t\tuserId,\n\t\t\tuserType,\n\t\t\t...(attemptsLeft === undefined ? {} : { attemptsLeft }),\n\t\t},\n\t);\n}\n\n/**\n * The refusal for a challenge whose user is gone, or of another type — the\n * API of the wrong type compares no code. Its attempt was counted all the\n * same, before the type was known, so the last one spends the challenge, as\n * a wrong code would: past it, every call answers `TOKEN_SPENT`.\n */\nexport async function unknownChallenge(\n\tcontext: Context,\n\ttoken: TokenRecord,\n\tsecret: string,\n\twhere: string,\n): Promise<TokenError> {\n\tif (token.attempts === CODE_ATTEMPTS) {\n\t\tawait burnOneTime(context, secret, token.kind);\n\t}\n\treturn unknownOneTime(where, 'challenge');\n}\n\n/**\n * A code's hash, **keyed by its challenge**: the tokens alone — a dump, a\n * log of the table — do not reveal the code, since a million guesses at it\n * each need the challenge, which only the visitor holds.\n */\nexport const hashCode = (challenge: string, code: string): string =>\n\thashSecret(`${challenge}${code}`);\n\n/** Whether `code` is the one whose hash the token holds, compared in constant time. */\nexport function codeMatches(\n\ttoken: TokenRecord,\n\tchallenge: string,\n\tcode: string,\n): boolean {\n\tif (token.codeHash === null || !/^\\d{6}$/.test(code)) return false;\n\tconst given = Buffer.from(hashCode(challenge, code));\n\tconst held = Buffer.from(token.codeHash);\n\treturn given.length === held.length && timingSafeEqual(given, held);\n}\n",
42
- "/**\n * The refusals of a one-time token that could not be used: none, spent,\n * lapsed, or sent to an e-mail the user no longer has.\n */\n\nimport { TokenError } from '../../errors/janus-error';\nimport { normalizeEmail, type ResolvedType } from '../config';\nimport { emailOf } from '../context';\nimport type { TokenRecord, UserRecord } from '../port/types';\n\n/**\n * `noun` is what the messages call it: `token` for a link, `challenge` for\n * what `signIn` answers. No message names the secret or its hash.\n */\nexport type OneTimeNoun = 'token' | 'challenge';\n\n/**\n * Refuses a token sent to an e-mail the user no longer has: redeeming it\n * would prove an address nobody holds any more.\n */\nexport function refuseStale(\n\ttype: ResolvedType,\n\tuser: UserRecord,\n\ttoken: TokenRecord,\n\twhere: string,\n\tnoun: 'token' | 'code',\n): void {\n\tconst email = emailOf(type, user.fields);\n\tif (\n\t\temail === null ||\n\t\tnormalizeEmail(email) !== normalizeEmail(token.address)\n\t) {\n\t\tthrow new TokenError(\n\t\t\t'TOKEN_STALE',\n\t\t\t`${where}: the ${noun} was sent to an e-mail the user no longer has`,\n\t\t\t{ operation: where, userId: user.id, userType: type.name },\n\t\t);\n\t}\n}\n\n/**\n * Refuses a token that cannot be used: none, spent, or lapsed. What a store\n * answered — before a `consumeToken`, after a `countAttempt` — is read the\n * same way: `spentAt` set means somebody else used it.\n */\nexport function refuseUnusable(\n\ttoken: TokenRecord | null,\n\tnow: Date,\n\twhere: string,\n\tnoun: OneTimeNoun,\n): asserts token is TokenRecord {\n\tif (token === null) {\n\t\tthrow new TokenError('TOKEN_UNKNOWN', `${where}: no such ${noun}`, {\n\t\t\toperation: where,\n\t\t});\n\t}\n\tif (token.spentAt !== null) {\n\t\tthrow new TokenError(\n\t\t\t'TOKEN_SPENT',\n\t\t\t`${where}: the ${noun} was already used`,\n\t\t\t{ operation: where },\n\t\t);\n\t}\n\tif (token.expiresAt.getTime() <= now.getTime()) {\n\t\tthrow new TokenError('TOKEN_EXPIRED', `${where}: the ${noun} has expired`, {\n\t\t\toperation: where,\n\t\t});\n\t}\n}\n\n/** The refusal for a token whose user is gone, or of another type. */\nexport const unknownOneTime = (where: string, noun: OneTimeNoun) =>\n\tnew TokenError('TOKEN_UNKNOWN', `${where}: no such ${noun}`, {\n\t\toperation: where,\n\t});\n",
43
- "/**\n * Spending a one-time token: once when it is redeemed, and once more when its\n * last attempt failed.\n */\n\nimport type { Context } from '../context';\nimport type { TokenKind, TokenRecord } from '../port/types';\nimport { hashSecret } from '../secrets';\nimport { type OneTimeNoun, refuseUnusable } from './refusals';\n\n/**\n * Spends a token, and refuses it when this call did not: the store answers it\n * **as it was before**, so exactly one call ever reads `spentAt: null`. A\n * lapsed token is spent all the same, so it cannot be retried.\n */\nexport async function spendOneTime(\n\tcontext: Context,\n\tsecret: string,\n\tkind: TokenKind,\n\twhere: string,\n\tnoun: OneTimeNoun,\n): Promise<TokenRecord> {\n\tconst now = context.clock.now();\n\tconst token = await context.store.tokens.consumeToken(\n\t\thashSecret(secret),\n\t\tkind,\n\t\tnow,\n\t);\n\trefuseUnusable(token, now, where, noun);\n\treturn token;\n}\n\n/**\n * Spends a token whose last attempt failed. Its answer is not read: a racing\n * call that spent it first changes nothing for this one, which is refused\n * for its code either way.\n */\nexport async function burnOneTime(\n\tcontext: Context,\n\tsecret: string,\n\tkind: TokenKind,\n): Promise<void> {\n\tawait context.store.tokens.consumeToken(\n\t\thashSecret(secret),\n\t\tkind,\n\t\tcontext.clock.now(),\n\t);\n}\n",
44
- "/**\n * Issuing a one-time token — a link's, or a challenge carrying a code for a\n * person to type. The secret is given back once; the store holds its hash.\n */\n\nimport { randomInt } from 'node:crypto';\nimport type { Context } from '../context';\nimport type { TokenKind } from '../port/types';\nimport { hashSecret, mintSecret } from '../secrets';\nimport { hashCode } from './codes';\n\ninterface OneTimeRequest {\n\treadonly kind: TokenKind;\n\treadonly userId: string;\n\treadonly address: string;\n\treadonly ttlMs: number;\n\t/**\n\t * The secret to issue under, minted beforehand — a sign-in code's\n\t * challenge, handed to the visitor by `prepare` before the lookup. A\n\t * fresh one by default.\n\t */\n\treadonly secret?: string;\n}\n\n/**\n * Issues a one-time token: 32 random bytes, given back once, and only their\n * hash stored.\n */\nexport async function issueOneTime(\n\tcontext: Context,\n\ttoken: OneTimeRequest & {\n\t\t/**\n\t\t * What the token is bound to, stored as its `codeHash`: `changeEmail`\n\t\t * binds the address it replaces. `null` by default.\n\t\t */\n\t\treadonly boundHash?: string;\n\t},\n): Promise<{ readonly secret: string; readonly expiresAt: Date }> {\n\treturn insertOneTime(context, token, null, token.boundHash ?? null);\n}\n\n/**\n * Issues a one-time token with a six-digit code for a person to type: the\n * token is the challenge, and only the code's hash is stored, keyed by it.\n */\nexport async function issueCode(\n\tcontext: Context,\n\ttoken: OneTimeRequest,\n): Promise<{\n\treadonly secret: string;\n\treadonly expiresAt: Date;\n\treadonly code: string;\n}> {\n\tconst code = String(randomInt(1_000_000)).padStart(6, '0');\n\treturn { ...(await insertOneTime(context, token, code, null)), code };\n}\n\nasync function insertOneTime(\n\tcontext: Context,\n\ttoken: OneTimeRequest,\n\tcode: string | null,\n\tboundHash: string | null,\n): Promise<{ readonly secret: string; readonly expiresAt: Date }> {\n\tconst now = context.clock.now();\n\tconst secret = token.secret ?? mintSecret();\n\tconst expiresAt = new Date(now.getTime() + token.ttlMs);\n\n\tawait context.store.tokens.insertToken({\n\t\ttokenHash: hashSecret(secret),\n\t\tkind: token.kind,\n\t\tuserId: token.userId,\n\t\taddress: token.address,\n\t\tcodeHash: code === null ? boundHash : hashCode(secret, code),\n\t\tattempts: 0,\n\t\texpiresAt,\n\t\tspentAt: null,\n\t\tcreatedAt: now,\n\t});\n\treturn { secret, expiresAt };\n}\n",
45
- "/**\n * Attempts counted by the store in fixed windows of the clock — what bounds\n * the codes tried at an app outside a sign-in (`second-factor/app-code-attempts.ts`)\n * and the passwords tried at one login (`../sign-in-attempts.ts`).\n *\n * **No port of its own.** The count is a one-time token of kind\n * `secondFactor`, counted by `countAttempt` like a challenge's: one\n * conditional write per attempt, never read then written, so twenty guesses\n * at once are twenty distinct counts. Its secret is never given out: each\n * caller names it by a keyed hash of what the count is for, so it cannot be\n * redeemed as a challenge.\n *\n * A token once spent counts nothing more. So the count is a **chain** of\n * links, and what a spent link means is the caller's to say: `carry`, and the\n * next link carries on from the attempts it holds — a password written, which\n * spends every `secondFactor` token of the user, buys no guess; `restart`,\n * and the next link starts from zero — a sign-in that succeeded spends the\n * link it counted on, and the login's count starts again.\n */\n\nimport type { Context } from '../context';\nimport type { TokenRecord } from '../port/types';\n\n/**\n * More links than this in one window, for `carry`: more passwords written\n * than guesses, and the count is past any limit.\n */\nexport const MAX_LINKS = 32;\n\n/**\n * Probes enough for 2^30 sign-ins in one window, for `restart`: past them, the\n * store answers links nobody stored, and the count fails closed.\n */\nconst MAX_PROBES = 64;\n\n/** What {@link countInWindow} counts, and how. */\nexport interface AttemptWindow {\n\t/** How long one window lasts, in milliseconds. */\n\treadonly windowMs: number;\n\t/** What a spent link means: its attempts carried on, or a count started again. */\n\treadonly spent: 'carry' | 'restart';\n\t/** The `userId` each link is stored under. */\n\treadonly userId: string;\n\t/** A link's token hash in one window: never given out, and never a secret. */\n\treadonly linkHash: (window: number, link: number) => string;\n\t/** What to throw when a link is gone right after it was stored, or the links never end. */\n\treadonly vanished: () => Error;\n}\n\n/** One attempt, counted. */\nexport interface CountedAttempt {\n\t/** The attempts of this window, this one included. */\n\treadonly attempts: number;\n\t/** The link it was counted on — what spending restarts — or `null` past the last one. */\n\treadonly link: string | null;\n\t/** When the window ends, in milliseconds since the epoch. */\n\treadonly endsAt: number;\n}\n\ninterface Links {\n\treadonly context: Context;\n\treadonly counting: AttemptWindow;\n\treadonly window: number;\n\treadonly now: number;\n\treadonly expiresAt: number;\n}\n\n/** Counts one attempt in the current window, before anything is compared. */\nexport async function countInWindow(\n\tcontext: Context,\n\tcounting: AttemptWindow,\n): Promise<CountedAttempt> {\n\tconst now = context.clock.now().getTime();\n\tconst window = Math.floor(now / counting.windowMs);\n\t// A window of slack: a store whose clock runs ahead of this one must not\n\t// drop a link before its window ends. The window is in the hash, so a\n\t// link never counts for the next one.\n\tconst expiresAt = (window + 2) * counting.windowMs;\n\tconst links = { context, counting, window, now, expiresAt };\n\tconst counted =\n\t\tcounting.spent === 'carry'\n\t\t\t? await countCarrying(links)\n\t\t\t: await countRestarting(links);\n\treturn { ...counted, endsAt: (window + 1) * counting.windowMs };\n}\n\n/** Every link from the first, each spent one's attempts carried on. */\nasync function countCarrying(\n\tlinks: Links,\n): Promise<Omit<CountedAttempt, 'endsAt'>> {\n\tlet carried = 0;\n\tfor (let link = 0; link < MAX_LINKS; link += 1) {\n\t\tconst hash = links.counting.linkHash(links.window, link);\n\t\tconst counted = await countLink(links, hash);\n\t\tconst attempts = carried + counted.attempts;\n\t\tif (counted.spentAt === null) return { attempts, link: hash };\n\t\tcarried = attempts;\n\t}\n\treturn { attempts: Number.POSITIVE_INFINITY, link: null };\n}\n\n/**\n * The one unspent link, found by probing rather than walked to: a link is\n * stored only once the one before it is spent, so every link below it is\n * spent and none above it is stored. Probing a spent link or one never\n * stored writes nothing; probing the unspent one counts the attempt. So a\n * login signed in to a thousand times in one window costs twenty probes,\n * not a thousand — and no number of sign-ins turns the count off.\n */\nasync function countRestarting(\n\tlinks: Links,\n): Promise<Omit<CountedAttempt, 'endsAt'>> {\n\tconst tokens = links.context.store.tokens;\n\tlet spent = -1;\n\tlet absent = Number.POSITIVE_INFINITY;\n\tfor (let probes = 0; probes < MAX_PROBES; probes += 1) {\n\t\tconst next = absent === spent + 1;\n\t\tconst link = next\n\t\t\t? absent\n\t\t\t: absent === Number.POSITIVE_INFINITY\n\t\t\t\t? 2 * spent + 2\n\t\t\t\t: Math.floor((spent + absent) / 2);\n\t\tconst hash = links.counting.linkHash(links.window, link);\n\t\tconst counted = next\n\t\t\t? await insertLink(links, hash)\n\t\t\t: await tokens.countAttempt(hash, 'secondFactor');\n\t\tif (counted === null) absent = link;\n\t\telse if (counted.spentAt === null) {\n\t\t\treturn { attempts: counted.attempts, link: hash };\n\t\t} else {\n\t\t\tspent = link;\n\t\t\t// Spent by a sign-in that raced this one: look further on.\n\t\t\tif (absent <= spent) absent = Number.POSITIVE_INFINITY;\n\t\t}\n\t}\n\t// A store whose links never end: it cannot be counting what it stores.\n\tthrow links.counting.vanished();\n}\n\n/** One attempt on one link: inserted on the first, and counted. */\nasync function countLink(\n\tlinks: Links,\n\ttokenHash: string,\n): Promise<TokenRecord> {\n\tconst tokens = links.context.store.tokens;\n\tconst counted = await tokens.countAttempt(tokenHash, 'secondFactor');\n\treturn counted ?? insertLink(links, tokenHash);\n}\n\n/** A link stored — idempotent: of two first attempts at once, one inserts — and counted. */\nasync function insertLink(\n\tlinks: Links,\n\ttokenHash: string,\n): Promise<TokenRecord> {\n\tconst tokens = links.context.store.tokens;\n\tawait tokens.insertToken({\n\t\ttokenHash,\n\t\tkind: 'secondFactor',\n\t\tuserId: links.counting.userId,\n\t\taddress: '',\n\t\tcodeHash: null,\n\t\tattempts: 0,\n\t\texpiresAt: new Date(links.expiresAt),\n\t\tspentAt: null,\n\t\tcreatedAt: new Date(links.now),\n\t});\n\tconst inserted = await tokens.countAttempt(tokenHash, 'secondFactor');\n\tif (inserted !== null) return inserted;\n\tthrow links.counting.vanished();\n}\n",
46
- "/**\n * The requests that hand out something to e-mail, counted by the store per\n * window — `janus({ mail: { throttle } })`, five per ten minutes by\n * default. Past the last one, the request answers `MAIL_THROTTLED` with\n * `retryAfter`, and **issues nothing**: no token is minted, so there is\n * nothing to send — and **nothing is spent**: counted before anything is\n * issued, a refused request never reaches the step that spends the earlier\n * tokens, so the last link or code sent still works. Nothing locks past a\n * window. With the default lifetimes, the window (`'10m'`) is no longer than\n * any token's, so the last one sent — issued in the window — outlives the\n * refusal: somebody who asks for an address in a loop mails its owner real\n * links, and the last of them signs in.\n *\n * **Each flow counts on its own**, so a loop on one — a sign-in link asked\n * for again and again — never shuts another, and what one address can be\n * sent is bounded per flow:\n *\n * - **per address**, for the requests anybody can make with an e-mail —\n * `magicLink.request`, `signInCode.request`, `resetPassword.request`.\n * Counted **before anything is looked up**, the address normalised, and\n * whatever the user type: an address nobody holds is counted, and refused\n * past the limit, as a registered one is, so being throttled never tells\n * who has an account;\n * - **per user**, for the requests the application makes for a user it\n * knows — `verifyEmail.send`, `changeEmail.send` (and, for the address it\n * names, per address too), and `stepUp.request` when it e-mails a code.\n * Nobody without the user's session or the application's call can spend\n * that count, so a loop on their address leaves their own requests alone;\n * and whatever addresses one user moves through, they are sent at most as\n * many.\n *\n * Counted in an attempt window (`one-time/window.ts`), in `secondFactor`\n * tokens stored under no user: the `userId` of each is a keyed hash of the\n * flow and the address or the user (`counter-key.ts`). Nothing spends a\n * link, and one that is spent carries its count on: the count never starts\n * again before its window ends.\n *\n * A store that cannot count throws `STORE_FAILED`: never a refusal, and\n * never a request let through uncounted.\n */\n\nimport { MailThrottledError, StoreFailure } from '../errors/janus-error';\nimport { normalizeEmail, type ResolvedType } from './config';\nimport type { Context } from './context';\nimport { counterKey, keyed } from './counter-key';\nimport { countInWindow } from './one-time';\nimport { hashSecret } from './secrets';\n\n/** What the key is derived for. Renamed, every count in progress would start over. */\nconst PURPOSE = 'janus/mail/requests/v1';\n\n/** The flows that hand out something to e-mail, each counted on its own. */\nexport type MailFlow =\n\t| 'magicLink'\n\t| 'signInCode'\n\t| 'resetPassword'\n\t| 'verifyEmail'\n\t| 'stepUp'\n\t| 'changeEmail';\n\n/**\n * Who a request is counted for: the address it names (and, when the request\n * is a user's, the user it is made for, carried by a refusal), or the user.\n */\ntype Counted =\n\t| { readonly address: string; readonly userId?: string }\n\t| { readonly userId: string };\n\n/**\n * Counts one request of `flow` for `email` — before it is looked up — and\n * refuses past the last one, whether anybody holds the address or not.\n * `userId`, for a request made for a user (`changeEmail.send`), is only\n * carried by the refusal; the count stays the address's.\n */\nexport async function countMailByAddress(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tflow: MailFlow,\n\temail: string,\n\twhere: string,\n\tuserId?: string,\n): Promise<void> {\n\tawait countMail(\n\t\tcontext,\n\t\ttype,\n\t\tflow,\n\t\t{\n\t\t\taddress: normalizeEmail(email),\n\t\t\t...(userId === undefined ? {} : { userId }),\n\t\t},\n\t\twhere,\n\t);\n}\n\n/** Counts one request of `flow` for the user `userId`, and refuses past the last one. */\nexport async function countMailByUser(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tflow: MailFlow,\n\tuserId: string,\n\twhere: string,\n): Promise<void> {\n\tawait countMail(context, type, flow, { userId }, where);\n}\n\nasync function countMail(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tflow: MailFlow,\n\tcounted: Counted,\n\twhere: string,\n): Promise<void> {\n\tconst throttle = context.config.mailThrottle;\n\tif (throttle === null) return;\n\tconst key = counterKey(context, PURPOSE);\n\tconst subject =\n\t\t'address' in counted\n\t\t\t? keyed(key, [flow, 'address', counted.address])\n\t\t\t: keyed(key, [flow, 'user', counted.userId]);\n\tconst { attempts, endsAt } = await countInWindow(context, {\n\t\twindowMs: throttle.windowMs,\n\t\tspent: 'carry',\n\t\tuserId: subject,\n\t\tlinkHash: (window, link) =>\n\t\t\thashSecret(keyed(key, [subject, String(window), String(link)])),\n\t\t// A store that lost what it just stored cannot count: an outage.\n\t\tvanished: () =>\n\t\t\tnew StoreFailure(\n\t\t\t\t`${where}: the store dropped the requests it had just counted`,\n\t\t\t\t{ slot: 'tokens', operation: 'countAttempt' },\n\t\t\t),\n\t});\n\tif (attempts <= throttle.attempts) return;\n\n\tconst now = context.clock.now().getTime();\n\tthrow new MailThrottledError(\n\t\t`${where}: too many e-mails asked for this ${'address' in counted ? 'address' : 'user'} — the last one sent still works; use it, or wait for the next window`,\n\t\t{\n\t\t\tuserType: type.name,\n\t\t\t...(counted.userId === undefined ? {} : { userId: counted.userId }),\n\t\t\tretryAfter: Math.max(1, Math.ceil((endsAt - now) / 1000)),\n\t\t},\n\t);\n}\n",
47
- "import { normalizeEmail, type ResolvedType } from '../config';\nimport { emailOf, loginsOf, validateFields } from '../context';\nimport type { JsonObject, UserRecord } from '../port/types';\nimport type { Input } from './flow-types';\n\nconst normalized = (email: string | null) =>\n\temail === null ? null : normalizeEmail(email);\n\n/**\n * Whether the e-mail differs between two sets of fields, compared normalised:\n * `Ada@Example.com` for `ada@example.com` is no change. The one test behind\n * both the new e-mail's verification reset and `user.emailChanged`.\n */\nexport function emailChanged(\n\ttype: ResolvedType,\n\tbefore: JsonObject,\n\tafter: JsonObject,\n): boolean {\n\treturn normalized(emailOf(type, before)) !== normalized(emailOf(type, after));\n}\n\n/**\n * What `update` writes: the patch merged over the stored fields, the whole\n * result validated, and the logins derived again from it.\n */\nexport async function fieldsPatch(\n\ttype: ResolvedType,\n\trecord: UserRecord,\n\tpatch: Input,\n\twhere: string,\n) {\n\tconst fields = await validateFields(\n\t\ttype,\n\t\t{ ...record.fields, ...patch },\n\t\twhere,\n\t);\n\n\treturn {\n\t\tfields,\n\t\tlogins: loginsOf(type, fields, where),\n\t\tschemaVersion: type.schemaVersion,\n\t\t// A new e-mail is an unproven one.\n\t\t...(emailChanged(type, record.fields, fields)\n\t\t\t? { emailVerifiedAt: null }\n\t\t\t: {}),\n\t};\n}\n",
48
- "/**\n * The token a change of e-mail sends and redeems: issued for the NEW\n * address, bound to the address it replaces, and refused when the user's\n * e-mail is no longer that one.\n *\n * `address` holds the new address; `codeHash` holds the former one, keyed by\n * the token's secret (`TokenRecord.codeHash`), so the port needs no field and\n * a dump of the store reveals neither.\n */\n\nimport { TokenError, UserInvalidError } from '../../errors/janus-error';\nimport { normalizeEmail, type ResolvedType } from '../config';\nimport { type Context, emailOf, findRecord, validateFields } from '../context';\nimport { issueOneTime, spendOneTime, unknownOneTime } from '../one-time';\nimport type { TokenRecord, UserRecord } from '../port/types';\nimport { hashSecret, mintSecret } from '../secrets';\nimport type { IssuedToken } from '../types';\n\n/** What binds a token to the address it replaces. */\nexport const formerHash = (secret: string, former: string | null): string =>\n\thashSecret(\n\t\t`janus/changeEmail/former\\0${secret}\\0${normalizeEmail(former ?? '')}`,\n\t);\n\n/**\n * Validates `email` as the user's new address — by the type's own schema, the\n * other fields as they are — and gives it back as the schema left it. An\n * address equal to the current one once normalised is `USER_INVALID`: moving\n * to where the user already is means nothing (`verifyEmail` proves it).\n */\nexport async function newAddressOf(\n\ttype: ResolvedType,\n\tuser: UserRecord,\n\temail: string,\n\twhere: string,\n): Promise<string> {\n\tconst fields = await validateFields(\n\t\ttype,\n\t\t{ ...user.fields, [type.email]: email },\n\t\twhere,\n\t);\n\tconst address = emailOf(type, fields);\n\tif (address === null) {\n\t\tthrow new TypeError(\n\t\t\t`janus: email \"${type.email}\" did not name a string in validated ${type.name} fields — the schema must keep the e-mail field a required string`,\n\t\t);\n\t}\n\tif (\n\t\tnormalizeEmail(address) === normalizeEmail(emailOf(type, user.fields) ?? '')\n\t) {\n\t\tthrow new UserInvalidError(\n\t\t\t`${where}: the new e-mail is the user's current one — a change moves to another address; verifyEmail proves the current one`,\n\t\t\t{\n\t\t\t\tissues: [\n\t\t\t\t\t{ path: [type.email], message: 'is the current e-mail of the user' },\n\t\t\t\t],\n\t\t\t\tuserType: type.name,\n\t\t\t},\n\t\t);\n\t}\n\treturn address;\n}\n\n/**\n * Issues the token for the validated new `address`, bound to the address the\n * user has now, and spends the user's earlier ones.\n */\nexport async function issueChangeEmailToken(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tuser: UserRecord,\n\taddress: string,\n): Promise<IssuedToken> {\n\tconst secret = mintSecret();\n\tconst { expiresAt } = await issueOneTime(context, {\n\t\tkind: 'changeEmail',\n\t\tuserId: user.id,\n\t\taddress,\n\t\tttlMs: context.config.tokenTtlMs.changeEmail,\n\t\tsecret,\n\t\tboundHash: formerHash(secret, emailOf(type, user.fields)),\n\t});\n\t// One live link per user: issued first, spent after, as for a reset, so\n\t// requests that race leave at most one live — never one each.\n\tawait context.store.tokens.spendUserTokens(\n\t\tuser.id,\n\t\t'changeEmail',\n\t\tcontext.clock.now(),\n\t\thashSecret(secret),\n\t);\n\treturn { token: secret, email: address, expiresAt };\n}\n\n/**\n * Refuses a token asked from an address the user has left: the link would\n * move somebody who is no longer where the request came from.\n */\nexport function refuseMoved(\n\ttype: ResolvedType,\n\tuser: UserRecord,\n\ttoken: TokenRecord,\n\tsecret: string,\n\twhere: string,\n): void {\n\tif (token.codeHash !== formerHash(secret, emailOf(type, user.fields))) {\n\t\tthrow new TokenError(\n\t\t\t'TOKEN_STALE',\n\t\t\t`${where}: the token was asked from an e-mail the user no longer has`,\n\t\t\t{ operation: where, userId: user.id, userType: type.name },\n\t\t);\n\t}\n}\n\n/**\n * Spends a change's token and says why it cannot be used, when it cannot. A\n * user gone since, or of another type, is as good as no token; a user who\n * moved since the link was asked is stale.\n */\nexport async function redeemChangeEmailToken(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tsecret: string,\n\twhere: string,\n): Promise<{ token: TokenRecord; user: UserRecord }> {\n\tconst token = await spendOneTime(\n\t\tcontext,\n\t\tsecret,\n\t\t'changeEmail',\n\t\twhere,\n\t\t'token',\n\t);\n\tconst user = await findRecord(context, token.userId, type.name);\n\tif (user === null) throw unknownOneTime(where, 'token');\n\n\trefuseMoved(type, user, token, secret, where);\n\treturn { token, user };\n}\n",
49
- "/**\n * Changing a user's e-mail: send a token to the NEW address, then redeem it\n * to move the user there — verified, since the link reached its inbox.\n */\n\nimport { UserInactiveError } from '../../errors/janus-error';\nimport type { At } from '../at';\nimport type { ResolvedType } from '../config';\nimport {\n\ttype AnyUser,\n\ttype Context,\n\temailOf,\n\tgetRecord,\n\tidOf,\n\ttoUser,\n\twriteUser,\n} from '../context';\nimport { emit } from '../events';\nimport { countMailByAddress, countMailByUser } from '../mail-requests';\nimport type { UserRecord } from '../port/types';\nimport type { ChangeEmailApi } from '../types';\nimport { emailChanged, fieldsPatch } from '../users/fields-patch';\nimport {\n\tissueChangeEmailToken,\n\tnewAddressOf,\n\tredeemChangeEmailToken,\n\trefuseMoved,\n} from './change-email-token';\n\nconst inactive = (type: ResolvedType, user: UserRecord, where: string) =>\n\tnew UserInactiveError(`${where}: the user is inactive`, {\n\t\tuserId: user.id,\n\t\tuserType: type.name,\n\t});\n\n/** `changeEmail` of one user type: `send` to the new address, then `confirm`. */\nexport function changeEmailFlows(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tat: At,\n): ChangeEmailApi<AnyUser>['changeEmail'] {\n\treturn {\n\t\tasync send(user, email) {\n\t\t\tconst where = at('changeEmail.send');\n\t\t\tconst record = await getRecord(context, idOf(user), type.name, where);\n\t\t\tif (!record.active) throw inactive(type, record, where);\n\t\t\t// Validated first — a USER_INVALID spends nothing — then the user is\n\t\t\t// counted, then the address, all before anything is issued. The user\n\t\t\t// first: an account past its own count spends no address's, so one\n\t\t\t// account can exhaust at most one address per window. An address\n\t\t\t// other people exhausted costs the asking user one of their own.\n\t\t\tconst address = await newAddressOf(type, record, email, where);\n\t\t\tawait countMailByUser(context, type, 'changeEmail', record.id, where);\n\t\t\tawait countMailByAddress(\n\t\t\t\tcontext,\n\t\t\t\ttype,\n\t\t\t\t'changeEmail',\n\t\t\t\taddress,\n\t\t\t\twhere,\n\t\t\t\trecord.id,\n\t\t\t);\n\t\t\treturn issueChangeEmailToken(context, type, record, address);\n\t\t},\n\n\t\tasync confirm(secret) {\n\t\t\treturn confirmChange(context, type, secret, at('changeEmail.confirm'));\n\t\t},\n\t};\n}\n\n/** Redeems a change's token: the write, then the events it earned. */\nasync function confirmChange(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tsecret: string,\n\twhere: string,\n): Promise<AnyUser> {\n\tconst { token, user } = await redeemChangeEmailToken(\n\t\tcontext,\n\t\ttype,\n\t\tsecret,\n\t\twhere,\n\t);\n\tif (!user.active) throw inactive(type, user, where);\n\n\t// The record the write replaced, read in its callback, as `update` does.\n\tconst seen: { replaced: UserRecord | null } = { replaced: null };\n\tconst written = await writeUser(\n\t\tcontext,\n\t\tuser.id,\n\t\ttype,\n\t\tundefined,\n\t\twhere,\n\t\tasync (record, now) => {\n\t\t\t// Checked again on the record written, as for verifyEmail.\n\t\t\tif (!record.active) throw inactive(type, record, where);\n\t\t\trefuseMoved(type, record, token, secret, where);\n\t\t\tseen.replaced = record;\n\t\t\tconst patch = await fieldsPatch(\n\t\t\t\ttype,\n\t\t\t\trecord,\n\t\t\t\t{ [type.email]: token.address },\n\t\t\t\twhere,\n\t\t\t);\n\t\t\t// Verified by the link that reached the new address. `send` refuses\n\t\t\t// the current address and an `update` spends the link, so the address\n\t\t\t// always moves here; the test is a guard, not a path.\n\t\t\tconst proved =\n\t\t\t\trecord.emailVerifiedAt === null ||\n\t\t\t\temailChanged(type, record.fields, patch.fields);\n\t\t\treturn proved ? { ...patch, emailVerifiedAt: now } : patch;\n\t\t},\n\t);\n\tconst { replaced } = seen;\n\tconst moved =\n\t\treplaced !== null && emailChanged(type, replaced.fields, written.fields);\n\tif (replaced !== null && moved) {\n\t\tawait emit(context, 'user.emailChanged', written, written.updatedAt, {\n\t\t\tformerEmail: emailOf(type, replaced.fields),\n\t\t});\n\t}\n\tif (moved || replaced?.emailVerifiedAt === null) {\n\t\tawait emit(context, 'user.emailVerified', written, written.updatedAt);\n\t}\n\treturn toUser(written);\n}\n",
50
51
  "import type { Id } from '../ids/id';\nimport type { ResolvedType } from './config';\nimport {\n\ttype AnyUser,\n\ttype Context,\n\tfindRecord,\n\tpasswordMatches,\n} from './context';\nimport { emit } from './events';\nimport { burnOneTime } from './one-time';\nimport type { UserRecord } from './port/types';\nimport type { SignInResult } from './types';\n\n/**\n * What writing a password ends besides. A reset, a change and a set each call\n * it **after** the write, and a failure here throws — it is never ignored:\n *\n * - The user's reset links still unspent. A link answers a request to\n * replace the password; once it is replaced, an older link would replace\n * it again, without knowing the new one.\n * - Every second-factor challenge still open, so a sign-in started with the\n * old password cannot be finished — the other half of\n * {@link heldByPassword}, which reads **after** it issued.\n *\n * Both spends are attempted even when one fails, so a store failing one kind\n * still spends the other; the first failure is then thrown.\n *\n * After the write, not before: a link issued while the password is written\n * is spent too, where one issued between an earlier spend and the write\n * would survive. So an outage here leaves the password written and the\n * older links live, and the caller is told, with `STORE_FAILED`; the next\n * `resetPassword.request` spends them. Sign-in codes and step-ups are left\n * alone: the password proves neither, and a step-up belongs to a session,\n * which a reset revokes.\n */\nexport async function endWhatThePasswordOpened(\n\tcontext: Context,\n\tuserId: Id,\n): Promise<void> {\n\tconst now = context.clock.now();\n\tconst spent = await Promise.allSettled(\n\t\t(['resetPassword', 'secondFactor'] as const).map((kind) =>\n\t\t\tcontext.store.tokens.spendUserTokens(userId, kind, now),\n\t\t),\n\t);\n\tconst failed = spent.find(\n\t\t(result): result is PromiseRejectedResult => result.status === 'rejected',\n\t);\n\tif (failed !== undefined) throw failed.reason;\n}\n\n/**\n * What a change and a set do once the password is written: end what the\n * old one opened, then send `user.passwordChanged` — from a `finally`, so an\n * outage ending them still reports the write, which a retry would not make\n * again. A reset sends `user.passwordReset` instead, from its own flow.\n */\nexport async function passwordChanged(\n\tcontext: Context,\n\twritten: UserRecord,\n): Promise<void> {\n\ttry {\n\t\tawait endWhatThePasswordOpened(context, written.id);\n\t} finally {\n\t\tawait emit(context, 'user.passwordChanged', written, written.updatedAt);\n\t}\n}\n\n/**\n * Whether the password a sign-in verified is still the user's, once the\n * sign-in answered. A password written meanwhile ends the sign-in: its\n * session is revoked, or its challenge spent, and `false` is answered.\n *\n * A password writer writes, then spends the challenges waiting; a sign-in\n * issues, then reads here. Whichever order they interleave in, one of the two\n * sees the other. A hash that changed with the same password — a concurrent\n * sign-in rehashing it — is not a change: the password is compared again.\n */\nexport async function heldByPassword(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tverified: UserRecord,\n\tpassword: string,\n\tresult: SignInResult<AnyUser>,\n\twhere: string,\n): Promise<boolean> {\n\tconst now = await findRecord(context, verified.id, type.name);\n\tconst kept =\n\t\tnow !== null &&\n\t\tnow.password !== null &&\n\t\t(now.password.hash === verified.password?.hash ||\n\t\t\t(await passwordMatches(context, now, password, where)));\n\tif (kept) return true;\n\n\tif (result.status === 'signedIn') {\n\t\tawait context.store.sessions.revokeSession(\n\t\t\tresult.session.id,\n\t\t\tcontext.clock.now(),\n\t\t);\n\t} else {\n\t\tawait burnOneTime(context, result.challenge, 'secondFactor');\n\t}\n\treturn false;\n}\n",
51
52
  "/**\n * A request for an e-mail made in two steps — `prepare` counts it, `send`\n * issues — so the mail throttle answers in the visitor's own request, while\n * the lookup and the writes, whose time depends on whether the address has\n * an account, run off it.\n *\n * `prepare` looks nobody up: it validates, counts the address\n * (`mail-requests.ts`) and refuses past the limit, the same store calls for\n * any address. `send` is what `request` does after the count, **once**: the\n * count `prepare` made pays for one issue, so a second call is a `TypeError`\n * — a bug of the caller's, never a value from a request — and nothing a\n * caller can pass skips the count.\n */\n\n/**\n * `send` for a prepared request: `issue` on the first call, a `TypeError`\n * on every other — marked spent before `issue` starts, so two calls at once\n * cannot both issue, and spent even when `issue` fails: prepare again then,\n * which counts again.\n */\nexport function sendOnce<T>(\n\twhere: string,\n\tissue: () => Promise<T>,\n): () => Promise<T> {\n\tlet sent = false;\n\treturn async () => {\n\t\tif (sent) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`${where}(…).send: already called — a prepared request sends once; call ${where} again for another`,\n\t\t\t);\n\t\t}\n\t\tsent = true;\n\t\treturn issue();\n\t};\n}\n",
52
53
  "/**\n * The token an e-mail flow sends and redeems: issued for the user's current\n * e-mail, and refused on redemption when that e-mail is not the one it was\n * sent to any more.\n */\n\nimport { NotFoundError } from '../../errors/janus-error';\nimport type { ResolvedType } from '../config';\nimport { type Context, emailOf, findRecord } from '../context';\nimport {\n\tissueOneTime,\n\trefuseStale,\n\tspendOneTime,\n\tunknownOneTime,\n} from '../one-time';\nimport type { TokenKind, TokenRecord, UserRecord } from '../port/types';\nimport type { IssuedToken } from '../types';\n\n/**\n * Spends a token and says why it cannot be used, when it cannot. A user\n * gone since, or of another type, is as good as no token; a token sent to\n * an e-mail the user no longer has is stale.\n */\nexport async function redeemEmailToken(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tkind: TokenKind,\n\tsecret: string,\n\twhere: string,\n): Promise<{ token: TokenRecord; user: UserRecord }> {\n\tconst token = await spendOneTime(context, secret, kind, where, 'token');\n\tconst user = await findRecord(context, token.userId, type.name);\n\tif (user === null) throw unknownOneTime(where, 'token');\n\n\trefuseStale(type, user, token, where, 'token');\n\treturn { token, user };\n}\n\n/** Issues a one-time token for the user's current e-mail. */\nexport async function issueEmailToken(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tkind: 'verifyEmail' | 'resetPassword',\n\tuser: UserRecord,\n\twhere: string,\n): Promise<IssuedToken> {\n\tconst email = emailOf(type, user.fields);\n\tif (email === null) {\n\t\tthrow new NotFoundError(`${where}: the user has no e-mail`, {\n\t\t\tuserId: user.id,\n\t\t\tuserType: type.name,\n\t\t\toperation: where,\n\t\t});\n\t}\n\n\tconst { secret, expiresAt } = await issueOneTime(context, {\n\t\tkind,\n\t\tuserId: user.id,\n\t\taddress: email,\n\t\tttlMs: context.config.tokenTtlMs[kind],\n\t});\n\treturn { token: secret, email, expiresAt };\n}\n",
@@ -60,7 +61,7 @@
60
61
  "/**\n * What the two sign-ins by e-mail share — a code typed back\n * (`sign-in-code.ts`) and a link followed (`magic-link.ts`): who may be sent\n * one, keeping only the last one live, and how a redeemed one ends — the\n * e-mail proved, then the same session or second-factor challenge a\n * password opens.\n */\n\nimport { UserInactiveError } from '../errors/janus-error';\nimport type { ResolvedType } from './config';\nimport { type AnyUser, type Context, holderOfEmail } from './context';\nimport { type DeviceHint, reportNewDevice } from './devices';\nimport { proveFirstEmail } from './first-proof';\nimport { refuseStale } from './one-time';\nimport type { TokenKind, TokenRecord, UserRecord } from './port/types';\nimport { hashSecret } from './secrets';\nimport type { SignInResult } from './types';\n\n/** What a sign-in answers once the user proved who they are: `secondFactor.finish`. */\nexport type Finish = (\n\trecord: UserRecord,\n\twhere: string,\n\tdevice: DeviceHint,\n) => Promise<SignInResult<AnyUser>>;\n\n/**\n * The user of this type holding `email`, when they may be sent a sign-in:\n * `null` for nobody, and for an inactive user — the same answer, so the\n * caller cannot tell them apart either.\n */\nexport async function signInHolder(\n\tcontext: Context,\n\ttype: ResolvedType,\n\temail: string,\n): Promise<UserRecord | null> {\n\tconst record = await holderOfEmail(context, type, email);\n\treturn record === null || !record.active ? null : record;\n}\n\n/**\n * Spends every other unspent token of this kind the user holds, sparing the\n * one just issued. Issued first, spent after, so requests that race leave\n * at most one live — maybe none, and the visitor asks again — never one each.\n */\nexport async function keepOnlyLatest(\n\tcontext: Context,\n\tuserId: string,\n\tkind: TokenKind,\n\tsecret: string,\n): Promise<void> {\n\tawait context.store.tokens.spendUserTokens(\n\t\tuserId,\n\t\tkind,\n\t\tcontext.clock.now(),\n\t\thashSecret(secret),\n\t);\n}\n\n/**\n * Ends a sign-in by e-mail whose token is spent: refuses an e-mail changed\n * since it was sent and an inactive user, proves the e-mail — it reached the\n * inbox — and finishes as a password would, reporting a new device.\n *\n * **An e-mail proved for the first time drops the password and the second\n * factor, and revokes every session** before the new one opens\n * (`./first-proof`): whoever signed up with the address without holding its\n * inbox keeps nothing, and the owner is asked for no factor they never set.\n * An e-mail already proved changes nothing. The proof is written under the\n * version read, so an address changed since is not the one proved: a\n * `VERSION_CONFLICT` then, with the token spent.\n */\nexport async function finishEmailSignIn(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tfinish: Finish,\n\tsignIn: {\n\t\treadonly user: UserRecord;\n\t\treadonly token: TokenRecord;\n\t\treadonly where: string;\n\t\treadonly noun: 'token' | 'code';\n\t\treadonly device: DeviceHint;\n\t},\n): Promise<SignInResult<AnyUser>> {\n\tconst { user, token, where, noun, device } = signIn;\n\trefuseStale(type, user, token, where, noun);\n\tif (!user.active) {\n\t\tthrow new UserInactiveError(`${where}: the user is inactive`, {\n\t\t\tuserId: user.id,\n\t\t\tuserType: type.name,\n\t\t});\n\t}\n\n\tconst proved =\n\t\tuser.emailVerifiedAt !== null\n\t\t\t? user\n\t\t\t: await proveFirstEmail(context, type, user, where);\n\tconst result = await finish(proved, where, device);\n\tawait reportNewDevice(context, result);\n\treturn result;\n}\n",
61
62
  "import type { At } from './at';\nimport type { ResolvedType } from './config';\nimport { type AnyUser, type Context, toUser } from './context';\nimport { type DeviceHint, deviceHint } from './devices';\nimport { redeemEmailToken } from './email-flows/email-token';\nimport {\n\ttype Finish,\n\tfinishEmailSignIn,\n\tkeepOnlyLatest,\n\tsignInHolder,\n} from './email-sign-in';\nimport { countMailByAddress } from './mail-requests';\nimport { issueOneTime } from './one-time';\nimport { sendOnce } from './prepared';\nimport type {\n\tIssuedToken,\n\tMagicLinkApi,\n\tPreparedRequest,\n\tSignInResult,\n} from './types';\n\ntype IssuedLink = IssuedToken & { readonly user: AnyUser };\n\n/**\n * Signing in with a link sent to the user's e-mail: no password, and the\n * link proves the address — a sign-in code with nothing to type.\n *\n * The token is 32 random bytes, so there is nothing to guess and no attempt\n * to count: redeeming it is one conditional write, and of two redemptions\n * at once exactly one signs in. **At most one link is live per user**, as\n * for a sign-in code: `request` spends every other once it issued its own.\n * A token of its own kind, `magicLink`, so a sign-in code's challenge — which\n * the visitor holds — is never a link, nor a link a challenge.\n *\n * Whoever opens the link signs in, in the browser that opened it: the\n * application confirms it from a `POST`, never from the `GET` of the link,\n * which a mail scanner follows too.\n *\n * `request` is `prepare`, then `send`: counted, then looked up and issued\n * (`prepared.ts`).\n */\nexport function magicLinkFlows(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tat: At,\n\tfinish: Finish,\n): MagicLinkApi<AnyUser, SignInResult<AnyUser>>['magicLink'] {\n\treturn {\n\t\tasync request(email) {\n\t\t\tconst where = at('magicLink.request');\n\t\t\treturn (await prepareLink(context, type, String(email), where)).send();\n\t\t},\n\n\t\tasync prepare(email) {\n\t\t\tconst where = at('magicLink.prepare');\n\t\t\treturn prepareLink(context, type, String(email), where);\n\t\t},\n\n\t\tasync confirm(token, options) {\n\t\t\tconst where = at('magicLink.confirm');\n\t\t\tconst device = deviceHint(context, options, where);\n\t\t\treturn confirmLink(context, type, finish, String(token), where, device);\n\t\t},\n\t};\n}\n\n/**\n * Counts a link asked for `email` — before it is looked up: past the limit,\n * nobody and somebody are refused alike — and answers the `send` that\n * issues it, once.\n */\nasync function prepareLink(\n\tcontext: Context,\n\ttype: ResolvedType,\n\temail: string,\n\twhere: string,\n): Promise<PreparedRequest<IssuedLink>> {\n\tawait countMailByAddress(context, type, 'magicLink', email, where);\n\treturn Object.freeze({\n\t\tsend: sendOnce(where, () => issueLink(context, type, email)),\n\t});\n}\n\n/** Issues a link's token for the holder of `email`, and spends every other they had. */\nasync function issueLink(\n\tcontext: Context,\n\ttype: ResolvedType,\n\temail: string,\n): Promise<IssuedLink | null> {\n\t// Nobody, and an inactive user, get the same answer: no link.\n\tconst record = await signInHolder(context, type, email);\n\tif (record === null) return null;\n\n\tconst address = String(record.fields[type.email]);\n\tconst { secret, expiresAt } = await issueOneTime(context, {\n\t\tkind: 'magicLink',\n\t\tuserId: record.id,\n\t\taddress,\n\t\tttlMs: context.config.tokenTtlMs.magicLink,\n\t});\n\t// One live link per user: the ones sent before stop working.\n\tawait keepOnlyLatest(context, record.id, 'magicLink', secret);\n\treturn { token: secret, email: address, expiresAt, user: toUser(record) };\n}\n\n/** Spends a link's token, proves the e-mail, and finishes the sign-in. */\nasync function confirmLink(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tfinish: Finish,\n\tsecret: string,\n\twhere: string,\n\tdevice: DeviceHint,\n): Promise<SignInResult<AnyUser>> {\n\t// Spent first, whatever follows: a link is redeemed once, and a refused\n\t// one — stale, inactive, another type's — cannot be tried again.\n\tconst { token, user } = await redeemEmailToken(\n\t\tcontext,\n\t\ttype,\n\t\t'magicLink',\n\t\tsecret,\n\t\twhere,\n\t);\n\n\treturn finishEmailSignIn(context, type, finish, {\n\t\tuser,\n\t\ttoken,\n\t\twhere,\n\t\tnoun: 'token',\n\t\tdevice,\n\t});\n}\n",
62
63
  "/**\n * Signing in a user the application proved by its own means — an\n * invitation token it issued, a channel of its own: no credential checked\n * here, so nothing to count, nothing to send and nothing to spend.\n */\n\nimport { UserInactiveError } from '../errors/janus-error';\nimport type { At } from './at';\nimport type { ResolvedType } from './config';\nimport { type AnyUser, type Context, getRecord, refId } from './context';\nimport { deviceHint, reportNewDevice } from './devices';\nimport type { Finish } from './email-sign-in';\nimport type { ProvenSignInApi, SignInResult } from './types';\n\n/**\n * `signInProven` for one user type: the user read by id — `NOT_FOUND` for\n * nobody, as `get` — refused when inactive, then finished as every sign-in\n * is, by `secondFactor.finish`: a session, or a challenge for an active\n * factor.\n *\n * No throttle is counted and no count restarted, no token issued or spent,\n * no e-mail proved: the proof is the application's, and links and codes\n * already sent keep working.\n */\nexport function provenSignInFlows(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tat: At,\n\tfinish: Finish,\n): ProvenSignInApi<AnyUser, SignInResult<AnyUser>> {\n\treturn {\n\t\tasync signInProven(user, options) {\n\t\t\tconst where = at('signInProven');\n\t\t\tconst device = deviceHint(context, options, where);\n\t\t\tconst record = await getRecord(context, refId(user), type.name, where);\n\t\t\tif (!record.active) {\n\t\t\t\tthrow new UserInactiveError(`${where}: the user is inactive`, {\n\t\t\t\t\tuserId: record.id,\n\t\t\t\t\tuserType: type.name,\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst result = await finish(record, where, device);\n\t\t\tawait reportNewDevice(context, result);\n\t\t\treturn result;\n\t\t},\n\t};\n}\n",
63
- "/**\n * The passwords tried at one login, counted by the store per window —\n * `janus({ signIn: { throttle } })`, ten per fifteen minutes by default.\n * Past the last one, `signIn` answers `CREDENTIALS_INVALID` with\n * `retryAfter`, the right password included, until the window ends. **Nothing\n * locks** past a window — but somebody who keeps trying a login keeps its\n * password sign-in shut, window after window: a per-client limit is the\n * application's, and a sign-in code still opens the account.\n *\n * Counted per login, **known or not**: an unknown login is counted as a\n * registered one is, so the throttle does not tell them apart. Counted\n * before anything is looked up or compared, so of twenty guesses at once,\n * exactly as many as the limit are compared.\n *\n * Counted in an attempt window (`one-time/window.ts`), in `secondFactor`\n * tokens stored under no user: the `userId` of each is a keyed hash of the\n * login, never the login (`counter-key.ts`). A sign-in that opens a session\n * spends the link it counts on, and the login's count **restarts** from\n * zero.\n *\n * A store that cannot count throws `STORE_FAILED`: never a refusal, and\n * never a sign-in let through uncounted.\n */\n\nimport { CredentialError, StoreFailure } from '../errors/janus-error';\nimport type { ResolvedType } from './config';\nimport type { Context } from './context';\nimport { counterKey, keyed } from './counter-key';\nimport { type CountedAttempt, countInWindow } from './one-time';\nimport type { UserRecord } from './port/types';\nimport { hashSecret } from './secrets';\n\n/** What the key is derived for. Renamed, every count in progress would start over. */\nconst PURPOSE = 'janus/sign-in/attempts/v1';\n\n/** One attempt counted at `login`, already normalised, or `null` with the throttle off. */\nasync function countLogin(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tlogin: string,\n\twhere: string,\n): Promise<CountedAttempt | null> {\n\tconst throttle = context.config.signInThrottle;\n\tif (throttle === null) return null;\n\tconst key = counterKey(context, PURPOSE);\n\tconst loginKey = keyed(key, [type.name, login]);\n\treturn countInWindow(context, {\n\t\twindowMs: throttle.windowMs,\n\t\tspent: 'restart',\n\t\tuserId: loginKey,\n\t\tlinkHash: (window, link) =>\n\t\t\thashSecret(keyed(key, [loginKey, String(window), String(link)])),\n\t\t// A store that lost what it just stored cannot count: an outage.\n\t\tvanished: () =>\n\t\t\tnew StoreFailure(\n\t\t\t\t`${where}: the store dropped the attempts it had just stored`,\n\t\t\t\t{ slot: 'tokens', operation: 'countAttempt' },\n\t\t\t),\n\t});\n}\n\n/**\n * Counts one password tried at `login` — already normalised — before it is\n * looked up, and refuses past the last one: the right password included.\n */\nexport async function countSignInAttempt(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tlogin: string,\n\twhere: string,\n): Promise<void> {\n\tconst counted = await countLogin(context, type, login, where);\n\tconst limit = context.config.signInThrottle?.attempts;\n\tif (counted === null || limit === undefined || counted.attempts <= limit) {\n\t\treturn;\n\t}\n\tconst now = context.clock.now().getTime();\n\tthrow new CredentialError(\n\t\t'CREDENTIALS_INVALID',\n\t\t`${where}: too many passwords tried at this login — wait for the next window`,\n\t\t{\n\t\t\treason: 'throttled',\n\t\t\tuserType: type.name,\n\t\t\tretryAfter: Math.max(1, Math.ceil((counted.endsAt - now) / 1000)),\n\t\t},\n\t);\n}\n\n/**\n * Starts the user's count again, once a sign-in opens a session: after the\n * password alone, or after the second factor's code — never after the\n * password of a user whose second factor is still to come, so knowing the\n * password buys no more challenges. It counts one attempt on the current\n * link, and spends it: the next one counts from zero.\n */\nexport async function restartSignInCount(\n\tcontext: Context,\n\ttype: ResolvedType,\n\trecord: UserRecord,\n\twhere: string,\n): Promise<void> {\n\tconst rule = type.password;\n\tconst login = rule === null ? undefined : record.fields[rule.login];\n\tif (rule === null || typeof login !== 'string') return;\n\tconst counted = await countLogin(context, type, rule.normalize(login), where);\n\tif (counted?.link == null) return;\n\tawait context.store.tokens.consumeToken(\n\t\tcounted.link,\n\t\t'secondFactor',\n\t\tcontext.clock.now(),\n\t);\n}\n",
64
+ "/**\n * The passwords tried at one login, counted by the store per window —\n * `janus({ signIn: { throttle } })`, ten per fifteen minutes by default.\n * Past the last one, `signIn` answers `CREDENTIALS_INVALID` with\n * `retryAfter`, the right password included, until the window ends. **Nothing\n * locks** past a window — but somebody who keeps trying a login keeps its\n * password sign-in shut, window after window: a per-client limit is the\n * application's, and a sign-in code still opens the account.\n *\n * `changePassword` counts in the same budget: each call is one more\n * password tried at the user's login, counted before `current` is compared\n * (a user with no password too) and refused past the limit alike, and a\n * change that is written restarts the count. Wrong guesses of both add up.\n *\n * Counted per login, **known or not**: an unknown login is counted as a\n * registered one is, so the throttle does not tell them apart. Counted\n * before anything is looked up or compared, so of twenty guesses at once,\n * exactly as many as the limit are compared.\n *\n * Counted in an attempt window (`one-time/window.ts`), in `secondFactor`\n * tokens stored under no user: the `userId` of each is a keyed hash of the\n * login, never the login (`counter-key.ts`). A sign-in that opens a session\n * spends the link it counts on, and the login's count **restarts** from\n * zero.\n *\n * A store that cannot count throws `STORE_FAILED`: never a refusal, and\n * never a sign-in let through uncounted.\n */\n\nimport { CredentialError, StoreFailure } from '../errors/janus-error';\nimport type { ResolvedType } from './config';\nimport type { Context } from './context';\nimport { counterKey, keyed } from './counter-key';\nimport { type CountedAttempt, countInWindow } from './one-time';\nimport type { UserRecord } from './port/types';\nimport { hashSecret } from './secrets';\n\n/** What the key is derived for. Renamed, every count in progress would start over. */\nconst PURPOSE = 'janus/sign-in/attempts/v1';\n\n/** One attempt counted at `login`, already normalised, or `null` with the throttle off. */\nasync function countLogin(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tlogin: string,\n\twhere: string,\n): Promise<CountedAttempt | null> {\n\tconst throttle = context.config.signInThrottle;\n\tif (throttle === null) return null;\n\tconst key = counterKey(context, PURPOSE);\n\tconst loginKey = keyed(key, [type.name, login]);\n\treturn countInWindow(context, {\n\t\twindowMs: throttle.windowMs,\n\t\tspent: 'restart',\n\t\tuserId: loginKey,\n\t\tlinkHash: (window, link) =>\n\t\t\thashSecret(keyed(key, [loginKey, String(window), String(link)])),\n\t\t// A store that lost what it just stored cannot count: an outage.\n\t\tvanished: () =>\n\t\t\tnew StoreFailure(\n\t\t\t\t`${where}: the store dropped the attempts it had just stored`,\n\t\t\t\t{ slot: 'tokens', operation: 'countAttempt' },\n\t\t\t),\n\t});\n}\n\n/**\n * Counts one password tried at `login` — already normalised — before it is\n * looked up, and refuses past the last one: the right password included.\n */\nexport async function countSignInAttempt(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tlogin: string,\n\twhere: string,\n): Promise<void> {\n\tconst counted = await countLogin(context, type, login, where);\n\tconst limit = context.config.signInThrottle?.attempts;\n\tif (counted === null || limit === undefined || counted.attempts <= limit) {\n\t\treturn;\n\t}\n\tconst now = context.clock.now().getTime();\n\tthrow new CredentialError(\n\t\t'CREDENTIALS_INVALID',\n\t\t`${where}: too many passwords tried at this login — wait for the next window`,\n\t\t{\n\t\t\treason: 'throttled',\n\t\t\tuserType: type.name,\n\t\t\tretryAfter: Math.max(1, Math.ceil((counted.endsAt - now) / 1000)),\n\t\t},\n\t);\n}\n\n/**\n * Starts the user's count again, once a sign-in opens a session: after the\n * password alone, or after the second factor's code — never after the\n * password of a user whose second factor is still to come, so knowing the\n * password buys no more challenges. It counts one attempt on the current\n * link, and spends it: the next one counts from zero.\n */\nexport async function restartSignInCount(\n\tcontext: Context,\n\ttype: ResolvedType,\n\trecord: UserRecord,\n\twhere: string,\n): Promise<void> {\n\tconst rule = type.password;\n\tconst login = rule === null ? undefined : record.fields[rule.login];\n\tif (rule === null || typeof login !== 'string') return;\n\tconst counted = await countLogin(context, type, rule.normalize(login), where);\n\tif (counted?.link == null) return;\n\tawait context.store.tokens.consumeToken(\n\t\tcounted.link,\n\t\t'secondFactor',\n\t\tcontext.clock.now(),\n\t);\n}\n",
64
65
  "import { SecondFactorError, UserInactiveError } from '../../errors/janus-error';\nimport type { ResolvedType } from '../config';\nimport { type Context, findRecord } from '../context';\nimport {\n\tburnOneTime,\n\tcodeInvalid,\n\tcountCodeAttempt,\n\tspendOneTime,\n\tunknownChallenge,\n} from '../one-time';\nimport type { SecondFactorRecord, UserRecord } from '../port/types';\nimport { isActive, requireSettings, type Settings } from './factor';\n\n/**\n * What redeeming `signIn`'s challenge takes before any code is compared —\n * with an app's code (`confirm`) or a recovery code (`recover`): the attempt\n * counted, then the user read, and refused when gone, inactive or without an\n * active factor any more.\n */\n\n/** A challenge counted, and the user it waits for, whose factor is active. */\nexport interface OpenedChallenge {\n\treadonly configured: Settings;\n\treadonly secret: string;\n\treadonly attemptsLeft: number;\n\treadonly record: UserRecord & {\n\t\treadonly secondFactor: SecondFactorRecord & { readonly confirmedAt: Date };\n\t};\n}\n\n/** Spends a second-factor challenge, refusing it when this call did not. */\nexport const spendChallenge = (\n\tcontext: Context,\n\tchallenge: string,\n\twhere: string,\n) => spendOneTime(context, challenge, 'secondFactor', where, 'challenge');\n\n/**\n * Counts one attempt at the challenge, then reads its user: refused for a\n * user gone, of another type, inactive, or whose factor was disabled since.\n */\nexport async function openChallenge(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tchallenge: string,\n\twhere: string,\n): Promise<OpenedChallenge> {\n\tconst configured = requireSettings(\n\t\tcontext,\n\t\twhere,\n\t\t'a second factor is being confirmed',\n\t);\n\tconst secret = String(challenge);\n\n\tconst { token, attemptsLeft } = await countCodeAttempt(\n\t\tcontext,\n\t\tsecret,\n\t\t'secondFactor',\n\t\twhere,\n\t\ttype.name,\n\t);\n\n\t// A user gone since, or of another type, is as good as no challenge.\n\tconst record = await findRecord(context, token.userId, type.name);\n\tif (record === null) {\n\t\tthrow await unknownChallenge(context, token, secret, where);\n\t}\n\tif (!record.active) {\n\t\tawait spendChallenge(context, secret, where);\n\t\tthrow new UserInactiveError(`${where}: the user is inactive`, {\n\t\t\tuserId: record.id,\n\t\t\tuserType: type.name,\n\t\t});\n\t}\n\tconst factor = record.secondFactor;\n\tif (!isActive(factor)) {\n\t\tawait spendChallenge(context, secret, where);\n\t\tthrow new SecondFactorError(\n\t\t\t'SECOND_FACTOR_NOT_ENROLLED',\n\t\t\t`${where}: the user no longer has a second factor — sign in again`,\n\t\t\t{ operation: where, userId: record.id, userType: type.name },\n\t\t);\n\t}\n\treturn {\n\t\tconfigured,\n\t\tsecret,\n\t\tattemptsLeft,\n\t\trecord: { ...record, secondFactor: factor },\n\t};\n}\n\n/** A code that does not match: on the last attempt, the challenge is spent. */\nexport async function refuseCode(\n\tcontext: Context,\n\ttype: ResolvedType,\n\topened: OpenedChallenge,\n\twhere: string,\n): Promise<never> {\n\tif (opened.attemptsLeft === 0) {\n\t\tawait burnOneTime(context, opened.secret, 'secondFactor');\n\t}\n\tthrow codeInvalid(where, opened.record.id, type.name, opened.attemptsLeft);\n}\n",
65
66
  "import type { At } from '../at';\nimport type { ResolvedType } from '../config';\nimport type { AnyUser, Context } from '../context';\nimport { deviceHint, reportNewDevice } from '../devices';\nimport { issueOneTime } from '../one-time';\nimport type { UserRecord } from '../port/types';\nimport { openSession } from '../sessions';\nimport { restartSignInCount } from '../sign-in-attempts';\nimport type { SecondFactorRequired, SignedIn, SignInOptions } from '../types';\nimport { acceptCode, requireSettings } from './factor';\nimport { openChallenge, refuseCode, spendChallenge } from './redeem';\n\n/**\n * The challenge `signIn` answers instead of a session, and the code that\n * redeems it. **Only the challenge's hash is stored**, like a session\n * token's.\n */\nexport function challengeFlows(context: Context, type: ResolvedType, at: At) {\n\treturn {\n\t\tasync issue(\n\t\t\trecord: UserRecord,\n\t\t\twhere: string,\n\t\t): Promise<SecondFactorRequired> {\n\t\t\tconst configured = requireSettings(\n\t\t\t\tcontext,\n\t\t\t\twhere,\n\t\t\t\t\"the user's second factor is active\",\n\t\t\t);\n\t\t\tconst { secret, expiresAt } = await issueOneTime(context, {\n\t\t\t\tkind: 'secondFactor',\n\t\t\t\tuserId: record.id,\n\t\t\t\t// Nothing is sent for a challenge: there is no address.\n\t\t\t\taddress: '',\n\t\t\t\tttlMs: configured.challengeTtlMs,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tstatus: 'secondFactor',\n\t\t\t\tchallenge: secret,\n\t\t\t\texpiresAt,\n\t\t\t\tuserId: record.id,\n\t\t\t};\n\t\t},\n\n\t\tasync confirm(\n\t\t\tchallenge: string,\n\t\t\tcode: string,\n\t\t\toptions?: SignInOptions,\n\t\t): Promise<SignedIn<AnyUser>> {\n\t\t\treturn confirmChallenge(context, type, challenge, code, at, options);\n\t\t},\n\t};\n}\n\n/**\n * Redeems a challenge with its code: counted first, then refused for a user\n * gone, inactive or without a factor any more, then compared — and the factor\n * written under the version read before the session opens.\n */\nasync function confirmChallenge(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tchallenge: string,\n\tcode: string,\n\tat: At,\n\toptions: SignInOptions | undefined,\n): Promise<SignedIn<AnyUser>> {\n\tconst where = at('secondFactor.confirm');\n\tconst device = deviceHint(context, options, where);\n\tconst opened = await openChallenge(context, type, challenge, where);\n\tconst { record } = opened;\n\n\tconst now = context.clock.now();\n\tconst accepted = acceptCode(\n\t\topened.configured,\n\t\trecord,\n\t\trecord.secondFactor,\n\t\tString(code),\n\t\tnow,\n\t\twhere,\n\t);\n\tif (accepted === null) return refuseCode(context, type, opened, where);\n\n\t// Read, decided, then written under the version read: of two codes\n\t// accepted at once, the second write is VERSION_CONFLICT.\n\tconst written = await context.store.users.updateUser(\n\t\trecord.id,\n\t\t{ secondFactor: accepted, updatedAt: now },\n\t\trecord.version,\n\t);\n\tawait spendChallenge(context, opened.secret, where);\n\t// The sign-in is complete: the password's count starts again.\n\tawait restartSignInCount(context, type, written, where);\n\tconst signedIn = await openSession(context, type, written, device);\n\tawait reportNewDevice(context, signedIn);\n\treturn signedIn;\n}\n",
66
67
  "import type { ResolvedType } from '../config';\nimport { type Context, getRecord, idOf } from '../context';\nimport type { UserRef } from '../types';\nimport { isActive } from './factor';\n\n/**\n * How many recovery codes the user still holds, read from their record: the\n * count `secondFactor.recover` answers, for whoever did not see that answer —\n * a `user.recoveryCodeUsed` listener, a security settings page.\n *\n * `null` when the user has no active factor: none, or one still waiting for\n * its first code, holds no codes to count. An unknown id, or a user of\n * another type, is `NOT_FOUND`; a store that fails throws. Writes nothing.\n */\nexport async function recoveryCodesLeftOf(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tuser: UserRef,\n\twhere: string,\n): Promise<number | null> {\n\tconst record = await getRecord(context, idOf(user), type.name, where);\n\tconst factor = record.secondFactor;\n\treturn isActive(factor) ? factor.recoveryCodes.length : null;\n}\n",
@@ -83,7 +84,7 @@
83
84
  "import { isStorable } from '../../stores/storable';\nimport type { ResolvedType } from '../config';\nimport type { Context } from '../context';\nimport type { UserRecord } from '../port/types';\n\n/**\n * The user holding this normalised login, or `null`. A login no store can\n * keep is nobody's: answered as an absence, without asking a store that\n * would fail on it.\n */\nexport const byLogin = async (\n\tcontext: Context,\n\ttype: ResolvedType,\n\tlogin: string,\n): Promise<UserRecord | null> =>\n\tisStorable(login)\n\t\t? context.store.users.findUserByLogin(type.name, login)\n\t\t: null;\n",
84
85
  "import { mintId } from '../../ids/id';\nimport type { ResolvedType } from '../config';\nimport {\n\ttype Context,\n\tcheckPassword,\n\tloginsOf,\n\trequireHasher,\n\tvalidateFields,\n} from '../context';\nimport { emit } from '../events';\nimport type { JsonObject, UserRecord } from '../port/types';\nimport type { Input } from './flow-types';\n\n/**\n * Validates, hashes, writes once. What `create`, `signUp` and `findOrCreate`\n * share. `accept` sees the validated fields and may throw to refuse before\n * anything is written; it is `findOrCreate`'s check that the input names the\n * key it was asked for.\n */\nexport async function insert(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tinput: Input,\n\twhere: string,\n\taccept?: (fields: JsonObject) => void,\n): Promise<UserRecord> {\n\tconst { store, clock } = context;\n\tconst { password, active, ...rest } = input ?? {};\n\tconst now = clock.now();\n\tconst fields = await validateFields(type, rest, where);\n\taccept?.(fields);\n\n\tlet hash: UserRecord['password'] = null;\n\tif (password !== undefined) {\n\t\tcheckPassword(type, password as string, where);\n\t\thash = {\n\t\t\thash: await requireHasher(context, where).hash(password as string),\n\t\t\tupdatedAt: now,\n\t\t};\n\t}\n\n\tconst inserted = await store.users.insertUser({\n\t\tid: mintId(now.getTime()),\n\t\ttype: type.name,\n\t\tschemaVersion: type.schemaVersion,\n\t\tactive: active === undefined ? true : active === true,\n\t\tfields,\n\t\tlogins: loginsOf(type, fields, where),\n\t\tpassword: hash,\n\t\tsecondFactor: null,\n\t\temailVerifiedAt: null,\n\t\tversion: 0,\n\t\tcreatedAt: now,\n\t\tupdatedAt: now,\n\t});\n\t// Once the user exists: an outage opening signUp's session later still\n\t// leaves a user created, and reported.\n\tawait emit(context, 'user.created', inserted, inserted.createdAt);\n\treturn inserted;\n}\n",
85
86
  "import { StoreConflict, UserInvalidError } from '../../errors/janus-error';\nimport type { At } from '../at';\nimport { normalizeEmail, type ResolvedType } from '../config';\nimport { type AnyUser, type Context, holderOfEmail, toUser } from '../context';\nimport { unlessLoginTaken } from '../outage';\nimport type { JsonObject, UserRecord } from '../port/types';\nimport type { FindOrCreateApi } from '../types';\nimport { byLogin } from './by-login';\nimport type { Input } from './flow-types';\nimport { insert } from './insert';\n\n/** The user holding the key as the type's own lookup reads it, or `null`. */\nasync function holder(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tkey: string,\n): Promise<UserRecord | null> {\n\tif (type.password !== null) {\n\t\treturn byLogin(context, type, type.password.normalize(key));\n\t}\n\treturn key.trim() === '' ? null : holderOfEmail(context, type, key);\n}\n\n/** The refusal, before any write, of an input that names another key. */\nfunction refusal(type: ResolvedType, where: string, field: string) {\n\treturn new UserInvalidError(\n\t\t`${where}: the fields do not match the ${type.name} schema (1 issue, at ${field})`,\n\t\t{\n\t\t\tissues: [\n\t\t\t\t{ path: [field], message: 'is not the key findOrCreate was given' },\n\t\t\t],\n\t\t\tuserType: type.name,\n\t\t},\n\t);\n}\n\n/** Throws unless the validated fields name `key`, normalised as the lookup does. */\nfunction mustNameKey(\n\ttype: ResolvedType,\n\tkey: string,\n\twhere: string,\n): (fields: JsonObject) => void {\n\treturn (fields) => {\n\t\tconst field = type.password === null ? type.email : type.password.login;\n\t\tconst value = fields[field];\n\t\tconst named =\n\t\t\ttypeof value !== 'string'\n\t\t\t\t? null\n\t\t\t\t: type.password === null\n\t\t\t\t\t? normalizeEmail(value)\n\t\t\t\t\t: type.password.normalize(value);\n\t\tconst wanted =\n\t\t\ttype.password === null\n\t\t\t\t? normalizeEmail(key)\n\t\t\t\t: type.password.normalize(key);\n\t\tif (named === null || named !== wanted) {\n\t\t\tthrow refusal(type, where, field);\n\t\t}\n\t};\n}\n\n/**\n * `findOrCreate` for one user type: the lookup by login (e-mail on a type\n * with no password), and when nobody holds the key, `input()` and the\n * creation `create` does — once more the lookup if the write lost a race.\n */\nexport function findOrCreateFlows(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tat: At,\n): FindOrCreateApi<AnyUser, Input> {\n\treturn {\n\t\tasync findOrCreate(key, input) {\n\t\t\tconst where = at('findOrCreate');\n\t\t\tif (typeof key !== 'string') {\n\t\t\t\tthrow new UserInvalidError(`${where}: the key must be a string`, {\n\t\t\t\t\tissues: [{ path: [], message: 'is not a string' }],\n\t\t\t\t\tuserType: type.name,\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst found = await holder(context, type, key);\n\t\t\tif (found !== null) return { user: toUser(found), created: false };\n\n\t\t\tconst record = await input();\n\t\t\tconst written = await unlessLoginTaken(\n\t\t\t\tinsert(context, type, record, where, mustNameKey(type, key, where)),\n\t\t\t);\n\t\t\tif (!(written instanceof StoreConflict)) {\n\t\t\t\treturn { user: toUser(written), created: true };\n\t\t\t}\n\t\t\t// Lost a race, or another of the new user's logins is taken: read the key again.\n\t\t\tconst winner = await holder(context, type, key);\n\t\t\tif (winner === null) throw written;\n\t\t\treturn { user: toUser(winner), created: false };\n\t\t},\n\t};\n}\n",
86
- "import { CredentialError } from '../../errors/janus-error';\nimport type { ResolvedType } from '../config';\nimport {\n\ttype Context,\n\tcheckPassword,\n\tpasswordMatches,\n\tpasswordRule,\n\trequireHasher,\n\twriteUser,\n} from '../context';\nimport { passwordChanged } from '../password-written';\nimport type { UserRecord } from '../port/types';\nimport type { UserRef, WriteOptions } from '../types';\n\n/**\n * Replaces the password after checking the current one, in the write that\n * replaces it — so the check is made on the very record the write replaces.\n */\nexport async function changePassword(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tuser: UserRef,\n\tchange: { readonly current: string; readonly next: string },\n\toptions: WriteOptions | undefined,\n\twhere: string,\n): Promise<UserRecord> {\n\tpasswordRule(type, where);\n\tcheckPassword(type, change?.next, where);\n\tconst hasher = requireHasher(context, where);\n\n\tconst written = await writeUser(\n\t\tcontext,\n\t\tuser,\n\t\ttype,\n\t\toptions,\n\t\twhere,\n\t\tasync (record, now) => {\n\t\t\tif (\n\t\t\t\trecord.password === null ||\n\t\t\t\t!(await passwordMatches(context, record, change.current, where))\n\t\t\t) {\n\t\t\t\tthrow new CredentialError(\n\t\t\t\t\t'CREDENTIALS_INVALID',\n\t\t\t\t\t`${where}: the current password does not match`,\n\t\t\t\t\t{\n\t\t\t\t\t\treason: record.password === null ? 'noPassword' : 'wrongPassword',\n\t\t\t\t\t\tuserId: record.id,\n\t\t\t\t\t\tuserType: type.name,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tpassword: {\n\t\t\t\t\thash: await hasher.hash(change.next),\n\t\t\t\t\tupdatedAt: now,\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t);\n\tawait passwordChanged(context, written);\n\treturn written;\n}\n",
87
+ "import { CredentialError } from '../../errors/janus-error';\nimport type { ResolvedType } from '../config';\nimport {\n\ttype Context,\n\tcheckPassword,\n\tpasswordMatches,\n\tpasswordRule,\n\trequireHasher,\n\twriteUser,\n} from '../context';\nimport { passwordChanged } from '../password-written';\nimport type { UserRecord } from '../port/types';\nimport { countSignInAttempt, restartSignInCount } from '../sign-in-attempts';\nimport type { UserRef, WriteOptions } from '../types';\n\n/**\n * Replaces the password after checking the current one, in the write that\n * replaces it — so the check is made on the very record the write replaces.\n *\n * Each call counts one attempt in the sign-in throttle of the user's login,\n * the one `signIn` counts in, so a caller holding a session cannot try\n * current passwords without limit, and the wrong guesses of both add up. The\n * attempt is counted on the record the write reads, before the password is\n * compared (a user with no password included, so the answer does not tell\n * the two apart); past the limit the call is refused with `retryAfter`, the\n * right password included, and nothing is compared or written. The write\n * runs its callback once, so a call counts exactly once. A user with no login\n * string, or the throttle off, counts nothing. A change that is written\n * restarts the count, as a sign-in that opens a session does — after\n * {@link passwordChanged}, so an outage restarting it cannot skip what the\n * old password opened.\n */\nexport async function changePassword(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tuser: UserRef,\n\tchange: { readonly current: string; readonly next: string },\n\toptions: WriteOptions | undefined,\n\twhere: string,\n): Promise<UserRecord> {\n\tconst rule = passwordRule(type, where);\n\tcheckPassword(type, change?.next, where);\n\tconst hasher = requireHasher(context, where);\n\n\tconst written = await writeUser(\n\t\tcontext,\n\t\tuser,\n\t\ttype,\n\t\toptions,\n\t\twhere,\n\t\tasync (record, now) => {\n\t\t\tconst login =\n\t\t\t\trule.login in record.fields ? record.fields[rule.login] : undefined;\n\t\t\tif (typeof login === 'string') {\n\t\t\t\tawait countSignInAttempt(context, type, rule.normalize(login), where);\n\t\t\t}\n\t\t\tif (\n\t\t\t\trecord.password === null ||\n\t\t\t\t!(await passwordMatches(context, record, change.current, where))\n\t\t\t) {\n\t\t\t\tthrow new CredentialError(\n\t\t\t\t\t'CREDENTIALS_INVALID',\n\t\t\t\t\t`${where}: the current password does not match`,\n\t\t\t\t\t{\n\t\t\t\t\t\treason: record.password === null ? 'noPassword' : 'wrongPassword',\n\t\t\t\t\t\tuserId: record.id,\n\t\t\t\t\t\tuserType: type.name,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tpassword: {\n\t\t\t\t\thash: await hasher.hash(change.next),\n\t\t\t\t\tupdatedAt: now,\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t);\n\tawait passwordChanged(context, written);\n\tawait restartSignInCount(context, type, written, where);\n\treturn written;\n}\n",
87
88
  "import {\n\tCredentialError,\n\ttype CredentialRefusal,\n\tUserInactiveError,\n} from '../../errors/janus-error';\nimport type { ResolvedType } from '../config';\nimport {\n\ttype AnyUser,\n\ttype Context,\n\tpasswordMatches,\n\tpasswordRule,\n\trehashed,\n\trequireHasher,\n} from '../context';\nimport { type DeviceHint, reportNewDevice } from '../devices';\nimport { heldByPassword } from '../password-written';\nimport { isActive } from '../second-factor/factor';\nimport { countSignInAttempt, restartSignInCount } from '../sign-in-attempts';\nimport type { SignInResult } from '../types';\nimport { byLogin } from './by-login';\nimport type { Finish, Input } from './flow-types';\n\n/**\n * Checks the password and answers what `finish` answers for the user. One\n * refusal for an unknown login, no password, a wrong one and a login past\n * its attempts; `USER_INACTIVE` only once the password matched.\n */\nexport async function signIn(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tfinish: Finish,\n\tinput: Input,\n\tcall: { readonly where: string; readonly device: DeviceHint },\n): Promise<SignInResult<AnyUser>> {\n\tconst { where, device } = call;\n\tconst rule = passwordRule(type, where);\n\tconst hasher = requireHasher(context, where);\n\tconst login = input?.[rule.login];\n\tconst password = input?.['password'];\n\n\tconst normalized = typeof login === 'string' ? rule.normalize(login) : null;\n\t// Counted before the login is looked up, so the count says nothing of\n\t// whether it is registered.\n\tif (normalized !== null) {\n\t\tawait countSignInAttempt(context, type, normalized, where);\n\t}\n\tconst record =\n\t\tnormalized === null ? null : await byLogin(context, type, normalized);\n\tconst refuse = (reason: CredentialRefusal) =>\n\t\tnew CredentialError(\n\t\t\t'CREDENTIALS_INVALID',\n\t\t\t`${where}: the login and the password do not match`,\n\t\t\t{ reason, userType: type.name },\n\t\t);\n\n\tif (record === null || record.password === null) {\n\t\t// Compared all the same, so the response time does not say which\n\t\t// logins are registered. The store's own latency stays observable;\n\t\t// that limit is documented, not denied.\n\t\tawait hasher.verify(String(password), await context.dummyHash());\n\t\tthrow refuse(record === null ? 'unknownLogin' : 'noPassword');\n\t}\n\n\tif (!(await passwordMatches(context, record, String(password), where))) {\n\t\tthrow refuse('wrongPassword');\n\t}\n\t// Checked after the password, so an inactive account is only told to\n\t// somebody who knows its password.\n\tif (!record.active) {\n\t\tthrow new UserInactiveError(`${where}: the user is inactive`, {\n\t\t\tuserId: record.id,\n\t\t\tuserType: type.name,\n\t\t});\n\t}\n\n\t// A session opens: the login's count starts again. With a second factor\n\t// to come, only its code starts it — the password alone buys no more\n\t// challenges.\n\tif (!isActive(record.secondFactor)) {\n\t\tawait restartSignInCount(context, type, record, where);\n\t}\n\tconst verified = await rehashed(context, record, String(password));\n\tconst result = await finish(verified, where, device);\n\t// A password written while this sign-in ran ends it: the password\n\t// verified above is no longer the user's.\n\tif (\n\t\t!(await heldByPassword(\n\t\t\tcontext,\n\t\t\ttype,\n\t\t\tverified,\n\t\t\tString(password),\n\t\t\tresult,\n\t\t\twhere,\n\t\t))\n\t) {\n\t\tthrow refuse('wrongPassword');\n\t}\n\t// Complete only now: a sign-in refused above reports no new device.\n\tawait reportNewDevice(context, result);\n\treturn result;\n}\n",
88
89
  "import type { At } from '../at';\nimport type { ResolvedType } from '../config';\nimport {\n\ttype AnyUser,\n\ttype Context,\n\tcheckPassword,\n\tpasswordRule,\n\trequireHasher,\n\ttoUser,\n\twriteUser,\n} from '../context';\nimport { deviceHint } from '../devices';\nimport { passwordChanged } from '../password-written';\nimport { openSession } from '../sessions';\nimport type { PasswordApi, SignInResult } from '../types';\nimport { byLogin } from './by-login';\nimport { changePassword } from './change-password';\nimport type { Finish, Input } from './flow-types';\nimport { insert } from './insert';\nimport { signIn } from './sign-in';\n\n/**\n * The password flows of one user type: signing up and in, finding a user by\n * the login they sign in with, and setting or changing their password.\n */\nexport function passwordFlows(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tat: At,\n\tfinish: Finish,\n): PasswordApi<AnyUser, Input, string, SignInResult<AnyUser>> {\n\treturn {\n\t\tasync signUp(input, options) {\n\t\t\tconst where = at('signUp');\n\t\t\tconst device = deviceHint(context, options, where);\n\t\t\tpasswordRule(type, where);\n\t\t\tif ((input as Input)?.['password'] === undefined) {\n\t\t\t\tcheckPassword(type, undefined as unknown as string, where);\n\t\t\t}\n\t\t\tconst record = await insert(context, type, input as Input, where);\n\t\t\treturn openSession(context, type, record, device, true);\n\t\t},\n\n\t\tasync signIn(input, options) {\n\t\t\tconst where = at('signIn');\n\t\t\tconst device = deviceHint(context, options, where);\n\t\t\treturn signIn(context, type, finish, input as Input, { where, device });\n\t\t},\n\n\t\tasync findByLogin(login) {\n\t\t\tconst rule = passwordRule(type, at('findByLogin'));\n\t\t\tconst record = await byLogin(context, type, rule.normalize(login));\n\t\t\treturn record === null ? null : toUser(record);\n\t\t},\n\n\t\tasync setPassword(user, password, options) {\n\t\t\tconst where = at('setPassword');\n\t\t\tpasswordRule(type, where);\n\t\t\tcheckPassword(type, password, where);\n\t\t\tconst hash = await requireHasher(context, where).hash(password);\n\n\t\t\tconst written = await writeUser(\n\t\t\t\tcontext,\n\t\t\t\tuser,\n\t\t\t\ttype,\n\t\t\t\toptions,\n\t\t\t\twhere,\n\t\t\t\t(_, now) => ({ password: { hash, updatedAt: now } }),\n\t\t\t);\n\t\t\tawait passwordChanged(context, written);\n\t\t\treturn toUser(written);\n\t\t},\n\n\t\tasync changePassword(user, change, options) {\n\t\t\tconst where = at('changePassword');\n\t\t\treturn toUser(\n\t\t\t\tawait changePassword(context, type, user, change, options, where),\n\t\t\t);\n\t\t},\n\t};\n}\n",
89
90
  "import { isId } from '../../ids/id';\nimport type { ResolvedType } from '../config';\nimport { type Context, idOf } from '../context';\nimport { emit } from '../events';\nimport type { UserRef } from '../types';\n\n/**\n * Deletes the user, then every session, token and tuple naming them. `true`\n * when this call deleted them; a replay finds nobody, answers `false`, and\n * still deletes what was left.\n */\nexport async function deleteUser(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tuser: UserRef,\n): Promise<boolean> {\n\tconst { store, clock } = context;\n\tconst id = idOf(user);\n\tif (!isId(id)) return false;\n\n\t// Read first, so a staff API never deletes a patient: another type's\n\t// id is answered as nobody, and nothing of theirs is touched.\n\tconst record = await store.users.findUser(id);\n\tif (record !== null && record.type !== type.name) return false;\n\n\t// The user first: from then on nobody can sign in as them, and what\n\t// is left — sessions, tokens — is refused for a user who is gone. An\n\t// outage between the steps leaves only that inert remainder, and a\n\t// replay, finding no user, still deletes it.\n\tconst deletedAt = clock.now();\n\tconst deleted = record !== null && (await store.users.deleteUser(id));\n\ttry {\n\t\tawait store.sessions.deleteUserSessions(id);\n\t\tawait store.tokens.deleteUserTokens(id);\n\t\t// Last, and on a replay too: the tuples naming them.\n\t\tawait context.relations?.deleteEntity({ type: type.name, id });\n\t} finally {\n\t\t// Once, when this call deleted them — even when an outage\n\t\t// interrupts the steps above: a replay deletes nobody, so it\n\t\t// could not send it.\n\t\tif (deleted) {\n\t\t\tawait emit(context, 'user.deleted', { id, type: type.name }, deletedAt);\n\t\t}\n\t}\n\treturn deleted;\n}\n",
@@ -91,10 +92,10 @@
91
92
  "import type { ResolvedType } from '../config';\nimport { type Context, emailOf, writeUser } from '../context';\nimport { emit } from '../events';\nimport type { UserRecord } from '../port/types';\nimport type { UserRef, WriteOptions } from '../types';\nimport { emailChanged, fieldsPatch } from './fields-patch';\nimport type { Input } from './flow-types';\n\n/**\n * `update`: the patch written over the stored fields, then — when it changed\n * the e-mail — `user.emailChanged`, carrying the address the write replaced,\n * which nothing keeps once it landed, and the user's pending `changeEmail`\n * links spent.\n */\nexport async function update(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tuser: UserRef,\n\tpatch: Input,\n\toptions: WriteOptions | undefined,\n\twhere: string,\n): Promise<UserRecord> {\n\t// The record the write replaced, read in its callback — which writeUser\n\t// always calls, once, before it writes under that record's version — so\n\t// the e-mail compared is the one this write changed.\n\tconst seen: { replaced: UserRecord | null } = { replaced: null };\n\tconst written = await writeUser(\n\t\tcontext,\n\t\tuser,\n\t\ttype,\n\t\toptions,\n\t\twhere,\n\t\t(record) => {\n\t\t\tseen.replaced = record;\n\t\t\treturn fieldsPatch(type, record, patch, where);\n\t\t},\n\t);\n\tconst { replaced } = seen;\n\tif (\n\t\treplaced !== null &&\n\t\temailChanged(type, replaced.fields, written.fields)\n\t) {\n\t\t// A pending changeEmail link was asked from the address just left:\n\t\t// spent, so a move back to that address cannot revive it. The event is\n\t\t// sent from a `finally`, so an outage there still reports the write.\n\t\ttry {\n\t\t\tawait context.store.tokens.spendUserTokens(\n\t\t\t\twritten.id,\n\t\t\t\t'changeEmail',\n\t\t\t\tcontext.clock.now(),\n\t\t\t);\n\t\t} finally {\n\t\t\tawait emit(context, 'user.emailChanged', written, written.updatedAt, {\n\t\t\t\tformerEmail: emailOf(type, replaced.fields),\n\t\t\t});\n\t\t}\n\t}\n\treturn written;\n}\n",
92
93
  "import { isId } from '../../ids/id';\nimport { invalidCursor, pageLimit } from '../../pagination/cursor-page';\nimport type { At } from '../at';\nimport type { ResolvedType } from '../config';\nimport {\n\ttype AnyUser,\n\ttype Context,\n\tfindRecord,\n\tgetRecord,\n\ttoUser,\n\twriteUser,\n} from '../context';\nimport type { UserTypeApi } from '../types';\nimport { deleteUser } from './delete';\nimport { findManyRecords } from './find-many';\nimport type { Input } from './flow-types';\nimport { insert } from './insert';\nimport { update } from './update';\n\n/**\n * The flows every user type has, whatever its configuration: creating,\n * reading, listing, updating, deactivating and deleting its users.\n */\nexport function recordFlows(\n\tcontext: Context,\n\ttype: ResolvedType,\n\tat: At,\n): UserTypeApi<AnyUser, Input> {\n\tconst { store } = context;\n\n\treturn {\n\t\tasync create(input) {\n\t\t\treturn toUser(await insert(context, type, input as Input, at('create')));\n\t\t},\n\n\t\tasync find(id) {\n\t\t\tconst record = await findRecord(context, id, type.name);\n\t\t\treturn record === null ? null : toUser(record);\n\t\t},\n\n\t\tasync findMany(ids) {\n\t\t\tconst records = await findManyRecords(\n\t\t\t\tcontext,\n\t\t\t\tids,\n\t\t\t\ttype.name,\n\t\t\t\tat('findMany'),\n\t\t\t);\n\t\t\treturn records.map(toUser);\n\t\t},\n\n\t\tasync get(id) {\n\t\t\treturn toUser(await getRecord(context, id, type.name, at('get')));\n\t\t},\n\n\t\tasync list(page) {\n\t\t\tconst after = page?.after ?? null;\n\t\t\t// Never a silent first page: a caller paging a list would loop for\n\t\t\t// ever, and the loop would look like a slow query.\n\t\t\tif (after !== null && !isId(after)) {\n\t\t\t\tthrow invalidCursor(at('list'), after);\n\t\t\t}\n\n\t\t\tconst answer = await store.users.listUsers({\n\t\t\t\ttype: type.name,\n\t\t\t\tafter,\n\t\t\t\tlimit: pageLimit(page?.limit, at('list')),\n\t\t\t});\n\t\t\treturn { items: answer.items.map(toUser), nextCursor: answer.nextCursor };\n\t\t},\n\n\t\tasync update(user, patch, options) {\n\t\t\treturn toUser(\n\t\t\t\tawait update(\n\t\t\t\t\tcontext,\n\t\t\t\t\ttype,\n\t\t\t\t\tuser,\n\t\t\t\t\tpatch as Input,\n\t\t\t\t\toptions,\n\t\t\t\t\tat('update'),\n\t\t\t\t),\n\t\t\t);\n\t\t},\n\n\t\tasync setActive(user, active, options) {\n\t\t\treturn toUser(\n\t\t\t\tawait writeUser(context, user, type, options, at('setActive'), () => ({\n\t\t\t\t\tactive: active === true,\n\t\t\t\t})),\n\t\t\t);\n\t\t},\n\n\t\tasync delete(user) {\n\t\t\treturn deleteUser(context, type, user);\n\t\t},\n\t};\n}\n",
93
94
  "import type { At } from '../at';\nimport type { ResolvedType } from '../config';\nimport type { Context } from '../context';\nimport { emailFlows } from '../email-flows';\nimport { magicLinkFlows } from '../magic-link';\nimport { provenSignInFlows } from '../proven-sign-in';\nimport { secondFactorFlows } from '../second-factor/flows';\nimport { signInCodeFlows } from '../sign-in-code';\nimport { stepUpFlows } from '../step-up/flows';\nimport type { AnyTypeApi } from './any-type-api';\nimport { findByEmailFlows } from './find-by-email';\nimport { findOrCreateFlows } from './find-or-create';\nimport { passwordFlows } from './password-flows';\nimport { recordFlows } from './record-flows';\n\n/**\n * Everything one user type answers, gathered from its flows: its records,\n * its password, its sign-in on the application's proof, its second factor,\n * its sign-in code and link, its step-up, its e-mails, the lookup by e-mail and the lookup that creates.\n */\nexport function typeApi(context: Context, type: ResolvedType): AnyTypeApi {\n\tconst at: At = (operation) =>\n\t\tcontext.config.single ? operation : `${type.name}.${operation}`;\n\tconst secondFactor = secondFactorFlows(context, type, at);\n\tconst signInCode = signInCodeFlows(context, type, at, secondFactor.finish);\n\n\treturn {\n\t\t...recordFlows(context, type, at),\n\t\t...passwordFlows(context, type, at, secondFactor.finish),\n\t\t...provenSignInFlows(context, type, at, secondFactor.finish),\n\n\t\tsecondFactor: secondFactor.api,\n\t\tsignInCode,\n\t\tmagicLink: magicLinkFlows(context, type, at, secondFactor.finish),\n\t\tstepUp: stepUpFlows(context, type, at),\n\n\t\t...findByEmailFlows(context, type),\n\t\t...findOrCreateFlows(context, type, at),\n\t\t...emailFlows(context, type, at),\n\t};\n}\n",
94
- "import { guardRelations } from '../stores/guard';\nimport { systemClock } from '../time/clock';\nimport { type JanusConfig, resolveConfig } from './config';\nimport { warnThrottleWindow } from './config/warn-throttle-window';\nimport { createContext } from './context';\nimport { resolveEvents } from './events';\nimport { guardStores } from './outage';\nimport { assertStores } from './port/assert-stores';\nimport { sharedApi } from './sessions';\nimport type { Checked, Janus } from './types';\nimport { typeApi } from './users';\n\n/**\n * Wires the identities side over the stores the application opened. **Synchronous,\n * and does no I/O**: it connects to nothing.\n *\n * ```ts\n * // One user type\n * const auth = janus({\n * user: z.object({ email: z.email(), name: z.string() }),\n * password: { login: 'email' },\n * store: createMemoryStores(),\n * hasher: scryptHasher(),\n * });\n * const { user, token } = await auth.signUp({ email, name, password });\n *\n * // Several\n * const auth = janus({\n * users: {\n * patient: { schema: Patient, password: { login: 'email' } },\n * staff: { schema: Staff, password: { login: 'email' }, session: { lifespan: '8h' } },\n * },\n * store, hasher,\n * });\n * await auth.staff.signIn({ email, password });\n * const current = await auth.authenticate(request, { type: 'staff' });\n * ```\n *\n * The types refuse first, on the offending key: a login or an e-mail that\n * names no required string field, a schema declaring a field `janus` sets, a\n * user type named like a method. What follows at run time is the net for\n * JavaScript callers, each a bare `TypeError` because only wiring produces one:\n * a store slot missing or incomplete; a password type with no hasher — there\n * is no silent fallback; two hashers claiming the same prefix, which would make\n * verification depend on the order they were listed in.\n */\nexport function janus<const C extends JanusConfig>(\n\tconfig: C & Checked<C>,\n): Janus<C> {\n\tconst where = 'janus';\n\tconst resolved = resolveConfig(config, where);\n\twarnThrottleWindow(resolved, where);\n\tconst capabilities = assertStores(config.store, where);\n\n\tconst hasher = config.hasher ?? null;\n\tconst verifiers = [\n\t\t...(hasher === null ? [] : [hasher]),\n\t\t...(config.verifiers ?? []),\n\t];\n\tconst prefixes = new Set<string>();\n\tfor (const verifier of verifiers) {\n\t\tif (typeof verifier?.prefix !== 'string' || verifier.prefix === '') {\n\t\t\tthrow new TypeError(`${where}: every hasher needs a non-empty prefix`);\n\t\t}\n\t\tif (prefixes.has(verifier.prefix)) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`${where}: two hashers claim the prefix \"${verifier.prefix}\" — which one verifies would depend on their order`,\n\t\t\t);\n\t\t}\n\t\tprefixes.add(verifier.prefix);\n\t}\n\n\tconst relations = config.relations ?? null;\n\tif (\n\t\trelations !== null &&\n\t\ttypeof (relations as { deleteEntity?: unknown }).deleteEntity !== 'function'\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`${where}: relations must be a relation store — relations.deleteEntity is missing`,\n\t\t);\n\t}\n\n\tconst context = createContext(\n\t\tresolved,\n\t\tguardStores(config.store),\n\t\trelations === null ? null : guardRelations(relations),\n\t\tcapabilities,\n\t\tconfig.clock ?? systemClock,\n\t\thasher,\n\t\tverifiers,\n\t\tresolveEvents(config.events, where),\n\t);\n\n\tconst shared = sharedApi(context);\n\tconst types = Object.fromEntries(\n\t\t[...resolved.types.values()].map((type) => [\n\t\t\ttype.name,\n\t\t\ttypeApi(context, type),\n\t\t]),\n\t);\n\n\t// The one cast at the boundary: every field was validated against its\n\t// type's schema before any of these answers was built.\n\tconst surface = resolved.single\n\t\t? { ...shared, ...types['user'] }\n\t\t: { ...shared, ...types };\n\treturn surface as unknown as Janus<C>;\n}\n",
95
+ "import { guardRelations } from '../stores/guard';\nimport { systemClock } from '../time/clock';\nimport { type JanusConfig, resolveConfig } from './config';\nimport { warnThrottleWindow } from './config/warn-throttle-window';\nimport { createContext } from './context';\nimport { anyTypeChangeEmail } from './email-flows/any-type-change-email';\nimport { resolveEvents } from './events';\nimport { guardStores } from './outage';\nimport { assertStores } from './port/assert-stores';\nimport { sharedApi } from './sessions';\nimport type { Checked, Janus } from './types';\nimport { typeApi } from './users';\n\n/**\n * Wires the identities side over the stores the application opened. **Synchronous,\n * and does no I/O**: it connects to nothing.\n *\n * ```ts\n * // One user type\n * const auth = janus({\n * user: z.object({ email: z.email(), name: z.string() }),\n * password: { login: 'email' },\n * store: createMemoryStores(),\n * hasher: scryptHasher(),\n * });\n * const { user, token } = await auth.signUp({ email, name, password });\n *\n * // Several\n * const auth = janus({\n * users: {\n * patient: { schema: Patient, password: { login: 'email' } },\n * staff: { schema: Staff, password: { login: 'email' }, session: { lifespan: '8h' } },\n * },\n * store, hasher,\n * });\n * await auth.staff.signIn({ email, password });\n * const current = await auth.authenticate(request, { type: 'staff' });\n * ```\n *\n * The types refuse first, on the offending key: a login or an e-mail that\n * names no required string field, a schema declaring a field `janus` sets, a\n * user type named like a method. What follows at run time is the net for\n * JavaScript callers, each a bare `TypeError` because only wiring produces one:\n * a store slot missing or incomplete; a password type with no hasher — there\n * is no silent fallback; two hashers claiming the same prefix, which would make\n * verification depend on the order they were listed in.\n */\nexport function janus<const C extends JanusConfig>(\n\tconfig: C & Checked<C>,\n): Janus<C> {\n\tconst where = 'janus';\n\tconst resolved = resolveConfig(config, where);\n\twarnThrottleWindow(resolved, where);\n\tconst capabilities = assertStores(config.store, where);\n\n\tconst hasher = config.hasher ?? null;\n\tconst verifiers = [\n\t\t...(hasher === null ? [] : [hasher]),\n\t\t...(config.verifiers ?? []),\n\t];\n\tconst prefixes = new Set<string>();\n\tfor (const verifier of verifiers) {\n\t\tif (typeof verifier?.prefix !== 'string' || verifier.prefix === '') {\n\t\t\tthrow new TypeError(`${where}: every hasher needs a non-empty prefix`);\n\t\t}\n\t\tif (prefixes.has(verifier.prefix)) {\n\t\t\tthrow new TypeError(\n\t\t\t\t`${where}: two hashers claim the prefix \"${verifier.prefix}\" — which one verifies would depend on their order`,\n\t\t\t);\n\t\t}\n\t\tprefixes.add(verifier.prefix);\n\t}\n\n\tconst relations = config.relations ?? null;\n\tif (\n\t\trelations !== null &&\n\t\ttypeof (relations as { deleteEntity?: unknown }).deleteEntity !== 'function'\n\t) {\n\t\tthrow new TypeError(\n\t\t\t`${where}: relations must be a relation store — relations.deleteEntity is missing`,\n\t\t);\n\t}\n\n\tconst context = createContext(\n\t\tresolved,\n\t\tguardStores(config.store),\n\t\trelations === null ? null : guardRelations(relations),\n\t\tcapabilities,\n\t\tconfig.clock ?? systemClock,\n\t\thasher,\n\t\tverifiers,\n\t\tresolveEvents(config.events, where),\n\t);\n\n\tconst shared = sharedApi(context);\n\tconst types = Object.fromEntries(\n\t\t[...resolved.types.values()].map((type) => [\n\t\t\ttype.name,\n\t\t\ttypeApi(context, type),\n\t\t]),\n\t);\n\n\t// The one cast at the boundary: every field was validated against its\n\t// type's schema before any of these answers was built.\n\tconst surface = resolved.single\n\t\t? { ...shared, ...types['user'] }\n\t\t: {\n\t\t\t\t...shared,\n\t\t\t\t...types,\n\t\t\t\t...anyTypeChangeEmail(context),\n\t\t\t};\n\treturn surface as unknown as Janus<C>;\n}\n",
95
96
  "/**\n * `assertFresh`: whether a session proved who it is recently enough for a\n * sensitive action — signed in, or confirmed by a step-up, less than\n * `maxAge` ago.\n */\n\nimport { StepUpRequiredError } from '../../errors/janus-error';\nimport { type Clock, systemClock } from '../../time/clock';\nimport { type Duration, parseDuration } from '../../time/duration';\nimport type { Session } from '../types';\n\n/**\n * Refuses a session whose credentials were last presented `maxAge` ago or\n * more — at its sign-in, or since by `stepUp.confirm` — with\n * `STEP_UP_REQUIRED` (403): ask for a step-up, then run the action again. One\n * field of the session `authenticate` already answered, so no store is read.\n *\n * ```ts\n * const current = await auth.authenticate(request);\n * if (current === null) return new Response(null, { status: 401 });\n * assertFresh(current.session, '10m'); // STEP_UP_REQUIRED past ten minutes\n * ```\n *\n * Pass the `clock` given to `janus()` when it is not the system's. A\n * `maxAge` that is not a duration is a `TypeError`: it is written in the\n * code, never read from a request.\n */\nexport function assertFresh(\n\tsession: Pick<Session, 'authenticatedAt' | 'userId'>,\n\tmaxAge: Duration,\n\tclock: Clock = systemClock,\n): void {\n\tconst maxAgeMs = parseDuration(maxAge, 'assertFresh: maxAge');\n\tconst age = clock.now().getTime() - session.authenticatedAt.getTime();\n\tif (age >= maxAgeMs) {\n\t\tthrow new StepUpRequiredError(\n\t\t\t'assertFresh: the session proved who it is longer ago than maxAge — confirm with a step-up',\n\t\t\t{ userId: session.userId },\n\t\t);\n\t}\n}\n"
96
97
  ],
97
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAwBO,SAAS,YAAY,CAAC,SAEV;AAAA,EAClB,MAAM,OAAO,SAAS,QAAQ;AAAA,EAC9B,IAAI,CAAC,OAAO,UAAU,IAAI,KAAK,OAAO,MAAM,OAAO,IAAI;AAAA,IACtD,MAAM,IAAI,UACT,uFACD;AAAA,EACD;AAAA,EAEA,OAAO;AAAA,IACN,QAAQ;AAAA,SACF,KAAI,CAAC,OAAO;AAAA,MACjB,MAA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