better-auth 1.7.21 → 1.7.22
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 +3 -3
- package/dist/api/index.mjs +8 -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 +10 -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/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 +6 -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/session-source.d.mts +1 -3
- package/dist/api/state/session-source.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 +1 -2
- 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 +21 -10
- 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 +3 -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 +0 -2
- package/dist/plugins/generic-oauth/index.mjs +5 -7
- 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 +1 -3
- 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 +1 -3
- package/dist/plugins/one-tap/client.mjs +1 -2
- package/dist/plugins/one-tap/index.d.mts +1 -3
- package/dist/plugins/one-tap/index.mjs +7 -8
- 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 +6 -7
- 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 +5 -6
- 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 +0 -2
- package/dist/state.mjs +2 -3
- 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 +0 -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/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,6 +1,5 @@
|
|
|
1
1
|
import { AuthContext } from "@better-auth/core";
|
|
2
2
|
import { Endpoint, EndpointContext, InputContext } from "better-call";
|
|
3
|
-
//#region src/api/dispatch.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Input accepted by {@link dispatchAuthEndpoint}. `context` must already be a
|
|
6
5
|
* resolved `AuthContext`; the caller owns `baseURL` resolution. A fresh
|
|
@@ -28,5 +27,4 @@ export type DispatchContext = Partial<InputContext<string, any> & EndpointContex
|
|
|
28
27
|
* @param endpoint The endpoint to dispatch.
|
|
29
28
|
* @param input Input context whose `context` is an already-resolved `AuthContext`.
|
|
30
29
|
*/
|
|
31
|
-
export declare function dispatchAuthEndpoint(endpoint: Endpoint, input: DispatchContext): Promise<unknown>;
|
|
32
|
-
//#endregion
|
|
30
|
+
export declare function dispatchAuthEndpoint(endpoint: Endpoint, input: DispatchContext): Promise<unknown>;
|
package/dist/api/dispatch.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { APIError } from "@better-auth/core/error";
|
|
|
6
6
|
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
|
+
// src/api/dispatch.ts
|
|
10
10
|
const defuReplaceArrays = createDefu((obj, key, value) => {
|
|
11
11
|
if (Array.isArray(obj[key]) && Array.isArray(value)) {
|
|
12
12
|
obj[key] = value;
|
|
@@ -273,5 +273,4 @@ async function dispatchAuthEndpoint(endpoint, input) {
|
|
|
273
273
|
} : result.response;
|
|
274
274
|
}));
|
|
275
275
|
}
|
|
276
|
-
//#endregion
|
|
277
276
|
export { dispatchAuthEndpoint, getOperationId };
|
package/dist/api/index.d.mts
CHANGED
|
@@ -1,8 +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 "../index.mjs";
|
|
3
4
|
import "../types/index.mjs";
|
|
4
5
|
import { generateGenericState, parseGenericState } from "../state.mjs";
|
|
5
|
-
import "../index.mjs";
|
|
6
6
|
import { isAPIError } from "../utils/is-api-error.mjs";
|
|
7
7
|
import { DispatchContext, dispatchAuthEndpoint } from "./dispatch.mjs";
|
|
8
8
|
import { requireOrgRole, requireResourceOwnership } from "./middlewares/authorization.mjs";
|
|
@@ -30,7 +30,6 @@ import { APIError } from "@better-auth/core/error";
|
|
|
30
30
|
import { getIP } from "@better-auth/core/utils/ip";
|
|
31
31
|
import { Middleware } from "better-call";
|
|
32
32
|
import { AuthEndpoint, AuthMiddleware, NO_STORE_HEADERS, createAuthEndpoint, createAuthMiddleware, optionsMiddleware } from "@better-auth/core/api";
|
|
33
|
-
//#region src/api/index.d.ts
|
|
34
33
|
export declare function checkEndpointConflicts(options: BetterAuthOptions, logger: InternalLogger): void;
|
|
35
34
|
export declare function getEndpoints<Option extends BetterAuthOptions>(ctx: Awaitable<AuthContext>, options: Option): {
|
|
36
35
|
api: OverrideMerge<{
|
|
@@ -243,6 +242,7 @@ export declare function getEndpoints<Option extends BetterAuthOptions>(ctx: Awai
|
|
|
243
242
|
disableRefresh: import("zod").ZodOptional<import("zod").ZodCoercedBoolean<unknown>>;
|
|
244
243
|
}, import("zod/v4/core").$strip>>;
|
|
245
244
|
requireHeaders: true;
|
|
245
|
+
disableBody: true;
|
|
246
246
|
metadata: {
|
|
247
247
|
openapi: {
|
|
248
248
|
operationId: string;
|
|
@@ -2257,6 +2257,7 @@ export declare const router: <Option extends BetterAuthOptions>(ctx: AuthContext
|
|
|
2257
2257
|
disableRefresh: import("zod").ZodOptional<import("zod").ZodCoercedBoolean<unknown>>;
|
|
2258
2258
|
}, import("zod/v4/core").$strip>>;
|
|
2259
2259
|
requireHeaders: true;
|
|
2260
|
+
disableBody: true;
|
|
2260
2261
|
metadata: {
|
|
2261
2262
|
openapi: {
|
|
2262
2263
|
operationId: string;
|
|
@@ -4049,5 +4050,4 @@ export declare const router: <Option extends BetterAuthOptions>(ctx: AuthContext
|
|
|
4049
4050
|
}>;
|
|
4050
4051
|
} 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;
|
|
4051
4052
|
};
|
|
4052
|
-
//#endregion
|
|
4053
4053
|
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, generateGenericState, getAccessToken, getAuthoritativeSessionFromCtx, getIP, getOAuthState, getSession, getSessionFromCtx, getShouldSkipSessionRefresh, isAPIError, isStateful, linkSocialAccount, listSessions, listUserAccounts, markSessionOutsideStore, 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,24 +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
|
-
import { generateGenericState, parseGenericState } from "../state.mjs";
|
|
9
5
|
import { accountInfo, getAccessToken, linkSocialAccount, listUserAccounts, refreshToken, unlinkAccount } from "./routes/account.mjs";
|
|
10
6
|
import { callbackOAuth } from "./routes/callback.mjs";
|
|
11
|
-
import {
|
|
7
|
+
import { changeEmail, changePassword, deleteUser, deleteUserCallback, setPassword, updateUser } from "./routes/update-user.mjs";
|
|
12
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";
|
|
13
10
|
import { ok } from "./routes/ok.mjs";
|
|
14
11
|
import { requestPasswordReset, requestPasswordResetCallback, resetPassword, verifyPassword } from "./routes/password.mjs";
|
|
12
|
+
import { createEmailVerificationToken, sendVerificationEmail, sendVerificationEmailFn, verifyEmail } from "./routes/email-verification.mjs";
|
|
15
13
|
import { signInEmail, signInSocial } from "./routes/sign-in.mjs";
|
|
16
14
|
import { signOut } from "./routes/sign-out.mjs";
|
|
17
15
|
import { signUpEmail } from "./routes/sign-up.mjs";
|
|
18
16
|
import { updateSession } from "./routes/update-session.mjs";
|
|
19
|
-
import { changeEmail, changePassword, deleteUser, deleteUserCallback, setPassword, updateUser } from "./routes/update-user.mjs";
|
|
20
|
-
import { dispatchAuthEndpoint } from "./dispatch.mjs";
|
|
21
17
|
import { toAuthEndpoints } from "./to-auth-endpoints.mjs";
|
|
18
|
+
import { generateGenericState, parseGenericState } from "../state.mjs";
|
|
19
|
+
import { dispatchAuthEndpoint } from "./dispatch.mjs";
|
|
20
|
+
import { addOAuthServerContext, getOAuthState } from "./state/oauth.mjs";
|
|
22
21
|
import { markSessionOutsideStore } from "./state/session-source.mjs";
|
|
22
|
+
import { getShouldSkipSessionRefresh, setShouldSkipSessionRefresh } from "./state/should-session-refresh.mjs";
|
|
23
23
|
import { logger } from "@better-auth/core/env";
|
|
24
24
|
import { APIError } from "@better-auth/core/error";
|
|
25
25
|
import { getIP } from "@better-auth/core/utils/ip";
|
|
@@ -27,7 +27,7 @@ import { ATTR_CONTEXT, ATTR_HOOK_TYPE, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_HTTP
|
|
|
27
27
|
import { normalizePathname } from "@better-auth/core/utils/url";
|
|
28
28
|
import { createRouter } from "better-call";
|
|
29
29
|
import { NO_STORE_HEADERS, createAuthEndpoint, createAuthMiddleware, optionsMiddleware } from "@better-auth/core/api";
|
|
30
|
-
|
|
30
|
+
// src/api/index.ts
|
|
31
31
|
function checkEndpointConflicts(options, logger) {
|
|
32
32
|
const endpointRegistry = /* @__PURE__ */ new Map();
|
|
33
33
|
options.plugins?.forEach((plugin) => {
|
|
@@ -223,5 +223,4 @@ const router = (ctx, options) => {
|
|
|
223
223
|
}
|
|
224
224
|
});
|
|
225
225
|
};
|
|
226
|
-
//#endregion
|
|
227
226
|
export { APIError, NO_STORE_HEADERS, accountInfo, addOAuthServerContext, callbackOAuth, changeEmail, changePassword, checkEndpointConflicts, createAuthEndpoint, createAuthMiddleware, createEmailVerificationToken, deleteUser, deleteUserCallback, dispatchAuthEndpoint, error, formCsrfMiddleware, freshSessionMiddleware, generateGenericState, getAccessToken, getAuthoritativeSessionFromCtx, getEndpoints, getIP, getOAuthState, getSession, getSessionFromCtx, getShouldSkipSessionRefresh, isAPIError, isStateful, linkSocialAccount, listSessions, listUserAccounts, markSessionOutsideStore, 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,21 @@
|
|
|
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 { freshSessionMiddleware, getSessionFromCtx, isStateful, sensitiveSessionMiddleware, sessionMiddleware } from "./session.mjs";
|
|
14
13
|
import { APIError, BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
15
|
-
import { additionalAuthorizationParamsSchema, supportsIdTokenSignIn, verifyProviderIdToken } from "@better-auth/core/oauth2";
|
|
14
|
+
import { additionalAuthorizationParamsSchema, parseStringBoolean, supportsIdTokenSignIn, verifyProviderIdToken } from "@better-auth/core/oauth2";
|
|
16
15
|
import { SocialProviderListEnum } from "@better-auth/core/social-providers";
|
|
17
16
|
import { createAuthEndpoint } from "@better-auth/core/api";
|
|
18
17
|
import * as z from "zod";
|
|
19
|
-
|
|
18
|
+
// src/api/routes/account.ts
|
|
20
19
|
function parseStoredScopes(scope) {
|
|
21
20
|
if (!scope) return [];
|
|
22
21
|
return scope.split(",").map((s) => s.trim()).filter(Boolean);
|
|
@@ -208,7 +207,9 @@ const linkSocialAccount = createAuthEndpoint("/link-social", {
|
|
|
208
207
|
});
|
|
209
208
|
}
|
|
210
209
|
if (linkedAccount) throw APIError.from("CONFLICT", BASE_ERROR_CODES.SOCIAL_ACCOUNT_ALREADY_LINKED);
|
|
211
|
-
|
|
210
|
+
const isTrustedProvider = c.context.trustedProviders.includes(provider.id);
|
|
211
|
+
const emailVerified = parseStringBoolean(linkingUserInfo.user.emailVerified) ?? false;
|
|
212
|
+
if (!isTrustedProvider && !emailVerified || c.context.options.account?.accountLinking?.enabled === false) throw APIError.from("UNAUTHORIZED", {
|
|
212
213
|
message: "Account not linked - linking not allowed",
|
|
213
214
|
code: "LINKING_NOT_ALLOWED"
|
|
214
215
|
});
|
|
@@ -626,5 +627,4 @@ const accountInfo = createAuthEndpoint("/account-info", {
|
|
|
626
627
|
}
|
|
627
628
|
});
|
|
628
629
|
});
|
|
629
|
-
//#endregion
|
|
630
630
|
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 };
|
package/dist/api/routes/ok.d.mts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/api/routes/ok.d.ts
|
|
2
1
|
export declare const ok: import("better-call").StrictEndpoint<"/ok", {
|
|
3
2
|
method: "GET";
|
|
4
3
|
metadata: {
|
|
@@ -28,5 +27,4 @@ export declare const ok: import("better-call").StrictEndpoint<"/ok", {
|
|
|
28
27
|
};
|
|
29
28
|
}, {
|
|
30
29
|
ok: boolean;
|
|
31
|
-
}>;
|
|
32
|
-
//#endregion
|
|
30
|
+
}>;
|
package/dist/api/routes/ok.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HIDE_METADATA } from "../../utils/hide-metadata.mjs";
|
|
2
2
|
import { createAuthEndpoint } from "@better-auth/core/api";
|
|
3
|
-
|
|
3
|
+
// src/api/routes/ok.ts
|
|
4
4
|
const ok = createAuthEndpoint("/ok", {
|
|
5
5
|
method: "GET",
|
|
6
6
|
metadata: {
|
|
@@ -23,5 +23,4 @@ const ok = createAuthEndpoint("/ok", {
|
|
|
23
23
|
}, async (ctx) => {
|
|
24
24
|
return ctx.json({ ok: true });
|
|
25
25
|
});
|
|
26
|
-
//#endregion
|
|
27
26
|
export { ok };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
|
-
//#region src/api/routes/password.d.ts
|
|
3
2
|
export declare const requestPasswordReset: import("better-call").StrictEndpoint<"/request-password-reset", {
|
|
4
3
|
method: "POST";
|
|
5
4
|
body: z.ZodObject<{
|
|
@@ -175,5 +174,4 @@ export declare const verifyPassword: import("better-call").StrictEndpoint<"/veri
|
|
|
175
174
|
}>>[];
|
|
176
175
|
}, {
|
|
177
176
|
status: boolean;
|
|
178
|
-
}>;
|
|
179
|
-
//#endregion
|
|
177
|
+
}>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { originCheck } from "../middlewares/origin-check.mjs";
|
|
2
1
|
import { getDate } from "../../utils/date.mjs";
|
|
3
|
-
import { sensitiveSessionMiddleware } from "./session.mjs";
|
|
4
2
|
import { assertPasswordNotTooLong, assertPasswordNotTooShort, resetCredentialPassword, validatePassword } from "../../utils/password.mjs";
|
|
3
|
+
import { originCheck } from "../middlewares/origin-check.mjs";
|
|
4
|
+
import { sensitiveSessionMiddleware } from "./session.mjs";
|
|
5
5
|
import { APIError, BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
6
6
|
import { generateId } from "@better-auth/core/utils/id";
|
|
7
7
|
import { createAuthEndpoint } from "@better-auth/core/api";
|
|
8
8
|
import * as z from "zod";
|
|
9
|
-
|
|
9
|
+
// src/api/routes/password.ts
|
|
10
10
|
function redirectError(ctx, callbackURL, query) {
|
|
11
11
|
const url = callbackURL ? new URL(callbackURL, ctx.baseURL) : new URL(`${ctx.baseURL}/error`);
|
|
12
12
|
if (query) Object.entries(query).forEach(([k, v]) => url.searchParams.set(k, v));
|
|
@@ -195,5 +195,4 @@ password: z.string().meta({ description: "The password to verify" }) }),
|
|
|
195
195
|
})) throw APIError.from("BAD_REQUEST", BASE_ERROR_CODES.INVALID_PASSWORD);
|
|
196
196
|
return ctx.json({ status: true });
|
|
197
197
|
});
|
|
198
|
-
//#endregion
|
|
199
198
|
export { requestPasswordReset, requestPasswordResetCallback, resetPassword, verifyPassword };
|
|
@@ -3,7 +3,6 @@ import { Session, User } from "../../types/models.mjs";
|
|
|
3
3
|
import "../../types/index.mjs";
|
|
4
4
|
import { BetterAuthOptions, GenericEndpointContext } from "@better-auth/core";
|
|
5
5
|
import * as z from "zod";
|
|
6
|
-
//#region src/api/routes/session.d.ts
|
|
7
6
|
export declare const getSession: <Option extends BetterAuthOptions>() => import("better-call").StrictEndpoint<"/get-session", {
|
|
8
7
|
method: ("GET" | "POST")[];
|
|
9
8
|
operationId: string;
|
|
@@ -12,6 +11,7 @@ export declare const getSession: <Option extends BetterAuthOptions>() => import(
|
|
|
12
11
|
disableRefresh: z.ZodOptional<z.ZodCoercedBoolean<unknown>>;
|
|
13
12
|
}, z.core.$strip>>;
|
|
14
13
|
requireHeaders: true;
|
|
14
|
+
disableBody: true;
|
|
15
15
|
metadata: {
|
|
16
16
|
openapi: {
|
|
17
17
|
operationId: string;
|
|
@@ -443,5 +443,4 @@ export declare const revokeOtherSessions: import("better-call").StrictEndpoint<"
|
|
|
443
443
|
};
|
|
444
444
|
}, {
|
|
445
445
|
status: boolean;
|
|
446
|
-
}>;
|
|
447
|
-
//#endregion
|
|
446
|
+
}>;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { isAPIError } from "../../utils/is-api-error.mjs";
|
|
2
1
|
import { hasServerSessionStore } from "../../context/store-capabilities.mjs";
|
|
2
|
+
import { decodeCookieCache, deleteSessionCookie, expireCookie, setCookieCache, setSessionCookie } from "../../cookies/index.mjs";
|
|
3
|
+
import { createSessionStore, getChunkedCookie, getSessionQuerySchema } from "../../cookies/session-store.mjs";
|
|
3
4
|
import { parseSessionOutput, parseUserOutput } from "../../db/schema.mjs";
|
|
4
5
|
import { getDate } from "../../utils/date.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { decodeCookieCache, deleteSessionCookie, expireCookie, setCookieCache, setSessionCookie } from "../../cookies/index.mjs";
|
|
6
|
+
import { isAPIError } from "../../utils/is-api-error.mjs";
|
|
7
7
|
import { getShouldSkipSessionRefresh } from "../state/should-session-refresh.mjs";
|
|
8
8
|
import { APIError, BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
9
9
|
import { createAuthEndpoint, createAuthMiddleware } from "@better-auth/core/api";
|
|
10
10
|
import * as z from "zod";
|
|
11
|
-
|
|
11
|
+
// src/api/routes/session.ts
|
|
12
12
|
const getSession = () => createAuthEndpoint("/get-session", {
|
|
13
13
|
method: ["GET", "POST"],
|
|
14
14
|
operationId: "getSession",
|
|
15
15
|
query: getSessionQuerySchema,
|
|
16
16
|
requireHeaders: true,
|
|
17
|
+
disableBody: true,
|
|
17
18
|
metadata: { openapi: {
|
|
18
19
|
operationId: "getSession",
|
|
19
20
|
description: "Get the current session",
|
|
@@ -32,6 +33,7 @@ const getSession = () => createAuthEndpoint("/get-session", {
|
|
|
32
33
|
}, async (ctx) => {
|
|
33
34
|
ctx.setHeader("cache-control", "no-store");
|
|
34
35
|
ctx.setHeader("pragma", "no-cache");
|
|
36
|
+
ctx.context.session = null;
|
|
35
37
|
const deferSessionRefresh = ctx.context.options.session?.deferSessionRefresh;
|
|
36
38
|
const isPostRequest = ctx.method === "POST";
|
|
37
39
|
if (isPostRequest && !deferSessionRefresh) throw APIError.from("METHOD_NOT_ALLOWED", BASE_ERROR_CODES.METHOD_NOT_ALLOWED_DEFER_SESSION_REQUIRED);
|
|
@@ -151,7 +153,6 @@ const getSession = () => createAuthEndpoint("/get-session", {
|
|
|
151
153
|
}
|
|
152
154
|
}
|
|
153
155
|
const session = await ctx.context.internalAdapter.findSession(sessionCookieToken);
|
|
154
|
-
ctx.context.session = session;
|
|
155
156
|
if (!session || session.session.expiresAt < /* @__PURE__ */ new Date()) {
|
|
156
157
|
deleteSessionCookie(ctx);
|
|
157
158
|
if (session) {
|
|
@@ -163,6 +164,7 @@ const getSession = () => createAuthEndpoint("/get-session", {
|
|
|
163
164
|
}
|
|
164
165
|
return ctx.json(null);
|
|
165
166
|
}
|
|
167
|
+
ctx.context.session = session;
|
|
166
168
|
/**
|
|
167
169
|
* We don't need to update the session if the user doesn't want to be remembered
|
|
168
170
|
* or if the session refresh is disabled
|
|
@@ -227,6 +229,7 @@ const getSession = () => createAuthEndpoint("/get-session", {
|
|
|
227
229
|
user: parsedUser
|
|
228
230
|
});
|
|
229
231
|
} catch (error) {
|
|
232
|
+
ctx.context.session = null;
|
|
230
233
|
if (isAPIError(error)) throw error;
|
|
231
234
|
ctx.context.logger.error("INTERNAL_SERVER_ERROR", error);
|
|
232
235
|
throw APIError.from("INTERNAL_SERVER_ERROR", BASE_ERROR_CODES.FAILED_TO_GET_SESSION, { cause: error });
|
|
@@ -412,6 +415,7 @@ const revokeSession = createAuthEndpoint("/revoke-session", {
|
|
|
412
415
|
code: "INTERNAL_SERVER_ERROR"
|
|
413
416
|
});
|
|
414
417
|
}
|
|
418
|
+
if (token === ctx.context.session.session.token) deleteSessionCookie(ctx);
|
|
415
419
|
return ctx.json({ status: true });
|
|
416
420
|
});
|
|
417
421
|
/**
|
|
@@ -445,6 +449,7 @@ const revokeSessions = createAuthEndpoint("/revoke-sessions", {
|
|
|
445
449
|
code: "INTERNAL_SERVER_ERROR"
|
|
446
450
|
});
|
|
447
451
|
}
|
|
452
|
+
deleteSessionCookie(ctx);
|
|
448
453
|
return ctx.json({ status: true });
|
|
449
454
|
});
|
|
450
455
|
const revokeOtherSessions = createAuthEndpoint("/revoke-other-sessions", {
|
|
@@ -477,5 +482,4 @@ const revokeOtherSessions = createAuthEndpoint("/revoke-other-sessions", {
|
|
|
477
482
|
await Promise.all(otherSessions.map((session) => ctx.context.internalAdapter.deleteSession(session.token)));
|
|
478
483
|
return ctx.json({ status: true });
|
|
479
484
|
});
|
|
480
|
-
//#endregion
|
|
481
485
|
export { freshSessionMiddleware, getAuthoritativeSessionFromCtx, getSession, getSessionFromCtx, isStateful, listSessions, requestOnlySessionMiddleware, revokeOtherSessions, revokeSession, revokeSessions, sensitiveSessionMiddleware, sessionMiddleware };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
2
2
|
import { User } from "@better-auth/core/db";
|
|
3
3
|
import * as z from "zod";
|
|
4
|
-
//#region src/api/routes/sign-in.d.ts
|
|
5
4
|
declare const socialSignInBodySchema: z.ZodObject<{
|
|
6
5
|
callbackURL: z.ZodOptional<z.ZodString>;
|
|
7
6
|
newUserCallbackURL: z.ZodOptional<z.ZodString>;
|
|
@@ -180,5 +179,4 @@ export declare const signInEmail: <O extends BetterAuthOptions>() => import("bet
|
|
|
180
179
|
url?: string | undefined;
|
|
181
180
|
user: User<O["user"], O["plugins"]>;
|
|
182
181
|
}>;
|
|
183
|
-
//#endregion
|
|
184
182
|
export {};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { formCsrfMiddleware } from "../middlewares/origin-check.mjs";
|
|
2
|
-
import { parseUserOutput } from "../../db/schema.mjs";
|
|
3
|
-
import { setSessionCookie } from "../../cookies/index.mjs";
|
|
4
1
|
import { getAwaitableValue } from "../../context/helpers.mjs";
|
|
2
|
+
import { setSessionCookie } from "../../cookies/index.mjs";
|
|
3
|
+
import { parseUserOutput } from "../../db/schema.mjs";
|
|
5
4
|
import { resolveOAuthAccountKeyForAPI, toOAuthProfileRecord } from "../../oauth2/account-key.mjs";
|
|
6
5
|
import { OAUTH_CALLBACK_ERROR_CODES, missingEmailLogMessage } from "../../oauth2/errors.mjs";
|
|
7
|
-
import { getOAuthCallbackPath } from "../../oauth2/utils.mjs";
|
|
8
6
|
import { handleOAuthUserInfo } from "../../oauth2/link-account.mjs";
|
|
7
|
+
import { getOAuthCallbackPath } from "../../oauth2/utils.mjs";
|
|
9
8
|
import { generateIdTokenNonce, generateState } from "../../oauth2/state.mjs";
|
|
9
|
+
import { assertPasswordNotTooLong } from "../../utils/password.mjs";
|
|
10
10
|
import { safeCloneRequest } from "../../utils/request.mjs";
|
|
11
|
+
import { formCsrfMiddleware } from "../middlewares/origin-check.mjs";
|
|
11
12
|
import { createEmailVerificationToken } from "./email-verification.mjs";
|
|
12
|
-
import { assertPasswordNotTooLong } from "../../utils/password.mjs";
|
|
13
13
|
import { APIError, BASE_ERROR_CODES } from "@better-auth/core/error";
|
|
14
14
|
import { additionalAuthorizationParamsSchema, supportsIdTokenSignIn, verifyProviderIdToken } from "@better-auth/core/oauth2";
|
|
15
15
|
import { SocialProviderListEnum } from "@better-auth/core/social-providers";
|
|
16
16
|
import { createAuthEndpoint } from "@better-auth/core/api";
|
|
17
17
|
import * as z from "zod";
|
|
18
|
-
|
|
18
|
+
// src/api/routes/sign-in.ts
|
|
19
19
|
const socialSignInBodySchema = z.object({
|
|
20
20
|
/**
|
|
21
21
|
* Callback URL to redirect to after the user
|
|
@@ -366,5 +366,4 @@ const signInEmail = () => createAuthEndpoint("/sign-in/email", {
|
|
|
366
366
|
user: parseUserOutput(ctx.context.options, user)
|
|
367
367
|
});
|
|
368
368
|
});
|
|
369
|
-
//#endregion
|
|
370
369
|
export { signInEmail, signInSocial };
|