@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,316 @@
1
+ # API keys
2
+
3
+ Personal keys that a user creates for their own scripts, and that act as that
4
+ user. `janus({ apiKeys })` adds `auth.apiKeys` to the instance: **create**,
5
+ **list**, **revoke**, **revokeAll**. Without the block there is no
6
+ `auth.apiKeys` — not at run time, and not in the type.
7
+
8
+ ## Wiring
9
+
10
+ ```ts
11
+ import { createMemoryApiKeys, janus } from '@softistx/janus';
12
+
13
+ const auth = janus({
14
+ user: User,
15
+ password: { login: 'email' },
16
+ store, // users, sessions, tokens
17
+ hasher,
18
+ apiKeys: {
19
+ store: createMemoryApiKeys(), // or an adapter's
20
+ prefix: 'sl_',
21
+ lifetimes: ['30d', '90d', '365d'],
22
+ },
23
+ });
24
+ ```
25
+
26
+ | Option | Default | Meaning |
27
+ | --- | --- | --- |
28
+ | `store` | required | An [`ApiKeyStore`](adapters.md). A port of its own, **not** a slot of `store`: the three identity stores are unchanged |
29
+ | `prefix` | required | The start of every token, so a leaked key can be recognised and scanned for. Lowercase letters and digits, starting with a letter, at most 16 characters, ending in `_` |
30
+ | `lifetimes` | required | The lifetimes a key may be created with, each at least `'1d'`. **No default and no unlimited key**: every key expires, and the user picks one of these |
31
+ | `maxActive` | `10` | Standing keys one user may hold, 1 to 100 |
32
+ | `freshWithin` | `'10m'` | How recently the session must have proved who it is to create a key |
33
+ | `lastUsedEvery` | `'1h'` | At most one write of `lastUsedAt` per key and per this span (used when keys are accepted) |
34
+ | `types` | every type | The user types that may hold keys |
35
+ | `revokeOnPasswordReset` | `true` | `resetPassword.confirm` revokes every key of the user. `false` leaves them |
36
+
37
+ A wrong value is a `TypeError` naming it, at wiring: `janus: apiKeys.prefix …`,
38
+ `janus: apiKeys.lifetimes: "12h" is under one day …`, `janus: apiKeys.store: the
39
+ API key store has no method …`. `lifetime` in `create` is typed as the
40
+ lifetimes you listed.
41
+
42
+ ## Creating a key
43
+
44
+ ```ts
45
+ const current = await auth.authenticate(request);
46
+ if (current === null) return new Response(null, { status: 401 });
47
+
48
+ const { apiKey, token } = await auth.apiKeys.create(current, {
49
+ name: 'CI deploy',
50
+ lifetime: '90d',
51
+ });
52
+ // token: 'sl_0192ab…_…' — show it to the user now. Only its hash is stored.
53
+ ```
54
+
55
+ - **The token is shown once.** It is `${prefix}${id}_${secret}`: the key's id
56
+ (a UUIDv7 without hyphens) and 256 bits of secret. The store holds
57
+ `sha256(secret)`, so a dump of it cannot be replayed, and a lost token is a
58
+ new key. `apiKey.hint` (`sl_0192ab…`) is what a list shows.
59
+ - **Behind a fresh proof.** `current.session.authenticatedAt` must be less than
60
+ `freshWithin` old, else `STEP_UP_REQUIRED`: ask for a [step-up](step-up.md),
61
+ then try again. The password and the session are checked again once the key is stored: a
62
+ password written since this session proved who it is (a reset, a
63
+ `changePassword`), or a session that no longer stands (a reset or a first
64
+ proof of the e-mail ended it), revokes the new key and answers
65
+ `STEP_UP_REQUIRED` — sign
66
+ in again or confirm a step-up.
67
+ - **A key never creates a key.** A principal that came in by an API key is
68
+ refused with `STEP_UP_REQUIRED` and `reason: 'apiKey'` — there is no
69
+ step-up for it to do.
70
+ - **The e-mail must be verified.** A user with an address that was never proved is
71
+ refused with `EMAIL_UNVERIFIED` (403) and nothing is written: a key outlives
72
+ the session that made it, and an address someone signed up with is not yet
73
+ theirs. A user type with no e-mail (a username login) has nothing to squat and is not
74
+ asked. There is no option to allow it; verify the address first
75
+ ([`verifyEmail`](email-flows.md)).
76
+ - The user is read again: `USER_INACTIVE` for an inactive one, `NOT_FOUND` for a
77
+ user who is gone or of a type `types` leaves out.
78
+ - `name` is trimmed and must be 1 to 100 characters, with no NUL character or
79
+ lone surrogate (no store can keep one); `lifetime` must be one
80
+ of `lifetimes`. Either wrong is `API_KEY_INVALID` (400) with `field: 'name'`
81
+ or `'lifetime'`, and nothing is written.
82
+ - **At most `maxActive` standing keys** (not revoked, not lapsed). A user at
83
+ the limit is refused with `API_KEY_LIMIT` (409, carrying `maxActive`) before
84
+ anything is written. The key is then inserted and the user's keys counted
85
+ again, which guards the race: two creations at the limit both count the
86
+ other and are both refused (their keys are revoked again) rather than one
87
+ too many accepted. A store failure after the insert revokes the new key
88
+ before the error reaches you, so no key stands that nobody holds — unless
89
+ the revoke fails too, which is reported with `process.emitWarning` (code
90
+ `JANUS_API_KEY_REVOKE_FAILED`) while the first failure is the one thrown.
91
+
92
+ ## Listing and revoking
93
+
94
+ ```ts
95
+ const page = await auth.apiKeys.list(user, { limit: 20 }); // oldest first
96
+ const key = await auth.apiKeys.get(id, { owner: current.user }); // ApiKey | null
97
+ await auth.apiKeys.revoke(id, { owner: current.user }); // a request-supplied id
98
+ await auth.apiKeys.revokeAll(user); // → how many
99
+ ```
100
+
101
+ - `list` answers every key of the user — standing, revoked and lapsed — as
102
+ `ApiKey`s (no hash, no token), with the usual `limit` and `after` cursor. A
103
+ user without keys has an empty page.
104
+ - `get(id, { owner })` answers one key as `list` does, or `null` for an
105
+ unknown or malformed id (without reading the store) and, with `owner`, for
106
+ a key of another user. A revoked or lapsed key is answered as it is: `get`
107
+ does not check validity, `authenticate` does. **Pass `owner` whenever the
108
+ id came from a request.** Without it any key is answered: the
109
+ administrator's path, never to be answered to a request without checking
110
+ `userId`. A store failure throws.
111
+ - `revoke(id, { owner })` makes a key of **another user** `NOT_FOUND`, the same
112
+ as an unknown or malformed id, so a request cannot tell which keys exist.
113
+ **Always pass `owner` when the id came from a request.** Without it any key
114
+ is revoked: the administrator's path. Revoking a revoked key is not an
115
+ error, and keeps its first `revokedAt`. It sends no `user.apiKeyRevoked` for a
116
+ key already revoked, **for sequential calls**: two concurrent `revoke(id)`
117
+ calls of one key can both send the event.
118
+ - `revokeAll(user)` revokes every standing key and answers how many.
119
+
120
+ ## Accepting a key
121
+
122
+ Keys are **opt-in per call**. Without `apiKey: true`, a key-shaped bearer
123
+ answers `null` (anonymous), so a route written for sessions never accepts one:
124
+
125
+ ```ts
126
+ // A route for scripts: a session or a key.
127
+ const principal = await auth.authenticate(request, { apiKey: true });
128
+ if (principal === null) return new Response(null, { status: 401 });
129
+
130
+ if (principal.via === 'apiKey') {
131
+ principal.apiKey.id; // limit by key; principal.session is null
132
+ } else {
133
+ principal.session.expiresAt; // a session, as before
134
+ }
135
+
136
+ // A route for people only: a key answers null here.
137
+ const person = await auth.authenticate(request);
138
+ ```
139
+
140
+ With `apiKey: true`, a token shaped like a key (`prefix`, 32 hex characters,
141
+ `_`, 43 base64url characters) is looked up **before** any session. It
142
+ authenticates when all of these hold, and answers `null` otherwise:
143
+
144
+ - the key exists and the SHA-256 of the presented secret equals the stored
145
+ hash (compared in constant time);
146
+ - it is not revoked, and `expiresAt` is after now;
147
+ - its user exists, is active, is of an allowed type (`apiKeys.types`) and of
148
+ `options.type` when given.
149
+
150
+ **A key is accepted only from `Authorization: Bearer`.** A key-shaped token in
151
+ the session cookie or in `X-Session-Token` answers `null`, with `apiKey: true`
152
+ too: a cookie is sent by a browser without being asked, and a key is not meant
153
+ to live there. A session token keeps all three routes.
154
+
155
+ A token that merely starts with the prefix but is not shaped like a key goes
156
+ to the session path. As for sessions, the first credential present wins.
157
+
158
+ Nothing is renewed: a key's `expiresAt` never moves. `lastUsedAt` is written
159
+ at most once per `lastUsedEvery` (default `1h`), so a busy key costs one write
160
+ per hour; the principal's `apiKey.lastUsedAt` shows it when this call wrote.
161
+
162
+ **An outage is not anonymous**: a key store that cannot answer rejects with
163
+ `STORE_FAILED`, as the other stores do; answer 503.
164
+
165
+ A key is **never fresh**. `assertFresh(principal, maxAge)` throws
166
+ `STEP_UP_REQUIRED` with `reason: 'apiKey'` for one, whatever its age, and
167
+ `apiKeys.create` refuses it likewise: guard sensitive actions with it, and
168
+ the key gets a 403 that a step-up cannot clear. Passing `apiKey: true` on an
169
+ instance wired without `apiKeys` is a `TypeError`.
170
+
171
+ ## Scopes and a bound object
172
+
173
+ A key can carry **scopes** (what it may do) and be **bound** to one object
174
+ (what it acts for: a workspace, an account), both chosen at creation:
175
+
176
+ ```ts
177
+ const { apiKey, token } = await auth.apiKeys.create(current, {
178
+ name: 'Assistant',
179
+ lifetime: '30d',
180
+ scopes: ['tools:read', 'tools:write'],
181
+ bound: { type: 'workspace', id: workspace.id },
182
+ });
183
+
184
+ const principal = await auth.authenticate(request, { apiKey: true });
185
+ if (principal?.via === 'apiKey') {
186
+ principal.scopes; // ['tools:read', 'tools:write'], or null for an unscoped key
187
+ principal.bound; // { type: 'workspace', id: '…' }, or null
188
+ }
189
+ ```
190
+
191
+ - **Janus stores them and hands them back; it never enforces them.** Your
192
+ route checks that the scope it needs is in `principal.scopes` and that
193
+ `principal.bound` is the object the request touches. A key without
194
+ either answers `null` for both, and is stored exactly as before.
195
+ - `scopes`: 1 to 32 OAuth scope tokens (printable ASCII without space, `"`
196
+ or `\`), each at most 100 characters; duplicates are dropped, the order
197
+ kept. `bound`: `{ type, id }`, `type` of 1 to 64 characters and `id` of 1 to
198
+ 200, with no NUL character or lone surrogate; other properties are dropped.
199
+ Either wrong is `API_KEY_INVALID` (400) with `field: 'scopes'` or `'bound'`,
200
+ and nothing is written.
201
+ - **The store must be able to keep them.** Passing `scopes` or `bound` to an
202
+ instance whose key store lacks the optional `bound` capability
203
+ (`listBoundApiKeys` and `revokeBoundApiKeys`) is a `TypeError`, before
204
+ anything is written: a store that silently dropped them would turn a
205
+ restricted key into a full one. `createMemoryApiKeys()` and
206
+ `createMongoApiKeys(db)` have it.
207
+
208
+ ```ts
209
+ const page = await auth.apiKeys.listBound({ type: 'workspace', id }, { limit: 20 });
210
+ const revoked = await auth.apiKeys.revokeAllBound(user, { type: 'workspace', id }); // → how many
211
+ ```
212
+
213
+ - `listBound(object, page?)` answers every key bound to the object — any
214
+ user's, standing, revoked or lapsed — oldest first, with the usual `limit`
215
+ and `after` cursor. An object that is not `{ type, id }` has an empty page.
216
+ - `revokeAllBound(user, object)` revokes that user's standing keys bound to the
217
+ object and answers how many: when a member leaves a workspace, say. The
218
+ user's other keys stand.
219
+ - Both need the `bound` capability; without it they are a `TypeError`.
220
+
221
+ To list **one user's** keys of an object, filter `list`:
222
+
223
+ ```ts
224
+ const mine = await auth.apiKeys.list(user, { bound: { type: 'workspace', id } });
225
+ const unbound = await auth.apiKeys.list(user, { bound: null }); // the user's unbound keys
226
+ ```
227
+
228
+ - `bound` absent lists every key; an object lists those bound to it; `null`
229
+ lists the unbound ones. A value that is not `{ type, id }` has an empty
230
+ page. A bad cursor is `INVALID_CURSOR`.
231
+ - It needs the `bound` capability (a `TypeError` before any read without it).
232
+ A store with `listUserBoundApiKeys` answers in one read; without it the core
233
+ reads the user's keys 100 at a time and keeps those that match.
234
+
235
+ ## Expiry notices
236
+
237
+ To warn a user before a key lapses, sweep the keys that expire soon and claim
238
+ each one before sending:
239
+
240
+ ```ts
241
+ let after: string | null = null;
242
+ do {
243
+ const page = await auth.apiKeys.expiring({ within: '7d', limit: 100, after });
244
+ for (const key of page.items) {
245
+ // true for the one sweep that claimed it: send then.
246
+ if (await auth.apiKeys.markExpiryNotified(key.id)) await notify(key);
247
+ }
248
+ after = page.nextCursor;
249
+ } while (after !== null);
250
+ ```
251
+
252
+ - `expiring({ within, limit?, after? })` answers the standing keys (not
253
+ revoked, not lapsed) whose `expiresAt` falls within `within` from now and
254
+ that were not marked yet, oldest first. `within` is a duration (`'7d'`, or
255
+ milliseconds); a wrong one is a `TypeError`.
256
+ - `markExpiryNotified(id)` records `expiryNotifiedAt` once. It answers `true`
257
+ for the call that wrote it and `false` when the key was already marked, so
258
+ of two sweeps running at once only one sends. An unknown or malformed id is
259
+ `NOT_FOUND`. `apiKey.expiryNotifiedAt` shows it in a list.
260
+ - Both need the optional `expiryNotice` capability of the key store
261
+ (`listExpiringApiKeys` and `markApiKeyExpiryNotified`); without it they are a
262
+ `TypeError`.
263
+
264
+ ## What else ends a key
265
+
266
+ | Event | Keys |
267
+ | --- | --- |
268
+ | `resetPassword.confirm` | Revoked, unless `revokeOnPasswordReset: false` — whoever had the old password may have made keys with it. Always revoked when the link proved the e-mail for the first time. Each ending (sessions, keys, links) runs whatever the others do, and the first store failure is thrown after all were tried |
269
+ | First proof of an e-mail (`magicLink.confirm`, `signInCode.confirm`, `verifyEmail.confirm(token, { firstProof: true })`, `verifyEmail.proveFirst`) | Revoked, whatever `revokeOnPasswordReset` says — whoever signed up with the address and a password may have made keys, and the holder of the inbox did not |
270
+ | `changePassword`, `signOutEverywhere` | Left: the user is still who they were |
271
+ | `delete(user)` | Deleted with the user |
272
+ | `collectExpired()` | Lapsed keys are deleted, when the key store implements `deleteExpiredApiKeys` |
273
+
274
+ ## Events
275
+
276
+ Two [user events](events.md) report a key's life to `janus({ events })`, and
277
+ to webhooks:
278
+
279
+ | `type` | Sent by | `count` |
280
+ | --- | --- | --- |
281
+ | `user.apiKeyCreated` | `create`, once the key is stored | none |
282
+ | `user.apiKeyRevoked` | `revoke`, `revokeAll`, `revokeAllBound`, and the password reset and first proof above when they revoke keys | the keys the call revoked |
283
+
284
+ ```ts
285
+ const auth = janus({
286
+ // …
287
+ events(event) {
288
+ if (event.type === 'user.apiKeyRevoked') {
289
+ audit(event.userId, `${event.count} API key(s) revoked`);
290
+ }
291
+ },
292
+ });
293
+ ```
294
+
295
+ - **One event per call**: a bulk revoke sends one `user.apiKeyRevoked` with
296
+ its `count`, not one per key. A call that revokes nothing sends none: a key
297
+ already revoked, a user with no standing key, an object with no bound key.
298
+ - **The event names the user (`userId`, `userType`) and nothing of the key**:
299
+ no id, no secret, no name. Read the keys with `apiKeys.list(event.userId)`.
300
+ - **`count` stays in the process**: a webhook posts the user alone.
301
+ - **`delete(user)` sends `user.deleted`**, not a revoke event: its keys are
302
+ deleted with the user.
303
+
304
+ There is no e-mail notice when a key is created: listen to `user.apiKeyCreated` to send your own.
305
+
306
+ ## Types
307
+
308
+ `ApiKey` (a key without its hash, with a `hint`, and `scopes`, `bound` and
309
+ `expiryNotifiedAt`, each `null` when unset), `CreatedApiKey`
310
+ (`{ apiKey, token }`), `CreateApiKeyInput`, `ApiKeyBound` (`{ type, id }`),
311
+ `ApiKeyPage` (`{ limit?, after? }`; `expiring` takes `{ within } & ApiKeyPage`),
312
+ `ApiKeyListOptions` (`ApiKeyPage & { bound? }`, what `list` takes), `ApiKeysApi`, `ApiKeysConfig`, and for
313
+ the principal of a request, `Principal<U> = Authenticated<U> | KeyAuthenticated<U>`,
314
+ told apart by `via` (`'session'` or `'apiKey'`; a key's has `session: null`,
315
+ and `scopes` and `bound`). `apiKeys`
316
+ is a reserved name: a user type cannot be called that.
@@ -0,0 +1,334 @@
1
+ # Account avatars
2
+
3
+ This page is the full recipe for giving accounts an avatar: the upload route,
4
+ the remove route, the route that serves the image, who may see it, and what
5
+ fails in what order. Janus is a small part of it: **it records which image is
6
+ the account's — an opaque id your application chose — and stores no bytes.**
7
+ Storing, processing, serving and deleting the image is your application's,
8
+ in whatever storage it already runs.
9
+
10
+ The calls it adds are `auth.avatar.set` and `auth.avatar.remove` on an instance
11
+ of one user type (with several, `auth.<type>.avatar.set`, and the same at the
12
+ root for a page that holds only an id; the reference is in [the README](../../README.md#avatars--avatar)); the
13
+ avatar is read back as `user.avatar`, `{ id, updatedAt } | null`.
14
+
15
+ The image side below is written with
16
+ [`@softistx/image`](https://github.com/softistx/nxgt-data/blob/develop/packages/image/README.md)
17
+ 0.4 and its `@softistx/image/s3` subpath over
18
+ [`@softistx/s3`](https://github.com/softistx/nxgt-data/blob/develop/packages/s3/README.md),
19
+ **for example**: any storage works, since janus keeps only the id. Both are
20
+ private `@softistx` packages (they moved from `@nxgt/image` and
21
+ `@nxgt/s3` on npm). Their calls — `defineImageSet`, `bindImageStore`,
22
+ `store.replace`, `store.remove`, `store.bytes` — are the ones the recipe uses;
23
+ swap them for your own storage calls. `@softistx/image` runs on Bun 1.4.1 or
24
+ later only, and its bucket must accept `image/webp` and a `maxSize` of at least
25
+ the largest size: see its README and
26
+ [`docs/guide/storing.md`](https://github.com/softistx/nxgt-data/blob/develop/packages/image/docs/guide/storing.md).
27
+
28
+ ## What you decide, and what janus does
29
+
30
+ | | |
31
+ | --- | --- |
32
+ | The id | Yours: `crypto.randomUUID()`, a **new one for every upload** |
33
+ | The bytes | Yours: processed, stored, served and deleted by your application |
34
+ | The record | Janus's: `user.avatar`, written by `avatar.set` / `avatar.remove` |
35
+ | Who may change it | Yours: janus has **no access check** on either call |
36
+ | Who may see it | Yours: janus has no access check on `user.avatar` either |
37
+ | Reading | A stream through **your own authenticated route** — see *Never a public URL* in the traps |
38
+ | History | None: only the current image is kept |
39
+
40
+ ## The image store
41
+
42
+ ```ts
43
+ import { defineImageSet, ImageError } from '@softistx/image';
44
+ import { bindImageStore } from '@softistx/image/s3';
45
+ import { bindBucket, defineBucket } from '@softistx/s3';
46
+
47
+ const sizes = [256, 64]; // the only sizes the proxy route will serve
48
+
49
+ const avatarBucket = defineBucket({
50
+ bucket: 'avatars',
51
+ // a fresh imageId per upload, so a new image never lands on the former one's keys
52
+ key: (p: { imageId: string; size: number }) => `avatars/${p.imageId}/${p.size}.webp`,
53
+ });
54
+
55
+ const s3Config = { endpoint: env.S3_ENDPOINT, accessKeyId: env.S3_KEY, secretAccessKey: env.S3_SECRET };
56
+
57
+ export const store = bindImageStore(
58
+ defineImageSet({ sizes }), // limits, quality: see the @softistx/image README
59
+ bindBucket(avatarBucket, s3Config), // never with a public default acl
60
+ );
61
+ // store.replace({ imageId }, input) — decode, resize, write every size
62
+ // store.remove({ imageId }) — delete every size
63
+ // store.bytes({ imageId }, size) — the stored bytes of one size
64
+ ```
65
+
66
+ A refused image throws an `ImageError` whose `code` is `TOO_LARGE`,
67
+ `UNSUPPORTED_TYPE`, `UNDECODABLE` or `TOO_SMALL`: answer it with a 4xx of
68
+ your own.
69
+
70
+ ## 1. The upload route
71
+
72
+ Any HTTP framework; this one is Hono-like. The order is the point: **session,
73
+ fresh id, bytes, record, then the former image.**
74
+
75
+ ```ts
76
+ import { bodyLimit } from 'hono/body-limit';
77
+
78
+ app.put(
79
+ '/me/avatar',
80
+ // Before the body is read: `arrayBuffer()` below holds the whole upload in
81
+ // memory, so a limit in front of the route stops a huge body before it does.
82
+ bodyLimit({ maxSize: 5 * 1024 * 1024, onError: (c) => c.body(null, 413) }),
83
+ async (c) => {
84
+ const current = await auth.authenticate(c.req.raw); // 1. who is asking
85
+ if (current === null) return c.body(null, 401);
86
+ const userId = current.user.id; // only ever the caller's own avatar
87
+
88
+ const imageId = crypto.randomUUID(); // 2. a new id for every upload
89
+ try {
90
+ await store.replace({ imageId }, await c.req.arrayBuffer()); // 3. the bytes FIRST
91
+ } catch (error) {
92
+ if (error instanceof ImageError) {
93
+ return c.json({ code: error.code }, error.code === 'TOO_LARGE' ? 413 : 422);
94
+ }
95
+ throw error;
96
+ }
97
+
98
+ const former = current.user.avatar?.id ?? null; // read before the call (webhook-only receivers)
99
+ try {
100
+ await auth.avatar.set(userId, { id: imageId }); // 4. then the record
101
+ } catch (error) {
102
+ await store.remove({ imageId }); // any failure: nothing points at this upload
103
+ throw error;
104
+ }
105
+ if (former !== null) await store.remove({ imageId: former }); // 5. then the former image
106
+ return c.json({ id: imageId }, 200);
107
+ },
108
+ );
109
+ ```
110
+
111
+ The body limit is the route's, not janus's: `c.req.arrayBuffer()` reads the
112
+ whole body before `@softistx/image` can refuse it as `TOO_LARGE`, so without a
113
+ limit in front, one large request is held in memory first. Any equivalent —
114
+ the framework's, or the reverse proxy's — does the same.
115
+
116
+ Step 5 has two homes. In the process that wrote, the `janus({ events })`
117
+ listener hears `user.avatarChanged` with `formerAvatarId` — see
118
+ [user events](events.md#what-an-event-carries) — and is the one place that
119
+ deletes the former image whichever route changed it:
120
+
121
+ ```ts
122
+ const auth = janus({
123
+ ...config,
124
+ async events(event) {
125
+ if (
126
+ (event.type === 'user.avatarChanged' || event.type === 'user.avatarRemoved') &&
127
+ event.formerAvatarId != null
128
+ ) {
129
+ await store.remove({ imageId: event.formerAvatarId });
130
+ }
131
+ },
132
+ });
133
+ ```
134
+
135
+ With that listener, drop step 5 from the route. A receiver that only gets
136
+ **webhooks** never sees `formerAvatarId` (`@softistx/janus-webhooks` strips it),
137
+ so it reads `user.avatar?.id` before the call, as the route above does, and
138
+ deletes that image once the call answered.
139
+
140
+ ## 2. The remove route
141
+
142
+ ```ts
143
+ app.delete('/me/avatar', async (c) => {
144
+ const current = await auth.authenticate(c.req.raw);
145
+ if (current === null) return c.body(null, 401);
146
+
147
+ const former = current.user.avatar?.id ?? null;
148
+ await auth.avatar.remove(current.user.id); // the record first: nothing points at the bytes any more
149
+ if (former !== null) await store.remove({ imageId: former }); // then the bytes (or the listener above)
150
+ return c.body(null, 204);
151
+ });
152
+ ```
153
+
154
+ Removing the record before the bytes is the safe order here too: a failure
155
+ in between leaves an orphan image, never a record pointing at nothing.
156
+ `avatar.remove` on a user with no avatar writes and sends nothing.
157
+
158
+ ## 3. The proxy route
159
+
160
+ Reading is a stream through your application, behind its session and its
161
+ access rule. The `url` a client holds points here.
162
+
163
+ ```ts
164
+ app.get('/avatars/:userId/:size', async (c) => {
165
+ const current = await auth.authenticate(c.req.raw);
166
+ if (current === null) return c.body(null, 401);
167
+
168
+ const { userId } = c.req.param();
169
+ const size = Number(c.req.param('size'));
170
+ if (!sizes.includes(size)) return c.body(null, 404); // only the sizes you store
171
+
172
+ const user = await auth.find(userId);
173
+ if (user === null || !(await canViewAvatar(current.user, user))) return c.body(null, 404); // the access check
174
+ if (user.avatar === null) return c.body(null, 404); // no avatar
175
+
176
+ const etag = `"${user.avatar.id}"`; // a new upload is a new id, so a new ETag
177
+ const cache = 'private, no-cache'; // revalidate on every view, so the access check re-runs
178
+ if (c.req.header('If-None-Match') === etag) {
179
+ return c.body(null, 304, { ETag: etag, 'Cache-Control': cache });
180
+ }
181
+ const bytes = await store.bytes({ imageId: user.avatar.id }, size);
182
+ if (bytes === undefined) return c.body(null, 404); // the record outlived its bytes
183
+ return new Response(bytes, {
184
+ headers: {
185
+ 'Content-Type': 'image/webp',
186
+ 'Cache-Control': cache, // private: never a shared cache or a CDN
187
+ ETag: etag,
188
+ },
189
+ });
190
+ });
191
+ ```
192
+
193
+ Answer **404 when the caller may not see it**, as you would for an account
194
+ that does not exist: a 403 tells them the account has an avatar. The
195
+ `?v=<id>` your GraphQL `url` adds is for the browser's cache only; the route
196
+ reads the current avatar, never the one the query names. Put the id in a
197
+ `?v=` with `encodeURIComponent(id)`: ids are the application's own strings.
198
+
199
+ The `ETag` is built from the id and quoted, as the header requires. That is
200
+ fine for a UUID; an id you choose yourself must not hold a `"` or a control
201
+ character, or the header is malformed.
202
+
203
+ ## 4. Who may see an account: a privacy recipe
204
+
205
+ Janus has no organizations, so "an account is visible to the members of an
206
+ organization it belongs to" is yours to enforce — with
207
+ [`@softistx/janus/permissions`](permissions.md). Model the organization's members,
208
+ and give each account a `viewAvatar` permission that is its own owner or
209
+ anyone in an organization it belongs to:
210
+
211
+ ```ts
212
+ import { defineModel, fromField, permissions } from '@softistx/janus/permissions';
213
+
214
+ const model = defineModel({
215
+ subjects: auth.types, // ['user']
216
+ types: {
217
+ organization: {
218
+ related: { members: ['user'] },
219
+ },
220
+ user: {
221
+ related: {
222
+ self: fromField('id', 'user'), // the account itself, read from its own id
223
+ viewers: ['organization#members'], // every member of an organization it belongs to
224
+ },
225
+ permits: { viewAvatar: ['self', 'viewers'] },
226
+ },
227
+ },
228
+ });
229
+
230
+ export const access = permissions({ model, store: relations }); // relations: your relation store
231
+ ```
232
+
233
+ **Granted when a membership is created, revoked when it ends** — beside your
234
+ own membership write, so the two never drift:
235
+
236
+ ```ts
237
+ async function addMember(user: { type: 'user'; id: string }, organizationId: string) {
238
+ const organization = { type: 'organization', id: organizationId } as const;
239
+ await access.grant(organization, 'members', user);
240
+ // the account is now visible to every member of the organization:
241
+ await access.grant(user, 'viewers', { ...organization, relation: 'members' });
242
+ }
243
+
244
+ async function removeMember(user: { type: 'user'; id: string }, organizationId: string) {
245
+ const organization = { type: 'organization', id: organizationId } as const;
246
+ await access.revoke(user, 'viewers', { ...organization, relation: 'members' });
247
+ await access.revoke(organization, 'members', user);
248
+ }
249
+ ```
250
+
251
+ Both calls are idempotent, so a retry is safe. The subject set follows the
252
+ data as it stands: a member added to the organization later sees every
253
+ account granted to its members, with no new tuple.
254
+
255
+ **Check it in the proxy route** — the `canViewAvatar` of step 3:
256
+
257
+ ```ts
258
+ const canViewAvatar = (viewer: { type: 'user'; id: string }, owner: { type: 'user'; id: string }) =>
259
+ access.can(viewer, 'viewAvatar', owner); // a user passed as it is, is that user
260
+ ```
261
+
262
+ `can()` answers `false` for a denial and throws `STORE_FAILED` for an
263
+ outage: answer the outage 503, never 404.
264
+
265
+ **And on the GraphQL field**, with
266
+ [`@softistx/janus-graphql`](https://github.com/softistx/nxgt-janus/blob/develop/packages/janus-graphql/docs/guide/avatars.md), either
267
+ the directive or `can()`:
268
+
269
+ ```graphql
270
+ type Member {
271
+ id: ID!
272
+ avatar: JanusAvatar @permission(name: "viewAvatar", type: "user", id: "parent.id")
273
+ }
274
+ ```
275
+
276
+ The directive's ids, loaders and the `null`-on-deny alternative are in
277
+ [the GraphQL avatars guide](https://github.com/softistx/nxgt-janus/blob/develop/packages/janus-graphql/docs/guide/avatars.md#who-may-see-an-avatar).
278
+
279
+ ## 5. Failure order and traps
280
+
281
+ - **Bytes before the record.** If `avatar.set` fails after the bytes were
282
+ written, the image is an orphan nobody points at; the other order could
283
+ leave a record pointing at bytes that were never written. An orphan costs
284
+ storage; a dangling record costs a broken image.
285
+ - **A fresh id for every upload.** `store.replace` writes under keys built
286
+ from its params. Reusing the user's id overwrites the image they are
287
+ showing, and the later removal of the former image — the same id — deletes
288
+ the new one. Janus refuses an id that is not a non-empty string of at most
289
+ 512 characters that every store can keep (no NUL, no lone surrogate;
290
+ `AVATAR_ID_INVALID`) and nothing else.
291
+ - **Setting the same id is a no-op**: no write, no event, so no former image
292
+ to delete.
293
+ - **Janus has no access check.** `avatar.set`, `avatar.remove`, `find` and
294
+ `get` answer whoever calls them. Check the session and the rule before
295
+ each, as the routes above do.
296
+ - **Webhooks strip `formerAvatarId`.** Delete the former image from the
297
+ in-process listener, or read `user.avatar?.id` before the call.
298
+ - **`Cache-Control: private, no-cache`, not `max-age`.** `no-cache` lets the
299
+ browser keep the bytes but makes it ask the route on every view, so the
300
+ access check runs again: a member removed from an organization stops seeing
301
+ its accounts' images at the next view, and an unchanged image costs one 304.
302
+ A `max-age=86400` would serve a revoked viewer the cached image for a day,
303
+ with no request to refuse. `private` keeps a shared cache or a CDN out.
304
+ - **`VERSION_CONFLICT` is not only a stale `ifVersion`.** Any write that
305
+ landed between the read and the write conflicts too, with or without an
306
+ `ifVersion` of yours: a sign-in that rehashed the password is one. Delete
307
+ your fresh upload on any failure of `avatar.set`, as the route above does.
308
+ - **Never a public URL.** A public bucket or a signed URL needs no session:
309
+ anyone holding the link, an ex-member included, keeps seeing the image.
310
+ The proxy route is what makes the rule above hold.
311
+ - **Deploy the schema first.** `avatar` is a column or a document field, and
312
+ the two adapters fail differently before it exists. On MongoDB, run
313
+ `syncMongoStores(db)` before the release that calls `avatar.set` or
314
+ `avatar.remove`: until then only a write that sets an avatar fails, with
315
+ `STORE_FAILED`. On PostgreSQL, run the
316
+ [drizzle migration](https://github.com/softistx/nxgt-janus/blob/develop/packages/janus-drizzle/docs/guide/migrations.md)
317
+ before the release at all: the columns are missing, so every query on
318
+ `users` fails with `STORE_FAILED`, sign-in included.
319
+ - **An avatar set before the address was proven is not cleared by the
320
+ proof.** The first e-mail proof clears the password, the second factor and the avatar
321
+ of a user who registered an address they do not own (a squatter's), but not
322
+ the avatar. An application that shows avatars of unverified accounts calls
323
+ `avatar.remove` for a user whose `user.emailVerified` has just turned true, or does
324
+ not show the avatar of a user whose `emailVerified` is `false`.
325
+ - **Delete the account's image with the account.** `user.deleted` carries
326
+ no avatar id: read `user.avatar?.id` before calling `delete`, and remove
327
+ that image once it answered.
328
+
329
+ ## See also
330
+
331
+ - [User events](events.md) — `user.avatarChanged`, `user.avatarRemoved` and `formerAvatarId`
332
+ - [Users](users.md) — `user.avatar` and the reserved name
333
+ - [Permissions](permissions.md) — `defineModel`, `fromField`, `grant`, `can`
334
+ - [`@softistx/janus-graphql`'s avatar guide](https://github.com/softistx/nxgt-janus/blob/develop/packages/janus-graphql/docs/guide/avatars.md) — the `JanusAvatar` type and its `url(size:)`