@sharadox/account-web-library 0.1.0-development.3 → 0.1.0-development.33

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 (392) hide show
  1. package/README.md +270 -8
  2. package/distribution/account-activity/index.d.ts +16 -0
  3. package/distribution/account-activity/index.d.ts.map +1 -0
  4. package/distribution/account-activity/index.js +18 -0
  5. package/distribution/account-activity/index.js.map +1 -0
  6. package/distribution/account-activity/type.d.ts +15 -0
  7. package/distribution/account-activity/type.d.ts.map +1 -0
  8. package/distribution/account-activity/type.js.map +1 -0
  9. package/distribution/account-ban/index.d.ts +67 -0
  10. package/distribution/account-ban/index.d.ts.map +1 -0
  11. package/distribution/account-ban/index.js +233 -0
  12. package/distribution/account-ban/index.js.map +1 -0
  13. package/distribution/account-ban/type.d.ts +44 -0
  14. package/distribution/account-ban/type.d.ts.map +1 -0
  15. package/distribution/account-ban/type.js +2 -0
  16. package/distribution/account-ban/type.js.map +1 -0
  17. package/distribution/account-database/type.d.ts +264 -0
  18. package/distribution/account-database/type.d.ts.map +1 -0
  19. package/distribution/account-database/type.js +2 -0
  20. package/distribution/account-database/type.js.map +1 -0
  21. package/distribution/account-deletion/index.d.ts +21 -0
  22. package/distribution/account-deletion/index.d.ts.map +1 -0
  23. package/distribution/account-deletion/index.js +66 -0
  24. package/distribution/account-deletion/index.js.map +1 -0
  25. package/distribution/account-export/index.d.ts +17 -0
  26. package/distribution/account-export/index.d.ts.map +1 -0
  27. package/distribution/account-export/index.js +87 -0
  28. package/distribution/account-export/index.js.map +1 -0
  29. package/distribution/account-export/type.d.ts +40 -0
  30. package/distribution/account-export/type.d.ts.map +1 -0
  31. package/distribution/account-export/type.js +2 -0
  32. package/distribution/account-export/type.js.map +1 -0
  33. package/distribution/account-inactivity/index.d.ts +25 -0
  34. package/distribution/account-inactivity/index.d.ts.map +1 -0
  35. package/distribution/account-inactivity/index.js +100 -0
  36. package/distribution/account-inactivity/index.js.map +1 -0
  37. package/distribution/account-migration/index.d.ts +18 -0
  38. package/distribution/account-migration/index.d.ts.map +1 -0
  39. package/distribution/account-migration/index.js +376 -0
  40. package/distribution/account-migration/index.js.map +1 -0
  41. package/distribution/account-name/index.d.ts +13 -0
  42. package/distribution/account-name/index.d.ts.map +1 -0
  43. package/distribution/account-name/index.js +22 -0
  44. package/distribution/account-name/index.js.map +1 -0
  45. package/distribution/account-name/type.d.ts +9 -0
  46. package/distribution/account-name/type.d.ts.map +1 -0
  47. package/distribution/account-name/type.js +2 -0
  48. package/distribution/account-name/type.js.map +1 -0
  49. package/distribution/account-name-change/index.d.ts +15 -0
  50. package/distribution/account-name-change/index.d.ts.map +1 -0
  51. package/distribution/account-name-change/index.js +26 -0
  52. package/distribution/account-name-change/index.js.map +1 -0
  53. package/distribution/account-name-change/type.d.ts +7 -0
  54. package/distribution/account-name-change/type.d.ts.map +1 -0
  55. package/distribution/account-name-change/type.js +2 -0
  56. package/distribution/account-name-change/type.js.map +1 -0
  57. package/distribution/account-notice/index.d.ts +15 -0
  58. package/distribution/account-notice/index.d.ts.map +1 -0
  59. package/distribution/account-notice/index.js +41 -0
  60. package/distribution/account-notice/index.js.map +1 -0
  61. package/distribution/account-permission/index.d.ts +14 -0
  62. package/distribution/account-permission/index.d.ts.map +1 -0
  63. package/distribution/account-permission/index.js +91 -0
  64. package/distribution/account-permission/index.js.map +1 -0
  65. package/distribution/account-permission/type.d.ts +12 -0
  66. package/distribution/account-permission/type.d.ts.map +1 -0
  67. package/distribution/account-permission/type.js +2 -0
  68. package/distribution/account-permission/type.js.map +1 -0
  69. package/distribution/account-picture-change/index.d.ts +30 -0
  70. package/distribution/account-picture-change/index.d.ts.map +1 -0
  71. package/distribution/account-picture-change/index.js +70 -0
  72. package/distribution/account-picture-change/index.js.map +1 -0
  73. package/distribution/account-picture-change/type.d.ts +11 -0
  74. package/distribution/account-picture-change/type.d.ts.map +1 -0
  75. package/distribution/account-picture-change/type.js +2 -0
  76. package/distribution/account-picture-change/type.js.map +1 -0
  77. package/distribution/account-server/index.d.ts +25 -0
  78. package/distribution/account-server/index.d.ts.map +1 -0
  79. package/distribution/account-server/index.js +34 -0
  80. package/distribution/account-server/index.js.map +1 -0
  81. package/distribution/account-server/type.d.ts +30 -0
  82. package/distribution/account-server/type.d.ts.map +1 -0
  83. package/distribution/account-server/type.js +2 -0
  84. package/distribution/account-server/type.js.map +1 -0
  85. package/distribution/account-session-end/index.d.ts +15 -0
  86. package/distribution/account-session-end/index.d.ts.map +1 -0
  87. package/distribution/account-session-end/index.js +21 -0
  88. package/distribution/account-session-end/index.js.map +1 -0
  89. package/distribution/account-session-list/index.d.ts +16 -0
  90. package/distribution/account-session-list/index.d.ts.map +1 -0
  91. package/distribution/account-session-list/index.js +33 -0
  92. package/distribution/account-session-list/index.js.map +1 -0
  93. package/distribution/account-session-list/type.d.ts +13 -0
  94. package/distribution/account-session-list/type.d.ts.map +1 -0
  95. package/distribution/account-session-list/type.js +2 -0
  96. package/distribution/account-session-list/type.js.map +1 -0
  97. package/distribution/account-session-revocation/index.d.ts +14 -0
  98. package/distribution/account-session-revocation/index.d.ts.map +1 -0
  99. package/distribution/account-session-revocation/index.js +25 -0
  100. package/distribution/account-session-revocation/index.js.map +1 -0
  101. package/distribution/account-sign-in/index.d.ts +15 -0
  102. package/distribution/account-sign-in/index.d.ts.map +1 -0
  103. package/distribution/account-sign-in/index.js +78 -0
  104. package/distribution/account-sign-in/index.js.map +1 -0
  105. package/distribution/account-sign-in/type.d.ts +24 -0
  106. package/distribution/account-sign-in/type.d.ts.map +1 -0
  107. package/distribution/account-sign-in/type.js +2 -0
  108. package/distribution/account-sign-in/type.js.map +1 -0
  109. package/distribution/account-sign-out/index.d.ts +16 -0
  110. package/distribution/account-sign-out/index.d.ts.map +1 -0
  111. package/distribution/account-sign-out/index.js +34 -0
  112. package/distribution/account-sign-out/index.js.map +1 -0
  113. package/distribution/application-sync/index.d.ts +14 -0
  114. package/distribution/application-sync/index.d.ts.map +1 -0
  115. package/distribution/application-sync/index.js +96 -0
  116. package/distribution/application-sync/index.js.map +1 -0
  117. package/distribution/application-sync/type.d.ts +29 -0
  118. package/distribution/application-sync/type.d.ts.map +1 -0
  119. package/distribution/application-sync/type.js +2 -0
  120. package/distribution/application-sync/type.js.map +1 -0
  121. package/distribution/audit-event/index.d.ts +12 -0
  122. package/distribution/audit-event/index.d.ts.map +1 -0
  123. package/distribution/audit-event/index.js +36 -0
  124. package/distribution/audit-event/index.js.map +1 -0
  125. package/distribution/audit-event/type.d.ts +16 -0
  126. package/distribution/audit-event/type.d.ts.map +1 -0
  127. package/distribution/audit-event/type.js +2 -0
  128. package/distribution/audit-event/type.js.map +1 -0
  129. package/distribution/banned-contact/index.d.ts +34 -0
  130. package/distribution/banned-contact/index.d.ts.map +1 -0
  131. package/distribution/banned-contact/index.js +52 -0
  132. package/distribution/banned-contact/index.js.map +1 -0
  133. package/distribution/browser-session-read/index.d.ts +17 -0
  134. package/distribution/browser-session-read/index.d.ts.map +1 -0
  135. package/distribution/browser-session-read/index.js +52 -0
  136. package/distribution/browser-session-read/index.js.map +1 -0
  137. package/distribution/browser-session-read/type.d.ts +18 -0
  138. package/distribution/browser-session-read/type.d.ts.map +1 -0
  139. package/distribution/browser-session-read/type.js +2 -0
  140. package/distribution/browser-session-read/type.js.map +1 -0
  141. package/distribution/challenge-issue/index.d.ts +13 -0
  142. package/distribution/challenge-issue/index.d.ts.map +1 -0
  143. package/distribution/challenge-issue/index.js +18 -0
  144. package/distribution/challenge-issue/index.js.map +1 -0
  145. package/distribution/code-request/index.d.ts +16 -0
  146. package/distribution/code-request/index.d.ts.map +1 -0
  147. package/distribution/code-request/index.js +52 -0
  148. package/distribution/code-request/index.js.map +1 -0
  149. package/distribution/code-request/type.d.ts +25 -0
  150. package/distribution/code-request/type.d.ts.map +1 -0
  151. package/distribution/code-request/type.js +2 -0
  152. package/distribution/code-request/type.js.map +1 -0
  153. package/distribution/code-request-prune/index.d.ts +13 -0
  154. package/distribution/code-request-prune/index.d.ts.map +1 -0
  155. package/distribution/code-request-prune/index.js +12 -0
  156. package/distribution/code-request-prune/index.js.map +1 -0
  157. package/distribution/code-sending/index.d.ts +14 -0
  158. package/distribution/code-sending/index.d.ts.map +1 -0
  159. package/distribution/code-sending/index.js +65 -0
  160. package/distribution/code-sending/index.js.map +1 -0
  161. package/distribution/code-sending/type.d.ts +31 -0
  162. package/distribution/code-sending/type.d.ts.map +1 -0
  163. package/distribution/code-sending/type.js +2 -0
  164. package/distribution/code-sending/type.js.map +1 -0
  165. package/distribution/code-verification/index.d.ts +14 -0
  166. package/distribution/code-verification/index.d.ts.map +1 -0
  167. package/distribution/code-verification/index.js +43 -0
  168. package/distribution/code-verification/index.js.map +1 -0
  169. package/distribution/code-verification/type.d.ts +22 -0
  170. package/distribution/code-verification/type.d.ts.map +1 -0
  171. package/distribution/code-verification/type.js +2 -0
  172. package/distribution/code-verification/type.js.map +1 -0
  173. package/distribution/contact-addition/index.d.ts +13 -0
  174. package/distribution/contact-addition/index.d.ts.map +1 -0
  175. package/distribution/contact-addition/index.js +48 -0
  176. package/distribution/contact-addition/index.js.map +1 -0
  177. package/distribution/contact-addition/type.d.ts +15 -0
  178. package/distribution/contact-addition/type.d.ts.map +1 -0
  179. package/distribution/contact-addition/type.js +2 -0
  180. package/distribution/contact-addition/type.js.map +1 -0
  181. package/distribution/contact-addition-flow/index.d.ts +32 -0
  182. package/distribution/contact-addition-flow/index.d.ts.map +1 -0
  183. package/distribution/contact-addition-flow/index.js +96 -0
  184. package/distribution/contact-addition-flow/index.js.map +1 -0
  185. package/distribution/contact-addition-flow/type.d.ts +25 -0
  186. package/distribution/contact-addition-flow/type.d.ts.map +1 -0
  187. package/distribution/contact-addition-flow/type.js +2 -0
  188. package/distribution/contact-addition-flow/type.js.map +1 -0
  189. package/distribution/contact-channel/type.d.ts +49 -0
  190. package/distribution/contact-channel/type.d.ts.map +1 -0
  191. package/distribution/contact-channel/type.js +2 -0
  192. package/distribution/contact-channel/type.js.map +1 -0
  193. package/distribution/contact-kind/index.d.ts +12 -0
  194. package/distribution/contact-kind/index.d.ts.map +1 -0
  195. package/distribution/contact-kind/index.js +18 -0
  196. package/distribution/contact-kind/index.js.map +1 -0
  197. package/distribution/contact-kind/type.d.ts +6 -0
  198. package/distribution/contact-kind/type.d.ts.map +1 -0
  199. package/distribution/contact-kind/type.js +2 -0
  200. package/distribution/contact-kind/type.js.map +1 -0
  201. package/distribution/contact-lookup/index.d.ts +16 -0
  202. package/distribution/contact-lookup/index.d.ts.map +1 -0
  203. package/distribution/contact-lookup/index.js +20 -0
  204. package/distribution/contact-lookup/index.js.map +1 -0
  205. package/distribution/contact-removal/index.d.ts +19 -0
  206. package/distribution/contact-removal/index.d.ts.map +1 -0
  207. package/distribution/contact-removal/index.js +35 -0
  208. package/distribution/contact-removal/index.js.map +1 -0
  209. package/distribution/contact-verification/index.d.ts +20 -0
  210. package/distribution/contact-verification/index.d.ts.map +1 -0
  211. package/distribution/contact-verification/index.js +37 -0
  212. package/distribution/contact-verification/index.js.map +1 -0
  213. package/distribution/database-error/index.d.ts +12 -0
  214. package/distribution/database-error/index.d.ts.map +1 -0
  215. package/distribution/database-error/index.js +14 -0
  216. package/distribution/database-error/index.js.map +1 -0
  217. package/distribution/email-channel/index.d.ts +13 -0
  218. package/distribution/email-channel/index.d.ts.map +1 -0
  219. package/distribution/email-channel/index.js +185 -0
  220. package/distribution/email-channel/index.js.map +1 -0
  221. package/distribution/email-channel/type.d.ts +17 -0
  222. package/distribution/email-channel/type.d.ts.map +1 -0
  223. package/distribution/email-channel/type.js +2 -0
  224. package/distribution/email-channel/type.js.map +1 -0
  225. package/distribution/identifier/index.d.ts +23 -0
  226. package/distribution/identifier/index.d.ts.map +1 -0
  227. package/distribution/identifier/index.js +32 -0
  228. package/distribution/identifier/index.js.map +1 -0
  229. package/distribution/identifier/type.d.ts +10 -0
  230. package/distribution/identifier/type.d.ts.map +1 -0
  231. package/distribution/identifier/type.js +2 -0
  232. package/distribution/identifier/type.js.map +1 -0
  233. package/distribution/identifier-availability/index.d.ts +11 -0
  234. package/distribution/identifier-availability/index.d.ts.map +1 -0
  235. package/distribution/identifier-availability/index.js +21 -0
  236. package/distribution/identifier-availability/index.js.map +1 -0
  237. package/distribution/identifier-change/index.d.ts +15 -0
  238. package/distribution/identifier-change/index.d.ts.map +1 -0
  239. package/distribution/identifier-change/index.js +43 -0
  240. package/distribution/identifier-change/index.js.map +1 -0
  241. package/distribution/identifier-change/type.d.ts +7 -0
  242. package/distribution/identifier-change/type.d.ts.map +1 -0
  243. package/distribution/identifier-change/type.js +2 -0
  244. package/distribution/identifier-change/type.js.map +1 -0
  245. package/distribution/memory-picture-storage/index.d.ts +15 -0
  246. package/distribution/memory-picture-storage/index.d.ts.map +1 -0
  247. package/distribution/memory-picture-storage/index.js +16 -0
  248. package/distribution/memory-picture-storage/index.js.map +1 -0
  249. package/distribution/one-time-code/index.d.ts +2 -2
  250. package/distribution/one-time-code/index.js +3 -3
  251. package/distribution/person-account/index.d.ts +18 -0
  252. package/distribution/person-account/index.d.ts.map +1 -0
  253. package/distribution/person-account/index.js +65 -0
  254. package/distribution/person-account/index.js.map +1 -0
  255. package/distribution/person-account/type.d.ts +22 -0
  256. package/distribution/person-account/type.d.ts.map +1 -0
  257. package/distribution/person-account/type.js +2 -0
  258. package/distribution/person-account/type.js.map +1 -0
  259. package/distribution/picture-key/index.d.ts +8 -0
  260. package/distribution/picture-key/index.d.ts.map +1 -0
  261. package/distribution/picture-key/index.js +10 -0
  262. package/distribution/picture-key/index.js.map +1 -0
  263. package/distribution/picture-preparation/index.d.ts +18 -0
  264. package/distribution/picture-preparation/index.d.ts.map +1 -0
  265. package/distribution/picture-preparation/index.js +86 -0
  266. package/distribution/picture-preparation/index.js.map +1 -0
  267. package/distribution/picture-preparation/type.d.ts +18 -0
  268. package/distribution/picture-preparation/type.d.ts.map +1 -0
  269. package/distribution/picture-preparation/type.js +2 -0
  270. package/distribution/picture-preparation/type.js.map +1 -0
  271. package/distribution/picture-storage/type.d.ts +11 -0
  272. package/distribution/picture-storage/type.d.ts.map +1 -0
  273. package/distribution/picture-storage/type.js +2 -0
  274. package/distribution/picture-storage/type.js.map +1 -0
  275. package/distribution/recovery-code-regeneration/index.d.ts +19 -0
  276. package/distribution/recovery-code-regeneration/index.d.ts.map +1 -0
  277. package/distribution/recovery-code-regeneration/index.js +34 -0
  278. package/distribution/recovery-code-regeneration/index.js.map +1 -0
  279. package/distribution/recovery-code-store/index.d.ts +25 -0
  280. package/distribution/recovery-code-store/index.d.ts.map +1 -0
  281. package/distribution/recovery-code-store/index.js +34 -0
  282. package/distribution/recovery-code-store/index.js.map +1 -0
  283. package/distribution/role-grant/index.d.ts +38 -0
  284. package/distribution/role-grant/index.d.ts.map +1 -0
  285. package/distribution/role-grant/index.js +142 -0
  286. package/distribution/role-grant/index.js.map +1 -0
  287. package/distribution/role-grant/type.d.ts +40 -0
  288. package/distribution/role-grant/type.d.ts.map +1 -0
  289. package/distribution/role-grant/type.js +2 -0
  290. package/distribution/role-grant/type.js.map +1 -0
  291. package/distribution/rule-sync/index.d.ts +28 -0
  292. package/distribution/rule-sync/index.d.ts.map +1 -0
  293. package/distribution/rule-sync/index.js +80 -0
  294. package/distribution/rule-sync/index.js.map +1 -0
  295. package/distribution/rule-sync/type.d.ts +17 -0
  296. package/distribution/rule-sync/type.d.ts.map +1 -0
  297. package/distribution/rule-sync/type.js +2 -0
  298. package/distribution/rule-sync/type.js.map +1 -0
  299. package/distribution/second-factor-finish/index.d.ts +13 -0
  300. package/distribution/second-factor-finish/index.d.ts.map +1 -0
  301. package/distribution/second-factor-finish/index.js +90 -0
  302. package/distribution/second-factor-finish/index.js.map +1 -0
  303. package/distribution/second-factor-finish/type.d.ts +30 -0
  304. package/distribution/second-factor-finish/type.d.ts.map +1 -0
  305. package/distribution/second-factor-finish/type.js +2 -0
  306. package/distribution/second-factor-finish/type.js.map +1 -0
  307. package/distribution/secret-derivation/index.d.ts +10 -0
  308. package/distribution/secret-derivation/index.d.ts.map +1 -0
  309. package/distribution/secret-derivation/index.js +15 -0
  310. package/distribution/secret-derivation/index.js.map +1 -0
  311. package/distribution/secret-encryption/index.d.ts +17 -0
  312. package/distribution/secret-encryption/index.d.ts.map +1 -0
  313. package/distribution/secret-encryption/index.js +37 -0
  314. package/distribution/secret-encryption/index.js.map +1 -0
  315. package/distribution/session-prune/index.d.ts +17 -0
  316. package/distribution/session-prune/index.d.ts.map +1 -0
  317. package/distribution/session-prune/index.js +30 -0
  318. package/distribution/session-prune/index.js.map +1 -0
  319. package/distribution/session-token/index.d.ts +19 -0
  320. package/distribution/session-token/index.d.ts.map +1 -0
  321. package/distribution/session-token/index.js +22 -0
  322. package/distribution/session-token/index.js.map +1 -0
  323. package/distribution/sign-in-finish/index.d.ts +13 -0
  324. package/distribution/sign-in-finish/index.d.ts.map +1 -0
  325. package/distribution/sign-in-finish/index.js +69 -0
  326. package/distribution/sign-in-finish/index.js.map +1 -0
  327. package/distribution/sign-in-finish/type.d.ts +44 -0
  328. package/distribution/sign-in-finish/type.d.ts.map +1 -0
  329. package/distribution/sign-in-finish/type.js +2 -0
  330. package/distribution/sign-in-finish/type.js.map +1 -0
  331. package/distribution/sign-in-start/index.d.ts +17 -0
  332. package/distribution/sign-in-start/index.d.ts.map +1 -0
  333. package/distribution/sign-in-start/index.js +45 -0
  334. package/distribution/sign-in-start/index.js.map +1 -0
  335. package/distribution/sign-in-start/type.d.ts +34 -0
  336. package/distribution/sign-in-start/type.d.ts.map +1 -0
  337. package/distribution/sign-in-start/type.js +2 -0
  338. package/distribution/sign-in-start/type.js.map +1 -0
  339. package/distribution/sign-up-finish/index.d.ts +13 -0
  340. package/distribution/sign-up-finish/index.d.ts.map +1 -0
  341. package/distribution/sign-up-finish/index.js +38 -0
  342. package/distribution/sign-up-finish/index.js.map +1 -0
  343. package/distribution/sign-up-finish/type.d.ts +28 -0
  344. package/distribution/sign-up-finish/type.d.ts.map +1 -0
  345. package/distribution/sign-up-finish/type.js +2 -0
  346. package/distribution/sign-up-finish/type.js.map +1 -0
  347. package/distribution/signed-ticket/index.d.ts +19 -0
  348. package/distribution/signed-ticket/index.d.ts.map +1 -0
  349. package/distribution/signed-ticket/index.js +35 -0
  350. package/distribution/signed-ticket/index.js.map +1 -0
  351. package/distribution/signed-ticket/type.d.ts +16 -0
  352. package/distribution/signed-ticket/type.d.ts.map +1 -0
  353. package/distribution/signed-ticket/type.js +2 -0
  354. package/distribution/signed-ticket/type.js.map +1 -0
  355. package/distribution/step-up/index.d.ts +48 -0
  356. package/distribution/step-up/index.d.ts.map +1 -0
  357. package/distribution/step-up/index.js +83 -0
  358. package/distribution/step-up/index.js.map +1 -0
  359. package/distribution/step-up/type.d.ts +15 -0
  360. package/distribution/step-up/type.d.ts.map +1 -0
  361. package/distribution/step-up/type.js +2 -0
  362. package/distribution/{username → step-up}/type.js.map +1 -1
  363. package/distribution/test-database/index.d.ts +13 -0
  364. package/distribution/test-database/index.d.ts.map +1 -0
  365. package/distribution/test-database/index.js +17 -0
  366. package/distribution/test-database/index.js.map +1 -0
  367. package/distribution/test-person/index.d.ts +14 -0
  368. package/distribution/test-person/index.d.ts.map +1 -0
  369. package/distribution/test-person/index.js +20 -0
  370. package/distribution/test-person/index.js.map +1 -0
  371. package/distribution/test-server/index.d.ts +10 -0
  372. package/distribution/test-server/index.d.ts.map +1 -0
  373. package/distribution/test-server/index.js +16 -0
  374. package/distribution/test-server/index.js.map +1 -0
  375. package/distribution/totp/type.d.ts +1 -1
  376. package/distribution/totp/type.d.ts.map +1 -1
  377. package/distribution/totp-setup/index.d.ts +50 -0
  378. package/distribution/totp-setup/index.d.ts.map +1 -0
  379. package/distribution/totp-setup/index.js +136 -0
  380. package/distribution/totp-setup/index.js.map +1 -0
  381. package/distribution/totp-setup/type.d.ts +24 -0
  382. package/distribution/totp-setup/type.d.ts.map +1 -0
  383. package/distribution/totp-setup/type.js +2 -0
  384. package/distribution/totp-setup/type.js.map +1 -0
  385. package/package.json +9 -2
  386. package/distribution/username/index.d.ts +0 -23
  387. package/distribution/username/index.d.ts.map +0 -1
  388. package/distribution/username/index.js +0 -32
  389. package/distribution/username/index.js.map +0 -1
  390. package/distribution/username/type.d.ts +0 -10
  391. package/distribution/username/type.d.ts.map +0 -1
  392. /package/distribution/{username → account-activity}/type.js +0 -0
