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,83 @@
|
|
|
1
|
+
import { z } from "@hono/zod-openapi";
|
|
2
|
+
import type { Client, ClientInsert } from "@authhero/adapter-interfaces";
|
|
3
|
+
/**
|
|
4
|
+
* RFC 7591 §2 client metadata accepted at the DCR endpoint. Auth0's
|
|
5
|
+
* Management API uses `callbacks`; we map from RFC-standard `redirect_uris`
|
|
6
|
+
* at the wire boundary and back on response.
|
|
7
|
+
*
|
|
8
|
+
* The schema is strict (not passthrough) — unknown fields in the request
|
|
9
|
+
* are ignored rather than being echoed to the response. Forward-compat for
|
|
10
|
+
* RFC 7591 unknown fields can be added later via a separate `extensions`
|
|
11
|
+
* field or a `.passthrough()` once the dts-bundle-generator config allows
|
|
12
|
+
* the wider type.
|
|
13
|
+
*/
|
|
14
|
+
export declare const dcrRequestSchema: z.ZodObject<{
|
|
15
|
+
redirect_uris: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
16
|
+
client_name: z.ZodOptional<z.ZodString>;
|
|
17
|
+
client_uri: z.ZodOptional<z.ZodString>;
|
|
18
|
+
logo_uri: z.ZodOptional<z.ZodString>;
|
|
19
|
+
tos_uri: z.ZodOptional<z.ZodString>;
|
|
20
|
+
policy_uri: z.ZodOptional<z.ZodString>;
|
|
21
|
+
contacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
22
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
23
|
+
grant_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
24
|
+
response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
|
+
token_endpoint_auth_method: z.ZodOptional<z.ZodEnum<{
|
|
26
|
+
none: "none";
|
|
27
|
+
client_secret_post: "client_secret_post";
|
|
28
|
+
client_secret_basic: "client_secret_basic";
|
|
29
|
+
client_secret_jwt: "client_secret_jwt";
|
|
30
|
+
private_key_jwt: "private_key_jwt";
|
|
31
|
+
}>>;
|
|
32
|
+
jwks_uri: z.ZodOptional<z.ZodString>;
|
|
33
|
+
jwks: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
34
|
+
software_id: z.ZodOptional<z.ZodString>;
|
|
35
|
+
software_version: z.ZodOptional<z.ZodString>;
|
|
36
|
+
client_id: z.ZodOptional<z.ZodString>;
|
|
37
|
+
client_secret: z.ZodOptional<z.ZodString>;
|
|
38
|
+
audience: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
export type DcrRequest = z.infer<typeof dcrRequestSchema>;
|
|
41
|
+
export declare const dcrResponseSchema: z.ZodObject<{
|
|
42
|
+
client_id: z.ZodString;
|
|
43
|
+
client_secret: z.ZodOptional<z.ZodString>;
|
|
44
|
+
client_id_issued_at: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
client_secret_expires_at: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
registration_access_token: z.ZodOptional<z.ZodString>;
|
|
47
|
+
registration_client_uri: z.ZodString;
|
|
48
|
+
client_name: z.ZodOptional<z.ZodString>;
|
|
49
|
+
redirect_uris: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
50
|
+
grant_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
51
|
+
response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
52
|
+
token_endpoint_auth_method: z.ZodOptional<z.ZodString>;
|
|
53
|
+
logo_uri: z.ZodOptional<z.ZodString>;
|
|
54
|
+
client_uri: z.ZodOptional<z.ZodString>;
|
|
55
|
+
tos_uri: z.ZodOptional<z.ZodString>;
|
|
56
|
+
policy_uri: z.ZodOptional<z.ZodString>;
|
|
57
|
+
contacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
58
|
+
scope: z.ZodOptional<z.ZodString>;
|
|
59
|
+
jwks_uri: z.ZodOptional<z.ZodString>;
|
|
60
|
+
software_id: z.ZodOptional<z.ZodString>;
|
|
61
|
+
software_version: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
export type DcrResponse = z.infer<typeof dcrResponseSchema>;
|
|
64
|
+
export interface RegistrationMapping {
|
|
65
|
+
/** Fields suitable for ClientInsert (subset of Client). */
|
|
66
|
+
clientFields: Partial<ClientInsert>;
|
|
67
|
+
/** Additional metadata preserved on the client for round-trip. */
|
|
68
|
+
extraMetadata: Record<string, unknown>;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Map an RFC 7591 DCR request to internal Client fields.
|
|
72
|
+
*/
|
|
73
|
+
export declare function dcrRequestToClient(req: DcrRequest): RegistrationMapping;
|
|
74
|
+
/**
|
|
75
|
+
* Build the RFC 7591 §3.2.1 response body from a stored Client plus the
|
|
76
|
+
* issuance artifacts generated at registration time.
|
|
77
|
+
*/
|
|
78
|
+
export declare function clientToDcrResponse(client: Client, opts: {
|
|
79
|
+
client_secret?: string;
|
|
80
|
+
registration_access_token?: string;
|
|
81
|
+
registration_client_uri: string;
|
|
82
|
+
include_client_secret: boolean;
|
|
83
|
+
}): DcrResponse;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ClientRegistrationToken, ClientRegistrationTokensAdapter } from "@authhero/adapter-interfaces";
|
|
2
|
+
export interface MintIatOptions {
|
|
3
|
+
sub?: string;
|
|
4
|
+
constraints?: Record<string, unknown>;
|
|
5
|
+
expires_in_seconds?: number;
|
|
6
|
+
single_use?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface MintedIat {
|
|
9
|
+
id: string;
|
|
10
|
+
token: string;
|
|
11
|
+
expires_at: string;
|
|
12
|
+
record: ClientRegistrationToken;
|
|
13
|
+
}
|
|
14
|
+
export declare function mintIat(adapter: ClientRegistrationTokensAdapter, tenant_id: string, opts?: MintIatOptions): Promise<MintedIat>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface GeneratedRegistrationToken {
|
|
2
|
+
id: string;
|
|
3
|
+
token: string;
|
|
4
|
+
token_hash: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function hashRegistrationToken(token: string): Promise<string>;
|
|
7
|
+
export declare function mintRegistrationToken(): Promise<GeneratedRegistrationToken>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Validates an origin (scheme + host + port) supplied to `/connect/start`.
|
|
3
|
+
*
|
|
4
|
+
* HTTPS origins are always permitted. HTTP origins are permitted only when
|
|
5
|
+
* the host is loopback (RFC 8252 §7.3) or the exact origin appears in the
|
|
6
|
+
* tenant's `allow_http_return_to` allowlist.
|
|
7
|
+
*/
|
|
8
|
+
export type ValidConnectOrigin = {
|
|
9
|
+
ok: true;
|
|
10
|
+
origin: string;
|
|
11
|
+
isLoopback: boolean;
|
|
12
|
+
isAllowlisted: boolean;
|
|
13
|
+
isHttp: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type InvalidConnectOrigin = {
|
|
16
|
+
ok: false;
|
|
17
|
+
reason: string;
|
|
18
|
+
};
|
|
19
|
+
export type ConnectOriginResult = ValidConnectOrigin | InvalidConnectOrigin;
|
|
20
|
+
export declare function validateConnectOrigin(raw: string, allowHttp?: readonly string[]): ConnectOriginResult;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ClientRegistrationToken, ClientRegistrationTokensAdapter } from "@authhero/adapter-interfaces";
|
|
2
|
+
export type VerifyFailure = "not_found" | "wrong_type" | "expired" | "revoked" | "already_used";
|
|
3
|
+
export interface VerifyResult {
|
|
4
|
+
ok: boolean;
|
|
5
|
+
token?: ClientRegistrationToken;
|
|
6
|
+
failure?: VerifyFailure;
|
|
7
|
+
}
|
|
8
|
+
export declare function verifyRegistrationToken(adapter: ClientRegistrationTokensAdapter, tenant_id: string, plaintextToken: string, expectedType: "iat" | "rat"): Promise<VerifyResult>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { DataAdapters } from "@authhero/adapter-interfaces";
|
|
2
|
+
import { EventDestination } from "./outbox-relay";
|
|
3
|
+
import { type GetServiceToken } from "./outbox-destinations/webhooks";
|
|
4
|
+
import type { WebhookInvoker } from "../types/AuthHeroConfig";
|
|
5
|
+
export interface CreateDefaultDestinationsConfig {
|
|
6
|
+
/**
|
|
7
|
+
* Data adapter — only the `logs`, `hooks`, `users`, and `logStreams`
|
|
8
|
+
* adapters are used by the built-in destinations.
|
|
9
|
+
*/
|
|
10
|
+
dataAdapter: Pick<DataAdapters, "logs" | "hooks" | "users" | "logStreams">;
|
|
11
|
+
/**
|
|
12
|
+
* Produces a Bearer access token for the given tenant, used when POSTing
|
|
13
|
+
* `hook.*` events to the configured webhook URLs.
|
|
14
|
+
*
|
|
15
|
+
* Required if you want `hook.*` events to be drained. Omit for cron
|
|
16
|
+
* drains that only need to sweep up log events.
|
|
17
|
+
*/
|
|
18
|
+
getServiceToken?: GetServiceToken;
|
|
19
|
+
/** Webhook HTTP request timeout in ms (default: 10_000). */
|
|
20
|
+
webhookTimeoutMs?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Custom webhook invoker — same shape as the `webhookInvoker` option on
|
|
23
|
+
* `init()`. When provided, `hook.*` events are dispatched by calling this
|
|
24
|
+
* function instead of issuing a raw `fetch` with a Bearer token. Use this
|
|
25
|
+
* to match a consumer-configured invoker exactly, so cron-drained
|
|
26
|
+
* deliveries don't diverge from inline per-request ones.
|
|
27
|
+
*/
|
|
28
|
+
webhookInvoker?: WebhookInvoker;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Build the same array of outbox destinations that authhero's per-request
|
|
32
|
+
* `outboxMiddleware` constructs internally. Intended for consumers that want
|
|
33
|
+
* to run `drainOutbox` from a cron / scheduled handler as a safety net for
|
|
34
|
+
* events that failed per-request delivery.
|
|
35
|
+
*
|
|
36
|
+
* Without this helper, consumers would have to instantiate the destination
|
|
37
|
+
* classes themselves and stay in sync with their ordering and filtering
|
|
38
|
+
* rules (e.g. `RegistrationFinalizerDestination` must come AFTER
|
|
39
|
+
* `WebhookDestination`).
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* // Cloudflare Workers scheduled handler
|
|
44
|
+
* async scheduled(_event, env) {
|
|
45
|
+
* const destinations = createDefaultDestinations({
|
|
46
|
+
* dataAdapter,
|
|
47
|
+
* getServiceToken: async (tenantId) =>
|
|
48
|
+
* (await mintServiceToken(tenantId, "webhook")).access_token,
|
|
49
|
+
* });
|
|
50
|
+
* await drainOutbox(dataAdapter.outbox, destinations);
|
|
51
|
+
* await cleanupOutbox(dataAdapter.outbox, { retentionDays: 7 });
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare function createDefaultDestinations(config: CreateDefaultDestinationsConfig): EventDestination[];
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { DataAdapters } from "@authhero/adapter-interfaces";
|
|
2
|
+
import { EntityHooksConfig } from "../types/AuthHeroConfig";
|
|
3
|
+
/**
|
|
4
|
+
* Options for the entity hooks wrapper
|
|
5
|
+
*/
|
|
6
|
+
export interface EntityHooksWrapperOptions {
|
|
7
|
+
/** The tenant ID for the hook context */
|
|
8
|
+
tenantId: string;
|
|
9
|
+
/** Entity hooks configuration */
|
|
10
|
+
entityHooks?: EntityHooksConfig;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Adds entity hooks to data adapters.
|
|
14
|
+
* This wraps each entity adapter's CRUD methods to call the configured hooks.
|
|
15
|
+
*
|
|
16
|
+
* Hooks must be provided as arrays. Multiple hooks are chained together with
|
|
17
|
+
* proper return value handling for "before" hooks.
|
|
18
|
+
*
|
|
19
|
+
* @example Single hook
|
|
20
|
+
* ```typescript
|
|
21
|
+
* const wrappedData = addEntityHooks(data, {
|
|
22
|
+
* tenantId: ctx.var.tenant_id,
|
|
23
|
+
* entityHooks: {
|
|
24
|
+
* roles: [{
|
|
25
|
+
* afterCreate: async (ctx, role) => {
|
|
26
|
+
* await syncToChildTenants(ctx, role);
|
|
27
|
+
* },
|
|
28
|
+
* }],
|
|
29
|
+
* },
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example Chaining multiple hooks
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const wrappedData = addEntityHooks(data, {
|
|
36
|
+
* tenantId: ctx.var.tenant_id,
|
|
37
|
+
* entityHooks: {
|
|
38
|
+
* roles: [syncHooks, auditHooks], // Called in order
|
|
39
|
+
* },
|
|
40
|
+
* });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export declare function addEntityHooks(data: DataAdapters, options: EntityHooksWrapperOptions): DataAdapters;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { User } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { Bindings, Variables } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Enqueue a `hook.{triggerId}` event to the outbox so the `WebhookDestination`
|
|
6
|
+
* (and future `CodeHookDestination`) can dispatch the hook asynchronously with
|
|
7
|
+
* retries instead of firing inline while the request is being served.
|
|
8
|
+
*
|
|
9
|
+
* Mirrors the synchronous-push pattern used by `logMessage`: the promise from
|
|
10
|
+
* `outbox.create` is pushed onto `ctx.var.outboxEventPromises` so the outbox
|
|
11
|
+
* middleware can await it in its finally block and then relay the resulting
|
|
12
|
+
* event IDs.
|
|
13
|
+
*
|
|
14
|
+
* When the outbox is not configured, falls back to inline webhook invocation
|
|
15
|
+
* (via `waitUntil`) so tenants without outbox still receive webhook calls.
|
|
16
|
+
*/
|
|
17
|
+
export declare function enqueuePostHookEvent(ctx: Context<{
|
|
18
|
+
Bindings: Bindings;
|
|
19
|
+
Variables: Variables;
|
|
20
|
+
}>, tenantId: string, triggerId: string, user: User): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { User } from "@authhero/adapter-interfaces";
|
|
2
|
+
export type ExternalUser = Omit<User, "registration_completed_at">;
|
|
3
|
+
/**
|
|
4
|
+
* Remove fields that are tracked internally for self-healing/bookkeeping
|
|
5
|
+
* but must never reach customer-facing payloads (webhooks, code hooks,
|
|
6
|
+
* `onExecutePostLogin` event, outbox `target.after`, etc.).
|
|
7
|
+
*/
|
|
8
|
+
export declare function stripInternalUserFields(user: User): ExternalUser;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type Connection } from "@authhero/adapter-interfaces";
|
|
2
|
+
import { type StrategyHandler } from "../strategies";
|
|
3
|
+
export declare function findHrdConnection(email: string, connections: readonly Connection[], envStrategies?: Record<string, StrategyHandler>): Connection | undefined;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { Context } from "hono";
|
|
2
|
+
import { DataAdapters, LogType } from "@authhero/adapter-interfaces";
|
|
3
|
+
import { Variables, Bindings } from "../types";
|
|
4
|
+
export type LogParams = {
|
|
5
|
+
type: LogType;
|
|
6
|
+
description?: string;
|
|
7
|
+
userId?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Identifier of the actor when it differs from the subject `userId`
|
|
10
|
+
* (e.g. impersonation). When set, audit events attribute `actor.id` to
|
|
11
|
+
* this value and `target.id` to `userId`, and the event is categorised as
|
|
12
|
+
* `admin_action`.
|
|
13
|
+
*/
|
|
14
|
+
actorUserId?: string;
|
|
15
|
+
body?: unknown;
|
|
16
|
+
strategy?: string;
|
|
17
|
+
strategy_type?: string;
|
|
18
|
+
connection?: string;
|
|
19
|
+
audience?: string;
|
|
20
|
+
scope?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Response details to include in the log (for Management API operations)
|
|
23
|
+
*/
|
|
24
|
+
response?: {
|
|
25
|
+
statusCode: number;
|
|
26
|
+
body?: unknown;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* When provided, replaces the auto-generated details object entirely.
|
|
30
|
+
* Use this to store a compact, pre-built details payload (e.g. for webhook logs)
|
|
31
|
+
* that fits within storage limits (Analytics Engine blob: 1024 bytes).
|
|
32
|
+
*/
|
|
33
|
+
details?: Record<string, unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* If true, wait for the log to complete before returning.
|
|
36
|
+
* If false (default), execute logging asynchronously in the background.
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
39
|
+
waitForCompletion?: boolean;
|
|
40
|
+
/** Entity state before the mutation (for audit events) */
|
|
41
|
+
beforeState?: Record<string, unknown>;
|
|
42
|
+
/** Entity state after the mutation (for audit events) */
|
|
43
|
+
afterState?: Record<string, unknown>;
|
|
44
|
+
/** Entity type being mutated (e.g. 'user', 'client', 'connection') */
|
|
45
|
+
targetType?: string;
|
|
46
|
+
/** Entity ID being mutated */
|
|
47
|
+
targetId?: string;
|
|
48
|
+
};
|
|
49
|
+
export declare function logMessage(ctx: Context<{
|
|
50
|
+
Bindings: Bindings;
|
|
51
|
+
Variables: Variables;
|
|
52
|
+
}>, tenantId: string, params: LogParams): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Transactional variant of {@link logMessage}. Writes the audit event to the
|
|
55
|
+
* outbox through the caller-provided `trxData` so the insert commits (or rolls
|
|
56
|
+
* back) with the surrounding business write. Returns the event id so the
|
|
57
|
+
* caller can hand it to the outbox middleware for destination delivery.
|
|
58
|
+
*
|
|
59
|
+
* Only intended for outbox-enabled deployments; callers should fall back to
|
|
60
|
+
* `logMessage` when `ctx.env.outbox?.enabled` is false.
|
|
61
|
+
*/
|
|
62
|
+
export declare function logMessageInTx(ctx: Context<{
|
|
63
|
+
Bindings: Bindings;
|
|
64
|
+
Variables: Variables;
|
|
65
|
+
}>, trxData: DataAdapters, tenantId: string, params: LogParams): Promise<string | undefined>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { OutboxAdapter } from "@authhero/adapter-interfaces";
|
|
2
|
+
export interface OutboxCleanupParams {
|
|
3
|
+
/** Days to keep processed (and dead-lettered) events. Defaults to 7. */
|
|
4
|
+
retentionDays?: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Delete processed outbox events older than the retention window.
|
|
8
|
+
* Intended for use in a scheduled handler / cron job.
|
|
9
|
+
*/
|
|
10
|
+
export declare function cleanupOutbox(outbox: OutboxAdapter, params?: OutboxCleanupParams): Promise<number>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { AuditEvent, LogStreamsAdapter } from "@authhero/adapter-interfaces";
|
|
2
|
+
import { EventDestination } from "../outbox-relay";
|
|
3
|
+
interface LogStreamData {
|
|
4
|
+
date: string;
|
|
5
|
+
type: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
tenant_name: string;
|
|
8
|
+
ip: string;
|
|
9
|
+
user_agent?: string;
|
|
10
|
+
user_id?: string;
|
|
11
|
+
user_name?: string;
|
|
12
|
+
client_id?: string;
|
|
13
|
+
connection?: string;
|
|
14
|
+
strategy?: string;
|
|
15
|
+
strategy_type?: string;
|
|
16
|
+
audience?: string;
|
|
17
|
+
scope?: string;
|
|
18
|
+
hostname?: string;
|
|
19
|
+
auth0_client?: unknown;
|
|
20
|
+
location_info?: unknown;
|
|
21
|
+
details: {
|
|
22
|
+
request: {
|
|
23
|
+
method: string;
|
|
24
|
+
path: string;
|
|
25
|
+
qs?: Record<string, string>;
|
|
26
|
+
body?: unknown;
|
|
27
|
+
};
|
|
28
|
+
response?: {
|
|
29
|
+
statusCode: number;
|
|
30
|
+
body?: unknown;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
interface LogStreamPayload {
|
|
35
|
+
log_id: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
data: LogStreamData;
|
|
38
|
+
}
|
|
39
|
+
interface StreamDelivery {
|
|
40
|
+
tenantId: string;
|
|
41
|
+
logType: string;
|
|
42
|
+
payload: LogStreamPayload;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Delivers audit events to tenant-configured HTTP log streams. Mirrors
|
|
46
|
+
* Auth0's log_stream wire shape so Loki / Logstash / Datadog sinks
|
|
47
|
+
* configured for an Auth0 tenant can be pointed at authhero unchanged.
|
|
48
|
+
*
|
|
49
|
+
* One delivery per (event, stream) — does not batch events into a single
|
|
50
|
+
* POST because the outbox relay invokes `deliver` per-event. JSONARRAY is
|
|
51
|
+
* therefore a single-element array; consumers expecting batched arrays
|
|
52
|
+
* should still parse correctly.
|
|
53
|
+
*/
|
|
54
|
+
export declare class LogStreamDestination implements EventDestination {
|
|
55
|
+
name: string;
|
|
56
|
+
private logStreams;
|
|
57
|
+
private timeoutMs;
|
|
58
|
+
constructor(logStreams: LogStreamsAdapter, options?: {
|
|
59
|
+
timeoutMs?: number;
|
|
60
|
+
});
|
|
61
|
+
accepts(event: AuditEvent): boolean;
|
|
62
|
+
transform(event: AuditEvent): StreamDelivery;
|
|
63
|
+
deliver(events: StreamDelivery[]): Promise<void>;
|
|
64
|
+
private deliverToStream;
|
|
65
|
+
}
|
|
66
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AuditEvent, LogInsert, LogsDataAdapter } from "@authhero/adapter-interfaces";
|
|
2
|
+
import { EventDestination } from "../outbox-relay";
|
|
3
|
+
export declare class LogsDestination implements EventDestination {
|
|
4
|
+
name: string;
|
|
5
|
+
private logs;
|
|
6
|
+
constructor(logs: LogsDataAdapter);
|
|
7
|
+
/**
|
|
8
|
+
* Only accept log-shaped events. `hook.*` events are dispatch tasks for
|
|
9
|
+
* webhook / code-hook destinations and are not audit log entries.
|
|
10
|
+
*/
|
|
11
|
+
accepts(event: AuditEvent): boolean;
|
|
12
|
+
transform(event: AuditEvent): {
|
|
13
|
+
tenantId: string;
|
|
14
|
+
log: LogInsert;
|
|
15
|
+
};
|
|
16
|
+
deliver(events: {
|
|
17
|
+
tenantId: string;
|
|
18
|
+
log: LogInsert;
|
|
19
|
+
}[]): Promise<void>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AuditEvent, UserDataAdapter } from "@authhero/adapter-interfaces";
|
|
2
|
+
import { EventDestination } from "../outbox-relay";
|
|
3
|
+
interface FinalizationTask {
|
|
4
|
+
tenantId: string;
|
|
5
|
+
userId: string;
|
|
6
|
+
timestamp: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Side-effect destination that flips `user.registration_completed_at` once
|
|
10
|
+
* the upstream hook destinations (webhooks, code hooks) have all succeeded
|
|
11
|
+
* for a `hook.post-user-registration` event.
|
|
12
|
+
*
|
|
13
|
+
* Must be listed AFTER the destinations that actually deliver the hook so
|
|
14
|
+
* that a delivery failure aborts the loop before the flag is set — the
|
|
15
|
+
* relay then retries the entire event, and on a subsequent successful pass
|
|
16
|
+
* the finalizer sets the flag.
|
|
17
|
+
*
|
|
18
|
+
* The flag is read by `postUserLoginHook` to decide whether to re-enqueue
|
|
19
|
+
* the event on the next login (self-healing recovery).
|
|
20
|
+
*/
|
|
21
|
+
export declare class RegistrationFinalizerDestination implements EventDestination {
|
|
22
|
+
name: string;
|
|
23
|
+
private users;
|
|
24
|
+
constructor(users: UserDataAdapter);
|
|
25
|
+
accepts(event: AuditEvent): boolean;
|
|
26
|
+
transform(event: AuditEvent): FinalizationTask;
|
|
27
|
+
deliver(tasks: FinalizationTask[]): Promise<void>;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { AuditEvent, HooksAdapter } from "@authhero/adapter-interfaces";
|
|
2
|
+
import { EventDestination } from "../outbox-relay";
|
|
3
|
+
import type { WebhookInvoker } from "../../types/AuthHeroConfig";
|
|
4
|
+
/**
|
|
5
|
+
* Mints a Bearer token for a given tenant. `scope` is forwarded so a custom
|
|
6
|
+
* `webhookInvoker` can request a non-default scope for its outbound call.
|
|
7
|
+
*/
|
|
8
|
+
export type GetServiceToken = (tenantId: string, scope?: string) => Promise<string>;
|
|
9
|
+
interface WebhookInvocation {
|
|
10
|
+
eventId: string;
|
|
11
|
+
tenantId: string;
|
|
12
|
+
triggerId: string;
|
|
13
|
+
payload: {
|
|
14
|
+
tenant_id: string;
|
|
15
|
+
trigger_id: string;
|
|
16
|
+
user?: unknown;
|
|
17
|
+
request?: unknown;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface WebhookDestinationOptions {
|
|
21
|
+
timeoutMs?: number;
|
|
22
|
+
/**
|
|
23
|
+
* Replaces the default HTTP invoker. When set, each matching webhook is
|
|
24
|
+
* dispatched by calling `webhookInvoker({ hook, data, tenant_id,
|
|
25
|
+
* createServiceToken })` instead of issuing a raw `fetch` with a Bearer
|
|
26
|
+
* token. `createServiceToken(scope?)` lazily mints a token bound to the
|
|
27
|
+
* invocation's tenant, matching the shape passed to the legacy inline
|
|
28
|
+
* dispatcher in `hooks/webhooks.ts`.
|
|
29
|
+
*/
|
|
30
|
+
webhookInvoker?: WebhookInvoker;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Delivers `hook.*` outbox events to HTTP webhooks configured for the matching
|
|
34
|
+
* trigger_id. Each POST includes `Idempotency-Key: {event.id}` so downstream
|
|
35
|
+
* webhook handlers can dedupe if the outbox retries.
|
|
36
|
+
*
|
|
37
|
+
* The destination is constructed per-request (via `outboxMiddleware`'s
|
|
38
|
+
* `getDestinations(ctx)` factory) so it can close over a ctx-bound service
|
|
39
|
+
* token generator. The same class is also used by the cron `runOutboxRelay`
|
|
40
|
+
* helper — a consumer's `webhookInvoker` configured via `init()` propagates
|
|
41
|
+
* to both paths so cron-drained deliveries don't diverge from per-request
|
|
42
|
+
* ones.
|
|
43
|
+
*/
|
|
44
|
+
export declare class WebhookDestination implements EventDestination {
|
|
45
|
+
name: string;
|
|
46
|
+
private hooks;
|
|
47
|
+
private getServiceToken;
|
|
48
|
+
private timeoutMs;
|
|
49
|
+
private webhookInvoker?;
|
|
50
|
+
constructor(hooks: HooksAdapter, getServiceToken: GetServiceToken, options?: WebhookDestinationOptions);
|
|
51
|
+
accepts(event: AuditEvent): boolean;
|
|
52
|
+
transform(event: AuditEvent): WebhookInvocation;
|
|
53
|
+
deliver(events: WebhookInvocation[]): Promise<void>;
|
|
54
|
+
private invokeCustom;
|
|
55
|
+
private invokeDefault;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { OutboxAdapter, AuditEvent } from "@authhero/adapter-interfaces";
|
|
2
|
+
/**
|
|
3
|
+
* Interface for outbox event destinations.
|
|
4
|
+
* Each destination transforms audit events into its own format and delivers them.
|
|
5
|
+
*
|
|
6
|
+
* Destinations may implement `accepts(event)` to filter which events they
|
|
7
|
+
* handle (e.g. the logs destination only accepts log-shaped events, while a
|
|
8
|
+
* webhook destination only accepts `hook.*` events). If `accepts` is absent,
|
|
9
|
+
* the destination receives every event.
|
|
10
|
+
*/
|
|
11
|
+
export interface EventDestination {
|
|
12
|
+
name: string;
|
|
13
|
+
accepts?(event: AuditEvent): boolean;
|
|
14
|
+
transform(event: AuditEvent): unknown;
|
|
15
|
+
deliver(events: unknown[]): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Process specific outbox events by their IDs.
|
|
19
|
+
* Used by per-request processing where each request handles only its own events.
|
|
20
|
+
* Claims events first to prevent concurrent processing by drain workers.
|
|
21
|
+
*/
|
|
22
|
+
export declare function processOutboxEvents(outbox: OutboxAdapter, ids: string[], destinations: EventDestination[], options?: {
|
|
23
|
+
maxRetries?: number;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Drain unprocessed events from the outbox and deliver to all destinations.
|
|
27
|
+
* Intended for cron/scheduled use to sweep up events that failed per-request processing.
|
|
28
|
+
* Uses claim mechanism for safe multi-worker execution.
|
|
29
|
+
*/
|
|
30
|
+
export declare function drainOutbox(outbox: OutboxAdapter, destinations: EventDestination[], options?: {
|
|
31
|
+
batchSize?: number;
|
|
32
|
+
maxRetries?: number;
|
|
33
|
+
retentionDays?: number;
|
|
34
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Bindings } from "../types";
|
|
2
|
+
export declare const PASSWORD_ERROR_CODES: {
|
|
3
|
+
readonly TOO_SHORT: "password_too_short";
|
|
4
|
+
readonly MISSING_LOWERCASE: "password_missing_lowercase";
|
|
5
|
+
readonly MISSING_UPPERCASE: "password_missing_uppercase";
|
|
6
|
+
readonly MISSING_NUMBER: "password_missing_number";
|
|
7
|
+
readonly MISSING_SPECIAL: "password_missing_special";
|
|
8
|
+
readonly REUSED: "password_reused";
|
|
9
|
+
readonly CONTAINS_PERSONAL_INFO: "password_contains_personal_info";
|
|
10
|
+
readonly CONTAINS_FORBIDDEN_WORD: "password_contains_forbidden_word";
|
|
11
|
+
};
|
|
12
|
+
export interface PasswordValidationError {
|
|
13
|
+
code: string;
|
|
14
|
+
message: string;
|
|
15
|
+
params?: Record<string, string | number>;
|
|
16
|
+
}
|
|
17
|
+
export declare class PasswordPolicyError extends Error {
|
|
18
|
+
code: string;
|
|
19
|
+
params?: Record<string, string | number>;
|
|
20
|
+
constructor(code: string, message: string, params?: Record<string, string | number>);
|
|
21
|
+
}
|
|
22
|
+
export interface PasswordPolicy {
|
|
23
|
+
passwordPolicy?: string;
|
|
24
|
+
password_complexity_options?: {
|
|
25
|
+
min_length?: number;
|
|
26
|
+
};
|
|
27
|
+
password_history?: {
|
|
28
|
+
enable?: boolean;
|
|
29
|
+
size?: number;
|
|
30
|
+
};
|
|
31
|
+
password_no_personal_info?: {
|
|
32
|
+
enable?: boolean;
|
|
33
|
+
};
|
|
34
|
+
password_dictionary?: {
|
|
35
|
+
enable?: boolean;
|
|
36
|
+
dictionary?: string[];
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface PasswordValidationOptions {
|
|
40
|
+
tenantId: string;
|
|
41
|
+
userId: string;
|
|
42
|
+
newPassword: string;
|
|
43
|
+
userData?: any;
|
|
44
|
+
data: Bindings["data"];
|
|
45
|
+
}
|
|
46
|
+
export declare function validatePasswordPolicy(policy: PasswordPolicy, options: PasswordValidationOptions): Promise<void>;
|
|
47
|
+
export declare function getPasswordPolicy(data: Bindings["data"], tenantId: string, connectionName: string): Promise<PasswordPolicy>;
|
|
48
|
+
/**
|
|
49
|
+
* Hash a password using bcrypt with a cost factor of 10
|
|
50
|
+
*/
|
|
51
|
+
export declare function hashPassword(password: string): Promise<{
|
|
52
|
+
hash: string;
|
|
53
|
+
algorithm: "bcrypt";
|
|
54
|
+
}>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { LoadClientKeysOptions, ClientWithKeys } from "./client-keys";
|
|
2
|
+
/**
|
|
3
|
+
* Narrow client shape used by the request-object verifier. Allows passing
|
|
4
|
+
* `EnrichedClient` (which redefines `connections`) without a structural
|
|
5
|
+
* mismatch against the wider `Client` type.
|
|
6
|
+
*/
|
|
7
|
+
export interface RequestObjectClient extends ClientWithKeys {
|
|
8
|
+
client_id: string;
|
|
9
|
+
client_secret?: string | undefined;
|
|
10
|
+
}
|
|
11
|
+
export declare class RequestObjectVerificationError extends Error {
|
|
12
|
+
code: "invalid_request_object" | "unsupported_alg" | "missing_keys" | "signature_invalid" | "claim_invalid";
|
|
13
|
+
constructor(code: "invalid_request_object" | "unsupported_alg" | "missing_keys" | "signature_invalid" | "claim_invalid", message: string);
|
|
14
|
+
}
|
|
15
|
+
export interface VerifyRequestObjectOptions extends LoadClientKeysOptions {
|
|
16
|
+
/**
|
|
17
|
+
* Issuer URL of this authorization server. The `aud` claim of the request
|
|
18
|
+
* object MUST match this (as a string or one element of an array). When
|
|
19
|
+
* unset, the audience check is skipped — only enable for testing.
|
|
20
|
+
*/
|
|
21
|
+
issuer: string;
|
|
22
|
+
/** Optional clock-skew leeway in seconds for exp/nbf checks. Defaults to 30. */
|
|
23
|
+
leewaySeconds?: number;
|
|
24
|
+
/** Override Date.now() for tests (returns ms since epoch). */
|
|
25
|
+
now?: () => number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Verify an OIDC Request Object (signed JWT, RFC 9101 / OIDC Core 6.1) sent
|
|
29
|
+
* via the `request=` parameter or fetched from `request_uri=`.
|
|
30
|
+
*
|
|
31
|
+
* Returns the parsed JWT claims when the signature is valid, the alg is
|
|
32
|
+
* supported, and basic temporal/audience checks pass. Throws
|
|
33
|
+
* RequestObjectVerificationError otherwise.
|
|
34
|
+
*
|
|
35
|
+
* `alg: none` (unsigned) request objects are rejected. The current `request=`
|
|
36
|
+
* pre-check in /authorize used to accept these unconditionally, which let any
|
|
37
|
+
* caller forge claims; closing that hole is the main motivator for this code
|
|
38
|
+
* path.
|
|
39
|
+
*/
|
|
40
|
+
export declare function verifyRequestObject(jwt: string, client: RequestObjectClient, opts: VerifyRequestObjectOptions): Promise<Record<string, unknown>>;
|