@robelest/convex-auth 0.0.4-preview.21 → 0.0.4-preview.23

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 (310) hide show
  1. package/dist/authorization/index.d.ts +1 -1
  2. package/dist/authorization/index.js +1 -1
  3. package/dist/authorization/index.js.map +1 -1
  4. package/dist/client/index.d.ts +1 -2
  5. package/dist/client/index.d.ts.map +1 -1
  6. package/dist/client/index.js +36 -39
  7. package/dist/client/index.js.map +1 -1
  8. package/dist/component/client/index.d.ts +1 -2
  9. package/dist/component/convex.config.d.ts +2 -2
  10. package/dist/component/convex.config.d.ts.map +1 -1
  11. package/dist/component/model.d.ts +5 -5
  12. package/dist/component/model.d.ts.map +1 -1
  13. package/dist/component/public/enterprise/audit.d.ts.map +1 -1
  14. package/dist/component/public/enterprise/audit.js.map +1 -1
  15. package/dist/component/public/enterprise/core.d.ts.map +1 -1
  16. package/dist/component/public/enterprise/core.js.map +1 -1
  17. package/dist/component/public/enterprise/domains.d.ts.map +1 -1
  18. package/dist/component/public/enterprise/domains.js.map +1 -1
  19. package/dist/component/public/enterprise/scim.d.ts.map +1 -1
  20. package/dist/component/public/enterprise/scim.js.map +1 -1
  21. package/dist/component/public/enterprise/secrets.d.ts.map +1 -1
  22. package/dist/component/public/enterprise/secrets.js.map +1 -1
  23. package/dist/component/public/enterprise/webhooks.d.ts.map +1 -1
  24. package/dist/component/public/enterprise/webhooks.js.map +1 -1
  25. package/dist/component/public/factors/devices.d.ts.map +1 -1
  26. package/dist/component/public/factors/devices.js.map +1 -1
  27. package/dist/component/public/factors/passkeys.d.ts.map +1 -1
  28. package/dist/component/public/factors/passkeys.js.map +1 -1
  29. package/dist/component/public/factors/totp.d.ts.map +1 -1
  30. package/dist/component/public/factors/totp.js.map +1 -1
  31. package/dist/component/public/groups/core.js.map +1 -1
  32. package/dist/component/public/groups/invites.d.ts.map +1 -1
  33. package/dist/component/public/groups/invites.js.map +1 -1
  34. package/dist/component/public/groups/members.d.ts.map +1 -1
  35. package/dist/component/public/groups/members.js.map +1 -1
  36. package/dist/component/public/identity/accounts.d.ts.map +1 -1
  37. package/dist/component/public/identity/accounts.js.map +1 -1
  38. package/dist/component/public/identity/codes.d.ts.map +1 -1
  39. package/dist/component/public/identity/codes.js.map +1 -1
  40. package/dist/component/public/identity/sessions.d.ts.map +1 -1
  41. package/dist/component/public/identity/sessions.js.map +1 -1
  42. package/dist/component/public/identity/tokens.d.ts.map +1 -1
  43. package/dist/component/public/identity/tokens.js.map +1 -1
  44. package/dist/component/public/identity/users.d.ts.map +1 -1
  45. package/dist/component/public/identity/users.js.map +1 -1
  46. package/dist/component/public/identity/verifiers.d.ts.map +1 -1
  47. package/dist/component/public/identity/verifiers.js.map +1 -1
  48. package/dist/component/public/security/keys.d.ts.map +1 -1
  49. package/dist/component/public/security/keys.js.map +1 -1
  50. package/dist/component/public/security/limits.d.ts.map +1 -1
  51. package/dist/component/public/security/limits.js.map +1 -1
  52. package/dist/component/schema.d.ts +39 -39
  53. package/dist/component/server/auth.d.ts +95 -52
  54. package/dist/component/server/auth.d.ts.map +1 -1
  55. package/dist/component/server/auth.js +63 -43
  56. package/dist/component/server/auth.js.map +1 -1
  57. package/dist/component/server/core.js +116 -235
  58. package/dist/component/server/core.js.map +1 -1
  59. package/dist/component/server/crypto.js +25 -7
  60. package/dist/component/server/crypto.js.map +1 -1
  61. package/dist/component/server/device.js +58 -15
  62. package/dist/component/server/device.js.map +1 -1
  63. package/dist/component/server/enterprise/domain.js +148 -59
  64. package/dist/component/server/enterprise/domain.js.map +1 -1
  65. package/dist/component/server/enterprise/http.js +36 -15
  66. package/dist/component/server/enterprise/http.js.map +1 -1
  67. package/dist/component/server/enterprise/oidc.js +1 -1
  68. package/dist/component/server/http.js +26 -21
  69. package/dist/component/server/http.js.map +1 -1
  70. package/dist/component/server/identity.js +5 -2
  71. package/dist/component/server/identity.js.map +1 -1
  72. package/dist/component/server/limits.js +21 -30
  73. package/dist/component/server/limits.js.map +1 -1
  74. package/dist/component/server/mutations/account.js +12 -10
  75. package/dist/component/server/mutations/account.js.map +1 -1
  76. package/dist/component/server/mutations/code.js +5 -2
  77. package/dist/component/server/mutations/code.js.map +1 -1
  78. package/dist/component/server/mutations/invalidate.js +1 -1
  79. package/dist/component/server/mutations/invalidate.js.map +1 -1
  80. package/dist/component/server/mutations/oauth.js +10 -4
  81. package/dist/component/server/mutations/oauth.js.map +1 -1
  82. package/dist/component/server/mutations/refresh.js +2 -2
  83. package/dist/component/server/mutations/refresh.js.map +1 -1
  84. package/dist/component/server/mutations/register.js +46 -42
  85. package/dist/component/server/mutations/register.js.map +1 -1
  86. package/dist/component/server/mutations/retrieve.js +21 -25
  87. package/dist/component/server/mutations/retrieve.js.map +1 -1
  88. package/dist/component/server/mutations/signature.js +10 -4
  89. package/dist/component/server/mutations/signature.js.map +1 -1
  90. package/dist/component/server/mutations/signout.js.map +1 -1
  91. package/dist/component/server/mutations/store.js +9 -24
  92. package/dist/component/server/mutations/store.js.map +1 -1
  93. package/dist/component/server/mutations/verifier.js.map +1 -1
  94. package/dist/component/server/mutations/verify.js +1 -1
  95. package/dist/component/server/mutations/verify.js.map +1 -1
  96. package/dist/component/server/oauth.js +53 -16
  97. package/dist/component/server/oauth.js.map +1 -1
  98. package/dist/component/server/passkey.js +115 -31
  99. package/dist/component/server/passkey.js.map +1 -1
  100. package/dist/component/server/redirects.js +9 -3
  101. package/dist/component/server/redirects.js.map +1 -1
  102. package/dist/component/server/refresh.js +10 -7
  103. package/dist/component/server/refresh.js.map +1 -1
  104. package/dist/component/server/runtime.d.ts +3 -3
  105. package/dist/component/server/runtime.d.ts.map +1 -1
  106. package/dist/component/server/runtime.js +62 -20
  107. package/dist/component/server/runtime.js.map +1 -1
  108. package/dist/component/server/signin.js +34 -10
  109. package/dist/component/server/signin.js.map +1 -1
  110. package/dist/component/server/totp.js +79 -19
  111. package/dist/component/server/totp.js.map +1 -1
  112. package/dist/component/server/types.d.ts +12 -20
  113. package/dist/component/server/types.d.ts.map +1 -1
  114. package/dist/component/server/types.js.map +1 -1
  115. package/dist/component/server/users.js +6 -3
  116. package/dist/component/server/users.js.map +1 -1
  117. package/dist/component/server/utils.js +10 -4
  118. package/dist/component/server/utils.js.map +1 -1
  119. package/dist/core/types.d.ts +14 -22
  120. package/dist/core/types.d.ts.map +1 -1
  121. package/dist/factors/device.js +8 -9
  122. package/dist/factors/device.js.map +1 -1
  123. package/dist/factors/passkey.js +18 -21
  124. package/dist/factors/passkey.js.map +1 -1
  125. package/dist/providers/password.js +66 -81
  126. package/dist/providers/password.js.map +1 -1
  127. package/dist/runtime/invite.js +2 -8
  128. package/dist/runtime/invite.js.map +1 -1
  129. package/dist/server/auth.d.ts +95 -52
  130. package/dist/server/auth.d.ts.map +1 -1
  131. package/dist/server/auth.js +63 -43
  132. package/dist/server/auth.js.map +1 -1
  133. package/dist/server/core.d.ts +71 -159
  134. package/dist/server/core.d.ts.map +1 -1
  135. package/dist/server/core.js +116 -235
  136. package/dist/server/core.js.map +1 -1
  137. package/dist/server/crypto.d.ts.map +1 -1
  138. package/dist/server/crypto.js +25 -7
  139. package/dist/server/crypto.js.map +1 -1
  140. package/dist/server/device.js +58 -15
  141. package/dist/server/device.js.map +1 -1
  142. package/dist/server/enterprise/domain.d.ts +0 -8
  143. package/dist/server/enterprise/domain.d.ts.map +1 -1
  144. package/dist/server/enterprise/domain.js +148 -59
  145. package/dist/server/enterprise/domain.js.map +1 -1
  146. package/dist/server/enterprise/http.d.ts.map +1 -1
  147. package/dist/server/enterprise/http.js +35 -14
  148. package/dist/server/enterprise/http.js.map +1 -1
  149. package/dist/server/http.d.ts +2 -2
  150. package/dist/server/http.d.ts.map +1 -1
  151. package/dist/server/http.js +25 -20
  152. package/dist/server/http.js.map +1 -1
  153. package/dist/server/identity.js +5 -2
  154. package/dist/server/identity.js.map +1 -1
  155. package/dist/server/index.d.ts +2 -2
  156. package/dist/server/limits.js +21 -30
  157. package/dist/server/limits.js.map +1 -1
  158. package/dist/server/mounts.d.ts +26 -64
  159. package/dist/server/mounts.d.ts.map +1 -1
  160. package/dist/server/mounts.js +45 -106
  161. package/dist/server/mounts.js.map +1 -1
  162. package/dist/server/mutations/account.d.ts +8 -9
  163. package/dist/server/mutations/account.d.ts.map +1 -1
  164. package/dist/server/mutations/account.js +11 -9
  165. package/dist/server/mutations/account.js.map +1 -1
  166. package/dist/server/mutations/code.d.ts +13 -13
  167. package/dist/server/mutations/code.d.ts.map +1 -1
  168. package/dist/server/mutations/code.js +5 -2
  169. package/dist/server/mutations/code.js.map +1 -1
  170. package/dist/server/mutations/invalidate.d.ts +4 -4
  171. package/dist/server/mutations/invalidate.d.ts.map +1 -1
  172. package/dist/server/mutations/invalidate.js.map +1 -1
  173. package/dist/server/mutations/oauth.d.ts +12 -10
  174. package/dist/server/mutations/oauth.d.ts.map +1 -1
  175. package/dist/server/mutations/oauth.js +9 -3
  176. package/dist/server/mutations/oauth.js.map +1 -1
  177. package/dist/server/mutations/refresh.d.ts +3 -3
  178. package/dist/server/mutations/refresh.d.ts.map +1 -1
  179. package/dist/server/mutations/refresh.js +1 -1
  180. package/dist/server/mutations/refresh.js.map +1 -1
  181. package/dist/server/mutations/register.d.ts +11 -11
  182. package/dist/server/mutations/register.d.ts.map +1 -1
  183. package/dist/server/mutations/register.js +45 -41
  184. package/dist/server/mutations/register.js.map +1 -1
  185. package/dist/server/mutations/retrieve.d.ts +6 -6
  186. package/dist/server/mutations/retrieve.d.ts.map +1 -1
  187. package/dist/server/mutations/retrieve.js +20 -24
  188. package/dist/server/mutations/retrieve.js.map +1 -1
  189. package/dist/server/mutations/signature.d.ts +6 -7
  190. package/dist/server/mutations/signature.d.ts.map +1 -1
  191. package/dist/server/mutations/signature.js +9 -3
  192. package/dist/server/mutations/signature.js.map +1 -1
  193. package/dist/server/mutations/signin.d.ts +5 -5
  194. package/dist/server/mutations/signin.d.ts.map +1 -1
  195. package/dist/server/mutations/signout.js.map +1 -1
  196. package/dist/server/mutations/store.d.ts +97 -97
  197. package/dist/server/mutations/store.d.ts.map +1 -1
  198. package/dist/server/mutations/store.js +8 -23
  199. package/dist/server/mutations/store.js.map +1 -1
  200. package/dist/server/mutations/verifier.js.map +1 -1
  201. package/dist/server/mutations/verify.d.ts +10 -10
  202. package/dist/server/mutations/verify.d.ts.map +1 -1
  203. package/dist/server/mutations/verify.js.map +1 -1
  204. package/dist/server/oauth.js +53 -16
  205. package/dist/server/oauth.js.map +1 -1
  206. package/dist/server/passkey.d.ts +2 -2
  207. package/dist/server/passkey.d.ts.map +1 -1
  208. package/dist/server/passkey.js +114 -30
  209. package/dist/server/passkey.js.map +1 -1
  210. package/dist/server/redirects.js +9 -3
  211. package/dist/server/redirects.js.map +1 -1
  212. package/dist/server/refresh.js +10 -7
  213. package/dist/server/refresh.js.map +1 -1
  214. package/dist/server/runtime.d.ts +14 -14
  215. package/dist/server/runtime.d.ts.map +1 -1
  216. package/dist/server/runtime.js +61 -19
  217. package/dist/server/runtime.js.map +1 -1
  218. package/dist/server/signin.js +34 -10
  219. package/dist/server/signin.js.map +1 -1
  220. package/dist/server/ssr.d.ts.map +1 -1
  221. package/dist/server/ssr.js +175 -184
  222. package/dist/server/ssr.js.map +1 -1
  223. package/dist/server/totp.js +78 -18
  224. package/dist/server/totp.js.map +1 -1
  225. package/dist/server/types.d.ts +13 -21
  226. package/dist/server/types.d.ts.map +1 -1
  227. package/dist/server/types.js.map +1 -1
  228. package/dist/server/users.js +6 -3
  229. package/dist/server/users.js.map +1 -1
  230. package/dist/server/utils.js +10 -4
  231. package/dist/server/utils.js.map +1 -1
  232. package/package.json +2 -6
  233. package/src/authorization/index.ts +1 -1
  234. package/src/cli/index.ts +1 -1
  235. package/src/client/core/types.ts +14 -14
  236. package/src/client/factors/device.ts +10 -12
  237. package/src/client/factors/passkey.ts +23 -26
  238. package/src/client/index.ts +54 -64
  239. package/src/client/runtime/invite.ts +5 -7
  240. package/src/component/index.ts +1 -0
  241. package/src/component/public/enterprise/audit.ts +6 -1
  242. package/src/component/public/enterprise/core.ts +1 -0
  243. package/src/component/public/enterprise/domains.ts +5 -1
  244. package/src/component/public/enterprise/scim.ts +1 -0
  245. package/src/component/public/enterprise/secrets.ts +1 -0
  246. package/src/component/public/enterprise/webhooks.ts +1 -0
  247. package/src/component/public/factors/devices.ts +1 -0
  248. package/src/component/public/factors/passkeys.ts +1 -0
  249. package/src/component/public/factors/totp.ts +1 -0
  250. package/src/component/public/groups/core.ts +1 -1
  251. package/src/component/public/groups/invites.ts +7 -1
  252. package/src/component/public/groups/members.ts +1 -0
  253. package/src/component/public/identity/accounts.ts +1 -0
  254. package/src/component/public/identity/codes.ts +1 -0
  255. package/src/component/public/identity/sessions.ts +1 -0
  256. package/src/component/public/identity/tokens.ts +1 -0
  257. package/src/component/public/identity/users.ts +1 -0
  258. package/src/component/public/identity/verifiers.ts +1 -0
  259. package/src/component/public/security/keys.ts +1 -0
  260. package/src/component/public/security/limits.ts +1 -0
  261. package/src/providers/password.ts +89 -110
  262. package/src/server/auth.ts +177 -111
  263. package/src/server/core.ts +197 -233
  264. package/src/server/crypto.ts +31 -29
  265. package/src/server/device.ts +65 -32
  266. package/src/server/enterprise/domain.ts +158 -170
  267. package/src/server/enterprise/http.ts +46 -39
  268. package/src/server/http.ts +36 -30
  269. package/src/server/identity.ts +5 -5
  270. package/src/server/index.ts +2 -0
  271. package/src/server/limits.ts +53 -80
  272. package/src/server/mounts.ts +47 -74
  273. package/src/server/mutations/account.ts +22 -36
  274. package/src/server/mutations/code.ts +6 -6
  275. package/src/server/mutations/invalidate.ts +1 -1
  276. package/src/server/mutations/oauth.ts +14 -8
  277. package/src/server/mutations/refresh.ts +5 -4
  278. package/src/server/mutations/register.ts +87 -132
  279. package/src/server/mutations/retrieve.ts +44 -44
  280. package/src/server/mutations/signature.ts +13 -6
  281. package/src/server/mutations/signout.ts +1 -1
  282. package/src/server/mutations/store.ts +16 -31
  283. package/src/server/mutations/verifier.ts +1 -1
  284. package/src/server/mutations/verify.ts +3 -5
  285. package/src/server/oauth.ts +60 -69
  286. package/src/server/passkey.ts +567 -517
  287. package/src/server/redirects.ts +10 -6
  288. package/src/server/refresh.ts +14 -18
  289. package/src/server/runtime.ts +70 -55
  290. package/src/server/signin.ts +44 -37
  291. package/src/server/ssr.ts +390 -407
  292. package/src/server/totp.ts +85 -35
  293. package/src/server/types.ts +19 -22
  294. package/src/server/users.ts +7 -6
  295. package/src/server/utils.ts +10 -12
  296. package/dist/component/server/authError.js +0 -34
  297. package/dist/component/server/authError.js.map +0 -1
  298. package/dist/component/server/errors.d.ts +0 -1
  299. package/dist/component/server/errors.js +0 -137
  300. package/dist/component/server/errors.js.map +0 -1
  301. package/dist/server/authError.d.ts +0 -46
  302. package/dist/server/authError.d.ts.map +0 -1
  303. package/dist/server/authError.js +0 -34
  304. package/dist/server/authError.js.map +0 -1
  305. package/dist/server/errors.d.ts +0 -177
  306. package/dist/server/errors.d.ts.map +0 -1
  307. package/dist/server/errors.js +0 -212
  308. package/dist/server/errors.js.map +0 -1
  309. package/src/server/authError.ts +0 -44
  310. package/src/server/errors.ts +0 -290