@@ -0,0 +1,20 @@
1
+ import { createPersonAccount } from "@sharadox/account-web-library/person-account";
2
+ /**
3
+ * For tests: a person named after their identifier, with `<identifier>@example.com` verified. Returns the account
4
+ * and contact ids.
5
+ *
6
+ * @example
7
+ * const { accountId } = await createTestPerson(memory.database, "ana");
8
+ */
9
+ export async function createTestPerson(database, identifier, now) {
10
+ const result = await createPersonAccount(database, {
11
+ name: identifier,
12
+ identifier,
13
+ contact: { kind: "email", value: `${identifier.toLowerCase()}@example.com` },
14
+ ...(now === undefined ? {} : { now }),
15
+ });
16
+ if (!result.created)
17
+ throw new Error(`test person "${identifier}" not created: ${result.reason}`);
18
+ return { accountId: result.accountId, contactId: result.contactId };
19
+ }
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/test-person/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnF;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,QAAiC,EACjC,UAAkB,EAClB,GAAY;IAEZ,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,QAAQ,EAAE;QACjD,IAAI,EAAE,UAAU;QAChB,UAAU;QACV,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC,WAAW,EAAE,cAAc,EAAE;QAC5E,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;KACtC,CAAC,CAAC;IACH,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,gBAAgB,UAAU,kBAAkB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAClG,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;AACtE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { MemoryDatabase } from "@sharadox/database-web-library/memory-database/type";
2
+ import type { AccountServerDatabase } from "@sharadox/account-web-library/account-database/type";
3
+ /**
4
+ * A migrated account server database (account and protection tables) in memory, for tests of the sign-in flow.
5
+ *
6
+ * @example
7
+ * const memory = await createTestServerDatabase();
8
+ */
9
+ export declare function createTestServerDatabase(): Promise<MemoryDatabase<AccountServerDatabase>>;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/test-server/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAC;AAE1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAGjG;;;;;GAKG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC,CAK/F"}
@@ -0,0 +1,16 @@
1
+ import { createMemoryDatabase } from "@sharadox/database-web-library/memory-database";
2
+ import { migrateProtection } from "@sharadox/protection-web-library/protection-migration";
3
+ import { migrateAccount } from "@sharadox/account-web-library/account-migration";
4
+ /**
5
+ * A migrated account server database (account and protection tables) in memory, for tests of the sign-in flow.
6
+ *
7
+ * @example
8
+ * const memory = await createTestServerDatabase();
9
+ */
10
+ export async function createTestServerDatabase() {
11
+ const memory = await createMemoryDatabase();
12
+ await migrateProtection(memory.database);
13
+ await migrateAccount(memory.database);
14
+ return memory;
15
+ }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/test-server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAEtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,uDAAuD,CAAC;AAE1F,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAEjF;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB;IAC5C,MAAM,MAAM,GAAG,MAAM,oBAAoB,EAAyB,CAAC;IACnE,MAAM,iBAAiB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACzC,MAAM,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -18,7 +18,7 @@ export type TotpVerification = {
18
18
  export interface TotpUriOptions {
19
19
  /** The company, shown above the code. */
20
20
  issuer: string;
21
- /** Which account: the username. */
21
+ /** Which account: the identifier. */
22
22
  account: string;
23
23
  secret: Uint8Array;
24
24
  }
@@ -1 +1 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/totp/type.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,6FAA6F;AAC7F,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,qEAAqE;AACrE,MAAM,MAAM,gBAAgB,GAAG;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAEhF,+DAA+D;AAC/D,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,UAAU,CAAC;CACpB"}
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/totp/type.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,6FAA6F;AAC7F,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,qEAAqE;AACrE,MAAM,MAAM,gBAAgB,GAAG;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAEhF,+DAA+D;AAC/D,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,UAAU,CAAC;CACpB"}
@@ -0,0 +1,50 @@
1
+ import type { Kysely } from "kysely";
2
+ import type { AccountDatabase } from "@sharadox/account-web-library/account-database/type";
3
+ import type { AccountServer } from "@sharadox/account-web-library/account-server/type";
4
+ import type { TotpSetupConfirmation, TotpSetupStart, TotpStatus } from "@sharadox/account-web-library/totp-setup/type";
5
+ /**
6
+ * Starts setting up an authenticator app (two-factor): a new secret, stored encrypted and not yet on, to show as a
7
+ * QR code (`uri`) or to type in (`secret`). Starting again replaces an unfinished setup. Ask for a fresh code first
8
+ * (step-up).
9
+ *
10
+ * @example
11
+ * const setup = await startTotpSetup(server, { accountId, issuer: "Luis Pires Decor" });
12
+ */
13
+ export declare function startTotpSetup(server: AccountServer, { accountId, issuer, now }: {
14
+ accountId: string;
15
+ issuer: string;
16
+ now?: number;
17
+ }): Promise<TotpSetupStart>;
18
+ /**
19
+ * Turns two-factor on once the authenticator app shows a right code, and makes 10 recovery codes to show once.
20
+ *
21
+ * @example
22
+ * const result = await confirmTotpSetup(server, { accountId, code });
23
+ * if (result.confirmed) show(result.recoveryCodes);
24
+ */
25
+ export declare function confirmTotpSetup(server: AccountServer, { accountId, code, now }: {
26
+ accountId: string;
27
+ code: string;
28
+ now?: number;
29
+ }): Promise<TotpSetupConfirmation>;
30
+ /**
31
+ * Turns two-factor off: the authenticator app and the recovery codes. Ask for a fresh code first (step-up).
32
+ *
33
+ * @example
34
+ * await removeTotp(database, { accountId }); // { removed: true }
35
+ */
36
+ export declare function removeTotp(database: Kysely<AccountDatabase>, { accountId }: {
37
+ accountId: string;
38
+ }): Promise<{
39
+ removed: boolean;
40
+ }>;
41
+ /**
42
+ * Whether an account has two-factor on, and how many recovery codes it has left.
43
+ *
44
+ * @example
45
+ * const { on, recoveryCodesLeft } = await totpStatus(database, { accountId });
46
+ */
47
+ export declare function totpStatus(database: Kysely<AccountDatabase>, { accountId }: {
48
+ accountId: string;
49
+ }): Promise<TotpStatus>;
50
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/totp-setup/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAE3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAC;AAOvF,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAEvH;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,aAAa,EACrB,EAAE,SAAS,EAAE,MAAM,EAAE,GAAgB,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3F,OAAO,CAAC,cAAc,CAAC,CAkCzB;AAED;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,aAAa,EACrB,EAAE,SAAS,EAAE,IAAI,EAAE,GAAgB,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACvF,OAAO,CAAC,qBAAqB,CAAC,CA4BhC;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,CAAC,eAAe,CAAC,EACjC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GACnC,OAAO,CAAC;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAY/B;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,CAAC,eAAe,CAAC,EACjC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GACnC,OAAO,CAAC,UAAU,CAAC,CAgBrB"}
@@ -0,0 +1,136 @@
1
+ import { uuidVersion7 } from "@sharadox/web-library/identifier/uuid-version-7";
2
+ import { accountTables } from "@sharadox/account-web-library/account-server";
3
+ import { recordAuditEvent } from "@sharadox/account-web-library/audit-event";
4
+ import { encodeBase32 } from "@sharadox/account-web-library/base-32";
5
+ import { replaceRecoveryCodes } from "@sharadox/account-web-library/recovery-code-store";
6
+ import { decryptSecret, encryptSecret } from "@sharadox/account-web-library/secret-encryption";
7
+ import { deriveSecret } from "@sharadox/account-web-library/secret-derivation";
8
+ import { createTotpSecret, totpUri, verifyTotp } from "@sharadox/account-web-library/totp";
9
+ /**
10
+ * Starts setting up an authenticator app (two-factor): a new secret, stored encrypted and not yet on, to show as a
11
+ * QR code (`uri`) or to type in (`secret`). Starting again replaces an unfinished setup. Ask for a fresh code first
12
+ * (step-up).
13
+ *
14
+ * @example
15
+ * const setup = await startTotpSetup(server, { accountId, issuer: "Luis Pires Decor" });
16
+ */
17
+ export async function startTotpSetup(server, { accountId, issuer, now = Date.now() }) {
18
+ const account = await server.database
19
+ .selectFrom("identifier")
20
+ .select("value")
21
+ .where("account_id", "=", accountId)
22
+ .executeTakeFirst();
23
+ if (!account)
24
+ return { status: "no-account" };
25
+ const secret = createTotpSecret();
26
+ return accountTables(server)
27
+ .transaction()
28
+ .execute(async (transaction) => {
29
+ const existing = await transaction
30
+ .selectFrom("totp_credential")
31
+ .select(["id", "confirmed_at"])
32
+ .where("account_id", "=", accountId)
33
+ .forUpdate()
34
+ .executeTakeFirst();
35
+ if (existing?.confirmed_at)
36
+ return { status: "already-on" };
37
+ if (existing)
38
+ await transaction.deleteFrom("totp_credential").where("id", "=", existing.id).execute();
39
+ await transaction
40
+ .insertInto("totp_credential")
41
+ .values({
42
+ id: uuidVersion7({ now }),
43
+ account_id: accountId,
44
+ secret_ciphertext: encryptSecret(secret, deriveSecret(server.secret, "totp-encryption")),
45
+ created_at: new Date(now),
46
+ })
47
+ .execute();
48
+ return {
49
+ status: "started",
50
+ uri: totpUri({ issuer, account: account.value, secret }),
51
+ secret: encodeBase32(secret),
52
+ };
53
+ });
54
+ }
55
+ /**
56
+ * Turns two-factor on once the authenticator app shows a right code, and makes 10 recovery codes to show once.
57
+ *
58
+ * @example
59
+ * const result = await confirmTotpSetup(server, { accountId, code });
60
+ * if (result.confirmed) show(result.recoveryCodes);
61
+ */
62
+ export async function confirmTotpSetup(server, { accountId, code, now = Date.now() }) {
63
+ return accountTables(server)
64
+ .transaction()
65
+ .execute(async (transaction) => {
66
+ const pending = await transaction
67
+ .selectFrom("totp_credential")
68
+ .select(["id", "secret_ciphertext"])
69
+ .where("account_id", "=", accountId)
70
+ .where("confirmed_at", "is", null)
71
+ .forUpdate()
72
+ .executeTakeFirst();
73
+ if (!pending)
74
+ return { confirmed: false, reason: "none" };
75
+ const secret = decryptSecret(pending.secret_ciphertext, deriveSecret(server.secret, "totp-encryption"));
76
+ const verification = verifyTotp(secret, code.replace(/\s/g, ""), now);
77
+ if (!verification.valid)
78
+ return { confirmed: false, reason: "wrong" };
79
+ await transaction
80
+ .updateTable("totp_credential")
81
+ .set({ confirmed_at: new Date(now), last_used_step: verification.step })
82
+ .where("id", "=", pending.id)
83
+ .execute();
84
+ const recoveryCodes = await replaceRecoveryCodes(transaction, {
85
+ accountId,
86
+ pepper: deriveSecret(server.secret, "recovery-code"),
87
+ now,
88
+ });
89
+ await recordAuditEvent(transaction, { accountId, action: "second-factor.turned-on", now });
90
+ return { confirmed: true, recoveryCodes };
91
+ });
92
+ }
93
+ /**
94
+ * Turns two-factor off: the authenticator app and the recovery codes. Ask for a fresh code first (step-up).
95
+ *
96
+ * @example
97
+ * await removeTotp(database, { accountId }); // { removed: true }
98
+ */
99
+ export async function removeTotp(database, { accountId }) {
100
+ return database.transaction().execute(async (transaction) => {
101
+ const removed = await transaction
102
+ .deleteFrom("totp_credential")
103
+ .where("account_id", "=", accountId)
104
+ .where("confirmed_at", "is not", null)
105
+ .executeTakeFirst();
106
+ if (removed.numDeletedRows === 0n)
107
+ return { removed: false };
108
+ await transaction.deleteFrom("recovery_code").where("account_id", "=", accountId).execute();
109
+ await recordAuditEvent(transaction, { accountId, action: "second-factor.turned-off" });
110
+ return { removed: true };
111
+ });
112
+ }
113
+ /**
114
+ * Whether an account has two-factor on, and how many recovery codes it has left.
115
+ *
116
+ * @example
117
+ * const { on, recoveryCodesLeft } = await totpStatus(database, { accountId });
118
+ */
119
+ export async function totpStatus(database, { accountId }) {
120
+ const [credential, codes] = await Promise.all([
121
+ database
122
+ .selectFrom("totp_credential")
123
+ .select("id")
124
+ .where("account_id", "=", accountId)
125
+ .where("confirmed_at", "is not", null)
126
+ .executeTakeFirst(),
127
+ database
128
+ .selectFrom("recovery_code")
129
+ .select("id")
130
+ .where("account_id", "=", accountId)
131
+ .where("used_at", "is", null)
132
+ .execute(),
133
+ ]);
134
+ return { on: credential !== undefined, recoveryCodesLeft: codes.length };
135
+ }
136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AAU,CAAC,eAAe,CAAC;aAC3B,MAAM,CAAC,IAAI,CAAC;aACZ,KAAK,CAAC,YAAY,EAAE,GAAG,EAAE,SAAS,CAAC;aACnC,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,CAAC;aAC5B,OAAO,EAAE;KACb,CAAC,CAAC;IACH,OAAO,EAAE,EAAE,EAAE,UAAU,KAAK,SAAS,EAAE,iBAAiB,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;AAC3E,CAAC"}
@@ -0,0 +1,24 @@
1
+ export type TotpSetupStart =
2
+ /** Show `uri` as a QR code, and `secret` (base 32) for typing in by hand. */
3
+ {
4
+ status: "started";
5
+ uri: string;
6
+ secret: string;
7
+ } | {
8
+ status: "already-on" | "no-account";
9
+ };
10
+ export type TotpSetupConfirmation =
11
+ /** Two-factor is on: show the recovery codes once, and recommend keeping them somewhere safe. */
12
+ {
13
+ confirmed: true;
14
+ recoveryCodes: string[];
15
+ } | {
16
+ confirmed: false;
17
+ reason: "wrong" | "none";
18
+ };
19
+ export interface TotpStatus {
20
+ /** Whether an authenticator app is needed to sign in. */
21
+ on: boolean;
22
+ recoveryCodesLeft: number;
23
+ }
24
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/totp-setup/type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc;AACxB,6EAA6E;AAC7E;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,YAAY,GAAG,YAAY,CAAA;CAAE,CAAC;AAE/F,MAAM,MAAM,qBAAqB;AAC/B,iGAAiG;AACjG;IAAE,SAAS,EAAE,IAAI,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG;IAAE,SAAS,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAA;CAAE,CAAC;AAEhG,MAAM,WAAW,UAAU;IACzB,yDAAyD;IACzD,EAAE,EAAE,OAAO,CAAC;IACZ,iBAAiB,EAAE,MAAM,CAAC;CAC3B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/totp-setup/type.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sharadox/account-web-library",
3
- "version": "0.1.0-development.3",
3
+ "version": "0.1.0-development.33",
4
4
  "description": "Passwordless accounts for web applications: one-time codes, two-factor, roles, bans and OpenID Connect for people and agents.",
5
5
  "private": false,
6
6
  "license": "SEE LICENSE IN LICENCA.md",
@@ -40,9 +40,16 @@
40
40
  "*.{json,md,yml,yaml}": "prettier --write"
41
41
  },
