@softistx/janus 0.0.0-stage → 0.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (911) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2929 -2
  3. package/dist/auth/api-keys/authenticate-key.d.ts +21 -0
  4. package/dist/auth/api-keys/authenticate-key.d.ts.map +1 -0
  5. package/dist/auth/api-keys/bound.d.ts +11 -0
  6. package/dist/auth/api-keys/bound.d.ts.map +1 -0
  7. package/dist/auth/api-keys/count.d.ts +8 -0
  8. package/dist/auth/api-keys/count.d.ts.map +1 -0
  9. package/dist/auth/api-keys/create/checks.d.ts +42 -0
  10. package/dist/auth/api-keys/create/checks.d.ts.map +1 -0
  11. package/dist/auth/api-keys/create/index.d.ts +10 -0
  12. package/dist/auth/api-keys/create/index.d.ts.map +1 -0
  13. package/dist/auth/api-keys/events.d.ts +22 -0
  14. package/dist/auth/api-keys/events.d.ts.map +1 -0
  15. package/dist/auth/api-keys/expiry.d.ts +11 -0
  16. package/dist/auth/api-keys/expiry.d.ts.map +1 -0
  17. package/dist/auth/api-keys/flows.d.ts +13 -0
  18. package/dist/auth/api-keys/flows.d.ts.map +1 -0
  19. package/dist/auth/api-keys/index.d.ts +11 -0
  20. package/dist/auth/api-keys/index.d.ts.map +1 -0
  21. package/dist/auth/api-keys/read.d.ts +10 -0
  22. package/dist/auth/api-keys/read.d.ts.map +1 -0
  23. package/dist/auth/api-keys/shape.d.ts +24 -0
  24. package/dist/auth/api-keys/shape.d.ts.map +1 -0
  25. package/dist/auth/api-keys/to-api-key.d.ts +8 -0
  26. package/dist/auth/api-keys/to-api-key.d.ts.map +1 -0
  27. package/dist/auth/api-keys/token.d.ts +23 -0
  28. package/dist/auth/api-keys/token.d.ts.map +1 -0
  29. package/dist/auth/api-keys/user-bound.d.ts +10 -0
  30. package/dist/auth/api-keys/user-bound.d.ts.map +1 -0
  31. package/dist/auth/at.d.ts +9 -0
  32. package/dist/auth/at.d.ts.map +1 -0
  33. package/dist/auth/avatar/any-type.d.ts +13 -0
  34. package/dist/auth/avatar/any-type.d.ts.map +1 -0
  35. package/dist/auth/avatar/flows.d.ts +7 -0
  36. package/dist/auth/avatar/flows.d.ts.map +1 -0
  37. package/dist/auth/avatar/id.d.ts +10 -0
  38. package/dist/auth/avatar/id.d.ts.map +1 -0
  39. package/dist/auth/avatar/index.d.ts +7 -0
  40. package/dist/auth/avatar/index.d.ts.map +1 -0
  41. package/dist/auth/avatar/remove.d.ts +10 -0
  42. package/dist/auth/avatar/remove.d.ts.map +1 -0
  43. package/dist/auth/avatar/set.d.ts +12 -0
  44. package/dist/auth/avatar/set.d.ts.map +1 -0
  45. package/dist/auth/concurrency-limit.d.ts +13 -0
  46. package/dist/auth/concurrency-limit.d.ts.map +1 -0
  47. package/dist/auth/config/api-keys-config.d.ts +33 -0
  48. package/dist/auth/config/api-keys-config.d.ts.map +1 -0
  49. package/dist/auth/config/hasher.d.ts +22 -0
  50. package/dist/auth/config/hasher.d.ts.map +1 -0
  51. package/dist/auth/config/index.d.ts +24 -0
  52. package/dist/auth/config/index.d.ts.map +1 -0
  53. package/dist/auth/config/invitations-config.d.ts +74 -0
  54. package/dist/auth/config/invitations-config.d.ts.map +1 -0
  55. package/dist/auth/config/janus-config.d.ts +233 -0
  56. package/dist/auth/config/janus-config.d.ts.map +1 -0
  57. package/dist/auth/config/magic-link-config.d.ts +6 -0
  58. package/dist/auth/config/magic-link-config.d.ts.map +1 -0
  59. package/dist/auth/config/names.d.ts +9 -0
  60. package/dist/auth/config/names.d.ts.map +1 -0
  61. package/dist/auth/config/normalize.d.ts +26 -0
  62. package/dist/auth/config/normalize.d.ts.map +1 -0
  63. package/dist/auth/config/passkeys-config.d.ts +49 -0
  64. package/dist/auth/config/passkeys-config.d.ts.map +1 -0
  65. package/dist/auth/config/password-config.d.ts +22 -0
  66. package/dist/auth/config/password-config.d.ts.map +1 -0
  67. package/dist/auth/config/reserved.d.ts +14 -0
  68. package/dist/auth/config/reserved.d.ts.map +1 -0
  69. package/dist/auth/config/resolve-api-keys.d.ts +5 -0
  70. package/dist/auth/config/resolve-api-keys.d.ts.map +1 -0
  71. package/dist/auth/config/resolve-config.d.ts +9 -0
  72. package/dist/auth/config/resolve-config.d.ts.map +1 -0
  73. package/dist/auth/config/resolve-cookie.d.ts +5 -0
  74. package/dist/auth/config/resolve-cookie.d.ts.map +1 -0
  75. package/dist/auth/config/resolve-devices.d.ts +5 -0
  76. package/dist/auth/config/resolve-devices.d.ts.map +1 -0
  77. package/dist/auth/config/resolve-invitation-types.d.ts +5 -0
  78. package/dist/auth/config/resolve-invitation-types.d.ts.map +1 -0
  79. package/dist/auth/config/resolve-invitations.d.ts +5 -0
  80. package/dist/auth/config/resolve-invitations.d.ts.map +1 -0
  81. package/dist/auth/config/resolve-magic-link.d.ts +4 -0
  82. package/dist/auth/config/resolve-magic-link.d.ts.map +1 -0
  83. package/dist/auth/config/resolve-passkeys.d.ts +5 -0
  84. package/dist/auth/config/resolve-passkeys.d.ts.map +1 -0
  85. package/dist/auth/config/resolve-second-factor.d.ts +5 -0
  86. package/dist/auth/config/resolve-second-factor.d.ts.map +1 -0
  87. package/dist/auth/config/resolve-social.d.ts +17 -0
  88. package/dist/auth/config/resolve-social.d.ts.map +1 -0
  89. package/dist/auth/config/resolve-throttle.d.ts +37 -0
  90. package/dist/auth/config/resolve-throttle.d.ts.map +1 -0
  91. package/dist/auth/config/resolve-type.d.ts +6 -0
  92. package/dist/auth/config/resolve-type.d.ts.map +1 -0
  93. package/dist/auth/config/resolved-config.d.ts +126 -0
  94. package/dist/auth/config/resolved-config.d.ts.map +1 -0
  95. package/dist/auth/config/social-config.d.ts +154 -0
  96. package/dist/auth/config/social-config.d.ts.map +1 -0
  97. package/dist/auth/config/user-type.d.ts +79 -0
  98. package/dist/auth/config/user-type.d.ts.map +1 -0
  99. package/dist/auth/config/warn-throttle-window.d.ts +14 -0
  100. package/dist/auth/config/warn-throttle-window.d.ts.map +1 -0
  101. package/dist/auth/context/create-context.d.ts +31 -0
  102. package/dist/auth/context/create-context.d.ts.map +1 -0
  103. package/dist/auth/context/index.d.ts +17 -0
  104. package/dist/auth/context/index.d.ts.map +1 -0
  105. package/dist/auth/context/logins.d.ts +28 -0
  106. package/dist/auth/context/logins.d.ts.map +1 -0
  107. package/dist/auth/context/password.d.ts +34 -0
  108. package/dist/auth/context/password.d.ts.map +1 -0
  109. package/dist/auth/context/records.d.ts +27 -0
  110. package/dist/auth/context/records.d.ts.map +1 -0
  111. package/dist/auth/context/user.d.ts +21 -0
  112. package/dist/auth/context/user.d.ts.map +1 -0
  113. package/dist/auth/context/validate-fields.d.ts +12 -0
  114. package/dist/auth/context/validate-fields.d.ts.map +1 -0
  115. package/dist/auth/counter-key.d.ts +20 -0
  116. package/dist/auth/counter-key.d.ts.map +1 -0
  117. package/dist/auth/derived-keys.d.ts +9 -0
  118. package/dist/auth/derived-keys.d.ts.map +1 -0
  119. package/dist/auth/devices/cookie.d.ts +56 -0
  120. package/dist/auth/devices/cookie.d.ts.map +1 -0
  121. package/dist/auth/devices/hint.d.ts +42 -0
  122. package/dist/auth/devices/hint.d.ts.map +1 -0
  123. package/dist/auth/devices/index.d.ts +11 -0
  124. package/dist/auth/devices/index.d.ts.map +1 -0
  125. package/dist/auth/devices/report.d.ts +11 -0
  126. package/dist/auth/devices/report.d.ts.map +1 -0
  127. package/dist/auth/devices/token.d.ts +13 -0
  128. package/dist/auth/devices/token.d.ts.map +1 -0
  129. package/dist/auth/email-flows/any-type-change-email.d.ts +18 -0
  130. package/dist/auth/email-flows/any-type-change-email.d.ts.map +1 -0
  131. package/dist/auth/email-flows/any-type-reset-password.d.ts +19 -0
  132. package/dist/auth/email-flows/any-type-reset-password.d.ts.map +1 -0
  133. package/dist/auth/email-flows/any-type-verify-email.d.ts +18 -0
  134. package/dist/auth/email-flows/any-type-verify-email.d.ts.map +1 -0
  135. package/dist/auth/email-flows/change-email-token.d.ts +47 -0
  136. package/dist/auth/email-flows/change-email-token.d.ts.map +1 -0
  137. package/dist/auth/email-flows/change-email.d.ts +17 -0
  138. package/dist/auth/email-flows/change-email.d.ts.map +1 -0
  139. package/dist/auth/email-flows/confirm-reset.d.ts +16 -0
  140. package/dist/auth/email-flows/confirm-reset.d.ts.map +1 -0
  141. package/dist/auth/email-flows/email-token.d.ts +30 -0
  142. package/dist/auth/email-flows/email-token.d.ts.map +1 -0
  143. package/dist/auth/email-flows/flows.d.ts +13 -0
  144. package/dist/auth/email-flows/flows.d.ts.map +1 -0
  145. package/dist/auth/email-flows/index.d.ts +10 -0
  146. package/dist/auth/email-flows/index.d.ts.map +1 -0
  147. package/dist/auth/email-flows/owner-of.d.ts +17 -0
  148. package/dist/auth/email-flows/owner-of.d.ts.map +1 -0
  149. package/dist/auth/email-flows/prove-first.d.ts +45 -0
  150. package/dist/auth/email-flows/prove-first.d.ts.map +1 -0
  151. package/dist/auth/email-flows/reset-password.d.ts +17 -0
  152. package/dist/auth/email-flows/reset-password.d.ts.map +1 -0
  153. package/dist/auth/email-flows/set-email-verified.d.ts +19 -0
  154. package/dist/auth/email-flows/set-email-verified.d.ts.map +1 -0
  155. package/dist/auth/email-flows/verify-email.d.ts +25 -0
  156. package/dist/auth/email-flows/verify-email.d.ts.map +1 -0
  157. package/dist/auth/email-sign-in.d.ts +51 -0
  158. package/dist/auth/email-sign-in.d.ts.map +1 -0
  159. package/dist/auth/events.d.ts +166 -0
  160. package/dist/auth/events.d.ts.map +1 -0
  161. package/dist/auth/first-proof.d.ts +43 -0
  162. package/dist/auth/first-proof.d.ts.map +1 -0
  163. package/dist/auth/hashers.d.ts +52 -0
  164. package/dist/auth/hashers.d.ts.map +1 -0
  165. package/dist/auth/index.d.ts +22 -0
  166. package/dist/auth/index.d.ts.map +1 -0
  167. package/dist/auth/invitations/accept.d.ts +10 -0
  168. package/dist/auth/invitations/accept.d.ts.map +1 -0
  169. package/dist/auth/invitations/change-pending.d.ts +17 -0
  170. package/dist/auth/invitations/change-pending.d.ts.map +1 -0
  171. package/dist/auth/invitations/claim.d.ts +31 -0
  172. package/dist/auth/invitations/claim.d.ts.map +1 -0
  173. package/dist/auth/invitations/events.d.ts +46 -0
  174. package/dist/auth/invitations/events.d.ts.map +1 -0
  175. package/dist/auth/invitations/find-invitee.d.ts +20 -0
  176. package/dist/auth/invitations/find-invitee.d.ts.map +1 -0
  177. package/dist/auth/invitations/find-pending.d.ts +5 -0
  178. package/dist/auth/invitations/find-pending.d.ts.map +1 -0
  179. package/dist/auth/invitations/flows.d.ts +7 -0
  180. package/dist/auth/invitations/flows.d.ts.map +1 -0
  181. package/dist/auth/invitations/history-input.d.ts +29 -0
  182. package/dist/auth/invitations/history-input.d.ts.map +1 -0
  183. package/dist/auth/invitations/history.d.ts +10 -0
  184. package/dist/auth/invitations/history.d.ts.map +1 -0
  185. package/dist/auth/invitations/index.d.ts +11 -0
  186. package/dist/auth/invitations/index.d.ts.map +1 -0
  187. package/dist/auth/invitations/input.d.ts +30 -0
  188. package/dist/auth/invitations/input.d.ts.map +1 -0
  189. package/dist/auth/invitations/invited-type.d.ts +22 -0
  190. package/dist/auth/invitations/invited-type.d.ts.map +1 -0
  191. package/dist/auth/invitations/invitee.d.ts +11 -0
  192. package/dist/auth/invitations/invitee.d.ts.map +1 -0
  193. package/dist/auth/invitations/issue.d.ts +9 -0
  194. package/dist/auth/invitations/issue.d.ts.map +1 -0
  195. package/dist/auth/invitations/limit.d.ts +7 -0
  196. package/dist/auth/invitations/limit.d.ts.map +1 -0
  197. package/dist/auth/invitations/password-invitee.d.ts +18 -0
  198. package/dist/auth/invitations/password-invitee.d.ts.map +1 -0
  199. package/dist/auth/invitations/passwordless-invitee.d.ts +13 -0
  200. package/dist/auth/invitations/passwordless-invitee.d.ts.map +1 -0
  201. package/dist/auth/invitations/preview.d.ts +8 -0
  202. package/dist/auth/invitations/preview.d.ts.map +1 -0
  203. package/dist/auth/invitations/read.d.ts +10 -0
  204. package/dist/auth/invitations/read.d.ts.map +1 -0
  205. package/dist/auth/invitations/resend.d.ts +12 -0
  206. package/dist/auth/invitations/resend.d.ts.map +1 -0
  207. package/dist/auth/invitations/to-invitation.d.ts +11 -0
  208. package/dist/auth/invitations/to-invitation.d.ts.map +1 -0
  209. package/dist/auth/invitations/write.d.ts +17 -0
  210. package/dist/auth/invitations/write.d.ts.map +1 -0
  211. package/dist/auth/issuers/cache.d.ts +21 -0
  212. package/dist/auth/issuers/cache.d.ts.map +1 -0
  213. package/dist/auth/issuers/create.d.ts +18 -0
  214. package/dist/auth/issuers/create.d.ts.map +1 -0
  215. package/dist/auth/issuers/index.d.ts +3 -0
  216. package/dist/auth/issuers/index.d.ts.map +1 -0
  217. package/dist/auth/issuers/types.d.ts +45 -0
  218. package/dist/auth/issuers/types.d.ts.map +1 -0
  219. package/dist/auth/janus.d.ts +39 -0
  220. package/dist/auth/janus.d.ts.map +1 -0
  221. package/dist/auth/magic-link.d.ts +25 -0
  222. package/dist/auth/magic-link.d.ts.map +1 -0
  223. package/dist/auth/mail-requests.d.ts +55 -0
  224. package/dist/auth/mail-requests.d.ts.map +1 -0
  225. package/dist/auth/one-time/codes.d.ts +46 -0
  226. package/dist/auth/one-time/codes.d.ts.map +1 -0
  227. package/dist/auth/one-time/index.d.ts +15 -0
  228. package/dist/auth/one-time/index.d.ts.map +1 -0
  229. package/dist/auth/one-time/issue.d.ts +45 -0
  230. package/dist/auth/one-time/issue.d.ts.map +1 -0
  231. package/dist/auth/one-time/refusals.d.ts +26 -0
  232. package/dist/auth/one-time/refusals.d.ts.map +1 -0
  233. package/dist/auth/one-time/spend.d.ts +24 -0
  234. package/dist/auth/one-time/spend.d.ts.map +1 -0
  235. package/dist/auth/one-time/window.d.ts +50 -0
  236. package/dist/auth/one-time/window.d.ts.map +1 -0
  237. package/dist/auth/outage.d.ts +66 -0
  238. package/dist/auth/outage.d.ts.map +1 -0
  239. package/dist/auth/parse-sealing-keys.d.ts +26 -0
  240. package/dist/auth/parse-sealing-keys.d.ts.map +1 -0
  241. package/dist/auth/passkeys/assert.d.ts +51 -0
  242. package/dist/auth/passkeys/assert.d.ts.map +1 -0
  243. package/dist/auth/passkeys/assertion-options.d.ts +9 -0
  244. package/dist/auth/passkeys/assertion-options.d.ts.map +1 -0
  245. package/dist/auth/passkeys/challenge.d.ts +19 -0
  246. package/dist/auth/passkeys/challenge.d.ts.map +1 -0
  247. package/dist/auth/passkeys/commit.d.ts +33 -0
  248. package/dist/auth/passkeys/commit.d.ts.map +1 -0
  249. package/dist/auth/passkeys/flows.d.ts +13 -0
  250. package/dist/auth/passkeys/flows.d.ts.map +1 -0
  251. package/dist/auth/passkeys/index.d.ts +12 -0
  252. package/dist/auth/passkeys/index.d.ts.map +1 -0
  253. package/dist/auth/passkeys/manage.d.ts +11 -0
  254. package/dist/auth/passkeys/manage.d.ts.map +1 -0
  255. package/dist/auth/passkeys/name.d.ts +4 -0
  256. package/dist/auth/passkeys/name.d.ts.map +1 -0
  257. package/dist/auth/passkeys/register.d.ts +20 -0
  258. package/dist/auth/passkeys/register.d.ts.map +1 -0
  259. package/dist/auth/passkeys/registration-options.d.ts +22 -0
  260. package/dist/auth/passkeys/registration-options.d.ts.map +1 -0
  261. package/dist/auth/passkeys/remove-all.d.ts +26 -0
  262. package/dist/auth/passkeys/remove-all.d.ts.map +1 -0
  263. package/dist/auth/passkeys/sign-in-options.d.ts +12 -0
  264. package/dist/auth/passkeys/sign-in-options.d.ts.map +1 -0
  265. package/dist/auth/passkeys/sign-in.d.ts +21 -0
  266. package/dist/auth/passkeys/sign-in.d.ts.map +1 -0
  267. package/dist/auth/passkeys/verifier.d.ts +113 -0
  268. package/dist/auth/passkeys/verifier.d.ts.map +1 -0
  269. package/dist/auth/passkeys/view.d.ts +5 -0
  270. package/dist/auth/passkeys/view.d.ts.map +1 -0
  271. package/dist/auth/passkeys/wiring.d.ts +24 -0
  272. package/dist/auth/passkeys/wiring.d.ts.map +1 -0
  273. package/dist/auth/password-written.d.ts +55 -0
  274. package/dist/auth/password-written.d.ts.map +1 -0
  275. package/dist/auth/port/assert-api-keys.d.ts +21 -0
  276. package/dist/auth/port/assert-api-keys.d.ts.map +1 -0
  277. package/dist/auth/port/assert-invitations.d.ts +15 -0
  278. package/dist/auth/port/assert-invitations.d.ts.map +1 -0
  279. package/dist/auth/port/assert-stores.d.ts +16 -0
  280. package/dist/auth/port/assert-stores.d.ts.map +1 -0
  281. package/dist/auth/port/memory/api-keys/capabilities.d.ts +8 -0
  282. package/dist/auth/port/memory/api-keys/capabilities.d.ts.map +1 -0
  283. package/dist/auth/port/memory/api-keys/index.d.ts +13 -0
  284. package/dist/auth/port/memory/api-keys/index.d.ts.map +1 -0
  285. package/dist/auth/port/memory/api-keys/pages.d.ts +7 -0
  286. package/dist/auth/port/memory/api-keys/pages.d.ts.map +1 -0
  287. package/dist/auth/port/memory/copy.d.ts +6 -0
  288. package/dist/auth/port/memory/copy.d.ts.map +1 -0
  289. package/dist/auth/port/memory/index.d.ts +10 -0
  290. package/dist/auth/port/memory/index.d.ts.map +1 -0
  291. package/dist/auth/port/memory/invitations-pending.d.ts +6 -0
  292. package/dist/auth/port/memory/invitations-pending.d.ts.map +1 -0
  293. package/dist/auth/port/memory/invitations.d.ts +12 -0
  294. package/dist/auth/port/memory/invitations.d.ts.map +1 -0
  295. package/dist/auth/port/memory/passkeys.d.ts +9 -0
  296. package/dist/auth/port/memory/passkeys.d.ts.map +1 -0
  297. package/dist/auth/port/memory/sessions.d.ts +4 -0
  298. package/dist/auth/port/memory/sessions.d.ts.map +1 -0
  299. package/dist/auth/port/memory/social-links.d.ts +10 -0
  300. package/dist/auth/port/memory/social-links.d.ts.map +1 -0
  301. package/dist/auth/port/memory/stores.d.ts +26 -0
  302. package/dist/auth/port/memory/stores.d.ts.map +1 -0
  303. package/dist/auth/port/memory/tokens.d.ts +4 -0
  304. package/dist/auth/port/memory/tokens.d.ts.map +1 -0
  305. package/dist/auth/port/memory/user-index.d.ts +20 -0
  306. package/dist/auth/port/memory/user-index.d.ts.map +1 -0
  307. package/dist/auth/port/memory/user-update.d.ts +10 -0
  308. package/dist/auth/port/memory/user-update.d.ts.map +1 -0
  309. package/dist/auth/port/memory/users.d.ts +4 -0
  310. package/dist/auth/port/memory/users.d.ts.map +1 -0
  311. package/dist/auth/port/types/api-keys.d.ts +199 -0
  312. package/dist/auth/port/types/api-keys.d.ts.map +1 -0
  313. package/dist/auth/port/types/credentials.d.ts +46 -0
  314. package/dist/auth/port/types/credentials.d.ts.map +1 -0
  315. package/dist/auth/port/types/index.d.ts +75 -0
  316. package/dist/auth/port/types/index.d.ts.map +1 -0
  317. package/dist/auth/port/types/invitations/index.d.ts +15 -0
  318. package/dist/auth/port/types/invitations/index.d.ts.map +1 -0
  319. package/dist/auth/port/types/invitations/page.d.ts +52 -0
  320. package/dist/auth/port/types/invitations/page.d.ts.map +1 -0
  321. package/dist/auth/port/types/invitations/records.d.ts +101 -0
  322. package/dist/auth/port/types/invitations/records.d.ts.map +1 -0
  323. package/dist/auth/port/types/invitations/store.d.ts +82 -0
  324. package/dist/auth/port/types/invitations/store.d.ts.map +1 -0
  325. package/dist/auth/port/types/json.d.ts +27 -0
  326. package/dist/auth/port/types/json.d.ts.map +1 -0
  327. package/dist/auth/port/types/passkeys.d.ts +94 -0
  328. package/dist/auth/port/types/passkeys.d.ts.map +1 -0
  329. package/dist/auth/port/types/sessions.d.ts +142 -0
  330. package/dist/auth/port/types/sessions.d.ts.map +1 -0
  331. package/dist/auth/port/types/social-links.d.ts +72 -0
  332. package/dist/auth/port/types/social-links.d.ts.map +1 -0
  333. package/dist/auth/port/types/stores.d.ts +48 -0
  334. package/dist/auth/port/types/stores.d.ts.map +1 -0
  335. package/dist/auth/port/types/tokens.d.ts +168 -0
  336. package/dist/auth/port/types/tokens.d.ts.map +1 -0
  337. package/dist/auth/port/types/users.d.ts +260 -0
  338. package/dist/auth/port/types/users.d.ts.map +1 -0
  339. package/dist/auth/prepared.d.ts +21 -0
  340. package/dist/auth/prepared.d.ts.map +1 -0
  341. package/dist/auth/proven-sign-in.d.ts +22 -0
  342. package/dist/auth/proven-sign-in.d.ts.map +1 -0
  343. package/dist/auth/sealer-for.d.ts +44 -0
  344. package/dist/auth/sealer-for.d.ts.map +1 -0
  345. package/dist/auth/sealing.d.ts +36 -0
  346. package/dist/auth/sealing.d.ts.map +1 -0
  347. package/dist/auth/second-factor/activate.d.ts +9 -0
  348. package/dist/auth/second-factor/activate.d.ts.map +1 -0
  349. package/dist/auth/second-factor/app-code-attempts.d.ts +47 -0
  350. package/dist/auth/second-factor/app-code-attempts.d.ts.map +1 -0
  351. package/dist/auth/second-factor/challenge.d.ts +15 -0
  352. package/dist/auth/second-factor/challenge.d.ts.map +1 -0
  353. package/dist/auth/second-factor/codes-left.d.ts +14 -0
  354. package/dist/auth/second-factor/codes-left.d.ts.map +1 -0
  355. package/dist/auth/second-factor/disable.d.ts +10 -0
  356. package/dist/auth/second-factor/disable.d.ts.map +1 -0
  357. package/dist/auth/second-factor/enroll.d.ts +6 -0
  358. package/dist/auth/second-factor/enroll.d.ts.map +1 -0
  359. package/dist/auth/second-factor/factor.d.ts +33 -0
  360. package/dist/auth/second-factor/factor.d.ts.map +1 -0
  361. package/dist/auth/second-factor/flows.d.ts +36 -0
  362. package/dist/auth/second-factor/flows.d.ts.map +1 -0
  363. package/dist/auth/second-factor/lifecycle.d.ts +14 -0
  364. package/dist/auth/second-factor/lifecycle.d.ts.map +1 -0
  365. package/dist/auth/second-factor/passkey-confirm.d.ts +21 -0
  366. package/dist/auth/second-factor/passkey-confirm.d.ts.map +1 -0
  367. package/dist/auth/second-factor/recovery-codes.d.ts +36 -0
  368. package/dist/auth/second-factor/recovery-codes.d.ts.map +1 -0
  369. package/dist/auth/second-factor/recovery.d.ts +20 -0
  370. package/dist/auth/second-factor/recovery.d.ts.map +1 -0
  371. package/dist/auth/second-factor/redeem.d.ts +42 -0
  372. package/dist/auth/second-factor/redeem.d.ts.map +1 -0
  373. package/dist/auth/second-factor/refusal.d.ts +6 -0
  374. package/dist/auth/second-factor/refusal.d.ts.map +1 -0
  375. package/dist/auth/second-factor/regenerate.d.ts +12 -0
  376. package/dist/auth/second-factor/regenerate.d.ts.map +1 -0
  377. package/dist/auth/second-factor/reseal.d.ts +17 -0
  378. package/dist/auth/second-factor/reseal.d.ts.map +1 -0
  379. package/dist/auth/second-factor/spend-recovery-code.d.ts +15 -0
  380. package/dist/auth/second-factor/spend-recovery-code.d.ts.map +1 -0
  381. package/dist/auth/secrets.d.ts +17 -0
  382. package/dist/auth/secrets.d.ts.map +1 -0
  383. package/dist/auth/sessions/amr.d.ts +36 -0
  384. package/dist/auth/sessions/amr.d.ts.map +1 -0
  385. package/dist/auth/sessions/authenticate.d.ts +12 -0
  386. package/dist/auth/sessions/authenticate.d.ts.map +1 -0
  387. package/dist/auth/sessions/collect-expired.d.ts +15 -0
  388. package/dist/auth/sessions/collect-expired.d.ts.map +1 -0
  389. package/dist/auth/sessions/cookie.d.ts +9 -0
  390. package/dist/auth/sessions/cookie.d.ts.map +1 -0
  391. package/dist/auth/sessions/fresh.d.ts +35 -0
  392. package/dist/auth/sessions/fresh.d.ts.map +1 -0
  393. package/dist/auth/sessions/index.d.ts +12 -0
  394. package/dist/auth/sessions/index.d.ts.map +1 -0
  395. package/dist/auth/sessions/open-session.d.ts +22 -0
  396. package/dist/auth/sessions/open-session.d.ts.map +1 -0
  397. package/dist/auth/sessions/presented-token.d.ts +25 -0
  398. package/dist/auth/sessions/presented-token.d.ts.map +1 -0
  399. package/dist/auth/sessions/shared-api.d.ts +17 -0
  400. package/dist/auth/sessions/shared-api.d.ts.map +1 -0
  401. package/dist/auth/sessions/standing.d.ts +32 -0
  402. package/dist/auth/sessions/standing.d.ts.map +1 -0
  403. package/dist/auth/shared-api.d.ts +142 -0
  404. package/dist/auth/shared-api.d.ts.map +1 -0
  405. package/dist/auth/sign-in-attempts.d.ts +45 -0
  406. package/dist/auth/sign-in-attempts.d.ts.map +1 -0
  407. package/dist/auth/sign-in-code.d.ts +26 -0
  408. package/dist/auth/sign-in-code.d.ts.map +1 -0
  409. package/dist/auth/social/attach.d.ts +31 -0
  410. package/dist/auth/social/attach.d.ts.map +1 -0
  411. package/dist/auth/social/begin.d.ts +30 -0
  412. package/dist/auth/social/begin.d.ts.map +1 -0
  413. package/dist/auth/social/complete-link.d.ts +17 -0
  414. package/dist/auth/social/complete-link.d.ts.map +1 -0
  415. package/dist/auth/social/complete.d.ts +54 -0
  416. package/dist/auth/social/complete.d.ts.map +1 -0
  417. package/dist/auth/social/cookie.d.ts +16 -0
  418. package/dist/auth/social/cookie.d.ts.map +1 -0
  419. package/dist/auth/social/find-provider.d.ts +23 -0
  420. package/dist/auth/social/find-provider.d.ts.map +1 -0
  421. package/dist/auth/social/finish.d.ts +60 -0
  422. package/dist/auth/social/finish.d.ts.map +1 -0
  423. package/dist/auth/social/flow-cookie-value.d.ts +26 -0
  424. package/dist/auth/social/flow-cookie-value.d.ts.map +1 -0
  425. package/dist/auth/social/flow-secret.d.ts +40 -0
  426. package/dist/auth/social/flow-secret.d.ts.map +1 -0
  427. package/dist/auth/social/index.d.ts +19 -0
  428. package/dist/auth/social/index.d.ts.map +1 -0
  429. package/dist/auth/social/link-holder.d.ts +33 -0
  430. package/dist/auth/social/link-holder.d.ts.map +1 -0
  431. package/dist/auth/social/provider-call.d.ts +31 -0
  432. package/dist/auth/social/provider-call.d.ts.map +1 -0
  433. package/dist/auth/social/redeem.d.ts +45 -0
  434. package/dist/auth/social/redeem.d.ts.map +1 -0
  435. package/dist/auth/social/return-to.d.ts +18 -0
  436. package/dist/auth/social/return-to.d.ts.map +1 -0
  437. package/dist/auth/social/sign-in.d.ts +41 -0
  438. package/dist/auth/social/sign-in.d.ts.map +1 -0
  439. package/dist/auth/social/sign-up.d.ts +37 -0
  440. package/dist/auth/social/sign-up.d.ts.map +1 -0
  441. package/dist/auth/social/start.d.ts +21 -0
  442. package/dist/auth/social/start.d.ts.map +1 -0
  443. package/dist/auth/social/step-up-proof.d.ts +26 -0
  444. package/dist/auth/social/step-up-proof.d.ts.map +1 -0
  445. package/dist/auth/social/step-up-request.d.ts +28 -0
  446. package/dist/auth/social/step-up-request.d.ts.map +1 -0
  447. package/dist/auth/social/step-up.d.ts +19 -0
  448. package/dist/auth/social/step-up.d.ts.map +1 -0
  449. package/dist/auth/social/types-of.d.ts +12 -0
  450. package/dist/auth/social/types-of.d.ts.map +1 -0
  451. package/dist/auth/social/unlink.d.ts +23 -0
  452. package/dist/auth/social/unlink.d.ts.map +1 -0
  453. package/dist/auth/social/wiring.d.ts +10 -0
  454. package/dist/auth/social/wiring.d.ts.map +1 -0
  455. package/dist/auth/standard-schema.d.ts +41 -0
  456. package/dist/auth/standard-schema.d.ts.map +1 -0
  457. package/dist/auth/step-up/codes.d.ts +35 -0
  458. package/dist/auth/step-up/codes.d.ts.map +1 -0
  459. package/dist/auth/step-up/flows.d.ts +18 -0
  460. package/dist/auth/step-up/flows.d.ts.map +1 -0
  461. package/dist/auth/step-up/open.d.ts +23 -0
  462. package/dist/auth/step-up/open.d.ts.map +1 -0
  463. package/dist/auth/step-up/passkey.d.ts +31 -0
  464. package/dist/auth/step-up/passkey.d.ts.map +1 -0
  465. package/dist/auth/step-up/request.d.ts +15 -0
  466. package/dist/auth/step-up/request.d.ts.map +1 -0
  467. package/dist/auth/step-up/spend.d.ts +4 -0
  468. package/dist/auth/step-up/spend.d.ts.map +1 -0
  469. package/dist/auth/totp.d.ts +36 -0
  470. package/dist/auth/totp.d.ts.map +1 -0
  471. package/dist/auth/types/api-keys-of.d.ts +19 -0
  472. package/dist/auth/types/api-keys-of.d.ts.map +1 -0
  473. package/dist/auth/types/api-keys.d.ts +164 -0
  474. package/dist/auth/types/api-keys.d.ts.map +1 -0
  475. package/dist/auth/types/avatar.d.ts +72 -0
  476. package/dist/auth/types/avatar.d.ts.map +1 -0
  477. package/dist/auth/types/change-email.d.ts +82 -0
  478. package/dist/auth/types/change-email.d.ts.map +1 -0
  479. package/dist/auth/types/checks.d.ts +147 -0
  480. package/dist/auth/types/checks.d.ts.map +1 -0
  481. package/dist/auth/types/email-flows.d.ts +117 -0
  482. package/dist/auth/types/email-flows.d.ts.map +1 -0
  483. package/dist/auth/types/find-by-email.d.ts +31 -0
  484. package/dist/auth/types/find-by-email.d.ts.map +1 -0
  485. package/dist/auth/types/find-or-create.d.ts +59 -0
  486. package/dist/auth/types/find-or-create.d.ts.map +1 -0
  487. package/dist/auth/types/index.d.ts +38 -0
  488. package/dist/auth/types/index.d.ts.map +1 -0
  489. package/dist/auth/types/inference.d.ts +62 -0
  490. package/dist/auth/types/inference.d.ts.map +1 -0
  491. package/dist/auth/types/invitations/api.d.ts +203 -0
  492. package/dist/auth/types/invitations/api.d.ts.map +1 -0
  493. package/dist/auth/types/invitations/history.d.ts +87 -0
  494. package/dist/auth/types/invitations/history.d.ts.map +1 -0
  495. package/dist/auth/types/invitations/index.d.ts +10 -0
  496. package/dist/auth/types/invitations/index.d.ts.map +1 -0
  497. package/dist/auth/types/invitations/invitation.d.ts +76 -0
  498. package/dist/auth/types/invitations/invitation.d.ts.map +1 -0
  499. package/dist/auth/types/invitations/issue-type.d.ts +15 -0
  500. package/dist/auth/types/invitations/issue-type.d.ts.map +1 -0
  501. package/dist/auth/types/invitations-of.d.ts +26 -0
  502. package/dist/auth/types/invitations-of.d.ts.map +1 -0
  503. package/dist/auth/types/janus.d.ts +51 -0
  504. package/dist/auth/types/janus.d.ts.map +1 -0
  505. package/dist/auth/types/magic-link.d.ts +69 -0
  506. package/dist/auth/types/magic-link.d.ts.map +1 -0
  507. package/dist/auth/types/passkeys.d.ts +183 -0
  508. package/dist/auth/types/passkeys.d.ts.map +1 -0
  509. package/dist/auth/types/password.d.ts +113 -0
  510. package/dist/auth/types/password.d.ts.map +1 -0
  511. package/dist/auth/types/prepared.d.ts +68 -0
  512. package/dist/auth/types/prepared.d.ts.map +1 -0
  513. package/dist/auth/types/proven-sign-in.d.ts +43 -0
  514. package/dist/auth/types/proven-sign-in.d.ts.map +1 -0
  515. package/dist/auth/types/reset-password.d.ts +46 -0
  516. package/dist/auth/types/reset-password.d.ts.map +1 -0
  517. package/dist/auth/types/second-factor.d.ts +164 -0
  518. package/dist/auth/types/second-factor.d.ts.map +1 -0
  519. package/dist/auth/types/session.d.ts +68 -0
  520. package/dist/auth/types/session.d.ts.map +1 -0
  521. package/dist/auth/types/shared-api.d.ts +96 -0
  522. package/dist/auth/types/shared-api.d.ts.map +1 -0
  523. package/dist/auth/types/sign-in.d.ts +102 -0
  524. package/dist/auth/types/sign-in.d.ts.map +1 -0
  525. package/dist/auth/types/social-flow.d.ts +28 -0
  526. package/dist/auth/types/social-flow.d.ts.map +1 -0
  527. package/dist/auth/types/social-step-up.d.ts +38 -0
  528. package/dist/auth/types/social-step-up.d.ts.map +1 -0
  529. package/dist/auth/types/social.d.ts +201 -0
  530. package/dist/auth/types/social.d.ts.map +1 -0
  531. package/dist/auth/types/step-up.d.ts +133 -0
  532. package/dist/auth/types/step-up.d.ts.map +1 -0
  533. package/dist/auth/types/type-api.d.ts +29 -0
  534. package/dist/auth/types/type-api.d.ts.map +1 -0
  535. package/dist/auth/types/user-type.d.ts +106 -0
  536. package/dist/auth/types/user-type.d.ts.map +1 -0
  537. package/dist/auth/types/user.d.ts +62 -0
  538. package/dist/auth/types/user.d.ts.map +1 -0
  539. package/dist/auth/types/verify-email.d.ts +190 -0
  540. package/dist/auth/types/verify-email.d.ts.map +1 -0
  541. package/dist/auth/users/any-type-api.d.ts +6 -0
  542. package/dist/auth/users/any-type-api.d.ts.map +1 -0
  543. package/dist/auth/users/by-login.d.ts +10 -0
  544. package/dist/auth/users/by-login.d.ts.map +1 -0
  545. package/dist/auth/users/change-password.d.ts +26 -0
  546. package/dist/auth/users/change-password.d.ts.map +1 -0
  547. package/dist/auth/users/delete.d.ts +10 -0
  548. package/dist/auth/users/delete.d.ts.map +1 -0
  549. package/dist/auth/users/email-move-guard.d.ts +20 -0
  550. package/dist/auth/users/email-move-guard.d.ts.map +1 -0
  551. package/dist/auth/users/email-prefix.d.ts +23 -0
  552. package/dist/auth/users/email-prefix.d.ts.map +1 -0
  553. package/dist/auth/users/fields-patch.d.ts +21 -0
  554. package/dist/auth/users/fields-patch.d.ts.map +1 -0
  555. package/dist/auth/users/find-by-email.d.ts +11 -0
  556. package/dist/auth/users/find-by-email.d.ts.map +1 -0
  557. package/dist/auth/users/find-many.d.ts +29 -0
  558. package/dist/auth/users/find-many.d.ts.map +1 -0
  559. package/dist/auth/users/find-or-create.d.ts +12 -0
  560. package/dist/auth/users/find-or-create.d.ts.map +1 -0
  561. package/dist/auth/users/flow-types.d.ts +15 -0
  562. package/dist/auth/users/flow-types.d.ts.map +1 -0
  563. package/dist/auth/users/index.d.ts +9 -0
  564. package/dist/auth/users/index.d.ts.map +1 -0
  565. package/dist/auth/users/insert.d.ts +15 -0
  566. package/dist/auth/users/insert.d.ts.map +1 -0
  567. package/dist/auth/users/name-prefix.d.ts +19 -0
  568. package/dist/auth/users/name-prefix.d.ts.map +1 -0
  569. package/dist/auth/users/password-flows.d.ts +11 -0
  570. package/dist/auth/users/password-flows.d.ts.map +1 -0
  571. package/dist/auth/users/record-flows.d.ts +11 -0
  572. package/dist/auth/users/record-flows.d.ts.map +1 -0
  573. package/dist/auth/users/sign-in.d.ts +24 -0
  574. package/dist/auth/users/sign-in.d.ts.map +1 -0
  575. package/dist/auth/users/sign-up.d.ts +13 -0
  576. package/dist/auth/users/sign-up.d.ts.map +1 -0
  577. package/dist/auth/users/type-api.d.ts +10 -0
  578. package/dist/auth/users/type-api.d.ts.map +1 -0
  579. package/dist/auth/users/update.d.ts +16 -0
  580. package/dist/auth/users/update.d.ts.map +1 -0
  581. package/dist/background/background.d.ts +22 -0
  582. package/dist/background/background.d.ts.map +1 -0
  583. package/dist/chunks/index-2ttdcz7n.js +354 -0
  584. package/dist/chunks/index-2ttdcz7n.js.map +16 -0
  585. package/dist/chunks/index-5dxynm32.js +85 -0
  586. package/dist/chunks/index-5dxynm32.js.map +10 -0
  587. package/dist/chunks/index-7h34nqrm.js +732 -0
  588. package/dist/chunks/index-7h34nqrm.js.map +24 -0
  589. package/dist/chunks/index-ftz0ne6j.js +127 -0
  590. package/dist/chunks/index-ftz0ne6j.js.map +11 -0
  591. package/dist/chunks/index-n8jxmxeg.js +64 -0
  592. package/dist/chunks/index-n8jxmxeg.js.map +11 -0
  593. package/dist/conformance/api-keys/cases/bound.d.ts +3 -0
  594. package/dist/conformance/api-keys/cases/bound.d.ts.map +1 -0
  595. package/dist/conformance/api-keys/cases/expiry.d.ts +3 -0
  596. package/dist/conformance/api-keys/cases/expiry.d.ts.map +1 -0
  597. package/dist/conformance/api-keys/cases/index.d.ts +4 -0
  598. package/dist/conformance/api-keys/cases/index.d.ts.map +1 -0
  599. package/dist/conformance/api-keys/cases/insert.d.ts +3 -0
  600. package/dist/conformance/api-keys/cases/insert.d.ts.map +1 -0
  601. package/dist/conformance/api-keys/cases/outage.d.ts +3 -0
  602. package/dist/conformance/api-keys/cases/outage.d.ts.map +1 -0
  603. package/dist/conformance/api-keys/cases/revoke.d.ts +3 -0
  604. package/dist/conformance/api-keys/cases/revoke.d.ts.map +1 -0
  605. package/dist/conformance/api-keys/cases/touch.d.ts +3 -0
  606. package/dist/conformance/api-keys/cases/touch.d.ts.map +1 -0
  607. package/dist/conformance/api-keys/cases/user-bound.d.ts +3 -0
  608. package/dist/conformance/api-keys/cases/user-bound.d.ts.map +1 -0
  609. package/dist/conformance/api-keys/describe.d.ts +20 -0
  610. package/dist/conformance/api-keys/describe.d.ts.map +1 -0
  611. package/dist/conformance/api-keys/fixtures.d.ts +4 -0
  612. package/dist/conformance/api-keys/fixtures.d.ts.map +1 -0
  613. package/dist/conformance/api-keys/index.d.ts +18 -0
  614. package/dist/conformance/api-keys/index.d.ts.map +1 -0
  615. package/dist/conformance/api-keys/reference.d.ts +4 -0
  616. package/dist/conformance/api-keys/reference.d.ts.map +1 -0
  617. package/dist/conformance/api-keys/types.d.ts +42 -0
  618. package/dist/conformance/api-keys/types.d.ts.map +1 -0
  619. package/dist/conformance/assert.d.ts +40 -0
  620. package/dist/conformance/assert.d.ts.map +1 -0
  621. package/dist/conformance/cases/outage.d.ts +3 -0
  622. package/dist/conformance/cases/outage.d.ts.map +1 -0
  623. package/dist/conformance/cases/outage.passkeys.d.ts +12 -0
  624. package/dist/conformance/cases/outage.passkeys.d.ts.map +1 -0
  625. package/dist/conformance/cases/passkeys/deletion.d.ts +4 -0
  626. package/dist/conformance/cases/passkeys/deletion.d.ts.map +1 -0
  627. package/dist/conformance/cases/passkeys/index.d.ts +8 -0
  628. package/dist/conformance/cases/passkeys/index.d.ts.map +1 -0
  629. package/dist/conformance/cases/passkeys/inserts.d.ts +4 -0
  630. package/dist/conformance/cases/passkeys/inserts.d.ts.map +1 -0
  631. package/dist/conformance/cases/passkeys/reads.d.ts +4 -0
  632. package/dist/conformance/cases/passkeys/reads.d.ts.map +1 -0
  633. package/dist/conformance/cases/passkeys/uses.d.ts +4 -0
  634. package/dist/conformance/cases/passkeys/uses.d.ts.map +1 -0
  635. package/dist/conformance/cases/sessions/deletion.d.ts +4 -0
  636. package/dist/conformance/cases/sessions/deletion.d.ts.map +1 -0
  637. package/dist/conformance/cases/sessions/extension.d.ts +4 -0
  638. package/dist/conformance/cases/sessions/extension.d.ts.map +1 -0
  639. package/dist/conformance/cases/sessions/index.d.ts +4 -0
  640. package/dist/conformance/cases/sessions/index.d.ts.map +1 -0
  641. package/dist/conformance/cases/sessions/inserts.d.ts +4 -0
  642. package/dist/conformance/cases/sessions/inserts.d.ts.map +1 -0
  643. package/dist/conformance/cases/sessions/list.d.ts +4 -0
  644. package/dist/conformance/cases/sessions/list.d.ts.map +1 -0
  645. package/dist/conformance/cases/sessions/reads.d.ts +4 -0
  646. package/dist/conformance/cases/sessions/reads.d.ts.map +1 -0
  647. package/dist/conformance/cases/sessions/reauthentication.d.ts +4 -0
  648. package/dist/conformance/cases/sessions/reauthentication.d.ts.map +1 -0
  649. package/dist/conformance/cases/sessions/revocation.d.ts +4 -0
  650. package/dist/conformance/cases/sessions/revocation.d.ts.map +1 -0
  651. package/dist/conformance/cases/social-links/deletion.d.ts +4 -0
  652. package/dist/conformance/cases/social-links/deletion.d.ts.map +1 -0
  653. package/dist/conformance/cases/social-links/index.d.ts +8 -0
  654. package/dist/conformance/cases/social-links/index.d.ts.map +1 -0
  655. package/dist/conformance/cases/social-links/inserts.d.ts +4 -0
  656. package/dist/conformance/cases/social-links/inserts.d.ts.map +1 -0
  657. package/dist/conformance/cases/social-links/reads.d.ts +4 -0
  658. package/dist/conformance/cases/social-links/reads.d.ts.map +1 -0
  659. package/dist/conformance/cases/tokens/attempts.d.ts +7 -0
  660. package/dist/conformance/cases/tokens/attempts.d.ts.map +1 -0
  661. package/dist/conformance/cases/tokens/change-email.d.ts +8 -0
  662. package/dist/conformance/cases/tokens/change-email.d.ts.map +1 -0
  663. package/dist/conformance/cases/tokens/deletion.d.ts +4 -0
  664. package/dist/conformance/cases/tokens/deletion.d.ts.map +1 -0
  665. package/dist/conformance/cases/tokens/index.d.ts +4 -0
  666. package/dist/conformance/cases/tokens/index.d.ts.map +1 -0
  667. package/dist/conformance/cases/tokens/inserts.d.ts +7 -0
  668. package/dist/conformance/cases/tokens/inserts.d.ts.map +1 -0
  669. package/dist/conformance/cases/tokens/kinds.d.ts +7 -0
  670. package/dist/conformance/cases/tokens/kinds.d.ts.map +1 -0
  671. package/dist/conformance/cases/tokens/redemption.d.ts +7 -0
  672. package/dist/conformance/cases/tokens/redemption.d.ts.map +1 -0
  673. package/dist/conformance/cases/tokens/social-flow.d.ts +8 -0
  674. package/dist/conformance/cases/tokens/social-flow.d.ts.map +1 -0
  675. package/dist/conformance/cases/tokens/spending.d.ts +7 -0
  676. package/dist/conformance/cases/tokens/spending.d.ts.map +1 -0
  677. package/dist/conformance/cases/users/avatar.d.ts +8 -0
  678. package/dist/conformance/cases/users/avatar.d.ts.map +1 -0
  679. package/dist/conformance/cases/users/batch.d.ts +8 -0
  680. package/dist/conformance/cases/users/batch.d.ts.map +1 -0
  681. package/dist/conformance/cases/users/deletion.d.ts +4 -0
  682. package/dist/conformance/cases/users/deletion.d.ts.map +1 -0
  683. package/dist/conformance/cases/users/index.d.ts +4 -0
  684. package/dist/conformance/cases/users/index.d.ts.map +1 -0
  685. package/dist/conformance/cases/users/inserts.d.ts +4 -0
  686. package/dist/conformance/cases/users/inserts.d.ts.map +1 -0
  687. package/dist/conformance/cases/users/listing.d.ts +4 -0
  688. package/dist/conformance/cases/users/listing.d.ts.map +1 -0
  689. package/dist/conformance/cases/users/patches.d.ts +7 -0
  690. package/dist/conformance/cases/users/patches.d.ts.map +1 -0
  691. package/dist/conformance/cases/users/reads.d.ts +7 -0
  692. package/dist/conformance/cases/users/reads.d.ts.map +1 -0
  693. package/dist/conformance/cases/users/second-factor.d.ts +16 -0
  694. package/dist/conformance/cases/users/second-factor.d.ts.map +1 -0
  695. package/dist/conformance/cases/users/versions.d.ts +7 -0
  696. package/dist/conformance/cases/users/versions.d.ts.map +1 -0
  697. package/dist/conformance/describe.d.ts +82 -0
  698. package/dist/conformance/describe.d.ts.map +1 -0
  699. package/dist/conformance/fixtures.d.ts +31 -0
  700. package/dist/conformance/fixtures.d.ts.map +1 -0
  701. package/dist/conformance/index.d.ts +46 -0
  702. package/dist/conformance/index.d.ts.map +1 -0
  703. package/dist/conformance/index.js +4442 -0
  704. package/dist/conformance/index.js.map +86 -0
  705. package/dist/conformance/invitations/cases/actors.d.ts +3 -0
  706. package/dist/conformance/invitations/cases/actors.d.ts.map +1 -0
  707. package/dist/conformance/invitations/cases/find-pending.d.ts +3 -0
  708. package/dist/conformance/invitations/cases/find-pending.d.ts.map +1 -0
  709. package/dist/conformance/invitations/cases/imported.d.ts +3 -0
  710. package/dist/conformance/invitations/cases/imported.d.ts.map +1 -0
  711. package/dist/conformance/invitations/cases/index.d.ts +4 -0
  712. package/dist/conformance/invitations/cases/index.d.ts.map +1 -0
  713. package/dist/conformance/invitations/cases/insert.d.ts +3 -0
  714. package/dist/conformance/invitations/cases/insert.d.ts.map +1 -0
  715. package/dist/conformance/invitations/cases/list-lapsed.d.ts +3 -0
  716. package/dist/conformance/invitations/cases/list-lapsed.d.ts.map +1 -0
  717. package/dist/conformance/invitations/cases/list-status.d.ts +3 -0
  718. package/dist/conformance/invitations/cases/list-status.d.ts.map +1 -0
  719. package/dist/conformance/invitations/cases/list.d.ts +3 -0
  720. package/dist/conformance/invitations/cases/list.d.ts.map +1 -0
  721. package/dist/conformance/invitations/cases/outage.d.ts +3 -0
  722. package/dist/conformance/invitations/cases/outage.d.ts.map +1 -0
  723. package/dist/conformance/invitations/cases/scope.d.ts +3 -0
  724. package/dist/conformance/invitations/cases/scope.d.ts.map +1 -0
  725. package/dist/conformance/invitations/cases/update.d.ts +3 -0
  726. package/dist/conformance/invitations/cases/update.d.ts.map +1 -0
  727. package/dist/conformance/invitations/describe.d.ts +20 -0
  728. package/dist/conformance/invitations/describe.d.ts.map +1 -0
  729. package/dist/conformance/invitations/fixtures.d.ts +4 -0
  730. package/dist/conformance/invitations/fixtures.d.ts.map +1 -0
  731. package/dist/conformance/invitations/index.d.ts +18 -0
  732. package/dist/conformance/invitations/index.d.ts.map +1 -0
  733. package/dist/conformance/invitations/reference.d.ts +4 -0
  734. package/dist/conformance/invitations/reference.d.ts.map +1 -0
  735. package/dist/conformance/invitations/types.d.ts +34 -0
  736. package/dist/conformance/invitations/types.d.ts.map +1 -0
  737. package/dist/conformance/reference.d.ts +13 -0
  738. package/dist/conformance/reference.d.ts.map +1 -0
  739. package/dist/conformance/relations/cases/deletion.d.ts +4 -0
  740. package/dist/conformance/relations/cases/deletion.d.ts.map +1 -0
  741. package/dist/conformance/relations/cases/holders.d.ts +9 -0
  742. package/dist/conformance/relations/cases/holders.d.ts.map +1 -0
  743. package/dist/conformance/relations/cases/index.d.ts +4 -0
  744. package/dist/conformance/relations/cases/index.d.ts.map +1 -0
  745. package/dist/conformance/relations/cases/outage.d.ts +3 -0
  746. package/dist/conformance/relations/cases/outage.d.ts.map +1 -0
  747. package/dist/conformance/relations/cases/reads.d.ts +8 -0
  748. package/dist/conformance/relations/cases/reads.d.ts.map +1 -0
  749. package/dist/conformance/relations/cases/traversal.d.ts +7 -0
  750. package/dist/conformance/relations/cases/traversal.d.ts.map +1 -0
  751. package/dist/conformance/relations/cases/writes.d.ts +4 -0
  752. package/dist/conformance/relations/cases/writes.d.ts.map +1 -0
  753. package/dist/conformance/relations/describe.d.ts +20 -0
  754. package/dist/conformance/relations/describe.d.ts.map +1 -0
  755. package/dist/conformance/relations/fixtures.d.ts +8 -0
  756. package/dist/conformance/relations/fixtures.d.ts.map +1 -0
  757. package/dist/conformance/relations/index.d.ts +18 -0
  758. package/dist/conformance/relations/index.d.ts.map +1 -0
  759. package/dist/conformance/relations/reference.d.ts +4 -0
  760. package/dist/conformance/relations/reference.d.ts.map +1 -0
  761. package/dist/conformance/relations/types.d.ts +34 -0
  762. package/dist/conformance/relations/types.d.ts.map +1 -0
  763. package/dist/conformance/types.d.ts +79 -0
  764. package/dist/conformance/types.d.ts.map +1 -0
  765. package/dist/errors/janus-error/base.d.ts +47 -0
  766. package/dist/errors/janus-error/base.d.ts.map +1 -0
  767. package/dist/errors/janus-error/codes.credentials.d.ts +36 -0
  768. package/dist/errors/janus-error/codes.credentials.d.ts.map +1 -0
  769. package/dist/errors/janus-error/codes.d.ts +23 -0
  770. package/dist/errors/janus-error/codes.d.ts.map +1 -0
  771. package/dist/errors/janus-error/codes.invitations.d.ts +52 -0
  772. package/dist/errors/janus-error/codes.invitations.d.ts.map +1 -0
  773. package/dist/errors/janus-error/codes.one-time.d.ts +63 -0
  774. package/dist/errors/janus-error/codes.one-time.d.ts.map +1 -0
  775. package/dist/errors/janus-error/codes.records.d.ts +86 -0
  776. package/dist/errors/janus-error/codes.records.d.ts.map +1 -0
  777. package/dist/errors/janus-error/codes.social.d.ts +88 -0
  778. package/dist/errors/janus-error/codes.social.d.ts.map +1 -0
  779. package/dist/errors/janus-error/index.d.ts +17 -0
  780. package/dist/errors/janus-error/index.d.ts.map +1 -0
  781. package/dist/errors/janus-error/options.d.ts +105 -0
  782. package/dist/errors/janus-error/options.d.ts.map +1 -0
  783. package/dist/errors/janus-error/refusals.d.ts +151 -0
  784. package/dist/errors/janus-error/refusals.d.ts.map +1 -0
  785. package/dist/errors/janus-error/status.d.ts +21 -0
  786. package/dist/errors/janus-error/status.d.ts.map +1 -0
  787. package/dist/errors/janus-error/store.d.ts +36 -0
  788. package/dist/errors/janus-error/store.d.ts.map +1 -0
  789. package/dist/ids/derived.d.ts +25 -0
  790. package/dist/ids/derived.d.ts.map +1 -0
  791. package/dist/ids/id.d.ts +55 -0
  792. package/dist/ids/id.d.ts.map +1 -0
  793. package/dist/index.d.ts +32 -0
  794. package/dist/index.d.ts.map +1 -0
  795. package/dist/index.js +6948 -0
  796. package/dist/index.js.map +208 -0
  797. package/dist/pagination/cursor-page.d.ts +53 -0
  798. package/dist/pagination/cursor-page.d.ts.map +1 -0
  799. package/dist/permissions/bound-model.d.ts +10 -0
  800. package/dist/permissions/bound-model.d.ts.map +1 -0
  801. package/dist/permissions/can.d.ts +13 -0
  802. package/dist/permissions/can.d.ts.map +1 -0
  803. package/dist/permissions/engine.d.ts +49 -0
  804. package/dist/permissions/engine.d.ts.map +1 -0
  805. package/dist/permissions/holders.d.ts +12 -0
  806. package/dist/permissions/holders.d.ts.map +1 -0
  807. package/dist/permissions/index.d.ts +36 -0
  808. package/dist/permissions/index.d.ts.map +1 -0
  809. package/dist/permissions/index.js +924 -0
  810. package/dist/permissions/index.js.map +28 -0
  811. package/dist/permissions/input.d.ts +43 -0
  812. package/dist/permissions/input.d.ts.map +1 -0
  813. package/dist/permissions/list.d.ts +16 -0
  814. package/dist/permissions/list.d.ts.map +1 -0
  815. package/dist/permissions/model/can.d.ts +41 -0
  816. package/dist/permissions/model/can.d.ts.map +1 -0
  817. package/dist/permissions/model/config.d.ts +36 -0
  818. package/dist/permissions/model/config.d.ts.map +1 -0
  819. package/dist/permissions/model/constraint.d.ts +37 -0
  820. package/dist/permissions/model/constraint.d.ts.map +1 -0
  821. package/dist/permissions/model/ctx.d.ts +23 -0
  822. package/dist/permissions/model/ctx.d.ts.map +1 -0
  823. package/dist/permissions/model/define.d.ts +78 -0
  824. package/dist/permissions/model/define.d.ts.map +1 -0
  825. package/dist/permissions/model/from-field.d.ts +31 -0
  826. package/dist/permissions/model/from-field.d.ts.map +1 -0
  827. package/dist/permissions/model/grant.d.ts +81 -0
  828. package/dist/permissions/model/grant.d.ts.map +1 -0
  829. package/dist/permissions/model/list.d.ts +48 -0
  830. package/dist/permissions/model/list.d.ts.map +1 -0
  831. package/dist/permissions/model/names.d.ts +51 -0
  832. package/dist/permissions/model/names.d.ts.map +1 -0
  833. package/dist/permissions/model/permissions.d.ts +48 -0
  834. package/dist/permissions/model/permissions.d.ts.map +1 -0
  835. package/dist/permissions/model/refs.d.ts +36 -0
  836. package/dist/permissions/model/refs.d.ts.map +1 -0
  837. package/dist/permissions/model/refusal.d.ts +13 -0
  838. package/dist/permissions/model/refusal.d.ts.map +1 -0
  839. package/dist/permissions/model/unions.d.ts +3 -0
  840. package/dist/permissions/model/unions.d.ts.map +1 -0
  841. package/dist/permissions/model/when.d.ts +16 -0
  842. package/dist/permissions/model/when.d.ts.map +1 -0
  843. package/dist/permissions/port/holders.d.ts +38 -0
  844. package/dist/permissions/port/holders.d.ts.map +1 -0
  845. package/dist/permissions/port/memory.d.ts +17 -0
  846. package/dist/permissions/port/memory.d.ts.map +1 -0
  847. package/dist/permissions/port/types.d.ts +101 -0
  848. package/dist/permissions/port/types.d.ts.map +1 -0
  849. package/dist/permissions/replace.d.ts +25 -0
  850. package/dist/permissions/replace.d.ts.map +1 -0
  851. package/dist/permissions/resolve/declared-names.d.ts +24 -0
  852. package/dist/permissions/resolve/declared-names.d.ts.map +1 -0
  853. package/dist/permissions/resolve/refuse-data-beyond-root.d.ts +11 -0
  854. package/dist/permissions/resolve/refuse-data-beyond-root.d.ts.map +1 -0
  855. package/dist/permissions/resolve/refuse-loops.d.ts +10 -0
  856. package/dist/permissions/resolve/refuse-loops.d.ts.map +1 -0
  857. package/dist/permissions/resolve/resolve-model.d.ts +13 -0
  858. package/dist/permissions/resolve/resolve-model.d.ts.map +1 -0
  859. package/dist/permissions/resolve/resolve-relation.d.ts +9 -0
  860. package/dist/permissions/resolve/resolve-relation.d.ts.map +1 -0
  861. package/dist/permissions/resolve/resolve-rule.d.ts +12 -0
  862. package/dist/permissions/resolve/resolve-rule.d.ts.map +1 -0
  863. package/dist/permissions/resolve/resolved.d.ts +52 -0
  864. package/dist/permissions/resolve/resolved.d.ts.map +1 -0
  865. package/dist/permissions/resolve/step.d.ts +4 -0
  866. package/dist/permissions/resolve/step.d.ts.map +1 -0
  867. package/dist/permissions/reverse.d.ts +53 -0
  868. package/dist/permissions/reverse.d.ts.map +1 -0
  869. package/dist/permissions/walk.d.ts +29 -0
  870. package/dist/permissions/walk.d.ts.map +1 -0
  871. package/dist/stores/guard.d.ts +24 -0
  872. package/dist/stores/guard.d.ts.map +1 -0
  873. package/dist/stores/storable.d.ts +15 -0
  874. package/dist/stores/storable.d.ts.map +1 -0
  875. package/dist/subjects/notation.d.ts +39 -0
  876. package/dist/subjects/notation.d.ts.map +1 -0
  877. package/dist/subjects/subject.d.ts +128 -0
  878. package/dist/subjects/subject.d.ts.map +1 -0
  879. package/dist/testing/index.d.ts +12 -0
  880. package/dist/testing/index.d.ts.map +1 -0
  881. package/dist/testing/index.js +26 -0
  882. package/dist/testing/index.js.map +10 -0
  883. package/dist/time/clock.d.ts +31 -0
  884. package/dist/time/clock.d.ts.map +1 -0
  885. package/dist/time/duration.d.ts +23 -0
  886. package/dist/time/duration.d.ts.map +1 -0
  887. package/docs/README.md +46 -0
  888. package/docs/guide/adapters.md +861 -0
  889. package/docs/guide/api-keys.md +316 -0
  890. package/docs/guide/avatars.md +334 -0
  891. package/docs/guide/devices.md +441 -0
  892. package/docs/guide/email-flows.md +880 -0
  893. package/docs/guide/errors.md +180 -0
  894. package/docs/guide/events.md +467 -0
  895. package/docs/guide/invitations.md +465 -0
  896. package/docs/guide/issuers.md +107 -0
  897. package/docs/guide/magic-link.md +580 -0
  898. package/docs/guide/migrating-invitations.md +142 -0
  899. package/docs/guide/passkeys.md +425 -0
  900. package/docs/guide/passwords.md +325 -0
  901. package/docs/guide/permissions.md +719 -0
  902. package/docs/guide/second-factor.md +1124 -0
  903. package/docs/guide/sessions.md +521 -0
  904. package/docs/guide/sign-in-code.md +631 -0
  905. package/docs/guide/social.md +648 -0
  906. package/docs/guide/step-up.md +262 -0
  907. package/docs/guide/users.md +557 -0
  908. package/docs/guide/vocabulary.md +316 -0
  909. package/docs/roadmap.md +102 -0
  910. package/docs/troubleshooting.md +3318 -0
  911. package/package.json +77 -5
