@warlock.js/auth 5.30.0 → 5.32.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 (179) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/esm/commands/auth-cleanup-command.d.mts +1 -2
  3. package/esm/commands/auth-cleanup-command.d.mts.map +1 -1
  4. package/esm/commands/auth-purge-never-expiring-command.d.mts +1 -2
  5. package/esm/commands/auth-purge-never-expiring-command.d.mts.map +1 -1
  6. package/esm/commands/auth-purge-never-expiring-command.mjs.map +1 -1
  7. package/esm/commands/jwt-secret-generator-command.d.mts +1 -2
  8. package/esm/commands/jwt-secret-generator-command.d.mts.map +1 -1
  9. package/esm/commands/jwt-secret-generator-command.mjs.map +1 -1
  10. package/esm/contracts/auth-contract.d.mts +1 -3
  11. package/esm/contracts/auth-contract.d.mts.map +1 -1
  12. package/esm/contracts/index.d.mts +2 -1
  13. package/esm/contracts/providers.d.mts +82 -50
  14. package/esm/contracts/providers.d.mts.map +1 -1
  15. package/esm/contracts/request-locals.d.mts +2 -3
  16. package/esm/contracts/request-locals.d.mts.map +1 -1
  17. package/esm/contracts/types.d.mts +59 -43
  18. package/esm/contracts/types.d.mts.map +1 -1
  19. package/esm/errors/auth-provider-sdk-missing.error.d.mts +1 -3
  20. package/esm/errors/auth-provider-sdk-missing.error.d.mts.map +1 -1
  21. package/esm/errors/email-not-verified.error.d.mts +1 -3
  22. package/esm/errors/email-not-verified.error.d.mts.map +1 -1
  23. package/esm/errors/index.d.mts +2 -1
  24. package/esm/errors/index.mjs +1 -1
  25. package/esm/errors/invalid-one-time-token.error.d.mts +1 -3
  26. package/esm/errors/invalid-one-time-token.error.d.mts.map +1 -1
  27. package/esm/errors/invalid-passkey.error.d.mts +1 -3
  28. package/esm/errors/invalid-passkey.error.d.mts.map +1 -1
  29. package/esm/errors/invalid-provider-callback.error.d.mts +1 -3
  30. package/esm/errors/invalid-provider-callback.error.d.mts.map +1 -1
  31. package/esm/errors/notifications-unavailable.error.d.mts +1 -3
  32. package/esm/errors/notifications-unavailable.error.d.mts.map +1 -1
  33. package/esm/errors/provider-email-not-verified.error.d.mts +1 -3
  34. package/esm/errors/provider-email-not-verified.error.d.mts.map +1 -1
  35. package/esm/index.d.mts +8 -0
  36. package/esm/localization/auth-default-translations.d.mts +1 -3
  37. package/esm/localization/auth-default-translations.d.mts.map +1 -1
  38. package/esm/localization/auth-translations.type.d.mts +11 -7
  39. package/esm/localization/auth-translations.type.d.mts.map +1 -1
  40. package/esm/localization/index.mjs +1 -1
  41. package/esm/localization/register-auth-translations.d.mts +1 -2
  42. package/esm/localization/register-auth-translations.d.mts.map +1 -1
  43. package/esm/middleware/auth.middleware.d.mts +10 -10
  44. package/esm/middleware/auth.middleware.d.mts.map +1 -1
  45. package/esm/middleware/auth.middleware.mjs +2 -2
  46. package/esm/middleware/auth.middleware.mjs.map +1 -1
  47. package/esm/middleware/csrf-origin-check.d.mts +4 -6
  48. package/esm/middleware/csrf-origin-check.d.mts.map +1 -1
  49. package/esm/middleware/csrf-origin-check.mjs +1 -1
  50. package/esm/middleware/csrf-origin-check.mjs.map +1 -1
  51. package/esm/middleware/index.d.mts +2 -1
  52. package/esm/middleware/index.mjs +1 -1
  53. package/esm/middleware/login-throttle.middleware.d.mts +4 -6
  54. package/esm/middleware/login-throttle.middleware.d.mts.map +1 -1
  55. package/esm/middleware/login-throttle.middleware.mjs +1 -1
  56. package/esm/middleware/login-throttle.middleware.mjs.map +1 -1
  57. package/esm/middleware/one-time-token-throttle.middleware.d.mts +2 -4
  58. package/esm/middleware/one-time-token-throttle.middleware.d.mts.map +1 -1
  59. package/esm/middleware/otp-throttle.middleware.d.mts +2 -4
  60. package/esm/middleware/otp-throttle.middleware.d.mts.map +1 -1
  61. package/esm/middleware/require-verified-email.middleware.d.mts +1 -3
  62. package/esm/middleware/require-verified-email.middleware.d.mts.map +1 -1
  63. package/esm/models/access-token/access-token.model.d.mts +6 -30
  64. package/esm/models/access-token/access-token.model.d.mts.map +1 -1
  65. package/esm/models/access-token/index.d.mts +2 -1
  66. package/esm/models/access-token/index.mjs +1 -1
  67. package/esm/models/auth-token-family/auth-token-family.model.d.mts +2 -28
  68. package/esm/models/auth-token-family/auth-token-family.model.d.mts.map +1 -1
  69. package/esm/models/auth-token-family/index.d.mts +2 -1
  70. package/esm/models/auth-token-family/index.mjs +1 -1
  71. package/esm/models/auth.model.d.mts +1 -3
  72. package/esm/models/auth.model.d.mts.map +1 -1
  73. package/esm/models/index.d.mts +8 -2
  74. package/esm/models/index.d.mts.map +1 -1
  75. package/esm/models/index.mjs +1 -1
  76. package/esm/models/one-time-token/index.d.mts +2 -1
  77. package/esm/models/one-time-token/index.mjs +1 -1
  78. package/esm/models/one-time-token/one-time-token.model.d.mts +3 -37
  79. package/esm/models/one-time-token/one-time-token.model.d.mts.map +1 -1
  80. package/esm/models/passkey-credential/index.d.mts +2 -1
  81. package/esm/models/passkey-credential/index.mjs +1 -1
  82. package/esm/models/passkey-credential/passkey-credential.model.d.mts +2 -32
  83. package/esm/models/passkey-credential/passkey-credential.model.d.mts.map +1 -1
  84. package/esm/models/provider-account/index.d.mts +2 -1
  85. package/esm/models/provider-account/index.mjs +1 -1
  86. package/esm/models/provider-account/provider-account.model.d.mts +2 -28
  87. package/esm/models/provider-account/provider-account.model.d.mts.map +1 -1
  88. package/esm/models/refresh-token/index.d.mts +2 -1
  89. package/esm/models/refresh-token/index.mjs +1 -1
  90. package/esm/models/refresh-token/refresh-token.model.d.mts +11 -55
  91. package/esm/models/refresh-token/refresh-token.model.d.mts.map +1 -1
  92. package/esm/otp/index.d.mts +2 -1
  93. package/esm/otp/index.mjs +1 -1
  94. package/esm/otp/otp.d.mts +2 -4
  95. package/esm/otp/otp.d.mts.map +1 -1
  96. package/esm/otp/otp.mjs +2 -1
  97. package/esm/otp/otp.mjs.map +1 -1
  98. package/esm/passkeys/index.d.mts +2 -1
  99. package/esm/passkeys/index.mjs +1 -1
  100. package/esm/passkeys/passkey-authentication.d.mts +2 -4
  101. package/esm/passkeys/passkey-authentication.d.mts.map +1 -1
  102. package/esm/passkeys/passkey-authentication.mjs +2 -1
  103. package/esm/passkeys/passkey-authentication.mjs.map +1 -1
  104. package/esm/passkeys/passkey-registration.d.mts +3 -4
  105. package/esm/passkeys/passkey-registration.d.mts.map +1 -1
  106. package/esm/passkeys/simplewebauthn.d.mts +2 -3
  107. package/esm/passkeys/simplewebauthn.d.mts.map +1 -1
  108. package/esm/passkeys/simplewebauthn.mjs +1 -1
  109. package/esm/providers/apple-provider.d.mts +5 -9
  110. package/esm/providers/apple-provider.d.mts.map +1 -1
  111. package/esm/providers/discord-provider.d.mts +2 -7
  112. package/esm/providers/discord-provider.d.mts.map +1 -1
  113. package/esm/providers/facebook-provider.d.mts +2 -7
  114. package/esm/providers/facebook-provider.d.mts.map +1 -1
  115. package/esm/providers/github-provider.d.mts +2 -7
  116. package/esm/providers/github-provider.d.mts.map +1 -1
  117. package/esm/providers/google-provider.d.mts +5 -10
  118. package/esm/providers/google-provider.d.mts.map +1 -1
  119. package/esm/providers/index.d.mts +2 -1
  120. package/esm/providers/index.mjs +1 -1
  121. package/esm/providers/linkedin-provider.d.mts +3 -8
  122. package/esm/providers/linkedin-provider.d.mts.map +1 -1
  123. package/esm/providers/provider-login.d.mts +3 -5
  124. package/esm/providers/provider-login.d.mts.map +1 -1
  125. package/esm/providers/provider-login.mjs +3 -2
  126. package/esm/providers/provider-login.mjs.map +1 -1
  127. package/esm/providers/provider-state-cookie.mjs +3 -2
  128. package/esm/providers/provider-state-cookie.mjs.map +1 -1
  129. package/esm/providers/x-provider.d.mts +2 -7
  130. package/esm/providers/x-provider.d.mts.map +1 -1
  131. package/esm/services/auth-events.d.mts +5 -6
  132. package/esm/services/auth-events.d.mts.map +1 -1
  133. package/esm/services/auth.service.d.mts +10 -9
  134. package/esm/services/auth.service.d.mts.map +1 -1
  135. package/esm/services/current-user.d.mts +1 -3
  136. package/esm/services/current-user.d.mts.map +1 -1
  137. package/esm/services/email-verification.d.mts +3 -5
  138. package/esm/services/email-verification.d.mts.map +1 -1
  139. package/esm/services/generate-jwt-secret.d.mts +1 -2
  140. package/esm/services/generate-jwt-secret.d.mts.map +1 -1
  141. package/esm/services/index.d.mts +2 -1
  142. package/esm/services/index.mjs +1 -1
  143. package/esm/services/jwt.d.mts +8 -29
  144. package/esm/services/jwt.d.mts.map +1 -1
  145. package/esm/services/jwt.mjs +2 -2
  146. package/esm/services/jwt.mjs.map +1 -1
  147. package/esm/services/one-time-tokens.d.mts +6 -6
  148. package/esm/services/one-time-tokens.d.mts.map +1 -1
  149. package/esm/services/password-reset.d.mts +2 -4
  150. package/esm/services/password-reset.d.mts.map +1 -1
  151. package/esm/services/resolve-request-user.d.mts +19 -14
  152. package/esm/services/resolve-request-user.d.mts.map +1 -1
  153. package/esm/services/resolve-request-user.mjs.map +1 -1
  154. package/esm/services/token-family-operation.mjs +1 -1
  155. package/esm/session/index.d.mts +2 -1
  156. package/esm/session/index.mjs +1 -1
  157. package/esm/session/page-session.d.mts +26 -18
  158. package/esm/session/page-session.d.mts.map +1 -1
  159. package/esm/utils/auth-error-codes.d.mts +11 -22
  160. package/esm/utils/auth-error-codes.d.mts.map +1 -1
  161. package/esm/utils/index.mjs +1 -1
  162. package/esm/utils/safe-equal.d.mts +1 -2
  163. package/esm/utils/safe-equal.d.mts.map +1 -1
  164. package/esm/utils/token-expiry.d.mts +3 -4
  165. package/esm/utils/token-expiry.d.mts.map +1 -1
  166. package/llms-full.txt +189 -111
  167. package/package.json +8 -8
  168. package/skills/auth-basics/SKILL.md +10 -13
  169. package/skills/customize-token-storage/SKILL.md +24 -19
  170. package/skills/customize-user-type/SKILL.md +3 -1
  171. package/skills/index.md +4 -1
  172. package/skills/login-with-providers/SKILL.md +54 -29
  173. package/skills/manage-tokens/SKILL.md +2 -2
  174. package/skills/overview/SKILL.md +10 -1
  175. package/skills/protect-routes/SKILL.md +23 -14
  176. package/skills/register-user/SKILL.md +4 -4
  177. package/skills/run-auth-commands/SKILL.md +1 -1
  178. package/skills/throttle-login-attempts/SKILL.md +51 -22
  179. package/skills/verify-email-and-reset-password/SKILL.md +7 -5
