authhero 5.8.0 → 5.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/u/widget/index.esm.js +1 -1
- package/dist/authhero.cjs +97 -97
- package/dist/authhero.d.ts +17629 -72311
- package/dist/authhero.mjs +5613 -5615
- package/dist/stats.html +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -0
- package/dist/types/adapters/cache/in-memory.d.ts +52 -0
- package/dist/types/adapters/cache/index.d.ts +2 -0
- package/dist/types/adapters/index.d.ts +1 -0
- package/dist/types/authentication-flows/auth0-migration.d.ts +53 -0
- package/dist/types/authentication-flows/authorization-code.d.ts +23 -0
- package/dist/types/authentication-flows/client-credentials.d.ts +16 -0
- package/dist/types/authentication-flows/common.d.ts +253 -0
- package/dist/types/authentication-flows/connection.d.ts +17 -0
- package/dist/types/authentication-flows/mfa.d.ts +49 -0
- package/dist/types/authentication-flows/passkey-enrollment.d.ts +19 -0
- package/dist/types/authentication-flows/password.d.ts +24 -0
- package/dist/types/authentication-flows/passwordless.d.ts +571 -0
- package/dist/types/authentication-flows/refresh-token-migration.d.ts +17 -0
- package/dist/types/authentication-flows/refresh-token.d.ts +15 -0
- package/dist/types/authentication-flows/resume.d.ts +22 -0
- package/dist/types/authentication-flows/silent.d.ts +25 -0
- package/dist/types/authentication-flows/ticket.d.ts +7 -0
- package/dist/types/authentication-flows/try-connection.d.ts +33 -0
- package/dist/types/authentication-flows/universal.d.ts +19 -0
- package/dist/types/build-hash.d.ts +7 -0
- package/dist/types/client/client-bundle.d.ts +1 -0
- package/dist/types/client/form-handler.d.ts +9 -0
- package/dist/types/client/incognito-handler.d.ts +5 -0
- package/dist/types/client/index.d.ts +1 -0
- package/dist/types/client/input-otp.d.ts +12 -0
- package/dist/types/client/password-toggle.d.ts +10 -0
- package/dist/types/client/user-agent-detector.d.ts +22 -0
- package/dist/types/components/AccountChangeEmailPage.d.ts +14 -0
- package/dist/types/components/AccountForm.d.ts +17 -0
- package/dist/types/components/AccountPage.d.ts +15 -0
- package/dist/types/components/AppLogo.d.ts +8 -0
- package/dist/types/components/AuthLayout.d.ts +18 -0
- package/dist/types/components/Button.d.ts +12 -0
- package/dist/types/components/ChangeEmailForm.d.ts +14 -0
- package/dist/types/components/ChangeEmailPage.d.ts +15 -0
- package/dist/types/components/ContinueForm.d.ts +13 -0
- package/dist/types/components/EmailValidatedForm.d.ts +12 -0
- package/dist/types/components/EmailValidatedPage.d.ts +11 -0
- package/dist/types/components/EnterCodeForm.d.ts +13 -0
- package/dist/types/components/EnterCodePage.d.ts +14 -0
- package/dist/types/components/EnterPasswordForm.d.ts +14 -0
- package/dist/types/components/EnterPasswordPage.d.ts +13 -0
- package/dist/types/components/ErrorMessage.d.ts +6 -0
- package/dist/types/components/Footer.d.ts +9 -0
- package/dist/types/components/ForgotPasswordForm.d.ts +14 -0
- package/dist/types/components/ForgotPasswordPage.d.ts +13 -0
- package/dist/types/components/ForgotPasswordSentPage.d.ts +11 -0
- package/dist/types/components/Form.d.ts +6 -0
- package/dist/types/components/FormNodePage.d.ts +16 -0
- package/dist/types/components/GoBack.d.ts +5 -0
- package/dist/types/components/GoogleLogo.d.ts +4 -0
- package/dist/types/components/Icon.d.ts +8 -0
- package/dist/types/components/IconEye.d.ts +8 -0
- package/dist/types/components/IconEyeSlash.d.ts +8 -0
- package/dist/types/components/IconPen.d.ts +7 -0
- package/dist/types/components/IdentifierForm.d.ts +16 -0
- package/dist/types/components/IdentifierPage.d.ts +15 -0
- package/dist/types/components/ImpersonateForm.d.ts +14 -0
- package/dist/types/components/ImpersonationPage.d.ts +13 -0
- package/dist/types/components/InvalidSessionPage.d.ts +11 -0
- package/dist/types/components/Layout.d.ts +11 -0
- package/dist/types/components/LoginForm.d.ts +15 -0
- package/dist/types/components/MessagePage.d.ts +13 -0
- package/dist/types/components/PasswordInput.d.ts +6 -0
- package/dist/types/components/PreSignUpConfirmationPage.d.ts +12 -0
- package/dist/types/components/PreSignUpPage.d.ts +12 -0
- package/dist/types/components/ResetPasswordForm.d.ts +14 -0
- package/dist/types/components/ResetPasswordPage.d.ts +12 -0
- package/dist/types/components/SignUpForm.d.ts +15 -0
- package/dist/types/components/SignUpPage.d.ts +14 -0
- package/dist/types/components/SocialButton.d.ts +10 -0
- package/dist/types/components/Spinner.d.ts +6 -0
- package/dist/types/components/Trans.d.ts +8 -0
- package/dist/types/components/UnverifiedEmailPage.d.ts +11 -0
- package/dist/types/components/UserNotFoundPage.d.ts +12 -0
- package/dist/types/components/VippsLogo.d.ts +4 -0
- package/dist/types/components/index.d.ts +34 -0
- package/dist/types/components/stories/AccountForm.stories.d.ts +13 -0
- package/dist/types/components/stories/AuthLayout.stories.d.ts +27 -0
- package/dist/types/components/stories/ChangeEmailForm.stories.d.ts +11 -0
- package/dist/types/components/stories/ContinueForm.stories.d.ts +10 -0
- package/dist/types/components/stories/EnterCodeForm.stories.d.ts +9 -0
- package/dist/types/components/stories/EnterPasswordForm.stories.d.ts +22 -0
- package/dist/types/components/stories/IdentifierForm.stories.d.ts +42 -0
- package/dist/types/components/stories/IdentifierPage.stories.d.ts +33 -0
- package/dist/types/components/stories/ImpersonateForm.stories.d.ts +11 -0
- package/dist/types/components/stories/LoginForm.stories.d.ts +12 -0
- package/dist/types/components/ui/button.d.ts +12 -0
- package/dist/types/components/ui/card.d.ts +30 -0
- package/dist/types/components/ui/input-otp.d.ts +31 -0
- package/dist/types/components/ui/input.d.ts +15 -0
- package/dist/types/components/ui/label.d.ts +9 -0
- package/dist/types/constants/defaultBranding.d.ts +2 -0
- package/dist/types/constants/defaultTheme.d.ts +2 -0
- package/dist/types/constants/index.d.ts +2 -0
- package/dist/types/constants.d.ts +15 -0
- package/dist/types/email-services/index.d.ts +3 -0
- package/dist/types/email-services/mailgun.d.ts +18 -0
- package/dist/types/email-services/postmark.d.ts +14 -0
- package/dist/types/email-services/resend.d.ts +14 -0
- package/dist/types/emails/defaults/Layout.d.ts +12 -0
- package/dist/types/emails/defaults/PrimaryButton.d.ts +11 -0
- package/dist/types/emails/defaults/ResetEmail.d.ts +1 -0
- package/dist/types/emails/defaults/ResetEmailByCode.d.ts +1 -0
- package/dist/types/emails/defaults/UserInvitation.d.ts +1 -0
- package/dist/types/emails/defaults/VerifyEmail.d.ts +1 -0
- package/dist/types/emails/defaults/VerifyEmailByCode.d.ts +1 -0
- package/dist/types/emails/defaults/WelcomeEmail.d.ts +1 -0
- package/dist/types/emails/defaults/compiled.d.ts +2 -0
- package/dist/types/emails/defaults/index.d.ts +6 -0
- package/dist/types/emails/defaults/subjects.d.ts +2 -0
- package/dist/types/emails/index.d.ts +70 -0
- package/dist/types/emails/render.d.ts +41 -0
- package/dist/types/errors/is-unique-constraint-error.d.ts +8 -0
- package/dist/types/errors/json-http-exception.d.ts +5 -0
- package/dist/types/errors/redirect-exception.d.ts +6 -0
- package/dist/types/generated/locale-types.d.ts +690 -0
- package/dist/types/helpers/cache-wrapper.d.ts +23 -0
- package/dist/types/helpers/client-assertion.d.ts +49 -0
- package/dist/types/helpers/client-keys.d.ts +27 -0
- package/dist/types/helpers/client.d.ts +496 -0
- package/dist/types/helpers/dcr/constraint-enforcement.d.ts +24 -0
- package/dist/types/helpers/dcr/metadata-mapping.d.ts +83 -0
- package/dist/types/helpers/dcr/mint-iat.d.ts +14 -0
- package/dist/types/helpers/dcr/mint-token.d.ts +7 -0
- package/dist/types/helpers/dcr/validate-connect-origin.d.ts +20 -0
- package/dist/types/helpers/dcr/verify-token.d.ts +8 -0
- package/dist/types/helpers/default-destinations.d.ts +55 -0
- package/dist/types/helpers/entity-hooks-wrapper.d.ts +43 -0
- package/dist/types/helpers/hook-events.d.ts +20 -0
- package/dist/types/helpers/hook-user-payload.d.ts +8 -0
- package/dist/types/helpers/hrd.d.ts +3 -0
- package/dist/types/helpers/logging.d.ts +65 -0
- package/dist/types/helpers/outbox-cleanup.d.ts +10 -0
- package/dist/types/helpers/outbox-destinations/index.d.ts +2 -0
- package/dist/types/helpers/outbox-destinations/log-streams.d.ts +66 -0
- package/dist/types/helpers/outbox-destinations/logs.d.ts +20 -0
- package/dist/types/helpers/outbox-destinations/registration-finalizer.d.ts +29 -0
- package/dist/types/helpers/outbox-destinations/webhooks.d.ts +57 -0
- package/dist/types/helpers/outbox-relay.d.ts +34 -0
- package/dist/types/helpers/password-policy.d.ts +54 -0
- package/dist/types/helpers/request-object.d.ts +40 -0
- package/dist/types/helpers/run-outbox-relay.d.ts +58 -0
- package/dist/types/helpers/saml.d.ts +1 -0
- package/dist/types/helpers/scope-claims.d.ts +4 -0
- package/dist/types/helpers/scopes-permissions.d.ts +38 -0
- package/dist/types/helpers/server-timing.d.ts +12 -0
- package/dist/types/helpers/service-token.d.ts +54 -0
- package/dist/types/helpers/set-tenant-id.d.ts +15 -0
- package/dist/types/helpers/signing-keys.d.ts +16 -0
- package/dist/types/helpers/try-connection-client.d.ts +15 -0
- package/dist/types/helpers/user-linking.d.ts +14 -0
- package/dist/types/helpers/user-session-cleanup.d.ts +21 -0
- package/dist/types/helpers/users.d.ts +46 -0
- package/dist/types/helpers/wait-until.d.ts +21 -0
- package/dist/types/hooks/addDataHooks.d.ts +16 -0
- package/dist/types/hooks/code-executor/local.d.ts +13 -0
- package/dist/types/hooks/codehooks.d.ts +70 -0
- package/dist/types/hooks/formhooks.d.ts +99 -0
- package/dist/types/hooks/helpers/token-api.d.ts +17 -0
- package/dist/types/hooks/index.d.ts +20 -0
- package/dist/types/hooks/link-users.d.ts +29 -0
- package/dist/types/hooks/pagehooks.d.ts +16 -0
- package/dist/types/hooks/post-user-login.d.ts +29 -0
- package/dist/types/hooks/pre-defined/account-linking.d.ts +73 -0
- package/dist/types/hooks/pre-defined/ensure-username.d.ts +86 -0
- package/dist/types/hooks/pre-defined/index.d.ts +23 -0
- package/dist/types/hooks/pre-defined/set-preferred-username.d.ts +26 -0
- package/dist/types/hooks/templatehooks.d.ts +29 -0
- package/dist/types/hooks/user-deletion.d.ts +14 -0
- package/dist/types/hooks/user-registration.d.ts +88 -0
- package/dist/types/hooks/user-update.d.ts +16 -0
- package/dist/types/hooks/validate-signup.d.ts +34 -0
- package/dist/types/hooks/webhooks.d.ts +35 -0
- package/dist/types/i18n/index.d.ts +77 -0
- package/dist/types/index.d.ts +15791 -0
- package/dist/types/locales/index.d.ts +9 -0
- package/dist/types/middlewares/apply-config.d.ts +14 -0
- package/dist/types/middlewares/authentication.d.ts +26 -0
- package/dist/types/middlewares/client-info.d.ts +8 -0
- package/dist/types/middlewares/index.d.ts +6 -0
- package/dist/types/middlewares/outbox.d.ts +24 -0
- package/dist/types/middlewares/register-component.d.ts +10 -0
- package/dist/types/middlewares/tenant.d.ts +12 -0
- package/dist/types/migration-providers/auth0.d.ts +3 -0
- package/dist/types/migration-providers/index.d.ts +5 -0
- package/dist/types/migration-providers/types.d.ts +32 -0
- package/dist/types/routes/auth-api/account.d.ts +36 -0
- package/dist/types/routes/auth-api/authenticate.d.ts +31 -0
- package/dist/types/routes/auth-api/authorize.d.ts +239 -0
- package/dist/types/routes/auth-api/callback.d.ts +234 -0
- package/dist/types/routes/auth-api/connect-start.d.ts +52 -0
- package/dist/types/routes/auth-api/dbconnections.d.ts +43 -0
- package/dist/types/routes/auth-api/index.d.ts +1580 -0
- package/dist/types/routes/auth-api/logout.d.ts +20 -0
- package/dist/types/routes/auth-api/oidc-logout.d.ts +52 -0
- package/dist/types/routes/auth-api/passwordless.d.ts +154 -0
- package/dist/types/routes/auth-api/register/index.d.ts +159 -0
- package/dist/types/routes/auth-api/register/shared.d.ts +30 -0
- package/dist/types/routes/auth-api/revoke.d.ts +73 -0
- package/dist/types/routes/auth-api/token.d.ts +412 -0
- package/dist/types/routes/auth-api/userinfo.d.ts +84 -0
- package/dist/types/routes/auth-api/well-known.d.ts +74 -0
- package/dist/types/routes/management-api/action-executions.d.ts +90 -0
- package/dist/types/routes/management-api/action-triggers.d.ts +118 -0
- package/dist/types/routes/management-api/actions.d.ts +673 -0
- package/dist/types/routes/management-api/analytics.d.ts +18 -0
- package/dist/types/routes/management-api/attack-protection.d.ts +189 -0
- package/dist/types/routes/management-api/authentication-methods.d.ts +115 -0
- package/dist/types/routes/management-api/branding.d.ts +402 -0
- package/dist/types/routes/management-api/client-grants.d.ts +183 -0
- package/dist/types/routes/management-api/client-registration-tokens.d.ts +35 -0
- package/dist/types/routes/management-api/clients.d.ts +995 -0
- package/dist/types/routes/management-api/connections.d.ts +872 -0
- package/dist/types/routes/management-api/custom-domains.d.ts +266 -0
- package/dist/types/routes/management-api/email-templates.d.ts +205 -0
- package/dist/types/routes/management-api/emails.d.ts +124 -0
- package/dist/types/routes/management-api/failed-events.d.ts +146 -0
- package/dist/types/routes/management-api/flows.d.ts +438 -0
- package/dist/types/routes/management-api/forms.d.ts +4090 -0
- package/dist/types/routes/management-api/guardian.d.ts +211 -0
- package/dist/types/routes/management-api/hook-code.d.ts +142 -0
- package/dist/types/routes/management-api/hooks.d.ts +405 -0
- package/dist/types/routes/management-api/index.d.ts +13210 -0
- package/dist/types/routes/management-api/keys.d.ts +98 -0
- package/dist/types/routes/management-api/log-streams.d.ts +170 -0
- package/dist/types/routes/management-api/logs.d.ts +159 -0
- package/dist/types/routes/management-api/migration-sources.d.ts +173 -0
- package/dist/types/routes/management-api/organizations.d.ts +896 -0
- package/dist/types/routes/management-api/prompts.d.ts +150 -0
- package/dist/types/routes/management-api/refresh_tokens.d.ts +66 -0
- package/dist/types/routes/management-api/resource-servers.d.ts +321 -0
- package/dist/types/routes/management-api/roles.d.ts +260 -0
- package/dist/types/routes/management-api/sessions.d.ts +78 -0
- package/dist/types/routes/management-api/stats.d.ts +44 -0
- package/dist/types/routes/management-api/tenants.d.ts +546 -0
- package/dist/types/routes/management-api/themes.d.ts +265 -0
- package/dist/types/routes/management-api/tickets.d.ts +75 -0
- package/dist/types/routes/management-api/users-by-email.d.ts +23 -0
- package/dist/types/routes/management-api/users.d.ts +1085 -0
- package/dist/types/routes/saml/index.d.ts +64 -0
- package/dist/types/routes/saml/samlp.d.ts +64 -0
- package/dist/types/routes/setup.d.ts +6 -0
- package/dist/types/routes/universal-login/account-change-email-confirmation.d.ts +30 -0
- package/dist/types/routes/universal-login/account-change-email-verify.d.ts +66 -0
- package/dist/types/routes/universal-login/account-change-email.d.ts +58 -0
- package/dist/types/routes/universal-login/account.d.ts +64 -0
- package/dist/types/routes/universal-login/common.d.ts +1482 -0
- package/dist/types/routes/universal-login/continue.d.ts +37 -0
- package/dist/types/routes/universal-login/enter-password.d.ts +49 -0
- package/dist/types/routes/universal-login/error-handler.d.ts +14 -0
- package/dist/types/routes/universal-login/error-page.d.ts +32 -0
- package/dist/types/routes/universal-login/error.d.ts +20 -0
- package/dist/types/routes/universal-login/flow-api.d.ts +381 -0
- package/dist/types/routes/universal-login/flow-widget.d.ts +23 -0
- package/dist/types/routes/universal-login/forgot-password.d.ts +32 -0
- package/dist/types/routes/universal-login/form-node.d.ts +74 -0
- package/dist/types/routes/universal-login/identifier.d.ts +55 -0
- package/dist/types/routes/universal-login/impersonate.d.ts +71 -0
- package/dist/types/routes/universal-login/index.d.ts +748 -0
- package/dist/types/routes/universal-login/info.d.ts +20 -0
- package/dist/types/routes/universal-login/invalid-session.d.ts +19 -0
- package/dist/types/routes/universal-login/otp-challenge.d.ts +54 -0
- package/dist/types/routes/universal-login/pre-signup-sent.d.ts +19 -0
- package/dist/types/routes/universal-login/pre-signup.d.ts +32 -0
- package/dist/types/routes/universal-login/reset-password.d.ts +39 -0
- package/dist/types/routes/universal-login/sanitization-utils.d.ts +55 -0
- package/dist/types/routes/universal-login/screen-api.d.ts +20 -0
- package/dist/types/routes/universal-login/screens/accept-invitation.d.ts +13 -0
- package/dist/types/routes/universal-login/screens/account-delete.d.ts +14 -0
- package/dist/types/routes/universal-login/screens/account-helpers.d.ts +13 -0
- package/dist/types/routes/universal-login/screens/account-linked.d.ts +14 -0
- package/dist/types/routes/universal-login/screens/account-mfa-phone-enrollment.d.ts +10 -0
- package/dist/types/routes/universal-login/screens/account-mfa-totp-enrollment.d.ts +10 -0
- package/dist/types/routes/universal-login/screens/account-passkeys.d.ts +10 -0
- package/dist/types/routes/universal-login/screens/account-profile.d.ts +14 -0
- package/dist/types/routes/universal-login/screens/account-security.d.ts +14 -0
- package/dist/types/routes/universal-login/screens/account.d.ts +14 -0
- package/dist/types/routes/universal-login/screens/connect-consent.d.ts +9 -0
- package/dist/types/routes/universal-login/screens/connect-tenant-select.d.ts +13 -0
- package/dist/types/routes/universal-login/screens/email-otp-challenge.d.ts +14 -0
- package/dist/types/routes/universal-login/screens/enter-password.d.ts +14 -0
- package/dist/types/routes/universal-login/screens/forgot-password.d.ts +11 -0
- package/dist/types/routes/universal-login/screens/identifier.d.ts +14 -0
- package/dist/types/routes/universal-login/screens/impersonate.d.ts +15 -0
- package/dist/types/routes/universal-login/screens/index.d.ts +29 -0
- package/dist/types/routes/universal-login/screens/login-passwordless-identifier.d.ts +17 -0
- package/dist/types/routes/universal-login/screens/login.d.ts +17 -0
- package/dist/types/routes/universal-login/screens/magic-link-sent.d.ts +11 -0
- package/dist/types/routes/universal-login/screens/mfa-login-options.d.ts +21 -0
- package/dist/types/routes/universal-login/screens/mfa-phone-challenge.d.ts +14 -0
- package/dist/types/routes/universal-login/screens/mfa-phone-enrollment.d.ts +14 -0
- package/dist/types/routes/universal-login/screens/mfa-totp-challenge.d.ts +14 -0
- package/dist/types/routes/universal-login/screens/mfa-totp-enrollment.d.ts +17 -0
- package/dist/types/routes/universal-login/screens/passkey-challenge.d.ts +16 -0
- package/dist/types/routes/universal-login/screens/passkey-enrollment-nudge.d.ts +17 -0
- package/dist/types/routes/universal-login/screens/passkey-enrollment.d.ts +11 -0
- package/dist/types/routes/universal-login/screens/passkey-utils.d.ts +100 -0
- package/dist/types/routes/universal-login/screens/registry.d.ts +28 -0
- package/dist/types/routes/universal-login/screens/reset-password-code.d.ts +18 -0
- package/dist/types/routes/universal-login/screens/reset-password.d.ts +36 -0
- package/dist/types/routes/universal-login/screens/signup.d.ts +14 -0
- package/dist/types/routes/universal-login/screens/sms-otp-challenge.d.ts +14 -0
- package/dist/types/routes/universal-login/screens/try-connection-result.d.ts +12 -0
- package/dist/types/routes/universal-login/screens/types.d.ts +167 -0
- package/dist/types/routes/universal-login/signup.d.ts +54 -0
- package/dist/types/routes/universal-login/u2-form-node.d.ts +93 -0
- package/dist/types/routes/universal-login/u2-index.d.ts +173 -0
- package/dist/types/routes/universal-login/u2-routes.d.ts +98 -0
- package/dist/types/routes/universal-login/u2-widget-page.d.ts +187 -0
- package/dist/types/routes/universal-login/universal-login-template.d.ts +55 -0
- package/dist/types/routes/universal-login/validate-email.d.ts +20 -0
- package/dist/types/routes/universal-login/widget-routes.d.ts +81 -0
- package/dist/types/seed.d.ts +86 -0
- package/dist/types/state-machines/index.d.ts +1 -0
- package/dist/types/state-machines/login-session.d.ts +173 -0
- package/dist/types/storybook-utils/HonoJSXWrapper.d.ts +43 -0
- package/dist/types/strategies/apple.d.ts +24 -0
- package/dist/types/strategies/facebook.d.ts +20 -0
- package/dist/types/strategies/github.d.ts +23 -0
- package/dist/types/strategies/google-oauth2.d.ts +43 -0
- package/dist/types/strategies/index.d.ts +69 -0
- package/dist/types/strategies/internal-oauth2.d.ts +17 -0
- package/dist/types/strategies/microsoft.d.ts +24 -0
- package/dist/types/strategies/oauth2.d.ts +38 -0
- package/dist/types/strategies/oidc.d.ts +38 -0
- package/dist/types/strategies/saml.d.ts +9 -0
- package/dist/types/strategies/vipps.d.ts +16 -0
- package/dist/types/styles/index.d.ts +9 -0
- package/dist/types/styles/tailwind.d.ts +1 -0
- package/dist/types/types/Auth0Client.d.ts +9 -0
- package/dist/types/types/AuthError.d.ts +14 -0
- package/dist/types/types/AuthHeroConfig.d.ts +415 -0
- package/dist/types/types/Bindings.d.ts +51 -0
- package/dist/types/types/GrantFlowResult.d.ts +22 -0
- package/dist/types/types/Hooks.d.ts +240 -0
- package/dist/types/types/IdToken.d.ts +30 -0
- package/dist/types/types/UserInfo.d.ts +8 -0
- package/dist/types/types/Variables.d.ts +33 -0
- package/dist/types/types/auth0/Query.d.ts +12 -0
- package/dist/types/types/auth0/Totals.d.ts +11 -0
- package/dist/types/types/auth0/UserResponse.d.ts +46 -0
- package/dist/types/types/auth0/index.d.ts +3 -0
- package/dist/types/types/index.d.ts +6 -0
- package/dist/types/types/saml.d.ts +1 -0
- package/dist/types/utils/append-log.d.ts +10 -0
- package/dist/types/utils/auth-header.d.ts +18 -0
- package/dist/types/utils/auth0-upstream.d.ts +60 -0
- package/dist/types/utils/authIframe.d.ts +11 -0
- package/dist/types/utils/client-info.d.ts +47 -0
- package/dist/types/utils/color.d.ts +23 -0
- package/dist/types/utils/connections.d.ts +11 -0
- package/dist/types/utils/cookies.d.ts +28 -0
- package/dist/types/utils/crypto.d.ts +2 -0
- package/dist/types/utils/deep-merge.d.ts +6 -0
- package/dist/types/utils/encryption.d.ts +22 -0
- package/dist/types/utils/entity-id.d.ts +13 -0
- package/dist/types/utils/fetchAll.d.ts +60 -0
- package/dist/types/utils/form-post.d.ts +1 -0
- package/dist/types/utils/id-token-hash.d.ts +1 -0
- package/dist/types/utils/incognito.d.ts +11 -0
- package/dist/types/utils/instance-to-json.d.ts +8 -0
- package/dist/types/utils/ip.d.ts +8 -0
- package/dist/types/utils/is-valid-redirect-url.d.ts +4 -0
- package/dist/types/utils/jwk-alg.d.ts +20 -0
- package/dist/types/utils/jwks.d.ts +41 -0
- package/dist/types/utils/jwt.d.ts +15 -0
- package/dist/types/utils/organization-id.d.ts +2 -0
- package/dist/types/utils/otp.d.ts +1 -0
- package/dist/types/utils/refresh-token-format.d.ts +20 -0
- package/dist/types/utils/safe-compare.d.ts +1 -0
- package/dist/types/utils/sort.d.ts +4 -0
- package/dist/types/utils/ssrf-fetch.d.ts +44 -0
- package/dist/types/utils/ulid.d.ts +1 -0
- package/dist/types/utils/url.d.ts +16 -0
- package/dist/types/utils/user-id.d.ts +2 -0
- package/dist/types/utils/username-password-provider.d.ts +67 -0
- package/dist/types/utils/username.d.ts +11 -0
- package/dist/types/variables.d.ts +4 -0
- package/package.json +11 -11
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { HookEvent, OnExecutePostLogin } from "../../types/Hooks";
|
|
2
|
+
export interface AccountLinkingOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Require `email_verified` on the logged-in user before attempting to link.
|
|
5
|
+
* Disabling this is almost never what you want — unverified email linking
|
|
6
|
+
* lets an attacker claim existing accounts by signing up with a matching
|
|
7
|
+
* email on an unverifying provider.
|
|
8
|
+
* @default true
|
|
9
|
+
*/
|
|
10
|
+
requireVerifiedEmail?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* When the link is performed, merge the secondary user's `user_metadata`
|
|
13
|
+
* into the primary's. Existing keys on the primary are NOT overwritten —
|
|
14
|
+
* only keys absent from the primary are filled in from the secondary, so
|
|
15
|
+
* the primary remains the source of truth for any conflicting values.
|
|
16
|
+
*
|
|
17
|
+
* `app_metadata` is intentionally never copied to avoid auto-merging into
|
|
18
|
+
* the admin-only namespace.
|
|
19
|
+
*
|
|
20
|
+
* @default false
|
|
21
|
+
*/
|
|
22
|
+
copyUserMetadata?: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Trigger-agnostic event handler used by all `account-linking` template
|
|
26
|
+
* dispatch sites. It accepts the same shape as `OnExecutePostLogin` but
|
|
27
|
+
* ignores the trigger-specific `api` object, which lets the same function
|
|
28
|
+
* back `post-user-login`, `post-user-registration`, and `post-user-update`.
|
|
29
|
+
*/
|
|
30
|
+
export type AccountLinkingHandler = (event: HookEvent) => Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Idempotently links a user to an existing primary user with the same
|
|
33
|
+
* (verified) email address. Safe to invoke from any trigger that has a
|
|
34
|
+
* `user` and a `tenant.id` on the event — `post-user-login`,
|
|
35
|
+
* `post-user-registration`, or `post-user-update`.
|
|
36
|
+
*
|
|
37
|
+
* This is the Auth0-style "Account Linking" action: customers enable it by
|
|
38
|
+
* creating a template hook with `template_id: "account-linking"`. Because
|
|
39
|
+
* the implementation is a no-op when linking is already correct, transient
|
|
40
|
+
* failures self-heal — a later trigger simply retries the link.
|
|
41
|
+
*
|
|
42
|
+
* **Behavior:**
|
|
43
|
+
* - No-op if the user already has `linked_to` set (already a secondary).
|
|
44
|
+
* - No-op if the user has no email or `email_verified` is false (default).
|
|
45
|
+
* - Looks up the primary user with the same email via
|
|
46
|
+
* `getPrimaryUserByEmail`. If found AND it's not the user themselves,
|
|
47
|
+
* sets `linked_to` on the user to point at that primary.
|
|
48
|
+
* - Never unlinks; if the current user is already the primary it stays so.
|
|
49
|
+
*
|
|
50
|
+
* **Idempotency:** repeated calls produce the same end state.
|
|
51
|
+
*
|
|
52
|
+
* @example Enable as a config-level post-login hook
|
|
53
|
+
* ```typescript
|
|
54
|
+
* import { init, preDefinedHooks } from "authhero";
|
|
55
|
+
*
|
|
56
|
+
* init({
|
|
57
|
+
* dataAdapter,
|
|
58
|
+
* hooks: {
|
|
59
|
+
* onExecutePostLogin: preDefinedHooks.accountLinking(),
|
|
60
|
+
* },
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @example Enable as a per-tenant template hook (admin API)
|
|
65
|
+
* ```typescript
|
|
66
|
+
* await data.hooks.create(tenantId, {
|
|
67
|
+
* trigger_id: "post-user-registration",
|
|
68
|
+
* template_id: "account-linking",
|
|
69
|
+
* enabled: true,
|
|
70
|
+
* });
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function accountLinking(options?: AccountLinkingOptions): OnExecutePostLogin & AccountLinkingHandler;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { OnExecutePostLogin } from "../../types/Hooks";
|
|
2
|
+
export interface EnsureUsernameOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The connection name used for username accounts.
|
|
5
|
+
* @default Strategy.USERNAME_PASSWORD
|
|
6
|
+
*/
|
|
7
|
+
connection?: string;
|
|
8
|
+
/**
|
|
9
|
+
* The provider used for username accounts.
|
|
10
|
+
* @default USERNAME_PASSWORD_PROVIDER
|
|
11
|
+
*/
|
|
12
|
+
provider?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Maximum number of attempts to find a unique username before giving up.
|
|
15
|
+
* @default 10
|
|
16
|
+
*/
|
|
17
|
+
maxRetries?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Slugify a string into a valid username.
|
|
21
|
+
*
|
|
22
|
+
* - Lowercases and normalizes unicode (NFD + strip diacritics)
|
|
23
|
+
* - Replaces non-alphanumeric characters with hyphens
|
|
24
|
+
* - Collapses consecutive hyphens
|
|
25
|
+
* - Trims leading/trailing hyphens
|
|
26
|
+
* - Returns undefined if the result is empty
|
|
27
|
+
*/
|
|
28
|
+
export declare function slugify(input: string): string | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Extract candidate usernames from a user's profile fields.
|
|
31
|
+
*
|
|
32
|
+
* Tries the following fields in order:
|
|
33
|
+
* 1. nickname
|
|
34
|
+
* 2. name
|
|
35
|
+
* 3. Local part of email (before @)
|
|
36
|
+
* 4. phone_number
|
|
37
|
+
*
|
|
38
|
+
* Each value is slugified. Duplicates are removed while preserving order.
|
|
39
|
+
*/
|
|
40
|
+
export declare function extractCandidateUsernames(user: {
|
|
41
|
+
nickname?: string | null;
|
|
42
|
+
name?: string | null;
|
|
43
|
+
email?: string | null;
|
|
44
|
+
phone_number?: string | null;
|
|
45
|
+
}): string[];
|
|
46
|
+
/**
|
|
47
|
+
* Creates a post-login hook that ensures every user has a username.
|
|
48
|
+
*
|
|
49
|
+
* **Behavior:**
|
|
50
|
+
* - If the user is a username-type account (username-password provider), it verifies
|
|
51
|
+
* the `username` field is set. If not, it picks one from the profile fields.
|
|
52
|
+
* - If the user logged in via another provider (email, social, SMS), it checks
|
|
53
|
+
* whether a linked username account already exists. If not, it creates a new
|
|
54
|
+
* username account and links it to the current user.
|
|
55
|
+
*
|
|
56
|
+
* **Username candidate extraction (in order):**
|
|
57
|
+
* 1. `nickname`
|
|
58
|
+
* 2. `name`
|
|
59
|
+
* 3. Local part of `email` (before `@`)
|
|
60
|
+
* 4. `phone_number`
|
|
61
|
+
*
|
|
62
|
+
* Each candidate is slugified (lowercased, non-alphanum replaced with hyphens).
|
|
63
|
+
* If the slug is taken, numeric suffixes are tried (e.g. `john`, `john2`, `john3`).
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* import { init, preDefinedHooks } from "authhero";
|
|
68
|
+
*
|
|
69
|
+
* const { app } = init({
|
|
70
|
+
* dataAdapter,
|
|
71
|
+
* hooks: {
|
|
72
|
+
* onExecutePostLogin: preDefinedHooks.ensureUsername(),
|
|
73
|
+
* },
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @example Custom connection name
|
|
78
|
+
* ```typescript
|
|
79
|
+
* preDefinedHooks.ensureUsername({
|
|
80
|
+
* connection: "my-username-connection",
|
|
81
|
+
* provider: USERNAME_PASSWORD_PROVIDER,
|
|
82
|
+
* maxRetries: 20,
|
|
83
|
+
* })
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
export declare function ensureUsername(options?: EnsureUsernameOptions): OnExecutePostLogin;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-defined hooks library for AuthHero.
|
|
3
|
+
*
|
|
4
|
+
* These are ready-to-use hooks that implement common authentication patterns.
|
|
5
|
+
* Users can connect them via the `hooks` configuration in AuthHeroConfig.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { init, preDefinedHooks } from "authhero";
|
|
10
|
+
*
|
|
11
|
+
* const { app } = init({
|
|
12
|
+
* dataAdapter,
|
|
13
|
+
* hooks: {
|
|
14
|
+
* onExecutePostLogin: preDefinedHooks.ensureUsername(),
|
|
15
|
+
* },
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export { ensureUsername } from "./ensure-username";
|
|
20
|
+
export type { EnsureUsernameOptions } from "./ensure-username";
|
|
21
|
+
export { setPreferredUsername } from "./set-preferred-username";
|
|
22
|
+
export { accountLinking } from "./account-linking";
|
|
23
|
+
export type { AccountLinkingOptions } from "./account-linking";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { OnExecuteCredentialsExchange } from "../../types/Hooks";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a credentials-exchange hook that sets the `preferred_username`
|
|
4
|
+
* claim on both access and ID tokens.
|
|
5
|
+
*
|
|
6
|
+
* The username is resolved from the primary user or any linked identity.
|
|
7
|
+
* If no username is found, the hook does nothing.
|
|
8
|
+
*
|
|
9
|
+
* **Resolution order:**
|
|
10
|
+
* 1. `user.username` — direct username on the primary user
|
|
11
|
+
* 2. `user.preferred_username` — existing preferred_username field
|
|
12
|
+
* 3. Linked identities — first identity with `username` or `profileData.username`
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* import { init, preDefinedHooks } from "authhero";
|
|
17
|
+
*
|
|
18
|
+
* const { app } = init({
|
|
19
|
+
* dataAdapter,
|
|
20
|
+
* hooks: {
|
|
21
|
+
* onExecuteCredentialsExchange: preDefinedHooks.setPreferredUsername(),
|
|
22
|
+
* },
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function setPreferredUsername(): OnExecuteCredentialsExchange;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { Bindings, Variables } from "../types";
|
|
3
|
+
import { User } from "@authhero/adapter-interfaces";
|
|
4
|
+
import { OnExecuteCredentialsExchangeAPI } from "../types/Hooks";
|
|
5
|
+
export declare function isTemplateHook(hook: any): hook is {
|
|
6
|
+
template_id: string;
|
|
7
|
+
enabled: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Handles a template hook by executing the corresponding pre-defined hook function.
|
|
11
|
+
* Template hooks map to code-level pre-defined hooks that can be enabled per-tenant
|
|
12
|
+
* through the admin UI without requiring server configuration changes.
|
|
13
|
+
*
|
|
14
|
+
* `metadata` carries the configuring tenant's options for the template — see
|
|
15
|
+
* `hookBaseCommonProperties.metadata` in the adapter-interfaces Hook schema.
|
|
16
|
+
* Each template that takes options reads its keys from here.
|
|
17
|
+
*/
|
|
18
|
+
export declare function handleTemplateHook(ctx: Context<{
|
|
19
|
+
Bindings: Bindings;
|
|
20
|
+
Variables: Variables;
|
|
21
|
+
}>, template_id: string, user: User, metadata?: Record<string, unknown>): Promise<User>;
|
|
22
|
+
/**
|
|
23
|
+
* Handles a credentials-exchange template hook by executing the corresponding
|
|
24
|
+
* pre-defined hook function that sets custom claims on tokens.
|
|
25
|
+
*/
|
|
26
|
+
export declare function handleCredentialsExchangeTemplateHook(ctx: Context<{
|
|
27
|
+
Bindings: Bindings;
|
|
28
|
+
Variables: Variables;
|
|
29
|
+
}>, template_id: string, user: User, api: OnExecuteCredentialsExchangeAPI): Promise<void>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { DataAdapters } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { Bindings, Variables } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Decorator applied by `addDataHooks` to `users.remove`. Runs pre-deletion
|
|
6
|
+
* hooks (outside any transaction), then executes the unlink-secondaries +
|
|
7
|
+
* delete-primary inside a single `data.transaction` so the user graph is
|
|
8
|
+
* never left half-demolished. Post-deletion webhook delivery is handed to
|
|
9
|
+
* the outbox for retryable dispatch.
|
|
10
|
+
*/
|
|
11
|
+
export declare function createUserDeletionHooks(ctx: Context<{
|
|
12
|
+
Bindings: Bindings;
|
|
13
|
+
Variables: Variables;
|
|
14
|
+
}>, data: DataAdapters): (tenant_id: string, user_id: string) => Promise<boolean>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { DataAdapters, User } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { Bindings, Variables } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Decorator applied by `addDataHooks` to `users.create`. Runs the full
|
|
6
|
+
* pre-commit/commit/publish pipeline for a user creation:
|
|
7
|
+
*
|
|
8
|
+
* 1. Pre-registration blocking hooks (outside any transaction so webhook
|
|
9
|
+
* latency and user-authored code don't hold a DB connection).
|
|
10
|
+
* 2. `commitUserHook` — the internal transactional step that atomically
|
|
11
|
+
* writes the user row (via `rawCreate`) and, when the built-in
|
|
12
|
+
* email-based linking path is enabled, also resolves `linked_to` from
|
|
13
|
+
* the existing primary inside the same transaction.
|
|
14
|
+
* 3. Post-registration hooks — webhook delivery is handed to the outbox
|
|
15
|
+
* (`enqueuePostHookEvent`) for retryable / idempotent dispatch; code
|
|
16
|
+
* hooks currently still run inline with ctx.
|
|
17
|
+
*/
|
|
18
|
+
export declare function createUserHooks(ctx: Context<{
|
|
19
|
+
Bindings: Bindings;
|
|
20
|
+
Variables: Variables;
|
|
21
|
+
}>, data: DataAdapters): (tenant_id: string, user: User) => Promise<{
|
|
22
|
+
connection: string;
|
|
23
|
+
email_verified: boolean;
|
|
24
|
+
created_at: string;
|
|
25
|
+
updated_at: string;
|
|
26
|
+
user_id: string;
|
|
27
|
+
provider: string;
|
|
28
|
+
is_social: boolean;
|
|
29
|
+
login_count: number;
|
|
30
|
+
name?: string | undefined;
|
|
31
|
+
username?: string | undefined;
|
|
32
|
+
given_name?: string | undefined;
|
|
33
|
+
phone_number?: string | undefined;
|
|
34
|
+
phone_verified?: boolean | undefined;
|
|
35
|
+
family_name?: string | undefined;
|
|
36
|
+
profileData?: string | undefined;
|
|
37
|
+
address?: {
|
|
38
|
+
formatted?: string | undefined;
|
|
39
|
+
street_address?: string | undefined;
|
|
40
|
+
locality?: string | undefined;
|
|
41
|
+
region?: string | undefined;
|
|
42
|
+
postal_code?: string | undefined;
|
|
43
|
+
country?: string | undefined;
|
|
44
|
+
} | undefined;
|
|
45
|
+
nickname?: string | undefined;
|
|
46
|
+
picture?: string | undefined;
|
|
47
|
+
locale?: string | undefined;
|
|
48
|
+
linked_to?: string | undefined;
|
|
49
|
+
app_metadata?: any;
|
|
50
|
+
user_metadata?: any;
|
|
51
|
+
middle_name?: string | undefined;
|
|
52
|
+
preferred_username?: string | undefined;
|
|
53
|
+
profile?: string | undefined;
|
|
54
|
+
website?: string | undefined;
|
|
55
|
+
gender?: string | undefined;
|
|
56
|
+
birthdate?: string | undefined;
|
|
57
|
+
zoneinfo?: string | undefined;
|
|
58
|
+
verify_email?: boolean | undefined;
|
|
59
|
+
last_ip?: string | undefined;
|
|
60
|
+
last_login?: string | undefined;
|
|
61
|
+
registration_completed_at?: string | undefined;
|
|
62
|
+
email?: string | undefined;
|
|
63
|
+
identities?: {
|
|
64
|
+
connection: string;
|
|
65
|
+
user_id: string;
|
|
66
|
+
provider: string;
|
|
67
|
+
isSocial: boolean;
|
|
68
|
+
email?: string | undefined;
|
|
69
|
+
email_verified?: boolean | undefined;
|
|
70
|
+
phone_number?: string | undefined;
|
|
71
|
+
phone_verified?: boolean | undefined;
|
|
72
|
+
username?: string | undefined;
|
|
73
|
+
access_token?: string | undefined;
|
|
74
|
+
access_token_secret?: string | undefined;
|
|
75
|
+
refresh_token?: string | undefined;
|
|
76
|
+
profileData?: {
|
|
77
|
+
[x: string]: any;
|
|
78
|
+
email?: string | undefined;
|
|
79
|
+
email_verified?: boolean | undefined;
|
|
80
|
+
name?: string | undefined;
|
|
81
|
+
username?: string | undefined;
|
|
82
|
+
given_name?: string | undefined;
|
|
83
|
+
phone_number?: string | undefined;
|
|
84
|
+
phone_verified?: boolean | undefined;
|
|
85
|
+
family_name?: string | undefined;
|
|
86
|
+
} | undefined;
|
|
87
|
+
}[] | undefined;
|
|
88
|
+
}>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { DataAdapters, UserDataAdapter } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { Bindings, Variables } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Decorator applied by `addDataHooks` to `users.update`. Fires pre-update
|
|
6
|
+
* hooks, then commits the update inside its own `data.transaction(...)` so
|
|
7
|
+
* the write plus any follow-up email-based account linking are atomic.
|
|
8
|
+
*
|
|
9
|
+
* The single-field `linked_to` update fast-path at the top bypasses hooks to
|
|
10
|
+
* avoid recursion when `commitUserHook` or the account-linking template call
|
|
11
|
+
* back into `users.update`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createUserUpdateHooks(ctx: Context<{
|
|
14
|
+
Bindings: Bindings;
|
|
15
|
+
Variables: Variables;
|
|
16
|
+
}>, data: DataAdapters): UserDataAdapter["update"];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { DataAdapters } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { Bindings, Variables } from "../types";
|
|
4
|
+
import { EnrichedClient } from "../helpers/client";
|
|
5
|
+
/**
|
|
6
|
+
* Validates if an email can be used for signup based on client settings.
|
|
7
|
+
* This is a lightweight check that can be done early (e.g., on identifier page)
|
|
8
|
+
* without committing to creating a user.
|
|
9
|
+
*
|
|
10
|
+
* Supports code-based hooks via onExecuteValidateRegistrationUsername
|
|
11
|
+
*
|
|
12
|
+
* @returns An object with `allowed` boolean and optional `reason` string
|
|
13
|
+
*/
|
|
14
|
+
export declare function validateSignupEmail(ctx: Context<{
|
|
15
|
+
Bindings: Bindings;
|
|
16
|
+
Variables: Variables;
|
|
17
|
+
}>, client: EnrichedClient, data: DataAdapters, email: string, connection?: string, options?: {
|
|
18
|
+
identifierPreflight?: boolean;
|
|
19
|
+
}): Promise<{
|
|
20
|
+
allowed: boolean;
|
|
21
|
+
reason?: string;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Pre-user signup hook that runs RIGHT BEFORE user creation.
|
|
25
|
+
* This runs for ALL signup methods (email/password, code, social, etc.)
|
|
26
|
+
* and enforces signup policies and invokes webhooks.
|
|
27
|
+
*
|
|
28
|
+
* This hook is called from createUserHooks and will throw an HTTPException
|
|
29
|
+
* if the signup should be blocked.
|
|
30
|
+
*/
|
|
31
|
+
export declare function preUserSignupHook(ctx: Context<{
|
|
32
|
+
Bindings: Bindings;
|
|
33
|
+
Variables: Variables;
|
|
34
|
+
}>, client: EnrichedClient, data: DataAdapters, email: string, connection?: string): Promise<void>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { DataAdapters, Hook, User } from "@authhero/adapter-interfaces";
|
|
2
|
+
import { Context } from "hono";
|
|
3
|
+
import { Variables, Bindings } from "../types";
|
|
4
|
+
export declare function invokeHooks(ctx: Context<{
|
|
5
|
+
Bindings: Bindings;
|
|
6
|
+
Variables: Variables;
|
|
7
|
+
}>, hooks: Hook[], data: any & {
|
|
8
|
+
tenant_id: string;
|
|
9
|
+
}): Promise<void>;
|
|
10
|
+
export declare function postUserRegistrationWebhook(ctx: Context<{
|
|
11
|
+
Bindings: Bindings;
|
|
12
|
+
Variables: Variables;
|
|
13
|
+
}>): (tenant_id: string, user: User) => Promise<User>;
|
|
14
|
+
export declare function preUserRegistrationWebhook(ctx: Context<{
|
|
15
|
+
Bindings: Bindings;
|
|
16
|
+
Variables: Variables;
|
|
17
|
+
}>): (tenant_id: string, email: string) => Promise<void>;
|
|
18
|
+
export declare const preUserSignupWebhook: typeof preUserRegistrationWebhook;
|
|
19
|
+
export declare function postUserLoginWebhook(ctx: Context<{
|
|
20
|
+
Bindings: Bindings;
|
|
21
|
+
Variables: Variables;
|
|
22
|
+
}>, data: DataAdapters): (tenant_id: string, user: User) => Promise<User>;
|
|
23
|
+
export declare function getValidateRegistrationUsernameWebhook(ctx: Context<{
|
|
24
|
+
Bindings: Bindings;
|
|
25
|
+
Variables: Variables;
|
|
26
|
+
}>, tenant_id: string): Promise<Hook | null>;
|
|
27
|
+
export declare const getValidateSignupEmailWebhook: typeof getValidateRegistrationUsernameWebhook;
|
|
28
|
+
export declare function preUserDeletionWebhook(ctx: Context<{
|
|
29
|
+
Bindings: Bindings;
|
|
30
|
+
Variables: Variables;
|
|
31
|
+
}>): (tenant_id: string, user: User) => Promise<User>;
|
|
32
|
+
export declare function postUserDeletionWebhook(ctx: Context<{
|
|
33
|
+
Bindings: Bindings;
|
|
34
|
+
Variables: Variables;
|
|
35
|
+
}>): (tenant_id: string, user: User) => Promise<User>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* i18n with custom text override support
|
|
3
|
+
*
|
|
4
|
+
* Loads Auth0-format locale JSON files at build time and provides
|
|
5
|
+
* screen-scoped translation functions.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { createTranslation } from '../i18n';
|
|
10
|
+
*
|
|
11
|
+
* const { m } = createTranslation('login-id', 'login-id', 'nb', customTextFromDb);
|
|
12
|
+
* m.title() // "Velkommen" (or custom override if set)
|
|
13
|
+
* m.description({ companyName: 'Acme', clientName: 'App' })
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
import type { CustomText } from "@authhero/adapter-interfaces";
|
|
17
|
+
import type { ScreenMap } from "../generated/locale-types";
|
|
18
|
+
export type { ScreenMap } from "../generated/locale-types";
|
|
19
|
+
export type { Locale } from "../generated/locale-types";
|
|
20
|
+
export type TranslationMap = Record<string, (variables?: Record<string, unknown>) => string>;
|
|
21
|
+
export declare const locales: readonly ["cs", "da", "en", "fi", "it", "nb", "pl", "sv"];
|
|
22
|
+
export declare const baseLocale: "en";
|
|
23
|
+
/**
|
|
24
|
+
* Native display names for each supported locale. Used by the language picker
|
|
25
|
+
* in the universal-login chrome. Keys must stay in sync with `locales` above —
|
|
26
|
+
* adding a locale here without a JSON file (or vice versa) will leave the
|
|
27
|
+
* picker showing a raw code instead of a name.
|
|
28
|
+
*/
|
|
29
|
+
export declare const LOCALE_DISPLAY_NAMES: Record<(typeof locales)[number], string>;
|
|
30
|
+
/**
|
|
31
|
+
* Resolve a locale code to its native display name, falling back to the
|
|
32
|
+
* raw code when the locale is not recognised.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getLocaleDisplayName(lang: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Create a screen-scoped translation object.
|
|
37
|
+
*
|
|
38
|
+
* Returns a typed object matching the generated ScreenMap when prompt/screen
|
|
39
|
+
* are known string literals, or a generic TranslationMap for dynamic keys.
|
|
40
|
+
*
|
|
41
|
+
* @param prompt - The prompt ID (e.g., 'login-id', 'signup')
|
|
42
|
+
* @param screen - The screen ID (e.g., 'login-id', 'signup')
|
|
43
|
+
* @param locale - The locale code (e.g., 'nb', 'en', 'sv')
|
|
44
|
+
* @param customText - Optional custom text overrides from database
|
|
45
|
+
*/
|
|
46
|
+
export declare function createTranslation<P extends string, S extends string>(prompt: P, screen: S, locale: string, customText?: CustomText): {
|
|
47
|
+
m: `${P}.${S}` extends keyof ScreenMap ? ScreenMap[`${P}.${S}`] : TranslationMap;
|
|
48
|
+
locale: (typeof locales)[number];
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Check if a locale is supported.
|
|
52
|
+
*/
|
|
53
|
+
export declare function isLocaleSupported(locale: string): boolean;
|
|
54
|
+
/**
|
|
55
|
+
* Get locale defaults for a specific prompt and language.
|
|
56
|
+
* Used by the management API prompts endpoint.
|
|
57
|
+
*
|
|
58
|
+
* Returns the nested screen → key → value structure for the given prompt,
|
|
59
|
+
* falling back to English if the requested language isn't available.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getLocaleDefaults(prompt: string, language: string): Record<string, Record<string, string>>;
|
|
62
|
+
export interface LocaleDefaultsEntry {
|
|
63
|
+
prompt: string;
|
|
64
|
+
language: string;
|
|
65
|
+
custom_text: Record<string, Record<string, string>>;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Enumerate every bundled locale default as a flat list of
|
|
69
|
+
* `{ prompt, language, custom_text }` entries, optionally filtered by
|
|
70
|
+
* language and/or prompt. Powers the `/api/v2/prompts/custom-text/defaults`
|
|
71
|
+
* endpoint so the admin UI can render placeholders and discover which
|
|
72
|
+
* forms exist without round-tripping per (prompt, language) pair.
|
|
73
|
+
*/
|
|
74
|
+
export declare function getAllLocaleDefaults(filter?: {
|
|
75
|
+
language?: string;
|
|
76
|
+
prompt?: string;
|
|
77
|
+
}): LocaleDefaultsEntry[];
|