authhero 5.8.1 → 5.9.1
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 +135 -135
- package/dist/authhero.d.ts +17853 -72311
- package/dist/authhero.mjs +16401 -16771
- 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 +16022 -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 +13277 -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 +90 -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 +337 -0
- package/dist/types/routes/universal-login/u2-routes.d.ts +262 -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/define-route.d.ts +20 -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,58 @@
|
|
|
1
|
+
import { DataAdapters } from "@authhero/adapter-interfaces";
|
|
2
|
+
import type { WebhookInvoker } from "../types/AuthHeroConfig";
|
|
3
|
+
export interface RunOutboxRelayConfig {
|
|
4
|
+
/** Same `DataAdapters` passed to `init()`. Must include `outbox` to drain. */
|
|
5
|
+
dataAdapter: DataAdapters;
|
|
6
|
+
/**
|
|
7
|
+
* Issuer URL used when minting per-tenant `auth-service` tokens (typically
|
|
8
|
+
* your `env.ISSUER`). Webhook handlers that validate `iss` against this
|
|
9
|
+
* URL will accept tokens from both the inline dispatcher and this cron
|
|
10
|
+
* relay.
|
|
11
|
+
*/
|
|
12
|
+
issuer: string;
|
|
13
|
+
/**
|
|
14
|
+
* Optional webhook invoker — same shape as the one accepted by `init()`.
|
|
15
|
+
* When provided, cron-drained `hook.*` events go through this invoker,
|
|
16
|
+
* matching the inline per-request dispatch path exactly.
|
|
17
|
+
*/
|
|
18
|
+
webhookInvoker?: WebhookInvoker;
|
|
19
|
+
/** Days to retain processed events before cleanup. Default 7. */
|
|
20
|
+
retentionDays?: number;
|
|
21
|
+
/** Forwarded to `drainOutbox`. */
|
|
22
|
+
batchSize?: number;
|
|
23
|
+
/** Forwarded to `drainOutbox`. */
|
|
24
|
+
maxRetries?: number;
|
|
25
|
+
/** Webhook HTTP timeout (ms), when the default invoker is used. */
|
|
26
|
+
webhookTimeoutMs?: number;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* One-call outbox relay for cron / scheduled handlers.
|
|
30
|
+
*
|
|
31
|
+
* Internally:
|
|
32
|
+
* 1. Skips gracefully when `dataAdapter.outbox` is undefined.
|
|
33
|
+
* 2. Builds the same destination array as the inline dispatcher
|
|
34
|
+
* (`LogsDestination`, `WebhookDestination`, `RegistrationFinalizerDestination`).
|
|
35
|
+
* 3. Mints per-tenant service tokens via the same in-process path
|
|
36
|
+
* (`createServiceTokenCore`) that the request-time webhookInvoker uses,
|
|
37
|
+
* driven by the supplied dataAdapter.
|
|
38
|
+
* 4. Runs `drainOutbox`, then `cleanupOutbox`.
|
|
39
|
+
*
|
|
40
|
+
* This is intended to be the entire body of a consumer's scheduled handler
|
|
41
|
+
* for outbox maintenance — consumers should not need to call `drainOutbox` /
|
|
42
|
+
* `cleanupOutbox` / `createDefaultDestinations` directly.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* export default {
|
|
47
|
+
* async scheduled(_event, env) {
|
|
48
|
+
* await runOutboxRelay({
|
|
49
|
+
* dataAdapter,
|
|
50
|
+
* issuer: env.ISSUER,
|
|
51
|
+
* webhookInvoker, // same function passed to init()
|
|
52
|
+
* retentionDays: 7,
|
|
53
|
+
* });
|
|
54
|
+
* },
|
|
55
|
+
* };
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function runOutboxRelay(config: RunOutboxRelayConfig): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@authhero/saml";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { User } from "@authhero/adapter-interfaces";
|
|
2
|
+
export declare function getStandardClaim(user: User, claim: string): unknown | undefined;
|
|
3
|
+
export declare function buildScopeClaims(user: User, scopes: string[]): Record<string, unknown>;
|
|
4
|
+
export declare function buildRequestedClaims(user: User, claimNames: Iterable<string>): Record<string, unknown>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { GrantType } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { Bindings, Variables } from "../types";
|
|
4
|
+
interface BaseScopesAndPermissionsParams {
|
|
5
|
+
tenantId: string;
|
|
6
|
+
clientId: string;
|
|
7
|
+
audience: string;
|
|
8
|
+
requestedScopes: string[];
|
|
9
|
+
organizationId?: string;
|
|
10
|
+
}
|
|
11
|
+
interface ClientCredentialsScopesAndPermissionsParams extends BaseScopesAndPermissionsParams {
|
|
12
|
+
grantType: GrantType.ClientCredential;
|
|
13
|
+
userId?: never;
|
|
14
|
+
}
|
|
15
|
+
interface UserBasedScopesAndPermissionsParams extends BaseScopesAndPermissionsParams {
|
|
16
|
+
grantType?: GrantType.AuthorizationCode | GrantType.RefreshToken | GrantType.Password | GrantType.Passwordless | GrantType.OTP | undefined;
|
|
17
|
+
userId: string;
|
|
18
|
+
}
|
|
19
|
+
export type CalculateScopesAndPermissionsParams = ClientCredentialsScopesAndPermissionsParams | UserBasedScopesAndPermissionsParams;
|
|
20
|
+
export interface ScopesAndPermissionsResult {
|
|
21
|
+
scopes: string[];
|
|
22
|
+
permissions: string[];
|
|
23
|
+
token_lifetime: number;
|
|
24
|
+
token_lifetime_for_web: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Calculates the scopes and permissions for a user based on the audience and resource server configuration.
|
|
28
|
+
* This function implements Auth0-like behavior for RBAC and token dialects.
|
|
29
|
+
*
|
|
30
|
+
* @param ctx - The Hono context
|
|
31
|
+
* @param params - Parameters containing tenant ID, user ID, audience, and requested scopes
|
|
32
|
+
* @returns Object containing calculated scopes and permissions
|
|
33
|
+
*/
|
|
34
|
+
export declare function calculateScopesAndPermissions(ctx: Context<{
|
|
35
|
+
Bindings: Bindings;
|
|
36
|
+
Variables: Variables;
|
|
37
|
+
}>, params: CalculateScopesAndPermissionsParams): Promise<ScopesAndPermissionsResult>;
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { DataAdapters } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { Bindings, Variables } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Adds server-timing middleware logging to all adapter methods
|
|
6
|
+
* This wraps each method of the data adapter to measure its execution time
|
|
7
|
+
* and adds it to the server-timing header
|
|
8
|
+
*/
|
|
9
|
+
export declare function addTimingLogs(ctx: Context<{
|
|
10
|
+
Bindings: Bindings;
|
|
11
|
+
Variables: Variables;
|
|
12
|
+
}>, data: DataAdapters): DataAdapters;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { KeysAdapter, TenantsDataAdapter } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { Bindings, Variables } from "../types";
|
|
4
|
+
import { SigningKeyModeOption } from "../types/AuthHeroConfig";
|
|
5
|
+
declare const AUTH_SERVICE_CLIENT_ID = "auth-service";
|
|
6
|
+
export interface ServiceTokenResponse {
|
|
7
|
+
access_token: string;
|
|
8
|
+
token_type: "Bearer";
|
|
9
|
+
expires_in: number;
|
|
10
|
+
}
|
|
11
|
+
export interface CreateServiceTokenCoreParams {
|
|
12
|
+
tenants: TenantsDataAdapter;
|
|
13
|
+
keys: KeysAdapter;
|
|
14
|
+
tenantId: string;
|
|
15
|
+
scope: string;
|
|
16
|
+
issuer: string;
|
|
17
|
+
expiresInSeconds?: number;
|
|
18
|
+
customClaims?: Record<string, unknown>;
|
|
19
|
+
/**
|
|
20
|
+
* Optional per-tenant signing-key bucket selector. When unset the
|
|
21
|
+
* tenant uses the shared control-plane keys (legacy behavior) which
|
|
22
|
+
* keeps existing outbox/cron callers working without any change.
|
|
23
|
+
*/
|
|
24
|
+
signingKeyMode?: SigningKeyModeOption;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Ctx-free service token minter. Produces a signed JWT for the `auth-service`
|
|
28
|
+
* client using the tenant's current JWT signing key. Intended to be shared
|
|
29
|
+
* between the request-time outbox dispatcher and the cron `runOutboxRelay`
|
|
30
|
+
* helper so both paths emit tokens with identical issuer, subject, tenant
|
|
31
|
+
* binding, and signing key.
|
|
32
|
+
*/
|
|
33
|
+
export declare function createServiceTokenCore(params: CreateServiceTokenCoreParams): Promise<ServiceTokenResponse>;
|
|
34
|
+
export declare function createServiceToken(ctx: Context<{
|
|
35
|
+
Bindings: Bindings;
|
|
36
|
+
Variables: Variables;
|
|
37
|
+
}>, tenant_id: string, scope: string, expiresInSeconds?: number, customClaims?: Record<string, unknown>): Promise<{
|
|
38
|
+
access_token: string;
|
|
39
|
+
token_type: string;
|
|
40
|
+
expires_in: number;
|
|
41
|
+
}>;
|
|
42
|
+
/**
|
|
43
|
+
* Bound ctx-free token factory for outbox destinations. Mirrors the shape
|
|
44
|
+
* expected by `WebhookDestination` and `createDefaultDestinations` but uses
|
|
45
|
+
* `createServiceTokenCore` under the hood so the inline per-request outbox
|
|
46
|
+
* dispatcher and the cron `runOutboxRelay` emit identical tokens.
|
|
47
|
+
*/
|
|
48
|
+
export declare function makeOutboxServiceTokenFactory(deps: {
|
|
49
|
+
tenants: TenantsDataAdapter;
|
|
50
|
+
keys: KeysAdapter;
|
|
51
|
+
issuer: string;
|
|
52
|
+
signingKeyMode?: SigningKeyModeOption;
|
|
53
|
+
}): (tenantId: string, scope?: string) => Promise<string>;
|
|
54
|
+
export { AUTH_SERVICE_CLIENT_ID };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { Bindings, Variables } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Sets the tenant_id in context if not already set.
|
|
5
|
+
* If tenant_id is already set, validates it matches the expected tenant.
|
|
6
|
+
* Throws if there's a mismatch to prevent cross-tenant attacks.
|
|
7
|
+
*
|
|
8
|
+
* @param ctx - Hono context
|
|
9
|
+
* @param tenantId - The expected tenant ID (e.g., from a client lookup)
|
|
10
|
+
* @throws HTTPException if tenant_id is already set and doesn't match
|
|
11
|
+
*/
|
|
12
|
+
export declare function setTenantId(ctx: Context<{
|
|
13
|
+
Bindings: Bindings;
|
|
14
|
+
Variables: Variables;
|
|
15
|
+
}>, tenantId: string): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { SigningKey, KeysAdapter } from "@authhero/adapter-interfaces";
|
|
2
|
+
import { SigningKeyMode, SigningKeyModeOption } from "../types/AuthHeroConfig";
|
|
3
|
+
export declare function resolveSigningKeyMode(option: SigningKeyModeOption | undefined, tenantId: string): Promise<SigningKeyMode>;
|
|
4
|
+
export interface ResolveSigningKeysOptions {
|
|
5
|
+
/**
|
|
6
|
+
* `"sign"` returns at most one key — the tenant's newest non-revoked key
|
|
7
|
+
* if available, else the control-plane fallback. `"publish"` returns the
|
|
8
|
+
* full set used for JWKS: control-plane only when mode is
|
|
9
|
+
* `"control-plane"`, tenant ∪ control-plane when mode is `"tenant"` so
|
|
10
|
+
* tokens signed by either bucket still verify during rotation.
|
|
11
|
+
*/
|
|
12
|
+
purpose: "sign" | "publish";
|
|
13
|
+
/** Defaults to `"jwt_signing"`. Pass `"saml_encryption"` for SAML keys. */
|
|
14
|
+
type?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function resolveSigningKeys(keys: KeysAdapter, tenantId: string, modeOption: SigningKeyModeOption | undefined, opts: ResolveSigningKeysOptions): Promise<SigningKey[]>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Bindings } from "../types";
|
|
2
|
+
export declare function getTryConnectionResultPath(): string;
|
|
3
|
+
export declare function getTryConnectionResultUrl(env: Bindings, customDomain?: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* Idempotently ensure the per-tenant "Try Connection" client exists.
|
|
6
|
+
*
|
|
7
|
+
* The client has no explicit connection enablement — `getEnrichedClient`'s
|
|
8
|
+
* fallback then exposes every tenant connection on it, so the same client
|
|
9
|
+
* can drive a test for any connection without re-provisioning.
|
|
10
|
+
*
|
|
11
|
+
* Its only registered callback is the universal-login result page; the
|
|
12
|
+
* /authorize handler additionally allows the issuer + universal-login
|
|
13
|
+
* wildcards which already cover that URL.
|
|
14
|
+
*/
|
|
15
|
+
export declare function ensureTryConnectionClient(env: Bindings, tenantId: string): Promise<string>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { Bindings, Variables } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* Returns true when the built-in email-based linking path should run.
|
|
5
|
+
*
|
|
6
|
+
* The built-in path performs the legacy `getPrimaryUserByEmail` lookup at
|
|
7
|
+
* user creation and email update. With `userLinkingMode: "off"` it is
|
|
8
|
+
* skipped entirely and linking only happens via the `account-linking`
|
|
9
|
+
* template hook.
|
|
10
|
+
*/
|
|
11
|
+
export declare function builtInUserLinkingEnabled(ctx: Context<{
|
|
12
|
+
Bindings: Bindings;
|
|
13
|
+
Variables: Variables;
|
|
14
|
+
}>, tenant_id: string, client_id?: string): Promise<boolean>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { DataAdapters } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { Bindings, Variables } from "../types";
|
|
4
|
+
export interface UserSessionCleanupParams {
|
|
5
|
+
tenantId?: string;
|
|
6
|
+
userId?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Context-free session cleanup for use in scheduled handlers / cron jobs.
|
|
10
|
+
* Deletes expired login_sessions, sessions, and refresh_tokens, optionally
|
|
11
|
+
* scoped to a tenant and/or user.
|
|
12
|
+
*/
|
|
13
|
+
export declare function cleanupSessions(data: DataAdapters, params?: UserSessionCleanupParams): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Per-request wrapper around cleanupSessions. Designed to be called with
|
|
16
|
+
* waitUntil after creating a new login session.
|
|
17
|
+
*/
|
|
18
|
+
export declare function cleanupUserSessions(ctx: Context<{
|
|
19
|
+
Bindings: Bindings;
|
|
20
|
+
Variables: Variables;
|
|
21
|
+
}>, params: UserSessionCleanupParams): Promise<void>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { User, UserDataAdapter } from "@authhero/adapter-interfaces";
|
|
2
|
+
import { EnrichedClient } from "./client";
|
|
3
|
+
import { Context } from "hono";
|
|
4
|
+
import { Bindings, Variables } from "../types";
|
|
5
|
+
export declare function getUsersByEmail(userAdapter: UserDataAdapter, tenantId: string, email: string): Promise<User[]>;
|
|
6
|
+
interface GetUserByProviderParams {
|
|
7
|
+
userAdapter: UserDataAdapter;
|
|
8
|
+
tenant_id: string;
|
|
9
|
+
username: string;
|
|
10
|
+
provider: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function getUserByProvider({ userAdapter, tenant_id, username, provider, }: GetUserByProviderParams): Promise<User | null>;
|
|
13
|
+
interface GetPrimaryUserByEmailParams {
|
|
14
|
+
userAdapter: UserDataAdapter;
|
|
15
|
+
tenant_id: string;
|
|
16
|
+
email: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function getPrimaryUserByEmail({ userAdapter, tenant_id, email, }: GetPrimaryUserByEmailParams): Promise<User | undefined>;
|
|
19
|
+
interface GetPrimaryUserByProviderParams {
|
|
20
|
+
userAdapter: UserDataAdapter;
|
|
21
|
+
tenant_id: string;
|
|
22
|
+
username: string;
|
|
23
|
+
provider: string;
|
|
24
|
+
}
|
|
25
|
+
export declare function getPrimaryUserByProvider({ userAdapter, tenant_id, username, provider, }: GetPrimaryUserByProviderParams): Promise<User | null>;
|
|
26
|
+
interface GetOrCreateUserByProviderParams {
|
|
27
|
+
client: EnrichedClient;
|
|
28
|
+
username: string;
|
|
29
|
+
provider: string;
|
|
30
|
+
connection: string;
|
|
31
|
+
userId?: string;
|
|
32
|
+
profileData?: Record<string, unknown>;
|
|
33
|
+
ip?: string;
|
|
34
|
+
isSocial: boolean;
|
|
35
|
+
set_user_root_attributes?: "on_each_login" | "on_first_login" | "never_on_login";
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* This function will either fetch an existing user for a provider or create it
|
|
39
|
+
* @param param0
|
|
40
|
+
* @returns
|
|
41
|
+
*/
|
|
42
|
+
export declare function getOrCreateUserByProvider(ctx: Context<{
|
|
43
|
+
Bindings: Bindings;
|
|
44
|
+
Variables: Variables;
|
|
45
|
+
}>, params: GetOrCreateUserByProviderParams): Promise<User>;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
/**
|
|
3
|
+
* Register a background promise tied to the current request.
|
|
4
|
+
*
|
|
5
|
+
* On Cloudflare Workers (`workerd`), this uses `executionCtx.waitUntil`, which
|
|
6
|
+
* holds the worker alive until the promise settles but does not block the
|
|
7
|
+
* response.
|
|
8
|
+
*
|
|
9
|
+
* On Node/Bun and in tests we instead collect the promise on the context so a
|
|
10
|
+
* surrounding middleware can await it before the response leaves. Without this
|
|
11
|
+
* the response can return before background work (audit log writes, outbox
|
|
12
|
+
* webhook dispatches) completes, producing flaky test behavior and requests
|
|
13
|
+
* that occasionally lose tail work if the process exits.
|
|
14
|
+
*/
|
|
15
|
+
export declare function waitUntil(ctx: Context, promise: Promise<unknown>): void;
|
|
16
|
+
/**
|
|
17
|
+
* Await any `waitUntil` promises registered during the current request. Invoke
|
|
18
|
+
* from a middleware's finally block (after `await next()`) so non-Workers
|
|
19
|
+
* runtimes flush background work before returning the response.
|
|
20
|
+
*/
|
|
21
|
+
export declare function flushBackgroundPromises(ctx: Context): Promise<void>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { DataAdapters } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { Bindings, Variables } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Wrap a raw `DataAdapters` with lifecycle hooks for user CRUD operations.
|
|
6
|
+
*
|
|
7
|
+
* Read methods and non-user entities pass through untouched. `users.create`,
|
|
8
|
+
* `users.update`, and `users.remove` are replaced with decorated versions
|
|
9
|
+
* that run pre/post hooks, apply the narrow transactional commits, and
|
|
10
|
+
* dispatch post-event outbox messages. `users.rawCreate` is NOT decorated —
|
|
11
|
+
* commit paths call it directly to bypass the hook layer by design.
|
|
12
|
+
*/
|
|
13
|
+
export declare function addDataHooks(ctx: Context<{
|
|
14
|
+
Bindings: Bindings;
|
|
15
|
+
Variables: Variables;
|
|
16
|
+
}>, data: DataAdapters): DataAdapters;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CodeExecutionResult, CodeExecutor } from "@authhero/adapter-interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* Local code executor using `new Function()`.
|
|
4
|
+
* Suitable for local development only — no isolation or sandboxing.
|
|
5
|
+
*/
|
|
6
|
+
export declare class LocalCodeExecutor implements CodeExecutor {
|
|
7
|
+
execute(params: {
|
|
8
|
+
code: string;
|
|
9
|
+
triggerId: string;
|
|
10
|
+
event: Record<string, unknown>;
|
|
11
|
+
timeoutMs?: number;
|
|
12
|
+
}): Promise<CodeExecutionResult>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { ActionExecutionResult, CodeExecutionLog, DataAdapters, Hook } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { Bindings, Variables } from "../types";
|
|
4
|
+
import { HookEvent, OnExecuteCredentialsExchangeAPI } from "../types/Hooks";
|
|
5
|
+
/**
|
|
6
|
+
* Auth0 uses `post-login` for what we internally call `post-user-login`.
|
|
7
|
+
* Normalize when writing execution records so the public API matches Auth0.
|
|
8
|
+
*/
|
|
9
|
+
export declare function toAuth0TriggerId(internal: string): string;
|
|
10
|
+
type CodeHook = Extract<Hook, {
|
|
11
|
+
code_id: string;
|
|
12
|
+
}>;
|
|
13
|
+
export declare function isCodeHook(hook: Hook): hook is CodeHook;
|
|
14
|
+
/**
|
|
15
|
+
* Build a serializable event object from a HookEvent.
|
|
16
|
+
* Strips the `ctx` property (Hono context) which cannot be serialized,
|
|
17
|
+
* and returns a plain JSON-compatible object.
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildSerializableEvent(event: HookEvent, secrets?: Record<string, string>): Record<string, unknown>;
|
|
20
|
+
/**
|
|
21
|
+
* Replay recorded API calls from code hook execution against real API objects.
|
|
22
|
+
* Handles calls like "accessToken.setCustomClaim" by navigating the api object.
|
|
23
|
+
*/
|
|
24
|
+
export declare function replayApiCalls(apiCalls: Array<{
|
|
25
|
+
method: string;
|
|
26
|
+
args: unknown[];
|
|
27
|
+
}>, api: Record<string, any>): void;
|
|
28
|
+
export type HandleCodeHookOutcome = {
|
|
29
|
+
result: ActionExecutionResult;
|
|
30
|
+
logs: CodeExecutionLog[];
|
|
31
|
+
/** True if api.access.deny was recorded by the executor. */
|
|
32
|
+
denied: boolean;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Execute a code hook by fetching the code from the database, running it
|
|
36
|
+
* through the code executor, and replaying API calls against the real api
|
|
37
|
+
* object.
|
|
38
|
+
*
|
|
39
|
+
* Returns the per-action result (Auth0 shape) so the caller can aggregate
|
|
40
|
+
* results across all actions on a trigger into a single `action_executions`
|
|
41
|
+
* record. Returns `null` when the code cannot be located or the executor is
|
|
42
|
+
* unavailable — the caller decides whether to surface that.
|
|
43
|
+
*/
|
|
44
|
+
export declare function handleCodeHook(ctx: Context<{
|
|
45
|
+
Bindings: Bindings;
|
|
46
|
+
Variables: Variables;
|
|
47
|
+
}>, data: DataAdapters, hook: {
|
|
48
|
+
code_id: string;
|
|
49
|
+
hook_id: string;
|
|
50
|
+
}, event: HookEvent, triggerId: string, api: Record<string, any>): Promise<HandleCodeHookOutcome | null>;
|
|
51
|
+
/**
|
|
52
|
+
* Aggregate per-action outcomes into an Auth0-shape execution record and
|
|
53
|
+
* persist it via the adapter. Returns the generated execution_id (uuid)
|
|
54
|
+
* so the caller can embed it in the surrounding tenant log.
|
|
55
|
+
*/
|
|
56
|
+
export declare function persistActionExecution(data: DataAdapters, tenant_id: string, triggerId: string, outcomes: HandleCodeHookOutcome[]): Promise<string | null>;
|
|
57
|
+
/**
|
|
58
|
+
* Execute code hooks for the credentials-exchange trigger.
|
|
59
|
+
* Filters enabled code hooks from the provided hooks list and executes them.
|
|
60
|
+
*
|
|
61
|
+
* Returns the persisted `execution_id` so the caller can embed it in the
|
|
62
|
+
* surrounding tenant log (the standard token-exchange log entry). The
|
|
63
|
+
* execution record itself follows Auth0's shape — see
|
|
64
|
+
* GET /api/v2/actions/executions/:id.
|
|
65
|
+
*/
|
|
66
|
+
export declare function handleCredentialsExchangeCodeHooks(ctx: Context<{
|
|
67
|
+
Bindings: Bindings;
|
|
68
|
+
Variables: Variables;
|
|
69
|
+
}>, hooks: any[], event: HookEvent, api: OnExecuteCredentialsExchangeAPI): Promise<string | null>;
|
|
70
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { Bindings, Variables } from "../types";
|
|
3
|
+
import { FORM_FIELD_TYPES, LoginSession, Node, User } from "@authhero/adapter-interfaces";
|
|
4
|
+
import { EnrichedClient } from "../helpers/client";
|
|
5
|
+
export { FORM_FIELD_TYPES };
|
|
6
|
+
export declare function isFormHook(hook: any): hook is {
|
|
7
|
+
form_id: string;
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Resolves a template string like "{{context.user.email}}", "{{user.id}}", or "{{$form.gender}}" to its actual value
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveTemplateField(field: string, context: ResolveContext): string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Context passed to resolveNode and condition evaluation
|
|
16
|
+
*/
|
|
17
|
+
export interface ResolveContext {
|
|
18
|
+
user: User;
|
|
19
|
+
submittedFields?: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Flow action type used during resolution
|
|
23
|
+
*/
|
|
24
|
+
interface FlowAction {
|
|
25
|
+
type: string;
|
|
26
|
+
action?: string;
|
|
27
|
+
params?: {
|
|
28
|
+
target?: "change-email" | "account" | "custom";
|
|
29
|
+
custom_url?: string;
|
|
30
|
+
user_id?: string;
|
|
31
|
+
connection_id?: string;
|
|
32
|
+
changes?: Record<string, unknown>;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Flow fetcher function type for async flow resolution
|
|
37
|
+
*/
|
|
38
|
+
export type FlowFetcher = (flowId: string) => Promise<{
|
|
39
|
+
actions?: FlowAction[];
|
|
40
|
+
} | null>;
|
|
41
|
+
/**
|
|
42
|
+
* Pending user update action to be executed by the caller
|
|
43
|
+
*/
|
|
44
|
+
export interface PendingUserUpdate {
|
|
45
|
+
user_id: string;
|
|
46
|
+
changes: Record<string, string>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Builds userUpdates object from a PendingUserUpdate's changes map.
|
|
50
|
+
* Handles dot-notation key prefixes:
|
|
51
|
+
* - "metadata.X" → user_metadata.X
|
|
52
|
+
* - "address.X" → address.X (nested OIDC address claim)
|
|
53
|
+
* - anything else → top-level user field
|
|
54
|
+
*/
|
|
55
|
+
export declare function buildUserUpdates(changes: Record<string, string>, existingUser: {
|
|
56
|
+
user_metadata?: unknown;
|
|
57
|
+
address?: unknown;
|
|
58
|
+
}): Record<string, unknown>;
|
|
59
|
+
/**
|
|
60
|
+
* Merge multiple PendingUserUpdate entries by user_id so that overlapping
|
|
61
|
+
* changes (e.g. two updates both touching metadata.*) are accumulated into
|
|
62
|
+
* a single changes map per user. This avoids the stale-snapshot problem
|
|
63
|
+
* where each call to buildUserUpdates would spread the *original* user
|
|
64
|
+
* object, causing later writes to overwrite earlier ones.
|
|
65
|
+
*/
|
|
66
|
+
export declare function mergeUserUpdates(updates: PendingUserUpdate[]): PendingUserUpdate[];
|
|
67
|
+
/**
|
|
68
|
+
* Result type for node resolution
|
|
69
|
+
*/
|
|
70
|
+
type ResolveNodeResult = {
|
|
71
|
+
type: "step";
|
|
72
|
+
nodeId: string;
|
|
73
|
+
userUpdates?: PendingUserUpdate[];
|
|
74
|
+
} | {
|
|
75
|
+
type: "redirect";
|
|
76
|
+
target: string;
|
|
77
|
+
customUrl?: string;
|
|
78
|
+
userUpdates?: PendingUserUpdate[];
|
|
79
|
+
} | {
|
|
80
|
+
type: "end";
|
|
81
|
+
userUpdates?: PendingUserUpdate[];
|
|
82
|
+
} | null;
|
|
83
|
+
/**
|
|
84
|
+
* Resolves the target redirect URL based on the target type
|
|
85
|
+
*/
|
|
86
|
+
export declare function getRedirectUrl(target: "change-email" | "account" | "custom", customUrl: string | undefined, state: string): string;
|
|
87
|
+
/**
|
|
88
|
+
* Resolves the first displayable node by following ROUTER, ACTION, and FLOW nodes
|
|
89
|
+
*/
|
|
90
|
+
export declare function resolveNode(nodes: Node[], startNodeId: string, context: ResolveContext, flowFetcher?: FlowFetcher, maxDepth?: number): Promise<ResolveNodeResult>;
|
|
91
|
+
/**
|
|
92
|
+
* Handles a form hook: validates the form exists and returns a redirect Response to the first node.
|
|
93
|
+
* If the form resolves to 'end' or no step node is found, returns the user to continue normal auth flow.
|
|
94
|
+
* Throws if the form or start node is missing.
|
|
95
|
+
*/
|
|
96
|
+
export declare function handleFormHook(ctx: Context<{
|
|
97
|
+
Bindings: Bindings;
|
|
98
|
+
Variables: Variables;
|
|
99
|
+
}>, form_id: string, loginSession: LoginSession, user?: User, client?: EnrichedClient): Promise<User | Response>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { Bindings, Variables } from "../../types";
|
|
3
|
+
/**
|
|
4
|
+
* Build the `token` API surface that user-authored hook code receives. A thin
|
|
5
|
+
* wrapper over `createServiceToken` that hides the underlying context so the
|
|
6
|
+
* hook runtime cannot mint tokens for arbitrary tenants.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createTokenAPI(ctx: Context<{
|
|
9
|
+
Bindings: Bindings;
|
|
10
|
+
Variables: Variables;
|
|
11
|
+
}>, tenant_id: string): {
|
|
12
|
+
createServiceToken: (params: {
|
|
13
|
+
scope: string;
|
|
14
|
+
expiresInSeconds?: number;
|
|
15
|
+
customClaims?: Record<string, unknown>;
|
|
16
|
+
}) => Promise<string>;
|
|
17
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public surface of the hooks subsystem. Implementation lives in sibling
|
|
3
|
+
* files split by trigger:
|
|
4
|
+
* - user-registration.ts — createUserHooks (decorator applied to users.create)
|
|
5
|
+
* - user-update.ts — createUserUpdateHooks (decorator applied to users.update)
|
|
6
|
+
* - user-deletion.ts — createUserDeletionHooks (decorator applied to users.remove)
|
|
7
|
+
* - validate-signup.ts — validateSignupEmail + preUserSignupHook
|
|
8
|
+
* - post-user-login.ts — postUserLoginHook (+ Auth0-compat event builder)
|
|
9
|
+
* - addDataHooks.ts — the decorator assembler wrapped around a DataAdapters
|
|
10
|
+
* - helpers/token-api.ts — createTokenAPI, shared by every trigger
|
|
11
|
+
*
|
|
12
|
+
* Internal implementation helpers (`createUserHooks`, `createUserUpdateHooks`,
|
|
13
|
+
* `createUserDeletionHooks`) are intentionally NOT re-exported — callers go
|
|
14
|
+
* through `addDataHooks`.
|
|
15
|
+
*/
|
|
16
|
+
export { addDataHooks } from "./addDataHooks";
|
|
17
|
+
export { validateSignupEmail, preUserSignupHook } from "./validate-signup";
|
|
18
|
+
export { postUserLoginHook } from "./post-user-login";
|
|
19
|
+
export { validateSignupEmail as validateRegistrationUsername } from "./validate-signup";
|
|
20
|
+
export { preUserSignupHook as preUserRegistrationHook } from "./validate-signup";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { DataAdapters, User } from "@authhero/adapter-interfaces";
|
|
2
|
+
export interface CommitUserResult {
|
|
3
|
+
user: User;
|
|
4
|
+
created: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface CommitUserOptions {
|
|
7
|
+
/**
|
|
8
|
+
* When true, attempt the legacy email-based primary lookup inside the
|
|
9
|
+
* commit transaction. When the user has a verified email and no
|
|
10
|
+
* `linked_to` is already set (e.g. by a pre-user-registration hook), the
|
|
11
|
+
* commit will automatically point `linked_to` at the existing primary
|
|
12
|
+
* user with the same email.
|
|
13
|
+
*
|
|
14
|
+
* Disable this to make linking opt-in via the `account-linking` template
|
|
15
|
+
* hook (the current direction of travel — long-term the legacy lookup
|
|
16
|
+
* goes away entirely).
|
|
17
|
+
*/
|
|
18
|
+
resolveEmailLinkedPrimary?: boolean;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Commits a new user inside a transaction. Validates `linked_to` (if set),
|
|
22
|
+
* runs `rawCreate`, and recovers from concurrent-create races.
|
|
23
|
+
*
|
|
24
|
+
* Optionally performs the legacy email→primary auto-link lookup inside the
|
|
25
|
+
* same transaction (see {@link CommitUserOptions.resolveEmailLinkedPrimary}).
|
|
26
|
+
* Whether it runs is decided by the caller via
|
|
27
|
+
* `builtInUserLinkingEnabled(ctx, tenant_id, client_id)`.
|
|
28
|
+
*/
|
|
29
|
+
export declare function commitUserHook(data: DataAdapters): (tenant_id: string, user: User, options?: CommitUserOptions) => Promise<CommitUserResult>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { Bindings, Variables } from "../types";
|
|
3
|
+
import { LoginSession, User } from "@authhero/adapter-interfaces";
|
|
4
|
+
export declare function isPageHook(hook: any): hook is {
|
|
5
|
+
page_id: string;
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
permission_required?: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Handles a page hook: checks if user has required permission and returns a redirect Response to the page.
|
|
11
|
+
* If user doesn't have the required permission, returns the user without redirect.
|
|
12
|
+
*/
|
|
13
|
+
export declare function handlePageHook(ctx: Context<{
|
|
14
|
+
Bindings: Bindings;
|
|
15
|
+
Variables: Variables;
|
|
16
|
+
}>, page_id: string, loginSession: LoginSession, user: User, permission_required?: string): Promise<User | Response>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { DataAdapters, LoginSession, User } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { Bindings, Variables } from "../types";
|
|
4
|
+
import { EnrichedClient } from "../helpers/client";
|
|
5
|
+
/**
|
|
6
|
+
* Checks for post-user-login hooks (form, page, template, code, or webhook)
|
|
7
|
+
* and handles them in that order. Also:
|
|
8
|
+
* - logs the successful login,
|
|
9
|
+
* - increments the user's `login_count`.
|
|
10
|
+
*
|
|
11
|
+
* Delivery reliability for `post-user-registration` is the outbox's concern
|
|
12
|
+
* (retry + dead-letter), not the login path's. Recovery of dead-lettered
|
|
13
|
+
* events is a separate admin/cron responsibility so a user's first login
|
|
14
|
+
* can't double-enqueue while the original event is still pending.
|
|
15
|
+
*
|
|
16
|
+
* Returns either the (possibly updated) user or a `Response` when a hook
|
|
17
|
+
* redirects, takes over the login, or renders a form.
|
|
18
|
+
*/
|
|
19
|
+
export declare function postUserLoginHook(ctx: Context<{
|
|
20
|
+
Bindings: Bindings;
|
|
21
|
+
Variables: Variables;
|
|
22
|
+
}>, data: DataAdapters, tenant_id: string, user: User, loginSession?: LoginSession, params?: {
|
|
23
|
+
client?: EnrichedClient;
|
|
24
|
+
authParams?: any;
|
|
25
|
+
authStrategy?: {
|
|
26
|
+
strategy: string;
|
|
27
|
+
strategy_type: string;
|
|
28
|
+
};
|
|
29
|
+
}): Promise<User | Response>;
|