@hed-hog/core 0.0.4

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 (935) hide show
  1. package/dist/auth/auth.controller.d.ts +167 -0
  2. package/dist/auth/auth.controller.d.ts.map +1 -0
  3. package/dist/auth/auth.controller.js +236 -0
  4. package/dist/auth/auth.controller.js.map +1 -0
  5. package/dist/auth/auth.module.d.ts +5 -0
  6. package/dist/auth/auth.module.d.ts.map +1 -0
  7. package/dist/auth/auth.module.js +116 -0
  8. package/dist/auth/auth.module.js.map +1 -0
  9. package/dist/auth/auth.service.d.ts +215 -0
  10. package/dist/auth/auth.service.d.ts.map +1 -0
  11. package/dist/auth/auth.service.js +493 -0
  12. package/dist/auth/auth.service.js.map +1 -0
  13. package/dist/auth/consts/body.d.ts +2 -0
  14. package/dist/auth/consts/body.d.ts.map +1 -0
  15. package/dist/auth/consts/body.js +32 -0
  16. package/dist/auth/consts/body.js.map +1 -0
  17. package/dist/auth/dto/change.dto.d.ts +7 -0
  18. package/dist/auth/dto/change.dto.d.ts.map +1 -0
  19. package/dist/auth/dto/change.dto.js +51 -0
  20. package/dist/auth/dto/change.dto.js.map +1 -0
  21. package/dist/auth/dto/create-user.dto.d.ts +12 -0
  22. package/dist/auth/dto/create-user.dto.d.ts.map +1 -0
  23. package/dist/auth/dto/create-user.dto.js +60 -0
  24. package/dist/auth/dto/create-user.dto.js.map +1 -0
  25. package/dist/auth/dto/email.dto.d.ts +6 -0
  26. package/dist/auth/dto/email.dto.d.ts.map +1 -0
  27. package/dist/auth/dto/email.dto.js +33 -0
  28. package/dist/auth/dto/email.dto.js.map +1 -0
  29. package/dist/auth/dto/forget.dto.d.ts +6 -0
  30. package/dist/auth/dto/forget.dto.d.ts.map +1 -0
  31. package/dist/auth/dto/forget.dto.js +29 -0
  32. package/dist/auth/dto/forget.dto.js.map +1 -0
  33. package/dist/auth/dto/login-with-code.dto.d.ts +6 -0
  34. package/dist/auth/dto/login-with-code.dto.d.ts.map +1 -0
  35. package/dist/auth/dto/login-with-code.dto.js +31 -0
  36. package/dist/auth/dto/login-with-code.dto.js.map +1 -0
  37. package/dist/auth/dto/login-with-recovery-code.d.ts +5 -0
  38. package/dist/auth/dto/login-with-recovery-code.d.ts.map +1 -0
  39. package/dist/auth/dto/login-with-recovery-code.js +26 -0
  40. package/dist/auth/dto/login-with-recovery-code.js.map +1 -0
  41. package/dist/auth/dto/login.dto.d.ts +8 -0
  42. package/dist/auth/dto/login.dto.d.ts.map +1 -0
  43. package/dist/auth/dto/login.dto.js +51 -0
  44. package/dist/auth/dto/login.dto.js.map +1 -0
  45. package/dist/auth/dto/resend-mfa-code.dto.d.ts +4 -0
  46. package/dist/auth/dto/resend-mfa-code.dto.d.ts.map +1 -0
  47. package/dist/auth/dto/resend-mfa-code.dto.js +21 -0
  48. package/dist/auth/dto/resend-mfa-code.dto.js.map +1 -0
  49. package/dist/auth/dto/reset.dto.d.ts +5 -0
  50. package/dist/auth/dto/reset.dto.d.ts.map +1 -0
  51. package/dist/auth/dto/reset.dto.js +29 -0
  52. package/dist/auth/dto/reset.dto.js.map +1 -0
  53. package/dist/auth/enums/multifactor-type.enum.d.ts +5 -0
  54. package/dist/auth/enums/multifactor-type.enum.d.ts.map +1 -0
  55. package/dist/auth/enums/multifactor-type.enum.js +9 -0
  56. package/dist/auth/enums/multifactor-type.enum.js.map +1 -0
  57. package/dist/auth/guards/auth.guard.d.ts +11 -0
  58. package/dist/auth/guards/auth.guard.d.ts.map +1 -0
  59. package/dist/auth/guards/auth.guard.js +65 -0
  60. package/dist/auth/guards/auth.guard.js.map +1 -0
  61. package/dist/challenge/challenge.module.d.ts +3 -0
  62. package/dist/challenge/challenge.module.d.ts.map +1 -0
  63. package/dist/challenge/challenge.module.js +33 -0
  64. package/dist/challenge/challenge.module.js.map +1 -0
  65. package/dist/challenge/challenge.service.d.ts +84 -0
  66. package/dist/challenge/challenge.service.d.ts.map +1 -0
  67. package/dist/challenge/challenge.service.js +288 -0
  68. package/dist/challenge/challenge.service.js.map +1 -0
  69. package/dist/core/core.controller.d.ts +44 -0
  70. package/dist/core/core.controller.d.ts.map +1 -0
  71. package/dist/core/core.controller.js +38 -0
  72. package/dist/core/core.controller.js.map +1 -0
  73. package/dist/core/core.module.d.ts +3 -0
  74. package/dist/core/core.module.d.ts.map +1 -0
  75. package/dist/core/core.module.js +28 -0
  76. package/dist/core/core.module.js.map +1 -0
  77. package/dist/core/core.service.d.ts +56 -0
  78. package/dist/core/core.service.d.ts.map +1 -0
  79. package/dist/core/core.service.js +320 -0
  80. package/dist/core/core.service.js.map +1 -0
  81. package/dist/core/system.controller.d.ts +44 -0
  82. package/dist/core/system.controller.d.ts.map +1 -0
  83. package/dist/core/system.controller.js +38 -0
  84. package/dist/core/system.controller.js.map +1 -0
  85. package/dist/core/system.module.d.ts +3 -0
  86. package/dist/core/system.module.d.ts.map +1 -0
  87. package/dist/core/system.module.js +28 -0
  88. package/dist/core/system.module.js.map +1 -0
  89. package/dist/core/system.service.d.ts +56 -0
  90. package/dist/core/system.service.d.ts.map +1 -0
  91. package/dist/core/system.service.js +320 -0
  92. package/dist/core/system.service.js.map +1 -0
  93. package/dist/core.module.d.ts +5 -0
  94. package/dist/core.module.d.ts.map +1 -0
  95. package/dist/core.module.js +101 -0
  96. package/dist/core.module.js.map +1 -0
  97. package/dist/dashboard/dashboard/dashboard.controller.d.ts +24 -0
  98. package/dist/dashboard/dashboard/dashboard.controller.d.ts.map +1 -0
  99. package/dist/dashboard/dashboard/dashboard.controller.js +88 -0
  100. package/dist/dashboard/dashboard/dashboard.controller.js.map +1 -0
  101. package/dist/dashboard/dashboard/dashboard.module.d.ts +3 -0
  102. package/dist/dashboard/dashboard/dashboard.module.d.ts.map +1 -0
  103. package/dist/dashboard/dashboard/dashboard.module.js +26 -0
  104. package/dist/dashboard/dashboard/dashboard.module.js.map +1 -0
  105. package/dist/dashboard/dashboard/dashboard.service.d.ts +32 -0
  106. package/dist/dashboard/dashboard/dashboard.service.d.ts.map +1 -0
  107. package/dist/dashboard/dashboard/dashboard.service.js +61 -0
  108. package/dist/dashboard/dashboard/dashboard.service.js.map +1 -0
  109. package/dist/dashboard/dashboard/dto/create.dto.d.ts +5 -0
  110. package/dist/dashboard/dashboard/dto/create.dto.d.ts.map +1 -0
  111. package/dist/dashboard/dashboard/dto/create.dto.js +23 -0
  112. package/dist/dashboard/dashboard/dto/create.dto.js.map +1 -0
  113. package/dist/dashboard/dashboard/dto/update.dto.d.ts +6 -0
  114. package/dist/dashboard/dashboard/dto/update.dto.d.ts.map +1 -0
  115. package/dist/dashboard/dashboard/dto/update.dto.js +9 -0
  116. package/dist/dashboard/dashboard/dto/update.dto.js.map +1 -0
  117. package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts +24 -0
  118. package/dist/dashboard/dashboard-component/dashboard-component.controller.d.ts.map +1 -0
  119. package/dist/dashboard/dashboard-component/dashboard-component.controller.js +90 -0
  120. package/dist/dashboard/dashboard-component/dashboard-component.controller.js.map +1 -0
  121. package/dist/dashboard/dashboard-component/dashboard-component.module.d.ts +3 -0
  122. package/dist/dashboard/dashboard-component/dashboard-component.module.d.ts.map +1 -0
  123. package/dist/dashboard/dashboard-component/dashboard-component.module.js +26 -0
  124. package/dist/dashboard/dashboard-component/dashboard-component.module.js.map +1 -0
  125. package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts +32 -0
  126. package/dist/dashboard/dashboard-component/dashboard-component.service.d.ts.map +1 -0
  127. package/dist/dashboard/dashboard-component/dashboard-component.service.js +59 -0
  128. package/dist/dashboard/dashboard-component/dashboard-component.service.js.map +1 -0
  129. package/dist/dashboard/dashboard-component/dto/create.dto.d.ts +13 -0
  130. package/dist/dashboard/dashboard-component/dto/create.dto.d.ts.map +1 -0
  131. package/dist/dashboard/dashboard-component/dto/create.dto.js +59 -0
  132. package/dist/dashboard/dashboard-component/dto/create.dto.js.map +1 -0
  133. package/dist/dashboard/dashboard-component/dto/update.dto.d.ts +6 -0
  134. package/dist/dashboard/dashboard-component/dto/update.dto.d.ts.map +1 -0
  135. package/dist/dashboard/dashboard-component/dto/update.dto.js +9 -0
  136. package/dist/dashboard/dashboard-component/dto/update.dto.js.map +1 -0
  137. package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts +52 -0
  138. package/dist/dashboard/dashboard-core/dashboard-core.controller.d.ts.map +1 -0
  139. package/dist/dashboard/dashboard-core/dashboard-core.controller.js +40 -0
  140. package/dist/dashboard/dashboard-core/dashboard-core.controller.js.map +1 -0
  141. package/dist/dashboard/dashboard-core/dashboard-core.module.d.ts +3 -0
  142. package/dist/dashboard/dashboard-core/dashboard-core.module.d.ts.map +1 -0
  143. package/dist/dashboard/dashboard-core/dashboard-core.module.js +26 -0
  144. package/dist/dashboard/dashboard-core/dashboard-core.module.js.map +1 -0
  145. package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts +52 -0
  146. package/dist/dashboard/dashboard-core/dashboard-core.service.d.ts.map +1 -0
  147. package/dist/dashboard/dashboard-core/dashboard-core.service.js +44 -0
  148. package/dist/dashboard/dashboard-core/dashboard-core.service.js.map +1 -0
  149. package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts +54 -0
  150. package/dist/dashboard/dashboard-item/dashboard-item.controller.d.ts.map +1 -0
  151. package/dist/dashboard/dashboard-item/dashboard-item.controller.js +88 -0
  152. package/dist/dashboard/dashboard-item/dashboard-item.controller.js.map +1 -0
  153. package/dist/dashboard/dashboard-item/dashboard-item.module.d.ts +3 -0
  154. package/dist/dashboard/dashboard-item/dashboard-item.module.d.ts.map +1 -0
  155. package/dist/dashboard/dashboard-item/dashboard-item.module.js +26 -0
  156. package/dist/dashboard/dashboard-item/dashboard-item.module.js.map +1 -0
  157. package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts +59 -0
  158. package/dist/dashboard/dashboard-item/dashboard-item.service.d.ts.map +1 -0
  159. package/dist/dashboard/dashboard-item/dashboard-item.service.js +77 -0
  160. package/dist/dashboard/dashboard-item/dashboard-item.service.js.map +1 -0
  161. package/dist/dashboard/dashboard-item/dto/create.dto.d.ts +9 -0
  162. package/dist/dashboard/dashboard-item/dto/create.dto.d.ts.map +1 -0
  163. package/dist/dashboard/dashboard-item/dto/create.dto.js +41 -0
  164. package/dist/dashboard/dashboard-item/dto/create.dto.js.map +1 -0
  165. package/dist/dashboard/dashboard-item/dto/update.dto.d.ts +6 -0
  166. package/dist/dashboard/dashboard-item/dto/update.dto.d.ts.map +1 -0
  167. package/dist/dashboard/dashboard-item/dto/update.dto.js +9 -0
  168. package/dist/dashboard/dashboard-item/dto/update.dto.js.map +1 -0
  169. package/dist/dashboard/dashboard-user/dashboard-user.controller.d.ts +54 -0
  170. package/dist/dashboard/dashboard-user/dashboard-user.controller.d.ts.map +1 -0
  171. package/dist/dashboard/dashboard-user/dashboard-user.controller.js +88 -0
  172. package/dist/dashboard/dashboard-user/dashboard-user.controller.js.map +1 -0
  173. package/dist/dashboard/dashboard-user/dashboard-user.module.d.ts +3 -0
  174. package/dist/dashboard/dashboard-user/dashboard-user.module.d.ts.map +1 -0
  175. package/dist/dashboard/dashboard-user/dashboard-user.module.js +26 -0
  176. package/dist/dashboard/dashboard-user/dashboard-user.module.js.map +1 -0
  177. package/dist/dashboard/dashboard-user/dashboard-user.service.d.ts +61 -0
  178. package/dist/dashboard/dashboard-user/dashboard-user.service.d.ts.map +1 -0
  179. package/dist/dashboard/dashboard-user/dashboard-user.service.js +83 -0
  180. package/dist/dashboard/dashboard-user/dashboard-user.service.js.map +1 -0
  181. package/dist/dashboard/dashboard-user/dto/create.dto.d.ts +10 -0
  182. package/dist/dashboard/dashboard-user/dto/create.dto.d.ts.map +1 -0
  183. package/dist/dashboard/dashboard-user/dto/create.dto.js +42 -0
  184. package/dist/dashboard/dashboard-user/dto/create.dto.js.map +1 -0
  185. package/dist/dashboard/dashboard-user/dto/update.dto.d.ts +6 -0
  186. package/dist/dashboard/dashboard-user/dto/update.dto.d.ts.map +1 -0
  187. package/dist/dashboard/dashboard-user/dto/update.dto.js +9 -0
  188. package/dist/dashboard/dashboard-user/dto/update.dto.js.map +1 -0
  189. package/dist/dashboard/dashboard.module.d.ts +3 -0
  190. package/dist/dashboard/dashboard.module.d.ts.map +1 -0
  191. package/dist/dashboard/dashboard.module.js +37 -0
  192. package/dist/dashboard/dashboard.module.js.map +1 -0
  193. package/dist/dashboard/index.d.ts +2 -0
  194. package/dist/dashboard/index.d.ts.map +1 -0
  195. package/dist/dashboard/index.js +18 -0
  196. package/dist/dashboard/index.js.map +1 -0
  197. package/dist/decorators/inject-locale.decorator.d.ts +2 -0
  198. package/dist/decorators/inject-locale.decorator.d.ts.map +1 -0
  199. package/dist/decorators/inject-locale.decorator.js +16 -0
  200. package/dist/decorators/inject-locale.decorator.js.map +1 -0
  201. package/dist/dto/delete.dto.d.ts +4 -0
  202. package/dist/dto/delete.dto.d.ts.map +1 -0
  203. package/dist/dto/delete.dto.js +23 -0
  204. package/dist/dto/delete.dto.js.map +1 -0
  205. package/dist/dto/update-ids.dto.d.ts +4 -0
  206. package/dist/dto/update-ids.dto.d.ts.map +1 -0
  207. package/dist/dto/update-ids.dto.js +27 -0
  208. package/dist/dto/update-ids.dto.js.map +1 -0
  209. package/dist/emails/index.d.ts +3 -0
  210. package/dist/emails/index.d.ts.map +1 -0
  211. package/dist/emails/index.js +19 -0
  212. package/dist/emails/index.js.map +1 -0
  213. package/dist/emails/lib.d.ts +8 -0
  214. package/dist/emails/lib.d.ts.map +1 -0
  215. package/dist/emails/lib.js +73 -0
  216. package/dist/emails/lib.js.map +1 -0
  217. package/dist/emails/templates.d.ts +17 -0
  218. package/dist/emails/templates.d.ts.map +1 -0
  219. package/dist/emails/templates.js +70 -0
  220. package/dist/emails/templates.js.map +1 -0
  221. package/dist/file/dto/delete.dto.d.ts +4 -0
  222. package/dist/file/dto/delete.dto.d.ts.map +1 -0
  223. package/dist/file/dto/delete.dto.js +23 -0
  224. package/dist/file/dto/delete.dto.js.map +1 -0
  225. package/dist/file/dto/upload.dto.d.ts +4 -0
  226. package/dist/file/dto/upload.dto.d.ts.map +1 -0
  227. package/dist/file/dto/upload.dto.js +22 -0
  228. package/dist/file/dto/upload.dto.js.map +1 -0
  229. package/dist/file/file.controller.d.ts +45 -0
  230. package/dist/file/file.controller.d.ts.map +1 -0
  231. package/dist/file/file.controller.js +112 -0
  232. package/dist/file/file.controller.js.map +1 -0
  233. package/dist/file/file.module.d.ts +3 -0
  234. package/dist/file/file.module.d.ts.map +1 -0
  235. package/dist/file/file.module.js +40 -0
  236. package/dist/file/file.module.js.map +1 -0
  237. package/dist/file/file.service.d.ts +92 -0
  238. package/dist/file/file.service.d.ts.map +1 -0
  239. package/dist/file/file.service.js +260 -0
  240. package/dist/file/file.service.js.map +1 -0
  241. package/dist/file/provider/abstract.provider.d.ts +25 -0
  242. package/dist/file/provider/abstract.provider.d.ts.map +1 -0
  243. package/dist/file/provider/abstract.provider.js +15 -0
  244. package/dist/file/provider/abstract.provider.js.map +1 -0
  245. package/dist/file/provider/azure.provider.d.ts +16 -0
  246. package/dist/file/provider/azure.provider.d.ts.map +1 -0
  247. package/dist/file/provider/azure.provider.js +102 -0
  248. package/dist/file/provider/azure.provider.js.map +1 -0
  249. package/dist/file/provider/gcs.provider.d.ts +17 -0
  250. package/dist/file/provider/gcs.provider.d.ts.map +1 -0
  251. package/dist/file/provider/gcs.provider.js +86 -0
  252. package/dist/file/provider/gcs.provider.js.map +1 -0
  253. package/dist/file/provider/local.provider.d.ts +16 -0
  254. package/dist/file/provider/local.provider.d.ts.map +1 -0
  255. package/dist/file/provider/local.provider.js +138 -0
  256. package/dist/file/provider/local.provider.js.map +1 -0
  257. package/dist/file/provider/provider.enum.d.ts +7 -0
  258. package/dist/file/provider/provider.enum.d.ts.map +1 -0
  259. package/dist/file/provider/provider.enum.js +11 -0
  260. package/dist/file/provider/provider.enum.js.map +1 -0
  261. package/dist/file/provider/provider.factory.d.ts +6 -0
  262. package/dist/file/provider/provider.factory.d.ts.map +1 -0
  263. package/dist/file/provider/provider.factory.js +21 -0
  264. package/dist/file/provider/provider.factory.js.map +1 -0
  265. package/dist/file/provider/s3.provider.d.ts +20 -0
  266. package/dist/file/provider/s3.provider.d.ts.map +1 -0
  267. package/dist/file/provider/s3.provider.js +183 -0
  268. package/dist/file/provider/s3.provider.js.map +1 -0
  269. package/dist/index.d.ts +13 -0
  270. package/dist/index.d.ts.map +1 -0
  271. package/dist/index.js +35 -0
  272. package/dist/index.js.map +1 -0
  273. package/dist/install/dto/generate-migration.dto.d.ts +12 -0
  274. package/dist/install/dto/generate-migration.dto.d.ts.map +1 -0
  275. package/dist/install/dto/generate-migration.dto.js +51 -0
  276. package/dist/install/dto/generate-migration.dto.js.map +1 -0
  277. package/dist/install/dto/install.dto.d.ts +8 -0
  278. package/dist/install/dto/install.dto.d.ts.map +1 -0
  279. package/dist/install/dto/install.dto.js +46 -0
  280. package/dist/install/dto/install.dto.js.map +1 -0
  281. package/dist/install/install.controller.d.ts +19 -0
  282. package/dist/install/install.controller.d.ts.map +1 -0
  283. package/dist/install/install.controller.js +61 -0
  284. package/dist/install/install.controller.js.map +1 -0
  285. package/dist/install/install.module.d.ts +3 -0
  286. package/dist/install/install.module.d.ts.map +1 -0
  287. package/dist/install/install.module.js +32 -0
  288. package/dist/install/install.module.js.map +1 -0
  289. package/dist/install/install.service.d.ts +35 -0
  290. package/dist/install/install.service.d.ts.map +1 -0
  291. package/dist/install/install.service.js +332 -0
  292. package/dist/install/install.service.js.map +1 -0
  293. package/dist/mail/dto/create.dto.d.ts +15 -0
  294. package/dist/mail/dto/create.dto.d.ts.map +1 -0
  295. package/dist/mail/dto/create.dto.js +52 -0
  296. package/dist/mail/dto/create.dto.js.map +1 -0
  297. package/dist/mail/dto/send.dto.d.ts +6 -0
  298. package/dist/mail/dto/send.dto.d.ts.map +1 -0
  299. package/dist/mail/dto/send.dto.js +31 -0
  300. package/dist/mail/dto/send.dto.js.map +1 -0
  301. package/dist/mail/dto/test-mail.dto.d.ts +7 -0
  302. package/dist/mail/dto/test-mail.dto.d.ts.map +1 -0
  303. package/dist/mail/dto/test-mail.dto.js +37 -0
  304. package/dist/mail/dto/test-mail.dto.js.map +1 -0
  305. package/dist/mail/dto/update.dto.d.ts +6 -0
  306. package/dist/mail/dto/update.dto.d.ts.map +1 -0
  307. package/dist/mail/dto/update.dto.js +9 -0
  308. package/dist/mail/dto/update.dto.js.map +1 -0
  309. package/dist/mail/mail.controller.d.ts +89 -0
  310. package/dist/mail/mail.controller.d.ts.map +1 -0
  311. package/dist/mail/mail.controller.js +104 -0
  312. package/dist/mail/mail.controller.js.map +1 -0
  313. package/dist/mail/mail.module.d.ts +3 -0
  314. package/dist/mail/mail.module.d.ts.map +1 -0
  315. package/dist/mail/mail.module.js +113 -0
  316. package/dist/mail/mail.module.js.map +1 -0
  317. package/dist/mail/mail.service.d.ts +122 -0
  318. package/dist/mail/mail.service.d.ts.map +1 -0
  319. package/dist/mail/mail.service.js +356 -0
  320. package/dist/mail/mail.service.js.map +1 -0
  321. package/dist/mail-sent/dto/create.dto.d.ts +10 -0
  322. package/dist/mail-sent/dto/create.dto.d.ts.map +1 -0
  323. package/dist/mail-sent/dto/create.dto.js +70 -0
  324. package/dist/mail-sent/dto/create.dto.js.map +1 -0
  325. package/dist/mail-sent/dto/update.dto.d.ts +6 -0
  326. package/dist/mail-sent/dto/update.dto.d.ts.map +1 -0
  327. package/dist/mail-sent/dto/update.dto.js +9 -0
  328. package/dist/mail-sent/dto/update.dto.js.map +1 -0
  329. package/dist/mail-sent/mail-sent.controller.d.ts +57 -0
  330. package/dist/mail-sent/mail-sent.controller.d.ts.map +1 -0
  331. package/dist/mail-sent/mail-sent.controller.js +88 -0
  332. package/dist/mail-sent/mail-sent.controller.js.map +1 -0
  333. package/dist/mail-sent/mail-sent.module.d.ts +3 -0
  334. package/dist/mail-sent/mail-sent.module.d.ts.map +1 -0
  335. package/dist/mail-sent/mail-sent.module.js +26 -0
  336. package/dist/mail-sent/mail-sent.module.js.map +1 -0
  337. package/dist/mail-sent/mail-sent.service.d.ts +62 -0
  338. package/dist/mail-sent/mail-sent.service.d.ts.map +1 -0
  339. package/dist/mail-sent/mail-sent.service.js +93 -0
  340. package/dist/mail-sent/mail-sent.service.js.map +1 -0
  341. package/dist/mail-var/dto/create.dto.d.ts +5 -0
  342. package/dist/mail-var/dto/create.dto.d.ts.map +1 -0
  343. package/dist/mail-var/dto/create.dto.js +25 -0
  344. package/dist/mail-var/dto/create.dto.js.map +1 -0
  345. package/dist/mail-var/dto/update.dto.d.ts +6 -0
  346. package/dist/mail-var/dto/update.dto.d.ts.map +1 -0
  347. package/dist/mail-var/dto/update.dto.js +9 -0
  348. package/dist/mail-var/dto/update.dto.js.map +1 -0
  349. package/dist/mail-var/mail-var.controller.d.ts +42 -0
  350. package/dist/mail-var/mail-var.controller.d.ts.map +1 -0
  351. package/dist/mail-var/mail-var.controller.js +88 -0
  352. package/dist/mail-var/mail-var.controller.js.map +1 -0
  353. package/dist/mail-var/mail-var.module.d.ts +3 -0
  354. package/dist/mail-var/mail-var.module.d.ts.map +1 -0
  355. package/dist/mail-var/mail-var.module.js +26 -0
  356. package/dist/mail-var/mail-var.module.js.map +1 -0
  357. package/dist/mail-var/mail-var.service.d.ts +47 -0
  358. package/dist/mail-var/mail-var.service.d.ts.map +1 -0
  359. package/dist/mail-var/mail-var.service.js +73 -0
  360. package/dist/mail-var/mail-var.service.js.map +1 -0
  361. package/dist/menu/dto/create.dto.d.ts +8 -0
  362. package/dist/menu/dto/create.dto.d.ts.map +1 -0
  363. package/dist/menu/dto/create.dto.js +45 -0
  364. package/dist/menu/dto/create.dto.js.map +1 -0
  365. package/dist/menu/dto/order.dto.d.ts +4 -0
  366. package/dist/menu/dto/order.dto.d.ts.map +1 -0
  367. package/dist/menu/dto/order.dto.js +23 -0
  368. package/dist/menu/dto/order.dto.js.map +1 -0
  369. package/dist/menu/dto/update.dto.d.ts +7 -0
  370. package/dist/menu/dto/update.dto.d.ts.map +1 -0
  371. package/dist/menu/dto/update.dto.js +38 -0
  372. package/dist/menu/dto/update.dto.js.map +1 -0
  373. package/dist/menu/menu.controller.d.ts +81 -0
  374. package/dist/menu/menu.controller.d.ts.map +1 -0
  375. package/dist/menu/menu.controller.js +160 -0
  376. package/dist/menu/menu.controller.js.map +1 -0
  377. package/dist/menu/menu.module.d.ts +3 -0
  378. package/dist/menu/menu.module.d.ts.map +1 -0
  379. package/dist/menu/menu.module.js +31 -0
  380. package/dist/menu/menu.module.js.map +1 -0
  381. package/dist/menu/menu.service.d.ts +85 -0
  382. package/dist/menu/menu.service.d.ts.map +1 -0
  383. package/dist/menu/menu.service.js +223 -0
  384. package/dist/menu/menu.service.js.map +1 -0
  385. package/dist/menu/menu.service.spec.d.ts +1 -0
  386. package/dist/menu/menu.service.spec.d.ts.map +1 -0
  387. package/dist/menu/menu.service.spec.js +208 -0
  388. package/dist/menu/menu.service.spec.js.map +1 -0
  389. package/dist/middlewares/locale-injection.middleware.d.ts +6 -0
  390. package/dist/middlewares/locale-injection.middleware.d.ts.map +1 -0
  391. package/dist/middlewares/locale-injection.middleware.js +25 -0
  392. package/dist/middlewares/locale-injection.middleware.js.map +1 -0
  393. package/dist/oauth/interfaces/OAuthProvider.d.ts +6 -0
  394. package/dist/oauth/interfaces/OAuthProvider.d.ts.map +1 -0
  395. package/dist/oauth/interfaces/OAuthProvider.js +3 -0
  396. package/dist/oauth/interfaces/OAuthProvider.js.map +1 -0
  397. package/dist/oauth/oauth.controller.d.ts +27 -0
  398. package/dist/oauth/oauth.controller.d.ts.map +1 -0
  399. package/dist/oauth/oauth.controller.js +151 -0
  400. package/dist/oauth/oauth.controller.js.map +1 -0
  401. package/dist/oauth/oauth.module.d.ts +3 -0
  402. package/dist/oauth/oauth.module.d.ts.map +1 -0
  403. package/dist/oauth/oauth.module.js +49 -0
  404. package/dist/oauth/oauth.module.js.map +1 -0
  405. package/dist/oauth/oauth.service.d.ts +51 -0
  406. package/dist/oauth/oauth.service.d.ts.map +1 -0
  407. package/dist/oauth/oauth.service.js +294 -0
  408. package/dist/oauth/oauth.service.js.map +1 -0
  409. package/dist/oauth/providers/abstract.provider.d.ts +18 -0
  410. package/dist/oauth/providers/abstract.provider.d.ts.map +1 -0
  411. package/dist/oauth/providers/abstract.provider.js +30 -0
  412. package/dist/oauth/providers/abstract.provider.js.map +1 -0
  413. package/dist/oauth/providers/facebook.provider.d.ts +14 -0
  414. package/dist/oauth/providers/facebook.provider.d.ts.map +1 -0
  415. package/dist/oauth/providers/facebook.provider.js +73 -0
  416. package/dist/oauth/providers/facebook.provider.js.map +1 -0
  417. package/dist/oauth/providers/github.provider.d.ts +25 -0
  418. package/dist/oauth/providers/github.provider.d.ts.map +1 -0
  419. package/dist/oauth/providers/github.provider.js +105 -0
  420. package/dist/oauth/providers/github.provider.js.map +1 -0
  421. package/dist/oauth/providers/google.provider.d.ts +15 -0
  422. package/dist/oauth/providers/google.provider.d.ts.map +1 -0
  423. package/dist/oauth/providers/google.provider.js +94 -0
  424. package/dist/oauth/providers/google.provider.js.map +1 -0
  425. package/dist/oauth/providers/microsoft.provider.d.ts +14 -0
  426. package/dist/oauth/providers/microsoft.provider.d.ts.map +1 -0
  427. package/dist/oauth/providers/microsoft.provider.js +81 -0
  428. package/dist/oauth/providers/microsoft.provider.js.map +1 -0
  429. package/dist/profile/dto/change-password.dto.d.ts +5 -0
  430. package/dist/profile/dto/change-password.dto.d.ts.map +1 -0
  431. package/dist/profile/dto/change-password.dto.js +32 -0
  432. package/dist/profile/dto/change-password.dto.js.map +1 -0
  433. package/dist/profile/dto/email-verification-confirm.dto.d.ts +7 -0
  434. package/dist/profile/dto/email-verification-confirm.dto.d.ts.map +1 -0
  435. package/dist/profile/dto/email-verification-confirm.dto.js +36 -0
  436. package/dist/profile/dto/email-verification-confirm.dto.js.map +1 -0
  437. package/dist/profile/dto/generate-webauthn-registration-options.dto.d.ts +4 -0
  438. package/dist/profile/dto/generate-webauthn-registration-options.dto.d.ts.map +1 -0
  439. package/dist/profile/dto/generate-webauthn-registration-options.dto.js +22 -0
  440. package/dist/profile/dto/generate-webauthn-registration-options.dto.js.map +1 -0
  441. package/dist/profile/dto/regenerate-recovery-codes.dto.d.ts +7 -0
  442. package/dist/profile/dto/regenerate-recovery-codes.dto.d.ts.map +1 -0
  443. package/dist/profile/dto/regenerate-recovery-codes.dto.js +36 -0
  444. package/dist/profile/dto/regenerate-recovery-codes.dto.js.map +1 -0
  445. package/dist/profile/dto/remove-email-mfa.dto.d.ts +5 -0
  446. package/dist/profile/dto/remove-email-mfa.dto.d.ts.map +1 -0
  447. package/dist/profile/dto/remove-email-mfa.dto.js +27 -0
  448. package/dist/profile/dto/remove-email-mfa.dto.js.map +1 -0
  449. package/dist/profile/dto/remove-mfa-with-recovery-code.dto.d.ts +4 -0
  450. package/dist/profile/dto/remove-mfa-with-recovery-code.dto.d.ts.map +1 -0
  451. package/dist/profile/dto/remove-mfa-with-recovery-code.dto.js +22 -0
  452. package/dist/profile/dto/remove-mfa-with-recovery-code.dto.js.map +1 -0
  453. package/dist/profile/dto/remove-mfa.dto.d.ts +7 -0
  454. package/dist/profile/dto/remove-mfa.dto.d.ts.map +1 -0
  455. package/dist/profile/dto/remove-mfa.dto.js +36 -0
  456. package/dist/profile/dto/remove-mfa.dto.js.map +1 -0
  457. package/dist/profile/dto/remove-totp-mfa.dto.d.ts +4 -0
  458. package/dist/profile/dto/remove-totp-mfa.dto.d.ts.map +1 -0
  459. package/dist/profile/dto/remove-totp-mfa.dto.js +22 -0
  460. package/dist/profile/dto/remove-totp-mfa.dto.js.map +1 -0
  461. package/dist/profile/dto/send-email-verification.dto.d.ts +4 -0
  462. package/dist/profile/dto/send-email-verification.dto.d.ts.map +1 -0
  463. package/dist/profile/dto/send-email-verification.dto.js +24 -0
  464. package/dist/profile/dto/send-email-verification.dto.js.map +1 -0
  465. package/dist/profile/dto/set-preferences.dto.d.ts +5 -0
  466. package/dist/profile/dto/set-preferences.dto.d.ts.map +1 -0
  467. package/dist/profile/dto/set-preferences.dto.js +27 -0
  468. package/dist/profile/dto/set-preferences.dto.js.map +1 -0
  469. package/dist/profile/dto/update.dto.d.ts +4 -0
  470. package/dist/profile/dto/update.dto.d.ts.map +1 -0
  471. package/dist/profile/dto/update.dto.js +24 -0
  472. package/dist/profile/dto/update.dto.js.map +1 -0
  473. package/dist/profile/dto/verify-before-add-mfa.dto.d.ts +7 -0
  474. package/dist/profile/dto/verify-before-add-mfa.dto.d.ts.map +1 -0
  475. package/dist/profile/dto/verify-before-add-mfa.dto.js +34 -0
  476. package/dist/profile/dto/verify-before-add-mfa.dto.js.map +1 -0
  477. package/dist/profile/dto/verify-mfa-totp.dto.d.ts +6 -0
  478. package/dist/profile/dto/verify-mfa-totp.dto.d.ts.map +1 -0
  479. package/dist/profile/dto/verify-mfa-totp.dto.js +35 -0
  480. package/dist/profile/dto/verify-mfa-totp.dto.js.map +1 -0
  481. package/dist/profile/dto/verify-webauthn-registration.dto.d.ts +5 -0
  482. package/dist/profile/dto/verify-webauthn-registration.dto.d.ts.map +1 -0
  483. package/dist/profile/dto/verify-webauthn-registration.dto.js +27 -0
  484. package/dist/profile/dto/verify-webauthn-registration.dto.js.map +1 -0
  485. package/dist/profile/dto/verify-webauthn.dto.d.ts +4 -0
  486. package/dist/profile/dto/verify-webauthn.dto.d.ts.map +1 -0
  487. package/dist/profile/dto/verify-webauthn.dto.js +22 -0
  488. package/dist/profile/dto/verify-webauthn.dto.js.map +1 -0
  489. package/dist/profile/profile.controller.d.ts +264 -0
  490. package/dist/profile/profile.controller.d.ts.map +1 -0
  491. package/dist/profile/profile.controller.js +359 -0
  492. package/dist/profile/profile.controller.js.map +1 -0
  493. package/dist/profile/profile.module.d.ts +3 -0
  494. package/dist/profile/profile.module.d.ts.map +1 -0
  495. package/dist/profile/profile.module.js +34 -0
  496. package/dist/profile/profile.module.js.map +1 -0
  497. package/dist/profile/profile.service.d.ts +242 -0
  498. package/dist/profile/profile.service.d.ts.map +1 -0
  499. package/dist/profile/profile.service.js +1158 -0
  500. package/dist/profile/profile.service.js.map +1 -0
  501. package/dist/role/dto/create.dto.d.ts +5 -0
  502. package/dist/role/dto/create.dto.d.ts.map +1 -0
  503. package/dist/role/dto/create.dto.js +22 -0
  504. package/dist/role/dto/create.dto.js.map +1 -0
  505. package/dist/role/dto/update.dto.d.ts +6 -0
  506. package/dist/role/dto/update.dto.d.ts.map +1 -0
  507. package/dist/role/dto/update.dto.js +9 -0
  508. package/dist/role/dto/update.dto.js.map +1 -0
  509. package/dist/role/guards/role.guard.d.ts +11 -0
  510. package/dist/role/guards/role.guard.d.ts.map +1 -0
  511. package/dist/role/guards/role.guard.js +116 -0
  512. package/dist/role/guards/role.guard.js.map +1 -0
  513. package/dist/role/role.controller.d.ts +73 -0
  514. package/dist/role/role.controller.d.ts.map +1 -0
  515. package/dist/role/role.controller.js +183 -0
  516. package/dist/role/role.controller.js.map +1 -0
  517. package/dist/role/role.module.d.ts +3 -0
  518. package/dist/role/role.module.d.ts.map +1 -0
  519. package/dist/role/role.module.js +42 -0
  520. package/dist/role/role.module.js.map +1 -0
  521. package/dist/role/role.service.d.ts +80 -0
  522. package/dist/role/role.service.d.ts.map +1 -0
  523. package/dist/role/role.service.js +241 -0
  524. package/dist/role/role.service.js.map +1 -0
  525. package/dist/route/dto/create.dto.d.ts +6 -0
  526. package/dist/route/dto/create.dto.d.ts.map +1 -0
  527. package/dist/route/dto/create.dto.js +29 -0
  528. package/dist/route/dto/create.dto.js.map +1 -0
  529. package/dist/route/dto/update.dto.d.ts +6 -0
  530. package/dist/route/dto/update.dto.d.ts.map +1 -0
  531. package/dist/route/dto/update.dto.js +31 -0
  532. package/dist/route/dto/update.dto.js.map +1 -0
  533. package/dist/route/route.controller.d.ts +50 -0
  534. package/dist/route/route.controller.d.ts.map +1 -0
  535. package/dist/route/route.controller.js +134 -0
  536. package/dist/route/route.controller.js.map +1 -0
  537. package/dist/route/route.module.d.ts +3 -0
  538. package/dist/route/route.module.d.ts.map +1 -0
  539. package/dist/route/route.module.js +31 -0
  540. package/dist/route/route.module.js.map +1 -0
  541. package/dist/route/route.service.d.ts +54 -0
  542. package/dist/route/route.service.d.ts.map +1 -0
  543. package/dist/route/route.service.js +142 -0
  544. package/dist/route/route.service.js.map +1 -0
  545. package/dist/route/route.service.spec.d.ts +1 -0
  546. package/dist/route/route.service.spec.d.ts.map +1 -0
  547. package/dist/route/route.service.spec.js +262 -0
  548. package/dist/route/route.service.spec.js.map +1 -0
  549. package/dist/screen/dto/create.dto.d.ts +5 -0
  550. package/dist/screen/dto/create.dto.d.ts.map +1 -0
  551. package/dist/screen/dto/create.dto.js +28 -0
  552. package/dist/screen/dto/create.dto.js.map +1 -0
  553. package/dist/screen/dto/update.dto.d.ts +7 -0
  554. package/dist/screen/dto/update.dto.d.ts.map +1 -0
  555. package/dist/screen/dto/update.dto.js +38 -0
  556. package/dist/screen/dto/update.dto.js.map +1 -0
  557. package/dist/screen/screen.controller.d.ts +67 -0
  558. package/dist/screen/screen.controller.d.ts.map +1 -0
  559. package/dist/screen/screen.controller.js +137 -0
  560. package/dist/screen/screen.controller.js.map +1 -0
  561. package/dist/screen/screen.module.d.ts +3 -0
  562. package/dist/screen/screen.module.d.ts.map +1 -0
  563. package/dist/screen/screen.module.js +31 -0
  564. package/dist/screen/screen.module.js.map +1 -0
  565. package/dist/screen/screen.service.d.ts +72 -0
  566. package/dist/screen/screen.service.d.ts.map +1 -0
  567. package/dist/screen/screen.service.js +153 -0
  568. package/dist/screen/screen.service.js.map +1 -0
  569. package/dist/screen/screen.service.spec.d.ts +1 -0
  570. package/dist/screen/screen.service.spec.d.ts.map +1 -0
  571. package/dist/screen/screen.service.spec.js +259 -0
  572. package/dist/screen/screen.service.spec.js.map +1 -0
  573. package/dist/security/security.module.d.ts +3 -0
  574. package/dist/security/security.module.d.ts.map +1 -0
  575. package/dist/security/security.module.js +23 -0
  576. package/dist/security/security.module.js.map +1 -0
  577. package/dist/security/security.service.d.ts +18 -0
  578. package/dist/security/security.service.d.ts.map +1 -0
  579. package/dist/security/security.service.js +141 -0
  580. package/dist/security/security.service.js.map +1 -0
  581. package/dist/session/session.controller.d.ts +33 -0
  582. package/dist/session/session.controller.d.ts.map +1 -0
  583. package/dist/session/session.controller.js +72 -0
  584. package/dist/session/session.controller.js.map +1 -0
  585. package/dist/session/session.module.d.ts +3 -0
  586. package/dist/session/session.module.d.ts.map +1 -0
  587. package/dist/session/session.module.js +39 -0
  588. package/dist/session/session.module.js.map +1 -0
  589. package/dist/session/session.service.d.ts +72 -0
  590. package/dist/session/session.service.d.ts.map +1 -0
  591. package/dist/session/session.service.js +199 -0
  592. package/dist/session/session.service.js.map +1 -0
  593. package/dist/setting/dto/confirm-import.dto.d.ts +7 -0
  594. package/dist/setting/dto/confirm-import.dto.d.ts.map +1 -0
  595. package/dist/setting/dto/confirm-import.dto.js +22 -0
  596. package/dist/setting/dto/confirm-import.dto.js.map +1 -0
  597. package/dist/setting/dto/create.dto.d.ts +9 -0
  598. package/dist/setting/dto/create.dto.d.ts.map +1 -0
  599. package/dist/setting/dto/create.dto.js +40 -0
  600. package/dist/setting/dto/create.dto.js.map +1 -0
  601. package/dist/setting/dto/delete.dto.d.ts +4 -0
  602. package/dist/setting/dto/delete.dto.d.ts.map +1 -0
  603. package/dist/setting/dto/delete.dto.js +23 -0
  604. package/dist/setting/dto/delete.dto.js.map +1 -0
  605. package/dist/setting/dto/export.dto.d.ts +4 -0
  606. package/dist/setting/dto/export.dto.d.ts.map +1 -0
  607. package/dist/setting/dto/export.dto.js +24 -0
  608. package/dist/setting/dto/export.dto.js.map +1 -0
  609. package/dist/setting/dto/import-validation.dto.d.ts +7 -0
  610. package/dist/setting/dto/import-validation.dto.d.ts.map +1 -0
  611. package/dist/setting/dto/import-validation.dto.js +7 -0
  612. package/dist/setting/dto/import-validation.dto.js.map +1 -0
  613. package/dist/setting/dto/setting-user.dto.d.ts +4 -0
  614. package/dist/setting/dto/setting-user.dto.d.ts.map +1 -0
  615. package/dist/setting/dto/setting-user.dto.js +21 -0
  616. package/dist/setting/dto/setting-user.dto.js.map +1 -0
  617. package/dist/setting/dto/setting.dto.d.ts +9 -0
  618. package/dist/setting/dto/setting.dto.d.ts.map +1 -0
  619. package/dist/setting/dto/setting.dto.js +34 -0
  620. package/dist/setting/dto/setting.dto.js.map +1 -0
  621. package/dist/setting/dto/update.dto.d.ts +6 -0
  622. package/dist/setting/dto/update.dto.d.ts.map +1 -0
  623. package/dist/setting/dto/update.dto.js +9 -0
  624. package/dist/setting/dto/update.dto.js.map +1 -0
  625. package/dist/setting/setting.controller.d.ts +126 -0
  626. package/dist/setting/setting.controller.d.ts.map +1 -0
  627. package/dist/setting/setting.controller.js +206 -0
  628. package/dist/setting/setting.controller.js.map +1 -0
  629. package/dist/setting/setting.module.d.ts +3 -0
  630. package/dist/setting/setting.module.d.ts.map +1 -0
  631. package/dist/setting/setting.module.js +34 -0
  632. package/dist/setting/setting.module.js.map +1 -0
  633. package/dist/setting/setting.service.d.ts +134 -0
  634. package/dist/setting/setting.service.d.ts.map +1 -0
  635. package/dist/setting/setting.service.js +570 -0
  636. package/dist/setting/setting.service.js.map +1 -0
  637. package/dist/task/task.module.d.ts +3 -0
  638. package/dist/task/task.module.d.ts.map +1 -0
  639. package/dist/task/task.module.js +22 -0
  640. package/dist/task/task.module.js.map +1 -0
  641. package/dist/task/task.service.d.ts +8 -0
  642. package/dist/task/task.service.d.ts.map +1 -0
  643. package/dist/task/task.service.js +75 -0
  644. package/dist/task/task.service.js.map +1 -0
  645. package/dist/token/token.module.d.ts +3 -0
  646. package/dist/token/token.module.d.ts.map +1 -0
  647. package/dist/token/token.module.js +27 -0
  648. package/dist/token/token.module.js.map +1 -0
  649. package/dist/token/token.service.d.ts +31 -0
  650. package/dist/token/token.service.d.ts.map +1 -0
  651. package/dist/token/token.service.js +121 -0
  652. package/dist/token/token.service.js.map +1 -0
  653. package/dist/types/http-method.d.ts +2 -0
  654. package/dist/types/http-method.d.ts.map +1 -0
  655. package/dist/types/http-method.js +3 -0
  656. package/dist/types/http-method.js.map +1 -0
  657. package/dist/types/multer.d.ts +26 -0
  658. package/dist/types/multer.d.ts.map +1 -0
  659. package/dist/types/multer.js +3 -0
  660. package/dist/types/multer.js.map +1 -0
  661. package/dist/user/constants/user.constants.d.ts +2 -0
  662. package/dist/user/constants/user.constants.d.ts.map +1 -0
  663. package/dist/user/constants/user.constants.js +5 -0
  664. package/dist/user/constants/user.constants.js.map +1 -0
  665. package/dist/user/dto/create-with-email-and-password.dto.d.ts +8 -0
  666. package/dist/user/dto/create-with-email-and-password.dto.d.ts.map +1 -0
  667. package/dist/user/dto/create-with-email-and-password.dto.js +39 -0
  668. package/dist/user/dto/create-with-email-and-password.dto.js.map +1 -0
  669. package/dist/user/dto/update.dto.d.ts +4 -0
  670. package/dist/user/dto/update.dto.d.ts.map +1 -0
  671. package/dist/user/dto/update.dto.js +23 -0
  672. package/dist/user/dto/update.dto.js.map +1 -0
  673. package/dist/user/user.controller.d.ts +115 -0
  674. package/dist/user/user.controller.d.ts.map +1 -0
  675. package/dist/user/user.controller.js +123 -0
  676. package/dist/user/user.controller.js.map +1 -0
  677. package/dist/user/user.module.d.ts +3 -0
  678. package/dist/user/user.module.d.ts.map +1 -0
  679. package/dist/user/user.module.js +47 -0
  680. package/dist/user/user.module.js.map +1 -0
  681. package/dist/user/user.service.d.ts +191 -0
  682. package/dist/user/user.service.d.ts.map +1 -0
  683. package/dist/user/user.service.js +243 -0
  684. package/dist/user/user.service.js.map +1 -0
  685. package/dist/user/user.service.spec.d.ts +1 -0
  686. package/dist/user/user.service.spec.d.ts.map +1 -0
  687. package/dist/user/user.service.spec.js +261 -0
  688. package/dist/user/user.service.spec.js.map +1 -0
  689. package/dist/utils/locale-context.d.ts +8 -0
  690. package/dist/utils/locale-context.d.ts.map +1 -0
  691. package/dist/utils/locale-context.js +11 -0
  692. package/dist/utils/locale-context.js.map +1 -0
  693. package/dist/validators/is-email-with-settings.validator.d.ts +10 -0
  694. package/dist/validators/is-email-with-settings.validator.d.ts.map +1 -0
  695. package/dist/validators/is-email-with-settings.validator.js +80 -0
  696. package/dist/validators/is-email-with-settings.validator.js.map +1 -0
  697. package/dist/validators/is-pin-code-with-setting.validator.d.ts +11 -0
  698. package/dist/validators/is-pin-code-with-setting.validator.d.ts.map +1 -0
  699. package/dist/validators/is-pin-code-with-setting.validator.js +73 -0
  700. package/dist/validators/is-pin-code-with-setting.validator.js.map +1 -0
  701. package/dist/validators/is-strong-password-with-settings.validator.d.ts +12 -0
  702. package/dist/validators/is-strong-password-with-settings.validator.d.ts.map +1 -0
  703. package/dist/validators/is-strong-password-with-settings.validator.js +108 -0
  704. package/dist/validators/is-strong-password-with-settings.validator.js.map +1 -0
  705. package/hedhog/data/dashboard.yaml +1 -0
  706. package/hedhog/data/dashboard_component.yaml +28 -0
  707. package/hedhog/data/dashboard_item.yaml +40 -0
  708. package/hedhog/data/file_mimetype.yaml +27 -0
  709. package/hedhog/data/file_provider.yaml +12 -0
  710. package/hedhog/data/locale.yaml +6 -0
  711. package/hedhog/data/mail.yaml +192 -0
  712. package/hedhog/data/menu.yaml +41 -0
  713. package/hedhog/data/role.yaml +21 -0
  714. package/hedhog/data/route.yaml +802 -0
  715. package/hedhog/data/setting_group.yaml +996 -0
  716. package/hedhog/data/translation_namespace.yaml +33 -0
  717. package/hedhog/query/user_mfa_challenge_active_idx.sql +4 -0
  718. package/hedhog/query/user_mfa_validate_triggers.sql +56 -0
  719. package/hedhog/table/dashboard.yaml +11 -0
  720. package/hedhog/table/dashboard_component.yaml +39 -0
  721. package/hedhog/table/dashboard_item.yaml +24 -0
  722. package/hedhog/table/dashboard_user.yaml +24 -0
  723. package/hedhog/table/file.yaml +23 -0
  724. package/hedhog/table/file_mimetype.yaml +5 -0
  725. package/hedhog/table/file_provider.yaml +10 -0
  726. package/hedhog/table/locale.yaml +15 -0
  727. package/hedhog/table/mail.yaml +15 -0
  728. package/hedhog/table/mail_sent.yaml +21 -0
  729. package/hedhog/table/mail_var.yaml +12 -0
  730. package/hedhog/table/menu.yaml +25 -0
  731. package/hedhog/table/menu_screen.yaml +16 -0
  732. package/hedhog/table/role.yaml +18 -0
  733. package/hedhog/table/role_menu.yaml +18 -0
  734. package/hedhog/table/role_route.yaml +18 -0
  735. package/hedhog/table/role_screen.yaml +18 -0
  736. package/hedhog/table/role_user.yaml +18 -0
  737. package/hedhog/table/route.yaml +22 -0
  738. package/hedhog/table/route_screen.yaml +18 -0
  739. package/hedhog/table/screen.yaml +20 -0
  740. package/hedhog/table/setting.yaml +54 -0
  741. package/hedhog/table/setting_group.yaml +20 -0
  742. package/hedhog/table/setting_list.yaml +16 -0
  743. package/hedhog/table/setting_user.yaml +21 -0
  744. package/hedhog/table/translation.yaml +24 -0
  745. package/hedhog/table/translation_namespace.yaml +5 -0
  746. package/hedhog/table/user.yaml +23 -0
  747. package/hedhog/table/user_account.yaml +29 -0
  748. package/hedhog/table/user_activity.yaml +13 -0
  749. package/hedhog/table/user_credential.yaml +24 -0
  750. package/hedhog/table/user_identifier.yaml +23 -0
  751. package/hedhog/table/user_mfa.yaml +23 -0
  752. package/hedhog/table/user_mfa_challenge.yaml +19 -0
  753. package/hedhog/table/user_mfa_email.yaml +11 -0
  754. package/hedhog/table/user_mfa_phone.yaml +11 -0
  755. package/hedhog/table/user_mfa_totp.yaml +12 -0
  756. package/hedhog/table/user_mfa_webauthn.yaml +19 -0
  757. package/hedhog/table/user_recovery_code.yaml +16 -0
  758. package/hedhog/table/user_session.yaml +18 -0
  759. package/package.json +72 -0
  760. package/src/auth/auth.controller.ts +215 -0
  761. package/src/auth/auth.module.ts +106 -0
  762. package/src/auth/auth.service.ts +554 -0
  763. package/src/auth/consts/body.ts +27 -0
  764. package/src/auth/dto/change.dto.ts +36 -0
  765. package/src/auth/dto/create-user.dto.ts +37 -0
  766. package/src/auth/dto/email.dto.ts +16 -0
  767. package/src/auth/dto/forget.dto.ts +13 -0
  768. package/src/auth/dto/login-with-code.dto.ts +14 -0
  769. package/src/auth/dto/login-with-recovery-code.ts +10 -0
  770. package/src/auth/dto/login.dto.ts +33 -0
  771. package/src/auth/dto/resend-mfa-code.dto.ts +6 -0
  772. package/src/auth/dto/reset.dto.ts +13 -0
  773. package/src/auth/enums/multifactor-type.enum.ts +4 -0
  774. package/src/auth/guards/auth.guard.ts +59 -0
  775. package/src/challenge/challenge.module.ts +20 -0
  776. package/src/challenge/challenge.service.ts +327 -0
  777. package/src/core/system.controller.ts +15 -0
  778. package/src/core/system.module.ts +17 -0
  779. package/src/core/system.service.ts +296 -0
  780. package/src/core.module.ts +89 -0
  781. package/src/dashboard/dashboard/dashboard.controller.ts +49 -0
  782. package/src/dashboard/dashboard/dashboard.module.ts +13 -0
  783. package/src/dashboard/dashboard/dashboard.service.ts +71 -0
  784. package/src/dashboard/dashboard/dto/create.dto.ts +8 -0
  785. package/src/dashboard/dashboard/dto/update.dto.ts +4 -0
  786. package/src/dashboard/dashboard-component/dashboard-component.controller.ts +55 -0
  787. package/src/dashboard/dashboard-component/dashboard-component.module.ts +14 -0
  788. package/src/dashboard/dashboard-component/dashboard-component.service.ts +70 -0
  789. package/src/dashboard/dashboard-component/dto/create.dto.ts +36 -0
  790. package/src/dashboard/dashboard-component/dto/update.dto.ts +4 -0
  791. package/src/dashboard/dashboard-core/dashboard-core.controller.ts +13 -0
  792. package/src/dashboard/dashboard-core/dashboard-core.module.ts +14 -0
  793. package/src/dashboard/dashboard-core/dashboard-core.service.ts +27 -0
  794. package/src/dashboard/dashboard-item/dashboard-item.controller.ts +55 -0
  795. package/src/dashboard/dashboard-item/dashboard-item.module.ts +13 -0
  796. package/src/dashboard/dashboard-item/dashboard-item.service.ts +82 -0
  797. package/src/dashboard/dashboard-item/dto/create.dto.ts +22 -0
  798. package/src/dashboard/dashboard-item/dto/update.dto.ts +4 -0
  799. package/src/dashboard/dashboard-user/dashboard-user.controller.ts +55 -0
  800. package/src/dashboard/dashboard-user/dashboard-user.module.ts +13 -0
  801. package/src/dashboard/dashboard-user/dashboard-user.service.ts +89 -0
  802. package/src/dashboard/dashboard-user/dto/create.dto.ts +22 -0
  803. package/src/dashboard/dashboard-user/dto/update.dto.ts +4 -0
  804. package/src/dashboard/dashboard.module.ts +24 -0
  805. package/src/dashboard/index.ts +1 -0
  806. package/src/decorators/inject-locale.decorator.ts +17 -0
  807. package/src/dto/delete.dto.ts +8 -0
  808. package/src/dto/update-ids.dto.ts +12 -0
  809. package/src/emails/index.ts +2 -0
  810. package/src/emails/lib.ts +70 -0
  811. package/src/emails/templates.ts +73 -0
  812. package/src/file/dto/delete.dto.ts +8 -0
  813. package/src/file/dto/upload.dto.ts +7 -0
  814. package/src/file/file.controller.ts +78 -0
  815. package/src/file/file.module.ts +29 -0
  816. package/src/file/file.service.ts +339 -0
  817. package/src/file/provider/abstract.provider.ts +43 -0
  818. package/src/file/provider/azure.provider.ts +174 -0
  819. package/src/file/provider/gcs.provider.ts +108 -0
  820. package/src/file/provider/local.provider.ts +141 -0
  821. package/src/file/provider/provider.enum.ts +6 -0
  822. package/src/file/provider/provider.factory.ts +21 -0
  823. package/src/file/provider/s3.provider.ts +204 -0
  824. package/src/index.ts +26 -0
  825. package/src/install/dto/generate-migration.dto.ts +31 -0
  826. package/src/install/dto/install.dto.ts +27 -0
  827. package/src/install/install.controller.ts +26 -0
  828. package/src/install/install.module.ts +19 -0
  829. package/src/install/install.service.ts +345 -0
  830. package/src/language/en.json +112 -0
  831. package/src/language/pt.json +112 -0
  832. package/src/mail/dto/create.dto.ts +40 -0
  833. package/src/mail/dto/send.dto.ts +14 -0
  834. package/src/mail/dto/test-mail.dto.ts +19 -0
  835. package/src/mail/dto/update.dto.ts +4 -0
  836. package/src/mail/mail.controller.ts +67 -0
  837. package/src/mail/mail.module.ts +107 -0
  838. package/src/mail/mail.service.ts +371 -0
  839. package/src/mail-sent/dto/create.dto.ts +43 -0
  840. package/src/mail-sent/dto/update.dto.ts +4 -0
  841. package/src/mail-sent/mail-sent.controller.ts +55 -0
  842. package/src/mail-sent/mail-sent.module.ts +13 -0
  843. package/src/mail-sent/mail-sent.service.ts +103 -0
  844. package/src/mail-var/dto/create.dto.ts +9 -0
  845. package/src/mail-var/dto/update.dto.ts +4 -0
  846. package/src/mail-var/mail-var.controller.ts +55 -0
  847. package/src/mail-var/mail-var.module.ts +13 -0
  848. package/src/mail-var/mail-var.service.ts +78 -0
  849. package/src/menu/dto/create.dto.ts +26 -0
  850. package/src/menu/dto/order.dto.ts +8 -0
  851. package/src/menu/dto/update.dto.ts +20 -0
  852. package/src/menu/menu.controller.ts +105 -0
  853. package/src/menu/menu.module.ts +18 -0
  854. package/src/menu/menu.service.spec.ts +247 -0
  855. package/src/menu/menu.service.ts +264 -0
  856. package/src/middlewares/locale-injection.middleware.ts +15 -0
  857. package/src/oauth/interfaces/OAuthProvider.ts +5 -0
  858. package/src/oauth/oauth.controller.ts +116 -0
  859. package/src/oauth/oauth.module.ts +36 -0
  860. package/src/oauth/oauth.service.ts +364 -0
  861. package/src/oauth/providers/abstract.provider.ts +50 -0
  862. package/src/oauth/providers/facebook.provider.ts +69 -0
  863. package/src/oauth/providers/github.provider.ts +113 -0
  864. package/src/oauth/providers/google.provider.ts +108 -0
  865. package/src/oauth/providers/microsoft.provider.ts +76 -0
  866. package/src/profile/dto/change-password.dto.ts +16 -0
  867. package/src/profile/dto/email-verification-confirm.dto.ts +19 -0
  868. package/src/profile/dto/generate-webauthn-registration-options.dto.ts +7 -0
  869. package/src/profile/dto/regenerate-recovery-codes.dto.ts +18 -0
  870. package/src/profile/dto/remove-email-mfa.dto.ts +11 -0
  871. package/src/profile/dto/remove-mfa-with-recovery-code.dto.ts +7 -0
  872. package/src/profile/dto/remove-mfa.dto.ts +18 -0
  873. package/src/profile/dto/remove-totp-mfa.dto.ts +7 -0
  874. package/src/profile/dto/send-email-verification.dto.ts +9 -0
  875. package/src/profile/dto/set-preferences.dto.ts +11 -0
  876. package/src/profile/dto/update.dto.ts +10 -0
  877. package/src/profile/dto/verify-before-add-mfa.dto.ts +16 -0
  878. package/src/profile/dto/verify-mfa-totp.dto.ts +19 -0
  879. package/src/profile/dto/verify-webauthn-registration.dto.ts +11 -0
  880. package/src/profile/dto/verify-webauthn.dto.ts +7 -0
  881. package/src/profile/profile.controller.ts +201 -0
  882. package/src/profile/profile.module.ts +21 -0
  883. package/src/profile/profile.service.ts +1331 -0
  884. package/src/role/dto/create.dto.ts +7 -0
  885. package/src/role/dto/update.dto.ts +4 -0
  886. package/src/role/guards/role.guard.ts +121 -0
  887. package/src/role/role.controller.ts +126 -0
  888. package/src/role/role.module.ts +29 -0
  889. package/src/role/role.service.ts +289 -0
  890. package/src/route/dto/create.dto.ts +14 -0
  891. package/src/route/dto/update.dto.ts +16 -0
  892. package/src/route/route.controller.ts +91 -0
  893. package/src/route/route.module.ts +18 -0
  894. package/src/route/route.service.spec.ts +300 -0
  895. package/src/route/route.service.ts +164 -0
  896. package/src/screen/dto/create.dto.ts +12 -0
  897. package/src/screen/dto/update.dto.ts +20 -0
  898. package/src/screen/screen.controller.ts +93 -0
  899. package/src/screen/screen.module.ts +18 -0
  900. package/src/screen/screen.service.spec.ts +298 -0
  901. package/src/screen/screen.service.ts +179 -0
  902. package/src/security/security.module.ts +10 -0
  903. package/src/security/security.service.ts +103 -0
  904. package/src/session/session.controller.ts +35 -0
  905. package/src/session/session.module.ts +26 -0
  906. package/src/session/session.service.ts +207 -0
  907. package/src/setting/dto/confirm-import.dto.ts +7 -0
  908. package/src/setting/dto/create.dto.ts +21 -0
  909. package/src/setting/dto/delete.dto.ts +8 -0
  910. package/src/setting/dto/export.dto.ts +11 -0
  911. package/src/setting/dto/import-validation.dto.ts +6 -0
  912. package/src/setting/dto/setting-user.dto.ts +6 -0
  913. package/src/setting/dto/setting.dto.ts +17 -0
  914. package/src/setting/dto/update.dto.ts +4 -0
  915. package/src/setting/setting.controller.ts +136 -0
  916. package/src/setting/setting.module.ts +21 -0
  917. package/src/setting/setting.service.ts +673 -0
  918. package/src/task/task.module.ts +9 -0
  919. package/src/task/task.service.ts +55 -0
  920. package/src/token/token.module.ts +14 -0
  921. package/src/token/token.service.ts +110 -0
  922. package/src/types/http-method.ts +8 -0
  923. package/src/types/multer.d.ts +28 -0
  924. package/src/types/multer.ts +28 -0
  925. package/src/user/constants/user.constants.ts +1 -0
  926. package/src/user/dto/create-with-email-and-password.dto.ts +21 -0
  927. package/src/user/dto/update.dto.ts +11 -0
  928. package/src/user/user.controller.ts +87 -0
  929. package/src/user/user.module.ts +34 -0
  930. package/src/user/user.service.spec.ts +294 -0
  931. package/src/user/user.service.ts +269 -0
  932. package/src/utils/locale-context.ts +12 -0
  933. package/src/validators/is-email-with-settings.validator.ts +82 -0
  934. package/src/validators/is-pin-code-with-setting.validator.ts +81 -0
  935. package/src/validators/is-strong-password-with-settings.validator.ts +125 -0
