@baseplate-dev/plugin-auth 0.6.18 → 0.6.20
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.
- package/CHANGELOG.md +50 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/admin-crud-manage-roles-action.generator.d.ts +64 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/generated/index.d.ts +64 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/generated/template-renderers.d.ts +32 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/generated/typed-templates.d.ts +32 -0
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/templates/routes/-components/role-manager-dialog.js +1 -2
- package/dist/better-auth/admin/generators/admin-crud-manage-roles-action/templates/routes/-components/role-manager-dialog.tsx +1 -1
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/admin-crud-reset-password-action.generator.d.ts +64 -0
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/generated/index.d.ts +64 -0
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/generated/template-renderers.d.ts +32 -0
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/generated/typed-templates.d.ts +64 -0
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/templates/routes/-components/password-reset-dialog.js +1 -2
- package/dist/better-auth/admin/generators/admin-crud-reset-password-action/templates/routes/-components/password-reset-dialog.tsx +1 -1
- package/dist/better-auth/admin/generators/admin-crud-roles-column/admin-crud-roles-column.generator.d.ts +32 -0
- package/dist/better-auth/core/node.js +7 -8
- package/dist/better-auth/generators/fastify/better-auth-admin-module/generated/index.d.ts +1 -0
- package/dist/better-auth/generators/fastify/better-auth-admin-module/generated/ts-import-providers.d.ts +1 -0
- package/dist/better-auth/generators/fastify/better-auth-admin-module/generated/ts-import-providers.js +1 -0
- package/dist/better-auth/generators/fastify/better-auth-module/better-auth-module.generator.d.ts +20 -3
- package/dist/better-auth/generators/fastify/better-auth-module/better-auth-module.generator.js +5 -24
- package/dist/better-auth/generators/fastify/better-auth-module/generated/index.d.ts +40 -2
- package/dist/better-auth/generators/fastify/better-auth-module/generated/template-renderers.d.ts +19 -1
- package/dist/better-auth/generators/fastify/better-auth-module/generated/template-renderers.js +6 -2
- package/dist/better-auth/generators/fastify/better-auth-module/generated/ts-import-providers.d.ts +1 -0
- package/dist/better-auth/generators/fastify/better-auth-module/generated/ts-import-providers.js +1 -0
- package/dist/better-auth/generators/fastify/better-auth-module/generated/typed-templates.d.ts +20 -1
- package/dist/better-auth/generators/fastify/better-auth-module/generated/typed-templates.js +4 -1
- package/dist/better-auth/generators/fastify/better-auth-module/templates/module/services/auth.ts +16 -8
- package/dist/better-auth/generators/react/better-auth-hooks/better-auth-hooks.generator.d.ts +1 -1
- package/dist/better-auth/generators/react/better-auth-hooks/generated/index.d.ts +5 -4
- package/dist/better-auth/generators/react/better-auth-hooks/generated/template-paths.d.ts +1 -1
- package/dist/better-auth/generators/react/better-auth-hooks/generated/template-paths.js +1 -1
- package/dist/better-auth/generators/react/better-auth-hooks/generated/ts-import-providers.d.ts +2 -1
- package/dist/better-auth/generators/react/better-auth-hooks/generated/ts-import-providers.js +2 -1
- package/dist/better-auth/generators/react/better-auth-hooks/generated/typed-templates.d.ts +6 -6
- package/dist/better-auth/generators/react/better-auth-hooks/generated/typed-templates.js +13 -13
- package/dist/better-auth/generators/react/better-auth-hooks/templates/src/hooks/{use-required-user-id.ts → use-user-id-or-throw.ts} +1 -1
- package/dist/better-auth/generators/react/better-auth-pages/better-auth-pages.generator.d.ts +32 -0
- package/dist/better-auth/generators/react/better-auth-pages/generated/index.d.ts +192 -0
- package/dist/better-auth/generators/react/better-auth-pages/generated/template-renderers.d.ts +32 -0
- package/dist/better-auth/generators/react/better-auth-pages/generated/typed-templates.d.ts +320 -0
- package/dist/better-auth/generators/react/better-auth-pages/templates/routes/forgot-password.tsx +1 -4
- package/dist/better-auth/generators/react/react-better-auth/generated/index.d.ts +67 -2
- package/dist/better-auth/generators/react/react-better-auth/generated/template-renderers.d.ts +33 -1
- package/dist/better-auth/generators/react/react-better-auth/generated/ts-import-providers.d.ts +1 -0
- package/dist/better-auth/generators/react/react-better-auth/generated/ts-import-providers.js +1 -0
- package/dist/better-auth/generators/react/react-better-auth/generated/typed-templates.d.ts +33 -1
- package/dist/better-auth/generators/react/react-better-auth/react-better-auth.generator.d.ts +33 -1
- package/dist/better-auth/generators/react/react-better-auth/templates/src/app/auth-loaded-gate.tsx +12 -3
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/admin-crud-invite-user-action.generator.d.ts +64 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/index.d.ts +64 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/template-renderers.d.ts +32 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/generated/typed-templates.d.ts +32 -0
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/templates/routes/-components/invite-user-dialog.js +1 -2
- package/dist/local-auth/admin/generators/admin-crud-invite-user-action/templates/routes/-components/invite-user-dialog.tsx +1 -1
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/admin-crud-manage-roles-action.generator.d.ts +64 -0
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/generated/index.d.ts +64 -0
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/generated/template-renderers.d.ts +32 -0
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/generated/typed-templates.d.ts +32 -0
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/templates/routes/-components/role-manager-dialog.js +1 -2
- package/dist/local-auth/admin/generators/admin-crud-manage-roles-action/templates/routes/-components/role-manager-dialog.tsx +1 -1
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/admin-crud-reset-password-action.generator.d.ts +64 -0
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/generated/index.d.ts +64 -0
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/generated/template-renderers.d.ts +32 -0
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/generated/typed-templates.d.ts +64 -0
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/templates/routes/-components/password-reset-dialog.js +1 -2
- package/dist/local-auth/admin/generators/admin-crud-reset-password-action/templates/routes/-components/password-reset-dialog.tsx +1 -1
- package/dist/local-auth/admin/generators/admin-crud-roles-column/admin-crud-roles-column.generator.d.ts +32 -0
- package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.d.ts +10 -7
- package/dist/local-auth/core/generators/auth-email-password/auth-email-password.generator.js +8 -11
- package/dist/local-auth/core/generators/auth-email-password/generated/index.d.ts +40 -13
- package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.d.ts +9 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/template-renderers.js +6 -5
- package/dist/local-auth/core/generators/auth-email-password/generated/ts-import-providers.d.ts +1 -3
- package/dist/local-auth/core/generators/auth-email-password/generated/ts-import-providers.js +1 -2
- package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.d.ts +40 -16
- package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.js +11 -8
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-verification.service.js +2 -3
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/email-verification.service.ts +5 -3
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/invite.service.js +17 -13
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/invite.service.ts +25 -13
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.js +2 -3
- package/dist/local-auth/core/generators/auth-email-password/templates/module/services/password-reset.service.ts +5 -3
- package/dist/local-auth/core/generators/auth-hooks/auth-hooks.generator.d.ts +273 -1
- package/dist/local-auth/core/generators/auth-hooks/generated/index.d.ts +549 -4
- package/dist/local-auth/core/generators/auth-hooks/generated/template-paths.d.ts +1 -1
- package/dist/local-auth/core/generators/auth-hooks/generated/template-paths.js +1 -1
- package/dist/local-auth/core/generators/auth-hooks/generated/template-renderers.d.ts +272 -0
- package/dist/local-auth/core/generators/auth-hooks/generated/template-renderers.js +4 -2
- package/dist/local-auth/core/generators/auth-hooks/generated/ts-import-providers.d.ts +2 -1
- package/dist/local-auth/core/generators/auth-hooks/generated/ts-import-providers.js +2 -1
- package/dist/local-auth/core/generators/auth-hooks/generated/typed-templates.d.ts +550 -6
- package/dist/local-auth/core/generators/auth-hooks/generated/typed-templates.js +15 -14
- package/dist/local-auth/core/generators/auth-hooks/templates/src/hooks/use-log-out.js +1 -1
- package/dist/local-auth/core/generators/auth-hooks/templates/src/hooks/use-log-out.ts +1 -1
- package/dist/local-auth/core/generators/auth-hooks/templates/src/hooks/use-session.d.ts +7 -0
- package/dist/local-auth/core/generators/auth-hooks/templates/src/hooks/use-session.ts +7 -0
- package/dist/local-auth/core/generators/auth-module/auth-module.generator.d.ts +19 -7
- package/dist/local-auth/core/generators/auth-module/auth-module.generator.js +3 -26
- package/dist/local-auth/core/generators/auth-module/generated/index.d.ts +48 -7
- package/dist/local-auth/core/generators/auth-module/generated/template-paths.d.ts +0 -1
- package/dist/local-auth/core/generators/auth-module/generated/template-paths.js +0 -1
- package/dist/local-auth/core/generators/auth-module/generated/template-renderers.d.ts +19 -1
- package/dist/local-auth/core/generators/auth-module/generated/template-renderers.js +7 -3
- package/dist/local-auth/core/generators/auth-module/generated/ts-import-providers.d.ts +1 -0
- package/dist/local-auth/core/generators/auth-module/generated/ts-import-providers.js +1 -0
- package/dist/local-auth/core/generators/auth-module/generated/typed-templates.d.ts +28 -7
- package/dist/local-auth/core/generators/auth-module/generated/typed-templates.js +5 -14
- package/dist/local-auth/core/generators/auth-module/templates/module/services/code-verification.service.d.ts +7 -6
- package/dist/local-auth/core/generators/auth-module/templates/module/services/code-verification.service.js +23 -17
- package/dist/local-auth/core/generators/auth-module/templates/module/services/code-verification.service.ts +25 -18
- package/dist/local-auth/core/generators/auth-module/templates/module/services/user-session.service.js +8 -9
- package/dist/local-auth/core/generators/auth-module/templates/module/services/user-session.service.ts +10 -11
- package/dist/local-auth/core/generators/auth-routes/auth-routes.generator.d.ts +32 -0
- package/dist/local-auth/core/generators/auth-routes/generated/index.d.ts +257 -0
- package/dist/local-auth/core/generators/auth-routes/generated/template-renderers.d.ts +32 -0
- package/dist/local-auth/core/generators/auth-routes/generated/ts-import-providers.d.ts +1 -0
- package/dist/local-auth/core/generators/auth-routes/generated/ts-import-providers.js +1 -0
- package/dist/local-auth/core/generators/auth-routes/generated/typed-templates.d.ts +320 -0
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/accept-invite.js +12 -5
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/accept-invite.tsx +14 -4
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/forgot-password.js +1 -2
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/forgot-password.tsx +1 -1
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login-otp.js +4 -4
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login-otp.tsx +4 -3
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.js +4 -4
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/login.tsx +4 -3
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.js +4 -4
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/register.tsx +4 -3
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.js +1 -2
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/reset-password.tsx +1 -1
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/verify-email.js +1 -2
- package/dist/local-auth/core/generators/auth-routes/templates/routes/auth_/verify-email.tsx +1 -1
- package/dist/local-auth/core/generators/react-session/generated/index.d.ts +80 -7
- package/dist/local-auth/core/generators/react-session/generated/template-renderers.d.ts +33 -1
- package/dist/local-auth/core/generators/react-session/generated/ts-import-providers.d.ts +1 -0
- package/dist/local-auth/core/generators/react-session/generated/ts-import-providers.js +1 -0
- package/dist/local-auth/core/generators/react-session/generated/typed-templates.d.ts +92 -12
- package/dist/local-auth/core/generators/react-session/generated/typed-templates.js +5 -2
- package/dist/local-auth/core/generators/react-session/react-session.generator.d.ts +49 -1
- package/dist/local-auth/core/generators/react-session/react-session.generator.js +35 -1
- package/dist/local-auth/core/generators/react-session/templates/src/app/user-session-provider.js +17 -44
- package/dist/local-auth/core/generators/react-session/templates/src/app/user-session-provider.tsx +21 -49
- package/dist/local-auth/core/generators/react-session/templates/src/services/user-session-client.d.ts +43 -34
- package/dist/local-auth/core/generators/react-session/templates/src/services/user-session-client.js +96 -80
- package/dist/local-auth/core/generators/react-session/templates/src/services/user-session-client.ts +148 -82
- package/dist/local-auth/core/generators/seed-initial-user/generated/index.d.ts +0 -2
- package/dist/local-auth/core/generators/seed-initial-user/generated/template-renderers.d.ts +0 -1
- package/dist/local-auth/core/generators/seed-initial-user/generated/typed-templates.d.ts +0 -1
- package/dist/local-auth/core/generators/seed-initial-user/seed-initial-user.generator.d.ts +0 -1
- package/dist/local-auth/core/node.js +7 -7
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/index.d.ts +4 -3
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/template-paths.d.ts +1 -1
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/template-paths.js +1 -1
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/ts-import-providers.d.ts +2 -1
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/ts-import-providers.js +2 -1
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/typed-templates.d.ts +4 -4
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/generated/typed-templates.js +13 -13
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/placeholder-auth-hooks.generator.d.ts +1 -1
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/templates/src/hooks/use-session.d.ts +1 -0
- package/dist/placeholder-auth/core/generators/placeholder-auth-hooks/templates/src/hooks/use-session.ts +2 -0
- package/dist/placeholder-auth/core/generators/placeholder-auth-module/generated/index.d.ts +1 -2
- package/dist/placeholder-auth/core/generators/placeholder-auth-module/generated/template-renderers.d.ts +0 -1
- package/dist/placeholder-auth/core/generators/placeholder-auth-module/generated/ts-import-providers.d.ts +1 -0
- package/dist/placeholder-auth/core/generators/placeholder-auth-module/generated/ts-import-providers.js +1 -0
- package/dist/placeholder-auth/core/generators/placeholder-auth-module/generated/typed-templates.d.ts +0 -1
- package/dist/placeholder-auth/core/generators/placeholder-auth-module/placeholder-auth-module.generator.d.ts +0 -1
- package/dist/web/assets/{_virtual_mf-localSharedImportMap___mfe_internal__plugin_mf_2_auth__mf_owner__1-CKKmnLep.js → _virtual_mf-localSharedImportMap___mfe_internal__plugin_mf_2_auth__mf_owner__1-Ckrp2j8j.js} +14 -14
- package/dist/web/assets/{_virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib__loadShare__.js-Cx7TvZ_H.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib__loadShare__.js-DE4rTqEA.js} +198 -66
- package/dist/web/assets/{_virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib_mf_1_web__loadShare__.js-D3Nvasea.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib_mf_1_web__loadShare__.js-aFLESEyS.js} +1 -1
- package/dist/web/assets/{_virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_ui_mf_2_components__loadShare__.js-C2GDE8Py.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_baseplate_mf_2_dev_mf_1_ui_mf_2_components__loadShare__.js-tY6BN-tn.js} +2844 -1738
- package/dist/web/assets/{_virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_tanstack_mf_1_react_mf_2_router__loadShare__.js-CiccpWjh.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__mf_owner__1__loadShare___mf_0_tanstack_mf_1_react_mf_2_router__loadShare__.js-R9lCFRaW.js} +2 -2
- package/dist/web/assets/auth-DR6QxrAW.js +1 -0
- package/dist/web/assets/{common-CoLuMS7U.js → common-BsyRiQi3.js} +6 -6
- package/dist/web/assets/{common-N3skPbzk.js → common-CRwNlCMn.js} +10 -10
- package/dist/web/assets/{common-Co5lW_TK.js → common-CvqlRZC9.js} +12 -12
- package/dist/web/assets/{common-C8_sC5pp.js → common-D3atSs7O.js} +15 -15
- package/dist/web/assets/common-DuFyXa6l.js +36 -0
- package/dist/web/assets/common-islduJTj.js +43 -0
- package/dist/web/assets/{get-auth-plugin-definition-DyokUVjX.js → get-auth-plugin-definition-BgWWHl_Y.js} +3 -3
- package/dist/web/assets/{hostInit-BCYmw0H5.js → hostInit-CGEb3Tbe.js} +1 -1
- package/dist/web/assets/{mf-entry-bootstrap-0-3ede9334.js → mf-entry-bootstrap-0-ed392701.js} +1 -1
- package/dist/web/assets/{mf-entry-bootstrap-1-3da85eea.js → mf-entry-bootstrap-1-e2d80a25.js} +2 -2
- package/dist/web/assets/{mf-entry-bootstrap-2-32e24e11.js → mf-entry-bootstrap-2-ea90e6fe.js} +1 -1
- package/dist/web/assets/{mf-entry-bootstrap-3-a3cfea9d.js → mf-entry-bootstrap-3-5268230e.js} +2 -2
- package/dist/web/assets/{models-BcPOQC5p.js → models-BOeSYfRn.js} +4 -4
- package/dist/web/assets/{models-BcUgOGGn.js → models-DF6DoXt6.js} +4 -4
- package/dist/web/assets/{plugin-definition-D1EImXIf.js → plugin-definition--k0VAeK3.js} +9 -9
- package/dist/web/assets/{plugin-definition-lw-gB4hU.js → plugin-definition-CMwSlxsJ.js} +3 -3
- package/dist/web/assets/{styles-EOyEbGA4.js → styles-DZYLavnA.js} +8 -8
- package/dist/web/assets/{virtualExposes-DWORnjyA.js → virtualExposes-DnIi4GOx.js} +1 -1
- package/dist/web/assets/{virtual_mf-REMOTE_ENTRY_ID___mfe_internal__plugin-auth__remoteEntry_js-t-KnBiUh.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__plugin-auth__remoteEntry_js-rNmzkDAw.js} +3 -3
- package/dist/web/assets/{virtual_mf-exposes___mfe_internal__plugin-auth__remoteEntry_js-DZfE3QCR.js → virtual_mf-exposes___mfe_internal__plugin-auth__remoteEntry_js-E86pU-VB.js} +13 -13
- package/dist/web/assets/{web-Dgb85jhs.js → web-BKsbE-x8.js} +41 -41
- package/dist/web/assets/{web-xJ-GnSkC.js → web-BNZ-0TYy.js} +25 -25
- package/dist/web/assets/{web-kaD9AzNS.js → web-C6j3Z4Pi.js} +8 -8
- package/dist/web/assets/{web-CBVepebK.js → web-DPZssHx1.js} +19 -19
- package/dist/web/assets/{web-PqAcfBSy.js → web-DiHdy5Ov.js} +7 -7
- package/dist/web/assets/{web-EDeSquSP.js → web-RWlatCpa.js} +19 -19
- package/dist/web/assets/{web-RhChfBw_.js → web-f-cndKO0.js} +17 -17
- package/dist/web/index.html +4 -4
- package/dist/web/remoteEntry.js +1 -1
- package/package.json +13 -13
- package/dist/local-auth/core/generators/auth-module/templates/module/utils/cookie-signer.d.ts +0 -38
- package/dist/local-auth/core/generators/auth-module/templates/module/utils/cookie-signer.js +0 -71
- package/dist/local-auth/core/generators/auth-module/templates/module/utils/cookie-signer.ts +0 -77
- package/dist/web/assets/auth-CsHp2bQi.js +0 -1
- package/dist/web/assets/common-BGTuTgx7.js +0 -43
- package/dist/web/assets/common-Dueu_1NG.js +0 -36
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import type { AuthVerification, Prisma } from '%prismaGeneratedImports';
|
|
4
4
|
|
|
5
5
|
import { safeCompare } from '$servicesAuthVerification';
|
|
6
|
-
import {
|
|
6
|
+
import { deriveKey } from '%appSecretImports';
|
|
7
7
|
import { prisma } from '%prismaImports';
|
|
8
8
|
import * as crypto from 'node:crypto';
|
|
9
9
|
|
|
@@ -37,7 +37,7 @@ function hashCode({
|
|
|
37
37
|
code: string;
|
|
38
38
|
}): string {
|
|
39
39
|
return crypto
|
|
40
|
-
.createHmac('sha256',
|
|
40
|
+
.createHmac('sha256', deriveKey('auth:code-verification:v1'))
|
|
41
41
|
.update(`${type}:${identifier}:${code}`)
|
|
42
42
|
.digest('hex');
|
|
43
43
|
}
|
|
@@ -101,18 +101,19 @@ export async function createCodeVerification({
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
/**
|
|
104
|
-
* Validates a short code verification
|
|
105
|
-
* gather any further input it needs before committing.
|
|
104
|
+
* Validates a short code verification, leaving the record in place so the
|
|
105
|
+
* caller can gather any further input it needs before committing.
|
|
106
106
|
*
|
|
107
107
|
* Security: a short numeric code has far less entropy than a random token, so
|
|
108
108
|
* each code carries its own attempt counter alongside the endpoint rate limits.
|
|
109
|
-
*
|
|
110
|
-
*
|
|
109
|
+
* Every call spends an attempt, including one that matches, and the record is
|
|
110
|
+
* deleted once the code has expired or a wrong guess has spent the last
|
|
111
|
+
* attempt. Pass the returned record to {@link consumeCodeVerification} to
|
|
111
112
|
* complete the flow.
|
|
112
113
|
*
|
|
113
|
-
*
|
|
114
|
+
* The cleanup paths delete by filter rather than by primary key: simultaneous
|
|
114
115
|
* callers can each decide the record should go, and only one of them removes a
|
|
115
|
-
* row.
|
|
116
|
+
* row.
|
|
116
117
|
*/
|
|
117
118
|
export async function validateCodeVerification({
|
|
118
119
|
type,
|
|
@@ -138,19 +139,25 @@ export async function validateCodeVerification({
|
|
|
138
139
|
return null;
|
|
139
140
|
}
|
|
140
141
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
// Incremented in the database rather than read-modify-written here, so
|
|
146
|
-
// simultaneous guesses each cost a point instead of sharing one.
|
|
147
|
-
const { attempts } = await prisma.authVerification.update({
|
|
148
|
-
where: { id: record.id },
|
|
142
|
+
// Simultaneous guesses serialize on this statement, so at most `maxAttempts`
|
|
143
|
+
// of them reach the comparison below.
|
|
144
|
+
const [claimed] = await prisma.authVerification.updateManyAndReturn({
|
|
145
|
+
where: { id: record.id, attempts: { lt: maxAttempts } },
|
|
149
146
|
data: { attempts: { increment: 1 } },
|
|
150
|
-
select: { attempts: true },
|
|
151
147
|
});
|
|
152
148
|
|
|
153
|
-
|
|
149
|
+
// A spent budget is not this caller's to clean up: the guess that spent it
|
|
150
|
+
// discards the record below, and a correct guess that spent it may still be
|
|
151
|
+
// holding the record for {@link consumeCodeVerification}.
|
|
152
|
+
if (!claimed) {
|
|
153
|
+
return null;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
if (safeCompare(claimed.value, hashCode({ type, identifier, code }))) {
|
|
157
|
+
return claimed;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (claimed.attempts >= maxAttempts) {
|
|
154
161
|
await prisma.authVerification.deleteMany({ where: { id: record.id } });
|
|
155
162
|
}
|
|
156
163
|
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
|
-
import { signObject, unsignObject } from '$cookieSigner';
|
|
3
2
|
import { getUserSessionCookieName } from '$sessionCookie';
|
|
4
3
|
import { USER_SESSION_DURATION_SEC, USER_SESSION_MAX_LIFETIME_SEC, USER_SESSION_RENEWAL_THRESHOLD_SEC, } from '$userSessionConstants';
|
|
5
4
|
import { verifyRequestOrigin } from '$verifyRequestOrigin';
|
|
5
|
+
import { createSigner } from '%appSecretImports';
|
|
6
|
+
import { getWebOrigins } from '%appUrlsImports';
|
|
6
7
|
import { InvalidSessionError } from '%authContextImports';
|
|
7
8
|
import { DEFAULT_USER_ROLES } from '%authRolesImports';
|
|
8
|
-
import {
|
|
9
|
+
import { isDevelopment } from '%configServiceImports';
|
|
9
10
|
import { ForbiddenError } from '%errorHandlerServiceImports';
|
|
10
11
|
import { prisma } from '%prismaImports';
|
|
11
12
|
import { randomBytes } from 'node:crypto';
|
|
13
|
+
const sessionCookieSigner = createSigner('auth:session:v1');
|
|
12
14
|
function getCookieOptions() {
|
|
13
15
|
return {
|
|
14
16
|
httpOnly: true,
|
|
@@ -85,7 +87,7 @@ export class CookieUserSessionService {
|
|
|
85
87
|
...user.roles.map((role) => role.role),
|
|
86
88
|
];
|
|
87
89
|
const cookieName = getUserSessionCookieName(context.reqInfo.headers);
|
|
88
|
-
const cookieValue =
|
|
90
|
+
const cookieValue = sessionCookieSigner.sign({ token });
|
|
89
91
|
context.cookieStore.set(cookieName, cookieValue, getCookieOptions());
|
|
90
92
|
return { userId, expiresAt, roles };
|
|
91
93
|
}
|
|
@@ -122,17 +124,14 @@ export class CookieUserSessionService {
|
|
|
122
124
|
if ((req.method !== 'GET' ||
|
|
123
125
|
req.headers.upgrade?.toLowerCase() === 'websocket') &&
|
|
124
126
|
req.method !== 'HEAD' &&
|
|
125
|
-
!verifyRequestOrigin(req, [req.host, ...
|
|
127
|
+
!verifyRequestOrigin(req, [req.host, ...getWebOrigins()])) {
|
|
126
128
|
throw new ForbiddenError('Invalid Origin header');
|
|
127
129
|
}
|
|
128
130
|
try {
|
|
129
|
-
|
|
130
|
-
const sessionCookieResult = unsignObject(sessionCookieValue, getConfig().AUTH_SECRET);
|
|
131
|
+
const sessionCookieResult = sessionCookieSigner.verify(sessionCookieValue);
|
|
131
132
|
if (!sessionCookieResult)
|
|
132
133
|
throw new InvalidSessionError();
|
|
133
134
|
const { token } = sessionCookieResult;
|
|
134
|
-
if (typeof token !== 'string')
|
|
135
|
-
throw new InvalidSessionError();
|
|
136
135
|
// Fetch and validate user session
|
|
137
136
|
const userSession = await TPL_PRISMA_USER_SESSION.findUnique({
|
|
138
137
|
where: { token },
|
|
@@ -152,7 +151,7 @@ export class CookieUserSessionService {
|
|
|
152
151
|
expiresAt: sessionExpiryResult.newExpiry,
|
|
153
152
|
},
|
|
154
153
|
});
|
|
155
|
-
const newSignedCookie =
|
|
154
|
+
const newSignedCookie = sessionCookieSigner.sign({ token });
|
|
156
155
|
reply.setCookie(cookieName, newSignedCookie, getCookieOptions());
|
|
157
156
|
}
|
|
158
157
|
const { user } = userSession;
|
|
@@ -10,7 +10,6 @@ import type {
|
|
|
10
10
|
import type { CookieSerializeOptions } from '@fastify/cookie';
|
|
11
11
|
import type { FastifyReply, FastifyRequest } from 'fastify';
|
|
12
12
|
|
|
13
|
-
import { signObject, unsignObject } from '$cookieSigner';
|
|
14
13
|
import { getUserSessionCookieName } from '$sessionCookie';
|
|
15
14
|
import {
|
|
16
15
|
USER_SESSION_DURATION_SEC,
|
|
@@ -18,9 +17,11 @@ import {
|
|
|
18
17
|
USER_SESSION_RENEWAL_THRESHOLD_SEC,
|
|
19
18
|
} from '$userSessionConstants';
|
|
20
19
|
import { verifyRequestOrigin } from '$verifyRequestOrigin';
|
|
20
|
+
import { createSigner } from '%appSecretImports';
|
|
21
|
+
import { getWebOrigins } from '%appUrlsImports';
|
|
21
22
|
import { InvalidSessionError } from '%authContextImports';
|
|
22
23
|
import { DEFAULT_USER_ROLES } from '%authRolesImports';
|
|
23
|
-
import {
|
|
24
|
+
import { isDevelopment } from '%configServiceImports';
|
|
24
25
|
import { ForbiddenError } from '%errorHandlerServiceImports';
|
|
25
26
|
import { prisma } from '%prismaImports';
|
|
26
27
|
import { randomBytes } from 'node:crypto';
|
|
@@ -30,6 +31,8 @@ interface SessionCookieValue {
|
|
|
30
31
|
token: string;
|
|
31
32
|
}
|
|
32
33
|
|
|
34
|
+
const sessionCookieSigner = createSigner<SessionCookieValue>('auth:session:v1');
|
|
35
|
+
|
|
33
36
|
function getCookieOptions(): CookieSerializeOptions {
|
|
34
37
|
return {
|
|
35
38
|
httpOnly: true,
|
|
@@ -131,7 +134,7 @@ export class CookieUserSessionService implements UserSessionService {
|
|
|
131
134
|
];
|
|
132
135
|
|
|
133
136
|
const cookieName = getUserSessionCookieName(context.reqInfo.headers);
|
|
134
|
-
const cookieValue =
|
|
137
|
+
const cookieValue = sessionCookieSigner.sign({ token });
|
|
135
138
|
|
|
136
139
|
context.cookieStore.set(cookieName, cookieValue, getCookieOptions());
|
|
137
140
|
|
|
@@ -182,20 +185,16 @@ export class CookieUserSessionService implements UserSessionService {
|
|
|
182
185
|
(req.method !== 'GET' ||
|
|
183
186
|
req.headers.upgrade?.toLowerCase() === 'websocket') &&
|
|
184
187
|
req.method !== 'HEAD' &&
|
|
185
|
-
!verifyRequestOrigin(req, [req.host, ...
|
|
188
|
+
!verifyRequestOrigin(req, [req.host, ...getWebOrigins()])
|
|
186
189
|
) {
|
|
187
190
|
throw new ForbiddenError('Invalid Origin header');
|
|
188
191
|
}
|
|
189
192
|
try {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
sessionCookieValue,
|
|
193
|
-
getConfig().AUTH_SECRET,
|
|
194
|
-
) as SessionCookieValue | undefined;
|
|
193
|
+
const sessionCookieResult =
|
|
194
|
+
sessionCookieSigner.verify(sessionCookieValue);
|
|
195
195
|
if (!sessionCookieResult) throw new InvalidSessionError();
|
|
196
196
|
|
|
197
197
|
const { token } = sessionCookieResult;
|
|
198
|
-
if (typeof token !== 'string') throw new InvalidSessionError();
|
|
199
198
|
|
|
200
199
|
// Fetch and validate user session
|
|
201
200
|
const userSession = await TPL_PRISMA_USER_SESSION.findUnique({
|
|
@@ -220,7 +219,7 @@ export class CookieUserSessionService implements UserSessionService {
|
|
|
220
219
|
expiresAt: sessionExpiryResult.newExpiry,
|
|
221
220
|
},
|
|
222
221
|
});
|
|
223
|
-
const newSignedCookie =
|
|
222
|
+
const newSignedCookie = sessionCookieSigner.sign({ token });
|
|
224
223
|
reply.setCookie(cookieName, newSignedCookie, getCookieOptions());
|
|
225
224
|
}
|
|
226
225
|
|
|
@@ -33,6 +33,7 @@ export declare const authRoutesGenerator: import("@baseplate-dev/sync").Generato
|
|
|
33
33
|
isTypeOnly: true;
|
|
34
34
|
};
|
|
35
35
|
Alert: {};
|
|
36
|
+
AlertAction: {};
|
|
36
37
|
AlertDescription: {};
|
|
37
38
|
AlertTitle: {};
|
|
38
39
|
Autocomplete: {};
|
|
@@ -62,6 +63,7 @@ export declare const authRoutesGenerator: import("@baseplate-dev/sync").Generato
|
|
|
62
63
|
buttonVariants: {};
|
|
63
64
|
Calendar: {};
|
|
64
65
|
Card: {};
|
|
66
|
+
CardAction: {};
|
|
65
67
|
CardContent: {};
|
|
66
68
|
CardDescription: {};
|
|
67
69
|
CardFooter: {};
|
|
@@ -188,6 +190,10 @@ export declare const authRoutesGenerator: import("@baseplate-dev/sync").Generato
|
|
|
188
190
|
NotFoundCard: {};
|
|
189
191
|
NumberField: {};
|
|
190
192
|
NumberFieldController: {};
|
|
193
|
+
PageHeader: {};
|
|
194
|
+
PageHeaderActions: {};
|
|
195
|
+
PageHeaderDescription: {};
|
|
196
|
+
PageHeaderTitle: {};
|
|
191
197
|
Popover: {};
|
|
192
198
|
PopoverContent: {};
|
|
193
199
|
PopoverTrigger: {};
|
|
@@ -197,6 +203,11 @@ export declare const authRoutesGenerator: import("@baseplate-dev/sync").Generato
|
|
|
197
203
|
isTypeOnly: true;
|
|
198
204
|
};
|
|
199
205
|
ScrollArea: {};
|
|
206
|
+
Section: {};
|
|
207
|
+
SectionActions: {};
|
|
208
|
+
SectionDescription: {};
|
|
209
|
+
SectionHeader: {};
|
|
210
|
+
SectionTitle: {};
|
|
200
211
|
Select: {};
|
|
201
212
|
SelectField: {};
|
|
202
213
|
SelectFieldController: {};
|
|
@@ -252,7 +263,27 @@ export declare const authRoutesGenerator: import("@baseplate-dev/sync").Generato
|
|
|
252
263
|
Textarea: {};
|
|
253
264
|
TextareaField: {};
|
|
254
265
|
TextareaFieldController: {};
|
|
266
|
+
Toast: {};
|
|
267
|
+
toast: {};
|
|
268
|
+
ToastAction: {};
|
|
269
|
+
ToastClose: {};
|
|
270
|
+
ToastContent: {};
|
|
271
|
+
ToastDescription: {};
|
|
255
272
|
Toaster: {};
|
|
273
|
+
toastManager: {};
|
|
274
|
+
ToastOptions: {
|
|
275
|
+
isTypeOnly: true;
|
|
276
|
+
};
|
|
277
|
+
ToastPortal: {};
|
|
278
|
+
ToastProvider: {};
|
|
279
|
+
ToastTitle: {};
|
|
280
|
+
ToastType: {
|
|
281
|
+
isTypeOnly: true;
|
|
282
|
+
};
|
|
283
|
+
ToastUpdateOptions: {
|
|
284
|
+
isTypeOnly: true;
|
|
285
|
+
};
|
|
286
|
+
ToastViewport: {};
|
|
256
287
|
Tooltip: {};
|
|
257
288
|
TooltipContent: {};
|
|
258
289
|
TooltipProvider: {};
|
|
@@ -265,6 +296,7 @@ export declare const authRoutesGenerator: import("@baseplate-dev/sync").Generato
|
|
|
265
296
|
useConfirmDialogState: {};
|
|
266
297
|
useControlledState: {};
|
|
267
298
|
useControllerMerged: {};
|
|
299
|
+
useFieldIds: {};
|
|
268
300
|
useIsMobile: {};
|
|
269
301
|
useSidebar: {};
|
|
270
302
|
}>>;
|