@@ -0,0 +1,465 @@
1
+ # Invitations
2
+
3
+ Inviting somebody into an organization: a person with the right to invite
4
+ names an address, a role and a scope (a school, a team, a workspace); the
5
+ invitee follows a link, picks a password if the type has one and they have none,
6
+ and lands signed in.
7
+ `janus({ invitations })` adds `auth.invitations` to the instance: **issue**,
8
+ **resend**, **revoke**, **list**, **preview** and **accept**. Without the block
9
+ there is no `auth.invitations` — not at run time, and not in the type.
10
+
11
+ An invitation is a **scope** (a string of yours), an **address**, a **name**, a
12
+ **role** (a string of yours) and a **locale**. Janus keeps the invitation, its
13
+ lifetime and its one-time code; **what a role lets someone do, and who may
14
+ invite into a scope, stay with the application** — `onAccepted` is where it
15
+ adds the new member.
16
+
17
+ ## Wiring
18
+
19
+ ```ts
20
+ import { createMemoryInvitations, janus } from '@softistx/janus';
21
+
22
+ const auth = janus({
23
+ user: User, // a type with an e-mail: a password login that is the e-mail, or no password
24
+ password: { login: 'email' },
25
+ store,
26
+ hasher,
27
+ invitations: {
28
+ store: createMemoryInvitations(), // or an adapter's: createMongoInvitations(db), createDrizzleInvitations(db, { tables })
29
+ lifetime: '7d',
30
+ maxPending: 200,
31
+ // The fields of the user an invitation makes, for an invitee with no account.
32
+ create: (invitation) => ({ email: invitation.email, name: invitation.name, locale: invitation.locale }),
33
+ // Before anything is written: return false to refuse, and the invitation stays pending.
34
+ beforeAccept: async ({ invitation, user }) => {
35
+ return directory.stillExists(invitation.email);
36
+ },
37
+ // The application adds the user to the scope with the role. If it throws, the invitation can be accepted again.
38
+ onAccepted: async ({ invitation, user }) => {
39
+ await memberships.add({ scope: invitation.scope, userId: user.id, role: invitation.role });
40
+ },
41
+ events: (event) => audit.write(event),
42
+ },
43
+ });
44
+ ```
45
+
46
+ | Option | Default | Meaning |
47
+ | --- | --- | --- |
48
+ | `store` | required | An [`InvitationStore`](adapters.md). A port of its own, **not** a slot of `store`: the identity stores are unchanged |
49
+ | `create` | required | The fields of the user an invitation makes (its address, name, locale), validated by the type's schema. Called only for an invitee with no account |
50
+ | `beforeAccept` | none | Called when a code names a pending invitation, **before anything is written** (the claim, the user, the proof of the e-mail, the password), with the invitation and `{ id, type }` of the user who already holds its e-mail, or `user: null`. Return `false` to refuse: `accept` throws `INVITATION_REFUSED` (403), the invitation stays pending and can be accepted later; `true` goes on. A throw is thrown as it is, with nothing written. It runs on every accept path (new user, existing user, second factor) not for a code that names no pending invitation, and not for a deactivated user (`INVITATION_INVALID`). **It may run for an accept that then loses the claim to a concurrent one: keep it free of side effects** |
51
+ | `onAccepted` | required | Called once the invitee is a user, with the invitation and `{ id, type }` of the user. Where the application adds them to the scope with the role |
52
+ | `type` | the only user type | The user type an invitation makes or signs in, or a **list** of them ([several types](#several-user-types)). Required with several types. A type has an e-mail and either no password ([passwordless](#user-types-with-no-password)) or a password whose login is that e-mail |
53
+ | `lifetime` | `'7d'` | How long a code is good for, from `issue` or `resend` |
54
+ | `maxPending` | none | Pending invitations, not lapsed, one scope may hold (1 to 10000). Absent, no limit: the application limits what it can see |
55
+ | `events` | none | Called with each [invitation event](events.md#invitation-events), awaited |
56
+
57
+ A wrong value is a `TypeError` naming it, at wiring: `janus: invitations.create
58
+ must be a function …`, `janus: invitations.type must name the user type an
59
+ invitation makes: this instance has several`, `janus: invitations.type: "<name>"
60
+ must have no password, or sign in with a password whose login is its e-mail …`,
61
+ `janus: invitations.type must be a user type, or a non-empty list of distinct
62
+ user types`, `janus: invitations.type: "<name>" is listed twice`. `invitations` is a
63
+ reserved user type name.
64
+
65
+ ## Several user types
66
+
67
+ One `invitations` block can invite different kinds of user: list them in
68
+ `type`, and say which one each invitation is for when you issue it.
69
+
70
+ ```ts
71
+ const auth = janus({
72
+ users: {
73
+ staff: { schema: Staff, password: { login: 'email' } },
74
+ guardian: { schema: Guardian }, // no password: see below
75
+ },
76
+ store,
77
+ hasher,
78
+ invitations: {
79
+ store: createMemoryInvitations(),
80
+ type: ['staff', 'guardian'], // list the type your invitations were issued for before this option first
81
+ create: (invitation) => ({ email: invitation.email, name: invitation.name }),
82
+ onAccepted: async ({ invitation, user }) => {
83
+ await memberships.add({ scope: invitation.scope, userId: user.id, role: invitation.role });
84
+ },
85
+ },
86
+ });
87
+
88
+ await auth.invitations.issue({ scope, email, name, role, invitedBy: current.user, type: 'guardian' });
89
+ const shown = await auth.invitations.preview(code); // shown.type === 'guardian'
90
+ ```
91
+
92
+ - **`issue({ type })` is optional only with one type.** With several, an absent
93
+ or unlisted `type` is `INVITATION_INVALID` (`field: 'type'`, `issue: type must
94
+ be one of "staff", "guardian"`). It is a `string`, checked at run time.
95
+ - **The type is fixed at issue.** `resend` and `revoke` keep it; to change it,
96
+ issue again. It is answered as `invitation.type` (on `issue`, `list`, the
97
+ hooks and `accept`) and as `preview(code).type`.
98
+ - **`create`, `beforeAccept` and `onAccepted` keep their signatures**: read
99
+ `invitation.type` to tell the kinds apart. `beforeAccept` sees the user who
100
+ holds the address *on the invitation's type*; `accept` makes, proves or signs
101
+ in a user of that type.
102
+ - **One pending invitation per scope and address, across types**: issuing as
103
+ another type revokes the pending one and makes a new one.
104
+ - **An invitation stored before the field existed has no type**, and reads as
105
+ the **first type listed**. List the type you used until now first.
106
+ - **A stored type that is no longer listed** (you removed it from `type`) is
107
+ still listed by `list`, but `preview` and `accept` answer `INVITATION_INVALID`
108
+ like any code that names no invitation.
109
+ - **The store must keep `type`.** With several types, `issue` reads the
110
+ invitation back once and throws a `TypeError` if the store did not return the
111
+ type it was given: a dropped type would read as the first one listed. The
112
+ memory store, `@softistx/janus-mongo` and `@softistx/janus-drizzle` keep it;
113
+ a custom adapter passes the conformance case `invitations.insert.type`.
114
+ - The GraphQL SDL (`@softistx/janus-graphql`) issues only single-type
115
+ configurations until it learns the `type` argument.
116
+
117
+ ## User types with no password
118
+
119
+ A type with no `password` can be invited: there is nothing for the invitee to
120
+ choose, and they come back with the link or code they already use. It needs an
121
+ e-mail (the invitation is for an address).
122
+
123
+ ```ts
124
+ users: { guardian: { schema: Guardian } }, // Guardian has a required string `email`
125
+ invitations: { store, type: 'guardian', create, onAccepted },
126
+ ```
127
+
128
+ `preview` answers `needsPassword: false` for it, and `accept` ignores any
129
+ `password` sent. By who holds the address:
130
+
131
+ | Who holds the address | What `accept` does | Answer |
132
+ | --- | --- | --- |
133
+ | Nobody | Creates the user `create` describes, with the e-mail proved | `signedIn` |
134
+ | A user whose e-mail was never proved | Runs `verifyEmail.proveFirst` (what an unproved account held is dropped, every session revoked) | `signedIn` |
135
+ | A user whose e-mail is proved | Leaves them as they are | `signIn`: send them to your link or code page |
136
+
137
+ ## Issuing
138
+
139
+ ```ts
140
+ const current = await auth.authenticate(request);
141
+ if (current === null) return new Response(null, { status: 401 });
142
+ // Authorising the inviter is yours: may current.user invite into this scope?
143
+ await assertCanInvite(current.user, scope);
144
+
145
+ const { invitation, code } = await auth.invitations.issue({
146
+ scope,
147
+ email: 'ada@example.com',
148
+ name: 'Ada Lovelace',
149
+ role: 'teacher',
150
+ locale: 'fr-CA', // optional
151
+ ref: person.id, // optional: your own record's id, opaque to Janus
152
+ type: 'staff', // required with several user types, see below
153
+ invitedBy: current.user,
154
+ });
155
+ // code: 43 base64url characters — put it in the e-mail's link now. Only its sha256 is stored.
156
+ ```
157
+
158
+ - **The code is shown once.** It is 32 random bytes; the store holds its
159
+ `sha256`, so a dump of it cannot be replayed. A lost code is a `resend`.
160
+ - **One pending invitation per scope and address.** Issuing again for an
161
+ address that has one **revokes the old one** (lapsed or not) and makes a new
162
+ one, with a new id and a new code: the old link stops working. Only the invitation pending when the issue began is replaced: of concurrent issues exactly one wins; the others throw `INVITATION_PENDING`. A refused issue
163
+ that replaced one (a race over `maxPending`) leaves the old one revoked.
164
+ - A scope, address, name, role, locale, `ref`, `type` or `invitedBy` (neither a user, a user id nor `null`) that cannot be kept is
165
+ `INVITATION_INVALID` (400) with `field`, and nothing is written. The address is
166
+ normalised as a login is.
167
+ - At `maxPending` pending invitations that have not lapsed, in the scope and
168
+ none this address's own: `INVITATION_LIMIT` (409, `maxActive`).
169
+ - **`ref` ties the invitation to your own record** (a person row the inviter
170
+ already made): any string of 1 to 100 characters, kept as given, answered back
171
+ as `invitation.ref` (`null` when none) and kept by `resend` and `revoke`. It
172
+ is fixed at issue: to change it, issue again. Janus never reads it; it is
173
+ indexed with the scope so `list` and `count` can filter on it.
174
+ - **A system issue has no inviter.** A first administrator created from a
175
+ script or a migration has no user to be the inviter: pass `invitedBy: null`.
176
+
177
+ ```ts
178
+ const { invitation, code } = await auth.invitations.issue({
179
+ scope, email: 'root@example.com', name: 'Root', role: 'admin',
180
+ invitedBy: null, // the system; invitation.invitedBy is null
181
+ });
182
+ ```
183
+
184
+ The invitation is stored and answered with `invitedBy: null`, and so are its
185
+ events. The key stays required, so leaving `invitedBy` out (a forgotten
186
+ inviter) is a type error and `INVITATION_INVALID`, never a silent system
187
+ issue. Send its e-mail without an `inviter` (`mail.invitation` has copy for
188
+ it).
189
+ - **Who may invite is yours.** `issue` does not know your roles: check before
190
+ calling.
191
+
192
+ ## Sending the link
193
+
194
+ `@softistx/janus-mail` has a ready invitation e-mail, `mail.invitation`. Janus
195
+ hands you the code; you build the link and the e-mail says the rest.
196
+
197
+ ```ts
198
+ const { invitation, code } = await auth.invitations.issue({ scope, email, name, role, invitedBy: current.user });
199
+
200
+ await mail.invitation(
201
+ { email: invitation.email, locale: invitation.locale === null ? undefined : [invitation.locale] },
202
+ {
203
+ inviter: current.user.name,
204
+ organization: organizationName(scope),
205
+ role: roleLabel(invitation.role), // optional text
206
+ link: `https://acme.example/invitations/accept?code=${encodeURIComponent(code)}`, // your accept page
207
+ expiresAt: invitation.expiresAt,
208
+ },
209
+ );
210
+ ```
211
+
212
+ The accept page is yours. **A GET on it must spend nothing** — mail scanners
213
+ open links — so it calls `preview` (below) and shows a form; the form's POST
214
+ calls `accept`. If sending fails, the invitation exists and still stands:
215
+ `resend` gives it a new code to send again.
216
+
217
+ ## Resending and revoking
218
+
219
+ ```ts
220
+ const again = await auth.invitations.resend({ id, scope }); // { invitation, code }: new code, new lifetime
221
+ await mail.invitation(/* … with again.code … */);
222
+
223
+ const revoked = await auth.invitations.revoke({ id, scope }); // the invitation, now revoked
224
+ ```
225
+
226
+ Name who acts with `by`, the actor's user id, for an audit trail:
227
+
228
+ ```ts
229
+ await auth.invitations.resend({ id, scope, by: admin.id }); // invitation.resentBy === admin.id
230
+ const revoked = await auth.invitations.revoke({ id, scope, by: admin.id });
231
+ revoked.revokedBy; // admin.id
232
+ ```
233
+
234
+ `by` is optional (calls without it keep working) and Janus does not check it.
235
+ `revokedBy` is `null` until a revoke names someone. `resentBy` is the **last**
236
+ resender: a resend that names nobody sets it back to `null`. The matching
237
+ events carry `by` when it was given.
238
+
239
+ - Both take the `scope`: an id of another scope is `NOT_FOUND`, the same as an
240
+ unknown or malformed one, so a request cannot tell which invitations exist
241
+ elsewhere.
242
+ - `resend` works on a pending invitation, lapsed or not; the old code stops
243
+ working. Reviving a **lapsed** one takes a place like an `issue` does, so with
244
+ `maxPending` set it is `INVITATION_LIMIT` when the scope is already full; a
245
+ resend of one that has not lapsed takes none. `revoke` takes a pending one back, lapsed or not.
246
+ - On an accepted or revoked invitation both are `INVITATION_NOT_PENDING` (409).
247
+
248
+ ## Importing history
249
+
250
+ ```ts
251
+ const report = await auth.invitations.importHistory(
252
+ [
253
+ { key: 'inv-42', scope: 'school-1', email: 'ada@example.com', name: 'Ada', role: 'teacher',
254
+ status: 'accepted', createdAt, acceptedAt, acceptedBy: ada.id },
255
+ { key: 'inv-43', scope: 'school-1', email: 'bob@example.com', name: 'Bob', role: 'teacher',
256
+ status: 'revoked', createdAt, revokedAt },
257
+ ],
258
+ { dryRun: true }, // look first; nothing is written
259
+ );
260
+ // { dryRun: true, inserted: 2, present: 0, refused: 0, items: [{ key, id, outcome }, …] }
261
+ ```
262
+
263
+ For an application that moves from another system: copies its accepted,
264
+ revoked and lapsed pending invitations in as history, **with no event, no mail
265
+ and no code**. An imported record cannot be previewed or accepted (its code
266
+ hash matches nothing); `list`, `get` and `count` see it.
267
+
268
+ - It is **idempotent by (`scope`, `key`)**: the id is derived from them, so a
269
+ record already imported is reported `present` and left alone. **Concurrent
270
+ runs of the same records may both report `inserted`**; one write wins.
271
+ - A bad record is reported `refused` with a `reason` (`invalid` and its
272
+ `field`, `unknown-type`, `live-pending`, `pending-held`, `duplicate-key`, `key-taken`) and
273
+ the others go on. A live pending record is refused: issue it.
274
+ - At most 1000 records per call; a wrong call shape is a `TypeError`.
275
+ - `acceptedBy`, `revokedBy` and `invitedBy` are Janus user ids.
276
+ - A store that expires invitations (a Mongo TTL index, `deleteExpiredInvitations`)
277
+ drops imported history too: see [Migrating invitations](migrating-invitations.md)
278
+ for the field mapping, the dry run and what keeps it.
279
+
280
+ ## Listing
281
+
282
+ ```ts
283
+ const page = await auth.invitations.list(scope, { status: 'pending', limit: 20 });
284
+ const next = await auth.invitations.list(scope, { status: 'pending', limit: 20, after: page.nextCursor });
285
+
286
+ // The invitation of one of your records, newest first, and how many are pending.
287
+ const mine = await auth.invitations.list(scope, { ref: person.id, order: 'desc', limit: 1 });
288
+ const pending = await auth.invitations.count(scope, { status: 'pending' });
289
+ const teachers = await auth.invitations.count(scope, { role: 'teacher', ref: person.id });
290
+
291
+ // Lapsed invitations (pending, `expiresAt` at or before now) out of an admin screen, with a matching total.
292
+ const live = await auth.invitations.list(scope, { lapsed: 'exclude' });
293
+ const liveTotal = await auth.invitations.count(scope, { lapsed: 'exclude' });
294
+ const lapsed = await auth.invitations.list(scope, { lapsed: 'only' });
295
+
296
+ // One invitation by id, e.g. to authorize a resend or a revoke.
297
+ const one = await auth.invitations.get({ id, scope }); // Invitation | null
298
+ ```
299
+
300
+ `lapsed` is `'exclude'` or `'only'` (another value is a `TypeError`); absent
301
+ keeps every invitation, lapsed ones included. A lapsed invitation is one
302
+ stored `pending` whose `expiresAt` is at or before the core clock's now, the
303
+ instant of expiry included. `'exclude'` leaves those out and keeps every other
304
+ record, of any status; `'only'` keeps only those. With `status` it intersects,
305
+ so `status: 'accepted'` with `lapsed: 'only'` is empty: an accepted invitation
306
+ is never lapsed. A cursor is bound to `lapsed` too: reusing it with another
307
+ value is a `CursorFilterMismatchError`.
308
+
309
+ `get` costs one store read, whatever the scope holds, and answers the same
310
+ `Invitation` as `list` (with `ref`). It is `null` for an id that is unknown,
311
+ malformed or of another scope, so a request-supplied id reveals nothing about
312
+ other scopes. A store outage throws; it is never `null`.
313
+
314
+ `list` answers one scope's invitations, **oldest first** (`order: 'desc'` for
315
+ newest first), as `Invitation`s (no code, no hash), of one `status`
316
+ (`'pending' | 'accepted' | 'revoked'`), `role` and `ref`, or all. The filters
317
+ combine (all must match). `limit` is 20 when absent, at most 100; `after` is the
318
+ previous page's `nextCursor`, **with the same scope, filters and order**: the cursor is bound to the list it was issued for, and replayed against another one it is refused with `CURSOR_FILTER_MISMATCH` (`CursorFilterMismatchError`, 400; `BAD_USER_INPUT` in `@softistx/janus-graphql`). A `pending` invitation whose
319
+ `expiresAt` has passed is lapsed: it is still listed as `pending`, and `resend`
320
+ revives it. A status, role, ref, lapsed or order that is not valid is a `TypeError`,
321
+ never an unfiltered answer. A cursor that `list` handed out before the upgrade that bound cursors to their list is refused as `INVALID_CURSOR`; the client restarts from the first page.
322
+
323
+ `count(scope, { status?, role?, ref?, lapsed? })` answers how many invitations match the
324
+ same filters, with no page limit. `status: 'pending'` is the **stored** status:
325
+ a lapsed invitation counts, as it is listed. A scope without invitations is `0`.
326
+
327
+ ## Previewing
328
+
329
+ ```ts
330
+ const code = new URL(request.url).searchParams.get('code') ?? '';
331
+ try {
332
+ const invitation = await auth.invitations.preview(code);
333
+ // { id, scope, email, name, role, locale, expiresAt, needsPassword } — nothing about who sent it
334
+ } catch (error) {
335
+ if (error instanceof InvitationInvalidError) return Response.json({ code: error.code }, { status: 400 });
336
+ throw error;
337
+ }
338
+ ```
339
+
340
+ `preview` reads the invitation a code names **without spending it**, for the
341
+ page the invitee lands on ("Ada, you are invited to Globex as teacher"). It is
342
+ unauthenticated, so it answers only the `InvitationPreview` fields.
343
+ `needsPassword` is `false` only when the address belongs to a user with a
344
+ proved e-mail **and** a password (`accept` then answers `signIn` and needs no
345
+ password); it is `true` for a new invitee, for an account whose e-mail was never
346
+ proved, and for a proved account that holds no password. The page shows its
347
+ password field from it, before it calls `accept`. Every code
348
+ that names no pending, unlapsed invitation — unknown, malformed, accepted,
349
+ revoked, lapsed — is the same `INVITATION_INVALID`; `error.reason` tells them
350
+ apart (`'unknown'`, `'expired'`, `'accepted'`, `'revoked'`, typed `InvitationRefusal`: the code is the
351
+ invitee's own secret). A deactivated user, a taken login and a lost race stay
352
+ `'unknown'`. **Janus does not throttle it**: put a rate limit in front of the
353
+ route.
354
+
355
+ ## Accepting
356
+
357
+ ```ts
358
+ const accepted = await auth.invitations.accept({ code, password, device });
359
+
360
+ switch (accepted.status) {
361
+ case 'signedIn':
362
+ // a session: put accepted.token in the cookie; accepted.user, accepted.invitation
363
+ break;
364
+ case 'secondFactor':
365
+ // the user has a second factor to prove, as for any sign-in
366
+ break;
367
+ case 'signIn':
368
+ // the address already belongs to a proved user, who is NOT signed in: send them to the sign-in page
369
+ break;
370
+ }
371
+ ```
372
+
373
+ **The code is the proof of the invitee's inbox**, so no other proof is asked.
374
+ `accept` claims the invitation first, under its version: of two concurrent
375
+ accepts exactly one wins and the other is `INVITATION_INVALID`. Then, by who
376
+ holds the address:
377
+
378
+ | Who holds the address | What `accept` does | Answer |
379
+ | --- | --- | --- |
380
+ | Nobody | Creates the user `create` describes, with the e-mail proved and `password` set | `signedIn` (or `secondFactor`) |
381
+ | A user whose e-mail was never proved | Runs `verifyEmail.proveFirst` — **their old password, second factor and avatar are dropped, every session revoked** — then sets `password` | `signedIn` (or `secondFactor`) |
382
+ | A user whose e-mail is proved, with a password | Leaves them as they are; `password` is ignored | `signIn`, nobody signed in |
383
+ | A user whose e-mail is proved, with no password | Sets `password` when one is given (what a retry after a failed `setPassword` finds) | `signedIn` (or `secondFactor`); without a `password`, `signIn` |
384
+
385
+ A proved account with no password (a social-only one) of a type that has a
386
+ password is given the invitation's `password` on accept and signed in. A type
387
+ with no password at all has [its own table](#user-types-with-no-password).
388
+
389
+ For a proved user nothing is signed in on purpose: an invitation proves the
390
+ inbox, not who holds the account. `onAccepted` has run for them too, so they
391
+ are in the scope after they sign in as usual.
392
+
393
+ - `password` is **required** for the first two rows: without it `PASSWORD_REQUIRED`
394
+ (400), with nothing written and the invitation still pending. It is checked
395
+ against the type's policy before any user is made (`PASSWORD_TOO_SHORT`).
396
+ - `device` is as for any sign-in (a [device](devices.md) hint).
397
+ - **If anything fails before `onAccepted` returns, the claim is released** and
398
+ the invitation can be accepted again; once `onAccepted` returned, it stays
399
+ accepted. A release that fails too is a `JANUS_INVITATION_RELEASE_FAILED`
400
+ warning and the first error is the one thrown.
401
+ - **A retry after a failed `onAccepted` answers `signIn`.** The first try made
402
+ the user, proved their e-mail and set the password; the retry finds a proved
403
+ user with a password and, by the table, signs nobody in. If instead the
404
+ failure was `setPassword` itself (the user is proved and holds no password),
405
+ the retry sets the password it is given and signs them in. **The accept page must handle `signIn` after an
406
+ error**: send the person to sign in with the password they just chose. See
407
+ [troubleshooting](../troubleshooting.md#a-retry-after-a-failed-onaccepted-answers-signin).
408
+ - **Janus does not throttle `accept`** (nor `preview`): rate-limit the route.
409
+ - `accepted.invitation` is the invitation, now `accepted`.
410
+
411
+ ## Errors
412
+
413
+ | Code | Status | When |
414
+ | --- | --- | --- |
415
+ | `INVITATION_INVALID` | 400 | `preview`/`accept` on a code that names no pending, unlapsed invitation (one code, `reason` says why: `unknown`, `expired`, `accepted` or `revoked`), `accept` for a deactivated user, `accept` that lost a race on the invitation's version, or `accept` whose new user's login is taken (`LOGIN_TAKEN` is never shown); `issue` on an input it cannot keep (`field`) |
416
+ | `INVITATION_LIMIT` | 409 | `issue`, or `resend` of a lapsed invitation, into a scope holding `maxPending` invitations (`maxActive`) |
417
+ | `INVITATION_NOT_PENDING` | 409 | `resend`/`revoke` on an accepted or revoked invitation |
418
+ | `INVITATION_REFUSED` | 403 | `accept` refused by `beforeAccept`; nothing was written and the invitation is still pending |
419
+ | `INVITATION_PENDING` | 409 | A store refused a write that would make a second pending invitation for a scope and address; a concurrent `issue` won the place first; `issue` retries only while the place frees up or the invitation it replaces moved, and of concurrent issues exactly one wins and the others throw `INVITATION_PENDING` |
420
+ | `PASSWORD_REQUIRED` | 400 | `accept` needs a password and got none |
421
+ | `PASSWORD_TOO_SHORT`, `USER_INVALID` | 400 | `accept` makes a user: as `signUp` |
422
+ | `NOT_FOUND` | 404 | `resend`/`revoke` on an id that is unknown, malformed or of another scope |
423
+ | `STORE_FAILED` | 503 | A store could not answer. Never a negative answer |
424
+
425
+ Every code is in [Errors](errors.md); each message is in
426
+ [troubleshooting](../troubleshooting.md#invitations).
427
+
428
+ ## Events
429
+
430
+ Invitation events go to the block's own `events` listener, never to the
431
+ instance's user events: `invitation.issued`, `invitation.resent`,
432
+ `invitation.revoked` and `invitation.accepted`. They carry the invitation's id
433
+ and scope and who sent it — **never the address or the code**. See
434
+ [Invitation events](events.md#invitation-events).
435
+
436
+ ## Traps
437
+
438
+ - **The code is in the link, nowhere else.** Do not log it, store it, or put it
439
+ in an analytics URL. It is the only credential the invitee has.
440
+ - **Authorise the inviter yourself.** `issue` trusts `invitedBy`, and
441
+ `invitedBy: null` too: only code you trust should issue as the system.
442
+ - **`invitedBy` is `null` for a system issue.** Code that reads
443
+ `invitation.invitedBy` (a list, an event listener) must handle it.
444
+ - **No throttle on `preview` and `accept`.** Rate-limit both.
445
+ - **A GET on the accept page spends nothing.** Preview on GET, accept on POST.
446
+ - **Handle `signIn`.** It is the answer for a proved user, and for a retry after
447
+ a failed `onAccepted`.
448
+ - **`onAccepted` must be safe to run twice for one user** if it can fail half
449
+ way: the invitation is released on a throw, and the retry runs it again.
450
+ - **Issuing again revokes the old link.** An inviter who re-invites invalidates
451
+ the e-mail already in the inbox.
452
+ - **A proved e-mail is never taken over.** Whoever follows a link to an address
453
+ that already has a proved account is told to sign in; their password is not
454
+ changed.
455
+ - **Only a never-proved account is replaced**, and its password, second factor,
456
+ avatar and sessions with it: somebody who signed up with an address they did not own
457
+ loses it to its owner.
458
+
459
+ ## See also
460
+
461
+ - [Sessions](sessions.md) — what `signedIn` carries and the cookie
462
+ - [E-mail flows](email-flows.md) — `proveFirst`, which `accept` runs for an unproved address
463
+ - [Migrating invitations](migrating-invitations.md) — the field mapping, the dry run and retention of an import
464
+ - [Adapters](adapters.md) — the `InvitationStore` port and `describeInvitationStores`
465
+ - [Errors](errors.md) and [events](events.md#invitation-events)
@@ -0,0 +1,107 @@
1
+ # Several issuers in one process
2
+
3
+ One process can serve several tenants (schools, clinics, brands), each with its
4
+ own `janus()` instance: its own store, user types, cookie name, mail and keys,
5
+ chosen per request (from the host, say). `createJanusIssuers()` resolves the
6
+ request's issuer, builds that issuer's instance once and keeps it in a bounded
7
+ in-process cache. A single-instance application does not need it, and `janus()`
8
+ behaves the same with or without it.
9
+
10
+ ```ts
11
+ import { z } from 'zod';
12
+ import { createJanusIssuers, janus, scryptHasher } from '@softistx/janus';
13
+
14
+ const issuers = createJanusIssuers({
15
+ // Cheap: a lookup of plain data (cache it yourself, in Redis for instance).
16
+ resolve: (request) => tenants.byHost(request.headers.get('host') ?? ''), // { issuer, version, ... } | null
17
+ // Expensive: runs on a miss or a new version, once for concurrent misses.
18
+ build: (tenant) =>
19
+ janus({
20
+ user: z.object({ email: z.email() }),
21
+ password: { login: 'email' },
22
+ store: createMongoStores(db, { partition: tenant.issuer }), // your own store factory
23
+ hasher: scryptHasher(),
24
+ cookie: { name: `session_${tenant.issuer}` },
25
+ }),
26
+ cache: { max: 100, idle: '1h' }, // the defaults
27
+ });
28
+
29
+ app.use(async (c, next) => {
30
+ const auth = await issuers.forRequest(c.req.raw);
31
+ if (auth === null) return c.notFound(); // no such issuer
32
+ c.set('auth', auth);
33
+ await next();
34
+ });
35
+ ```
36
+
37
+ `forRequest` hands back exactly what `build` answered, fully typed: the
38
+ instance is not widened, so `auth.signIn`, `auth.users` and the rest keep the
39
+ types of your configuration.
40
+
41
+ ## What `resolve` answers
42
+
43
+ `{ issuer, version }`, plus whatever else `build` needs (a tenant id, its
44
+ settings). Both are strings, and the same shape `createOAuthIssuers()` of
45
+ `@softistx/janus-oauth` takes ([issuers](../../../janus-oauth/docs/guide/issuers.md)), so one lookup can feed both.
46
+
47
+ - `issuer` is the cache key.
48
+ - `version` is any string that changes whenever the issuer's configuration
49
+ does (an `updatedAt`, a revision number). The cached instance is kept while the
50
+ resolved version is the same and rebuilt when it differs.
51
+ - `null` means "no such issuer": `forRequest` answers `null`.
52
+ - A failure (the directory is down) rejects. It is never read as `null`, so an
53
+ outage is not an absence.
54
+ - Anything else (an empty `issuer`, a non-string `version`) is a `TypeError`.
55
+
56
+ Janus reads no forwarded header: `resolve` reads the `Host` header, or whatever
57
+ your proxy sets that you trust, and answers `null` for hosts it does not know.
58
+
59
+ ## The two methods
60
+
61
+ | Method | Does |
62
+ | --- | --- |
63
+ | `forRequest(request)` | The request's instance, built or cached, or `null` when `resolve` answered `null` |
64
+ | `evict(issuer)` | Drops one issuer's instance so the next request builds it again. An unknown issuer does nothing |
65
+
66
+ ## The cache
67
+
68
+ - Entries are kept least-recently-used first out, past `cache.max` (default `100`).
69
+ - An entry not used for `cache.idle` (default `'1h'`) is dropped. There is no
70
+ timer; the check happens at the next lookup. Pass `clock` (a `fixedClock()` in
71
+ a spec) to move time.
72
+ - **Concurrent misses share one build.** Ten requests for a new issuer call
73
+ `build` once, and all ten wait for it.
74
+ - **A failed build is not kept.** A `build` that threw is asked again by the next
75
+ request.
76
+ - The cache is in this process. With several processes each builds its own, and
77
+ a new `version` reaches each one on its next request.
78
+ - While a new version rolls out across processes, `resolve` may alternate between `v1` and `v2`, and each flip rebuilds: an older version arriving after a newer one replaces it. Make `resolve` answer one version at a time.
79
+ - A rebuilt instance replaces the old one; a request that already holds the old
80
+ one finishes with it.
81
+ - Wrong options (`resolve` or `build` not a function, `cache.max` not a positive
82
+ integer, `cache.idle` not a duration) are a `TypeError` when you call
83
+ `createJanusIssuers`.
84
+
85
+ ## Isolation
86
+
87
+ Every issuer gets the store and options `build` answers; nothing is shared unless
88
+ you share it. Give each issuer its **own** store, or a partition of one, so a
89
+ user, a session or a token of one issuer does not exist for another. A cookie
90
+ name per issuer keeps a browser that visits two tenants on one parent domain
91
+ from sending one's cookie to the other.
92
+
93
+ ## Traps
94
+
95
+ - `resolve` runs on every request: keep it to a lookup. Do not build instances there.
96
+ - Change `version` whenever the issuer's configuration changes, or the old
97
+ instance keeps answering until it is evicted or idle.
98
+ - A spoofed `Host` picks another tenant's instance: refuse hosts you do not know
99
+ (answer `null`).
100
+ - Do not call `janus()` yourself per request: each call is a new instance with
101
+ its own hashers and caches. This helper is the cache.
102
+ - Events registered on an instance (`events`) are registered once per build, so a
103
+ rebuilt instance registers them again; do not keep per-instance state in the
104
+ listener.
105
+
106
+ See also [Users](users.md), [Sessions](sessions.md) and
107
+ [the shared vocabulary](vocabulary.md) for `fixedClock` and durations.