@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,96 @@
1
+ import { notifyAccount } from "@sharadox/account-web-library/account-notice";
2
+ import { sendCode } from "@sharadox/account-web-library/code-sending";
3
+ import { verifyCode } from "@sharadox/account-web-library/code-verification";
4
+ import { contactBanned } from "@sharadox/account-web-library/banned-contact";
5
+ import { addContact } from "@sharadox/account-web-library/contact-addition";
6
+ import { normalizeContact } from "@sharadox/account-web-library/contact-kind";
7
+ import { verifyContact } from "@sharadox/account-web-library/contact-verification";
8
+ import { deriveSecret } from "@sharadox/account-web-library/secret-derivation";
9
+ /**
10
+ * Adds a contact to an account, unverified, and sends it a code (through `sendCode`); asking again for the same
11
+ * unverified contact sends a new code. Ask for a step-up first, and tell the account's other contacts.
12
+ *
13
+ * @example
14
+ * const result = await startContactAddition(server, { accountId, contact, address, language });
15
+ * if (result.status === "sent") after(result.deliver);
16
+ */
17
+ export async function startContactAddition(server, { accountId, contact, address, language, now = Date.now(), }) {
18
+ let normalized;
19
+ try {
20
+ normalized = normalizeContact(contact);
21
+ }
22
+ catch {
23
+ return { status: "refused", reason: "contact" };
24
+ }
25
+ const channel = server.channels.find(({ kind }) => kind === normalized.kind);
26
+ if (!channel)
27
+ return { status: "refused", reason: "contact" };
28
+ const pepper = deriveSecret(server.secret, "banned-contact");
29
+ if (await contactBanned(server.database, { contact: normalized, pepper, application: "account", now }))
30
+ return { status: "refused", reason: "contact-banned" };
31
+ const existing = await server.database
32
+ .selectFrom("contact")
33
+ .select(["id", "verified_at"])
34
+ .where("account_id", "=", accountId)
35
+ .where("kind", "=", normalized.kind)
36
+ .where("value", "=", normalized.value)
37
+ .executeTakeFirst();
38
+ if (existing?.verified_at)
39
+ return { status: "refused", reason: "already-added" };
40
+ let contactId = existing?.id;
41
+ if (!contactId) {
42
+ const added = await addContact(server.database, { accountId, contact: normalized, now });
43
+ if (!added.added)
44
+ return { status: "refused", reason: added.reason };
45
+ contactId = added.contactId;
46
+ }
47
+ const sent = await sendCode(server, {
48
+ purpose: "contact-verification",
49
+ contact: normalized,
50
+ channel,
51
+ accountId,
52
+ address,
53
+ language,
54
+ now,
55
+ });
56
+ return sent.status === "sent" ? { ...sent, contactId } : sent;
57
+ }
58
+ /**
59
+ * Verifies the added contact once its code comes back: it can then be used to sign in. Call `notify` after
60
+ * answering, to tell the account's other contacts.
61
+ *
62
+ * @example
63
+ * const result = await finishContactAddition(server, { accountId, requestId, code });
64
+ */
65
+ export async function finishContactAddition(server, { accountId, requestId, code, now = Date.now(), }) {
66
+ const verification = await verifyCode(server.database, {
67
+ requestId,
68
+ code,
69
+ purpose: "contact-verification",
70
+ pepper: deriveSecret(server.secret, "one-time-code"),
71
+ now,
72
+ });
73
+ if (!verification.valid)
74
+ return { status: "refused", reason: verification.reason };
75
+ if (verification.accountId !== accountId)
76
+ return { status: "refused", reason: "unknown" };
77
+ const contact = await server.database
78
+ .selectFrom("contact")
79
+ .select("id")
80
+ .where("account_id", "=", accountId)
81
+ .where("kind", "=", verification.contact.kind)
82
+ .where("value", "=", verification.contact.value)
83
+ .executeTakeFirst();
84
+ if (!contact)
85
+ return { status: "refused", reason: "no-contact" };
86
+ const verified = await verifyContact(server.database, { accountId, contactId: contact.id, now });
87
+ if (!verified.verified)
88
+ return { status: "refused", reason: verified.reason };
89
+ const notify = () => notifyAccount(server, {
90
+ accountId,
91
+ notice: { kind: "contact-added", contact: verification.contact.value },
92
+ except: contact.id,
93
+ });
94
+ return { status: "verified", contactId: contact.id, notify };
95
+ }
96
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/contact-addition-flow/index.ts"],"names":[],"mappings":"AAAA,OAAO,E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AQ,CAAC,QAAQ;QAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;IAC9E,MAAM,MAAM,GAAG,GAAG,EAAE,CAClB,aAAa,CAAC,MAAM,EAAE;QACpB,SAAS;QACT,MAAM,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE;QACtE,MAAM,EAAE,OAAO,CAAC,EAAE;KACnB,CAAC,CAAC;IACL,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,EAAE,MAAM,EAAE,CAAC;AAC/D,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { CodeSendingResult } from "@sharadox/account-web-library/code-sending/type";
2
+ import type { CodeVerificationResult } from "@sharadox/account-web-library/code-verification/type";
3
+ export type ContactAdditionStart = (Extract<CodeSendingResult, {
4
+ status: "sent";
5
+ }> & {
6
+ contactId: string;
7
+ }) | Exclude<CodeSendingResult, {
8
+ status: "sent";
9
+ }> | {
10
+ status: "refused";
11
+ reason: "contact" | "already-added" | "contact-taken" | "contact-banned" | "no-account";
12
+ };
13
+ export type ContactAdditionFinish =
14
+ /** `notify` tells the account's other contacts (call it after answering). */
15
+ {
16
+ status: "verified";
17
+ contactId: string;
18
+ notify: () => Promise<void>;
19
+ } | {
20
+ status: "refused";
21
+ reason: Extract<CodeVerificationResult, {
22
+ valid: false;
23
+ }>["reason"] | "no-contact" | "contact-taken";
24
+ };
25
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/contact-addition-flow/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sDAAsD,CAAC;AAEnG,MAAM,MAAM,oBAAoB,GAC5B,CAAC,OAAO,CAAC,iBAAiB,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,GACxE,OAAO,CAAC,iBAAiB,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,GAC9C;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,SAAS,GAAG,eAAe,GAAG,eAAe,GAAG,gBAAgB,GAAG,YAAY,CAAA;CAAE,CAAC;AAEnH,MAAM,MAAM,qBAAqB;AAC/B,6EAA6E;AAC3E;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;CAAE,GACtE;IACE,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC,sBAAsB,EAAE;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,YAAY,GAAG,eAAe,CAAC;CACtG,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/contact-addition-flow/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,49 @@
1
+ import type { CodePurpose } from "@sharadox/account-web-library/code-request/type";
2
+ import type { Contact } from "@sharadox/account-web-library/contact-kind/type";
3
+ /** A one-time code to deliver to a contact. */
4
+ export interface CodeDelivery {
5
+ contact: Contact;
6
+ code: string;
7
+ purpose: CodePurpose;
8
+ /** The reader's language (`en`, `pt-PT`…); channels fall back to English. */
9
+ language: string;
10
+ expiresAt: Date;
11
+ }
12
+ /** Something the account's owner must know, sent to each of its contacts. */
13
+ export type Notice =
14
+ /** The account will be deleted for not being used (2 years without signing in). */
15
+ {
16
+ kind: "inactivity-warning";
17
+ deletionAt: Date;
18
+ }
19
+ /** Another email was added to the account. */
20
+ | {
21
+ kind: "contact-added";
22
+ contact: string;
23
+ }
24
+ /** A recovery code was used to sign in. */
25
+ | {
26
+ kind: "recovery-code-used";
27
+ }
28
+ /** Someone signed in on a browser that had never signed in before. */
29
+ | {
30
+ kind: "new-sign-in";
31
+ at: Date;
32
+ };
33
+ export interface NoticeDelivery {
34
+ contact: Contact;
35
+ /** The reader's language; channels fall back to English. */
36
+ language: string;
37
+ notice: Notice;
38
+ }
39
+ /**
40
+ * How codes reach one kind of contact (email now; phone, WhatsApp, Messenger, Instagram later). Cap the sends of paid
41
+ * channels before calling `send` (protection-web-library's `spendFromCap`).
42
+ */
43
+ export interface ContactChannel {
44
+ kind: string;
45
+ send(delivery: CodeDelivery): Promise<void>;
46
+ /** Sends a notice; a channel without it can't carry notices. */
47
+ notify?(delivery: NoticeDelivery): Promise<void>;
48
+ }
49
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/contact-channel/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAC;AACnF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iDAAiD,CAAC;AAE/E,+CAA+C;AAC/C,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,CAAC;IACrB,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,IAAI,CAAC;CACjB;AAED,6EAA6E;AAC7E,MAAM,MAAM,MAAM;AAChB,mFAAmF;AACjF;IAAE,IAAI,EAAE,oBAAoB,CAAC;IAAC,UAAU,EAAE,IAAI,CAAA;CAAE;AAClD,8CAA8C;GAC5C;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE;AAC5C,2CAA2C;GACzC;IAAE,IAAI,EAAE,oBAAoB,CAAA;CAAE;AAChC,sEAAsE;GACpE;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,EAAE,EAAE,IAAI,CAAA;CAAE,CAAC;AAEtC,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,gEAAgE;IAChE,MAAM,CAAC,CAAC,QAAQ,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAClD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/contact-channel/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ import type { Contact } from "@sharadox/account-web-library/contact-kind/type";
2
+ /** The kinds of contact this version can store and send codes to. */
3
+ export declare const CONTACT_KINDS: string[];
4
+ /**
5
+ * A contact in the one form it is stored and compared in (an email trimmed and lowercase…). Throws for a kind this
6
+ * version doesn't know, or a value that isn't valid for its kind.
7
+ *
8
+ * @example
9
+ * normalizeContact({ kind: "email", value: " Luis@Example.com " }); // { kind: "email", value: "luis@example.com" }
10
+ */
11
+ export declare function normalizeContact({ kind, value }: Contact): Contact;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/contact-kind/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iDAAiD,CAAC;AAI/E,qEAAqE;AACrE,eAAO,MAAM,aAAa,UAA2B,CAAC;AAEtD;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,OAAO,GAAG,OAAO,CAIlE"}
@@ -0,0 +1,18 @@
1
+ import { normalizeEmail } from "@sharadox/account-web-library/email-contact";
2
+ const NORMALIZERS = { email: normalizeEmail };
3
+ /** The kinds of contact this version can store and send codes to. */
4
+ export const CONTACT_KINDS = Object.keys(NORMALIZERS);
5
+ /**
6
+ * A contact in the one form it is stored and compared in (an email trimmed and lowercase…). Throws for a kind this
7
+ * version doesn't know, or a value that isn't valid for its kind.
8
+ *
9
+ * @example
10
+ * normalizeContact({ kind: "email", value: " Luis@Example.com " }); // { kind: "email", value: "luis@example.com" }
11
+ */
12
+ export function normalizeContact({ kind, value }) {
13
+ const normalize = NORMALIZERS[kind];
14
+ if (!normalize)
15
+ throw new Error(`unknown contact kind "${kind}"`);
16
+ return { kind, value: normalize(value) };
17
+ }
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/contact-kind/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAG7E,MAAM,WAAW,GAA8C,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;AAEzF,qEAAqE;AACrE,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAW;IACvD,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,IAAI,GAAG,CAAC,CAAC;IAClE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,6 @@
1
+ /** A contact as given or stored: its kind (`email`…) and value. */
2
+ export interface Contact {
3
+ kind: string;
4
+ value: string;
5
+ }
6
+ //# sourceMappingURL=type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/contact-kind/type.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/contact-kind/type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ import type { Kysely } from "kysely";
2
+ import type { AccountDatabase } from "@sharadox/account-web-library/account-database/type";
3
+ import type { Contact } from "@sharadox/account-web-library/contact-kind/type";
4
+ /**
5
+ * The account a verified contact belongs to (written any way: it is normalized first), or undefined. Unverified
6
+ * contacts never count, so claiming someone's address proves nothing.
7
+ *
8
+ * @example
9
+ * const found = await findAccountByContact(database, { kind: "email", value: typed });
10
+ */
11
+ export declare function findAccountByContact(database: Kysely<AccountDatabase>, contact: Contact): Promise<{
12
+ accountId: string;
13
+ contactId: string;
14
+ signIn: boolean;
15
+ } | undefined>;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/contact-lookup/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAE3F,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iDAAiD,CAAC;AAE/E;;;;;;GAMG;AACH,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,CAAC,eAAe,CAAC,EACjC,OAAO,EAAE,OAAO,GACf,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAAC,CAUhF"}
@@ -0,0 +1,20 @@
1
+ import { normalizeContact } from "@sharadox/account-web-library/contact-kind";
2
+ /**
3
+ * The account a verified contact belongs to (written any way: it is normalized first), or undefined. Unverified
4
+ * contacts never count, so claiming someone's address proves nothing.
5
+ *
6
+ * @example
7
+ * const found = await findAccountByContact(database, { kind: "email", value: typed });
8
+ */
9
+ export async function findAccountByContact(database, contact) {
10
+ const { kind, value } = normalizeContact(contact);
11
+ const row = await database
12
+ .selectFrom("contact")
13
+ .select(["id", "account_id", "sign_in"])
14
+ .where("kind", "=", kind)
15
+ .where("value", "=", value)
16
+ .where("verified_at", "is not", null)
17
+ .executeTakeFirst();
18
+ return row && { accountId: row.account_id, contactId: row.id, signIn: row.sign_in };
19
+ }
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/contact-lookup/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAG9E;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,QAAiC,EACjC,OAAgB;IAEhB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAClD,MAAM,GAAG,GAAG,MAAM,QAAQ;SACvB,UAAU,CAAC,SAAS,CAAC;SACrB,MAAM,CAAC,CAAC,IAAI,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;SACvC,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC;SACxB,KAAK,CAAC,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC;SAC1B,KAAK,CAAC,aAAa,EAAE,QAAQ,EAAE,IAAI,CAAC;SACpC,gBAAgB,EAAE,CAAC;IACtB,OAAO,GAAG,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,UAAU,EAAE,SAAS,EAAE,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;AACtF,CAAC"}
@@ -0,0 +1,19 @@
1
+ import type { Kysely } from "kysely";
2
+ import type { AccountDatabase } from "@sharadox/account-web-library/account-database/type";
3
+ /**
4
+ * Removes a contact from an account. Refuses to remove the last verified sign-in contact of a person (the database
5
+ * checks it when the change commits). Ask for a fresh code first (step-up) and tell the other contacts.
6
+ *
7
+ * @example
8
+ * const result = await removeContact(database, { accountId, contactId });
9
+ */
10
+ export declare function removeContact(database: Kysely<AccountDatabase>, { accountId, contactId }: {
11
+ accountId: string;
12
+ contactId: string;
13
+ }): Promise<{
14
+ removed: true;
15
+ } | {
16
+ removed: false;
17
+ reason: "no-contact" | "last-sign-in-contact";
18
+ }>;
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/contact-removal/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAI3F;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,CAAC,eAAe,CAAC,EACjC,EAAE,SAAS,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACjE,OAAO,CAAC;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,YAAY,GAAG,sBAAsB,CAAA;CAAE,CAAC,CAqBhG"}
@@ -0,0 +1,35 @@
1
+ import { recordAuditEvent } from "@sharadox/account-web-library/audit-event";
2
+ import { databaseError } from "@sharadox/account-web-library/database-error";
3
+ /**
4
+ * Removes a contact from an account. Refuses to remove the last verified sign-in contact of a person (the database
5
+ * checks it when the change commits). Ask for a fresh code first (step-up) and tell the other contacts.
6
+ *
7
+ * @example
8
+ * const result = await removeContact(database, { accountId, contactId });
9
+ */
10
+ export async function removeContact(database, { accountId, contactId }) {
11
+ try {
12
+ return await database.transaction().execute(async (transaction) => {
13
+ const removed = await transaction
14
+ .deleteFrom("contact")
15
+ .where("id", "=", contactId)
16
+ .where("account_id", "=", accountId)
17
+ .returning("kind")
18
+ .executeTakeFirst();
19
+ if (!removed)
20
+ return { removed: false, reason: "no-contact" };
21
+ await recordAuditEvent(transaction, {
22
+ accountId,
23
+ action: "contact.removed",
24
+ detail: { contactId, kind: removed.kind },
25
+ });
26
+ return { removed: true };
27
+ });
28
+ }
29
+ catch (error) {
30
+ if (databaseError(error)?.code === "23514")
31
+ return { removed: false, reason: "last-sign-in-contact" };
32
+ throw error;
33
+ }
34
+ }
35
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/contact-removal/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAE7E;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,QAAiC,EACjC,EAAE,SAAS,EAAE,SAAS,EAA4C;IAElE,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE;YAChE,MAAM,OAAO,GAAG,MAAM,WAAW;iBAC9B,UAAU,CAAC,SAAS,CAAC;iBACrB,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,SAAS,CAAC;iBAC3B,KAAK,CAAC,YAAY,EAAE,GAAG,EAAE,SAAS,CAAC;iBACnC,SAAS,CAAC,MAAM,CAAC;iBACjB,gBAAgB,EAAE,CAAC;YACtB,IAAI,CAAC,OAAO;gBAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAW,CAAC;YACvE,MAAM,gBAAgB,CAAC,WAAW,EAAE;gBAClC,SAAS;gBACT,MAAM,EAAE,iBAAiB;gBACzB,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE;aAC1C,CAAC,CAAC;YACH,OAAO,EAAE,OAAO,EAAE,IAAI,EAAW,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,IAAI,KAAK,OAAO;YAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,sBAAsB,EAAE,CAAC;QACtG,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,20 @@
1
+ import type { Kysely } from "kysely";
2
+ import type { AccountDatabase } from "@sharadox/account-web-library/account-database/type";
3
+ /**
4
+ * Marks an account's contact verified, once the one-time code sent to it came back. Refuses when another account
5
+ * verified the same contact first (a verified contact belongs to one account only).
6
+ *
7
+ * @example
8
+ * await verifyContact(database, { accountId, contactId }); // { verified: true }
9
+ */
10
+ export declare function verifyContact(database: Kysely<AccountDatabase>, { accountId, contactId, now }: {
11
+ accountId: string;
12
+ contactId: string;
13
+ now?: number;
14
+ }): Promise<{
15
+ verified: true;
16
+ } | {
17
+ verified: false;
18
+ reason: "no-contact" | "contact-taken";
19
+ }>;
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/contact-verification/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAI3F;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,CAAC,eAAe,CAAC,EACjC,EAAE,SAAS,EAAE,SAAS,EAAE,GAAgB,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACjG,OAAO,CAAC;IAAE,QAAQ,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,YAAY,GAAG,eAAe,CAAA;CAAE,CAAC,CAuB3F"}
@@ -0,0 +1,37 @@
1
+ import { recordAuditEvent } from "@sharadox/account-web-library/audit-event";
2
+ import { databaseError } from "@sharadox/account-web-library/database-error";
3
+ /**
4
+ * Marks an account's contact verified, once the one-time code sent to it came back. Refuses when another account
5
+ * verified the same contact first (a verified contact belongs to one account only).
6
+ *
7
+ * @example
8
+ * await verifyContact(database, { accountId, contactId }); // { verified: true }
9
+ */
10
+ export async function verifyContact(database, { accountId, contactId, now = Date.now() }) {
11
+ try {
12
+ return await database.transaction().execute(async (transaction) => {
13
+ const updated = await transaction
14
+ .updateTable("contact")
15
+ .set({ verified_at: new Date(now) })
16
+ .where("id", "=", contactId)
17
+ .where("account_id", "=", accountId)
18
+ .returning("kind")
19
+ .executeTakeFirst();
20
+ if (!updated)
21
+ return { verified: false, reason: "no-contact" };
22
+ await recordAuditEvent(transaction, {
23
+ accountId,
24
+ action: "contact.verified",
25
+ detail: { contactId, kind: updated.kind },
26
+ now,
27
+ });
28
+ return { verified: true };
29
+ });
30
+ }
31
+ catch (error) {
32
+ if (databaseError(error)?.constraint === "contact_verified")
33
+ return { verified: false, reason: "contact-taken" };
34
+ throw error;
35
+ }
36
+ }
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/contact-verification/index.ts"],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M,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Postgres's error code (`23505` unique, `23514` check…) and the constraint that failed, from an error thrown by the
3
+ * driver (Neon's or PGlite's); undefined for any other error.
4
+ *
5
+ * @example
6
+ * if (databaseError(error)?.constraint === "account_identifier_key") return { reason: "identifier-taken" };
7
+ */
8
+ export declare function databaseError(error: unknown): {
9
+ code: string;
10
+ constraint: string | undefined;
11
+ } | undefined;
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/database-error/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAAG,SAAS,CAK1G"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Postgres's error code (`23505` unique, `23514` check…) and the constraint that failed, from an error thrown by the
3
+ * driver (Neon's or PGlite's); undefined for any other error.
4
+ *
5
+ * @example
6
+ * if (databaseError(error)?.constraint === "account_identifier_key") return { reason: "identifier-taken" };
7
+ */
8
+ export function databaseError(error) {
9
+ if (typeof error !== "object" || error === null || typeof error.code !== "string")
10
+ return undefined;
11
+ const { code, constraint } = error;
12
+ return { code, constraint };
13
+ }
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/database-error/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,OAAQ,KAA4B,CAAC,IAAI,KAAK,QAAQ;QACvG,OAAO,SAAS,CAAC;IACnB,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,KAA8C,CAAC;IAC5E,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC;AAC9B,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { ContactChannel } from "@sharadox/account-web-library/contact-channel/type";
2
+ import type { EmailChannelOptions } from "@sharadox/account-web-library/email-channel/type";
3
+ /**
4
+ * Sends one-time codes by email, in the shared Sharadox email layout (email-web-library), in English or European
5
+ * Portuguese (any `pt` reader). The code is in the body only, never the subject (lock screens show subjects), with
6
+ * no link to click: nothing to imitate in a phishing email.
7
+ *
8
+ * @example
9
+ * const channel = createEmailChannel({ sender: createAmazonSesSender(configuration), from, design });
10
+ * await channel.send({ contact, code, purpose: "sign-in", language: "pt-PT", expiresAt });
11
+ */
12
+ export declare function createEmailChannel({ sender, from, design, logos, now, }: EmailChannelOptions): ContactChannel;
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/email-channel/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,cAAc,EAGf,MAAM,oDAAoD,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AAmI5F;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,MAAM,EACN,IAAI,EACJ,MAAM,EACN,KAAU,EACV,GAAc,GACf,EAAE,mBAAmB,GAAG,cAAc,CAuEtC"}