@@ -0,0 +1,1158 @@
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
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
45
+ return function (target, key) { decorator(target, key, paramIndex); }
46
+ };
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ exports.ProfileService = void 0;
49
+ const api_locale_1 = require("@hed-hog/api-locale");
50
+ const api_prisma_1 = require("@hed-hog/api-prisma");
51
+ const common_1 = require("@nestjs/common");
52
+ const jwt_1 = require("@nestjs/jwt");
53
+ const server_1 = require("@simplewebauthn/server");
54
+ const qrcode = __importStar(require("qrcode"));
55
+ const speakeasy = __importStar(require("speakeasy"));
56
+ const challenge_service_1 = require("../challenge/challenge.service");
57
+ const security_service_1 = require("../security/security.service");
58
+ const setting_service_1 = require("../setting/setting.service");
59
+ const token_service_1 = require("../token/token.service");
60
+ const user_service_1 = require("../user/user.service");
61
+ let ProfileService = class ProfileService {
62
+ constructor(prisma, user, jwt, setting, security, challenge, token) {
63
+ this.prisma = prisma;
64
+ this.user = user;
65
+ this.jwt = jwt;
66
+ this.setting = setting;
67
+ this.security = security;
68
+ this.challenge = challenge;
69
+ this.token = token;
70
+ this.settings = {};
71
+ }
72
+ async updatePreferences(locale, userId, { theme, language }) {
73
+ if (theme) {
74
+ await this.setting.setSettingUserValue(locale, userId, 'theme-mode', theme);
75
+ }
76
+ if (language) {
77
+ await this.setting.setSettingUserValue(locale, userId, 'language', language);
78
+ }
79
+ return { success: true };
80
+ }
81
+ async onModuleInit() {
82
+ this.settings = await this.setting.getSettingValues([
83
+ 'mfa-issuer',
84
+ 'mfa-window',
85
+ 'mfa-setp',
86
+ 'system-name',
87
+ 'google_client_id',
88
+ 'google_client_secret',
89
+ 'google_scopes',
90
+ 'url',
91
+ 'mfa-challenge-expiration-minutes',
92
+ 'access-token-expiration-minutes'
93
+ ]);
94
+ }
95
+ async confirmEmailVerification(locale, userId, { pin, hash, name, email }) {
96
+ const challenge = await this.challenge.verifyCode(locale, userId, pin, hash, name, email);
97
+ const updatedUser = await this.prisma.user.findFirst({ where: { id: userId } });
98
+ const codes = await this.createMfaRecoveryCodes(updatedUser.id);
99
+ const newToken = await this.getToken(updatedUser);
100
+ return Object.assign(Object.assign({}, newToken), { challenge, codes });
101
+ }
102
+ async sendEmailVerification(locale, userId, { email }) {
103
+ const { codeHash } = await this.challenge.verifyEmail(locale, userId, email);
104
+ return { codeHash };
105
+ }
106
+ async sendCodeToRemove(locale, userId, email) {
107
+ return this.challenge.verifyEmail(locale, userId, email);
108
+ }
109
+ async getEmailIdentifier(userId) {
110
+ return this.prisma.user_identifier.findFirst({
111
+ where: { user_id: userId, type: 'email' },
112
+ });
113
+ }
114
+ async getProfile(userId) {
115
+ return this.prisma.user.findUnique({
116
+ where: { id: userId },
117
+ });
118
+ }
119
+ async getMFAMethods(userId) {
120
+ return this.prisma.user_mfa.findMany({
121
+ where: { user_id: userId },
122
+ include: {
123
+ user_mfa_email: true,
124
+ user_mfa_totp: true,
125
+ user_mfa_webauthn: true,
126
+ },
127
+ });
128
+ }
129
+ async updateMFA(userId, mfaId, { name }) {
130
+ return this.prisma.user_mfa.update({
131
+ where: { user_id: userId, id: mfaId },
132
+ data: { name }
133
+ });
134
+ }
135
+ async update(userid, { name }) {
136
+ return this.prisma.user.update({
137
+ where: { id: userid },
138
+ data: {
139
+ name,
140
+ },
141
+ });
142
+ }
143
+ async updateAvatar(userId, file) {
144
+ return this.user.changeAvatar(userId, file);
145
+ }
146
+ async changePassword(locale, userId, { currentPassword, newPassword }) {
147
+ const credential = await this.prisma.user_credential.findFirst({
148
+ where: { user_id: userId, type: 'password' },
149
+ });
150
+ if (!credential) {
151
+ throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('userNotFound', locale, 'User not found.'));
152
+ }
153
+ const isValidPassowrd = await this.security.validatePassword(locale, [credential], currentPassword);
154
+ if (!isValidPassowrd) {
155
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('accessDenied', locale, 'Access denied.'));
156
+ }
157
+ const passwordHash = await this.security.hashArgon2(newPassword);
158
+ await this.prisma.user_credential.update({
159
+ where: { id: credential.id },
160
+ data: { hash: passwordHash },
161
+ });
162
+ return { success: true };
163
+ }
164
+ generateRecoveryCodes(count = 10) {
165
+ const codes = Array.from({ length: count }, () => {
166
+ const array = new Uint8Array(4);
167
+ globalThis.crypto.getRandomValues(array);
168
+ return Array.from(array)
169
+ .map((b) => b.toString(16).padStart(2, '0'))
170
+ .join('');
171
+ });
172
+ return codes;
173
+ }
174
+ async createMfaRecoveryCodes(userId) {
175
+ const codes = this.generateRecoveryCodes();
176
+ await this.prisma.user_recovery_code.deleteMany({
177
+ where: {
178
+ user_id: userId,
179
+ },
180
+ });
181
+ const data = await Promise.all(codes.map(async (code) => ({
182
+ user_id: userId,
183
+ hash: await this.security.hashArgon2(code),
184
+ })));
185
+ await this.prisma.user_recovery_code.createMany({ data });
186
+ return codes;
187
+ }
188
+ async getToken(user) {
189
+ return { token: this.jwt.sign(user) };
190
+ }
191
+ async verifyMfaTotp(userId, token, secret, name) {
192
+ var _a, _b;
193
+ const window = (_a = this.settings['mfa-window']) !== null && _a !== void 0 ? _a : 0;
194
+ const step = (_b = this.settings['mfa-setp']) !== null && _b !== void 0 ? _b : 30;
195
+ const user = await this.prisma.user.findFirst({
196
+ where: { id: userId },
197
+ include: { user_mfa: { include: { user_mfa_totp: true } } }
198
+ });
199
+ if (!user) {
200
+ throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('userNotFound', 'en', 'User not found'));
201
+ }
202
+ const decodedSecret = Buffer.from(secret, 'base64').toString('utf-8');
203
+ const decryptedSecret = this.security.decrypt(decodedSecret);
204
+ const isValid = speakeasy.totp.verify({
205
+ secret: decryptedSecret,
206
+ encoding: 'base32',
207
+ token,
208
+ window,
209
+ step
210
+ });
211
+ if (!isValid) {
212
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('invalidCode', 'en', 'Invalid code'));
213
+ }
214
+ if (name) {
215
+ await this.prisma.user_mfa.create({
216
+ data: {
217
+ name,
218
+ user_id: userId,
219
+ type: 'totp',
220
+ verified_at: new Date(),
221
+ user_mfa_totp: {
222
+ create: {
223
+ secret: Buffer.from(decryptedSecret, 'utf-8'),
224
+ }
225
+ },
226
+ user_mfa_challenge: {
227
+ create: {
228
+ hash: await this.security.hashArgon2(decryptedSecret),
229
+ attempts: 1,
230
+ expires_at: new Date(),
231
+ verified_at: new Date()
232
+ }
233
+ }
234
+ },
235
+ });
236
+ }
237
+ const updatedUser = await this.prisma.user.findFirst({ where: { id: user.id } });
238
+ const codes = await this.createMfaRecoveryCodes(updatedUser.id);
239
+ const newToken = await this.getToken(updatedUser);
240
+ return Object.assign(Object.assign({}, newToken), { codes });
241
+ }
242
+ async generateMfaTotp(locale, userId) {
243
+ var _a, _b;
244
+ const user = await this.prisma.user.findFirst({
245
+ where: { id: userId },
246
+ select: {
247
+ user_mfa: true,
248
+ user_identifier: true
249
+ },
250
+ });
251
+ const issuer = (_a = this.settings['mfa-issuer']) !== null && _a !== void 0 ? _a : 'Hedhog';
252
+ const userEmail = user.user_identifier.find(ui => ui.type === 'email').value;
253
+ const appName = `${issuer} (${userEmail})`;
254
+ const secret = speakeasy.generateSecret({
255
+ length: 32,
256
+ name: appName,
257
+ otpauth: { label: appName, issuer },
258
+ encoding: 'base32',
259
+ });
260
+ const step = (_b = this.settings['mfa-setp']) !== null && _b !== void 0 ? _b : 30;
261
+ const otpauth = speakeasy.otpauthURL({
262
+ secret: secret.base32,
263
+ label: `${issuer}:${userEmail}`,
264
+ issuer,
265
+ period: step,
266
+ encoding: 'base32',
267
+ });
268
+ const qrCode = await qrcode.toDataURL(otpauth);
269
+ const encryptedSecret = this.security.encrypt(secret.base32);
270
+ const encodedSecret = Buffer.from(encryptedSecret, 'utf-8').toString('base64');
271
+ return { otpauthUrl: secret.otpauth_url, qrCode, secret: encodedSecret };
272
+ }
273
+ async removeMfaTotp(userId, mfaId, token) {
274
+ try {
275
+ const user = await this.prisma.user.findFirst({
276
+ where: { id: userId },
277
+ include: { user_identifier: true, user_mfa: { include: { user_mfa_totp: true } } }
278
+ });
279
+ const totpMfa = user.user_mfa.find((m) => m.type === 'totp' && m.user_mfa_totp);
280
+ if (!totpMfa || !totpMfa.user_mfa_totp) {
281
+ throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('totpNotFound', 'en', 'TOTP method not found'));
282
+ }
283
+ const secretBuffer = totpMfa.user_mfa_totp[0].secret;
284
+ const secretBase32 = secretBuffer instanceof Uint8Array
285
+ ? Buffer.from(secretBuffer).toString('utf-8')
286
+ : String(secretBuffer);
287
+ const encryptedSecret = this.security.encrypt(secretBase32);
288
+ const encodedSecret = Buffer.from(encryptedSecret, 'utf-8').toString('base64');
289
+ await this.verifyMfaTotp(user.id, token, encodedSecret);
290
+ await this.prisma.$transaction(async (tx) => {
291
+ await tx.user_mfa.deleteMany({
292
+ where: {
293
+ id: mfaId,
294
+ user_id: userId,
295
+ type: 'totp',
296
+ },
297
+ });
298
+ await tx.user_recovery_code.deleteMany({
299
+ where: {
300
+ user_id: userId,
301
+ },
302
+ });
303
+ });
304
+ return this.getUserToken(userId);
305
+ }
306
+ catch (error) {
307
+ throw new common_1.BadRequestException(`Invalid code: ${error === null || error === void 0 ? void 0 : error.message}`);
308
+ }
309
+ }
310
+ async removeMfaEmail(locale, userId, mfaId, token, providedHash) {
311
+ try {
312
+ await this.challenge.verifyCode(locale, userId, token, providedHash);
313
+ await this.prisma.user_mfa.deleteMany({
314
+ where: { id: mfaId, user_id: userId, type: 'email' },
315
+ });
316
+ return this.getUserToken(userId);
317
+ }
318
+ catch (error) {
319
+ throw new common_1.BadRequestException(`Invalid code: ${error === null || error === void 0 ? void 0 : error.message}`);
320
+ }
321
+ }
322
+ async removeMfaWithRecoveryCode(locale, userId, mfaId, recoveryCode) {
323
+ try {
324
+ const user = await this.prisma.user.findUnique({
325
+ where: { id: userId },
326
+ include: {
327
+ user_recovery_code: true,
328
+ },
329
+ });
330
+ if (!user) {
331
+ throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('userNotFound', 'en', 'User not found'));
332
+ }
333
+ let isValid = false;
334
+ for (const code of user.user_recovery_code) {
335
+ if (await this.security.verifyArgon2(recoveryCode, code.hash)) {
336
+ isValid = true;
337
+ await this.prisma.user_recovery_code.delete({
338
+ where: { id: code.id },
339
+ });
340
+ break;
341
+ }
342
+ }
343
+ if (!isValid) {
344
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('invalidRecoveryCode', locale, 'Invalid recovery code.'));
345
+ }
346
+ await this.prisma.user_mfa.deleteMany({
347
+ where: { id: mfaId, user_id: userId },
348
+ });
349
+ return this.getUserToken(userId);
350
+ }
351
+ catch (error) {
352
+ throw new common_1.BadRequestException(`Invalid code: ${error === null || error === void 0 ? void 0 : error.message}`);
353
+ }
354
+ }
355
+ async removeMfa(locale, userId, mfaId, data) {
356
+ try {
357
+ const user = await this.prisma.user.findUnique({
358
+ where: { id: userId },
359
+ include: {
360
+ user_mfa: {
361
+ where: { id: mfaId, verified_at: { not: null } },
362
+ include: {
363
+ user_mfa_totp: true,
364
+ user_mfa_email: true,
365
+ user_mfa_webauthn: true
366
+ }
367
+ },
368
+ user_recovery_code: true
369
+ }
370
+ });
371
+ if (!user) {
372
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('userNotFound', locale, 'User not found.'));
373
+ }
374
+ const mfaToRemove = user.user_mfa.find(m => m.id === mfaId);
375
+ if (!mfaToRemove) {
376
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('mfaMethodNotFound', locale, 'MFA method not found.'));
377
+ }
378
+ if (data.verificationType !== 'webauthn' && !data.token) {
379
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('verificationCodeRequired', locale, 'Verification code is required.'));
380
+ }
381
+ if (data.verificationType === 'webauthn') {
382
+ if (!data.assertionResponse) {
383
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('assertionResponseRequired', locale, 'Assertion response is required for WebAuthn.'));
384
+ }
385
+ try {
386
+ await this.verifyWebAuthnAuthentication(userId, data.assertionResponse);
387
+ }
388
+ catch (error) {
389
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('invalidWebAuthn', locale, 'WebAuthn verification failed.'));
390
+ }
391
+ }
392
+ else if (data.verificationType === 'recovery') {
393
+ if (!data.token) {
394
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('verificationCodeRequired', locale, 'Verification code is required.'));
395
+ }
396
+ let isValid = false;
397
+ for (const recoveryCode of user.user_recovery_code) {
398
+ if (await this.security.verifyArgon2(data.token, recoveryCode.hash)) {
399
+ isValid = true;
400
+ await this.prisma.user_recovery_code.delete({
401
+ where: { id: recoveryCode.id }
402
+ });
403
+ break;
404
+ }
405
+ }
406
+ if (!isValid) {
407
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('invalidRecoveryCode', locale, 'Invalid recovery code.'));
408
+ }
409
+ }
410
+ else if (data.verificationType === 'email' || mfaToRemove.type === 'email') {
411
+ if (!data.token) {
412
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('verificationCodeRequired', locale, 'Verification code is required.'));
413
+ }
414
+ try {
415
+ const isValid = await this.challenge.verifyMfaEmailCode(locale, userId, data.token);
416
+ if (!isValid) {
417
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('invalidVerificationCode', locale, 'Invalid verification code.'));
418
+ }
419
+ }
420
+ catch (error) {
421
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('invalidVerificationCode', locale, 'Invalid verification code.'));
422
+ }
423
+ }
424
+ else if (data.verificationType === 'totp' || mfaToRemove.type === 'totp') {
425
+ const totpMfa = user.user_mfa.find(m => m.type === 'totp' && m.user_mfa_totp);
426
+ if (!totpMfa || !totpMfa.user_mfa_totp || !totpMfa.user_mfa_totp[0]) {
427
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('totpMfaNotFound', locale, 'TOTP MFA not found.'));
428
+ }
429
+ const secretBuffer = totpMfa.user_mfa_totp[0].secret;
430
+ const secretBase32 = secretBuffer instanceof Uint8Array
431
+ ? Buffer.from(secretBuffer).toString('utf-8')
432
+ : String(secretBuffer);
433
+ const encryptedSecret = this.security.encrypt(secretBase32);
434
+ const encodedSecret = Buffer.from(encryptedSecret, 'utf-8').toString('base64');
435
+ try {
436
+ await this.verifyMfaTotp(userId, data.token, encodedSecret);
437
+ }
438
+ catch (error) {
439
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('invalidVerificationCode', locale, 'Invalid verification code.'));
440
+ }
441
+ }
442
+ await this.prisma.user_mfa.deleteMany({
443
+ where: { id: mfaId, user_id: userId },
444
+ });
445
+ return this.getUserToken(userId);
446
+ }
447
+ catch (error) {
448
+ throw new common_1.BadRequestException(`Failed to remove MFA: ${error === null || error === void 0 ? void 0 : error.message}`);
449
+ }
450
+ }
451
+ async checkMfaBeforeAdd(locale, userId) {
452
+ try {
453
+ const mfaMethods = await this.prisma.user_mfa.findMany({
454
+ where: {
455
+ user_id: userId,
456
+ verified_at: { not: null }
457
+ },
458
+ include: {
459
+ user_mfa_totp: true,
460
+ user_mfa_email: true,
461
+ user_mfa_webauthn: true
462
+ }
463
+ });
464
+ if (mfaMethods.length === 0) {
465
+ return { requiresVerification: false };
466
+ }
467
+ const totpMfa = mfaMethods.find(m => m.type === 'totp' && m.user_mfa_totp);
468
+ const emailMfas = mfaMethods.filter(m => m.type === 'email' && m.user_mfa_email && m.user_mfa_email.length > 0);
469
+ const webauthnMfa = mfaMethods.find(m => m.type === 'webauthn' && m.user_mfa_webauthn);
470
+ const availableMethods = [];
471
+ if (totpMfa) {
472
+ availableMethods.push('totp');
473
+ }
474
+ if (emailMfas.length > 0) {
475
+ const emails = emailMfas.map(mfa => mfa.user_mfa_email[0].email);
476
+ await this.challenge.sendMfaCodeToMultipleEmails(locale, userId, emails);
477
+ availableMethods.push('email');
478
+ }
479
+ if (availableMethods.length === 0 && !webauthnMfa) {
480
+ return { requiresVerification: false };
481
+ }
482
+ if (availableMethods.length === 0 && webauthnMfa) {
483
+ return {
484
+ requiresVerification: true,
485
+ availableMethods: [],
486
+ hasWebAuthn: true,
487
+ hasRecoveryCodes: true,
488
+ };
489
+ }
490
+ if (availableMethods.length === 2) {
491
+ return {
492
+ requiresVerification: true,
493
+ availableMethods,
494
+ hasWebAuthn: !!webauthnMfa,
495
+ hasRecoveryCodes: true,
496
+ };
497
+ }
498
+ return {
499
+ requiresVerification: true,
500
+ verificationType: availableMethods[0],
501
+ hasWebAuthn: !!webauthnMfa,
502
+ hasRecoveryCodes: true,
503
+ };
504
+ }
505
+ catch (error) {
506
+ throw new common_1.BadRequestException(`Failed to check MFA: ${error === null || error === void 0 ? void 0 : error.message}`);
507
+ }
508
+ }
509
+ async checkMfaBeforeRemove(locale, userId) {
510
+ try {
511
+ const mfaMethods = await this.prisma.user_mfa.findMany({
512
+ where: {
513
+ user_id: userId,
514
+ verified_at: { not: null }
515
+ },
516
+ include: {
517
+ user_mfa_totp: true,
518
+ user_mfa_email: true,
519
+ user_mfa_webauthn: true
520
+ }
521
+ });
522
+ if (mfaMethods.length === 0) {
523
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('noMfaMethodsFound', locale, 'No MFA methods found.'));
524
+ }
525
+ const totpMfa = mfaMethods.find(m => m.type === 'totp' && m.user_mfa_totp);
526
+ const emailMfas = mfaMethods.filter(m => m.type === 'email' && m.user_mfa_email && m.user_mfa_email.length > 0);
527
+ const webauthnMfa = mfaMethods.find(m => m.type === 'webauthn' && m.user_mfa_webauthn);
528
+ const availableMethods = [];
529
+ if (totpMfa) {
530
+ availableMethods.push('totp');
531
+ }
532
+ if (emailMfas.length > 0) {
533
+ const emails = emailMfas.map(mfa => mfa.user_mfa_email[0].email);
534
+ await this.challenge.sendMfaCodeToMultipleEmails(locale, userId, emails);
535
+ availableMethods.push('email');
536
+ }
537
+ return {
538
+ requiresVerification: true,
539
+ availableMethods,
540
+ hasWebAuthn: !!webauthnMfa,
541
+ hasRecoveryCodes: mfaMethods.length > 0,
542
+ };
543
+ }
544
+ catch (error) {
545
+ throw new common_1.BadRequestException(`Failed to check MFA before remove: ${error === null || error === void 0 ? void 0 : error.message}`);
546
+ }
547
+ }
548
+ async verifyBeforeAddMfa(locale, userId, data) {
549
+ try {
550
+ const user = await this.prisma.user.findUnique({
551
+ where: { id: userId },
552
+ include: {
553
+ user_mfa: {
554
+ where: { verified_at: { not: null } },
555
+ include: {
556
+ user_mfa_totp: true,
557
+ user_mfa_email: true,
558
+ user_mfa_webauthn: true
559
+ }
560
+ },
561
+ user_recovery_code: true
562
+ }
563
+ });
564
+ if (!user) {
565
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('userNotFound', locale, 'User not found.'));
566
+ }
567
+ if (user.user_mfa.length === 0) {
568
+ return { success: true };
569
+ }
570
+ if (data.verificationType === 'webauthn') {
571
+ if (!data.assertionResponse) {
572
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('assertionResponseRequired', locale, 'Assertion response is required for WebAuthn.'));
573
+ }
574
+ try {
575
+ await this.verifyWebAuthnAuthentication(userId, data.assertionResponse);
576
+ }
577
+ catch (error) {
578
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('invalidWebAuthn', locale, 'WebAuthn verification failed.'));
579
+ }
580
+ }
581
+ else if (data.verificationType === 'recovery') {
582
+ if (!data.verificationCode) {
583
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('verificationCodeRequired', locale, 'Verification code is required.'));
584
+ }
585
+ let isValid = false;
586
+ for (const recoveryCode of user.user_recovery_code) {
587
+ if (await this.security.verifyArgon2(data.verificationCode, recoveryCode.hash)) {
588
+ isValid = true;
589
+ await this.prisma.user_recovery_code.delete({
590
+ where: { id: recoveryCode.id }
591
+ });
592
+ break;
593
+ }
594
+ }
595
+ if (!isValid) {
596
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('invalidRecoveryCode', locale, 'Invalid recovery code.'));
597
+ }
598
+ }
599
+ else if (data.verificationType === 'email') {
600
+ const emailMfa = user.user_mfa.find(m => m.type === 'email' && m.user_mfa_email);
601
+ if (!emailMfa) {
602
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('emailMfaNotFound', locale, 'Email MFA not found.'));
603
+ }
604
+ if (!data.verificationCode) {
605
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('verificationCodeRequired', locale, 'Verification code is required.'));
606
+ }
607
+ try {
608
+ const isValid = await this.challenge.verifyMfaEmailCode(locale, userId, data.verificationCode);
609
+ if (!isValid) {
610
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('invalidVerificationCode', locale, 'Invalid verification code.'));
611
+ }
612
+ }
613
+ catch (error) {
614
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('invalidVerificationCode', locale, 'Invalid verification code.'));
615
+ }
616
+ }
617
+ else {
618
+ const totpMfa = user.user_mfa.find(m => m.type === 'totp' && m.user_mfa_totp);
619
+ if (!totpMfa || !totpMfa.user_mfa_totp[0]) {
620
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('totpMfaNotFound', locale, 'TOTP MFA not found.'));
621
+ }
622
+ const secretBuffer = totpMfa.user_mfa_totp[0].secret;
623
+ const secretBase32 = secretBuffer instanceof Uint8Array
624
+ ? Buffer.from(secretBuffer).toString('utf-8')
625
+ : String(secretBuffer);
626
+ const encryptedSecret = this.security.encrypt(secretBase32);
627
+ const encodedSecret = Buffer.from(encryptedSecret, 'utf-8').toString('base64');
628
+ try {
629
+ await this.verifyMfaTotp(userId, data.verificationCode, encodedSecret);
630
+ }
631
+ catch (error) {
632
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('invalidVerificationCode', locale, 'Invalid verification code.'));
633
+ }
634
+ }
635
+ return { success: true };
636
+ }
637
+ catch (error) {
638
+ throw new common_1.BadRequestException(`Failed to verify MFA: ${error === null || error === void 0 ? void 0 : error.message}`);
639
+ }
640
+ }
641
+ async sendRecoveryCodesVerification(locale, userId) {
642
+ try {
643
+ const mfaMethods = await this.prisma.user_mfa.findMany({
644
+ where: {
645
+ user_id: userId,
646
+ verified_at: { not: null }
647
+ },
648
+ include: {
649
+ user_mfa_totp: true,
650
+ user_mfa_email: true,
651
+ user_mfa_webauthn: true
652
+ }
653
+ });
654
+ if (mfaMethods.length === 0) {
655
+ return { requiresVerification: false };
656
+ }
657
+ const totpMfa = mfaMethods.find(m => m.type === 'totp' && m.user_mfa_totp);
658
+ const emailMfas = mfaMethods.filter(m => m.type === 'email' && m.user_mfa_email && m.user_mfa_email.length > 0);
659
+ const webauthnMfa = mfaMethods.find(m => m.type === 'webauthn' && m.user_mfa_webauthn);
660
+ const availableMethods = [];
661
+ if (totpMfa) {
662
+ availableMethods.push('totp');
663
+ }
664
+ if (emailMfas.length > 0) {
665
+ const emails = emailMfas.map(mfa => mfa.user_mfa_email[0].email);
666
+ await this.challenge.sendMfaCodeToMultipleEmails(locale, userId, emails);
667
+ availableMethods.push('email');
668
+ }
669
+ if (availableMethods.length === 0 && !webauthnMfa) {
670
+ return { requiresVerification: false };
671
+ }
672
+ if (availableMethods.length === 0 && webauthnMfa) {
673
+ return {
674
+ requiresVerification: true,
675
+ availableMethods: [],
676
+ hasWebAuthn: true,
677
+ hasRecoveryCodes: true,
678
+ };
679
+ }
680
+ if (availableMethods.length === 2) {
681
+ return {
682
+ requiresVerification: true,
683
+ availableMethods,
684
+ hasWebAuthn: !!webauthnMfa,
685
+ hasRecoveryCodes: true,
686
+ };
687
+ }
688
+ return {
689
+ requiresVerification: true,
690
+ verificationType: availableMethods[0],
691
+ hasWebAuthn: !!webauthnMfa,
692
+ hasRecoveryCodes: true,
693
+ };
694
+ }
695
+ catch (error) {
696
+ throw new common_1.BadRequestException(`Failed to send verification: ${error === null || error === void 0 ? void 0 : error.message}`);
697
+ }
698
+ }
699
+ async regenerateRecoveryCodes(locale, userId, data) {
700
+ try {
701
+ const user = await this.prisma.user.findUnique({
702
+ where: { id: userId },
703
+ include: {
704
+ user_mfa: {
705
+ where: { verified_at: { not: null } },
706
+ include: {
707
+ user_mfa_totp: true,
708
+ user_mfa_email: true,
709
+ user_mfa_webauthn: true
710
+ }
711
+ },
712
+ user_recovery_code: true
713
+ }
714
+ });
715
+ if (!user) {
716
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('userNotFound', locale, 'User not found.'));
717
+ }
718
+ if (user.user_mfa.length > 0) {
719
+ if (data.verificationType !== 'webauthn' && !data.verificationCode) {
720
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('verificationCodeRequired', locale, 'Verification code is required.'));
721
+ }
722
+ if (data.verificationType === 'webauthn') {
723
+ if (!data.assertionResponse) {
724
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('assertionResponseRequired', locale, 'Assertion response is required for WebAuthn.'));
725
+ }
726
+ try {
727
+ await this.verifyWebAuthnAuthentication(userId, data.assertionResponse);
728
+ }
729
+ catch (error) {
730
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('invalidWebAuthn', locale, 'WebAuthn verification failed.'));
731
+ }
732
+ }
733
+ else if (data.verificationType === 'recovery') {
734
+ if (!data.verificationCode) {
735
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('verificationCodeRequired', locale, 'Verification code is required.'));
736
+ }
737
+ let isValid = false;
738
+ for (const recoveryCode of user.user_recovery_code) {
739
+ if (await this.security.verifyArgon2(data.verificationCode, recoveryCode.hash)) {
740
+ isValid = true;
741
+ await this.prisma.user_recovery_code.delete({
742
+ where: { id: recoveryCode.id }
743
+ });
744
+ break;
745
+ }
746
+ }
747
+ if (!isValid) {
748
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('invalidRecoveryCode', locale, 'Invalid recovery code.'));
749
+ }
750
+ }
751
+ else if (data.verificationType === 'email') {
752
+ const emailMfa = user.user_mfa.find(m => m.type === 'email' && m.user_mfa_email);
753
+ if (!emailMfa) {
754
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('emailMfaNotFound', locale, 'Email MFA not found.'));
755
+ }
756
+ if (!data.verificationCode) {
757
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('verificationCodeRequired', locale, 'Verification code is required.'));
758
+ }
759
+ try {
760
+ const isValid = await this.challenge.verifyMfaEmailCode(locale, userId, data.verificationCode);
761
+ if (!isValid) {
762
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('invalidVerificationCode', locale, 'Invalid verification code.'));
763
+ }
764
+ }
765
+ catch (error) {
766
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('invalidVerificationCode', locale, 'Invalid verification code.'));
767
+ }
768
+ }
769
+ else {
770
+ const totpMfa = user.user_mfa.find(m => m.type === 'totp' && m.user_mfa_totp);
771
+ if (!totpMfa || !totpMfa.user_mfa_totp[0]) {
772
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('totpMfaNotFound', locale, 'TOTP MFA not found.'));
773
+ }
774
+ const secretBuffer = totpMfa.user_mfa_totp[0].secret;
775
+ const secretBase32 = secretBuffer instanceof Uint8Array
776
+ ? Buffer.from(secretBuffer).toString('utf-8')
777
+ : String(secretBuffer);
778
+ const encryptedSecret = this.security.encrypt(secretBase32);
779
+ const encodedSecret = Buffer.from(encryptedSecret, 'utf-8').toString('base64');
780
+ try {
781
+ await this.verifyMfaTotp(userId, data.verificationCode, encodedSecret);
782
+ }
783
+ catch (error) {
784
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('invalidVerificationCode', locale, 'Invalid verification code.'));
785
+ }
786
+ }
787
+ }
788
+ const codes = await this.createMfaRecoveryCodes(userId);
789
+ return { codes };
790
+ }
791
+ catch (error) {
792
+ throw new common_1.BadRequestException(`Failed to regenerate recovery codes: ${error === null || error === void 0 ? void 0 : error.message}`);
793
+ }
794
+ }
795
+ async generateWebAuthnRegistrationOptions(locale, userId, name) {
796
+ var _a;
797
+ try {
798
+ const user = await this.prisma.user.findFirst({
799
+ where: { id: userId },
800
+ include: {
801
+ user_identifier: true,
802
+ user_mfa: {
803
+ where: { type: 'webauthn', verified_at: { not: null } },
804
+ include: { user_mfa_webauthn: true }
805
+ }
806
+ }
807
+ });
808
+ if (!user) {
809
+ throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('userNotFound', locale, 'User not found.'));
810
+ }
811
+ const rpName = this.settings['system-name'] || 'HedHog';
812
+ const rpID = new URL(process.env.FRONTEND_URL || 'http://localhost:3200').hostname;
813
+ const userEmail = ((_a = user.user_identifier.find(ui => ui.type === 'email')) === null || _a === void 0 ? void 0 : _a.value) || `user${userId}@example.com`;
814
+ const existingAuthenticators = user.user_mfa
815
+ .filter(mfa => mfa.user_mfa_webauthn && mfa.user_mfa_webauthn.length > 0)
816
+ .map(mfa => ({
817
+ credentialID: mfa.user_mfa_webauthn[0].credential_id,
818
+ credentialPublicKey: mfa.user_mfa_webauthn[0].public_key,
819
+ counter: mfa.user_mfa_webauthn[0].sign_count,
820
+ }));
821
+ const options = await (0, server_1.generateRegistrationOptions)({
822
+ rpName,
823
+ rpID,
824
+ userName: userEmail,
825
+ userDisplayName: user.name || userEmail,
826
+ attestationType: 'none',
827
+ excludeCredentials: existingAuthenticators.map(auth => ({
828
+ id: Buffer.from(auth.credentialID).toString('base64url'),
829
+ })),
830
+ authenticatorSelection: {
831
+ residentKey: 'preferred',
832
+ userVerification: 'preferred',
833
+ },
834
+ });
835
+ await this.prisma.user_mfa_challenge.create({
836
+ data: {
837
+ user_mfa: {
838
+ create: {
839
+ user_id: userId,
840
+ type: 'webauthn',
841
+ name: name || 'Security Key',
842
+ }
843
+ },
844
+ hash: options.challenge,
845
+ attempts: 0,
846
+ expires_at: new Date(Date.now() + 5 * 60 * 1000),
847
+ }
848
+ });
849
+ return options;
850
+ }
851
+ catch (error) {
852
+ throw new common_1.BadRequestException(`Failed to generate registration options: ${error === null || error === void 0 ? void 0 : error.message}`);
853
+ }
854
+ }
855
+ async verifyWebAuthnRegistration(locale, userId, name, attestationResponse) {
856
+ try {
857
+ const challengeRecord = await this.prisma.user_mfa_challenge.findFirst({
858
+ where: {
859
+ user_mfa: {
860
+ user_id: userId,
861
+ type: 'webauthn',
862
+ verified_at: null,
863
+ },
864
+ expires_at: { gt: new Date() }
865
+ },
866
+ include: { user_mfa: true },
867
+ orderBy: { created_at: 'desc' }
868
+ });
869
+ if (!challengeRecord) {
870
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('challengeNotFound', locale, 'Challenge not found or expired.'));
871
+ }
872
+ const rpID = new URL(process.env.FRONTEND_URL || 'http://localhost:3200').hostname;
873
+ const expectedOrigin = process.env.FRONTEND_URL || 'http://localhost:3200';
874
+ const verification = await (0, server_1.verifyRegistrationResponse)({
875
+ response: attestationResponse,
876
+ expectedChallenge: challengeRecord.hash,
877
+ expectedOrigin,
878
+ expectedRPID: rpID,
879
+ });
880
+ if (!verification.verified || !verification.registrationInfo) {
881
+ throw new common_1.BadRequestException((0, api_locale_1.getLocaleText)('verificationFailed', locale, 'Verification failed.'));
882
+ }
883
+ const { credential } = verification.registrationInfo;
884
+ await this.prisma.user_mfa.update({
885
+ where: { id: challengeRecord.user_mfa_id },
886
+ data: {
887
+ name,
888
+ verified_at: new Date(),
889
+ user_mfa_webauthn: {
890
+ create: {
891
+ credential_id: Buffer.from(credential.id, 'base64url'),
892
+ public_key: credential.publicKey,
893
+ sign_count: credential.counter,
894
+ }
895
+ }
896
+ }
897
+ });
898
+ await this.prisma.user_mfa_challenge.update({
899
+ where: { id: challengeRecord.id },
900
+ data: { verified_at: new Date() }
901
+ });
902
+ const codes = await this.createMfaRecoveryCodes(userId);
903
+ return { success: true, codes };
904
+ }
905
+ catch (error) {
906
+ throw new common_1.BadRequestException(`Failed to verify registration: ${error === null || error === void 0 ? void 0 : error.message}`);
907
+ }
908
+ }
909
+ async generateWebAuthnAuthenticationOptions(locale, userId) {
910
+ try {
911
+ const user = await this.prisma.user.findFirst({
912
+ where: { id: userId },
913
+ include: {
914
+ user_mfa: {
915
+ where: { type: 'webauthn', verified_at: { not: null } },
916
+ include: { user_mfa_webauthn: true }
917
+ }
918
+ }
919
+ });
920
+ if (!user || user.user_mfa.length === 0) {
921
+ throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('webauthnNotConfigured', locale, 'WebAuthn not configured.'));
922
+ }
923
+ const rpID = new URL(process.env.FRONTEND_URL || 'http://localhost:3200').hostname;
924
+ const allowCredentials = user.user_mfa
925
+ .filter(mfa => mfa.user_mfa_webauthn && mfa.user_mfa_webauthn.length > 0)
926
+ .map(mfa => ({
927
+ id: Buffer.from(mfa.user_mfa_webauthn[0].credential_id).toString('base64url'),
928
+ }));
929
+ const options = await (0, server_1.generateAuthenticationOptions)({
930
+ rpID,
931
+ allowCredentials,
932
+ userVerification: 'preferred',
933
+ });
934
+ await this.prisma.user_mfa_challenge.create({
935
+ data: {
936
+ user_mfa_id: user.user_mfa[0].id,
937
+ hash: options.challenge,
938
+ attempts: 0,
939
+ expires_at: new Date(Date.now() + 5 * 60 * 1000),
940
+ }
941
+ });
942
+ return options;
943
+ }
944
+ catch (error) {
945
+ throw new common_1.BadRequestException(`Failed to generate authentication options: ${error === null || error === void 0 ? void 0 : error.message}`);
946
+ }
947
+ }
948
+ async verifyWebAuthnAuthentication(userId, assertionResponse) {
949
+ try {
950
+ const challengeRecord = await this.prisma.user_mfa_challenge.findFirst({
951
+ where: {
952
+ user_mfa: {
953
+ user_id: userId,
954
+ type: 'webauthn',
955
+ verified_at: { not: null },
956
+ },
957
+ verified_at: null,
958
+ expires_at: { gt: new Date() }
959
+ },
960
+ include: {
961
+ user_mfa: {
962
+ include: { user_mfa_webauthn: true }
963
+ }
964
+ },
965
+ orderBy: { created_at: 'desc' }
966
+ });
967
+ if (!challengeRecord || !challengeRecord.user_mfa.user_mfa_webauthn[0]) {
968
+ throw new common_1.BadRequestException('Challenge not found or expired.');
969
+ }
970
+ const authenticator = challengeRecord.user_mfa.user_mfa_webauthn[0];
971
+ const rpID = new URL(process.env.FRONTEND_URL || 'http://localhost:3200').hostname;
972
+ const expectedOrigin = process.env.FRONTEND_URL || 'http://localhost:3200';
973
+ const verification = await (0, server_1.verifyAuthenticationResponse)({
974
+ response: assertionResponse,
975
+ expectedChallenge: challengeRecord.hash,
976
+ expectedOrigin,
977
+ expectedRPID: rpID,
978
+ credential: {
979
+ id: Buffer.from(authenticator.credential_id).toString('base64url'),
980
+ publicKey: authenticator.public_key,
981
+ counter: authenticator.sign_count,
982
+ },
983
+ });
984
+ if (!verification.verified) {
985
+ throw new common_1.BadRequestException('Verification failed.');
986
+ }
987
+ await this.prisma.user_mfa_webauthn.update({
988
+ where: { id: authenticator.id },
989
+ data: {
990
+ sign_count: verification.authenticationInfo.newCounter,
991
+ last_used_at: new Date(),
992
+ }
993
+ });
994
+ await this.prisma.user_mfa_challenge.update({
995
+ where: { id: challengeRecord.id },
996
+ data: { verified_at: new Date() }
997
+ });
998
+ return { success: true };
999
+ }
1000
+ catch (error) {
1001
+ throw new common_1.BadRequestException(`Failed to verify authentication: ${error === null || error === void 0 ? void 0 : error.message}`);
1002
+ }
1003
+ }
1004
+ async removeWebAuthnMfa(locale, userId, mfaId) {
1005
+ try {
1006
+ const mfa = await this.prisma.user_mfa.findFirst({
1007
+ where: {
1008
+ id: mfaId,
1009
+ user_id: userId,
1010
+ type: 'webauthn',
1011
+ },
1012
+ });
1013
+ if (!mfa) {
1014
+ throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('mfaNotFound', locale, 'MFA method not found.'));
1015
+ }
1016
+ await this.prisma.user_mfa.delete({
1017
+ where: { id: mfaId },
1018
+ });
1019
+ return { success: true };
1020
+ }
1021
+ catch (error) {
1022
+ throw new common_1.BadRequestException(`Failed to remove WebAuthn: ${error === null || error === void 0 ? void 0 : error.message}`);
1023
+ }
1024
+ }
1025
+ async generateWebAuthnAuthenticationOptionsForLogin(mfaToken) {
1026
+ try {
1027
+ const decoded = this.jwt.decode(mfaToken);
1028
+ if (!decoded || !decoded.userId) {
1029
+ throw new common_1.BadRequestException('Invalid MFA token');
1030
+ }
1031
+ const user = await this.prisma.user.findFirst({
1032
+ where: { id: decoded.userId },
1033
+ include: {
1034
+ user_mfa: {
1035
+ where: { type: 'webauthn', verified_at: { not: null } },
1036
+ include: { user_mfa_webauthn: true }
1037
+ }
1038
+ }
1039
+ });
1040
+ if (!user || user.user_mfa.length === 0) {
1041
+ throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('webauthnNotConfigured', 'en', 'WebAuthn not configured.'));
1042
+ }
1043
+ const rpID = new URL(process.env.FRONTEND_URL || 'http://localhost:3200').hostname;
1044
+ const allowCredentials = user.user_mfa
1045
+ .filter(mfa => mfa.user_mfa_webauthn && mfa.user_mfa_webauthn.length > 0)
1046
+ .map(mfa => ({
1047
+ id: Buffer.from(mfa.user_mfa_webauthn[0].credential_id).toString('base64url'),
1048
+ }));
1049
+ const options = await (0, server_1.generateAuthenticationOptions)({
1050
+ rpID,
1051
+ allowCredentials,
1052
+ userVerification: 'preferred',
1053
+ });
1054
+ await this.prisma.user_mfa_challenge.create({
1055
+ data: {
1056
+ user_mfa_id: user.user_mfa[0].id,
1057
+ hash: options.challenge,
1058
+ attempts: 0,
1059
+ expires_at: new Date(Date.now() + 5 * 60 * 1000),
1060
+ }
1061
+ });
1062
+ return options;
1063
+ }
1064
+ catch (error) {
1065
+ throw new common_1.BadRequestException(`Failed to generate authentication options: ${error === null || error === void 0 ? void 0 : error.message}`);
1066
+ }
1067
+ }
1068
+ async verifyWebAuthnAuthenticationForLogin(mfaToken, assertionResponse) {
1069
+ try {
1070
+ const decoded = this.jwt.decode(mfaToken);
1071
+ if (!decoded || !decoded.userId) {
1072
+ throw new common_1.BadRequestException('Invalid MFA token');
1073
+ }
1074
+ const userId = decoded.userId;
1075
+ const challengeRecord = await this.prisma.user_mfa_challenge.findFirst({
1076
+ where: {
1077
+ user_mfa: {
1078
+ user_id: userId,
1079
+ type: 'webauthn',
1080
+ verified_at: { not: null },
1081
+ },
1082
+ verified_at: null,
1083
+ expires_at: { gt: new Date() }
1084
+ },
1085
+ include: {
1086
+ user_mfa: {
1087
+ include: { user_mfa_webauthn: true }
1088
+ }
1089
+ },
1090
+ orderBy: { created_at: 'desc' }
1091
+ });
1092
+ if (!challengeRecord || !challengeRecord.user_mfa.user_mfa_webauthn[0]) {
1093
+ throw new common_1.BadRequestException('Challenge not found or expired.');
1094
+ }
1095
+ const authenticator = challengeRecord.user_mfa.user_mfa_webauthn[0];
1096
+ const rpID = new URL(process.env.FRONTEND_URL || 'http://localhost:3200').hostname;
1097
+ const expectedOrigin = process.env.FRONTEND_URL || 'http://localhost:3200';
1098
+ const verification = await (0, server_1.verifyAuthenticationResponse)({
1099
+ response: assertionResponse,
1100
+ expectedChallenge: challengeRecord.hash,
1101
+ expectedOrigin,
1102
+ expectedRPID: rpID,
1103
+ credential: {
1104
+ id: Buffer.from(authenticator.credential_id).toString('base64url'),
1105
+ publicKey: authenticator.public_key,
1106
+ counter: authenticator.sign_count,
1107
+ },
1108
+ });
1109
+ if (!verification.verified) {
1110
+ throw new common_1.BadRequestException('Verification failed.');
1111
+ }
1112
+ await this.prisma.user_mfa_webauthn.update({
1113
+ where: { id: authenticator.id },
1114
+ data: {
1115
+ sign_count: verification.authenticationInfo.newCounter,
1116
+ last_used_at: new Date(),
1117
+ }
1118
+ });
1119
+ await this.prisma.user_mfa_challenge.update({
1120
+ where: { id: challengeRecord.id },
1121
+ data: { verified_at: new Date() }
1122
+ });
1123
+ const user = await this.prisma.user.findFirst({ where: { id: userId } });
1124
+ if (!user) {
1125
+ throw new common_1.NotFoundException((0, api_locale_1.getLocaleText)('userNotFound', 'en', 'User not found'));
1126
+ }
1127
+ const payload = { sub: userId };
1128
+ const accessToken = await this.token.createAccessToken(payload);
1129
+ const refreshToken = this.jwt.sign({ userId, type: 'refresh' }, { expiresIn: '7d' });
1130
+ return {
1131
+ accessToken,
1132
+ refreshToken,
1133
+ };
1134
+ }
1135
+ catch (error) {
1136
+ throw new common_1.BadRequestException(`Failed to verify authentication: ${error === null || error === void 0 ? void 0 : error.message}`);
1137
+ }
1138
+ }
1139
+ async getUserToken(userId) {
1140
+ const updatedUser = await this.prisma.user.findFirst({ where: { id: userId } });
1141
+ return this.getToken(updatedUser);
1142
+ }
1143
+ };
1144
+ exports.ProfileService = ProfileService;
1145
+ exports.ProfileService = ProfileService = __decorate([
1146
+ (0, common_1.Injectable)(),
1147
+ __param(2, (0, common_1.Inject)((0, common_1.forwardRef)(() => jwt_1.JwtService))),
1148
+ __param(3, (0, common_1.Inject)((0, common_1.forwardRef)(() => setting_service_1.SettingService))),
1149
+ __param(6, (0, common_1.Inject)((0, common_1.forwardRef)(() => token_service_1.TokenService))),
1150
+ __metadata("design:paramtypes", [api_prisma_1.PrismaService,
1151
+ user_service_1.UserService,
1152
+ jwt_1.JwtService,
1153
+ setting_service_1.SettingService,
1154
+ security_service_1.SecurityService,
1155
+ challenge_service_1.ChallengeService,
1156
+ token_service_1.TokenService])
1157
+ ], ProfileService);
1158
+ //# sourceMappingURL=profile.service.js.map