package/CHANGELOG.md CHANGED
@@ -4,6 +4,23 @@ All notable changes to `@warlock.js/auth` are documented in this file.
4
4
 
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). `@warlock.js/*` packages are released in lockstep — every package shares the same version number, so a version below may list only the changes that affected this package.
6
6
 
7
+ ## 5.32.0 - 2026-10-18
8
+
9
+ ### Changed
10
+
11
+ - Pin the package development compiler to TypeScript 7.0.2 and use explicit Node types and source roots with supported module resolution.
12
+
13
+ ## 5.31.0 - 2026-10-18
14
+
15
+ ### Added
16
+
17
+ - `authMiddleware()` marks itself as an auth guard (`markAuthGuard()` from `@warlock.js/core`), so `warlock dev`'s unguarded-route warning recognises routes behind it; the `{ optional: true }` form is marked as not a guard. Docs and skills list what throttles auth endpoints by default (core's global limit, plus the throttles new apps attach to sign-in and password recovery) and how to add them to an existing app.
18
+ - Real Redis integration coverage for login failure counters and lockouts, including concurrent requests, preserved deadlines and counters recreated after a seeded key expires. Local runs opt in with `WARLOCK_REDIS_INTEGRATION=1`; CI requires a live Redis service. Tests use UUID prefixes and clean only their own keys.
19
+
20
+ ### Fixed
21
+
22
+ - Login, token and OTP throttles pass their counting-window TTL into each atomic increment. A counter that expires between the create-only seed and increment is recreated with an expiry rather than becoming permanent. Token middleware regression assertions cover the issue counters' one-hour window and the consume counter's fifteen-minute window.
23
+
7
24
  ## 5.30.0 - 2026-10-16
8
25
 
9
26
  ### Upgrading
@@ -12,7 +29,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
12
29
 
13
30
  ### Changed
14
31
 
