better-auth 1.8.0-beta.7 → 1.8.0-beta.9
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/_virtual/_rolldown/runtime.mjs +1 -2
- package/dist/adapters/index.d.mts +0 -2
- package/dist/adapters/index.mjs +1 -2
- package/dist/api/dispatch.d.mts +1 -3
- package/dist/api/dispatch.mjs +1 -2
- package/dist/api/index.d.mts +70 -4
- package/dist/api/index.mjs +11 -9
- package/dist/api/middlewares/authorization.d.mts +1 -3
- package/dist/api/middlewares/authorization.mjs +1 -2
- package/dist/api/middlewares/origin-check.d.mts +1 -3
- package/dist/api/middlewares/origin-check.mjs +2 -3
- package/dist/api/rate-limiter/index.mjs +1 -2
- package/dist/api/routes/account.d.mts +1 -3
- package/dist/api/routes/account.mjs +12 -10
- package/dist/api/routes/callback.d.mts +1 -3
- package/dist/api/routes/callback.mjs +5 -6
- package/dist/api/routes/email-verification.d.mts +1 -3
- package/dist/api/routes/email-verification.mjs +4 -5
- package/dist/api/routes/error.d.mts +1 -3
- package/dist/api/routes/error.mjs +1 -2
- package/dist/api/routes/id-token-nonce.d.mts +83 -0
- package/dist/api/routes/id-token-nonce.mjs +79 -0
- package/dist/api/routes/index.d.mts +2 -1
- package/dist/api/routes/ok.d.mts +1 -3
- package/dist/api/routes/ok.mjs +1 -2
- package/dist/api/routes/password.d.mts +1 -3
- package/dist/api/routes/password.mjs +3 -4
- package/dist/api/routes/session.d.mts +2 -3
- package/dist/api/routes/session.mjs +10 -6
- package/dist/api/routes/sign-in.d.mts +0 -2
- package/dist/api/routes/sign-in.mjs +8 -7
- package/dist/api/routes/sign-out.d.mts +1 -3
- package/dist/api/routes/sign-out.mjs +1 -2
- package/dist/api/routes/sign-up.d.mts +1 -3
- package/dist/api/routes/sign-up.mjs +5 -6
- package/dist/api/routes/update-session.d.mts +1 -3
- package/dist/api/routes/update-session.mjs +2 -3
- package/dist/api/routes/update-user.d.mts +1 -3
- package/dist/api/routes/update-user.mjs +31 -28
- package/dist/api/state/oauth.d.mts +0 -2
- package/dist/api/state/oauth.mjs +1 -2
- package/dist/api/state/should-session-refresh.d.mts +0 -2
- package/dist/api/state/should-session-refresh.mjs +1 -2
- package/dist/api/to-auth-endpoints.mjs +2 -3
- package/dist/auth/base.mjs +3 -9
- package/dist/auth/full.d.mts +1 -3
- package/dist/auth/full.mjs +1 -2
- package/dist/auth/minimal.d.mts +0 -2
- package/dist/auth/minimal.mjs +2 -3
- package/dist/auth/trusted-origins.mjs +2 -3
- package/dist/client/broadcast-channel.d.mts +1 -3
- package/dist/client/broadcast-channel.mjs +4 -4
- package/dist/client/config.d.mts +1 -3
- package/dist/client/config.mjs +2 -3
- package/dist/client/equality.d.mts +1 -3
- package/dist/client/equality.mjs +1 -2
- package/dist/client/fetch-plugins.mjs +1 -2
- package/dist/client/focus-manager.d.mts +1 -3
- package/dist/client/focus-manager.mjs +4 -4
- package/dist/client/index.d.mts +5 -7
- package/dist/client/index.mjs +1 -2
- package/dist/client/lynx/index.d.mts +1 -3
- package/dist/client/lynx/index.mjs +1 -2
- package/dist/client/lynx/lynx-store.d.mts +0 -2
- package/dist/client/lynx/lynx-store.mjs +1 -2
- package/dist/client/online-manager.d.mts +1 -3
- package/dist/client/online-manager.mjs +7 -7
- package/dist/client/parser.d.mts +0 -2
- package/dist/client/parser.mjs +1 -2
- package/dist/client/path-to-object.d.mts +0 -2
- package/dist/client/plugins/index.d.mts +6 -6
- package/dist/client/plugins/infer-plugin.d.mts +1 -3
- package/dist/client/plugins/infer-plugin.mjs +1 -2
- package/dist/client/proxy.mjs +1 -2
- package/dist/client/query-atom.mjs +1 -2
- package/dist/client/query.d.mts +1 -3
- package/dist/client/query.mjs +1 -2
- package/dist/client/react/index.d.mts +1 -3
- package/dist/client/react/index.mjs +1 -2
- package/dist/client/react/react-store.d.mts +0 -2
- package/dist/client/react/react-store.mjs +1 -2
- package/dist/client/session-atom.d.mts +1 -3
- package/dist/client/session-atom.mjs +2 -2
- package/dist/client/session-refresh.d.mts +1 -3
- package/dist/client/session-refresh.mjs +3 -3
- package/dist/client/solid/index.d.mts +1 -3
- package/dist/client/solid/index.mjs +1 -2
- package/dist/client/solid/solid-store.mjs +1 -2
- package/dist/client/svelte/index.d.mts +1 -3
- package/dist/client/svelte/index.mjs +1 -2
- package/dist/client/types.d.mts +2 -4
- package/dist/client/vanilla.d.mts +1 -3
- package/dist/client/vanilla.mjs +1 -2
- package/dist/client/vue/index.d.mts +1 -3
- package/dist/client/vue/index.mjs +1 -2
- package/dist/client/vue/vue-store.mjs +1 -2
- package/dist/context/create-context.mjs +8 -9
- package/dist/context/helpers.mjs +3 -4
- package/dist/context/init-minimal.mjs +1 -2
- package/dist/context/init.mjs +1 -2
- package/dist/context/secret-utils.mjs +1 -2
- package/dist/context/store-capabilities.mjs +1 -2
- package/dist/cookies/cache.mjs +1 -2
- package/dist/cookies/cookie-utils.d.mts +0 -2
- package/dist/cookies/cookie-utils.mjs +1 -2
- package/dist/cookies/index.d.mts +0 -2
- package/dist/cookies/index.mjs +2 -3
- package/dist/cookies/jwt.mjs +1 -2
- package/dist/cookies/session-store.d.mts +0 -2
- package/dist/cookies/session-store.mjs +1 -2
- package/dist/crypto/buffer.d.mts +1 -3
- package/dist/crypto/buffer.mjs +1 -2
- package/dist/crypto/index.d.mts +0 -2
- package/dist/crypto/index.mjs +2 -3
- package/dist/crypto/jwt.d.mts +1 -3
- package/dist/crypto/jwt.mjs +1 -2
- package/dist/crypto/password.d.mts +0 -2
- package/dist/crypto/password.mjs +1 -2
- package/dist/crypto/purpose.mjs +1 -2
- package/dist/crypto/random.d.mts +1 -3
- package/dist/crypto/random.mjs +1 -2
- package/dist/db/adapter-base.d.mts +1 -3
- package/dist/db/adapter-base.mjs +1 -2
- package/dist/db/adapter-kysely.d.mts +1 -3
- package/dist/db/adapter-kysely.mjs +1 -2
- package/dist/db/field-converter.d.mts +1 -3
- package/dist/db/field-converter.mjs +1 -2
- package/dist/db/field.d.mts +0 -2
- package/dist/db/get-migration.d.mts +1 -3
- package/dist/db/get-migration.mjs +10 -13
- package/dist/db/get-schema.d.mts +1 -3
- package/dist/db/get-schema.mjs +1 -2
- package/dist/db/index.d.mts +1 -1
- package/dist/db/index.mjs +4 -5
- package/dist/db/internal-adapter.d.mts +1 -3
- package/dist/db/internal-adapter.mjs +41 -16
- package/dist/db/revoke-unproven-account-access.d.mts +1 -3
- package/dist/db/revoke-unproven-account-access.mjs +1 -2
- package/dist/db/schema.d.mts +1 -3
- package/dist/db/schema.mjs +1 -2
- package/dist/db/to-zod.d.mts +0 -2
- package/dist/db/to-zod.mjs +1 -2
- package/dist/db/verification-token-storage.mjs +1 -2
- package/dist/db/with-hooks.d.mts +1 -3
- package/dist/db/with-hooks.mjs +1 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/integrations/cookie-plugin-guard.mjs +1 -2
- package/dist/integrations/next-js.d.mts +1 -3
- package/dist/integrations/next-js.mjs +2 -3
- package/dist/integrations/node.d.mts +1 -3
- package/dist/integrations/node.mjs +1 -2
- package/dist/integrations/solid-start.d.mts +1 -3
- package/dist/integrations/solid-start.mjs +1 -2
- package/dist/integrations/svelte-kit.d.mts +1 -3
- package/dist/integrations/svelte-kit.mjs +1 -2
- package/dist/integrations/tanstack-start-solid.d.mts +1 -3
- package/dist/integrations/tanstack-start-solid.mjs +1 -2
- package/dist/integrations/tanstack-start.d.mts +1 -3
- package/dist/integrations/tanstack-start.mjs +1 -2
- package/dist/oauth2/account-key.mjs +1 -2
- package/dist/oauth2/callback.mjs +1 -2
- package/dist/oauth2/errors.mjs +1 -2
- package/dist/oauth2/index.d.mts +1 -1
- package/dist/oauth2/index.mjs +1 -1
- package/dist/oauth2/link-account.d.mts +1 -3
- package/dist/oauth2/link-account.mjs +18 -13
- package/dist/oauth2/state.d.mts +1 -3
- package/dist/oauth2/state.mjs +3 -4
- package/dist/oauth2/utils.d.mts +1 -3
- package/dist/oauth2/utils.mjs +1 -2
- package/dist/package.mjs +2 -3
- package/dist/plugins/access/access.d.mts +1 -3
- package/dist/plugins/access/access.mjs +1 -2
- package/dist/plugins/access/index.d.mts +1 -1
- package/dist/plugins/access/types.d.mts +1 -3
- package/dist/plugins/additional-fields/client.d.mts +1 -3
- package/dist/plugins/additional-fields/client.mjs +1 -2
- package/dist/plugins/admin/access/statement.d.mts +1 -3
- package/dist/plugins/admin/access/statement.mjs +1 -2
- package/dist/plugins/admin/admin.d.mts +1 -3
- package/dist/plugins/admin/admin.mjs +2 -3
- package/dist/plugins/admin/client.d.mts +2 -4
- package/dist/plugins/admin/client.mjs +1 -2
- package/dist/plugins/admin/error-codes.d.mts +1 -3
- package/dist/plugins/admin/error-codes.mjs +1 -2
- package/dist/plugins/admin/has-permission.mjs +1 -2
- package/dist/plugins/admin/index.d.mts +1 -1
- package/dist/plugins/admin/routes.mjs +3 -4
- package/dist/plugins/admin/schema.d.mts +1 -3
- package/dist/plugins/admin/schema.mjs +1 -2
- package/dist/plugins/admin/types.d.mts +1 -3
- package/dist/plugins/anonymous/client.d.mts +1 -3
- package/dist/plugins/anonymous/client.mjs +1 -2
- package/dist/plugins/anonymous/error-codes.d.mts +1 -3
- package/dist/plugins/anonymous/error-codes.mjs +1 -2
- package/dist/plugins/anonymous/index.d.mts +0 -2
- package/dist/plugins/anonymous/index.mjs +3 -4
- package/dist/plugins/anonymous/schema.d.mts +1 -3
- package/dist/plugins/anonymous/schema.mjs +1 -2
- package/dist/plugins/anonymous/types.d.mts +1 -3
- package/dist/plugins/bearer/index.d.mts +1 -3
- package/dist/plugins/bearer/index.mjs +1 -2
- package/dist/plugins/captcha/constants.d.mts +1 -3
- package/dist/plugins/captcha/constants.mjs +1 -2
- package/dist/plugins/captcha/error-codes.mjs +1 -2
- package/dist/plugins/captcha/index.d.mts +0 -2
- package/dist/plugins/captcha/index.mjs +2 -3
- package/dist/plugins/captcha/types.d.mts +1 -3
- package/dist/plugins/captcha/utils.mjs +1 -2
- package/dist/plugins/captcha/verify-handlers/captchafox.mjs +1 -2
- package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs +1 -2
- package/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs +1 -2
- package/dist/plugins/captcha/verify-handlers/h-captcha.mjs +1 -2
- package/dist/plugins/captcha/verify-handlers/vercel-botid.mjs +1 -2
- package/dist/plugins/custom-session/client.d.mts +1 -3
- package/dist/plugins/custom-session/client.mjs +1 -2
- package/dist/plugins/custom-session/index.d.mts +1 -3
- package/dist/plugins/custom-session/index.mjs +3 -4
- package/dist/plugins/device-authorization/client.d.mts +1 -3
- package/dist/plugins/device-authorization/client.mjs +1 -2
- package/dist/plugins/device-authorization/error-codes.mjs +1 -2
- package/dist/plugins/device-authorization/index.d.mts +1 -3
- package/dist/plugins/device-authorization/index.mjs +2 -3
- package/dist/plugins/device-authorization/routes.d.mts +4 -6
- package/dist/plugins/device-authorization/routes.mjs +18 -4
- package/dist/plugins/device-authorization/schema.d.mts +0 -2
- package/dist/plugins/device-authorization/schema.mjs +1 -2
- package/dist/plugins/email-otp/client.d.mts +0 -2
- package/dist/plugins/email-otp/client.mjs +1 -2
- package/dist/plugins/email-otp/error-codes.d.mts +1 -3
- package/dist/plugins/email-otp/error-codes.mjs +1 -2
- package/dist/plugins/email-otp/index.d.mts +0 -2
- package/dist/plugins/email-otp/index.mjs +4 -5
- package/dist/plugins/email-otp/otp-token.mjs +3 -4
- package/dist/plugins/email-otp/routes.mjs +6 -7
- package/dist/plugins/email-otp/types.d.mts +1 -3
- package/dist/plugins/email-otp/utils.mjs +1 -2
- package/dist/plugins/generic-oauth/error-codes.mjs +1 -2
- package/dist/plugins/generic-oauth/index.d.mts +1 -6
- package/dist/plugins/generic-oauth/index.mjs +44 -30
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/auth0.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/gumroad.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/hubspot.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/keycloak.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/line.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/line.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/okta.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/okta.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/patreon.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/slack.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/slack.mjs +1 -2
- package/dist/plugins/generic-oauth/providers/yandex.d.mts +1 -3
- package/dist/plugins/generic-oauth/providers/yandex.mjs +1 -2
- package/dist/plugins/generic-oauth/types.d.mts +11 -5
- package/dist/plugins/haveibeenpwned/index.d.mts +1 -3
- package/dist/plugins/haveibeenpwned/index.mjs +2 -3
- package/dist/plugins/index.d.mts +5 -5
- package/dist/plugins/jwt/adapter.mjs +1 -2
- package/dist/plugins/jwt/client.d.mts +1 -3
- package/dist/plugins/jwt/client.mjs +1 -2
- package/dist/plugins/jwt/cookie-cache.mjs +1 -2
- package/dist/plugins/jwt/index.d.mts +1 -3
- package/dist/plugins/jwt/index.mjs +5 -6
- package/dist/plugins/jwt/schema.d.mts +1 -3
- package/dist/plugins/jwt/schema.mjs +1 -2
- package/dist/plugins/jwt/sign.d.mts +0 -2
- package/dist/plugins/jwt/sign.mjs +1 -2
- package/dist/plugins/jwt/types.d.mts +1 -3
- package/dist/plugins/jwt/utils.d.mts +1 -3
- package/dist/plugins/jwt/utils.mjs +2 -3
- package/dist/plugins/jwt/verify.d.mts +1 -3
- package/dist/plugins/jwt/verify.mjs +1 -2
- package/dist/plugins/last-login-method/client.d.mts +1 -3
- package/dist/plugins/last-login-method/client.mjs +1 -2
- package/dist/plugins/last-login-method/index.d.mts +1 -3
- package/dist/plugins/last-login-method/index.mjs +1 -2
- package/dist/plugins/magic-link/client.d.mts +1 -3
- package/dist/plugins/magic-link/client.mjs +1 -2
- package/dist/plugins/magic-link/index.d.mts +1 -3
- package/dist/plugins/magic-link/index.mjs +4 -5
- package/dist/plugins/magic-link/utils.mjs +1 -2
- package/dist/plugins/multi-session/client.d.mts +0 -2
- package/dist/plugins/multi-session/client.mjs +1 -2
- package/dist/plugins/multi-session/error-codes.d.mts +1 -3
- package/dist/plugins/multi-session/error-codes.mjs +1 -2
- package/dist/plugins/multi-session/index.d.mts +0 -2
- package/dist/plugins/multi-session/index.mjs +3 -4
- package/dist/plugins/oauth-popup/client.d.mts +0 -2
- package/dist/plugins/oauth-popup/client.mjs +1 -2
- package/dist/plugins/oauth-popup/constants.d.mts +1 -3
- package/dist/plugins/oauth-popup/constants.mjs +1 -2
- package/dist/plugins/oauth-popup/error-codes.d.mts +1 -3
- package/dist/plugins/oauth-popup/error-codes.mjs +1 -2
- package/dist/plugins/oauth-popup/index.d.mts +0 -2
- package/dist/plugins/oauth-popup/index.mjs +5 -6
- package/dist/plugins/oauth-popup/types.d.mts +1 -3
- package/dist/plugins/oauth-proxy/index.d.mts +1 -3
- package/dist/plugins/oauth-proxy/index.mjs +7 -8
- package/dist/plugins/oauth-proxy/utils.mjs +1 -2
- package/dist/plugins/one-tap/client.d.mts +5 -3
- package/dist/plugins/one-tap/client.mjs +91 -79
- package/dist/plugins/one-tap/index.d.mts +41 -3
- package/dist/plugins/one-tap/index.mjs +117 -91
- package/dist/plugins/one-time-token/client.d.mts +0 -2
- package/dist/plugins/one-time-token/client.mjs +1 -2
- package/dist/plugins/one-time-token/index.d.mts +1 -3
- package/dist/plugins/one-time-token/index.mjs +3 -4
- package/dist/plugins/one-time-token/utils.mjs +1 -2
- package/dist/plugins/open-api/generator.d.mts +0 -2
- package/dist/plugins/open-api/generator.mjs +2 -3
- package/dist/plugins/open-api/index.d.mts +0 -2
- package/dist/plugins/open-api/index.mjs +2 -3
- package/dist/plugins/open-api/logo.mjs +1 -2
- package/dist/plugins/organization/access/statement.d.mts +1 -3
- package/dist/plugins/organization/access/statement.mjs +1 -2
- package/dist/plugins/organization/adapter.d.mts +3 -5
- package/dist/plugins/organization/adapter.mjs +2 -3
- package/dist/plugins/organization/call.mjs +1 -2
- package/dist/plugins/organization/client.d.mts +9 -11
- package/dist/plugins/organization/client.mjs +2 -3
- package/dist/plugins/organization/error-codes.d.mts +1 -3
- package/dist/plugins/organization/error-codes.mjs +1 -2
- package/dist/plugins/organization/has-permission.d.mts +1 -3
- package/dist/plugins/organization/has-permission.mjs +2 -3
- package/dist/plugins/organization/index.d.mts +3 -3
- package/dist/plugins/organization/organization.d.mts +3 -5
- package/dist/plugins/organization/organization.mjs +3 -4
- package/dist/plugins/organization/permission.d.mts +1 -3
- package/dist/plugins/organization/permission.mjs +1 -2
- package/dist/plugins/organization/roles.d.mts +1 -3
- package/dist/plugins/organization/roles.mjs +1 -2
- package/dist/plugins/organization/routes/crud-access-control.d.mts +2 -4
- package/dist/plugins/organization/routes/crud-access-control.mjs +3 -4
- package/dist/plugins/organization/routes/crud-invites.d.mts +4 -6
- package/dist/plugins/organization/routes/crud-invites.mjs +5 -6
- package/dist/plugins/organization/routes/crud-members.d.mts +4 -6
- package/dist/plugins/organization/routes/crud-members.mjs +4 -5
- package/dist/plugins/organization/routes/crud-org.d.mts +4 -6
- package/dist/plugins/organization/routes/crud-org.mjs +8 -9
- package/dist/plugins/organization/routes/crud-team.d.mts +4 -6
- package/dist/plugins/organization/routes/crud-team.mjs +3 -4
- package/dist/plugins/organization/schema.d.mts +0 -2
- package/dist/plugins/organization/schema.mjs +1 -2
- package/dist/plugins/organization/types.d.mts +1 -3
- package/dist/plugins/phone-number/client.d.mts +1 -3
- package/dist/plugins/phone-number/client.mjs +1 -2
- package/dist/plugins/phone-number/error-codes.d.mts +1 -3
- package/dist/plugins/phone-number/error-codes.mjs +1 -2
- package/dist/plugins/phone-number/index.d.mts +0 -2
- package/dist/plugins/phone-number/index.mjs +1 -2
- package/dist/plugins/phone-number/routes.mjs +5 -6
- package/dist/plugins/phone-number/schema.d.mts +1 -3
- package/dist/plugins/phone-number/schema.mjs +1 -2
- package/dist/plugins/phone-number/types.d.mts +2 -4
- package/dist/plugins/siwe/client.d.mts +1 -3
- package/dist/plugins/siwe/client.mjs +1 -2
- package/dist/plugins/siwe/index.d.mts +1 -3
- package/dist/plugins/siwe/index.mjs +6 -7
- package/dist/plugins/siwe/parse-message.mjs +1 -2
- package/dist/plugins/siwe/schema.d.mts +1 -3
- package/dist/plugins/siwe/schema.mjs +1 -2
- package/dist/plugins/siwe/types.d.mts +0 -2
- package/dist/plugins/test-utils/auth-helpers.mjs +1 -2
- package/dist/plugins/test-utils/cookie-builder.mjs +1 -2
- package/dist/plugins/test-utils/db-helpers.mjs +1 -2
- package/dist/plugins/test-utils/factories.mjs +1 -2
- package/dist/plugins/test-utils/index.d.mts +0 -2
- package/dist/plugins/test-utils/index.mjs +2 -3
- package/dist/plugins/test-utils/otp-sink.mjs +1 -2
- package/dist/plugins/test-utils/types.d.mts +1 -3
- package/dist/plugins/two-factor/backup-codes/index.d.mts +1 -3
- package/dist/plugins/two-factor/backup-codes/index.mjs +4 -5
- package/dist/plugins/two-factor/client.d.mts +2 -4
- package/dist/plugins/two-factor/client.mjs +1 -2
- package/dist/plugins/two-factor/constant.mjs +1 -2
- package/dist/plugins/two-factor/error-code.d.mts +1 -3
- package/dist/plugins/two-factor/error-code.mjs +1 -2
- package/dist/plugins/two-factor/index.d.mts +0 -2
- package/dist/plugins/two-factor/index.mjs +9 -10
- package/dist/plugins/two-factor/otp/index.d.mts +1 -3
- package/dist/plugins/two-factor/otp/index.mjs +4 -5
- package/dist/plugins/two-factor/schema.d.mts +1 -3
- package/dist/plugins/two-factor/schema.mjs +1 -2
- package/dist/plugins/two-factor/totp/index.d.mts +1 -3
- package/dist/plugins/two-factor/totp/index.mjs +3 -4
- package/dist/plugins/two-factor/types.d.mts +1 -3
- package/dist/plugins/two-factor/utils.mjs +1 -2
- package/dist/plugins/two-factor/verify-two-factor.mjs +5 -6
- package/dist/plugins/username/client.d.mts +0 -2
- package/dist/plugins/username/client.mjs +1 -2
- package/dist/plugins/username/error-codes.d.mts +1 -3
- package/dist/plugins/username/error-codes.mjs +1 -2
- package/dist/plugins/username/index.d.mts +0 -2
- package/dist/plugins/username/index.mjs +4 -5
- package/dist/plugins/username/schema.d.mts +1 -3
- package/dist/plugins/username/schema.mjs +1 -2
- package/dist/state.d.mts +2 -7
- package/dist/state.mjs +3 -7
- package/dist/test-utils/headers.d.mts +1 -3
- package/dist/test-utils/headers.mjs +1 -2
- package/dist/test-utils/http-test-instance.d.mts +8 -2
- package/dist/test-utils/http-test-instance.mjs +1 -2
- package/dist/test-utils/index.d.mts +1 -1
- package/dist/test-utils/index.mjs +1 -1
- package/dist/test-utils/test-instance.d.mts +4 -6
- package/dist/test-utils/test-instance.mjs +5 -6
- package/dist/types/api.d.mts +1 -3
- package/dist/types/auth.d.mts +2 -4
- package/dist/types/helper.d.mts +1 -3
- package/dist/types/index.d.mts +2 -2
- package/dist/types/models.d.mts +0 -2
- package/dist/types/plugins.d.mts +0 -2
- package/dist/utils/constants.mjs +1 -2
- package/dist/utils/date.mjs +1 -2
- package/dist/utils/hashing.mjs +1 -2
- package/dist/utils/hide-metadata.d.mts +2 -5
- package/dist/utils/hide-metadata.mjs +1 -4
- package/dist/utils/index.d.mts +1 -1
- package/dist/utils/is-atom.mjs +1 -2
- package/dist/utils/is-promise.mjs +1 -2
- package/dist/utils/middleware-response.mjs +1 -2
- package/dist/utils/password.mjs +1 -2
- package/dist/utils/plugin-helper.mjs +1 -2
- package/dist/utils/request.mjs +1 -2
- package/dist/utils/shim.mjs +1 -2
- package/dist/utils/time.d.mts +0 -2
- package/dist/utils/time.mjs +1 -2
- package/dist/utils/url.d.mts +1 -3
- package/dist/utils/url.mjs +1 -2
- package/dist/utils/validate-user-info.mjs +1 -2
- package/dist/utils/wildcard.mjs +1 -2
- package/dist/version.mjs +1 -2
- package/package.json +10 -10
- package/dist/utils/boolean.mjs +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -23,5 +23,4 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
23
23
|
return to;
|
|
24
24
|
};
|
|
25
25
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
26
|
-
//#endregion
|
|
27
26
|
export { __exportAll, __reExport };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AdapterFactory, AdapterFactoryConfig, AdapterFactoryCustomizeAdapterCreator, AdapterFactoryOptions, AdapterTestDebugLogs, CustomAdapter, createAdapterFactory, initGetDefaultFieldName, initGetDefaultModelName, initGetFieldAttributes, initGetFieldName, initGetIdField, initGetModelName } from "@better-auth/core/db/adapter";
|
|
2
2
|
export * from "@better-auth/core/db/adapter";
|
|
3
|
-
//#region src/adapters/index.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* @deprecated Use `createAdapterFactory` instead.
|
|
6
5
|
*/
|
|
@@ -17,5 +16,4 @@ export type AdapterConfig = AdapterFactoryConfig;
|
|
|
17
16
|
* @deprecated Use `AdapterFactoryCustomizeAdapterCreator` instead.
|
|
18
17
|
*/
|
|
19
18
|
export type CreateCustomAdapter = AdapterFactoryCustomizeAdapterCreator;
|
|
20
|
-
//#endregion
|
|
21
19
|
export { type AdapterFactory, type AdapterFactoryConfig, type AdapterFactoryCustomizeAdapterCreator, type AdapterFactoryOptions, type AdapterTestDebugLogs, type CustomAdapter, createAdapterFactory, initGetDefaultFieldName, initGetDefaultModelName, initGetFieldAttributes, initGetFieldName, initGetIdField, initGetModelName };
|
package/dist/adapters/index.mjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { createAdapterFactory, initGetDefaultFieldName, initGetDefaultModelName, initGetFieldAttributes, initGetFieldName, initGetIdField, initGetModelName } from "@better-auth/core/db/adapter";
|
|
2
2
|
export * from "@better-auth/core/db/adapter";
|
|
3
|
-
|
|
3
|
+
// src/adapters/index.ts
|
|
4
4
|
/**
|
|
5
5
|
* @deprecated Use `createAdapterFactory` instead.
|
|
6
6
|
*/
|
|
7
7
|
const createAdapter = createAdapterFactory;
|
|
8
|
-
//#endregion
|
|
9
8
|
export { createAdapter, createAdapterFactory, initGetDefaultFieldName, initGetDefaultModelName, initGetFieldAttributes, initGetFieldName, initGetIdField, initGetModelName };
|
package/dist/api/dispatch.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AuthContext } from "@better-auth/core";
|
|
2
2
|
import { Endpoint, EndpointContext, InputContext } from "better-call";
|
|
3
3
|
import "@better-auth/core/api";
|
|
4
|
-
//#region src/api/dispatch.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Input accepted by {@link dispatchAuthEndpoint}. `context` must already be a
|
|
7
6
|
* resolved `AuthContext`; the caller owns `baseURL` resolution. A fresh
|
|
@@ -29,5 +28,4 @@ export type DispatchContext = Partial<InputContext<string, any> & EndpointContex
|
|
|
29
28
|
* @param endpoint The endpoint to dispatch.
|
|
30
29
|
* @param input Input context whose `context` is an already-resolved `AuthContext`.
|
|
31
30
|
*/
|
|
32
|
-
export declare function dispatchAuthEndpoint(endpoint: Endpoint, input: DispatchContext): Promise<unknown>;
|
|
33
|
-
//#endregion
|
|
31
|
+
export declare function dispatchAuthEndpoint(endpoint: Endpoint, input: DispatchContext): Promise<unknown>;
|
package/dist/api/dispatch.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { createDefu } from "defu";
|
|
|
7
7
|
import { ATTR_CONTEXT, ATTR_HOOK_TYPE, ATTR_HTTP_ROUTE, ATTR_OPERATION_ID, createWithSpan } from "@better-auth/core/instrumentation";
|
|
8
8
|
import { kAPIErrorHeaderSymbol, toResponse } from "better-call";
|
|
9
9
|
import { getInternalAuthCompletion } from "@better-auth/core/utils/auth-completion";
|
|
10
|
-
|
|
10
|
+
// src/api/dispatch.ts
|
|
11
11
|
const defuReplaceArrays = createDefu((obj, key, value) => {
|
|
12
12
|
if (Array.isArray(obj[key]) && Array.isArray(value)) {
|
|
13
13
|
obj[key] = value;
|
|
@@ -296,5 +296,4 @@ async function dispatchAuthEndpoint(endpoint, input) {
|
|
|
296
296
|
} : result.response;
|
|
297
297
|
}));
|
|
298
298
|
}
|
|
299
|
-
//#endregion
|
|
300
299
|
export { asSignInGate, dispatchAuthEndpoint, getOperationId };
|
package/dist/api/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { OverrideMerge, Prettify as Prettify$1, UnionToIntersection } from "../types/helper.mjs";
|
|
2
2
|
import { AdditionalSessionFieldsInput, AdditionalUserFieldsInput } from "../types/models.mjs";
|
|
3
|
-
import "../types/index.mjs";
|
|
4
3
|
import "../index.mjs";
|
|
4
|
+
import "../types/index.mjs";
|
|
5
|
+
import { generateGenericState, parseGenericState } from "../state.mjs";
|
|
5
6
|
import { isAPIError } from "../utils/is-api-error.mjs";
|
|
6
7
|
import { DispatchContext, dispatchAuthEndpoint } from "./dispatch.mjs";
|
|
7
8
|
import { requireOrgRole, requireResourceOwnership } from "./middlewares/authorization.mjs";
|
|
@@ -11,6 +12,7 @@ import { accountInfo, getAccessToken, linkSocialAccount, listUserAccounts, refre
|
|
|
11
12
|
import { callbackOAuth } from "./routes/callback.mjs";
|
|
12
13
|
import { createEmailVerificationToken, sendVerificationEmail, sendVerificationEmailFn, verifyEmail } from "./routes/email-verification.mjs";
|
|
13
14
|
import { error } from "./routes/error.mjs";
|
|
15
|
+
import { consumeIssuedIdTokenNonce, consumeNonce, issueIdTokenNonce, issueNonce, issuedNonceResponses } from "./routes/id-token-nonce.mjs";
|
|
14
16
|
import { ok } from "./routes/ok.mjs";
|
|
15
17
|
import { requestPasswordReset, requestPasswordResetCallback, resetPassword, verifyPassword } from "./routes/password.mjs";
|
|
16
18
|
import { freshSessionMiddleware, getAuthoritativeSessionFromCtx, getSession, getSessionFromCtx, isStateful, listSessions, requestOnlySessionMiddleware, revokeOtherSessions, revokeSession, revokeSessions, sensitiveSessionMiddleware, sessionMiddleware } from "./routes/session.mjs";
|
|
@@ -28,7 +30,6 @@ import { APIError } from "@better-auth/core/error";
|
|
|
28
30
|
import { getIP } from "@better-auth/core/utils/ip";
|
|
29
31
|
import { Middleware } from "better-call";
|
|
30
32
|
import { AuthEndpoint, AuthMiddleware, NO_STORE_HEADERS, createAuthEndpoint, createAuthMiddleware, optionsMiddleware } from "@better-auth/core/api";
|
|
31
|
-
//#region src/api/index.d.ts
|
|
32
33
|
export declare function checkEndpointConflicts(options: BetterAuthOptions, logger: InternalLogger): void;
|
|
33
34
|
export declare function getEndpoints<Option extends BetterAuthOptions>(ctx: Awaitable<AuthContext>, options: Option): {
|
|
34
35
|
api: OverrideMerge<{
|
|
@@ -241,6 +242,7 @@ export declare function getEndpoints<Option extends BetterAuthOptions>(ctx: Awai
|
|
|
241
242
|
disableRefresh: import("zod").ZodOptional<import("zod").ZodCoercedBoolean<unknown>>;
|
|
242
243
|
}, import("zod/v4/core").$strip>>;
|
|
243
244
|
requireHeaders: true;
|
|
245
|
+
disableBody: true;
|
|
244
246
|
metadata: {
|
|
245
247
|
openapi: {
|
|
246
248
|
operationId: string;
|
|
@@ -1664,6 +1666,38 @@ export declare function getEndpoints<Option extends BetterAuthOptions>(ctx: Awai
|
|
|
1664
1666
|
url: string;
|
|
1665
1667
|
redirect: boolean;
|
|
1666
1668
|
}>;
|
|
1669
|
+
readonly issueIdTokenNonce: import("better-call").StrictEndpoint<"/id-token/nonce", {
|
|
1670
|
+
method: "POST";
|
|
1671
|
+
body: import("zod").ZodObject<{
|
|
1672
|
+
provider: import("zod").ZodType<(string & {}) | "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat", unknown, import("zod/v4/core").$ZodTypeInternals<(string & {}) | "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat", unknown>>;
|
|
1673
|
+
}, import("zod/v4/core").$strip>;
|
|
1674
|
+
metadata: {
|
|
1675
|
+
noStore: boolean;
|
|
1676
|
+
openapi: {
|
|
1677
|
+
description: string;
|
|
1678
|
+
responses: {
|
|
1679
|
+
200: {
|
|
1680
|
+
description: string;
|
|
1681
|
+
content: {
|
|
1682
|
+
"application/json": {
|
|
1683
|
+
schema: {
|
|
1684
|
+
type: "object";
|
|
1685
|
+
properties: {
|
|
1686
|
+
nonce: {
|
|
1687
|
+
type: "string";
|
|
1688
|
+
};
|
|
1689
|
+
};
|
|
1690
|
+
required: string[];
|
|
1691
|
+
};
|
|
1692
|
+
};
|
|
1693
|
+
};
|
|
1694
|
+
};
|
|
1695
|
+
};
|
|
1696
|
+
};
|
|
1697
|
+
};
|
|
1698
|
+
}, {
|
|
1699
|
+
nonce: string;
|
|
1700
|
+
}>;
|
|
1667
1701
|
readonly listUserAccounts: import("better-call").StrictEndpoint<"/list-accounts", {
|
|
1668
1702
|
method: "GET";
|
|
1669
1703
|
use: Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
@@ -2255,6 +2289,7 @@ export declare const router: <Option extends BetterAuthOptions>(ctx: AuthContext
|
|
|
2255
2289
|
disableRefresh: import("zod").ZodOptional<import("zod").ZodCoercedBoolean<unknown>>;
|
|
2256
2290
|
}, import("zod/v4/core").$strip>>;
|
|
2257
2291
|
requireHeaders: true;
|
|
2292
|
+
disableBody: true;
|
|
2258
2293
|
metadata: {
|
|
2259
2294
|
openapi: {
|
|
2260
2295
|
operationId: string;
|
|
@@ -3678,6 +3713,38 @@ export declare const router: <Option extends BetterAuthOptions>(ctx: AuthContext
|
|
|
3678
3713
|
url: string;
|
|
3679
3714
|
redirect: boolean;
|
|
3680
3715
|
}>;
|
|
3716
|
+
readonly issueIdTokenNonce: import("better-call").StrictEndpoint<"/id-token/nonce", {
|
|
3717
|
+
method: "POST";
|
|
3718
|
+
body: import("zod").ZodObject<{
|
|
3719
|
+
provider: import("zod").ZodType<(string & {}) | "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat", unknown, import("zod/v4/core").$ZodTypeInternals<(string & {}) | "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat", unknown>>;
|
|
3720
|
+
}, import("zod/v4/core").$strip>;
|
|
3721
|
+
metadata: {
|
|
3722
|
+
noStore: boolean;
|
|
3723
|
+
openapi: {
|
|
3724
|
+
description: string;
|
|
3725
|
+
responses: {
|
|
3726
|
+
200: {
|
|
3727
|
+
description: string;
|
|
3728
|
+
content: {
|
|
3729
|
+
"application/json": {
|
|
3730
|
+
schema: {
|
|
3731
|
+
type: "object";
|
|
3732
|
+
properties: {
|
|
3733
|
+
nonce: {
|
|
3734
|
+
type: "string";
|
|
3735
|
+
};
|
|
3736
|
+
};
|
|
3737
|
+
required: string[];
|
|
3738
|
+
};
|
|
3739
|
+
};
|
|
3740
|
+
};
|
|
3741
|
+
};
|
|
3742
|
+
};
|
|
3743
|
+
};
|
|
3744
|
+
};
|
|
3745
|
+
}, {
|
|
3746
|
+
nonce: string;
|
|
3747
|
+
}>;
|
|
3681
3748
|
readonly listUserAccounts: import("better-call").StrictEndpoint<"/list-accounts", {
|
|
3682
3749
|
method: "GET";
|
|
3683
3750
|
use: Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
@@ -4047,5 +4114,4 @@ export declare const router: <Option extends BetterAuthOptions>(ctx: AuthContext
|
|
|
4047
4114
|
}>;
|
|
4048
4115
|
} extends (infer T_2) ? { [K in keyof T_2 as K extends keyof T_1 ? never : K]: T_2[K]; } : never) & T_1> : never : never : never;
|
|
4049
4116
|
};
|
|
4050
|
-
|
|
4051
|
-
export { APIError, type AuthEndpoint, type AuthMiddleware, type DispatchContext, NO_STORE_HEADERS, accountInfo, addOAuthServerContext, callbackOAuth, changeEmail, changePassword, createAuthEndpoint, createAuthMiddleware, createEmailVerificationToken, deleteUser, deleteUserCallback, dispatchAuthEndpoint, error, formCsrfMiddleware, freshSessionMiddleware, getAccessToken, getAuthoritativeSessionFromCtx, getIP, getOAuthState, getSession, getSessionFromCtx, getShouldSkipSessionRefresh, isAPIError, isStateful, linkSocialAccount, listSessions, listUserAccounts, ok, optionsMiddleware, originCheck, originCheckMiddleware, refreshToken, requestOnlySessionMiddleware, requestPasswordReset, requestPasswordResetCallback, requireOrgRole, requireResourceOwnership, resetPassword, revokeOtherSessions, revokeSession, revokeSessions, sendVerificationEmail, sendVerificationEmailFn, sensitiveSessionMiddleware, sessionMiddleware, setPassword, setShouldSkipSessionRefresh, signInEmail, signInSocial, signOut, signUpEmail, unlinkAccount, updateSession, updateUser, verifyEmail, verifyPassword };
|
|
4117
|
+
export { APIError, type AuthEndpoint, type AuthMiddleware, type DispatchContext, NO_STORE_HEADERS, accountInfo, addOAuthServerContext, callbackOAuth, changeEmail, changePassword, consumeIssuedIdTokenNonce, consumeNonce, createAuthEndpoint, createAuthMiddleware, createEmailVerificationToken, deleteUser, deleteUserCallback, dispatchAuthEndpoint, error, formCsrfMiddleware, freshSessionMiddleware, generateGenericState, getAccessToken, getAuthoritativeSessionFromCtx, getIP, getOAuthState, getSession, getSessionFromCtx, getShouldSkipSessionRefresh, isAPIError, isStateful, issueIdTokenNonce, issueNonce, issuedNonceResponses, linkSocialAccount, listSessions, listUserAccounts, ok, optionsMiddleware, originCheck, originCheckMiddleware, parseGenericState, refreshToken, requestOnlySessionMiddleware, requestPasswordReset, requestPasswordResetCallback, requireOrgRole, requireResourceOwnership, resetPassword, revokeOtherSessions, revokeSession, revokeSessions, sendVerificationEmail, sendVerificationEmailFn, sensitiveSessionMiddleware, sessionMiddleware, setPassword, setShouldSkipSessionRefresh, signInEmail, signInSocial, signOut, signUpEmail, unlinkAccount, updateSession, updateUser, verifyEmail, verifyPassword };
|
package/dist/api/index.mjs
CHANGED
|
@@ -2,22 +2,24 @@ import { isAPIError } from "../utils/is-api-error.mjs";
|
|
|
2
2
|
import { requireOrgRole, requireResourceOwnership } from "./middlewares/authorization.mjs";
|
|
3
3
|
import { formCsrfMiddleware, originCheck, originCheckMiddleware } from "./middlewares/origin-check.mjs";
|
|
4
4
|
import { onRequestRateLimit } from "./rate-limiter/index.mjs";
|
|
5
|
-
import { getShouldSkipSessionRefresh, setShouldSkipSessionRefresh } from "./state/should-session-refresh.mjs";
|
|
6
|
-
import { freshSessionMiddleware, getAuthoritativeSessionFromCtx, getSession, getSessionFromCtx, isStateful, listSessions, requestOnlySessionMiddleware, revokeOtherSessions, revokeSession, revokeSessions, sensitiveSessionMiddleware, sessionMiddleware } from "./routes/session.mjs";
|
|
7
|
-
import { addOAuthServerContext, getOAuthState } from "./state/oauth.mjs";
|
|
8
5
|
import { accountInfo, getAccessToken, linkSocialAccount, listUserAccounts, refreshToken, unlinkAccount } from "./routes/account.mjs";
|
|
9
6
|
import { callbackOAuth } from "./routes/callback.mjs";
|
|
10
|
-
import {
|
|
7
|
+
import { changeEmail, changePassword, deleteUser, deleteUserCallback, setPassword, updateUser } from "./routes/update-user.mjs";
|
|
11
8
|
import { error } from "./routes/error.mjs";
|
|
9
|
+
import { freshSessionMiddleware, getAuthoritativeSessionFromCtx, getSession, getSessionFromCtx, isStateful, listSessions, requestOnlySessionMiddleware, revokeOtherSessions, revokeSession, revokeSessions, sensitiveSessionMiddleware, sessionMiddleware } from "./routes/session.mjs";
|
|
10
|
+
import { consumeIssuedIdTokenNonce, consumeNonce, issueIdTokenNonce, issueNonce, issuedNonceResponses } from "./routes/id-token-nonce.mjs";
|
|
12
11
|
import { ok } from "./routes/ok.mjs";
|
|
13
12
|
import { requestPasswordReset, requestPasswordResetCallback, resetPassword, verifyPassword } from "./routes/password.mjs";
|
|
13
|
+
import { createEmailVerificationToken, sendVerificationEmail, sendVerificationEmailFn, verifyEmail } from "./routes/email-verification.mjs";
|
|
14
14
|
import { signInEmail, signInSocial } from "./routes/sign-in.mjs";
|
|
15
15
|
import { signOut } from "./routes/sign-out.mjs";
|
|
16
16
|
import { signUpEmail } from "./routes/sign-up.mjs";
|
|
17
17
|
import { updateSession } from "./routes/update-session.mjs";
|
|
18
|
-
import { changeEmail, changePassword, deleteUser, deleteUserCallback, setPassword, updateUser } from "./routes/update-user.mjs";
|
|
19
|
-
import { dispatchAuthEndpoint } from "./dispatch.mjs";
|
|
20
18
|
import { toAuthEndpoints } from "./to-auth-endpoints.mjs";
|
|
19
|
+
import { generateGenericState, parseGenericState } from "../state.mjs";
|
|
20
|
+
import { dispatchAuthEndpoint } from "./dispatch.mjs";
|
|
21
|
+
import { addOAuthServerContext, getOAuthState } from "./state/oauth.mjs";
|
|
22
|
+
import { getShouldSkipSessionRefresh, setShouldSkipSessionRefresh } from "./state/should-session-refresh.mjs";
|
|
21
23
|
import { logger } from "@better-auth/core/env";
|
|
22
24
|
import { APIError } from "@better-auth/core/error";
|
|
23
25
|
import { getIP } from "@better-auth/core/utils/ip";
|
|
@@ -25,7 +27,7 @@ import { ATTR_CONTEXT, ATTR_HOOK_TYPE, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_HTTP
|
|
|
25
27
|
import { normalizePathname } from "@better-auth/core/utils/url";
|
|
26
28
|
import { createRouter } from "better-call";
|
|
27
29
|
import { NO_STORE_HEADERS, createAuthEndpoint, createAuthMiddleware, optionsMiddleware } from "@better-auth/core/api";
|
|
28
|
-
|
|
30
|
+
// src/api/index.ts
|
|
29
31
|
function checkEndpointConflicts(options, logger) {
|
|
30
32
|
const endpointRegistry = /* @__PURE__ */ new Map();
|
|
31
33
|
options.plugins?.forEach((plugin) => {
|
|
@@ -134,6 +136,7 @@ function getEndpoints(ctx, options) {
|
|
|
134
136
|
revokeSessions,
|
|
135
137
|
revokeOtherSessions,
|
|
136
138
|
linkSocialAccount,
|
|
139
|
+
issueIdTokenNonce,
|
|
137
140
|
listUserAccounts,
|
|
138
141
|
deleteUserCallback,
|
|
139
142
|
unlinkAccount,
|
|
@@ -221,5 +224,4 @@ const router = (ctx, options) => {
|
|
|
221
224
|
}
|
|
222
225
|
});
|
|
223
226
|
};
|
|
224
|
-
|
|
225
|
-
export { APIError, NO_STORE_HEADERS, accountInfo, addOAuthServerContext, callbackOAuth, changeEmail, changePassword, checkEndpointConflicts, createAuthEndpoint, createAuthMiddleware, createEmailVerificationToken, deleteUser, deleteUserCallback, dispatchAuthEndpoint, error, formCsrfMiddleware, freshSessionMiddleware, getAccessToken, getAuthoritativeSessionFromCtx, getEndpoints, getIP, getOAuthState, getSession, getSessionFromCtx, getShouldSkipSessionRefresh, isAPIError, isStateful, linkSocialAccount, listSessions, listUserAccounts, ok, optionsMiddleware, originCheck, originCheckMiddleware, refreshToken, requestOnlySessionMiddleware, requestPasswordReset, requestPasswordResetCallback, requireOrgRole, requireResourceOwnership, resetPassword, revokeOtherSessions, revokeSession, revokeSessions, router, sendVerificationEmail, sendVerificationEmailFn, sensitiveSessionMiddleware, sessionMiddleware, setPassword, setShouldSkipSessionRefresh, signInEmail, signInSocial, signOut, signUpEmail, unlinkAccount, updateSession, updateUser, verifyEmail, verifyPassword };
|
|
227
|
+
export { APIError, NO_STORE_HEADERS, accountInfo, addOAuthServerContext, callbackOAuth, changeEmail, changePassword, checkEndpointConflicts, consumeIssuedIdTokenNonce, consumeNonce, createAuthEndpoint, createAuthMiddleware, createEmailVerificationToken, deleteUser, deleteUserCallback, dispatchAuthEndpoint, error, formCsrfMiddleware, freshSessionMiddleware, generateGenericState, getAccessToken, getAuthoritativeSessionFromCtx, getEndpoints, getIP, getOAuthState, getSession, getSessionFromCtx, getShouldSkipSessionRefresh, isAPIError, isStateful, issueIdTokenNonce, issueNonce, issuedNonceResponses, linkSocialAccount, listSessions, listUserAccounts, ok, optionsMiddleware, originCheck, originCheckMiddleware, parseGenericState, refreshToken, requestOnlySessionMiddleware, requestPasswordReset, requestPasswordResetCallback, requireOrgRole, requireResourceOwnership, resetPassword, revokeOtherSessions, revokeSession, revokeSessions, router, sendVerificationEmail, sendVerificationEmailFn, sensitiveSessionMiddleware, sessionMiddleware, setPassword, setShouldSkipSessionRefresh, signInEmail, signInSocial, signOut, signUpEmail, unlinkAccount, updateSession, updateUser, verifyEmail, verifyPassword };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/api/middlewares/authorization.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Middleware that verifies the authenticated user owns a resource.
|
|
4
3
|
* Must be used after sessionMiddleware in the `use` array.
|
|
@@ -68,5 +67,4 @@ export declare function requireOrgRole(config: {
|
|
|
68
67
|
allowedRoles?: string[];
|
|
69
68
|
}): import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
70
69
|
verifiedMember: {};
|
|
71
|
-
}>>;
|
|
72
|
-
//#endregion
|
|
70
|
+
}>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { APIError } from "@better-auth/core/error";
|
|
2
2
|
import { createAuthMiddleware } from "@better-auth/core/api";
|
|
3
|
-
|
|
3
|
+
// src/api/middlewares/authorization.ts
|
|
4
4
|
/**
|
|
5
5
|
* Middleware that verifies the authenticated user owns a resource.
|
|
6
6
|
* Must be used after sessionMiddleware in the `use` array.
|
|
@@ -75,5 +75,4 @@ function requireOrgRole(config) {
|
|
|
75
75
|
return { verifiedMember: member };
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
//#endregion
|
|
79
78
|
export { requireOrgRole, requireResourceOwnership };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { GenericEndpointContext } from "@better-auth/core";
|
|
2
|
-
//#region src/api/middlewares/origin-check.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* A middleware to validate callbackURL and origin against trustedOrigins.
|
|
5
4
|
* Also handles CSRF protection using Fetch Metadata for first-login scenarios.
|
|
@@ -10,5 +9,4 @@ export declare const originCheck: (getValue: (ctx: GenericEndpointContext) => st
|
|
|
10
9
|
* Middleware for CSRF protection using Fetch Metadata headers.
|
|
11
10
|
* This prevents cross-site navigation login attacks while supporting progressive enhancement.
|
|
12
11
|
*/
|
|
13
|
-
export declare const formCsrfMiddleware: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>>;
|
|
14
|
-
//#endregion
|
|
12
|
+
export declare const formCsrfMiddleware: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<void>>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { getBaseURL, getOrigin } from "../../utils/url.mjs";
|
|
2
1
|
import { matchesOriginPattern } from "../../auth/trusted-origins.mjs";
|
|
2
|
+
import { getBaseURL, getOrigin } from "../../utils/url.mjs";
|
|
3
3
|
import { APIError, BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
4
4
|
import { normalizePathname } from "@better-auth/core/utils/url";
|
|
5
5
|
import { createAuthMiddleware } from "@better-auth/core/api";
|
|
6
6
|
import { deprecate } from "@better-auth/core/utils/deprecate";
|
|
7
|
-
|
|
7
|
+
// src/api/middlewares/origin-check.ts
|
|
8
8
|
/**
|
|
9
9
|
* Checks if CSRF should be skipped for backward compatibility.
|
|
10
10
|
* Previously, disableOriginCheck also disabled CSRF checks.
|
|
@@ -151,5 +151,4 @@ async function validateFormCsrf(ctx) {
|
|
|
151
151
|
}
|
|
152
152
|
if (headers.get("origin") || headers.get("referer")) return await validateOrigin(ctx, true);
|
|
153
153
|
}
|
|
154
|
-
//#endregion
|
|
155
154
|
export { formCsrfMiddleware, originCheck, originCheckMiddleware };
|
|
@@ -2,7 +2,7 @@ import { wildcardMatch } from "../../utils/wildcard.mjs";
|
|
|
2
2
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
3
3
|
import { createRateLimitKey, getIP } from "@better-auth/core/utils/ip";
|
|
4
4
|
import { normalizePathname } from "@better-auth/core/utils/url";
|
|
5
|
-
|
|
5
|
+
// src/api/rate-limiter/index.ts
|
|
6
6
|
const memory = /* @__PURE__ */ new Map();
|
|
7
7
|
const MEMORY_STORE_MAX_ENTRIES = 1e5;
|
|
8
8
|
function pruneMemoryStore() {
|
|
@@ -317,5 +317,4 @@ function getDefaultSpecialRules() {
|
|
|
317
317
|
max: 3
|
|
318
318
|
}];
|
|
319
319
|
}
|
|
320
|
-
//#endregion
|
|
321
320
|
export { onRequestRateLimit };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
//#region src/api/routes/account.d.ts
|
|
3
2
|
export declare const listUserAccounts: import("better-call").StrictEndpoint<"/list-accounts", {
|
|
4
3
|
method: "GET";
|
|
5
4
|
use: import("better-call").Middleware<import("better-call").MiddlewareOptions, (inputContext: import("better-call").MiddlewareInputContext<import("better-call").MiddlewareOptions>) => Promise<{
|
|
@@ -405,5 +404,4 @@ export declare const accountInfo: import("better-call").StrictEndpoint<"/account
|
|
|
405
404
|
};
|
|
406
405
|
user: import("@better-auth/core/oauth2").OAuth2UserInfo;
|
|
407
406
|
data: object;
|
|
408
|
-
}>;
|
|
409
|
-
//#endregion
|
|
407
|
+
}>;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
+
import { getAwaitableValue } from "../../context/helpers.mjs";
|
|
1
2
|
import { shouldBindAccountCookieToSessionUser } from "../../context/store-capabilities.mjs";
|
|
2
|
-
import { parseAccountOutput } from "../../db/schema.mjs";
|
|
3
|
-
import { symmetricEncrypt } from "../../crypto/index.mjs";
|
|
4
3
|
import { getAccountCookie, setAccountCookie } from "../../cookies/session-store.mjs";
|
|
5
|
-
import {
|
|
4
|
+
import { symmetricEncrypt } from "../../crypto/index.mjs";
|
|
6
5
|
import { derivePurposeKey } from "../../crypto/purpose.mjs";
|
|
6
|
+
import { parseAccountOutput } from "../../db/schema.mjs";
|
|
7
7
|
import { resolveOAuthAccountKeyForAPI } from "../../oauth2/account-key.mjs";
|
|
8
8
|
import { missingEmailLogMessage } from "../../oauth2/errors.mjs";
|
|
9
|
-
import { freshSessionMiddleware, getSessionFromCtx, isStateful, sensitiveSessionMiddleware, sessionMiddleware } from "./session.mjs";
|
|
10
|
-
import { toBoolean } from "../../utils/boolean.mjs";
|
|
11
|
-
import { decryptOAuthToken, getOAuthCallbackPath, setTokenUtil } from "../../oauth2/utils.mjs";
|
|
12
9
|
import { applyUpdateUserInfoOnLink } from "../../oauth2/link-account.mjs";
|
|
13
10
|
import { generateIdTokenNonce, generateState } from "../../oauth2/state.mjs";
|
|
11
|
+
import { decryptOAuthToken, getOAuthCallbackPath, setTokenUtil } from "../../oauth2/utils.mjs";
|
|
12
|
+
import { consumeIssuedIdTokenNonce } from "./id-token-nonce.mjs";
|
|
13
|
+
import { freshSessionMiddleware, getSessionFromCtx, isStateful, sensitiveSessionMiddleware, sessionMiddleware } from "./session.mjs";
|
|
14
14
|
import { APIError, BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
15
|
-
import { additionalAuthorizationParamsSchema, supportsIdTokenSignIn, verifyProviderIdToken } from "@better-auth/core/oauth2";
|
|
15
|
+
import { additionalAuthorizationParamsSchema, parseStringBoolean, supportsIdTokenSignIn, verifyProviderIdToken } from "@better-auth/core/oauth2";
|
|
16
16
|
import { SocialProviderListEnum } from "@better-auth/core/social-providers";
|
|
17
17
|
import { createAuthEndpoint } from "@better-auth/core/api";
|
|
18
18
|
import * as z from "zod";
|
|
19
|
-
|
|
19
|
+
// src/api/routes/account.ts
|
|
20
20
|
function parseStoredScopes(scope) {
|
|
21
21
|
if (!scope) return [];
|
|
22
22
|
return scope.split(",").map((s) => s.trim()).filter(Boolean);
|
|
@@ -168,6 +168,7 @@ const linkSocialAccount = createAuthEndpoint("/link-social", {
|
|
|
168
168
|
throw APIError.from("NOT_FOUND", BASE_ERROR_CODES.ID_TOKEN_NOT_SUPPORTED);
|
|
169
169
|
}
|
|
170
170
|
const { token, nonce } = c.body.idToken;
|
|
171
|
+
await consumeIssuedIdTokenNonce(c, provider, nonce);
|
|
171
172
|
if (!await verifyProviderIdToken(provider, token, nonce, c)) {
|
|
172
173
|
c.context.logger.warn("Invalid id token", { provider: c.body.provider });
|
|
173
174
|
throw APIError.from("UNAUTHORIZED", BASE_ERROR_CODES.INVALID_TOKEN);
|
|
@@ -208,7 +209,9 @@ const linkSocialAccount = createAuthEndpoint("/link-social", {
|
|
|
208
209
|
});
|
|
209
210
|
}
|
|
210
211
|
if (linkedAccount) throw APIError.from("CONFLICT", BASE_ERROR_CODES.SOCIAL_ACCOUNT_ALREADY_LINKED);
|
|
211
|
-
|
|
212
|
+
const isTrustedProvider = c.context.trustedProviders.includes(provider.id);
|
|
213
|
+
const emailVerified = parseStringBoolean(linkingUserInfo.user.emailVerified) ?? false;
|
|
214
|
+
if (!isTrustedProvider && !emailVerified || c.context.options.account?.accountLinking?.enabled === false) throw APIError.from("UNAUTHORIZED", {
|
|
212
215
|
message: "Account not linked - linking not allowed",
|
|
213
216
|
code: "LINKING_NOT_ALLOWED"
|
|
214
217
|
});
|
|
@@ -626,5 +629,4 @@ const accountInfo = createAuthEndpoint("/account-info", {
|
|
|
626
629
|
}
|
|
627
630
|
});
|
|
628
631
|
});
|
|
629
|
-
//#endregion
|
|
630
632
|
export { accountInfo, getAccessToken, linkSocialAccount, listUserAccounts, refreshToken, unlinkAccount };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
//#region src/api/routes/callback.d.ts
|
|
3
2
|
export declare const callbackOAuth: import("better-call").StrictEndpoint<"/callback/:id", {
|
|
4
3
|
method: ("GET" | "POST")[];
|
|
5
4
|
operationId: string;
|
|
@@ -25,5 +24,4 @@ export declare const callbackOAuth: import("better-call").StrictEndpoint<"/callb
|
|
|
25
24
|
allowedMediaTypes: string[];
|
|
26
25
|
scope: "server";
|
|
27
26
|
};
|
|
28
|
-
}, void>;
|
|
29
|
-
//#endregion
|
|
27
|
+
}, void>;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { isAPIError } from "../../utils/is-api-error.mjs";
|
|
2
|
-
import { setSessionCookie } from "../../cookies/index.mjs";
|
|
3
1
|
import { getAwaitableValue } from "../../context/helpers.mjs";
|
|
2
|
+
import { setSessionCookie } from "../../cookies/index.mjs";
|
|
3
|
+
import { exchangeOAuthCallback } from "../../oauth2/callback.mjs";
|
|
4
4
|
import { OAUTH_CALLBACK_ERROR_CODES, missingEmailLogMessage } from "../../oauth2/errors.mjs";
|
|
5
|
-
import { getOAuthCallbackPath } from "../../oauth2/utils.mjs";
|
|
6
5
|
import { handleOAuthUserInfo, linkOAuthAccount } from "../../oauth2/link-account.mjs";
|
|
7
6
|
import { generateIdTokenNonce, generateState, parseState } from "../../oauth2/state.mjs";
|
|
8
|
-
import {
|
|
7
|
+
import { getOAuthCallbackPath } from "../../oauth2/utils.mjs";
|
|
9
8
|
import { HIDE_METADATA } from "../../utils/hide-metadata.mjs";
|
|
9
|
+
import { isAPIError } from "../../utils/is-api-error.mjs";
|
|
10
10
|
import { appendQueryParams } from "@better-auth/core/utils/url";
|
|
11
11
|
import { createAuthEndpoint } from "@better-auth/core/api";
|
|
12
12
|
import * as z from "zod";
|
|
13
|
-
|
|
13
|
+
// src/api/routes/callback.ts
|
|
14
14
|
const schema = z.object({
|
|
15
15
|
code: z.string().optional(),
|
|
16
16
|
error: z.string().optional(),
|
|
@@ -170,5 +170,4 @@ const callbackOAuth = createAuthEndpoint("/callback/:id", {
|
|
|
170
170
|
}
|
|
171
171
|
throw c.redirect(toRedirectTo);
|
|
172
172
|
});
|
|
173
|
-
//#endregion
|
|
174
173
|
export { callbackOAuth };
|
|
@@ -2,7 +2,6 @@ import { User } from "../../types/models.mjs";
|
|
|
2
2
|
import "../../types/index.mjs";
|
|
3
3
|
import { GenericEndpointContext } from "@better-auth/core";
|
|
4
4
|
import * as z from "zod";
|
|
5
|
-
//#region src/api/routes/email-verification.d.ts
|
|
6
5
|
export declare function createEmailVerificationToken(secret: string, email: string,
|
|
7
6
|
/**
|
|
8
7
|
* The email to update from
|
|
@@ -151,5 +150,4 @@ export declare const verifyEmail: import("better-call").StrictEndpoint<"/verify-
|
|
|
151
150
|
};
|
|
152
151
|
}, void | {
|
|
153
152
|
status: boolean;
|
|
154
|
-
}>;
|
|
155
|
-
//#endregion
|
|
153
|
+
}>;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { setSessionCookie } from "../../cookies/index.mjs";
|
|
2
2
|
import { signJWT } from "../../crypto/jwt.mjs";
|
|
3
3
|
import { parseUserOutput } from "../../db/schema.mjs";
|
|
4
|
-
import { setSessionCookie } from "../../cookies/index.mjs";
|
|
5
|
-
import { getSessionFromCtx } from "./session.mjs";
|
|
6
4
|
import { safeCloneRequest } from "../../utils/request.mjs";
|
|
5
|
+
import { originCheck } from "../middlewares/origin-check.mjs";
|
|
6
|
+
import { getSessionFromCtx } from "./session.mjs";
|
|
7
7
|
import { APIError, BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
8
8
|
import { appendQueryParams } from "@better-auth/core/utils/url";
|
|
9
9
|
import { createAuthEndpoint } from "@better-auth/core/api";
|
|
10
10
|
import * as z from "zod";
|
|
11
11
|
import { jwtVerify } from "jose";
|
|
12
12
|
import { JWTExpired } from "jose/errors";
|
|
13
|
-
|
|
13
|
+
// src/api/routes/email-verification.ts
|
|
14
14
|
async function createEmailVerificationToken(secret, email, updateTo, expiresIn = 3600, extraPayload) {
|
|
15
15
|
return await signJWT({
|
|
16
16
|
email: email.toLowerCase(),
|
|
@@ -312,5 +312,4 @@ const verifyEmail = createAuthEndpoint("/verify-email", {
|
|
|
312
312
|
user: null
|
|
313
313
|
});
|
|
314
314
|
});
|
|
315
|
-
//#endregion
|
|
316
315
|
export { createEmailVerificationToken, sendVerificationEmail, sendVerificationEmailFn, verifyEmail };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/api/routes/error.d.ts
|
|
2
1
|
export declare const error: import("better-call").StrictEndpoint<"/error", {
|
|
3
2
|
method: "GET";
|
|
4
3
|
metadata: {
|
|
@@ -20,5 +19,4 @@ export declare const error: import("better-call").StrictEndpoint<"/error", {
|
|
|
20
19
|
};
|
|
21
20
|
scope: "server";
|
|
22
21
|
};
|
|
23
|
-
}, Response>;
|
|
24
|
-
//#endregion
|
|
22
|
+
}, Response>;
|
|
@@ -2,7 +2,7 @@ import { HIDE_METADATA } from "../../utils/hide-metadata.mjs";
|
|
|
2
2
|
import { isProduction } from "@better-auth/core/env";
|
|
3
3
|
import { appendQueryParams } from "@better-auth/core/utils/url";
|
|
4
4
|
import { createAuthEndpoint } from "@better-auth/core/api";
|
|
5
|
-
|
|
5
|
+
// src/api/routes/error.ts
|
|
6
6
|
function sanitize(input) {
|
|
7
7
|
return input.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'").replace(/&(?!amp;|lt;|gt;|quot;|#39;|#x[0-9a-fA-F]+;|#[0-9]+;)/g, "&");
|
|
8
8
|
}
|
|
@@ -383,5 +383,4 @@ const error = createAuthEndpoint("/error", {
|
|
|
383
383
|
});
|
|
384
384
|
return new Response(html(c.context.options, safeCode, safeDescription), { headers: { "Content-Type": "text/html" } });
|
|
385
385
|
});
|
|
386
|
-
//#endregion
|
|
387
386
|
export { error };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { GenericEndpointContext } from "@better-auth/core";
|
|
2
|
+
import { OAuthProvider } from "@better-auth/core/oauth2";
|
|
3
|
+
import * as z from "zod";
|
|
4
|
+
/**
|
|
5
|
+
* Store a new single-use nonce under `scope` and return it. It expires after
|
|
6
|
+
* five minutes.
|
|
7
|
+
*/
|
|
8
|
+
export declare function issueNonce(ctx: GenericEndpointContext, scope: string): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Consume a nonce that {@link issueNonce} stored under `scope`. Throws
|
|
11
|
+
* `INVALID_ID_TOKEN_NONCE` when it is missing, malformed, unknown, expired, or
|
|
12
|
+
* already used. Call it before verifying the token, so a failed attempt burns
|
|
13
|
+
* the nonce too.
|
|
14
|
+
*/
|
|
15
|
+
export declare function consumeNonce(ctx: GenericEndpointContext, scope: string, nonce: string | undefined): Promise<void>;
|
|
16
|
+
/** OpenAPI responses for an endpoint that returns `{ nonce }` from {@link issueNonce}. */
|
|
17
|
+
export declare const issuedNonceResponses: {
|
|
18
|
+
200: {
|
|
19
|
+
description: string;
|
|
20
|
+
content: {
|
|
21
|
+
"application/json": {
|
|
22
|
+
schema: {
|
|
23
|
+
type: "object";
|
|
24
|
+
properties: {
|
|
25
|
+
nonce: {
|
|
26
|
+
type: "string";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
required: string[];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
type ProviderWithOptions = Pick<OAuthProvider, "id" | "options">;
|
|
36
|
+
/**
|
|
37
|
+
* Consume the issued nonce presented with a client-submitted ID token, from
|
|
38
|
+
* `/sign-in/social` or `/link-social`. A no-op for providers without
|
|
39
|
+
* `requireIssuedIdTokenNonce`.
|
|
40
|
+
*/
|
|
41
|
+
export declare function consumeIssuedIdTokenNonce(ctx: GenericEndpointContext, provider: ProviderWithOptions, nonce: string | undefined): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* ### Endpoint
|
|
44
|
+
*
|
|
45
|
+
* POST `/id-token/nonce`
|
|
46
|
+
*
|
|
47
|
+
* Issues a single-use nonce for a client to pass to the provider's SDK before
|
|
48
|
+
* submitting the resulting ID token to `/sign-in/social` or `/link-social`.
|
|
49
|
+
* Only available for providers that set `requireIssuedIdTokenNonce`.
|
|
50
|
+
*/
|
|
51
|
+
export declare const issueIdTokenNonce: import("better-call").StrictEndpoint<"/id-token/nonce", {
|
|
52
|
+
method: "POST";
|
|
53
|
+
body: z.ZodObject<{
|
|
54
|
+
provider: z.ZodType<(string & {}) | "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat", unknown, z.core.$ZodTypeInternals<(string & {}) | "github" | "apple" | "atlassian" | "cloudflare" | "cognito" | "discord" | "facebook" | "figma" | "microsoft" | "google" | "huggingface" | "slack" | "spotify" | "twitch" | "twitter" | "dropbox" | "kick" | "linear" | "linkedin" | "gitlab" | "tiktok" | "reddit" | "roblox" | "salesforce" | "vk" | "zoom" | "notion" | "kakao" | "naver" | "line" | "paybin" | "paypal" | "polar" | "railway" | "vercel" | "wechat", unknown>>;
|
|
55
|
+
}, z.core.$strip>;
|
|
56
|
+
metadata: {
|
|
57
|
+
noStore: boolean;
|
|
58
|
+
openapi: {
|
|
59
|
+
description: string;
|
|
60
|
+
responses: {
|
|
61
|
+
200: {
|
|
62
|
+
description: string;
|
|
63
|
+
content: {
|
|
64
|
+
"application/json": {
|
|
65
|
+
schema: {
|
|
66
|
+
type: "object";
|
|
67
|
+
properties: {
|
|
68
|
+
nonce: {
|
|
69
|
+
type: "string";
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
required: string[];
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
}, {
|
|
81
|
+
nonce: string;
|
|
82
|
+
}>;
|
|
83
|
+
export {};
|