@carlonicora/nestjs-neo4jsonapi 1.39.0 → 1.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (296) hide show
  1. package/dist/config/base.config.d.ts.map +1 -1
  2. package/dist/config/base.config.js +9 -0
  3. package/dist/config/base.config.js.map +1 -1
  4. package/dist/config/interfaces/base.config.interface.d.ts +2 -0
  5. package/dist/config/interfaces/base.config.interface.d.ts.map +1 -1
  6. package/dist/config/interfaces/config.two.factor.interface.d.ts +27 -0
  7. package/dist/config/interfaces/config.two.factor.interface.d.ts.map +1 -0
  8. package/dist/config/interfaces/config.two.factor.interface.js +3 -0
  9. package/dist/config/interfaces/config.two.factor.interface.js.map +1 -0
  10. package/dist/config/interfaces/index.d.ts +1 -0
  11. package/dist/config/interfaces/index.d.ts.map +1 -1
  12. package/dist/config/interfaces/index.js +1 -0
  13. package/dist/config/interfaces/index.js.map +1 -1
  14. package/dist/core/jsonapi/services/jsonapi.service.d.ts.map +1 -1
  15. package/dist/core/jsonapi/services/jsonapi.service.js +3 -1
  16. package/dist/core/jsonapi/services/jsonapi.service.js.map +1 -1
  17. package/dist/core/llm/services/vision.llm.service.d.ts.map +1 -1
  18. package/dist/core/llm/services/vision.llm.service.js +0 -1
  19. package/dist/core/llm/services/vision.llm.service.js.map +1 -1
  20. package/dist/core/security/services/security.service.d.ts +27 -0
  21. package/dist/core/security/services/security.service.d.ts.map +1 -1
  22. package/dist/core/security/services/security.service.js +37 -0
  23. package/dist/core/security/services/security.service.js.map +1 -1
  24. package/dist/foundations/auth/auth.module.d.ts.map +1 -1
  25. package/dist/foundations/auth/auth.module.js +6 -0
  26. package/dist/foundations/auth/auth.module.js.map +1 -1
  27. package/dist/foundations/auth/entities/pending-auth.entity.d.ts +16 -0
  28. package/dist/foundations/auth/entities/pending-auth.entity.d.ts.map +1 -0
  29. package/dist/foundations/auth/entities/pending-auth.entity.js +3 -0
  30. package/dist/foundations/auth/entities/pending-auth.entity.js.map +1 -0
  31. package/dist/foundations/auth/entities/pending-auth.map.d.ts +6 -0
  32. package/dist/foundations/auth/entities/pending-auth.map.d.ts.map +1 -0
  33. package/dist/foundations/auth/entities/pending-auth.map.js +20 -0
  34. package/dist/foundations/auth/entities/pending-auth.map.js.map +1 -0
  35. package/dist/foundations/auth/entities/pending-auth.meta.d.ts +3 -0
  36. package/dist/foundations/auth/entities/pending-auth.meta.d.ts.map +1 -0
  37. package/dist/foundations/auth/entities/pending-auth.meta.js +10 -0
  38. package/dist/foundations/auth/entities/pending-auth.meta.js.map +1 -0
  39. package/dist/foundations/auth/entities/pending-auth.model.d.ts +9 -0
  40. package/dist/foundations/auth/entities/pending-auth.model.d.ts.map +1 -0
  41. package/dist/foundations/auth/entities/pending-auth.model.js +19 -0
  42. package/dist/foundations/auth/entities/pending-auth.model.js.map +1 -0
  43. package/dist/foundations/auth/serialisers/pending-auth.serialiser.d.ts +18 -0
  44. package/dist/foundations/auth/serialisers/pending-auth.serialiser.d.ts.map +1 -0
  45. package/dist/foundations/auth/serialisers/pending-auth.serialiser.js +49 -0
  46. package/dist/foundations/auth/serialisers/pending-auth.serialiser.js.map +1 -0
  47. package/dist/foundations/auth/services/auth.service.d.ts +12 -1
  48. package/dist/foundations/auth/services/auth.service.d.ts.map +1 -1
  49. package/dist/foundations/auth/services/auth.service.js +60 -6
  50. package/dist/foundations/auth/services/auth.service.js.map +1 -1
  51. package/dist/foundations/foundations.modules.d.ts.map +1 -1
  52. package/dist/foundations/foundations.modules.js +2 -0
  53. package/dist/foundations/foundations.modules.js.map +1 -1
  54. package/dist/foundations/index.d.ts +1 -0
  55. package/dist/foundations/index.d.ts.map +1 -1
  56. package/dist/foundations/index.js +1 -0
  57. package/dist/foundations/index.js.map +1 -1
  58. package/dist/foundations/stripe/services/billing.service.d.ts +3 -4
  59. package/dist/foundations/stripe/services/billing.service.d.ts.map +1 -1
  60. package/dist/foundations/stripe/services/billing.service.js +1 -1
  61. package/dist/foundations/stripe/services/billing.service.js.map +1 -1
  62. package/dist/foundations/stripe-invoice/services/stripe-invoice-admin.service.d.ts +1 -1
  63. package/dist/foundations/stripe-invoice/services/stripe-invoice-admin.service.js +1 -1
  64. package/dist/foundations/stripe-invoice/services/stripe-invoice-api.service.d.ts +1 -1
  65. package/dist/foundations/stripe-invoice/services/stripe-invoice-api.service.d.ts.map +1 -1
  66. package/dist/foundations/stripe-invoice/services/stripe-invoice-api.service.js +2 -2
  67. package/dist/foundations/stripe-invoice/services/stripe-invoice-api.service.js.map +1 -1
  68. package/dist/foundations/stripe-subscription/controllers/stripe-subscription.controller.d.ts.map +1 -1
  69. package/dist/foundations/stripe-subscription/controllers/stripe-subscription.controller.js +0 -3
  70. package/dist/foundations/stripe-subscription/controllers/stripe-subscription.controller.js.map +1 -1
  71. package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.d.ts +1 -1
  72. package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.d.ts.map +1 -1
  73. package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.js +1 -3
  74. package/dist/foundations/stripe-subscription/services/stripe-subscription-admin.service.js.map +1 -1
  75. package/dist/foundations/stripe-subscription/services/stripe-subscription-api.service.d.ts +1 -1
  76. package/dist/foundations/stripe-subscription/services/stripe-subscription-api.service.d.ts.map +1 -1
  77. package/dist/foundations/stripe-subscription/services/stripe-subscription-api.service.js +1 -5
  78. package/dist/foundations/stripe-subscription/services/stripe-subscription-api.service.js.map +1 -1
  79. package/dist/foundations/two-factor/controllers/passkey.controller.d.ts +52 -0
  80. package/dist/foundations/two-factor/controllers/passkey.controller.d.ts.map +1 -0
  81. package/dist/foundations/two-factor/controllers/passkey.controller.js +155 -0
  82. package/dist/foundations/two-factor/controllers/passkey.controller.js.map +1 -0
  83. package/dist/foundations/two-factor/controllers/totp.controller.d.ts +47 -0
  84. package/dist/foundations/two-factor/controllers/totp.controller.d.ts.map +1 -0
  85. package/dist/foundations/two-factor/controllers/totp.controller.js +132 -0
  86. package/dist/foundations/two-factor/controllers/totp.controller.js.map +1 -0
  87. package/dist/foundations/two-factor/controllers/two-factor.controller.d.ts +124 -0
  88. package/dist/foundations/two-factor/controllers/two-factor.controller.d.ts.map +1 -0
  89. package/dist/foundations/two-factor/controllers/two-factor.controller.js +352 -0
  90. package/dist/foundations/two-factor/controllers/two-factor.controller.js.map +1 -0
  91. package/dist/foundations/two-factor/dtos/passkey-options.dto.d.ts +42 -0
  92. package/dist/foundations/two-factor/dtos/passkey-options.dto.d.ts.map +1 -0
  93. package/dist/foundations/two-factor/dtos/passkey-options.dto.js +77 -0
  94. package/dist/foundations/two-factor/dtos/passkey-options.dto.js.map +1 -0
  95. package/dist/foundations/two-factor/dtos/passkey-verify.dto.d.ts +120 -0
  96. package/dist/foundations/two-factor/dtos/passkey-verify.dto.d.ts.map +1 -0
  97. package/dist/foundations/two-factor/dtos/passkey-verify.dto.js +226 -0
  98. package/dist/foundations/two-factor/dtos/passkey-verify.dto.js.map +1 -0
  99. package/dist/foundations/two-factor/dtos/totp-setup.dto.d.ts +32 -0
  100. package/dist/foundations/two-factor/dtos/totp-setup.dto.d.ts.map +1 -0
  101. package/dist/foundations/two-factor/dtos/totp-setup.dto.js +67 -0
  102. package/dist/foundations/two-factor/dtos/totp-setup.dto.js.map +1 -0
  103. package/dist/foundations/two-factor/dtos/totp-verify.dto.d.ts +62 -0
  104. package/dist/foundations/two-factor/dtos/totp-verify.dto.d.ts.map +1 -0
  105. package/dist/foundations/two-factor/dtos/totp-verify.dto.js +118 -0
  106. package/dist/foundations/two-factor/dtos/totp-verify.dto.js.map +1 -0
  107. package/dist/foundations/two-factor/dtos/two-factor-verify.dto.d.ts +83 -0
  108. package/dist/foundations/two-factor/dtos/two-factor-verify.dto.d.ts.map +1 -0
  109. package/dist/foundations/two-factor/dtos/two-factor-verify.dto.js +161 -0
  110. package/dist/foundations/two-factor/dtos/two-factor-verify.dto.js.map +1 -0
  111. package/dist/foundations/two-factor/entities/backup-code.d.ts +22 -0
  112. package/dist/foundations/two-factor/entities/backup-code.d.ts.map +1 -0
  113. package/dist/foundations/two-factor/entities/backup-code.js +25 -0
  114. package/dist/foundations/two-factor/entities/backup-code.js.map +1 -0
  115. package/dist/foundations/two-factor/entities/backup-code.meta.d.ts +3 -0
  116. package/dist/foundations/two-factor/entities/backup-code.meta.d.ts.map +1 -0
  117. package/dist/foundations/two-factor/entities/backup-code.meta.js +10 -0
  118. package/dist/foundations/two-factor/entities/backup-code.meta.js.map +1 -0
  119. package/dist/foundations/two-factor/entities/backup-codes-count.d.ts +18 -0
  120. package/dist/foundations/two-factor/entities/backup-codes-count.d.ts.map +1 -0
  121. package/dist/foundations/two-factor/entities/backup-codes-count.js +19 -0
  122. package/dist/foundations/two-factor/entities/backup-codes-count.js.map +1 -0
  123. package/dist/foundations/two-factor/entities/backup-codes-count.meta.d.ts +3 -0
  124. package/dist/foundations/two-factor/entities/backup-codes-count.meta.d.ts.map +1 -0
  125. package/dist/foundations/two-factor/entities/backup-codes-count.meta.js +10 -0
  126. package/dist/foundations/two-factor/entities/backup-codes-count.meta.js.map +1 -0
  127. package/dist/foundations/two-factor/entities/backup-codes-generation.d.ts +19 -0
  128. package/dist/foundations/two-factor/entities/backup-codes-generation.d.ts.map +1 -0
  129. package/dist/foundations/two-factor/entities/backup-codes-generation.js +20 -0
  130. package/dist/foundations/two-factor/entities/backup-codes-generation.js.map +1 -0
  131. package/dist/foundations/two-factor/entities/backup-codes-generation.meta.d.ts +3 -0
  132. package/dist/foundations/two-factor/entities/backup-codes-generation.meta.d.ts.map +1 -0
  133. package/dist/foundations/two-factor/entities/backup-codes-generation.meta.js +10 -0
  134. package/dist/foundations/two-factor/entities/backup-codes-generation.meta.js.map +1 -0
  135. package/dist/foundations/two-factor/entities/passkey-authentication-options.d.ts +19 -0
  136. package/dist/foundations/two-factor/entities/passkey-authentication-options.d.ts.map +1 -0
  137. package/dist/foundations/two-factor/entities/passkey-authentication-options.js +20 -0
  138. package/dist/foundations/two-factor/entities/passkey-authentication-options.js.map +1 -0
  139. package/dist/foundations/two-factor/entities/passkey-authentication-options.meta.d.ts +3 -0
  140. package/dist/foundations/two-factor/entities/passkey-authentication-options.meta.d.ts.map +1 -0
  141. package/dist/foundations/two-factor/entities/passkey-authentication-options.meta.js +10 -0
  142. package/dist/foundations/two-factor/entities/passkey-authentication-options.meta.js.map +1 -0
  143. package/dist/foundations/two-factor/entities/passkey-registration-options.d.ts +19 -0
  144. package/dist/foundations/two-factor/entities/passkey-registration-options.d.ts.map +1 -0
  145. package/dist/foundations/two-factor/entities/passkey-registration-options.js +20 -0
  146. package/dist/foundations/two-factor/entities/passkey-registration-options.js.map +1 -0
  147. package/dist/foundations/two-factor/entities/passkey-registration-options.meta.d.ts +3 -0
  148. package/dist/foundations/two-factor/entities/passkey-registration-options.meta.d.ts.map +1 -0
  149. package/dist/foundations/two-factor/entities/passkey-registration-options.meta.js +10 -0
  150. package/dist/foundations/two-factor/entities/passkey-registration-options.meta.js.map +1 -0
  151. package/dist/foundations/two-factor/entities/passkey.d.ts +27 -0
  152. package/dist/foundations/two-factor/entities/passkey.d.ts.map +1 -0
  153. package/dist/foundations/two-factor/entities/passkey.js +30 -0
  154. package/dist/foundations/two-factor/entities/passkey.js.map +1 -0
  155. package/dist/foundations/two-factor/entities/passkey.meta.d.ts +3 -0
  156. package/dist/foundations/two-factor/entities/passkey.meta.d.ts.map +1 -0
  157. package/dist/foundations/two-factor/entities/passkey.meta.js +10 -0
  158. package/dist/foundations/two-factor/entities/passkey.meta.js.map +1 -0
  159. package/dist/foundations/two-factor/entities/pending-two-factor.d.ts +24 -0
  160. package/dist/foundations/two-factor/entities/pending-two-factor.d.ts.map +1 -0
  161. package/dist/foundations/two-factor/entities/pending-two-factor.js +27 -0
  162. package/dist/foundations/two-factor/entities/pending-two-factor.js.map +1 -0
  163. package/dist/foundations/two-factor/entities/pending-two-factor.meta.d.ts +3 -0
  164. package/dist/foundations/two-factor/entities/pending-two-factor.meta.d.ts.map +1 -0
  165. package/dist/foundations/two-factor/entities/pending-two-factor.meta.js +10 -0
  166. package/dist/foundations/two-factor/entities/pending-two-factor.meta.js.map +1 -0
  167. package/dist/foundations/two-factor/entities/totp-authenticator.d.ts +24 -0
  168. package/dist/foundations/two-factor/entities/totp-authenticator.d.ts.map +1 -0
  169. package/dist/foundations/two-factor/entities/totp-authenticator.js +27 -0
  170. package/dist/foundations/two-factor/entities/totp-authenticator.js.map +1 -0
  171. package/dist/foundations/two-factor/entities/totp-authenticator.meta.d.ts +3 -0
  172. package/dist/foundations/two-factor/entities/totp-authenticator.meta.d.ts.map +1 -0
  173. package/dist/foundations/two-factor/entities/totp-authenticator.meta.js +10 -0
  174. package/dist/foundations/two-factor/entities/totp-authenticator.meta.js.map +1 -0
  175. package/dist/foundations/two-factor/entities/totp-setup.d.ts +20 -0
  176. package/dist/foundations/two-factor/entities/totp-setup.d.ts.map +1 -0
  177. package/dist/foundations/two-factor/entities/totp-setup.js +21 -0
  178. package/dist/foundations/two-factor/entities/totp-setup.js.map +1 -0
  179. package/dist/foundations/two-factor/entities/totp-setup.meta.d.ts +3 -0
  180. package/dist/foundations/two-factor/entities/totp-setup.meta.d.ts.map +1 -0
  181. package/dist/foundations/two-factor/entities/totp-setup.meta.js +10 -0
  182. package/dist/foundations/two-factor/entities/totp-setup.meta.js.map +1 -0
  183. package/dist/foundations/two-factor/entities/two-factor-challenge.d.ts +21 -0
  184. package/dist/foundations/two-factor/entities/two-factor-challenge.d.ts.map +1 -0
  185. package/dist/foundations/two-factor/entities/two-factor-challenge.js +22 -0
  186. package/dist/foundations/two-factor/entities/two-factor-challenge.js.map +1 -0
  187. package/dist/foundations/two-factor/entities/two-factor-challenge.meta.d.ts +3 -0
  188. package/dist/foundations/two-factor/entities/two-factor-challenge.meta.d.ts.map +1 -0
  189. package/dist/foundations/two-factor/entities/two-factor-challenge.meta.js +10 -0
  190. package/dist/foundations/two-factor/entities/two-factor-challenge.meta.js.map +1 -0
  191. package/dist/foundations/two-factor/entities/two-factor-config.d.ts +21 -0
  192. package/dist/foundations/two-factor/entities/two-factor-config.d.ts.map +1 -0
  193. package/dist/foundations/two-factor/entities/two-factor-config.js +23 -0
  194. package/dist/foundations/two-factor/entities/two-factor-config.js.map +1 -0
  195. package/dist/foundations/two-factor/entities/two-factor-config.meta.d.ts +3 -0
  196. package/dist/foundations/two-factor/entities/two-factor-config.meta.d.ts.map +1 -0
  197. package/dist/foundations/two-factor/entities/two-factor-config.meta.js +10 -0
  198. package/dist/foundations/two-factor/entities/two-factor-config.meta.js.map +1 -0
  199. package/dist/foundations/two-factor/entities/two-factor-status.d.ts +25 -0
  200. package/dist/foundations/two-factor/entities/two-factor-status.d.ts.map +1 -0
  201. package/dist/foundations/two-factor/entities/two-factor-status.js +22 -0
  202. package/dist/foundations/two-factor/entities/two-factor-status.js.map +1 -0
  203. package/dist/foundations/two-factor/entities/two-factor-status.meta.d.ts +3 -0
  204. package/dist/foundations/two-factor/entities/two-factor-status.meta.d.ts.map +1 -0
  205. package/dist/foundations/two-factor/entities/two-factor-status.meta.js +10 -0
  206. package/dist/foundations/two-factor/entities/two-factor-status.meta.js.map +1 -0
  207. package/dist/foundations/two-factor/entities/two-factor-verification.d.ts +19 -0
  208. package/dist/foundations/two-factor/entities/two-factor-verification.d.ts.map +1 -0
  209. package/dist/foundations/two-factor/entities/two-factor-verification.js +20 -0
  210. package/dist/foundations/two-factor/entities/two-factor-verification.js.map +1 -0
  211. package/dist/foundations/two-factor/entities/two-factor-verification.meta.d.ts +3 -0
  212. package/dist/foundations/two-factor/entities/two-factor-verification.meta.d.ts.map +1 -0
  213. package/dist/foundations/two-factor/entities/two-factor-verification.meta.js +10 -0
  214. package/dist/foundations/two-factor/entities/two-factor-verification.meta.js.map +1 -0
  215. package/dist/foundations/two-factor/guards/pending-auth.guard.d.ts +35 -0
  216. package/dist/foundations/two-factor/guards/pending-auth.guard.d.ts.map +1 -0
  217. package/dist/foundations/two-factor/guards/pending-auth.guard.js +70 -0
  218. package/dist/foundations/two-factor/guards/pending-auth.guard.js.map +1 -0
  219. package/dist/foundations/two-factor/index.d.ts +47 -0
  220. package/dist/foundations/two-factor/index.d.ts.map +1 -0
  221. package/dist/foundations/two-factor/index.js +134 -0
  222. package/dist/foundations/two-factor/index.js.map +1 -0
  223. package/dist/foundations/two-factor/repositories/backup-code.repository.d.ts +34 -0
  224. package/dist/foundations/two-factor/repositories/backup-code.repository.d.ts.map +1 -0
  225. package/dist/foundations/two-factor/repositories/backup-code.repository.js +107 -0
  226. package/dist/foundations/two-factor/repositories/backup-code.repository.js.map +1 -0
  227. package/dist/foundations/two-factor/repositories/passkey.repository.d.ts +51 -0
  228. package/dist/foundations/two-factor/repositories/passkey.repository.d.ts.map +1 -0
  229. package/dist/foundations/two-factor/repositories/passkey.repository.js +159 -0
  230. package/dist/foundations/two-factor/repositories/passkey.repository.js.map +1 -0
  231. package/dist/foundations/two-factor/repositories/pending-two-factor.repository.d.ts +47 -0
  232. package/dist/foundations/two-factor/repositories/pending-two-factor.repository.d.ts.map +1 -0
  233. package/dist/foundations/two-factor/repositories/pending-two-factor.repository.js +159 -0
  234. package/dist/foundations/two-factor/repositories/pending-two-factor.repository.js.map +1 -0
  235. package/dist/foundations/two-factor/repositories/totp-authenticator.repository.d.ts +51 -0
  236. package/dist/foundations/two-factor/repositories/totp-authenticator.repository.d.ts.map +1 -0
  237. package/dist/foundations/two-factor/repositories/totp-authenticator.repository.js +156 -0
  238. package/dist/foundations/two-factor/repositories/totp-authenticator.repository.js.map +1 -0
  239. package/dist/foundations/two-factor/repositories/two-factor-config.repository.d.ts +32 -0
  240. package/dist/foundations/two-factor/repositories/two-factor-config.repository.d.ts.map +1 -0
  241. package/dist/foundations/two-factor/repositories/two-factor-config.repository.js +105 -0
  242. package/dist/foundations/two-factor/repositories/two-factor-config.repository.js.map +1 -0
  243. package/dist/foundations/two-factor/services/backup-code.service.d.ts +95 -0
  244. package/dist/foundations/two-factor/services/backup-code.service.d.ts.map +1 -0
  245. package/dist/foundations/two-factor/services/backup-code.service.js +216 -0
  246. package/dist/foundations/two-factor/services/backup-code.service.js.map +1 -0
  247. package/dist/foundations/two-factor/services/index.d.ts +6 -0
  248. package/dist/foundations/two-factor/services/index.d.ts.map +1 -0
  249. package/dist/foundations/two-factor/services/index.js +14 -0
  250. package/dist/foundations/two-factor/services/index.js.map +1 -0
  251. package/dist/foundations/two-factor/services/passkey.service.d.ts +132 -0
  252. package/dist/foundations/two-factor/services/passkey.service.d.ts.map +1 -0
  253. package/dist/foundations/two-factor/services/passkey.service.js +400 -0
  254. package/dist/foundations/two-factor/services/passkey.service.js.map +1 -0
  255. package/dist/foundations/two-factor/services/totp-encryption.service.d.ts +42 -0
  256. package/dist/foundations/two-factor/services/totp-encryption.service.d.ts.map +1 -0
  257. package/dist/foundations/two-factor/services/totp-encryption.service.js +136 -0
  258. package/dist/foundations/two-factor/services/totp-encryption.service.js.map +1 -0
  259. package/dist/foundations/two-factor/services/totp.service.d.ts +132 -0
  260. package/dist/foundations/two-factor/services/totp.service.d.ts.map +1 -0
  261. package/dist/foundations/two-factor/services/totp.service.js +324 -0
  262. package/dist/foundations/two-factor/services/totp.service.js.map +1 -0
  263. package/dist/foundations/two-factor/services/two-factor.service.d.ts +165 -0
  264. package/dist/foundations/two-factor/services/two-factor.service.d.ts.map +1 -0
  265. package/dist/foundations/two-factor/services/two-factor.service.js +468 -0
  266. package/dist/foundations/two-factor/services/two-factor.service.js.map +1 -0
  267. package/dist/foundations/two-factor/two-factor.module.d.ts +23 -0
  268. package/dist/foundations/two-factor/two-factor.module.d.ts.map +1 -0
  269. package/dist/foundations/two-factor/two-factor.module.js +132 -0
  270. package/dist/foundations/two-factor/two-factor.module.js.map +1 -0
  271. package/dist/foundations/user/repositories/user.repository.d.ts +8 -0
  272. package/dist/foundations/user/repositories/user.repository.d.ts.map +1 -1
  273. package/dist/foundations/user/repositories/user.repository.js +28 -1
  274. package/dist/foundations/user/repositories/user.repository.js.map +1 -1
  275. package/dist/foundations/waitlist/controllers/waitlist.controller.d.ts.map +1 -1
  276. package/dist/foundations/waitlist/controllers/waitlist.controller.js +0 -4
  277. package/dist/foundations/waitlist/controllers/waitlist.controller.js.map +1 -1
  278. package/dist/foundations/waitlist/repositories/waitlist.repository.d.ts.map +1 -1
  279. package/dist/foundations/waitlist/repositories/waitlist.repository.js +0 -2
  280. package/dist/foundations/waitlist/repositories/waitlist.repository.js.map +1 -1
  281. package/dist/foundations/waitlist/services/waitlist.service.d.ts +1 -0
  282. package/dist/foundations/waitlist/services/waitlist.service.d.ts.map +1 -1
  283. package/dist/foundations/waitlist/services/waitlist.service.js +6 -7
  284. package/dist/foundations/waitlist/services/waitlist.service.js.map +1 -1
  285. package/dist/scripts/generate-module/generator.js +13 -13
  286. package/dist/scripts/generate-module/generator.js.map +1 -1
  287. package/dist/scripts/generate-module/index.js +6 -6
  288. package/dist/scripts/generate-module/index.js.map +1 -1
  289. package/dist/scripts/generate-module/utils/file-writer.js +2 -2
  290. package/dist/scripts/generate-module/utils/file-writer.js.map +1 -1
  291. package/dist/scripts/generate-module/utils/module-registrar.js +7 -7
  292. package/dist/scripts/generate-module/utils/module-registrar.js.map +1 -1
  293. package/dist/tools/migrate-entity/index.js +3 -3
  294. package/dist/tools/migrate-entity/lib/descriptor-generator.js +6 -6
  295. package/dist/tools/migrate-entity/lib/entity-migrator.js +13 -13
  296. package/package.json +5 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"two-factor-config.repository.d.ts","sourceRoot":"","sources":["../../../../src/foundations/two-factor/repositories/two-factor-config.repository.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AACvF,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,kDAAkD,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAE3F,qBACa,yBAA0B,SAAQ,kBAAkB,CAC/D,eAAe,EACf,OAAO,yBAAyB,CAAC,aAAa,CAC/C;IACC,SAAS,CAAC,QAAQ,CAAC,UAAU,2DAA6B;gBAE9C,KAAK,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,UAAU,EAAE,UAAU;IAMnF,YAAY,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAWzE,aAAa,CAAC,MAAM,EAAE;QAC1B,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,GAAG,OAAO,CAAC,eAAe,CAAC;IAyBtB,cAAc,CAAC,MAAM,EAAE;QAC3B,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,OAAO,CAAC;QACpB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,GAAG,OAAO,CAAC,eAAe,CAAC;IA2BtB,cAAc,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAWzD,WAAW,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,eAAe,CAAC;CAK1F"}
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.TwoFactorConfigRepository = void 0;
13
+ const common_1 = require("@nestjs/common");
14
+ const nestjs_cls_1 = require("nestjs-cls");
15
+ const abstract_repository_1 = require("../../../core/neo4j/abstracts/abstract.repository");
16
+ const neo4j_service_1 = require("../../../core/neo4j/services/neo4j.service");
17
+ const security_service_1 = require("../../../core/security/services/security.service");
18
+ const two_factor_config_1 = require("../entities/two-factor-config");
19
+ let TwoFactorConfigRepository = class TwoFactorConfigRepository extends abstract_repository_1.AbstractRepository {
20
+ constructor(neo4j, securityService, clsService) {
21
+ super(neo4j, securityService, clsService);
22
+ this.descriptor = two_factor_config_1.TwoFactorConfigDescriptor;
23
+ }
24
+ // onModuleInit is inherited from AbstractRepository - auto-creates constraints
25
+ async findByUserId(params) {
26
+ const { nodeName, labelName } = this.descriptor.model;
27
+ const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
28
+ query.queryParams = { userId: params.userId };
29
+ query.query = `
30
+ MATCH (user:User {id: $userId})-[:HAS_TWO_FACTOR_CONFIG]->(${nodeName}:${labelName})
31
+ RETURN ${nodeName}
32
+ `;
33
+ return this.neo4j.readOne(query);
34
+ }
35
+ async createForUser(params) {
36
+ const { nodeName, labelName } = this.descriptor.model;
37
+ const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
38
+ query.queryParams = {
39
+ configId: params.configId,
40
+ userId: params.userId,
41
+ isEnabled: params.isEnabled ?? false,
42
+ preferredMethod: params.preferredMethod ?? "totp",
43
+ };
44
+ query.query = `
45
+ MATCH (user:User {id: $userId})
46
+ CREATE (${nodeName}:${labelName} {
47
+ id: $configId,
48
+ isEnabled: $isEnabled,
49
+ preferredMethod: $preferredMethod,
50
+ backupCodesCount: 0,
51
+ createdAt: datetime(),
52
+ updatedAt: datetime()
53
+ })
54
+ CREATE (user)-[:HAS_TWO_FACTOR_CONFIG]->(${nodeName})
55
+ RETURN ${nodeName}
56
+ `;
57
+ return this.neo4j.writeOne(query);
58
+ }
59
+ async updateByUserId(params) {
60
+ const { nodeName, labelName } = this.descriptor.model;
61
+ const query = this.neo4j.initQuery({ serialiser: this.descriptor.model });
62
+ const setClauses = [`${nodeName}.updatedAt = datetime()`];
63
+ query.queryParams = { userId: params.userId };
64
+ if (params.isEnabled !== undefined) {
65
+ setClauses.push(`${nodeName}.isEnabled = $isEnabled`);
66
+ query.queryParams.isEnabled = params.isEnabled;
67
+ }
68
+ if (params.preferredMethod !== undefined) {
69
+ setClauses.push(`${nodeName}.preferredMethod = $preferredMethod`);
70
+ query.queryParams.preferredMethod = params.preferredMethod;
71
+ }
72
+ if (params.backupCodesCount !== undefined) {
73
+ setClauses.push(`${nodeName}.backupCodesCount = $backupCodesCount`);
74
+ query.queryParams.backupCodesCount = params.backupCodesCount;
75
+ }
76
+ query.query = `
77
+ MATCH (user:User {id: $userId})-[:HAS_TWO_FACTOR_CONFIG]->(${nodeName}:${labelName})
78
+ SET ${setClauses.join(", ")}
79
+ RETURN ${nodeName}
80
+ `;
81
+ return this.neo4j.writeOne(query);
82
+ }
83
+ async deleteByUserId(params) {
84
+ const { nodeName, labelName } = this.descriptor.model;
85
+ const query = this.neo4j.initQuery();
86
+ query.queryParams = { userId: params.userId };
87
+ query.query = `
88
+ MATCH (user:User {id: $userId})-[:HAS_TWO_FACTOR_CONFIG]->(${nodeName}:${labelName})
89
+ DETACH DELETE ${nodeName}
90
+ `;
91
+ await this.neo4j.writeOne(query);
92
+ }
93
+ async getOrCreate(params) {
94
+ const existing = await this.findByUserId({ userId: params.userId });
95
+ if (existing)
96
+ return existing;
97
+ return this.createForUser({ configId: params.configId, userId: params.userId });
98
+ }
99
+ };
100
+ exports.TwoFactorConfigRepository = TwoFactorConfigRepository;
101
+ exports.TwoFactorConfigRepository = TwoFactorConfigRepository = __decorate([
102
+ (0, common_1.Injectable)(),
103
+ __metadata("design:paramtypes", [neo4j_service_1.Neo4jService, security_service_1.SecurityService, nestjs_cls_1.ClsService])
104
+ ], TwoFactorConfigRepository);
105
+ //# sourceMappingURL=two-factor-config.repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"two-factor-config.repository.js","sourceRoot":"","sources":["../../../../src/foundations/two-factor/repositories/two-factor-config.repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,2CAAwC;AACxC,2FAAuF;AACvF,8EAA0E;AAC1E,uFAAmF;AACnF,qEAA2F;AAGpF,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,wCAG9C;IAGC,YAAY,KAAmB,EAAE,eAAgC,EAAE,UAAsB;QACvF,KAAK,CAAC,KAAK,EAAE,eAAe,EAAE,UAAU,CAAC,CAAC;QAHzB,eAAU,GAAG,6CAAyB,CAAC;IAI1D,CAAC;IAED,+EAA+E;IAE/E,KAAK,CAAC,YAAY,CAAC,MAA0B;QAC3C,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QACtD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;QAC1E,KAAK,CAAC,WAAW,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9C,KAAK,CAAC,KAAK,GAAG;mEACiD,QAAQ,IAAI,SAAS;eACzE,QAAQ;KAClB,CAAC;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAKnB;Q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AQ,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAClF,CAAC;CACF,CAAA;AArGY,8DAAyB;oCAAzB,yBAAyB;IADrC,IAAA,mBAAU,GAAE;qCAOQ,4BAAY,EAAmB,kCAAe,EAAc,uBAAU;GAN9E,yBAAyB,CAqGrC"}
@@ -0,0 +1,95 @@
1
+ import { JsonApiService } from "../../../core/jsonapi/services/jsonapi.service";
2
+ import { BackupCodeRepository } from "../repositories/backup-code.repository";
3
+ export interface BackupCodeGenerationResult {
4
+ codes: string[];
5
+ count: number;
6
+ }
7
+ /**
8
+ * Backup Code Service
9
+ *
10
+ * Manages single-use backup codes for two-factor authentication recovery.
11
+ * Codes are 8 hex characters, bcrypt hashed, and can only be used once.
12
+ */
13
+ export declare class BackupCodeService {
14
+ private readonly jsonApiService;
15
+ private readonly backupCodeRepository;
16
+ constructor(jsonApiService: JsonApiService, backupCodeRepository: BackupCodeRepository);
17
+ /**
18
+ * Generate a batch of backup codes for a user.
19
+ * Codes are returned in plain text ONCE - they should be shown to the user
20
+ * and will never be retrievable again (only hashes are stored).
21
+ *
22
+ * @param params.userId - The user's ID
23
+ * @returns JSON:API response with plain text backup codes (show to user once)
24
+ */
25
+ generateCodes(params: {
26
+ userId: string;
27
+ }): Promise<any>;
28
+ /**
29
+ * Validate a backup code for a user.
30
+ * If valid, the code is marked as used and cannot be reused.
31
+ *
32
+ * @param params.userId - The user's ID
33
+ * @param params.code - The backup code to validate (8 hex characters)
34
+ * @returns true if the code was valid and has been consumed
35
+ */
36
+ validateCode(params: {
37
+ userId: string;
38
+ code: string;
39
+ }): Promise<boolean>;
40
+ /**
41
+ * Get the count of unused backup codes for a user.
42
+ *
43
+ * @param params.userId - The user's ID
44
+ * @returns JSON:API response with unused backup codes count
45
+ */
46
+ getUnusedCount(params: {
47
+ userId: string;
48
+ }): Promise<any>;
49
+ /**
50
+ * Get the raw count of unused backup codes (for internal use).
51
+ *
52
+ * @param params.userId - The user's ID
53
+ * @returns Number of unused backup codes
54
+ */
55
+ getRawUnusedCount(params: {
56
+ userId: string;
57
+ }): Promise<number>;
58
+ /**
59
+ * Regenerate backup codes for a user.
60
+ * This deletes all existing codes (used and unused) and generates a new batch.
61
+ *
62
+ * @param params.userId - The user's ID
63
+ * @returns JSON:API response with new plain text backup codes (show to user once)
64
+ */
65
+ regenerateCodes(params: {
66
+ userId: string;
67
+ }): Promise<any>;
68
+ /**
69
+ * Check if a user has any backup codes (used or unused).
70
+ *
71
+ * @param params.userId - The user's ID
72
+ * @returns true if the user has any backup codes
73
+ */
74
+ hasBackupCodes(params: {
75
+ userId: string;
76
+ }): Promise<boolean>;
77
+ /**
78
+ * Delete all backup codes for a user.
79
+ *
80
+ * @param params.userId - The user's ID
81
+ */
82
+ deleteAllCodes(params: {
83
+ userId: string;
84
+ }): Promise<void>;
85
+ /**
86
+ * Generate a single random backup code.
87
+ * Format: 8 uppercase hex characters (e.g., "A1B2C3D4")
88
+ */
89
+ private generateSingleCode;
90
+ /**
91
+ * Create backup codes in the database and return plain text codes.
92
+ */
93
+ private createBackupCodes;
94
+ }
95
+ //# sourceMappingURL=backup-code.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backup-code.service.d.ts","sourceRoot":"","sources":["../../../../src/foundations/two-factor/services/backup-code.service.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAGhF,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAM9E,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;GAKG;AACH,qBACa,iBAAiB;IAE1B,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,oBAAoB;gBADpB,cAAc,EAAE,cAAc,EAC9B,oBAAoB,EAAE,oBAAoB;IAG7D;;;;;;;OAOG;IACG,aAAa,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAmB7D;;;;;;;OAOG;IACG,YAAY,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IA4B9E;;;;;OAKG;IACG,cAAc,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAS9D;;;;;OAKG;IACG,iBAAiB,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAIpE;;;;;;OAMG;IACG,eAAe,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC;IAc/D;;;;;OAKG;IACG,cAAc,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,OAAO,CAAC;IAOlE;;;;OAIG;IACG,cAAc,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI/D;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAK1B;;OAEG;YACW,iBAAiB;CAsBhC"}
@@ -0,0 +1,216 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
19
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
20
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
21
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
22
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
23
+ };
24
+ var __importStar = (this && this.__importStar) || (function () {
25
+ var ownKeys = function(o) {
26
+ ownKeys = Object.getOwnPropertyNames || function (o) {
27
+ var ar = [];
28
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
29
+ return ar;
30
+ };
31
+ return ownKeys(o);
32
+ };
33
+ return function (mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
37
+ __setModuleDefault(result, mod);
38
+ return result;
39
+ };
40
+ })();
41
+ var __metadata = (this && this.__metadata) || function (k, v) {
42
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.BackupCodeService = void 0;
46
+ const common_1 = require("@nestjs/common");
47
+ const bcrypt = __importStar(require("bcrypt"));
48
+ const crypto = __importStar(require("crypto"));
49
+ const jsonapi_service_1 = require("../../../core/jsonapi/services/jsonapi.service");
50
+ const backup_codes_count_1 = require("../entities/backup-codes-count");
51
+ const backup_codes_generation_1 = require("../entities/backup-codes-generation");
52
+ const backup_code_repository_1 = require("../repositories/backup-code.repository");
53
+ const BACKUP_CODE_COUNT = 10;
54
+ const BACKUP_CODE_LENGTH = 8; // 8 hex characters
55
+ const BCRYPT_ROUNDS = 10;
56
+ /**
57
+ * Backup Code Service
58
+ *
59
+ * Manages single-use backup codes for two-factor authentication recovery.
60
+ * Codes are 8 hex characters, bcrypt hashed, and can only be used once.
61
+ */
62
+ let BackupCodeService = class BackupCodeService {
63
+ constructor(jsonApiService, backupCodeRepository) {
64
+ this.jsonApiService = jsonApiService;
65
+ this.backupCodeRepository = backupCodeRepository;
66
+ }
67
+ /**
68
+ * Generate a batch of backup codes for a user.
69
+ * Codes are returned in plain text ONCE - they should be shown to the user
70
+ * and will never be retrievable again (only hashes are stored).
71
+ *
72
+ * @param params.userId - The user's ID
73
+ * @returns JSON:API response with plain text backup codes (show to user once)
74
+ */
75
+ async generateCodes(params) {
76
+ // Check if user already has backup codes
77
+ const existingCount = await this.backupCodeRepository.findUnusedCount({
78
+ userId: params.userId,
79
+ });
80
+ if (existingCount > 0) {
81
+ throw new common_1.BadRequestException("User already has backup codes. Use regenerateCodes to replace them.");
82
+ }
83
+ const result = await this.createBackupCodes({ userId: params.userId });
84
+ return this.jsonApiService.buildSingle(backup_codes_generation_1.BackupCodesGenerationDescriptor.model, {
85
+ id: params.userId,
86
+ codes: result.codes,
87
+ count: result.count,
88
+ });
89
+ }
90
+ /**
91
+ * Validate a backup code for a user.
92
+ * If valid, the code is marked as used and cannot be reused.
93
+ *
94
+ * @param params.userId - The user's ID
95
+ * @param params.code - The backup code to validate (8 hex characters)
96
+ * @returns true if the code was valid and has been consumed
97
+ */
98
+ async validateCode(params) {
99
+ // Normalize the code (uppercase, remove any dashes/spaces)
100
+ const normalizedCode = params.code.toUpperCase().replace(/[-\s]/g, "");
101
+ // Validate code format
102
+ if (!/^[0-9A-F]{8}$/.test(normalizedCode)) {
103
+ return false;
104
+ }
105
+ // Get all unused backup codes for the user
106
+ const unusedCodes = await this.backupCodeRepository.findUnusedByUserId({
107
+ userId: params.userId,
108
+ });
109
+ // Check each code hash
110
+ for (const backupCode of unusedCodes) {
111
+ const isMatch = await bcrypt.compare(normalizedCode, backupCode.codeHash);
112
+ if (isMatch) {
113
+ // Mark the code as used
114
+ await this.backupCodeRepository.markUsed({ codeId: backupCode.id });
115
+ return true;
116
+ }
117
+ }
118
+ return false;
119
+ }
120
+ /**
121
+ * Get the count of unused backup codes for a user.
122
+ *
123
+ * @param params.userId - The user's ID
124
+ * @returns JSON:API response with unused backup codes count
125
+ */
126
+ async getUnusedCount(params) {
127
+ const count = await this.backupCodeRepository.findUnusedCount({ userId: params.userId });
128
+ return this.jsonApiService.buildSingle(backup_codes_count_1.BackupCodesCountDescriptor.model, {
129
+ id: params.userId,
130
+ count,
131
+ });
132
+ }
133
+ /**
134
+ * Get the raw count of unused backup codes (for internal use).
135
+ *
136
+ * @param params.userId - The user's ID
137
+ * @returns Number of unused backup codes
138
+ */
139
+ async getRawUnusedCount(params) {
140
+ return this.backupCodeRepository.findUnusedCount({ userId: params.userId });
141
+ }
142
+ /**
143
+ * Regenerate backup codes for a user.
144
+ * This deletes all existing codes (used and unused) and generates a new batch.
145
+ *
146
+ * @param params.userId - The user's ID
147
+ * @returns JSON:API response with new plain text backup codes (show to user once)
148
+ */
149
+ async regenerateCodes(params) {
150
+ // Delete all existing backup codes
151
+ await this.backupCodeRepository.deleteAllByUserId({ userId: params.userId });
152
+ // Generate new codes
153
+ const result = await this.createBackupCodes({ userId: params.userId });
154
+ return this.jsonApiService.buildSingle(backup_codes_generation_1.BackupCodesGenerationDescriptor.model, {
155
+ id: params.userId,
156
+ codes: result.codes,
157
+ count: result.count,
158
+ });
159
+ }
160
+ /**
161
+ * Check if a user has any backup codes (used or unused).
162
+ *
163
+ * @param params.userId - The user's ID
164
+ * @returns true if the user has any backup codes
165
+ */
166
+ async hasBackupCodes(params) {
167
+ const codes = await this.backupCodeRepository.findByUserId({
168
+ userId: params.userId,
169
+ });
170
+ return codes.length > 0;
171
+ }
172
+ /**
173
+ * Delete all backup codes for a user.
174
+ *
175
+ * @param params.userId - The user's ID
176
+ */
177
+ async deleteAllCodes(params) {
178
+ await this.backupCodeRepository.deleteAllByUserId({ userId: params.userId });
179
+ }
180
+ /**
181
+ * Generate a single random backup code.
182
+ * Format: 8 uppercase hex characters (e.g., "A1B2C3D4")
183
+ */
184
+ generateSingleCode() {
185
+ const bytes = crypto.randomBytes(BACKUP_CODE_LENGTH / 2); // 4 bytes = 8 hex chars
186
+ return bytes.toString("hex").toUpperCase();
187
+ }
188
+ /**
189
+ * Create backup codes in the database and return plain text codes.
190
+ */
191
+ async createBackupCodes(params) {
192
+ const plainCodes = [];
193
+ for (let i = 0; i < BACKUP_CODE_COUNT; i++) {
194
+ const plainCode = this.generateSingleCode();
195
+ const codeHash = await bcrypt.hash(plainCode, BCRYPT_ROUNDS);
196
+ const codeId = crypto.randomUUID();
197
+ await this.backupCodeRepository.createForUser({
198
+ codeId,
199
+ userId: params.userId,
200
+ codeHash,
201
+ });
202
+ plainCodes.push(plainCode);
203
+ }
204
+ return {
205
+ codes: plainCodes,
206
+ count: plainCodes.length,
207
+ };
208
+ }
209
+ };
210
+ exports.BackupCodeService = BackupCodeService;
211
+ exports.BackupCodeService = BackupCodeService = __decorate([
212
+ (0, common_1.Injectable)(),
213
+ __metadata("design:paramtypes", [jsonapi_service_1.JsonApiService,
214
+ backup_code_repository_1.BackupCodeRepository])
215
+ ], BackupCodeService);
216
+ //# sourceMappingURL=backup-code.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"backup-code.service.js","sourceRoot":"","sources":["../../../../src/foundations/two-factor/services/backup-code.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAAiE;AACjE,+CAAiC;AACjC,+CAAiC;AACjC,oFAAgF;AAChF,uEAA4E;AAC5E,iFAAsF;AACtF,mFAA8E;AAE9E,MAAM,iBAAiB,GAAG,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YAC7D,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;YAEnC,MAAM,IAAI,CAAC,oBAAoB,CAAC,aAAa,CAAC;gBAC5C,MAAM;gBACN,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,QAAQ;aACT,CAAC,CAAC;YAEH,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC7B,CAAC;QAED,OAAO;YACL,KAAK,EAAE,UAAU;YACjB,KAAK,EAAE,UAAU,CAAC,MAAM;SACzB,CAAC;IACJ,CAAC;CACF,CAAA;AA3KY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,mBAAU,GAAE;qCAGwB,gCAAc;QACR,6CAAoB;GAHlD,iBAAiB,CA2K7B"}
@@ -0,0 +1,6 @@
1
+ export { BackupCodeGenerationResult, BackupCodeService } from "./backup-code.service";
2
+ export { PasskeyAuthenticationOptions, PasskeyInfo, PasskeyRegistrationOptions, PasskeyService, } from "./passkey.service";
3
+ export { TotpEncryptionService } from "./totp-encryption.service";
4
+ export { TotpAuthenticatorInfo, TotpService, TotpSetupResponse } from "./totp.service";
5
+ export { PendingSession, TwoFactorMethod, TwoFactorService, TwoFactorStatus, VerificationResult, } from "./two-factor.service";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/foundations/two-factor/services/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACtF,OAAO,EACL,4BAA4B,EAC5B,WAAW,EACX,0BAA0B,EAC1B,cAAc,GACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,qBAAqB,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACvF,OAAO,EACL,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,kBAAkB,GACnB,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TwoFactorService = exports.TotpService = exports.TotpEncryptionService = exports.PasskeyService = exports.BackupCodeService = void 0;
4
+ var backup_code_service_1 = require("./backup-code.service");
5
+ Object.defineProperty(exports, "BackupCodeService", { enumerable: true, get: function () { return backup_code_service_1.BackupCodeService; } });
6
+ var passkey_service_1 = require("./passkey.service");
7
+ Object.defineProperty(exports, "PasskeyService", { enumerable: true, get: function () { return passkey_service_1.PasskeyService; } });
8
+ var totp_encryption_service_1 = require("./totp-encryption.service");
9
+ Object.defineProperty(exports, "TotpEncryptionService", { enumerable: true, get: function () { return totp_encryption_service_1.TotpEncryptionService; } });
10
+ var totp_service_1 = require("./totp.service");
11
+ Object.defineProperty(exports, "TotpService", { enumerable: true, get: function () { return totp_service_1.TotpService; } });
12
+ var two_factor_service_1 = require("./two-factor.service");
13
+ Object.defineProperty(exports, "TwoFactorService", { enumerable: true, get: function () { return two_factor_service_1.TwoFactorService; } });
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/foundations/two-factor/services/index.ts"],"names":[],"mappings":";;;AAAA,6DAAsF;AAAjD,wHAAA,iBAAiB,OAAA;AACtD,qDAK2B;AADzB,iHAAA,cAAc,OAAA;AAEhB,qEAAkE;AAAzD,gIAAA,qBAAqB,OAAA;AAC9B,+CAAuF;AAAvD,2GAAA,WAAW,OAAA;AAC3C,2DAM8B;AAH5B,sHAAA,gBAAgB,OAAA"}
@@ -0,0 +1,132 @@
1
+ import { type AuthenticationResponseJSON, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RegistrationResponseJSON } from "@simplewebauthn/server";
2
+ import { JsonApiService } from "../../../core/jsonapi/services/jsonapi.service";
3
+ import { PasskeyRepository } from "../repositories/passkey.repository";
4
+ import { PendingTwoFactorRepository } from "../repositories/pending-two-factor.repository";
5
+ export interface PasskeyRegistrationOptions {
6
+ pendingId: string;
7
+ options: PublicKeyCredentialCreationOptionsJSON;
8
+ }
9
+ export interface PasskeyAuthenticationOptions {
10
+ pendingId: string;
11
+ options: PublicKeyCredentialRequestOptionsJSON;
12
+ }
13
+ export interface PasskeyInfo {
14
+ id: string;
15
+ name: string;
16
+ backedUp: boolean;
17
+ lastUsedAt?: Date;
18
+ createdAt: Date;
19
+ }
20
+ /**
21
+ * Passkey Service
22
+ *
23
+ * Manages WebAuthn passkey registration and authentication for two-factor authentication.
24
+ * Provides passkey enrollment, verification, and management capabilities.
25
+ */
26
+ export declare class PasskeyService {
27
+ private readonly jsonApiService;
28
+ private readonly passkeyRepository;
29
+ private readonly pendingTwoFactorRepository;
30
+ private readonly challengeTtlSeconds;
31
+ constructor(jsonApiService: JsonApiService, passkeyRepository: PasskeyRepository, pendingTwoFactorRepository: PendingTwoFactorRepository);
32
+ /**
33
+ * Get WebAuthn Relying Party configuration from environment.
34
+ */
35
+ private getRpConfig;
36
+ /**
37
+ * Generate registration options for creating a new passkey.
38
+ *
39
+ * @param params.userId - The user's ID
40
+ * @param params.userName - The user's email or username
41
+ * @param params.userDisplayName - The user's display name
42
+ * @returns JSON:API response with registration options
43
+ */
44
+ generateRegistrationOptions(params: {
45
+ userId: string;
46
+ userName: string;
47
+ userDisplayName: string;
48
+ }): Promise<any>;
49
+ /**
50
+ * Verify a passkey registration response and create the passkey.
51
+ *
52
+ * @param params.pendingId - The pending challenge ID from generateRegistrationOptions
53
+ * @param params.name - A friendly name for this passkey
54
+ * @param params.response - The WebAuthn credential response from the client
55
+ * @returns JSON:API response with the created passkey
56
+ */
57
+ verifyRegistration(params: {
58
+ pendingId: string;
59
+ name: string;
60
+ response: RegistrationResponseJSON;
61
+ }): Promise<any>;
62
+ /**
63
+ * Generate authentication options for passkey sign-in.
64
+ *
65
+ * @param params.userId - The user's ID
66
+ * @returns JSON:API response with authentication options
67
+ */
68
+ generateAuthenticationOptions(params: {
69
+ userId: string;
70
+ }): Promise<any>;
71
+ /**
72
+ * Verify a passkey authentication response.
73
+ *
74
+ * @param params.pendingId - The pending challenge ID from generateAuthenticationOptions
75
+ * @param params.response - The WebAuthn assertion response from the client
76
+ * @returns The passkey ID if verification succeeds
77
+ */
78
+ verifyAuthentication(params: {
79
+ pendingId: string;
80
+ response: AuthenticationResponseJSON;
81
+ }): Promise<string>;
82
+ /**
83
+ * List all passkeys for a user.
84
+ *
85
+ * @param params.userId - The user's ID
86
+ * @returns JSON:API response with list of passkeys
87
+ */
88
+ listPasskeys(params: {
89
+ userId: string;
90
+ }): Promise<any>;
91
+ /**
92
+ * Remove a passkey.
93
+ *
94
+ * @param params.passkeyId - The passkey ID to remove
95
+ */
96
+ removePasskey(params: {
97
+ passkeyId: string;
98
+ }): Promise<void>;
99
+ /**
100
+ * Rename a passkey.
101
+ *
102
+ * @param params.passkeyId - The passkey ID to rename
103
+ * @param params.name - The new name for the passkey
104
+ */
105
+ renamePasskey(params: {
106
+ passkeyId: string;
107
+ name: string;
108
+ }): Promise<void>;
109
+ /**
110
+ * Check if a user has any registered passkeys.
111
+ *
112
+ * @param params.userId - The user's ID
113
+ * @returns true if the user has at least one passkey
114
+ */
115
+ hasPasskeys(params: {
116
+ userId: string;
117
+ }): Promise<boolean>;
118
+ /**
119
+ * Parse transports JSON string into array.
120
+ */
121
+ private parseTransports;
122
+ /**
123
+ * Convert Uint8Array to base64url string.
124
+ */
125
+ private uint8ArrayToBase64Url;
126
+ /**
127
+ * Convert base64url string to Uint8Array.
128
+ * The type assertion ensures compatibility with @simplewebauthn's expected types.
129
+ */
130
+ private base64UrlToUint8Array;
131
+ }
132
+ //# sourceMappingURL=passkey.service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"passkey.service.d.ts","sourceRoot":"","sources":["../../../../src/foundations/two-factor/services/passkey.service.ts"],"names":[],"mappings":"AACA,O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