15
- - **The login throttle keys accounts and IPs by a keyed hash** (`auth.throttle.count.email.<hmac>`, `auth.throttle.count.ip.<hmac>`) instead of the raw address or IP, so cache logs never show them. The HMAC key is derived from `auth.accessToken.secret` (as the OTP code MAC is), so a list of known addresses cannot reverse it; without a configured secret it falls back to SHA-256. The value is trimmed and lower-cased first, so `" Sara@x.io"` and `"sara@x.io"` share one bucket. Applies to `loginThrottleMiddleware` and every preset built on it (token issue/consume, OTP); a custom `identify` is used as is. `throttleIdentifierHash(kind, value)` is exported (FW-04).
32
+ - **The login throttle keys accounts and IPs by a keyed hash** (`auth.throttle.count.email.<hmac>`, `auth.throttle.count.ip.<hmac>`) instead of the raw address or IP, so cache logs never show them. The HMAC key is derived from `auth.accessToken.secret` (as the OTP code MAC is), so a list of known addresses cannot reverse it; without a configured secret it falls back to SHA-256. The value is trimmed and lower-cased first, so `" Sara@x.io"` and `"sara@x.io"` share one bucket. Applies to `loginThrottleMiddleware` and every preset built on it (token issue/consume, OTP); a custom `identify` is used as is. `throttleIdentifierHash(kind, value)` is exported.
16
33
  - A throttle lock stores its own deadline, so a cache driver with sliding expiration (`memoryExtended`) can no longer keep a retrying client locked past `lockoutDuration`. Locks written by 5.29 (`true`) are still honoured until they expire.
17
34
  - The throttle warns once when the cache driver is `null`, which stores nothing, so the throttle can never lock.
18
35
 
@@ -7,7 +7,6 @@
7
7
  * warlock auth:cleanup
8
8
  * ```
9
9
  */
10
- declare function registerAuthCleanupCommand(): import("@warlock.js/core").CLICommand;
10
+ export declare function registerAuthCleanupCommand(): import("@warlock.js/core").CLICommand;
11
11
  //#endregion
12
- export { registerAuthCleanupCommand };
13
12
  //# sourceMappingURL=auth-cleanup-command.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-cleanup-command.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/commands/auth-cleanup-command.ts"],"mappings":";;AAYA;;;;AAA0C;;;iBAA1B,0BAAA,+BAA0B,UAAA"}
1
+ {"version":3,"file":"auth-cleanup-command.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/commands/auth-cleanup-command.ts"],"mappings":";;;;;;;;;wBAYgB,yDAA0B"}
@@ -23,7 +23,6 @@
23
23
  * warlock auth.purge-never-expiring # report, then delete
24
24
  * ```
25
25
  */
26
- declare function registerAuthPurgeNeverExpiringCommand(): import("@warlock.js/core").CLICommand;
26
+ export declare function registerAuthPurgeNeverExpiringCommand(): import("@warlock.js/core").CLICommand;
27
27
  //#endregion
28
- export { registerAuthPurgeNeverExpiringCommand };
29
28
  //# sourceMappingURL=auth-purge-never-expiring-command.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-purge-never-expiring-command.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/commands/auth-purge-never-expiring-command.ts"],"mappings":";;AA4BA;;;;AAAqD;;;;;;;;;;;;;;;;;;;iBAArC,qCAAA,+BAAqC,UAAA"}