@@ -1 +1 @@
1
- {"version":3,"file":"verifiers.js","names":[],"sources":["../../../../src/component/public/identity/verifiers.ts"],"sourcesContent":["import { v } from \"convex/values\";\nimport { mutation, query } from \"../../functions\";\nimport { vAuthVerifierDoc } from \"../../model\";\n\n/**\n * Create a new PKCE verifier, optionally linked to a session.\n *\n * Inserts a document into the `AuthVerifier` table. Verifiers are used during\n * OAuth/OIDC flows to implement the PKCE (Proof Key for Code Exchange) pattern,\n * preventing authorization code interception attacks. The verifier can optionally\n * be linked to an existing session for session-aware flows.\n *\n * @param args.sessionId - An optional session document ID to associate with the verifier.\n * When provided, the verifier is scoped to the given session.\n * @returns The document ID of the newly created verifier.\n *\n * @example\n * ```ts\n * const verifierId = await ctx.runMutation(\n * component.identity.verifiers.verifierCreate,\n * { sessionId: session._id },\n * );\n * ```\n */\nexport const verifierCreate = mutation({\n args: { sessionId: v.optional(v.id(\"Session\")) },\n returns: v.id(\"AuthVerifier\"),\n handler: async (ctx, { sessionId }) => {\n return await ctx.db.insert(\"AuthVerifier\", { sessionId: sessionId as any });\n },\n});\n\n/**\n * Retrieve a single verifier by its Convex document ID.\n *\n * Performs a direct point lookup on the `AuthVerifier` table. Returns `null` if\n * the verifier has been deleted or never existed.\n *\n * @param args.verifierId - The Convex document ID (`Id<\"AuthVerifier\">`) of the verifier to retrieve.\n * @returns The verifier document if it exists, or `null` otherwise.\n *\n * @example\n * ```ts\n * const verifier = await ctx.runQuery(\n * component.identity.verifiers.verifierGetById,\n * { verifierId: storedVerifierId },\n * );\n * if (verifier !== null) {\n * console.log(`Verifier signature: ${verifier.signature}`);\n * }\n * ```\n */\nexport const verifierGetById = query({\n args: { verifierId: v.id(\"AuthVerifier\") },\n returns: v.union(vAuthVerifierDoc, v.null()),\n handler: async (ctx, { verifierId }) => {\n return await ctx.db.get(\"AuthVerifier\", verifierId);\n },\n});\n\n/**\n * Look up a verifier by its cryptographic signature.\n *\n * Queries the `AuthVerifier` table using the `signature` index to find the\n * unique verifier matching the given signature string. This is the primary\n * lookup used during the OAuth callback phase to correlate the incoming\n * authorization response with the original PKCE challenge.\n *\n * @param args.signature - The cryptographic signature string to search for (exact match).\n * @returns The matching verifier document, or `null` if no verifier has the given signature.\n *\n * @example\n * ```ts\n * const verifier = await ctx.runQuery(\n * component.identity.verifiers.verifierGetBySignature,\n * { signature: incomingStateParam },\n * );\n * if (verifier === null) {\n * throw new Error(\"Invalid or expired OAuth state\");\n * }\n * ```\n */\nexport const verifierGetBySignature = query({\n args: { signature: v.string() },\n returns: v.union(vAuthVerifierDoc, v.null()),\n handler: async (ctx, { signature }) => {\n return await ctx.db\n .query(\"AuthVerifier\")\n .withIndex(\"signature\", (q) => q.eq(\"signature\", signature))\n .unique();\n },\n});\n\n/**\n * Patch a verifier document with partial data.\n *\n * Merges the provided fields into the existing verifier document. This is\n * typically used to set the `signature` field after the verifier is initially\n * created, or to associate a `sessionId` with an existing verifier.\n *\n * @param args.verifierId - The document ID of the verifier to update.\n * @param args.data - A partial object containing the fields to merge into the verifier document\n * (e.g. `{ signature: string }` or `{ sessionId: Id<\"Session\"> }`).\n * @returns `null` on success.\n *\n * @example\n * ```ts\n * // Set the PKCE signature on the verifier\n * await ctx.runMutation(\n * component.identity.verifiers.verifierPatch,\n * {\n * verifierId: verifier._id,\n * data: { signature: generatedSignature },\n * },\n * );\n * ```\n */\nexport const verifierPatch = mutation({\n args: { verifierId: v.id(\"AuthVerifier\"), data: v.any() },\n returns: v.null(),\n handler: async (ctx, { verifierId, data }) => {\n await ctx.db.patch(\"AuthVerifier\", verifierId, data);\n return null;\n },\n});\n\n/**\n * Delete a verifier document permanently.\n *\n * Removes the verifier from the `AuthVerifier` table. This is typically called\n * after a successful OAuth callback to clean up the consumed PKCE state, or\n * to expire stale verifiers that were never completed.\n *\n * @param args.verifierId - The document ID of the verifier to delete.\n * @returns `null` on success.\n *\n * @example\n * ```ts\n * // Clean up the verifier after a successful OAuth exchange\n * await ctx.runMutation(\n * component.identity.verifiers.verifierDelete,\n * { verifierId: verifier._id },\n * );\n * ```\n */\nexport const verifierDelete = mutation({\n args: { verifierId: v.id(\"AuthVerifier\") },\n returns: v.null(),\n handler: async (ctx, { verifierId }) => {\n await ctx.db.delete(\"AuthVerifier\", verifierId);\n return null;\n },\n});\n\n// ============================================================================\n// Verification Codes\n// ============================================================================\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,iBAAiB,SAAS;CACrC,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,GAAG,UAAU,CAAC,EAAE;CAChD,SAAS,EAAE,GAAG,eAAe;CAC7B,SAAS,OAAO,KAAK,EAAE,gBAAgB;AACrC,SAAO,MAAM,IAAI,GAAG,OAAO,gBAAgB,EAAa,WAAkB,CAAC;;CAE9E,CAAC;;;;;;;;;;;;;;;;;;;;;AAsBF,MAAa,kBAAkB,MAAM;CACnC,MAAM,EAAE,YAAY,EAAE,GAAG,eAAe,EAAE;CAC1C,SAAS,EAAE,MAAM,kBAAkB,EAAE,MAAM,CAAC;CAC5C,SAAS,OAAO,KAAK,EAAE,iBAAiB;AACtC,SAAO,MAAM,IAAI,GAAG,IAAI,gBAAgB,WAAW;;CAEtD,CAAC;;;;;;;;;;;;;;;;;;;;;;;AAwBF,MAAa,yBAAyB,MAAM;CAC1C,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE;CAC/B,SAAS,EAAE,MAAM,kBAAkB,EAAE,MAAM,CAAC;CAC5C,SAAS,OAAO,KAAK,EAAE,gBAAgB;AACrC,SAAO,MAAM,IAAI,GACd,MAAM,eAAe,CACrB,UAAU,cAAc,MAAM,EAAE,GAAG,aAAa,UAAU,CAAC,CAC3D,QAAQ;;CAEd,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;AA0BF,MAAa,gBAAgB,SAAS;CACpC,MAAM;EAAE,YAAY,EAAE,GAAG,eAAe;EAAE,MAAM,EAAE,KAAK;EAAE;CACzD,SAAS,EAAE,MAAM;CACjB,SAAS,OAAO,KAAK,EAAE,YAAY,WAAW;AAC5C,QAAM,IAAI,GAAG,MAAM,gBAAgB,YAAY,KAAK;AACpD,SAAO;;CAEV,CAAC;;;;;;;;;;;;;;;;;;;;AAqBF,MAAa,iBAAiB,SAAS;CACrC,MAAM,EAAE,YAAY,EAAE,GAAG,eAAe,EAAE;CAC1C,SAAS,EAAE,MAAM;CACjB,SAAS,OAAO,KAAK,EAAE,iBAAiB;AACtC,QAAM,IAAI,GAAG,OAAO,gBAAgB,WAAW;AAC/C,SAAO;;CAEV,CAAC"}
1
+ {"version":3,"file":"verifiers.js","names":[],"sources":["../../../../src/component/public/identity/verifiers.ts"],"sourcesContent":["import { v } from \"convex/values\";\n\nimport { mutation, query } from \"../../functions\";\nimport { vAuthVerifierDoc } from \"../../model\";\n\n/**\n * Create a new PKCE verifier, optionally linked to a session.\n *\n * Inserts a document into the `AuthVerifier` table. Verifiers are used during\n * OAuth/OIDC flows to implement the PKCE (Proof Key for Code Exchange) pattern,\n * preventing authorization code interception attacks. The verifier can optionally\n * be linked to an existing session for session-aware flows.\n *\n * @param args.sessionId - An optional session document ID to associate with the verifier.\n * When provided, the verifier is scoped to the given session.\n * @returns The document ID of the newly created verifier.\n *\n * @example\n * ```ts\n * const verifierId = await ctx.runMutation(\n * component.identity.verifiers.verifierCreate,\n * { sessionId: session._id },\n * );\n * ```\n */\nexport const verifierCreate = mutation({\n args: { sessionId: v.optional(v.id(\"Session\")) },\n returns: v.id(\"AuthVerifier\"),\n handler: async (ctx, { sessionId }) => {\n return await ctx.db.insert(\"AuthVerifier\", { sessionId: sessionId as any });\n },\n});\n\n/**\n * Retrieve a single verifier by its Convex document ID.\n *\n * Performs a direct point lookup on the `AuthVerifier` table. Returns `null` if\n * the verifier has been deleted or never existed.\n *\n * @param args.verifierId - The Convex document ID (`Id<\"AuthVerifier\">`) of the verifier to retrieve.\n * @returns The verifier document if it exists, or `null` otherwise.\n *\n * @example\n * ```ts\n * const verifier = await ctx.runQuery(\n * component.identity.verifiers.verifierGetById,\n * { verifierId: storedVerifierId },\n * );\n * if (verifier !== null) {\n * console.log(`Verifier signature: ${verifier.signature}`);\n * }\n * ```\n */\nexport const verifierGetById = query({\n args: { verifierId: v.id(\"AuthVerifier\") },\n returns: v.union(vAuthVerifierDoc, v.null()),\n handler: async (ctx, { verifierId }) => {\n return await ctx.db.get(\"AuthVerifier\", verifierId);\n },\n});\n\n/**\n * Look up a verifier by its cryptographic signature.\n *\n * Queries the `AuthVerifier` table using the `signature` index to find the\n * unique verifier matching the given signature string. This is the primary\n * lookup used during the OAuth callback phase to correlate the incoming\n * authorization response with the original PKCE challenge.\n *\n * @param args.signature - The cryptographic signature string to search for (exact match).\n * @returns The matching verifier document, or `null` if no verifier has the given signature.\n *\n * @example\n * ```ts\n * const verifier = await ctx.runQuery(\n * component.identity.verifiers.verifierGetBySignature,\n * { signature: incomingStateParam },\n * );\n * if (verifier === null) {\n * throw new Error(\"Invalid or expired OAuth state\");\n * }\n * ```\n */\nexport const verifierGetBySignature = query({\n args: { signature: v.string() },\n returns: v.union(vAuthVerifierDoc, v.null()),\n handler: async (ctx, { signature }) => {\n return await ctx.db\n .query(\"AuthVerifier\")\n .withIndex(\"signature\", (q) => q.eq(\"signature\", signature))\n .unique();\n },\n});\n\n/**\n * Patch a verifier document with partial data.\n *\n * Merges the provided fields into the existing verifier document. This is\n * typically used to set the `signature` field after the verifier is initially\n * created, or to associate a `sessionId` with an existing verifier.\n *\n * @param args.verifierId - The document ID of the verifier to update.\n * @param args.data - A partial object containing the fields to merge into the verifier document\n * (e.g. `{ signature: string }` or `{ sessionId: Id<\"Session\"> }`).\n * @returns `null` on success.\n *\n * @example\n * ```ts\n * // Set the PKCE signature on the verifier\n * await ctx.runMutation(\n * component.identity.verifiers.verifierPatch,\n * {\n * verifierId: verifier._id,\n * data: { signature: generatedSignature },\n * },\n * );\n * ```\n */\nexport const verifierPatch = mutation({\n args: { verifierId: v.id(\"AuthVerifier\"), data: v.any() },\n returns: v.null(),\n handler: async (ctx, { verifierId, data }) => {\n await ctx.db.patch(\"AuthVerifier\", verifierId, data);\n return null;\n },\n});\n\n/**\n * Delete a verifier document permanently.\n *\n * Removes the verifier from the `AuthVerifier` table. This is typically called\n * after a successful OAuth callback to clean up the consumed PKCE state, or\n * to expire stale verifiers that were never completed.\n *\n * @param args.verifierId - The document ID of the verifier to delete.\n * @returns `null` on success.\n *\n * @example\n * ```ts\n * // Clean up the verifier after a successful OAuth exchange\n * await ctx.runMutation(\n * component.identity.verifiers.verifierDelete,\n * { verifierId: verifier._id },\n * );\n * ```\n */\nexport const verifierDelete = mutation({\n args: { verifierId: v.id(\"AuthVerifier\") },\n returns: v.null(),\n handler: async (ctx, { verifierId }) => {\n await ctx.db.delete(\"AuthVerifier\", verifierId);\n return null;\n },\n});\n\n// ============================================================================\n// Verification Codes\n// ============================================================================\n"],"mappings":";;;;;;;;;;;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AS,OAAO,KAAK,EAAE,iBAAiB;AACtC,QAAM,IAAI,GAAG,OAAO,gBAAgB,WAAW;AAC/C,SAAO;;CAEV,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"keys.d.ts","names":[],"sources":["../../../../src/component/public/security/keys.ts"],"mappings":";;;;;;;;;;;;;;AAqDA;;;;;AAmDA;;;;;AAyDA;;;;;AAwFA;;;;;AAsDA;;;;;AA8CA;;;cAxSa,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;cAmDA,iBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAyDA,OAAA;;;;;;;;;;;;;;;;;;;;;;;cAwFA,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsDA,QAAA;;;;;;;;;;;;;;;;;;;;cA8CA,SAAA"}
1
+ {"version":3,"file":"keys.d.ts","names":[],"sources":["../../../../src/component/public/security/keys.ts"],"mappings":";;;;;;;;;;;;;;AAsDA;;;;;AAmDA;;;;;AAyDA;;;;;AAwFA;;;;;AAsDA;;;;;AA8CA;;;cAxSa,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;cAmDA,iBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAyDA,OAAA;;;;;;;;;;;;;;;;;;;;;;;cAwFA,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsDA,QAAA;;;;;;;;;;;;;;;;;;;;cA8CA,SAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"keys.js","names":[],"sources":["../../../../src/component/public/security/keys.ts"],"sourcesContent":["import { ConvexError, v } from \"convex/values\";\nimport { mutation, query } from \"../../functions\";\nimport {\n vApiKeyDoc,\n vApiKeyRateLimit,\n vApiKeyRateLimitState,\n vApiKeyScope,\n vPaginated,\n} from \"../../model\";\n\n// ============================================================================\n// API Keys\n// ============================================================================\n\n/**\n * Insert a new API key record into the `ApiKey` table.\n *\n * Creates an API key entry with the given metadata and scopes. The caller\n * is responsible for generating and hashing the raw key before passing it\n * here -- this function only stores the hash, never the plaintext key.\n * The `createdAt` timestamp and `revoked: false` flag are set automatically.\n *\n * @param userId - The `_id` of the `User` who owns this API key.\n * @param prefix - A short, visible prefix for the key (e.g. `\"sk_live_\"`)\n * that helps users identify which key was used without exposing the secret.\n * @param hashedKey - SHA-256 hash of the full API key string. Used for\n * constant-time lookup during Bearer token verification.\n * @param name - Human-readable name for the key (e.g. `\"Production Backend\"`).\n * @param scopes - Array of permission scopes, each containing a `resource`\n * name and an array of allowed `actions` (e.g.\n * `[{ resource: \"messages\", actions: [\"read\", \"write\"] }]`).\n * @param rateLimit - Optional rate limit configuration to apply per-key\n * (e.g. max requests per window).\n * @param expiresAt - Optional Unix timestamp (in milliseconds) after which\n * the key is no longer valid. Omit for non-expiring keys.\n * @param metadata - Optional arbitrary metadata to attach to the key record.\n * @returns The `_id` of the newly created `ApiKey` document.\n *\n * @example\n * ```ts\n * const keyId = await ctx.runMutation(\n * components.auth.security.keys.keyInsert,\n * {\n * userId: user._id,\n * prefix: \"sk_live_\",\n * hashedKey: await sha256(rawKey),\n * name: \"Production Backend\",\n * scopes: [{ resource: \"messages\", actions: [\"read\", \"write\"] }],\n * expiresAt: Date.now() + 90 * 24 * 60 * 60 * 1000,\n * },\n * );\n * ```\n */\nexport const keyInsert = mutation({\n args: {\n userId: v.id(\"User\"),\n prefix: v.string(),\n hashedKey: v.string(),\n name: v.string(),\n scopes: v.array(\n v.object({\n resource: v.string(),\n actions: v.array(v.string()),\n }),\n ),\n rateLimit: v.optional(vApiKeyRateLimit),\n expiresAt: v.optional(v.number()),\n metadata: v.optional(v.any()),\n },\n returns: v.id(\"ApiKey\"),\n handler: async (ctx, args) => {\n return await ctx.db.insert(\"ApiKey\", {\n ...args,\n createdAt: Date.now(),\n revoked: false,\n });\n },\n});\n\n/**\n * Look up an API key by its SHA-256 hash.\n *\n * Queries the `ApiKey` table using the `hashed_key` index. This is the\n * primary lookup path during Bearer token verification: the incoming\n * token is hashed and matched against stored hashes in constant time.\n * Returns the full key record including scopes, rate limit state, and\n * revocation status so the caller can perform authorization checks.\n *\n * @param hashedKey - SHA-256 hash of the API key string extracted from\n * the `Authorization: Bearer <token>` header.\n * @returns The matching `ApiKey` document (including rate limit state),\n * or `null` if no key matches the given hash.\n *\n * @example\n * ```ts\n * const apiKey = await ctx.runQuery(\n * components.auth.security.keys.keyGetByHashedKey,\n * { hashedKey: await sha256(bearerToken) },\n * );\n * if (apiKey === null || apiKey.revoked) {\n * throw new Error(\"Invalid or revoked API key\");\n * }\n * ```\n */\nexport const keyGetByHashedKey = query({\n args: { hashedKey: v.string() },\n returns: v.union(vApiKeyDoc, v.null()),\n handler: async (ctx, { hashedKey }) => {\n return await ctx.db\n .query(\"ApiKey\")\n .withIndex(\"hashed_key\", (q) => q.eq(\"hashedKey\", hashedKey))\n .first();\n },\n});\n\n/**\n * List API keys with optional filtering, sorting, and cursor-based pagination.\n *\n * Returns a paginated result `{ items, nextCursor }` from the `ApiKey`\n * table. Supports filtering by `userId`, `revoked` status, `name`, and\n * `prefix`. The page size is clamped between 1 and 100 (default 50).\n * Pass the returned `nextCursor` as `cursor` in a subsequent call to\n * fetch the next page.\n *\n * @param where - Optional filter object. All specified fields are\n * combined with AND logic:\n * - `userId` -- restrict to keys owned by this user.\n * - `revoked` -- `true` for revoked keys, `false` for active keys.\n * - `name` -- exact match on the key's human-readable name.\n * - `prefix` -- exact match on the key prefix string.\n * @param limit - Maximum number of items to return per page (1--100,\n * default `50`).\n * @param cursor - Opaque cursor string (an `ApiKey` document `_id`)\n * returned from a previous call. Pass `null` or omit for the first page.\n * @param orderBy - Field to sort by. One of `\"_creationTime\"`, `\"name\"`,\n * `\"lastUsedAt\"`, `\"expiresAt\"`, or `\"revoked\"`. Defaults to\n * `\"_creationTime\"`.\n * @param order - Sort direction, `\"asc\"` or `\"desc\"` (default `\"desc\"`).\n * @returns An object with `items` (array of `ApiKey` documents) and\n * `nextCursor` (string ID of the last item, or `null` if no more pages).\n *\n * @example\n * ```ts\n * // Fetch the first page of active keys for a user\n * const page = await ctx.runQuery(\n * components.auth.security.keys.keyList,\n * {\n * where: { userId: user._id, revoked: false },\n * limit: 20,\n * order: \"desc\",\n * },\n * );\n * // Fetch the next page\n * if (page.nextCursor) {\n * const page2 = await ctx.runQuery(\n * components.auth.security.keys.keyList,\n * { where: { userId: user._id, revoked: false }, cursor: page.nextCursor },\n * );\n * }\n * ```\n */\nexport const keyList = query({\n args: {\n where: v.optional(\n v.object({\n userId: v.optional(v.id(\"User\")),\n revoked: v.optional(v.boolean()),\n name: v.optional(v.string()),\n prefix: v.optional(v.string()),\n }),\n ),\n limit: v.optional(v.number()),\n cursor: v.optional(v.union(v.string(), v.null())),\n orderBy: v.optional(\n v.union(\n v.literal(\"_creationTime\"),\n v.literal(\"name\"),\n v.literal(\"lastUsedAt\"),\n v.literal(\"expiresAt\"),\n v.literal(\"revoked\"),\n ),\n ),\n order: v.optional(v.union(v.literal(\"asc\"), v.literal(\"desc\"))),\n },\n returns: vPaginated(vApiKeyDoc),\n handler: async (ctx, args) => {\n const where = args.where ?? {};\n const limit = Math.min(Math.max(args.limit ?? 50, 1), 100);\n const order = args.order ?? \"desc\";\n\n let q;\n if (where.userId !== undefined) {\n q = ctx.db\n .query(\"ApiKey\")\n .withIndex(\"user_id\", (idx) => idx.eq(\"userId\", where.userId!));\n } else {\n q = ctx.db.query(\"ApiKey\");\n }\n\n if (where.revoked !== undefined) {\n q = q.filter((f) => f.eq(f.field(\"revoked\"), where.revoked!));\n }\n if (where.name !== undefined) {\n q = q.filter((f) => f.eq(f.field(\"name\"), where.name!));\n }\n if (where.prefix !== undefined) {\n q = q.filter((f) => f.eq(f.field(\"prefix\"), where.prefix!));\n }\n\n q = q.order(order);\n\n const all = await q.collect();\n let startIdx = 0;\n if (args.cursor) {\n const cursorIdx = all.findIndex((doc) => doc._id === args.cursor);\n if (cursorIdx !== -1) {\n startIdx = cursorIdx + 1;\n }\n }\n const page = all.slice(startIdx, startIdx + limit + 1);\n const hasMore = page.length > limit;\n const items = hasMore ? page.slice(0, limit) : page;\n const nextCursor = hasMore ? items[items.length - 1]._id : null;\n return { items, nextCursor };\n },\n});\n\n/**\n * Get a single API key by its document ID.\n *\n * Performs a direct document lookup on the `ApiKey` table. Useful when\n * you already have the key's `_id` (e.g. from a list query or a stored\n * reference) and need to retrieve its full details.\n *\n * @param keyId - The `_id` of the `ApiKey` document to retrieve.\n * @returns The `ApiKey` document, or `null` if no key exists with the\n * given ID.\n *\n * @example\n * ```ts\n * const apiKey = await ctx.runQuery(\n * components.auth.security.keys.keyGetById,\n * { keyId: storedKeyId },\n * );\n * if (apiKey !== null) {\n * console.log(apiKey.name, apiKey.scopes);\n * }\n * ```\n */\nexport const keyGetById = query({\n args: { keyId: v.id(\"ApiKey\") },\n returns: v.union(vApiKeyDoc, v.null()),\n handler: async (ctx, { keyId }) => {\n return await ctx.db.get(\"ApiKey\", keyId);\n },\n});\n\n/**\n * Patch an API key record with partial updates.\n *\n * Performs a partial update on the `ApiKey` document. Supports modifying\n * the key's name, scopes, rate limit configuration, rate limit state,\n * revocation flag, and last-used timestamp. Throws a `ConvexError` with\n * code `\"KEY_NOT_FOUND\"` if the key does not exist.\n *\n * @param keyId - The `_id` of the `ApiKey` document to update.\n * @param data - An object containing the fields to patch. All fields are\n * optional:\n * - `name` -- Updated human-readable name.\n * - `scopes` -- Replacement array of permission scopes.\n * - `rateLimit` -- Updated rate limit configuration.\n * - `rateLimitState` -- Updated rate limit tracking state (token\n * count, last refill time).\n * - `revoked` -- Set to `true` to revoke the key, `false` to\n * reinstate it.\n * - `lastUsedAt` -- Unix timestamp (in milliseconds) of the most\n * recent API call using this key.\n * @returns `null` on success.\n *\n * @example\n * ```ts\n * // Revoke an API key\n * await ctx.runMutation(\n * components.auth.security.keys.keyPatch,\n * {\n * keyId: apiKey._id,\n * data: { revoked: true },\n * },\n * );\n *\n * // Rename and update scopes\n * await ctx.runMutation(\n * components.auth.security.keys.keyPatch,\n * {\n * keyId: apiKey._id,\n * data: {\n * name: \"Read-Only Key\",\n * scopes: [{ resource: \"messages\", actions: [\"read\"] }],\n * },\n * },\n * );\n * ```\n */\nexport const keyPatch = mutation({\n args: {\n keyId: v.id(\"ApiKey\"),\n data: v.object({\n name: v.optional(v.string()),\n scopes: v.optional(v.array(vApiKeyScope)),\n rateLimit: v.optional(vApiKeyRateLimit),\n rateLimitState: v.optional(vApiKeyRateLimitState),\n revoked: v.optional(v.boolean()),\n lastUsedAt: v.optional(v.number()),\n }),\n },\n returns: v.null(),\n handler: async (ctx, { keyId, data }) => {\n const key = await ctx.db.get(\"ApiKey\", keyId);\n if (key === null) {\n throw new ConvexError({\n code: \"KEY_NOT_FOUND\",\n message: \"API key not found\",\n keyId,\n });\n }\n await ctx.db.patch(\"ApiKey\", keyId, data);\n return null;\n },\n});\n\n/**\n * Hard-delete an API key record from the `ApiKey` table.\n *\n * Permanently removes the API key document. Unlike revocation (which\n * keeps the record for audit purposes), this is an irreversible\n * deletion. Throws a `ConvexError` with code `\"KEY_NOT_FOUND\"` if the\n * key does not exist.\n *\n * @param keyId - The `_id` of the `ApiKey` document to delete.\n * @returns `null` on success.\n *\n * @example\n * ```ts\n * await ctx.runMutation(\n * components.auth.security.keys.keyDelete,\n * { keyId: apiKey._id },\n * );\n * ```\n */\nexport const keyDelete = mutation({\n args: { keyId: v.id(\"ApiKey\") },\n returns: v.null(),\n handler: async (ctx, { keyId }) => {\n const key = await ctx.db.get(\"ApiKey\", keyId);\n if (key === null) {\n throw new ConvexError({\n code: \"KEY_NOT_FOUND\",\n message: \"API key not found\",\n keyId,\n });\n }\n await ctx.db.delete(\"ApiKey\", keyId);\n return null;\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAa,YAAY,SAAS;CAChC,MAAM;EACJ,QAAQ,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AE;CAC/B,SAAS,EAAE,MAAM;CACjB,SAAS,OAAO,KAAK,EAAE,YAAY;AAEjC,MADY,MAAM,IAAI,GAAG,IAAI,UAAU,MAAM,KACjC,KACV,OAAM,IAAI,YAAY;GACpB,MAAM;GACN,SAAS;GACT;GACD,CAAC;AAEJ,QAAM,IAAI,GAAG,OAAO,UAAU,MAAM;AACpC,SAAO;;CAEV,CAAC"}
1
+ {"version":3,"file":"keys.js","names":[],"sources":["../../../../src/component/public/security/keys.ts"],"sourcesContent":["import { ConvexError, v } from \"convex/values\";\n\nimport { mutation, query } from \"../../functions\";\nimport {\n vApiKeyDoc,\n vApiKeyRateLimit,\n vApiKeyRateLimitState,\n vApiKeyScope,\n vPaginated,\n} from \"../../model\";\n\n// ============================================================================\n// API Keys\n// ============================================================================\n\n/**\n * Insert a new API key record into the `ApiKey` table.\n *\n * Creates an API key entry with the given metadata and scopes. The caller\n * is responsible for generating and hashing the raw key before passing it\n * here -- this function only stores the hash, never the plaintext key.\n * The `createdAt` timestamp and `revoked: false` flag are set automatically.\n *\n * @param userId - The `_id` of the `User` who owns this API key.\n * @param prefix - A short, visible prefix for the key (e.g. `\"sk_live_\"`)\n * that helps users identify which key was used without exposing the secret.\n * @param hashedKey - SHA-256 hash of the full API key string. Used for\n * constant-time lookup during Bearer token verification.\n * @param name - Human-readable name for the key (e.g. `\"Production Backend\"`).\n * @param scopes - Array of permission scopes, each containing a `resource`\n * name and an array of allowed `actions` (e.g.\n * `[{ resource: \"messages\", actions: [\"read\", \"write\"] }]`).\n * @param rateLimit - Optional rate limit configuration to apply per-key\n * (e.g. max requests per window).\n * @param expiresAt - Optional Unix timestamp (in milliseconds) after which\n * the key is no longer valid. Omit for non-expiring keys.\n * @param metadata - Optional arbitrary metadata to attach to the key record.\n * @returns The `_id` of the newly created `ApiKey` document.\n *\n * @example\n * ```ts\n * const keyId = await ctx.runMutation(\n * components.auth.security.keys.keyInsert,\n * {\n * userId: user._id,\n * prefix: \"sk_live_\",\n * hashedKey: await sha256(rawKey),\n * name: \"Production Backend\",\n * scopes: [{ resource: \"messages\", actions: [\"read\", \"write\"] }],\n * expiresAt: Date.now() + 90 * 24 * 60 * 60 * 1000,\n * },\n * );\n * ```\n */\nexport const keyInsert = mutation({\n args: {\n userId: v.id(\"User\"),\n prefix: v.string(),\n hashedKey: v.string(),\n name: v.string(),\n scopes: v.array(\n v.object({\n resource: v.string(),\n actions: v.array(v.string()),\n }),\n ),\n rateLimit: v.optional(vApiKeyRateLimit),\n expiresAt: v.optional(v.number()),\n metadata: v.optional(v.any()),\n },\n returns: v.id(\"ApiKey\"),\n handler: async (ctx, args) => {\n return await ctx.db.insert(\"ApiKey\", {\n ...args,\n createdAt: Date.now(),\n revoked: false,\n });\n },\n});\n\n/**\n * Look up an API key by its SHA-256 hash.\n *\n * Queries the `ApiKey` table using the `hashed_key` index. This is the\n * primary lookup path during Bearer token verification: the incoming\n * token is hashed and matched against stored hashes in constant time.\n * Returns the full key record including scopes, rate limit state, and\n * revocation status so the caller can perform authorization checks.\n *\n * @param hashedKey - SHA-256 hash of the API key string extracted from\n * the `Authorization: Bearer <token>` header.\n * @returns The matching `ApiKey` document (including rate limit state),\n * or `null` if no key matches the given hash.\n *\n * @example\n * ```ts\n * const apiKey = await ctx.runQuery(\n * components.auth.security.keys.keyGetByHashedKey,\n * { hashedKey: await sha256(bearerToken) },\n * );\n * if (apiKey === null || apiKey.revoked) {\n * throw new Error(\"Invalid or revoked API key\");\n * }\n * ```\n */\nexport const keyGetByHashedKey = query({\n args: { hashedKey: v.string() },\n returns: v.union(vApiKeyDoc, v.null()),\n handler: async (ctx, { hashedKey }) => {\n return await ctx.db\n .query(\"ApiKey\")\n .withIndex(\"hashed_key\", (q) => q.eq(\"hashedKey\", hashedKey))\n .first();\n },\n});\n\n/**\n * List API keys with optional filtering, sorting, and cursor-based pagination.\n *\n * Returns a paginated result `{ items, nextCursor }` from the `ApiKey`\n * table. Supports filtering by `userId`, `revoked` status, `name`, and\n * `prefix`. The page size is clamped between 1 and 100 (default 50).\n * Pass the returned `nextCursor` as `cursor` in a subsequent call to\n * fetch the next page.\n *\n * @param where - Optional filter object. All specified fields are\n * combined with AND logic:\n * - `userId` -- restrict to keys owned by this user.\n * - `revoked` -- `true` for revoked keys, `false` for active keys.\n * - `name` -- exact match on the key's human-readable name.\n * - `prefix` -- exact match on the key prefix string.\n * @param limit - Maximum number of items to return per page (1--100,\n * default `50`).\n * @param cursor - Opaque cursor string (an `ApiKey` document `_id`)\n * returned from a previous call. Pass `null` or omit for the first page.\n * @param orderBy - Field to sort by. One of `\"_creationTime\"`, `\"name\"`,\n * `\"lastUsedAt\"`, `\"expiresAt\"`, or `\"revoked\"`. Defaults to\n * `\"_creationTime\"`.\n * @param order - Sort direction, `\"asc\"` or `\"desc\"` (default `\"desc\"`).\n * @returns An object with `items` (array of `ApiKey` documents) and\n * `nextCursor` (string ID of the last item, or `null` if no more pages).\n *\n * @example\n * ```ts\n * // Fetch the first page of active keys for a user\n * const page = await ctx.runQuery(\n * components.auth.security.keys.keyList,\n * {\n * where: { userId: user._id, revoked: false },\n * limit: 20,\n * order: \"desc\",\n * },\n * );\n * // Fetch the next page\n * if (page.nextCursor) {\n * const page2 = await ctx.runQuery(\n * components.auth.security.keys.keyList,\n * { where: { userId: user._id, revoked: false }, cursor: page.nextCursor },\n * );\n * }\n * ```\n */\nexport const keyList = query({\n args: {\n where: v.optional(\n v.object({\n userId: v.optional(v.id(\"User\")),\n revoked: v.optional(v.boolean()),\n name: v.optional(v.string()),\n prefix: v.optional(v.string()),\n }),\n ),\n limit: v.optional(v.number()),\n cursor: v.optional(v.union(v.string(), v.null())),\n orderBy: v.optional(\n v.union(\n v.literal(\"_creationTime\"),\n v.literal(\"name\"),\n v.literal(\"lastUsedAt\"),\n v.literal(\"expiresAt\"),\n v.literal(\"revoked\"),\n ),\n ),\n order: v.optional(v.union(v.literal(\"asc\"), v.literal(\"desc\"))),\n },\n returns: vPaginated(vApiKeyDoc),\n handler: async (ctx, args) => {\n const where = args.where ?? {};\n const limit = Math.min(Math.max(args.limit ?? 50, 1), 100);\n const order = args.order ?? \"desc\";\n\n let q;\n if (where.userId !== undefined) {\n q = ctx.db\n .query(\"ApiKey\")\n .withIndex(\"user_id\", (idx) => idx.eq(\"userId\", where.userId!));\n } else {\n q = ctx.db.query(\"ApiKey\");\n }\n\n if (where.revoked !== undefined) {\n q = q.filter((f) => f.eq(f.field(\"revoked\"), where.revoked!));\n }\n if (where.name !== undefined) {\n q = q.filter((f) => f.eq(f.field(\"name\"), where.name!));\n }\n if (where.prefix !== undefined) {\n q = q.filter((f) => f.eq(f.field(\"prefix\"), where.prefix!));\n }\n\n q = q.order(order);\n\n const all = await q.collect();\n let startIdx = 0;\n if (args.cursor) {\n const cursorIdx = all.findIndex((doc) => doc._id === args.cursor);\n if (cursorIdx !== -1) {\n startIdx = cursorIdx + 1;\n }\n }\n const page = all.slice(startIdx, startIdx + limit + 1);\n const hasMore = page.length > limit;\n const items = hasMore ? page.slice(0, limit) : page;\n const nextCursor = hasMore ? items[items.length - 1]._id : null;\n return { items, nextCursor };\n },\n});\n\n/**\n * Get a single API key by its document ID.\n *\n * Performs a direct document lookup on the `ApiKey` table. Useful when\n * you already have the key's `_id` (e.g. from a list query or a stored\n * reference) and need to retrieve its full details.\n *\n * @param keyId - The `_id` of the `ApiKey` document to retrieve.\n * @returns The `ApiKey` document, or `null` if no key exists with the\n * given ID.\n *\n * @example\n * ```ts\n * const apiKey = await ctx.runQuery(\n * components.auth.security.keys.keyGetById,\n * { keyId: storedKeyId },\n * );\n * if (apiKey !== null) {\n * console.log(apiKey.name, apiKey.scopes);\n * }\n * ```\n */\nexport const keyGetById = query({\n args: { keyId: v.id(\"ApiKey\") },\n returns: v.union(vApiKeyDoc, v.null()),\n handler: async (ctx, { keyId }) => {\n return await ctx.db.get(\"ApiKey\", keyId);\n },\n});\n\n/**\n * Patch an API key record with partial updates.\n *\n * Performs a partial update on the `ApiKey` document. Supports modifying\n * the key's name, scopes, rate limit configuration, rate limit state,\n * revocation flag, and last-used timestamp. Throws a `ConvexError` with\n * code `\"KEY_NOT_FOUND\"` if the key does not exist.\n *\n * @param keyId - The `_id` of the `ApiKey` document to update.\n * @param data - An object containing the fields to patch. All fields are\n * optional:\n * - `name` -- Updated human-readable name.\n * - `scopes` -- Replacement array of permission scopes.\n * - `rateLimit` -- Updated rate limit configuration.\n * - `rateLimitState` -- Updated rate limit tracking state (token\n * count, last refill time).\n * - `revoked` -- Set to `true` to revoke the key, `false` to\n * reinstate it.\n * - `lastUsedAt` -- Unix timestamp (in milliseconds) of the most\n * recent API call using this key.\n * @returns `null` on success.\n *\n * @example\n * ```ts\n * // Revoke an API key\n * await ctx.runMutation(\n * components.auth.security.keys.keyPatch,\n * {\n * keyId: apiKey._id,\n * data: { revoked: true },\n * },\n * );\n *\n * // Rename and update scopes\n * await ctx.runMutation(\n * components.auth.security.keys.keyPatch,\n * {\n * keyId: apiKey._id,\n * data: {\n * name: \"Read-Only Key\",\n * scopes: [{ resource: \"messages\", actions: [\"read\"] }],\n * },\n * },\n * );\n * ```\n */\nexport const keyPatch = mutation({\n args: {\n keyId: v.id(\"ApiKey\"),\n data: v.object({\n name: v.optional(v.string()),\n scopes: v.optional(v.array(vApiKeyScope)),\n rateLimit: v.optional(vApiKeyRateLimit),\n rateLimitState: v.optional(vApiKeyRateLimitState),\n revoked: v.optional(v.boolean()),\n lastUsedAt: v.optional(v.number()),\n }),\n },\n returns: v.null(),\n handler: async (ctx, { keyId, data }) => {\n const key = await ctx.db.get(\"ApiKey\", keyId);\n if (key === null) {\n throw new ConvexError({\n code: \"KEY_NOT_FOUND\",\n message: \"API key not found\",\n keyId,\n });\n }\n await ctx.db.patch(\"ApiKey\", keyId, data);\n return null;\n },\n});\n\n/**\n * Hard-delete an API key record from the `ApiKey` table.\n *\n * Permanently removes the API key document. Unlike revocation (which\n * keeps the record for audit purposes), this is an irreversible\n * deletion. Throws a `ConvexError` with code `\"KEY_NOT_FOUND\"` if the\n * key does not exist.\n *\n * @param keyId - The `_id` of the `ApiKey` document to delete.\n * @returns `null` on success.\n *\n * @example\n * ```ts\n * await ctx.runMutation(\n * components.auth.security.keys.keyDelete,\n * { keyId: apiKey._id },\n * );\n * ```\n */\nexport const keyDelete = mutation({\n args: { keyId: v.id(\"ApiKey\") },\n returns: v.null(),\n handler: async (ctx, { keyId }) => {\n const key = await ctx.db.get(\"ApiKey\", keyId);\n if (key === null) {\n throw new ConvexError({\n code: \"KEY_NOT_FOUND\",\n message: \"API key not found\",\n keyId,\n });\n }\n await ctx.db.delete(\"ApiKey\", keyId);\n return null;\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,MAAa,YAAY,SAAS;CAChC,MAAM;EACJ,QAAQ,EAAE,GAAG,OAAO;EACpB,QAAQ,EAAE,QAAQ;EAClB,WAAW,EAAE,QAAQ;EACrB,MAAM,EAAE,QAAQ;EAChB,QAAQ,EAAE,MACR,EAAE,OAAO;GACP,UAAU,EAAE,QAAQ;GACpB,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC;GAC7B,CAAC,CACH;EACD,WAAW,EAAE,SAAS,iBAAiB;EACvC,WAAW,EAAE,SAAS,EAAE,QAAQ,CAAC;EACjC,UAAU,EAAE,SAAS,EAAE,KAAK,CAAC;EAC9B;CACD,SAAS,EAAE,GAAG,SAAS;CACvB,SAAS,OAAO,KAAK,SAAS;AAC5B,SAAO,MAAM,IAAI,GAAG,OAAO,UAAU;GACnC,GAAG;GACH,WAAW,KAAK,KAAK;GACrB,SAAS;GACV,CAAC;;CAEL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;AA2BF,MAAa,oBAAoB,MAAM;CACrC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE;CAC/B,SAAS,EAAE,MAAM,YAAY,EAAE,MAAM,CAAC;CACtC,SAAS,OAAO,KAAK,EAAE,gBAAgB;AACrC,SAAO,MAAM,IAAI,G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AAE,SAAS,iBAAiB;GACvC,gBAAgB,EAAE,SAAS,sBAAsB;GACjD,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC;GAChC,YAAY,EAAE,SAAS,EAAE,QAAQ,CAAC;GACnC,CAAC;EACH;CACD,SAAS,EAAE,MAAM;CACjB,SAAS,OAAO,KAAK,EAAE,OAAO,WAAW;AAEvC,MADY,MAAM,IAAI,GAAG,IAAI,UAAU,MAAM,KACjC,KACV,OAAM,IAAI,YAAY;GACpB,MAAM;GACN,SAAS;GACT;GACD,CAAC;AAEJ,QAAM,IAAI,GAAG,MAAM,UAAU,OAAO,KAAK;AACzC,SAAO;;CAEV,CAAC;;;;;;;;;;;;;;;;;;;;AAqBF,MAAa,YAAY,SAAS;CAChC,MAAM,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE;CAC/B,SAAS,EAAE,MAAM;CACjB,SAAS,OAAO,KAAK,EAAE,YAAY;AAEjC,MADY,MAAM,IAAI,GAAG,IAAI,UAAU,MAAM,KACjC,KACV,OAAM,IAAI,YAAY;GACpB,MAAM;GACN,SAAS;GACT;GACD,CAAC;AAEJ,QAAM,IAAI,GAAG,OAAO,UAAU,MAAM;AACpC,SAAO;;CAEV,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"limits.d.ts","names":[],"sources":["../../../../src/component/public/security/limits.ts"],"mappings":";;;;;;;;;;;;AA4BA;;;;;AAgDA;;;;;AA+CA;;;;;cA/Fa,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgDA,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+CA,cAAA;;;;;;;;;;;;;;;;;;;;;cAsCA,eAAA"}
1
+ {"version":3,"file":"limits.d.ts","names":[],"sources":["../../../../src/component/public/security/limits.ts"],"mappings":";;;;;;;;;;;;AA6BA;;;;;AAgDA;;;;;AA+CA;;;;;cA/Fa,YAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAgDA,eAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+CA,cAAA;;;;;;;;;;;;;;;;;;;;;cAsCA,eAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"limits.js","names":[],"sources":["../../../../src/component/public/security/limits.ts"],"sourcesContent":["import { v } from \"convex/values\";\nimport { mutation, query } from \"../../functions\";\nimport { vRateLimitResult } from \"../../model\";\n\n/**\n * Look up a rate limit entry by its string identifier.\n *\n * Queries the `RateLimit` table using the `by_identifier` unique index.\n * Returns the rate limit state with camelCase field names (`attemptsLeft`,\n * `lastAttemptTime`) mapped from the snake_case storage format. Used to\n * check whether an action should be allowed or throttled.\n *\n * @param identifier - Unique string identifying the rate limit bucket\n * (e.g. `\"login:user@example.com\"` or `\"api:sk_live_abc123\"`).\n * @returns The rate limit state object (including `attemptsLeft` and\n * `lastAttemptTime`), or `null` if no entry exists for the identifier.\n *\n * @example\n * ```ts\n * const limit = await ctx.runQuery(\n * components.auth.security.limits.rateLimitGet,\n * { identifier: `login:${email}` },\n * );\n * if (limit !== null && limit.attemptsLeft <= 0) {\n * throw new Error(\"Too many login attempts. Please try again later.\");\n * }\n * ```\n */\nexport const rateLimitGet = query({\n args: { identifier: v.string() },\n returns: v.union(vRateLimitResult, v.null()),\n handler: async (ctx, { identifier }) => {\n const row = await ctx.db\n .query(\"RateLimit\")\n .withIndex(\"by_identifier\", (q) => q.eq(\"identifier\", identifier))\n .unique();\n if (row === null) {\n return null;\n }\n return {\n ...row,\n attemptsLeft: row.attempts_left,\n lastAttemptTime: row.last_attempt_time,\n };\n },\n});\n\n/**\n * Create a new rate limit entry in the `RateLimit` table.\n *\n * Initializes a rate limit bucket for a given identifier. The entry\n * tracks remaining attempts and the timestamp of the last attempt,\n * storing them in snake_case format internally. Call this when the\n * first rate-limited action occurs for an identifier that does not\n * yet have an entry.\n *\n * @param identifier - Unique string identifying the rate limit bucket\n * (e.g. `\"login:user@example.com\"` or `\"otp:+15551234567\"`).\n * @param attemptsLeft - Number of remaining attempts before the action\n * is throttled.\n * @param lastAttemptTime - Unix timestamp (in milliseconds) of the\n * initial attempt.\n * @returns The `_id` of the newly created `RateLimit` document.\n *\n * @example\n * ```ts\n * const rateLimitId = await ctx.runMutation(\n * components.auth.security.limits.rateLimitCreate,\n * {\n * identifier: `login:${email}`,\n * attemptsLeft: 4, // 5 max minus this attempt\n * lastAttemptTime: Date.now(),\n * },\n * );\n * ```\n */\nexport const rateLimitCreate = mutation({\n args: {\n identifier: v.string(),\n attemptsLeft: v.number(),\n lastAttemptTime: v.number(),\n },\n returns: v.id(\"RateLimit\"),\n handler: async (ctx, { identifier, attemptsLeft, lastAttemptTime }) => {\n return await ctx.db.insert(\"RateLimit\", {\n identifier,\n attempts_left: attemptsLeft,\n last_attempt_time: lastAttemptTime,\n });\n },\n});\n\n/**\n * Patch a rate limit entry with partial data.\n *\n * Updates an existing `RateLimit` document with the provided fields.\n * Automatically maps camelCase field names (`attemptsLeft`,\n * `lastAttemptTime`) to the snake_case storage format before writing.\n * Typically called to decrement remaining attempts or to reset the\n * bucket after a cooldown window has elapsed.\n *\n * @param rateLimitId - The `_id` of the `RateLimit` document to update.\n * @param data - An object containing the fields to patch. Supports\n * camelCase names which are transparently converted:\n * - `attemptsLeft` -- Updated number of remaining attempts.\n * - `lastAttemptTime` -- Updated timestamp of the most recent attempt.\n * @returns `null` on success.\n *\n * @example\n * ```ts\n * // Decrement attempts after a failed login\n * await ctx.runMutation(\n * components.auth.security.limits.rateLimitPatch,\n * {\n * rateLimitId: limit._id,\n * data: {\n * attemptsLeft: limit.attemptsLeft - 1,\n * lastAttemptTime: Date.now(),\n * },\n * },\n * );\n * ```\n */\nexport const rateLimitPatch = mutation({\n args: { rateLimitId: v.id(\"RateLimit\"), data: v.any() },\n returns: v.null(),\n handler: async (ctx, { rateLimitId, data }) => {\n const nextData: Record<string, unknown> = { ...data };\n if (nextData.attemptsLeft !== undefined) {\n nextData.attempts_left = nextData.attemptsLeft;\n delete nextData.attemptsLeft;\n }\n if (nextData.lastAttemptTime !== undefined) {\n nextData.last_attempt_time = nextData.lastAttemptTime;\n delete nextData.lastAttemptTime;\n }\n await ctx.db.patch(\"RateLimit\", rateLimitId, nextData);\n return null;\n },\n});\n\n/**\n * Delete a rate limit entry from the `RateLimit` table.\n *\n * Permanently removes the rate limit bucket. This effectively resets\n * rate limiting for the associated identifier, allowing the next\n * action to proceed without throttling. Useful for administrative\n * resets or cleanup of expired buckets.\n *\n * @param rateLimitId - The `_id` of the `RateLimit` document to delete.\n * @returns `null` on success.\n *\n * @example\n * ```ts\n * // Admin resets a user's login rate limit\n * await ctx.runMutation(\n * components.auth.security.limits.rateLimitDelete,\n * { rateLimitId: limit._id },\n * );\n * ```\n */\nexport const rateLimitDelete = mutation({\n args: { rateLimitId: v.id(\"RateLimit\") },\n returns: v.null(),\n handler: async (ctx, { rateLimitId }) => {\n await ctx.db.delete(\"RateLimit\", rateLimitId);\n return null;\n },\n});\n\n// ============================================================================\n// Device Authorization (RFC 8628)\n// ============================================================================\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BA,MAAa,eAAe,MAAM;CAChC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE;CAChC,SAAS,EAAE,MAAM,kBAAkB,EAAE,MAAM,CAAC;CAC5C,SAAS,OAAO,KAAK,EAAE,iBAAiB;EACtC,MAAM,MAAM,MAAM,IAAI,GACnB,MAAM,YAAY,CAClB,UAAU,kBAAkB,MAAM,EAAE,GAAG,cAAc,WAAW,CAAC,CACjE,QAAQ;AACX,MAAI,QAAQ,KACV,QAAO;AAET,SAAO;GACL,GAAG;GACH,cAAc,IAAI;GAClB,iBAAiB,IAAI;GACtB;;CAEJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BF,MAAa,kBAAkB,SAAS;CACtC,MAAM;EACJ,YAAY,EAAE,QAAQ;EACtB,cAAc,EAAE,QAAQ;EACxB,iBAAiB,EAAE,QAAQ;EAC5B;CACD,SAAS,EAAE,GAAG,YAAY;CAC1B,SAAS,OAAO,KAAK,EAAE,YAAY,cAAc,sBAAsB;AACrE,SAAO,MAAM,IAAI,GAAG,OAAO,aAAa;GACtC;GACA,eAAe;GACf,mBAAmB;GACpB,CAAC;;CAEL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCF,MAAa,iBAAiB,SAAS;CACrC,MAAM;EAAE,aAAa,EAAE,GAAG,YAAY;EAAE,MAAM,EAAE,KAAK;EAAE;CACvD,SAAS,EAAE,MAAM;CACjB,SAAS,OAAO,KAAK,EAAE,aAAa,WAAW;EAC7C,MAAM,WAAoC,EAAE,GAAG,MAAM;AACrD,MAAI,SAAS,iBAAiB,QAAW;AACvC,YAAS,gBAAgB,SAAS;AAClC,UAAO,SAAS;;AAElB,MAAI,SAAS,oBAAoB,QAAW;AAC1C,YAAS,oBAAoB,SAAS;AACtC,UAAO,SAAS;;AAElB,QAAM,IAAI,GAAG,MAAM,aAAa,aAAa,SAAS;AACtD,SAAO;;CAEV,CAAC;;;;;;;;;;;;;;;;;;;;;AAsBF,MAAa,kBAAkB,SAAS;CACtC,MAAM,EAAE,aAAa,EAAE,GAAG,YAAY,EAAE;CACxC,SAAS,EAAE,MAAM;CACjB,SAAS,OAAO,KAAK,EAAE,kBAAkB;AACvC,QAAM,IAAI,GAAG,OAAO,aAAa,YAAY;AAC7C,SAAO;;CAEV,CAAC"}
1
+ {"version":3,"file":"limits.js","names":[],"sources":["../../../../src/component/public/security/limits.ts"],"sourcesContent":["import { v } from \"convex/values\";\n\nimport { mutation, query } from \"../../functions\";\nimport { vRateLimitResult } from \"../../model\";\n\n/**\n * Look up a rate limit entry by its string identifier.\n *\n * Queries the `RateLimit` table using the `by_identifier` unique index.\n * Returns the rate limit state with camelCase field names (`attemptsLeft`,\n * `lastAttemptTime`) mapped from the snake_case storage format. Used to\n * check whether an action should be allowed or throttled.\n *\n * @param identifier - Unique string identifying the rate limit bucket\n * (e.g. `\"login:user@example.com\"` or `\"api:sk_live_abc123\"`).\n * @returns The rate limit state object (including `attemptsLeft` and\n * `lastAttemptTime`), or `null` if no entry exists for the identifier.\n *\n * @example\n * ```ts\n * const limit = await ctx.runQuery(\n * components.auth.security.limits.rateLimitGet,\n * { identifier: `login:${email}` },\n * );\n * if (limit !== null && limit.attemptsLeft <= 0) {\n * throw new Error(\"Too many login attempts. Please try again later.\");\n * }\n * ```\n */\nexport const rateLimitGet = query({\n args: { identifier: v.string() },\n returns: v.union(vRateLimitResult, v.null()),\n handler: async (ctx, { identifier }) => {\n const row = await ctx.db\n .query(\"RateLimit\")\n .withIndex(\"by_identifier\", (q) => q.eq(\"identifier\", identifier))\n .unique();\n if (row === null) {\n return null;\n }\n return {\n ...row,\n attemptsLeft: row.attempts_left,\n lastAttemptTime: row.last_attempt_time,\n };\n },\n});\n\n/**\n * Create a new rate limit entry in the `RateLimit` table.\n *\n * Initializes a rate limit bucket for a given identifier. The entry\n * tracks remaining attempts and the timestamp of the last attempt,\n * storing them in snake_case format internally. Call this when the\n * first rate-limited action occurs for an identifier that does not\n * yet have an entry.\n *\n * @param identifier - Unique string identifying the rate limit bucket\n * (e.g. `\"login:user@example.com\"` or `\"otp:+15551234567\"`).\n * @param attemptsLeft - Number of remaining attempts before the action\n * is throttled.\n * @param lastAttemptTime - Unix timestamp (in milliseconds) of the\n * initial attempt.\n * @returns The `_id` of the newly created `RateLimit` document.\n *\n * @example\n * ```ts\n * const rateLimitId = await ctx.runMutation(\n * components.auth.security.limits.rateLimitCreate,\n * {\n * identifier: `login:${email}`,\n * attemptsLeft: 4, // 5 max minus this attempt\n * lastAttemptTime: Date.now(),\n * },\n * );\n * ```\n */\nexport const rateLimitCreate = mutation({\n args: {\n identifier: v.string(),\n attemptsLeft: v.number(),\n lastAttemptTime: v.number(),\n },\n returns: v.id(\"RateLimit\"),\n handler: async (ctx, { identifier, attemptsLeft, lastAttemptTime }) => {\n return await ctx.db.insert(\"RateLimit\", {\n identifier,\n attempts_left: attemptsLeft,\n last_attempt_time: lastAttemptTime,\n });\n },\n});\n\n/**\n * Patch a rate limit entry with partial data.\n *\n * Updates an existing `RateLimit` document with the provided fields.\n * Automatically maps camelCase field names (`attemptsLeft`,\n * `lastAttemptTime`) to the snake_case storage format before writing.\n * Typically called to decrement remaining attempts or to reset the\n * bucket after a cooldown window has elapsed.\n *\n * @param rateLimitId - The `_id` of the `RateLimit` document to update.\n * @param data - An object containing the fields to patch. Supports\n * camelCase names which are transparently converted:\n * - `attemptsLeft` -- Updated number of remaining attempts.\n * - `lastAttemptTime` -- Updated timestamp of the most recent attempt.\n * @returns `null` on success.\n *\n * @example\n * ```ts\n * // Decrement attempts after a failed login\n * await ctx.runMutation(\n * components.auth.security.limits.rateLimitPatch,\n * {\n * rateLimitId: limit._id,\n * data: {\n * attemptsLeft: limit.attemptsLeft - 1,\n * lastAttemptTime: Date.now(),\n * },\n * },\n * );\n * ```\n */\nexport const rateLimitPatch = mutation({\n args: { rateLimitId: v.id(\"RateLimit\"), data: v.any() },\n returns: v.null(),\n handler: async (ctx, { rateLimitId, data }) => {\n const nextData: Record<string, unknown> = { ...data };\n if (nextData.attemptsLeft !== undefined) {\n nextData.attempts_left = nextData.attemptsLeft;\n delete nextData.attemptsLeft;\n }\n if (nextData.lastAttemptTime !== undefined) {\n nextData.last_attempt_time = nextData.lastAttemptTime;\n delete nextData.lastAttemptTime;\n }\n await ctx.db.patch(\"RateLimit\", rateLimitId, nextData);\n return null;\n },\n});\n\n/**\n * Delete a rate limit entry from the `RateLimit` table.\n *\n * Permanently removes the rate limit bucket. This effectively resets\n * rate limiting for the associated identifier, allowing the next\n * action to proceed without throttling. Useful for administrative\n * resets or cleanup of expired buckets.\n *\n * @param rateLimitId - The `_id` of the `RateLimit` document to delete.\n * @returns `null` on success.\n *\n * @example\n * ```ts\n * // Admin resets a user's login rate limit\n * await ctx.runMutation(\n * components.auth.security.limits.rateLimitDelete,\n * { rateLimitId: limit._id },\n * );\n * ```\n */\nexport const rateLimitDelete = mutation({\n args: { rateLimitId: v.id(\"RateLimit\") },\n returns: v.null(),\n handler: async (ctx, { rateLimitId }) => {\n await ctx.db.delete(\"RateLimit\", rateLimitId);\n return null;\n },\n});\n\n// ============================================================================\n// Device Authorization (RFC 8628)\n// ============================================================================\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,eAAe,MAAM;CAChC,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE;CAChC,SAAS,EAAE,MAAM,kBAAkB,EAAE,MAAM,CAAC;CAC5C,SAAS,OAAO,KAAK,EAAE,iBAAiB;EACtC,MAAM,MAAM,MAAM,IAAI,GACnB,MAAM,YAAY,CAClB,UAAU,kBAAkB,MAAM,EAAE,GAAG,cAAc,WAAW,CAAC,CACjE,QAAQ;AACX,MAAI,QAAQ,KACV,QAAO;AAET,SAAO;GACL,GAAG;GACH,cAAc,IAAI;GAClB,iBAAiB,IAAI;GACtB;;CAEJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BF,MAAa,kBAAkB,SAAS;CACtC,MAAM;EACJ,YAAY,EAAE,QAAQ;EACtB,cAAc,EAAE,QAAQ;EACxB,iBAAiB,EAAE,QAAQ;EAC5B;CACD,SAAS,EAAE,GAAG,YAAY;CAC1B,SAAS,OAAO,KAAK,EAAE,YAAY,cAAc,sBAAsB;AACrE,SAAO,MAAM,IAAI,GAAG,OAAO,aAAa;GACtC;GACA,eAAe;GACf,mBAAmB;GACpB,CAAC;;CAEL,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCF,MAAa,iBAAiB,SAAS;CACrC,MAAM;EAAE,aAAa,EAAE,GAAG,YAAY;EAAE,MAAM,EAAE,KAAK;EAAE;CACvD,SAAS,EAAE,MAAM;CACjB,SAAS,OAAO,KAAK,EAAE,aAAa,WAAW;EAC7C,MAAM,WAAoC,EAAE,GAAG,MAAM;AACrD,MAAI,SAAS,iBAAiB,QAAW;AACvC,YAAS,gBAAgB,SAAS;AAClC,UAAO,SAAS;;AAElB,MAAI,SAAS,oBAAoB,QAAW;AAC1C,YAAS,oBAAoB,SAAS;AACtC,UAAO,SAAS;;AAElB,QAAM,IAAI,GAAG,MAAM,aAAa,aAAa,SAAS;AACtD,SAAO;;CAEV,CAAC;;;;;;;;;;;;;;;;;;;;;AAsBF,MAAa,kBAAkB,SAAS;CACtC,MAAM,EAAE,aAAa,EAAE,GAAG,YAAY,EAAE;CACxC,SAAS,EAAE,MAAM;CACjB,SAAS,OAAO,KAAK,EAAE,kBAAkB;AACvC,QAAM,IAAI,GAAG,OAAO,aAAa,YAAY;AAC7C,SAAO;;CAEV,CAAC"}
@@ -15,10 +15,10 @@ declare const _default: convex_server66.SchemaDefinition<{
15
15
  * and multiple concurrent sessions.
16
16
  */
17
17
  User: convex_server66.TableDefinition<convex_values121.VObject<{
18
- email?: string | undefined;
19
- extend?: any;
20
18
  phone?: string | undefined;
19
+ extend?: any;
21
20
  name?: string | undefined;
21
+ email?: string | undefined;
22
22
  image?: string | undefined;
23
23
  emailVerificationTime?: number | undefined;
24
24
  phoneVerificationTime?: number | undefined;
@@ -32,7 +32,7 @@ declare const _default: convex_server66.SchemaDefinition<{
32
32
  phoneVerificationTime: convex_values121.VFloat64<number | undefined, "optional">;
33
33
  isAnonymous: convex_values121.VBoolean<boolean | undefined, "optional">;
34
34
  extend: convex_values121.VAny<any, "optional", string>;
35
- }, "required", "email" | "extend" | "phone" | "name" | "image" | "emailVerificationTime" | "phoneVerificationTime" | "isAnonymous" | `extend.${string}`>, {
35
+ }, "required", "phone" | "extend" | "name" | "email" | "image" | "emailVerificationTime" | "phoneVerificationTime" | "isAnonymous" | `extend.${string}`>, {
36
36
  email: ["email", "_creationTime"];
37
37
  email_verified: ["email", "emailVerificationTime", "_creationTime"];
38
38
  phone: ["phone", "_creationTime"];
@@ -62,8 +62,8 @@ declare const _default: convex_server66.SchemaDefinition<{
62
62
  secret?: string | undefined;
63
63
  emailVerified?: string | undefined;
64
64
  phoneVerified?: string | undefined;
65
- userId: convex_values121.GenericId<"User">;
66
65
  provider: string;
66
+ userId: convex_values121.GenericId<"User">;
67
67
  providerAccountId: string;
68
68
  }, {
69
69
  userId: convex_values121.VId<convex_values121.GenericId<"User">, "required">;
@@ -73,7 +73,7 @@ declare const _default: convex_server66.SchemaDefinition<{
73
73
  emailVerified: convex_values121.VString<string | undefined, "optional">;
74
74
  phoneVerified: convex_values121.VString<string | undefined, "optional">;
75
75
  extend: convex_values121.VAny<any, "optional", string>;
76
- }, "required", "userId" | "extend" | "provider" | "secret" | "providerAccountId" | `extend.${string}` | "emailVerified" | "phoneVerified">, {
76
+ }, "required", "extend" | "provider" | "userId" | "providerAccountId" | "secret" | `extend.${string}` | "emailVerified" | "phoneVerified">, {
77
77
  user_id_provider: ["userId", "provider", "_creationTime"];
78
78
  provider_account_id: ["provider", "providerAccountId", "_creationTime"];
79
79
  }, {}, {}>;
@@ -88,14 +88,14 @@ declare const _default: convex_server66.SchemaDefinition<{
88
88
  RefreshToken: convex_server66.TableDefinition<convex_values121.VObject<{
89
89
  firstUsedTime?: number | undefined;
90
90
  parentRefreshTokenId?: convex_values121.GenericId<"RefreshToken"> | undefined;
91
- expirationTime: number;
92
91
  sessionId: convex_values121.GenericId<"Session">;
92
+ expirationTime: number;
93
93
  }, {
94
94
  sessionId: convex_values121.VId<convex_values121.GenericId<"Session">, "required">;
95
95
  expirationTime: convex_values121.VFloat64<number, "required">;
96
96
  firstUsedTime: convex_values121.VFloat64<number | undefined, "optional">;
97
97
  parentRefreshTokenId: convex_values121.VId<convex_values121.GenericId<"RefreshToken"> | undefined, "optional">;
98
- }, "required", "expirationTime" | "sessionId" | "firstUsedTime" | "parentRefreshTokenId">, {
98
+ }, "required", "sessionId" | "expirationTime" | "firstUsedTime" | "parentRefreshTokenId">, {
99
99
  session_id: ["sessionId", "_creationTime"];
100
100
  session_id_first_used: ["sessionId", "firstUsedTime", "_creationTime"];
101
101
  session_id_parent_refresh_token_id: ["sessionId", "parentRefreshTokenId", "_creationTime"];
@@ -108,8 +108,8 @@ declare const _default: convex_server66.SchemaDefinition<{
108
108
  emailVerified?: string | undefined;
109
109
  phoneVerified?: string | undefined;
110
110
  provider: string;
111
- code: string;
112
111
  accountId: convex_values121.GenericId<"Account">;
112
+ code: string;
113
113
  expirationTime: number;
114
114
  }, {
115
115
  accountId: convex_values121.VId<convex_values121.GenericId<"Account">, "required">;
@@ -119,7 +119,7 @@ declare const _default: convex_server66.SchemaDefinition<{
119
119
  verifier: convex_values121.VString<string | undefined, "optional">;
120
120
  emailVerified: convex_values121.VString<string | undefined, "optional">;
121
121
  phoneVerified: convex_values121.VString<string | undefined, "optional">;
122
- }, "required", "provider" | "code" | "accountId" | "expirationTime" | "verifier" | "emailVerified" | "phoneVerified">, {
122
+ }, "required", "provider" | "verifier" | "accountId" | "code" | "expirationTime" | "emailVerified" | "phoneVerified">, {
123
123
  account_id: ["accountId", "_creationTime"];
124
124
  code: ["code", "_creationTime"];
125
125
  }, {}, {}>;
@@ -165,7 +165,7 @@ declare const _default: convex_server66.SchemaDefinition<{
165
165
  name: convex_values121.VString<string | undefined, "optional">;
166
166
  createdAt: convex_values121.VFloat64<number, "required">;
167
167
  lastUsedAt: convex_values121.VFloat64<number | undefined, "optional">;
168
- }, "required", "userId" | "name" | "credentialId" | "publicKey" | "algorithm" | "counter" | "transports" | "deviceType" | "backedUp" | "createdAt" | "lastUsedAt">, {
168
+ }, "required", "name" | "userId" | "credentialId" | "publicKey" | "algorithm" | "counter" | "transports" | "deviceType" | "backedUp" | "createdAt" | "lastUsedAt">, {
169
169
  user_id: ["userId", "_creationTime"];
170
170
  credential_id: ["credentialId", "_creationTime"];
171
171
  }, {}, {}>;
@@ -196,7 +196,7 @@ declare const _default: convex_server66.SchemaDefinition<{
196
196
  name: convex_values121.VString<string | undefined, "optional">;
197
197
  createdAt: convex_values121.VFloat64<number, "required">;
198
198
  lastUsedAt: convex_values121.VFloat64<number | undefined, "optional">;
199
- }, "required", "userId" | "secret" | "name" | "createdAt" | "lastUsedAt" | "digits" | "period" | "verified">, {
199
+ }, "required", "name" | "userId" | "secret" | "createdAt" | "lastUsedAt" | "digits" | "period" | "verified">, {
200
200
  user_id: ["userId", "_creationTime"];
201
201
  user_id_verified: ["userId", "verified", "_creationTime"];
202
202
  }, {}, {}>;
@@ -223,7 +223,7 @@ declare const _default: convex_server66.SchemaDefinition<{
223
223
  userId: convex_values121.VId<convex_values121.GenericId<"User"> | undefined, "optional">; /** Set when the user authorizes — the session created for the device. */
224
224
  sessionId: convex_values121.VId<convex_values121.GenericId<"Session"> | undefined, "optional">; /** Timestamp of the last poll request (for slow_down enforcement). */
225
225
  lastPolledAt: convex_values121.VFloat64<number | undefined, "optional">;
226
- }, "required", "userId" | "status" | "sessionId" | "deviceCodeHash" | "userCode" | "expiresAt" | "interval" | "lastPolledAt">, {
226
+ }, "required", "status" | "userId" | "sessionId" | "deviceCodeHash" | "userCode" | "expiresAt" | "interval" | "lastPolledAt">, {
227
227
  device_code_hash: ["deviceCodeHash", "_creationTime"];
228
228
  user_code_status: ["userCode", "status", "_creationTime"];
229
229
  }, {}, {}>;
@@ -276,7 +276,7 @@ declare const _default: convex_server66.SchemaDefinition<{
276
276
  value: convex_values121.VString<string, "required">;
277
277
  }, "required", "value" | "key">, "optional">;
278
278
  extend: convex_values121.VAny<any, "optional", string>;
279
- }, "required", "type" | "extend" | "name" | `extend.${string}` | "slug" | "parentGroupId" | "rootGroupId" | "isRoot" | "tags">, {
279
+ }, "required", "type" | "extend" | "name" | "slug" | `extend.${string}` | "parentGroupId" | "rootGroupId" | "isRoot" | "tags">, {
280
280
  slug: ["slug", "_creationTime"];
281
281
  parent_group_id: ["parentGroupId", "_creationTime"];
282
282
  root_group_id: ["rootGroupId", "_creationTime"];
@@ -312,8 +312,8 @@ declare const _default: convex_server66.SchemaDefinition<{
312
312
  status?: string | undefined;
313
313
  role?: string | undefined;
314
314
  roleIds?: string[] | undefined;
315
- userId: convex_values121.GenericId<"User">;
316
315
  groupId: convex_values121.GenericId<"Group">;
316
+ userId: convex_values121.GenericId<"User">;
317
317
  }, {
318
318
  groupId: convex_values121.VId<convex_values121.GenericId<"Group">, "required">;
319
319
  userId: convex_values121.VId<convex_values121.GenericId<"User">, "required">;
@@ -321,7 +321,7 @@ declare const _default: convex_server66.SchemaDefinition<{
321
321
  roleIds: convex_values121.VArray<string[] | undefined, convex_values121.VString<string, "required">, "optional">;
322
322
  status: convex_values121.VString<string | undefined, "optional">;
323
323
  extend: convex_values121.VAny<any, "optional", string>;
324
- }, "required", "userId" | "extend" | "status" | `extend.${string}` | "groupId" | "role" | "roleIds">, {
324
+ }, "required", "groupId" | "extend" | "status" | "userId" | `extend.${string}` | "role" | "roleIds">, {
325
325
  group_id: ["groupId", "_creationTime"];
326
326
  group_id_user_id: ["groupId", "userId", "_creationTime"];
327
327
  group_id_status: ["groupId", "status", "_creationTime"];
@@ -336,9 +336,9 @@ declare const _default: convex_server66.SchemaDefinition<{
336
336
  * invite links where neither is known upfront.
337
337
  */
338
338
  GroupInvite: convex_server66.TableDefinition<convex_values121.VObject<{
339
- email?: string | undefined;
340
- extend?: any;
341
339
  groupId?: convex_values121.GenericId<"Group"> | undefined;
340
+ extend?: any;
341
+ email?: string | undefined;
342
342
  role?: string | undefined;
343
343
  roleIds?: string[] | undefined;
344
344
  invitedByUserId?: convex_values121.GenericId<"User"> | undefined;
@@ -359,7 +359,7 @@ declare const _default: convex_server66.SchemaDefinition<{
359
359
  acceptedByUserId: convex_values121.VId<convex_values121.GenericId<"User"> | undefined, "optional">;
360
360
  acceptedTime: convex_values121.VFloat64<number | undefined, "optional">;
361
361
  extend: convex_values121.VAny<any, "optional", string>;
362
- }, "required", "email" | "extend" | "status" | `extend.${string}` | "groupId" | "role" | "roleIds" | "invitedByUserId" | "tokenHash" | "expiresTime" | "acceptedByUserId" | "acceptedTime">, {
362
+ }, "required", "groupId" | "extend" | "status" | "email" | `extend.${string}` | "role" | "roleIds" | "invitedByUserId" | "tokenHash" | "expiresTime" | "acceptedByUserId" | "acceptedTime">, {
363
363
  token_hash: ["tokenHash", "_creationTime"];
364
364
  status: ["status", "_creationTime"];
365
365
  email_status: ["email", "status", "_creationTime"];
@@ -402,8 +402,8 @@ declare const _default: convex_server66.SchemaDefinition<{
402
402
  };
403
403
  } | undefined;
404
404
  config?: any;
405
- status: "draft" | "active" | "disabled";
406
405
  groupId: convex_values121.GenericId<"Group">;
406
+ status: "draft" | "active" | "disabled";
407
407
  }, {
408
408
  groupId: convex_values121.VId<convex_values121.GenericId<"Group">, "required">;
409
409
  slug: convex_values121.VString<string | undefined, "optional">;
@@ -484,7 +484,7 @@ declare const _default: convex_server66.SchemaDefinition<{
484
484
  }, "optional", "extend" | `extend.${string}` | "version" | "identity" | "provisioning" | "identity.accountLinking" | "identity.accountLinking.oidc" | "identity.accountLinking.saml" | "provisioning.scimReuse" | "provisioning.jit" | "provisioning.deprovision" | "provisioning.scimReuse.user" | "provisioning.jit.mode" | "provisioning.jit.defaultRole" | "provisioning.jit.defaultRoleIds" | "provisioning.deprovision.mode">;
485
485
  config: convex_values121.VAny<any, "optional", string>;
486
486
  extend: convex_values121.VAny<any, "optional", string>;
487
- }, "required", "extend" | "status" | "name" | `extend.${string}` | "slug" | "groupId" | "policy" | "config" | "policy.extend" | `policy.extend.${string}` | "policy.version" | "policy.identity" | "policy.provisioning" | "policy.identity.accountLinking" | "policy.identity.accountLinking.oidc" | "policy.identity.accountLinking.saml" | "policy.provisioning.scimReuse" | "policy.provisioning.jit" | "policy.provisioning.deprovision" | "policy.provisioning.scimReuse.user" | "policy.provisioning.jit.mode" | "policy.provisioning.jit.defaultRole" | "policy.provisioning.jit.defaultRoleIds" | "policy.provisioning.deprovision.mode" | `config.${string}`>, {
487
+ }, "required", "groupId" | "extend" | "name" | "slug" | "status" | `extend.${string}` | "policy" | "config" | "policy.extend" | `policy.extend.${string}` | "policy.version" | "policy.identity" | "policy.provisioning" | "policy.identity.accountLinking" | "policy.identity.accountLinking.oidc" | "policy.identity.accountLinking.saml" | "policy.provisioning.scimReuse" | "policy.provisioning.jit" | "policy.provisioning.deprovision" | "policy.provisioning.scimReuse.user" | "policy.provisioning.jit.mode" | "policy.provisioning.jit.defaultRole" | "policy.provisioning.jit.defaultRoleIds" | "policy.provisioning.deprovision.mode" | `config.${string}`>, {
488
488
  group_id: ["groupId", "_creationTime"];
489
489
  slug: ["slug", "_creationTime"];
490
490
  status: ["status", "_creationTime"];
@@ -495,8 +495,8 @@ declare const _default: convex_server66.SchemaDefinition<{
495
495
  EnterpriseDomain: convex_server66.TableDefinition<convex_values121.VObject<{
496
496
  verifiedAt?: number | undefined;
497
497
  groupId: convex_values121.GenericId<"Group">;
498
- enterpriseId: convex_values121.GenericId<"Enterprise">;
499
498
  domain: string;
499
+ enterpriseId: convex_values121.GenericId<"Enterprise">;
500
500
  isPrimary: boolean;
501
501
  }, {
502
502
  enterpriseId: convex_values121.VId<convex_values121.GenericId<"Enterprise">, "required">;
@@ -504,7 +504,7 @@ declare const _default: convex_server66.SchemaDefinition<{
504
504
  domain: convex_values121.VString<string, "required">;
505
505
  isPrimary: convex_values121.VBoolean<boolean, "required">;
506
506
  verifiedAt: convex_values121.VFloat64<number | undefined, "optional">;
507
- }, "required", "groupId" | "enterpriseId" | "domain" | "isPrimary" | "verifiedAt">, {
507
+ }, "required", "groupId" | "domain" | "enterpriseId" | "isPrimary" | "verifiedAt">, {
508
508
  enterprise_id: ["enterpriseId", "_creationTime"];
509
509
  group_id: ["groupId", "_creationTime"];
510
510
  domain: ["domain", "_creationTime"];
@@ -513,11 +513,11 @@ declare const _default: convex_server66.SchemaDefinition<{
513
513
  * Pending DNS TXT verification challenges for enterprise domains.
514
514
  */
515
515
  EnterpriseDomainVerification: convex_server66.TableDefinition<convex_values121.VObject<{
516
- expiresAt: number;
517
516
  groupId: convex_values121.GenericId<"Group">;
517
+ domain: string;
518
+ expiresAt: number;
518
519
  tokenHash: string;
519
520
  enterpriseId: convex_values121.GenericId<"Enterprise">;
520
- domain: string;
521
521
  domainId: convex_values121.GenericId<"EnterpriseDomain">;
522
522
  recordName: string;
523
523
  token: string;
@@ -532,7 +532,7 @@ declare const _default: convex_server66.SchemaDefinition<{
532
532
  tokenHash: convex_values121.VString<string, "required">;
533
533
  requestedAt: convex_values121.VFloat64<number, "required">;
534
534
  expiresAt: convex_values121.VFloat64<number, "required">;
535
- }, "required", "expiresAt" | "groupId" | "tokenHash" | "enterpriseId" | "domain" | "domainId" | "recordName" | "token" | "requestedAt">, {
535
+ }, "required", "groupId" | "domain" | "expiresAt" | "tokenHash" | "enterpriseId" | "domainId" | "recordName" | "token" | "requestedAt">, {
536
536
  enterprise_id: ["enterpriseId", "_creationTime"];
537
537
  domain_id: ["domainId", "_creationTime"];
538
538
  token_hash: ["tokenHash", "_creationTime"];
@@ -542,17 +542,17 @@ declare const _default: convex_server66.SchemaDefinition<{
542
542
  */
543
543
  EnterpriseSecret: convex_server66.TableDefinition<convex_values121.VObject<{
544
544
  groupId: convex_values121.GenericId<"Group">;
545
+ kind: "oidc_client_secret";
545
546
  enterpriseId: convex_values121.GenericId<"Enterprise">;
546
547
  ciphertext: string;
547
548
  updatedAt: number;
548
- kind: "oidc_client_secret";
549
549
  }, {
550
550
  enterpriseId: convex_values121.VId<convex_values121.GenericId<"Enterprise">, "required">;
551
551
  groupId: convex_values121.VId<convex_values121.GenericId<"Group">, "required">;
552
552
  kind: convex_values121.VUnion<"oidc_client_secret", [convex_values121.VLiteral<"oidc_client_secret", "required">], "required", never>;
553
553
  ciphertext: convex_values121.VString<string, "required">;
554
554
  updatedAt: convex_values121.VFloat64<number, "required">;
555
- }, "required", "groupId" | "enterpriseId" | "ciphertext" | "updatedAt" | "kind">, {
555
+ }, "required", "groupId" | "kind" | "enterpriseId" | "ciphertext" | "updatedAt">, {
556
556
  enterprise_id: ["enterpriseId", "_creationTime"];
557
557
  enterprise_id_kind: ["enterpriseId", "kind", "_creationTime"];
558
558
  group_id: ["groupId", "_creationTime"];
@@ -563,8 +563,8 @@ declare const _default: convex_server66.SchemaDefinition<{
563
563
  EnterpriseScimConfig: convex_server66.TableDefinition<convex_values121.VObject<{
564
564
  extend?: any;
565
565
  lastRotatedAt?: number | undefined;
566
- status: "draft" | "active" | "disabled";
567
566
  groupId: convex_values121.GenericId<"Group">;
567
+ status: "draft" | "active" | "disabled";
568
568
  tokenHash: string;
569
569
  enterpriseId: convex_values121.GenericId<"Enterprise">;
570
570
  basePath: string;
@@ -576,7 +576,7 @@ declare const _default: convex_server66.SchemaDefinition<{
576
576
  tokenHash: convex_values121.VString<string, "required">;
577
577
  lastRotatedAt: convex_values121.VFloat64<number | undefined, "optional">;
578
578
  extend: convex_values121.VAny<any, "optional", string>;
579
- }, "required", "extend" | "status" | `extend.${string}` | "groupId" | "tokenHash" | "enterpriseId" | "basePath" | "lastRotatedAt">, {
579
+ }, "required", "groupId" | "extend" | "status" | `extend.${string}` | "tokenHash" | "enterpriseId" | "basePath" | "lastRotatedAt">, {
580
580
  enterprise_id: ["enterpriseId", "_creationTime"];
581
581
  group_id: ["groupId", "_creationTime"];
582
582
  token_hash: ["tokenHash", "_creationTime"];
@@ -586,26 +586,26 @@ declare const _default: convex_server66.SchemaDefinition<{
586
586
  * External SCIM identities mapped into local users/groups.
587
587
  */
588
588
  EnterpriseScimIdentity: convex_server66.TableDefinition<convex_values121.VObject<{
589
- userId?: convex_values121.GenericId<"User"> | undefined;
590
589
  active?: boolean | undefined;
590
+ userId?: convex_values121.GenericId<"User"> | undefined;
591
591
  mappedGroupId?: convex_values121.GenericId<"Group"> | undefined;
592
592
  lastProvisionedAt?: number | undefined;
593
593
  raw?: any;
594
594
  groupId: convex_values121.GenericId<"Group">;
595
595
  externalId: string;
596
596
  enterpriseId: convex_values121.GenericId<"Enterprise">;
597
- resourceType: "user" | "group";
597
+ resourceType: "group" | "user";
598
598
  }, {
599
599
  enterpriseId: convex_values121.VId<convex_values121.GenericId<"Enterprise">, "required">;
600
600
  groupId: convex_values121.VId<convex_values121.GenericId<"Group">, "required">;
601
- resourceType: convex_values121.VUnion<"user" | "group", [convex_values121.VLiteral<"user", "required">, convex_values121.VLiteral<"group", "required">], "required", never>;
601
+ resourceType: convex_values121.VUnion<"group" | "user", [convex_values121.VLiteral<"user", "required">, convex_values121.VLiteral<"group", "required">], "required", never>;
602
602
  externalId: convex_values121.VString<string, "required">;
603
603
  userId: convex_values121.VId<convex_values121.GenericId<"User"> | undefined, "optional">;
604
604
  mappedGroupId: convex_values121.VId<convex_values121.GenericId<"Group"> | undefined, "optional">;
605
605
  lastProvisionedAt: convex_values121.VFloat64<number | undefined, "optional">;
606
606
  active: convex_values121.VBoolean<boolean | undefined, "optional">;
607
607
  raw: convex_values121.VAny<any, "optional", string>;
608
- }, "required", "userId" | "groupId" | "active" | "externalId" | "enterpriseId" | "resourceType" | "mappedGroupId" | "lastProvisionedAt" | "raw" | `raw.${string}`>, {
608
+ }, "required", "groupId" | "active" | "userId" | "externalId" | "enterpriseId" | "resourceType" | "mappedGroupId" | "lastProvisionedAt" | "raw" | `raw.${string}`>, {
609
609
  enterprise_id: ["enterpriseId", "_creationTime"];
610
610
  group_id: ["groupId", "_creationTime"];
611
611
  enterprise_id_resource_type_external_id: ["enterpriseId", "resourceType", "externalId", "_creationTime"];
@@ -622,8 +622,8 @@ declare const _default: convex_server66.SchemaDefinition<{
622
622
  requestId?: string | undefined;
623
623
  ip?: string | undefined;
624
624
  metadata?: any;
625
- status: "success" | "failure";
626
625
  groupId: convex_values121.GenericId<"Group">;
626
+ status: "success" | "failure";
627
627
  enterpriseId: convex_values121.GenericId<"Enterprise">;
628
628
  actorType: "user" | "system" | "scim" | "api_key" | "webhook";
629
629
  eventType: string;
@@ -642,7 +642,7 @@ declare const _default: convex_server66.SchemaDefinition<{
642
642
  requestId: convex_values121.VString<string | undefined, "optional">;
643
643
  ip: convex_values121.VString<string | undefined, "optional">;
644
644
  metadata: convex_values121.VAny<any, "optional", string>;
645
- }, "required", "status" | "groupId" | "enterpriseId" | "actorType" | "eventType" | "actorId" | "subjectType" | "subjectId" | "occurredAt" | "requestId" | "ip" | "metadata" | `metadata.${string}`>, {
645
+ }, "required", "groupId" | "status" | "enterpriseId" | "actorType" | "eventType" | "actorId" | "subjectType" | "subjectId" | "occurredAt" | "requestId" | "ip" | "metadata" | `metadata.${string}`>, {
646
646
  enterprise_id_occurred_at: ["enterpriseId", "occurredAt", "_creationTime"];
647
647
  group_id_occurred_at: ["groupId", "occurredAt", "_creationTime"];
648
648
  event_type_occurred_at: ["eventType", "occurredAt", "_creationTime"];
@@ -655,8 +655,8 @@ declare const _default: convex_server66.SchemaDefinition<{
655
655
  createdByUserId?: convex_values121.GenericId<"User"> | undefined;
656
656
  lastSuccessAt?: number | undefined;
657
657
  lastFailureAt?: number | undefined;
658
- status: "active" | "disabled";
659
658
  groupId: convex_values121.GenericId<"Group">;
659
+ status: "active" | "disabled";
660
660
  enterpriseId: convex_values121.GenericId<"Enterprise">;
661
661
  url: string;
662
662
  secretHash: string;
@@ -674,7 +674,7 @@ declare const _default: convex_server66.SchemaDefinition<{
674
674
  lastFailureAt: convex_values121.VFloat64<number | undefined, "optional">;
675
675
  failureCount: convex_values121.VFloat64<number, "required">;
676
676
  extend: convex_values121.VAny<any, "optional", string>;
677
- }, "required", "extend" | "status" | `extend.${string}` | "groupId" | "enterpriseId" | "url" | "secretHash" | "subscriptions" | "createdByUserId" | "lastSuccessAt" | "lastFailureAt" | "failureCount">, {
677
+ }, "required", "groupId" | "extend" | "status" | `extend.${string}` | "enterpriseId" | "url" | "secretHash" | "subscriptions" | "createdByUserId" | "lastSuccessAt" | "lastFailureAt" | "failureCount">, {
678
678
  enterprise_id: ["enterpriseId", "_creationTime"];
679
679
  group_id: ["groupId", "_creationTime"];
680
680
  status: ["status", "_creationTime"];
@@ -737,8 +737,8 @@ declare const _default: convex_server66.SchemaDefinition<{
737
737
  attemptsLeft: number;
738
738
  lastAttemptTime: number;
739
739
  } | undefined;
740
- userId: convex_values121.GenericId<"User">;
741
740
  name: string;
741
+ userId: convex_values121.GenericId<"User">;
742
742
  createdAt: number;
743
743
  revoked: boolean;
744
744
  prefix: string;
@@ -781,7 +781,7 @@ declare const _default: convex_server66.SchemaDefinition<{
781
781
  createdAt: convex_values121.VFloat64<number, "required">; /** Soft-revoke flag. Revoked keys are kept for audit trail. */
782
782
  revoked: convex_values121.VBoolean<boolean, "required">; /** Arbitrary app-specific metadata attached to the key. */
783
783
  metadata: convex_values121.VAny<any, "optional", string>;
784
- }, "required", "userId" | "name" | "createdAt" | "lastUsedAt" | "expiresAt" | "revoked" | "metadata" | `metadata.${string}` | "prefix" | "hashedKey" | "scopes" | "rateLimit" | "rateLimitState" | "rateLimit.maxRequests" | "rateLimit.windowMs" | "rateLimitState.attemptsLeft" | "rateLimitState.lastAttemptTime">, {
784
+ }, "required", "name" | "userId" | "createdAt" | "lastUsedAt" | "expiresAt" | "revoked" | "metadata" | `metadata.${string}` | "prefix" | "hashedKey" | "scopes" | "rateLimit" | "rateLimitState" | "rateLimit.maxRequests" | "rateLimit.windowMs" | "rateLimitState.attemptsLeft" | "rateLimitState.lastAttemptTime">, {
785
785
  user_id: ["userId", "_creationTime"];
786
786
  hashed_key: ["hashedKey", "_creationTime"];
787
787
  }, {}, {}>;