42
42
  "dependencies": {
43
- "@sharadox/web-library": "^0.11.1"
43
+ "@sharadox/database-web-library": "0.1.0-development.9",
44
+ "@sharadox/email-web-library": "^0.7.1",
45
+ "@sharadox/protection-web-library": "0.1.0-development.12",
46
+ "@sharadox/web-library": "^0.11.1",
47
+ "kysely": "^0.28.20",
48
+ "sharp": "0.34.5",
49
+ "zod": "^4.6.7"
44
50
  },
45
51
  "devDependencies": {
52
+ "@electric-sql/pglite": "0.5.16",
46
53
  "@sharadox/es-lint-configuration-web-library": "^0.1.3",
47
54
  "@sharadox/library-build-web-library": "^0.2.1",
48
55
  "@sharadox/prettier-configuration-web-library": "^0.1.2",
@@ -1,23 +0,0 @@
1
- import type { UsernameCheck } from "@sharadox/account-web-library/username/type";
2
- /** The longest username. */
3
- export declare const USERNAME_MAXIMUM_LENGTH = 50;
4
- /**
5
- * Checks a username against the rules:
6
- * - 1 to 50 characters;
7
- * - only A–Z, a–z and 0–9, with `-`, `_` or `.` allowed only between letters or digits, never two in a row;
8
- * - shown as written, unique without regard to case (see `usernameKey`).
9
- *
10
- * @example
11
- * checkUsername("Luis-Pires"); // { valid: true, username: "Luis-Pires", key: "luis-pires" }
12
- * checkUsername("a--b"); // { valid: false, reason: "characters" }
13
- */
14
- export declare function checkUsername(username: string): UsernameCheck;
15
- /**
16
- * The form a username is unique in: lowercase, so `abc` and `aBc` are the same username (the database's unique index
17
- * is on this key).
18
- *
19
- * @example
20
- * usernameKey("aBc"); // "abc"
21
- */
22
- export declare function usernameKey(username: string): string;
23
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/username/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAKjF,4BAA4B;AAC5B,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAE1C;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAI7D;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEpD"}
@@ -1,32 +0,0 @@
1
- /** Letters and digits, with single `-`, `_` or `.` only between them. */
2
- const PATTERN = /^[A-Za-z0-9]+(?:[-_.][A-Za-z0-9]+)*$/;
3
- /** The longest username. */
4
- export const USERNAME_MAXIMUM_LENGTH = 50;
5
- /**
6
- * Checks a username against the rules:
7
- * - 1 to 50 characters;
8
- * - only A–Z, a–z and 0–9, with `-`, `_` or `.` allowed only between letters or digits, never two in a row;
9
- * - shown as written, unique without regard to case (see `usernameKey`).
10
- *
11
- * @example
12
- * checkUsername("Luis-Pires"); // { valid: true, username: "Luis-Pires", key: "luis-pires" }
13
- * checkUsername("a--b"); // { valid: false, reason: "characters" }
14
- */
15
- export function checkUsername(username) {
16
- if (username.length < 1 || username.length > USERNAME_MAXIMUM_LENGTH)
17
- return { valid: false, reason: "length" };
18
- if (!PATTERN.test(username))
19
- return { valid: false, reason: "characters" };
20
- return { valid: true, username, key: usernameKey(username) };
21
- }
22
- /**
23
- * The form a username is unique in: lowercase, so `abc` and `aBc` are the same username (the database's unique index
24
- * is on this key).
25
- *
26
- * @example
27
- * usernameKey("aBc"); // "abc"
28
- */
29
- export function usernameKey(username) {
30
- return username.toLowerCase();
31
- }
32
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/username/index.ts"],"names":[],"mappings":"AAEA,yEAAyE;AACzE,MAAM,OAAO,GAAG,sCAAsC,CAAC;AAEvD,4BAA4B;AAC5B,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAE1C;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,QAAgB;IAC5C,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,IAAI,QAAQ,CAAC,MAAM,GAAG,uBAAuB;QAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC;IAChH,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,CAAC;IAC3E,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC;AAC/D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,OAAO,QAAQ,CAAC,WAAW,EAAE,CAAC;AAChC,CAAC"}
@@ -1,10 +0,0 @@
1
- /** A username that follows the rules (with its `key` for uniqueness), or why not. */
2
- export type UsernameCheck = {
3
- valid: true;
4
- username: string;
5
- key: string;
6
- } | {
7
- valid: false;
8
- reason: "length" | "characters";
9
- };
10
- //# sourceMappingURL=type.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/username/type.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,MAAM,MAAM,aAAa,GACvB;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,QAAQ,GAAG,YAAY,CAAA;CAAE,CAAC"}