1
+ {"version":3,"file":"auth-purge-never-expiring-command.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/commands/auth-purge-never-expiring-command.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;wBA4BgB,oEAAqC"}
@@ -1 +1 @@
1
- {"version":3,"file":"auth-purge-never-expiring-command.mjs","names":[],"sources":["../../../../../../../../packages/auth/src/commands/auth-purge-never-expiring-command.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { command } from \"@warlock.js/core\";\nimport { authService } from \"../services/auth.service\";\n\n/**\n * Register the `auth.purge-never-expiring` CLI command — remediation for the\n * pre-4.12.0 `expiresIn` defect (#25).\n *\n * **Why a command and not a migration.** The rows this removes cannot be\n * selected by a date predicate (an `Invalid Date` compares `false` against\n * every date, so `WHERE expires_at < now()` never matches one) and the\n * definitive signal — a token with no `exp` claim — lives inside the JWT\n * string, not in a column. A migration would also run once, silently, at deploy\n * time; an operator dealing with possibly-leaked credentials needs to *look*\n * first, then act, and to repeat it. Hence `--dry-run`, which is the default\n * posture this command is expected to be run in first.\n *\n * A migration is additionally the wrong shape for a fix that must reach both\n * supported stores: the same row is a different thing in MongoDB and Postgres,\n * and this goes through the models so a registered override\n * (`config.auth.accessToken.model`) is honoured.\n *\n * @example\n * ```bash\n * warlock auth.purge-never-expiring --dry-run # report only\n * warlock auth.purge-never-expiring # report, then delete\n * ```\n */\nexport function registerAuthPurgeNeverExpiringCommand() {\n return command({\n name: \"auth.purge-never-expiring\",\n description:\n \"Find (and delete) token rows that can never expire — an unusable expires_at, or a token with no exp claim\",\n options: [\n {\n text: \"--dry-run\",\n description: \"Report the affected rows without deleting anything\",\n type: \"boolean\",\n },\n ],\n preload: {\n env: true,\n config: [\"auth\", \"database\"],\n connectors: [\"database\"],\n },\n action: async (data: { options?: Record<string, unknown> } = {}) => {\n // Core camelCases flags (`--dry-run` ⇒ `dryRun`); both spellings are read\n // so the command does not depend on that detail staying true.\n //\n // Read fail-safe: the flag counts as set unless it is *explicitly* false\n // (`--dry-run=false`). An operator who asked to look before deleting and\n // got a delete because a flag arrived as `\"true\"` instead of `true` would\n // lose live credentials to a parsing detail.\n const flags = data.options ?? {};\n const flag = flags[\"dryRun\"] ?? flags[\"dry-run\"];\n const dryRun = flag !== undefined && flag !== false && flag !== \"false\";\n\n console.log(colors.cyan(\"🔎 Scanning for tokens that can never expire...\"));\n\n const { accessTokens, refreshTokens } = await authService.findNeverExpiringTokens();\n const total = accessTokens.length + refreshTokens.length;\n\n if (total === 0) {\n console.log(colors.green(\"✅ No never-expiring tokens found.\"));\n\n return;\n }\n\n console.log(\n colors.yellow(\n `⚠️ ${total} never-expiring token(s): ` +\n `${accessTokens.length} access, ${refreshTokens.length} refresh.`,\n ),\n );\n\n // Identify each row so an operator can correlate with their own audit\n // trail before (or after) the rows are gone. The token string itself is\n // never printed — it is a live credential until this command removes it.\n for (const token of accessTokens) {\n console.log(\n colors.yellow(\n ` access id=${token.id} user_id=${token.get(\"user_id\")} ` +\n `user_type=${token.get(\"user_type\")} expires_at=${String(token.get(\"expires_at\"))}`,\n ),\n );\n }\n\n for (const token of refreshTokens) {\n console.log(\n colors.yellow(\n ` refresh id=${token.id} user_id=${token.get(\"user_id\")} ` +\n `user_type=${token.get(\"user_type\")} expires_at=${String(token.get(\"expires_at\"))}`,\n ),\n );\n }\n\n if (dryRun) {\n console.log(\n colors.cyan(\"Dry run — nothing deleted. Re-run without --dry-run to revoke these tokens.\"),\n );\n\n return;\n }\n\n // Re-selects rather than deleting the rows just listed: the delete then\n // acts on the table's current state instead of a snapshot taken before\n // the operator read the report. A second full scan is affordable here —\n // this is a one-off remediation, not a request path.\n const purged = await authService.purgeNeverExpiringTokens();\n\n console.log(\n colors.green(\n `✅ Revoked ${purged.accessTokens} access token(s) and ` +\n `${purged.refreshTokens} refresh token(s). Affected users must log in again.`,\n ),\n );\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,wCAAwC;CACtD,OAAO,QAAQ;EACb,MAAM;EACN,aACE;EACF,SAAS,CACP;GACE,MAAM;GACN,aAAa;GACb,MAAM;EACR,CACF;EACA,SAAS;GACP,KAAK;GACL,QAAQ,CAAC,QAAQ,UAAU;GAC3B,YAAY,CAAC,UAAU;EACzB;EACA,QAAQ,OAAO,OAA8C,CAAC,MAAM;GAQlE,MAAM,QAAQ,KAAK,WAAW,CAAC;GAC/B,MAAM,OAAO,MAAM,aAAa,MAAM;GACtC,MAAM,SAAS,SAAS,UAAa,SAAS,SAAS,SAAS;GAEhE,QAAQ,IAAI,OAAO,KAAK,iDAAiD,CAAC;GAE1E,MAAM,EAAE,cAAc,kBAAkB,MAAM,YAAY,wBAAwB;GAClF,MAAM,QAAQ,aAAa,SAAS,cAAc;GAElD,IAAI,UAAU,GAAG;IACf,QAAQ,IAAI,OAAO,MAAM,mCAAmC,CAAC;IAE7D;GACF;GAEA,QAAQ,IACN,OAAO,OACL,OAAO,MAAM,4BACR,aAAa,OAAO,WAAW,cAAc,OAAO,UAC3D,CACF;GAKA,KAAK,MAAM,SAAS,cAClB,QAAQ,IACN,OAAO,OACL,gBAAgB,MAAM,GAAG,WAAW,MAAM,IAAI,SAAS,EAAE,aAC1C,MAAM,IAAI,WAAW,EAAE,cAAc,OAAO,MAAM,IAAI,YAAY,CAAC,GACpF,CACF;GAGF,KAAK,MAAM,SAAS,eAClB,QAAQ,IACN,OAAO,OACL,gBAAgB,MAAM,GAAG,WAAW,MAAM,IAAI,SAAS,EAAE,aAC1C,MAAM,IAAI,WAAW,EAAE,cAAc,OAAO,MAAM,IAAI,YAAY,CAAC,GACpF,CACF;GAGF,IAAI,QAAQ;IACV,QAAQ,IACN,OAAO,KAAK,6EAA6E,CAC3F;IAEA;GACF;GAMA,MAAM,SAAS,MAAM,YAAY,yBAAyB;GAE1D,QAAQ,IACN,OAAO,MACL,aAAa,OAAO,aAAa,uBAC5B,OAAO,cAAc,qDAC5B,CACF;EACF;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"auth-purge-never-expiring-command.mjs","names":[],"sources":["../../../../../../../../packages/auth/src/commands/auth-purge-never-expiring-command.ts"],"sourcesContent":["import { colors } from \"@mongez/copper\";\nimport { command } from \"@warlock.js/core\";\nimport { authService } from \"../services/auth.service\";\n\n/**\n * Register the `auth.purge-never-expiring` CLI command — remediation for the\n * pre-4.12.0 `expiresIn` defect (#25).\n *\n * **Why a command and not a migration.** The rows this removes cannot be\n * selected by a date predicate (an `Invalid Date` compares `false` against\n * every date, so `WHERE expires_at < now()` never matches one) and the\n * definitive signal — a token with no `exp` claim — lives inside the JWT\n * string, not in a column. A migration would also run once, silently, at deploy\n * time; an operator dealing with possibly-leaked credentials needs to *look*\n * first, then act, and to repeat it. Hence `--dry-run`, which is the default\n * posture this command is expected to be run in first.\n *\n * A migration is additionally the wrong shape for a fix that must reach both\n * supported stores: the same row is a different thing in MongoDB and Postgres,\n * and this goes through the models so a registered override\n * (`config.auth.accessToken.model`) is honoured.\n *\n * @example\n * ```bash\n * warlock auth.purge-never-expiring --dry-run # report only\n * warlock auth.purge-never-expiring # report, then delete\n * ```\n */\nexport function registerAuthPurgeNeverExpiringCommand() {\n return command({\n name: \"auth.purge-never-expiring\",\n description:\n \"Find (and delete) token rows that can never expire — an unusable expires_at, or a token with no exp claim\",\n options: [\n {\n text: \"--dry-run\",\n description: \"Report the affected rows without deleting anything\",\n type: \"boolean\",\n },\n ],\n preload: {\n env: true,\n config: [\"auth\", \"database\"],\n connectors: [\"database\"],\n },\n action: async (data: { options?: Record<string, unknown> } = {}) => {\n // Core camelCases flags (`--dry-run` ⇒ `dryRun`); both spellings are read\n // so the command does not depend on that detail staying true.\n //\n // Read fail-safe: the flag counts as set unless it is *explicitly* false\n // (`--dry-run=false`). An operator who asked to look before deleting and\n // got a delete because a flag arrived as `\"true\"` instead of `true` would\n // lose live credentials to a parsing detail.\n const flags = data.options ?? {};\n const flag = flags[\"dryRun\"] ?? flags[\"dry-run\"];\n const dryRun = flag !== undefined && flag !== false && flag !== \"false\";\n\n console.log(colors.cyan(\"🔎 Scanning for tokens that can never expire...\"));\n\n const { accessTokens, refreshTokens } = await authService.findNeverExpiringTokens();\n const total = accessTokens.length + refreshTokens.length;\n\n if (total === 0) {\n console.log(colors.green(\"✅ No never-expiring tokens found.\"));\n\n return;\n }\n\n console.log(\n colors.yellow(\n `⚠️ ${total} never-expiring token(s): ` +\n `${accessTokens.length} access, ${refreshTokens.length} refresh.`,\n ),\n );\n\n // Identify each row so an operator can correlate with their own audit\n // trail before (or after) the rows are gone. The token string itself is\n // never printed — it is a live credential until this command removes it.\n for (const token of accessTokens) {\n console.log(\n colors.yellow(\n ` access id=${token.id} user_id=${token.get(\"user_id\")} ` +\n `user_type=${token.get(\"user_type\")} expires_at=${String(token.get(\"expires_at\"))}`,\n ),\n );\n }\n\n for (const token of refreshTokens) {\n console.log(\n colors.yellow(\n ` refresh id=${token.id} user_id=${token.get(\"user_id\")} ` +\n `user_type=${token.get(\"user_type\")} expires_at=${String(token.get(\"expires_at\"))}`,\n ),\n );\n }\n\n if (dryRun) {\n console.log(\n colors.cyan(\n \"Dry run — nothing deleted. Re-run without --dry-run to revoke these tokens.\",\n ),\n );\n\n return;\n }\n\n // Re-selects rather than deleting the rows just listed: the delete then\n // acts on the table's current state instead of a snapshot taken before\n // the operator read the report. A second full scan is affordable here —\n // this is a one-off remediation, not a request path.\n const purged = await authService.purgeNeverExpiringTokens();\n\n console.log(\n colors.green(\n `✅ Revoked ${purged.accessTokens} access token(s) and ` +\n `${purged.refreshTokens} refresh token(s). Affected users must log in again.`,\n ),\n );\n },\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,SAAgB,wCAAwC;CACtD,OAAO,QAAQ;EACb,MAAM;EACN,aACE;EACF,SAAS,CACP;GACE,MAAM;GACN,aAAa;GACb,MAAM;EACR,CACF;EACA,SAAS;GACP,KAAK;GACL,QAAQ,CAAC,QAAQ,UAAU;GAC3B,YAAY,CAAC,UAAU;EACzB;EACA,QAAQ,OAAO,OAA8C,CAAC,MAAM;GAQlE,MAAM,QAAQ,KAAK,WAAW,CAAC;GAC/B,MAAM,OAAO,MAAM,aAAa,MAAM;GACtC,MAAM,SAAS,SAAS,UAAa,SAAS,SAAS,SAAS;GAEhE,QAAQ,IAAI,OAAO,KAAK,iDAAiD,CAAC;GAE1E,MAAM,EAAE,cAAc,kBAAkB,MAAM,YAAY,wBAAwB;GAClF,MAAM,QAAQ,aAAa,SAAS,cAAc;GAElD,IAAI,UAAU,GAAG;IACf,QAAQ,IAAI,OAAO,MAAM,mCAAmC,CAAC;IAE7D;GACF;GAEA,QAAQ,IACN,OAAO,OACL,OAAO,MAAM,4BACR,aAAa,OAAO,WAAW,cAAc,OAAO,UAC3D,CACF;GAKA,KAAK,MAAM,SAAS,cAClB,QAAQ,IACN,OAAO,OACL,gBAAgB,MAAM,GAAG,WAAW,MAAM,IAAI,SAAS,EAAE,aAC1C,MAAM,IAAI,WAAW,EAAE,cAAc,OAAO,MAAM,IAAI,YAAY,CAAC,GACpF,CACF;GAGF,KAAK,MAAM,SAAS,eAClB,QAAQ,IACN,OAAO,OACL,gBAAgB,MAAM,GAAG,WAAW,MAAM,IAAI,SAAS,EAAE,aAC1C,MAAM,IAAI,WAAW,EAAE,cAAc,OAAO,MAAM,IAAI,YAAY,CAAC,GACpF,CACF;GAGF,IAAI,QAAQ;IACV,QAAQ,IACN,OAAO,KACL,6EACF,CACF;IAEA;GACF;GAMA,MAAM,SAAS,MAAM,YAAY,yBAAyB;GAE1D,QAAQ,IACN,OAAO,MACL,aAAa,OAAO,aAAa,uBAC5B,OAAO,cAAc,qDAC5B,CACF;EACF;CACF,CAAC;AACH"}
@@ -1,5 +1,4 @@
1
1
  //#region ../../packages/auth/src/commands/jwt-secret-generator-command.d.ts
2
- declare function registerJWTSecretGeneratorCommand(): import("@warlock.js/core").CLICommand;
2
+ export declare function registerJWTSecretGeneratorCommand(): import("@warlock.js/core").CLICommand;
3
3
  //#endregion
4
- export { registerJWTSecretGeneratorCommand };
5
4
  //# sourceMappingURL=jwt-secret-generator-command.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jwt-secret-generator-command.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/commands/jwt-secret-generator-command.ts"],"mappings":";iBAGgB,iCAAA,+BAAiC,UAAA"}
1
+ {"version":3,"file":"jwt-secret-generator-command.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/commands/jwt-secret-generator-command.ts"],"mappings":";wBAGgB,gEAAiC"}
@@ -1 +1 @@
1
- {"version":3,"file":"jwt-secret-generator-command.mjs","names":[],"sources":["../../../../../../../../packages/auth/src/commands/jwt-secret-generator-command.ts"],"sourcesContent":["import { command } from \"@warlock.js/core\";\r\nimport { generateJWTSecret } from \"../services/generate-jwt-secret\";\r\n\r\nexport function registerJWTSecretGeneratorCommand() {\r\n return command({\r\n name: \"jwt.generate\",\r\n description: \"Generate JWT Secret key in .env file\",\r\n action: generateJWTSecret,\r\n });\r\n}\r\n"],"mappings":";;;;AAGA,SAAgB,oCAAoC;CAClD,OAAO,QAAQ;EACb,MAAM;EACN,aAAa;EACb,QAAQ;CACV,CAAC;AACH"}
1
+ {"version":3,"file":"jwt-secret-generator-command.mjs","names":[],"sources":["../../../../../../../../packages/auth/src/commands/jwt-secret-generator-command.ts"],"sourcesContent":["import { command } from \"@warlock.js/core\";\nimport { generateJWTSecret } from \"../services/generate-jwt-secret\";\n\nexport function registerJWTSecretGeneratorCommand() {\n return command({\n name: \"jwt.generate\",\n description: \"Generate JWT Secret key in .env file\",\n action: generateJWTSecret,\n });\n}\n"],"mappings":";;;;AAGA,SAAgB,oCAAoC;CAClD,OAAO,QAAQ;EACb,MAAM;EACN,aAAa;EACb,QAAQ;CACV,CAAC;AACH"}
@@ -1,6 +1,5 @@
1
1
  import { AccessTokenOutput, DeviceInfo, TokenPair } from "./types.mjs";
2
2
  import { RefreshToken } from "../models/refresh-token/refresh-token.model.mjs";
3
-
4
3
  //#region ../../packages/auth/src/contracts/auth-contract.d.ts
5
4
  /**
6
5
  * Surface every authenticable user model exposes once it extends the
@@ -10,7 +9,7 @@ import { RefreshToken } from "../models/refresh-token/refresh-token.model.mjs";
10
9
  * Kept in sync with `Auth` — if a method here drifts from the class, the
11
10
  * `implements Authenticable` clause on `Auth` fails to compile.
12
11
  */
13
- interface Authenticable {
12
+ export interface Authenticable {
14
13
  /**
15
14
  * Discriminator identifying which user type this model represents.
16
15
  * Drives token payloads and `authMiddleware` type checks.
@@ -36,5 +35,4 @@ interface Authenticable {
36
35
  confirmPassword(password: string): Promise<boolean>;
37
36
  }
38
37
  //#endregion
39
- export { Authenticable };
40
38
  //# sourceMappingURL=auth-contract.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth-contract.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/contracts/auth-contract.ts"],"mappings":";;;;;;AAWA;;;;;;UAAiB,aAAA;EAiBwC;;;;EAAA,IAZnD,QAAA;EAsB+B;;;;EAhBnC,mBAAA,CAAoB,OAAA,GAAU,MAAA,oBAA0B,OAAA,CAAQ,iBAAA;EAAlC;;;;EAM9B,oBAAA,CAAqB,UAAA,GAAa,UAAA,GAAa,OAAA,CAAQ,YAAA;EAArB;;;EAKlC,eAAA,CAAgB,UAAA,GAAa,UAAA,GAAa,OAAA,CAAQ,SAAA;EAAlD;;;EAKA,eAAA,CAAgB,QAAA,WAAmB,OAAA;AAAA"}
1
+ {"version":3,"file":"auth-contract.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/contracts/auth-contract.ts"],"mappings":";;;;;;;;;;;iBAWiB;;;;;MAKX;;;;;EAMJ,oBAAoB,UAAU,0BAA0B,QAAQ;;;;;EAMhE,qBAAqB,aAAa,aAAa,QAAQ;;;;EAKvD,gBAAgB,aAAa,aAAa,QAAQ;;;;EAKlD,gBAAgB,mBAAmB"}
@@ -1,4 +1,5 @@
1
1
  import { AppleProviderConfig, AuthProvider, DiscordProviderConfig, FacebookProviderConfig, GitHubProviderConfig, GoogleProviderConfig, LinkedInProviderConfig, OtpConfig, OtpMessage, OtpSender, PasskeysConfig, ProviderAuthorizationState, ProviderCallbackParams, ProviderProfile, ProviderUserCreator, ProvidersConfig, XProviderConfig } from "./providers.mjs";
2
2
  import { AccessTokenConfig, AccessTokenOutput, AuthConfigurations, AuthCredentialDescriptor, AuthCredentials, AuthMiddlewareOptions, AuthNotification, AuthRefreshCredentialDescriptor, CanAuthenticate, ClearAuthCookieOptions, CookieAuthConfig, CookieDomainResolver, CsrfConfig, DeviceInfo, EmailVerificationConfig, LegacyJwtConfig, LoginResult, LogoutWithoutTokenBehavior, NO_EXPIRATION, OneTimeTokenConfig, OneTimeTokenNotificationData, OneTimeTokenUrlBuilder, PageAuthConfig, PasswordResetConfig, PasswordSetter, RefreshTokenConfig, SetAuthCookieOptions, TokenFrom, TokenPair } from "./types.mjs";
3
3
  import { Authenticable } from "./auth-contract.mjs";
4
- import { RequestUser } from "./request-locals.mjs";
4
+ import { RequestUser } from "./request-locals.mjs";
5
+ export { AccessTokenConfig, AccessTokenOutput, AppleProviderConfig, AuthConfigurations, AuthCredentialDescriptor, AuthCredentials, AuthMiddlewareOptions, AuthNotification, AuthProvider, AuthRefreshCredentialDescriptor, Authenticable, CanAuthenticate, ClearAuthCookieOptions, CookieAuthConfig, CookieDomainResolver, CsrfConfig, DeviceInfo, DiscordProviderConfig, EmailVerificationConfig, FacebookProviderConfig, GitHubProviderConfig, GoogleProviderConfig, LegacyJwtConfig, LinkedInProviderConfig, LoginResult, LogoutWithoutTokenBehavior, NO_EXPIRATION, OneTimeTokenConfig, OneTimeTokenNotificationData, OneTimeTokenUrlBuilder, OtpConfig, OtpMessage, OtpSender, PageAuthConfig, PasskeysConfig, PasswordResetConfig, PasswordSetter, ProviderAuthorizationState, ProviderCallbackParams, ProviderProfile, ProviderUserCreator, ProvidersConfig, RefreshTokenConfig, RequestUser, SetAuthCookieOptions, TokenFrom, TokenPair, XProviderConfig };
@@ -1,12 +1,11 @@
1
1
  import { Auth } from "../models/auth.model.mjs";
2
2
  import { ChildModel } from "@warlock.js/cascade";
3
-
4
3
  //#region ../../packages/auth/src/contracts/providers.d.ts
5
4
  /**
6
5
  * The per-login secrets a redirect provider round-trips: `state` (CSRF),
7
6
  * `nonce` (id_token replay binding) and the PKCE `codeVerifier`.
8
7
  */
9
- type ProviderAuthorizationState = {
8
+ export type ProviderAuthorizationState = {
10
9
  state: string;
11
10
  nonce: string;
12
11
  codeVerifier: string;
@@ -16,18 +15,22 @@ type ProviderAuthorizationState = {
16
15
  * callback query and the state that was stored when the login started. The
17
16
  * caller has already checked `query.state` against `expected.state`.
18
17
  */
19
- type ProviderCallbackParams = {
18
+ export type ProviderCallbackParams = {
20
19
  query: Record<string, unknown>;
21
20
  expected: ProviderAuthorizationState;
22
21
  };
23
22
  /** The identity a provider asserts, normalized across providers. */
24
- type ProviderProfile = {
25
- /** Provider name, e.g. `"google"`. */provider: string; /** The provider's stable user id (`sub`). The link key — never the email. */
23
+ export type ProviderProfile = {
24
+ /** Provider name, e.g. `"google"`. */
25
+ provider: string;
26
+ /** The provider's stable user id (`sub`). The link key — never the email. */
26
27
  providerUserId: string;
27
- email?: string; /** Whether the PROVIDER verified `email`. Accounts are never linked on `false`. */
28
+ email?: string;
29
+ /** Whether the PROVIDER verified `email`. Accounts are never linked on `false`. */
28
30
  emailVerified: boolean;
29
31
  name?: string;
30
- avatar?: string; /** The verified claims the profile was built from. */
32
+ avatar?: string;
33
+ /** The verified claims the profile was built from. */
31
34
  raw: Record<string, unknown>;
32
35
  };
33
36
  /**
@@ -35,7 +38,7 @@ type ProviderProfile = {
35
38
  * Register an instance under `auth.providers.custom.<name>` to add one auth does
36
39
  * not ship.
37
40
  */
38
- interface AuthProvider {
41
+ export interface AuthProvider {
39
42
  readonly name: string;
40
43
  /**
41
44
  * How the provider's callback arrives. `"query"` (default) is a top-level
@@ -51,60 +54,78 @@ interface AuthProvider {
51
54
  handleCallback(params: ProviderCallbackParams): Promise<ProviderProfile>;
52
55
  }
53
56
  /** `auth.providers.google`. */
54
- type GoogleProviderConfig = {
57
+ export type GoogleProviderConfig = {
55
58
  clientId: string;
56
- clientSecret: string; /** Must exactly match a redirect URI registered in the Google console. */
57
- redirectUri: string; /** @default ["openid", "email", "profile"] */
59
+ clientSecret: string;
60
+ /** Must exactly match a redirect URI registered in the Google console. */
61
+ redirectUri: string;
62
+ /** @default ["openid", "email", "profile"] */
58
63
  scopes?: string[];
59
64
  };
60
65
  /** `auth.providers.github`. */
61
- type GitHubProviderConfig = {
66
+ export type GitHubProviderConfig = {
62
67
  clientId: string;
63
- clientSecret: string; /** Must exactly match the "Authorization callback URL" registered on the GitHub OAuth App. */
64
- redirectUri: string; /** @default ["read:user", "user:email"] */
68
+ clientSecret: string;
69
+ /** Must exactly match the "Authorization callback URL" registered on the GitHub OAuth App. */
70
+ redirectUri: string;
71
+ /** @default ["read:user", "user:email"] */
65
72
  scopes?: string[];
66
73
  };
67
74
  /** `auth.providers.discord`. */
68
- type DiscordProviderConfig = {
75
+ export type DiscordProviderConfig = {
69
76
  clientId: string;
70
- clientSecret: string; /** Must exactly match a redirect registered on the Discord application. */
71
- redirectUri: string; /** @default ["identify", "email"] */
77
+ clientSecret: string;
78
+ /** Must exactly match a redirect registered on the Discord application. */
79
+ redirectUri: string;
80
+ /** @default ["identify", "email"] */
72
81
  scopes?: string[];
73
82
  };
74
83
  /** `auth.providers.linkedin`. */
75
- type LinkedInProviderConfig = {
84
+ export type LinkedInProviderConfig = {
76
85
  clientId: string;
77
- clientSecret: string; /** Must exactly match a redirect URL registered on the LinkedIn app. */
78
- redirectUri: string; /** @default ["openid", "profile", "email"] */
86
+ clientSecret: string;
87
+ /** Must exactly match a redirect URL registered on the LinkedIn app. */
88
+ redirectUri: string;
89
+ /** @default ["openid", "profile", "email"] */
79
90
  scopes?: string[];
80
91
  };
81
92
  /** `auth.providers.apple`. */
82
- type AppleProviderConfig = {
83
- /** The Services ID (or app id) registered with Sign in with Apple. */clientId: string; /** The Apple Developer team id — signed into the client-secret JWT as `iss`. */
84
- teamId: string; /** The id of the private key created for Sign in with Apple — signed into the client-secret JWT header as `kid`. */
85
- keyId: string; /** The PKCS8 PEM contents of that private key (`.p8` file), used to sign the client-secret JWT. */
86
- privateKey: string; /** Must exactly match a return URL registered on the Services ID. */
87
- redirectUri: string; /** @default ["name", "email"] */
93
+ export type AppleProviderConfig = {
94
+ /** The Services ID (or app id) registered with Sign in with Apple. */
95
+ clientId: string;
96
+ /** The Apple Developer team id — signed into the client-secret JWT as `iss`. */
97
+ teamId: string;
98
+ /** The id of the private key created for Sign in with Apple — signed into the client-secret JWT header as `kid`. */
99
+ keyId: string;
100
+ /** The PKCS8 PEM contents of that private key (`.p8` file), used to sign the client-secret JWT. */
101
+ privateKey: string;
102
+ /** Must exactly match a return URL registered on the Services ID. */
103
+ redirectUri: string;
104
+ /** @default ["name", "email"] */
88
105
  scopes?: string[];
89
106
  };
90
107
  /** `auth.providers.facebook`. */
91
- type FacebookProviderConfig = {
108
+ export type FacebookProviderConfig = {
92
109
  clientId: string;
93
- clientSecret: string; /** Must exactly match a valid OAuth redirect URI registered on the Facebook app. */
94
- redirectUri: string; /** @default ["email", "public_profile"] */
110
+ clientSecret: string;
111
+ /** Must exactly match a valid OAuth redirect URI registered on the Facebook app. */
112
+ redirectUri: string;
113
+ /** @default ["email", "public_profile"] */
95
114
  scopes?: string[];
96
115
  };
97
116
  /** `auth.providers.x`. */
98
- type XProviderConfig = {
117
+ export type XProviderConfig = {
99
118
  clientId: string;
100
- clientSecret: string; /** Must exactly match a callback URI registered on the X app (confidential client). */
101
- redirectUri: string; /** @default ["tweet.read", "users.read"] */
119
+ clientSecret: string;
120
+ /** Must exactly match a callback URI registered on the X app (confidential client). */
121
+ redirectUri: string;
122
+ /** @default ["tweet.read", "users.read"] */
102
123
  scopes?: string[];
103
124
  };
104
125
  /** Creates the app user for a verified provider profile with no matching account. */
105
- type ProviderUserCreator = (profile: ProviderProfile, Model: ChildModel<Auth>) => Auth | Promise<Auth>;
126
+ export type ProviderUserCreator = (profile: ProviderProfile, Model: ChildModel<Auth>) => Auth | Promise<Auth>;
106
127
  /** `auth.providers`. */
107
- type ProvidersConfig = {
128
+ export type ProvidersConfig = {
108
129
  google?: GoogleProviderConfig;
109
130
  github?: GitHubProviderConfig;
110
131
  discord?: DiscordProviderConfig;
@@ -116,44 +137,55 @@ type ProvidersConfig = {
116
137
  * User attribute a verified provider email is matched against.
117
138
  * @default "email"
118
139
  */
119
- emailField?: string; /** Replace the default user creation (`{ email, name, <verification.field>: now }`). */
120
- createUser?: ProviderUserCreator; /** Providers auth does not ship, by name. */
140
+ emailField?: string;
141
+ /** Replace the default user creation (`{ email, name, <verification.field>: now }`). */
142
+ createUser?: ProviderUserCreator;
143
+ /** Providers auth does not ship, by name. */
121
144
  custom?: Record<string, AuthProvider>;
122
145
  };
123
146
  /** `auth.passkeys`. */
124
- type PasskeysConfig = {
125
- /** Relying-party id — the site's registrable domain, e.g. `"example.com"`. */rpID: string; /** Name shown by the authenticator. */
126
- rpName: string; /** Exact origin(s) the browser ceremony runs on, e.g. `"https://example.com"`. */
147
+ export type PasskeysConfig = {
148
+ /** Relying-party id — the site's registrable domain, e.g. `"example.com"`. */
149
+ rpID: string;
150
+ /** Name shown by the authenticator. */
151
+ rpName: string;
152
+ /** Exact origin(s) the browser ceremony runs on, e.g. `"https://example.com"`. */
127
153
  origin: string | string[];
128
154
  /**
129
155
  * Challenge lifetime — a positive `ms` duration string.
130
156
  * @default "5m"
131
157
  */
132
- challengeExpiresIn?: string; /** Account name shown by the authenticator. @default user email, else id */
158
+ challengeExpiresIn?: string;
159
+ /** Account name shown by the authenticator. @default user email, else id */
133
160
  userName?: (user: Auth) => string;
134
161
  };
135
162
  /** Data an OTP delivery receives. */
136
- type OtpMessage = {
137
- /** Ready-to-send text containing the code. */body: string;
163
+ export type OtpMessage = {
164
+ /** Ready-to-send text containing the code. */
165
+ body: string;
138
166
  code: string;
139
167
  expiresAt: Date;
140
168
  };
141
169
  /** Delivers an OTP. Replaces the default `notify.channel(channel).send(phone, message)`. */
142
- type OtpSender = (phone: string, message: OtpMessage, channel: string) => unknown;
170
+ export type OtpSender = (phone: string, message: OtpMessage, channel: string) => unknown;
143
171
  /** `auth.otp`. */
144
- type OtpConfig = {
172
+ export type OtpConfig = {
145
173
  /**
146
174
  * Notifications channel the code is sent through. The app registers it
147
175
  * (auth ships no SMS/WhatsApp driver).
148
176
  * @default "sms"
149
177
  */
150
- channel?: string; /** User attribute holding the phone number. @default "phone" */
151
- phoneField?: string; /** Code lifetime. @default "5m" */
152
- expiresIn?: string; /** Verify attempts before the code is invalidated. @default 5 */
153
- maxAttempts?: number; /** Build the message text. @default "Your verification code is <code>" */
154
- message?: (code: string) => string; /** Replace delivery entirely. */
178
+ channel?: string;
179
+ /** User attribute holding the phone number. @default "phone" */
180
+ phoneField?: string;
181
+ /** Code lifetime. @default "5m" */
182
+ expiresIn?: string;
183
+ /** Verify attempts before the code is invalidated. @default 5 */
184
+ maxAttempts?: number;
185
+ /** Build the message text. @default "Your verification code is <code>" */
186
+ message?: (code: string) => string;
187
+ /** Replace delivery entirely. */
155
188
  send?: OtpSender;
156
189
  };
157
190
  //#endregion
158
- export { AppleProviderConfig, AuthProvider, DiscordProviderConfig, FacebookProviderConfig, GitHubProviderConfig, GoogleProviderConfig, LinkedInProviderConfig, OtpConfig, OtpMessage, OtpSender, PasskeysConfig, ProviderAuthorizationState, ProviderCallbackParams, ProviderProfile, ProviderUserCreator, ProvidersConfig, XProviderConfig };
159
191
  //# sourceMappingURL=providers.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"providers.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/contracts/providers.ts"],"mappings":";;;;;;AAOA;;KAAY,0BAAA;EACV,KAAA;EACA,KAAA;EACA,YAAA;AAAA;;AAAY;AAQd;;;KAAY,sBAAA;EACV,KAAA,EAAO,MAAA;EACP,QAAA,EAAU,0BAA0B;AAAA;;KAI1B,eAAA;EAJ0B,sCAMpC,QAAA,UAFyB;EAIzB,cAAA;EACA,KAAA,WAHA;EAKA,aAAA;EACA,IAAA;EACA,MAAA,WADA;EAGA,GAAA,EAAK,MAAM;AAAA;;;AAAA;AAQb;;UAAiB,YAAA;EAAA,SACN,IAAA;EAUqD;;;;;;;EAAA,SAFrD,YAAA;EAET;EAAA,gBAAA,CAAiB,KAAA,EAAO,0BAAA,YAAsC,OAAA;EAA7C;EAEjB,cAAA,CAAe,MAAA,EAAQ,sBAAA,GAAyB,OAAA,CAAQ,eAAA;AAAA;;KAI9C,oBAAA;EACV,QAAA;EACA,YAAA,UANuE;EAQvE,WAAA,UAJU;EAMV,MAAA;AAAA;;KAIU,oBAAA;EACV,QAAA;EACA,YAAA,UANA;EAQA,WAAA,UARM;EAUN,MAAA;AAAA;;KAIU,qBAAA;EACV,QAAA;EACA,YAAA,UARA;EAUA,WAAA,UARM;EAUN,MAAA;AAAA;;KAIU,sBAAA;EACV,QAAA;EACA,YAAA,UAVA;EAYA,WAAA,UARA;EAUA,MAAA;AAAA;AANF;AAAA,KAUY,mBAAA;wEAEV,QAAA,UAXA;EAaA,MAAA,UAVA;EAYA,KAAA,UAVM;EAYN,UAAA,UARU;EAUV,WAAA;EAEA,MAAA;AAAA;;KAIU,sBAAA;EACV,QAAA;EACA,YAAA,UANA;EAQA,WAAA,UARM;EAUN,MAAA;AAAA;;KAIU,eAAA;EACV,QAAA;EACA,YAAA,UARA;EAUA,WAAA,UARM;EAUN,MAAA;AAAA;;KAIU,mBAAA,IACV,OAAA,EAAS,eAAA,EACT,KAAA,EAAO,UAAA,CAAW,IAAA,MACf,IAAA,GAAO,OAAA,CAAQ,IAAA;;KAGR,eAAA;EACV,MAAA,GAAS,oBAAA;EACT,MAAA,GAAS,oBAAA;EACT,OAAA,GAAU,qBAAA;EACV,QAAA,GAAW,sBAAA;EACX,KAAA,GAAQ,mBAAA;EACR,QAAA,GAAW,sBAAA;EACX,CAAA,GAAI,eAAA;;;;;EAKJ,UAAA,WAfkB;EAiBlB,UAAA,GAAa,mBAAA,EAjBI;EAmBjB,MAAA,GAAS,MAAA,SAAe,YAAA;AAAA;;KAId,cAAA;EAxBQ,8EA0BlB,IAAA,UAzBG;EA2BH,MAAA,UA3BkB;EA6BlB,MAAA;EA7BsB;AAGxB;;;EA+BE,kBAAA,WA7BS;EA+BT,QAAA,IAAY,IAAA,EAAM,IAAI;AAAA;;KAIZ,UAAA;EA9BN,8CAgCJ,IAAA;EACA,IAAA;EACA,SAAA,EAAW,IAAI;AAAA;;KAIL,SAAA,IAAa,KAAA,UAAe,OAAA,EAAS,UAAU,EAAE,OAAA;;KAGjD,SAAA;EA9CD;;;;;EAoDT,OAAA,WAjDQ;EAmDR,UAAA,WAlDW;EAoDX,SAAA,WAnDI;EAqDJ,WAAA,WA9CA;EAgDA,OAAA,IAAW,IAAA,qBA9CX;EAgDA,IAAA,GAAO,SAAS;AAAA"}
1
+ {"version":3,"file":"providers.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/contracts/providers.ts"],"mappings":";;;;;;;YAOY;EACV;EACA;EACA;;;;;;;YAQU;EACV,OAAO;EACP,UAAU;;;YAIA;;EAEV;;EAEA;EACA;;EAEA;EACA;EACA;;EAEA,KAAK;;;;;;;iBAQU;WACN;;;;;;;;WAQA;;EAET,iBAAiB,OAAO,sCAAsC;;EAE9D,eAAe,QAAQ,yBAAyB,QAAQ;;;YAI9C;EACV;EACA;;EAEA;;EAEA;;;YAIU;EACV;EACA;;EAEA;;EAEA;;;YAIU;EACV;EACA;;EAEA;;EAEA;;;YAIU;EACV;EACA;;EAEA;;EAEA;;;YAIU;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;YAIU;EACV;EACA;;EAEA;;EAEA;;;YAIU;EACV;EACA;;EAEA;;EAEA;;;YAIU,uBACV,SAAS,iBACT,OAAO,WAAW,UACf,OAAO,QAAQ;;YAGR;EACV,SAAS;EACT,SAAS;EACT,UAAU;EACV,WAAW;EACX,QAAQ;EACR,WAAW;EACX,IAAI;;;;;EAKJ;;EAEA,aAAa;;EAEb,SAAS,eAAe;;;YAId;;EAEV;;EAEA;;EAEA;;;;;EAKA;;EAEA,YAAY,MAAM;;;YAIR;;EAEV;EACA;EACA,WAAW;;;YAID,aAAa,eAAe,SAAS,YAAY;;YAGjD;;;;;;EAMV;;EAEA;;EAEA;;EAEA;;EAEA,WAAW;;EAEX,OAAO"}
@@ -24,7 +24,7 @@
24
24
  * would fail to compile (TS2320). See `access/src/middleware/gate.middleware.ts`
25
25
  * for the same hazard documented at its call site.
26
26
  */
27
- interface RequestUser {}
27
+ export interface RequestUser {}
28
28
  /**
29
29
  * Augments core's `RequestLocals` (`request.locals`) with the `user` key —
30
30
  * done in the module that OWNS the key, per `RequestLocals`' own contract
@@ -42,7 +42,6 @@ declare module "@warlock.js/core" {
42
42
  */
43
43
  session?: Promise<any>;
44
44
  }
45
- } //# sourceMappingURL=request-locals.d.ts.map
45
+ }
46
46
  //#endregion
47
- export { RequestUser };
48
47
  //# sourceMappingURL=request-locals.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"request-locals.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/contracts/request-locals.ts"],"mappings":";;AAyBA;;;;AAA4B;AAAG;;;;;;;;;;;AAiBV;;;;;;;;UAjBJ,WAAA;;;;;;;;;;YAWL,aAAA;IACR,IAAA,GAAO,WAAA;;;;;IAKP,OAAA,GAAU,OAAO;EAAA;AAAA"}
1
+ {"version":3,"file":"request-locals.d.mts","names":[],"sources":["../../../../../../../../packages/auth/src/contracts/request-locals.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;iBAyBiB;;;;;;;;;;YAWL;IACR,OAAO;;;;;IAKP,UAAU"}