better-auth 1.7.21 → 1.7.23
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 +35 -22
- 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,7 +1,7 @@
|
|
|
1
1
|
import { decodeJwt } from "jose";
|
|
2
2
|
import { betterFetch } from "@better-fetch/fetch";
|
|
3
3
|
import { createPlaceholderEmail } from "@better-auth/core/utils/email";
|
|
4
|
-
|
|
4
|
+
// src/plugins/generic-oauth/providers/microsoft-entra-id.ts
|
|
5
5
|
function getMicrosoftProfileName(profile) {
|
|
6
6
|
return profile.name ?? (`${profile.given_name ?? profile.givenname ?? ""} ${profile.family_name ?? profile.familyname ?? ""}`.trim() || void 0);
|
|
7
7
|
}
|
|
@@ -100,5 +100,4 @@ function microsoftEntraId(options) {
|
|
|
100
100
|
getUserInfo
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
-
//#endregion
|
|
104
103
|
export { microsoftEntraId };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { GenericOAuthConfig } from "../types.mjs";
|
|
2
2
|
import { BaseOAuthProviderOptions } from "../index.mjs";
|
|
3
|
-
//#region src/plugins/generic-oauth/providers/okta.d.ts
|
|
4
3
|
export interface OktaOptions extends BaseOAuthProviderOptions {
|
|
5
4
|
/**
|
|
6
5
|
* Okta issuer URL (e.g., https://dev-xxxxx.okta.com/oauth2/default)
|
|
@@ -30,5 +29,4 @@ export interface OktaOptions extends BaseOAuthProviderOptions {
|
|
|
30
29
|
* });
|
|
31
30
|
* ```
|
|
32
31
|
*/
|
|
33
|
-
export declare function okta(options: OktaOptions): GenericOAuthConfig<"okta">;
|
|
34
|
-
//#endregion
|
|
32
|
+
export declare function okta(options: OktaOptions): GenericOAuthConfig<"okta">;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/plugins/generic-oauth/providers/okta.ts
|
|
2
2
|
/**
|
|
3
3
|
* Okta OAuth provider helper
|
|
4
4
|
*
|
|
@@ -43,5 +43,4 @@ function okta(options) {
|
|
|
43
43
|
overrideUserInfo: options.overrideUserInfo
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
|
-
//#endregion
|
|
47
46
|
export { okta };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { GenericOAuthConfig } from "../types.mjs";
|
|
2
2
|
import { BaseOAuthProviderOptions } from "../index.mjs";
|
|
3
|
-
//#region src/plugins/generic-oauth/providers/patreon.d.ts
|
|
4
3
|
export interface PatreonOptions extends BaseOAuthProviderOptions {}
|
|
5
4
|
/**
|
|
6
5
|
* Patreon OAuth provider helper
|
|
@@ -23,5 +22,4 @@ export interface PatreonOptions extends BaseOAuthProviderOptions {}
|
|
|
23
22
|
* });
|
|
24
23
|
* ```
|
|
25
24
|
*/
|
|
26
|
-
export declare function patreon(options: PatreonOptions): GenericOAuthConfig<"patreon">;
|
|
27
|
-
//#endregion
|
|
25
|
+
export declare function patreon(options: PatreonOptions): GenericOAuthConfig<"patreon">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { betterFetch } from "@better-fetch/fetch";
|
|
2
|
-
|
|
2
|
+
// src/plugins/generic-oauth/providers/patreon.ts
|
|
3
3
|
/**
|
|
4
4
|
* Patreon OAuth provider helper
|
|
5
5
|
*
|
|
@@ -57,5 +57,4 @@ function patreon(options) {
|
|
|
57
57
|
getUserInfo
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
-
//#endregion
|
|
61
60
|
export { patreon };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { GenericOAuthConfig } from "../types.mjs";
|
|
2
2
|
import { BaseOAuthProviderOptions } from "../index.mjs";
|
|
3
|
-
//#region src/plugins/generic-oauth/providers/slack.d.ts
|
|
4
3
|
export interface SlackOptions extends BaseOAuthProviderOptions {}
|
|
5
4
|
/**
|
|
6
5
|
* Slack OAuth provider helper
|
|
@@ -23,5 +22,4 @@ export interface SlackOptions extends BaseOAuthProviderOptions {}
|
|
|
23
22
|
* });
|
|
24
23
|
* ```
|
|
25
24
|
*/
|
|
26
|
-
export declare function slack(options: SlackOptions): GenericOAuthConfig<"slack">;
|
|
27
|
-
//#endregion
|
|
25
|
+
export declare function slack(options: SlackOptions): GenericOAuthConfig<"slack">;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { betterFetch } from "@better-fetch/fetch";
|
|
2
|
-
|
|
2
|
+
// src/plugins/generic-oauth/providers/slack.ts
|
|
3
3
|
/**
|
|
4
4
|
* Slack OAuth provider helper
|
|
5
5
|
*
|
|
@@ -59,5 +59,4 @@ function slack(options) {
|
|
|
59
59
|
getUserInfo
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
//#endregion
|
|
63
62
|
export { slack };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { GenericOAuthConfig } from "../types.mjs";
|
|
2
2
|
import { BaseOAuthProviderOptions } from "../index.mjs";
|
|
3
|
-
//#region src/plugins/generic-oauth/providers/yandex.d.ts
|
|
4
3
|
export interface YandexOptions extends BaseOAuthProviderOptions {}
|
|
5
4
|
/**
|
|
6
5
|
* Yandex OAuth provider helper
|
|
@@ -23,5 +22,4 @@ export interface YandexOptions extends BaseOAuthProviderOptions {}
|
|
|
23
22
|
* });
|
|
24
23
|
* ```
|
|
25
24
|
*/
|
|
26
|
-
export declare function yandex(options: YandexOptions): GenericOAuthConfig;
|
|
27
|
-
//#endregion
|
|
25
|
+
export declare function yandex(options: YandexOptions): GenericOAuthConfig;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { betterFetch } from "@better-fetch/fetch";
|
|
2
|
-
|
|
2
|
+
// src/plugins/generic-oauth/providers/yandex.ts
|
|
3
3
|
/**
|
|
4
4
|
* Yandex OAuth provider helper
|
|
5
5
|
*
|
|
@@ -63,5 +63,4 @@ function yandex(options) {
|
|
|
63
63
|
getUserInfo
|
|
64
64
|
};
|
|
65
65
|
}
|
|
66
|
-
//#endregion
|
|
67
66
|
export { yandex };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Awaitable } from "@better-auth/core";
|
|
2
2
|
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, OAuthMappedUser, OAuthRefreshContext, TokenEndpointAuth } from "@better-auth/core/oauth2";
|
|
3
|
-
//#region src/plugins/generic-oauth/types.d.ts
|
|
4
3
|
/** Raw profile returned by a Generic OAuth provider. */
|
|
5
4
|
export type GenericOAuthUserInfo = Omit<OAuth2UserInfo, "id"> & {
|
|
6
5
|
id?: string | number | null | undefined;
|
|
@@ -266,5 +265,4 @@ export interface GenericOAuthConfig<ID extends string = string> {
|
|
|
266
265
|
* @default false
|
|
267
266
|
*/
|
|
268
267
|
disableIdTokenNonceBinding?: boolean | undefined;
|
|
269
|
-
}
|
|
270
|
-
//#endregion
|
|
268
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/plugins/haveibeenpwned/index.d.ts
|
|
2
1
|
declare module "@better-auth/core" {
|
|
3
2
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
4
3
|
"have-i-been-pwned": {
|
|
@@ -55,5 +54,4 @@ export declare const haveIBeenPwned: (options?: HaveIBeenPwnedOptions | undefine
|
|
|
55
54
|
$ERROR_CODES: {
|
|
56
55
|
PASSWORD_COMPROMISED: import("@better-auth/core/utils/error-codes").RawError<"PASSWORD_COMPROMISED">;
|
|
57
56
|
};
|
|
58
|
-
};
|
|
59
|
-
//#endregion
|
|
57
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { isAPIError } from "../../utils/is-api-error.mjs";
|
|
2
1
|
import { APIError } from "../../api/index.mjs";
|
|
2
|
+
import { isAPIError } from "../../utils/is-api-error.mjs";
|
|
3
3
|
import { PACKAGE_VERSION } from "../../version.mjs";
|
|
4
4
|
import { getCurrentAuthEndpointContext } from "@better-auth/core/context";
|
|
5
5
|
import { defineErrorCodes } from "@better-auth/core/utils/error-codes";
|
|
6
6
|
import { createHash } from "@better-auth/utils/hash";
|
|
7
7
|
import { betterFetch } from "@better-fetch/fetch";
|
|
8
|
-
|
|
8
|
+
// src/plugins/haveibeenpwned/index.ts
|
|
9
9
|
const ERROR_CODES = defineErrorCodes({ PASSWORD_COMPROMISED: "The password you entered has been compromised. Please choose a different password." });
|
|
10
10
|
function getPasswordCompromiseCount(response, hashSuffix) {
|
|
11
11
|
const matchingEntryPrefix = `${hashSuffix.toUpperCase()}:`;
|
|
@@ -77,5 +77,4 @@ const haveIBeenPwned = (options) => {
|
|
|
77
77
|
$ERROR_CODES: ERROR_CODES
|
|
78
78
|
};
|
|
79
79
|
};
|
|
80
|
-
//#endregion
|
|
81
80
|
export { haveIBeenPwned, isPasswordCompromised };
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -53,21 +53,21 @@ import { OneTimeTokenOptions, oneTimeToken } from "./one-time-token/index.mjs";
|
|
|
53
53
|
import { FieldSchema, OpenAPIModelSchema, OpenAPIParameter, OpenAPISchema, Path, generator } from "./open-api/generator.mjs";
|
|
54
54
|
import { OpenAPIOptions, openAPI } from "./open-api/index.mjs";
|
|
55
55
|
import { PhoneNumberOptions, UserWithPhoneNumber } from "./phone-number/types.mjs";
|
|
56
|
+
import "./organization/index.mjs";
|
|
56
57
|
import { phoneNumber } from "./phone-number/index.mjs";
|
|
57
|
-
import { SIWEPluginOptions, siwe } from "./siwe/index.mjs";
|
|
58
58
|
import { LoginResult, TestAuthOptions, TestCookie, TestHelpers, TestUtilsOptions } from "./test-utils/types.mjs";
|
|
59
|
-
import {
|
|
59
|
+
import { SIWEPluginOptions, siwe } from "./siwe/index.mjs";
|
|
60
60
|
import { BackupCodeOptions, backupCode2fa, encodeBackupCodes, generateBackupCodes, getBackupCodes, verifyBackupCode } from "./two-factor/backup-codes/index.mjs";
|
|
61
61
|
import { OTPOptions, otp2fa } from "./two-factor/otp/index.mjs";
|
|
62
62
|
import { TOTPOptions, totp2fa } from "./two-factor/totp/index.mjs";
|
|
63
63
|
import { TwoFactorOptions, TwoFactorProvider, TwoFactorTable, UserWithTwoFactor } from "./two-factor/types.mjs";
|
|
64
64
|
import { TWO_FACTOR_ERROR_CODES } from "./two-factor/error-code.mjs";
|
|
65
65
|
import { twoFactorClient } from "./two-factor/client.mjs";
|
|
66
|
-
import {
|
|
66
|
+
import { testUtils } from "./test-utils/index.mjs";
|
|
67
67
|
import { USERNAME_ERROR_CODES } from "./username/error-codes.mjs";
|
|
68
|
-
import {
|
|
68
|
+
import { twoFactor } from "./two-factor/index.mjs";
|
|
69
69
|
import { hasPermission } from "./organization/has-permission.mjs";
|
|
70
70
|
import { parseRoles } from "./organization/roles.mjs";
|
|
71
71
|
import { DefaultOrganizationPlugin, DynamicAccessControlEndpoints, OrganizationCreator, OrganizationEndpoints, OrganizationPlugin, TeamEndpoints, organization } from "./organization/organization.mjs";
|
|
72
|
-
import "./
|
|
72
|
+
import { UsernameOptions, UsernamePlugin, UsernamePluginWithoutDisplayUsername, username } from "./username/index.mjs";
|
|
73
73
|
export { AccessControl, type AdminOptions, type AnonymousOptions, type AnonymousSession, ArrayElement, type Auth0Options, AuthorizeResponse, type BackupCodeOptions, type BaseCaptchaOptions, BaseOAuthProviderOptions, BearerOptions, type BotIdVerification, type CaptchaFoxOptions, type CaptchaOptions, type CloudflareTurnstileOptions, CustomSessionPluginOptions, DefaultOrganizationPlugin, DeviceAuthorizationGrant, DeviceAuthorizationGrantAuthorization, DeviceAuthorizationOptions, DeviceAuthorizationPluginOptions, DeviceAuthorizationRequest, type DeviceCode, type DeviceCodeRedemptionAuthorization, type DeviceCodeRedemptionResult, DynamicAccessControlEndpoints, MULTI_SESSION_ERROR_CODES as ERROR_CODES, type EmailOTPOptions, ExactRoleStatements, type FieldSchema, type GenericOAuthConfig, type GenericOAuthOptions, type GenericOAuthUserInfo, type GoogleRecaptchaOptions, type GumroadOptions, type HCaptchaOptions, HIDE_METADATA, HaveIBeenPwnedOptions, type HubSpotOptions, type InferAdminRolesFromOption, type InferInvitation, type InferMember, InferOptionSchema, type InferOrganization, type InferOrganizationRolesFromOption, type InferOrganizationZodRolesFromOption, InferPluginContext, InferPluginErrorCodes, InferPluginIDs, type InferTeam, type Invitation, type InvitationInput, type InvitationStatus, type JWKOptions, type JWSAlgorithms, type Jwk, type JwtOptions, type KeycloakOptions, LastLoginMethodOptions, type LineOptions, type LoginResult, MagicLinkOptions, type Member, type MemberInput, type MicrosoftEntraIdOptions, MultiSessionConfig, OAUTH_POPUP_COMPLETE_SCRIPT, OAUTH_POPUP_DATA_ELEMENT_ID, OAUTH_POPUP_ERROR_CODES, OAUTH_POPUP_MESSAGE_TYPE, OAUTH_POPUP_SCRIPT_CSP_HASH, type OAuthPopupData, type OAuthPopupMessage, OAuthProxyOptions, type OTPOptions, type OktaOptions, OneTapOptions, OneTimeTokenOptions, type OpenAPIModelSchema, OpenAPIOptions, type OpenAPIParameter, type OpenAPISchema, type Organization, OrganizationCreator, OrganizationEndpoints, type OrganizationInput, type OrganizationOptions, OrganizationPlugin, type OrganizationRole, type OrganizationSchema, POPUP_MARKER_COOKIE, type Path, type PatreonOptions, type PhoneNumberOptions, type Provider, type ResolvedSigningKey, Role, RoleAuthorizeRequest, RoleInput, RoleStatements, SIWEPluginOptions, type SessionWithImpersonatedBy, type SlackOptions, Statements, SubArray, Subset, type TOTPOptions, TWO_FACTOR_ERROR_CODES, type Team, TeamEndpoints, type TeamInput, type TeamMember, type TeamMemberInput, type TestAuthOptions, type TestCookie, type TestHelpers, type TestUtilsOptions, type TimeString, TwoFactorOptions, TwoFactorProvider, TwoFactorTable, USERNAME_ERROR_CODES, type UserWithAnonymous, type UserWithPhoneNumber, type UserWithRole, UserWithTwoFactor, UsernameOptions, UsernamePlugin, UsernamePluginWithoutDisplayUsername, type ValidateRequestContext, type VercelBotIdOptions, type YandexOptions, admin, anonymous, auth0, type backupCode2fa, bearer, captcha, createAccessControl, createJwk, customSession, type defaultRolesSchema, deviceAuthorization, deviceAuthorizationOptionsSchema, emailOTP, type encodeBackupCodes, type generateBackupCodes, generateExportedKeyPair, type generator, genericOAuth, type getBackupCodes, getJwtToken, getOrgAdapter, gumroad, hasPermission, haveIBeenPwned, hubspot, type invitationSchema, type invitationStatus, isPasswordCompromised, jwt, keycloak, lastLoginMethod, line, magicLink, type memberSchema, microsoftEntraId, type ms, multiSession, oAuthProxy, oauthPopup, okta, oneTap, oneTimeToken, openAPI, organization, type organizationRoleSchema, type organizationSchema, type otp2fa, parseRoles, patreon, phoneNumber, redeemDeviceCode, resolveSigningKey, role, type roleSchema, type sec, signJWT, siwe, slack, type teamMemberSchema, type teamSchema, testUtils, toExpJWT, type totp2fa, twoFactor, twoFactorClient, username, type verifyBackupCode, verifyJWT, yandex };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getCurrentAdapter } from "@better-auth/core/context";
|
|
2
|
-
|
|
2
|
+
// src/plugins/jwt/adapter.ts
|
|
3
3
|
/**
|
|
4
4
|
* Algorithm of the key the plugin generates when `jwks.keyPairConfig` is unset.
|
|
5
5
|
*/
|
|
@@ -75,5 +75,4 @@ const getJwksAdapter = (baseAdapter, options) => {
|
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
};
|
|
78
|
-
//#endregion
|
|
79
78
|
export { DEFAULT_JWK_ALG, getDefaultKeyAlg, getJwksAdapter };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { JWKOptions, JWSAlgorithms, Jwk, JwtOptions, ResolvedSigningKey } from "./types.mjs";
|
|
2
1
|
import { jwt } from "./index.mjs";
|
|
2
|
+
import { JWKOptions, JWSAlgorithms, Jwk, JwtOptions, ResolvedSigningKey } from "./types.mjs";
|
|
3
3
|
import { BetterAuthClientOptions, ClientFetchOption, ClientStore } from "@better-auth/core";
|
|
4
4
|
import { JSONWebKeySet } from "jose";
|
|
5
5
|
import { BetterFetch } from "@better-fetch/fetch";
|
|
6
|
-
//#region src/plugins/jwt/client.d.ts
|
|
7
6
|
interface JwtClientOptions {
|
|
8
7
|
jwks?: {
|
|
9
8
|
/**
|
|
@@ -36,5 +35,4 @@ export declare const jwtClient: (options?: JwtClientOptions) => {
|
|
|
36
35
|
}>;
|
|
37
36
|
};
|
|
38
37
|
};
|
|
39
|
-
//#endregion
|
|
40
38
|
export type { JWKOptions, JWSAlgorithms, Jwk, JwtOptions, ResolvedSigningKey };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PACKAGE_VERSION } from "../../version.mjs";
|
|
2
|
-
|
|
2
|
+
// src/plugins/jwt/client.ts
|
|
3
3
|
const jwtClient = (options) => {
|
|
4
4
|
const jwksPath = options?.jwks?.jwksPath ?? "/jwks";
|
|
5
5
|
return {
|
|
@@ -15,5 +15,4 @@ const jwtClient = (options) => {
|
|
|
15
15
|
} })
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
//#endregion
|
|
19
18
|
export { jwtClient };
|
|
@@ -3,7 +3,7 @@ import { getDefaultKeyAlg, getJwksAdapter } from "./adapter.mjs";
|
|
|
3
3
|
import { resolveSigningKey } from "./sign.mjs";
|
|
4
4
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
5
5
|
import { SignJWT, decodeProtectedHeader, importJWK, jwtVerify } from "jose";
|
|
6
|
-
|
|
6
|
+
// src/plugins/jwt/cookie-cache.ts
|
|
7
7
|
function getCookieCacheJwtIssuer(ctx) {
|
|
8
8
|
const baseURL = ctx.context.options.baseURL;
|
|
9
9
|
return typeof baseURL === "string" ? baseURL || "better-auth:session-cache" : ctx.context.baseURL || "better-auth:session-cache";
|
|
@@ -68,5 +68,4 @@ function createCookieCacheSigner(options) {
|
|
|
68
68
|
verify: (ctx, token) => verifyCookieCacheJWT(ctx, token, options)
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
|
-
//#endregion
|
|
72
71
|
export { createCookieCacheSigner };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { JWKOptions, JWSAlgorithms, Jwk, JwtOptions, ResolvedSigningKey } from "./types.mjs";
|
|
2
1
|
import { getJwtToken, resolveSigningKey, signJWT } from "./sign.mjs";
|
|
2
|
+
import { JWKOptions, JWSAlgorithms, Jwk, JwtOptions, ResolvedSigningKey } from "./types.mjs";
|
|
3
3
|
import { createJwk, generateExportedKeyPair, toExpJWT } from "./utils.mjs";
|
|
4
4
|
import { verifyJWT } from "./verify.mjs";
|
|
5
5
|
import * as z from "zod";
|
|
6
6
|
import { JSONWebKeySet, JWTPayload } from "jose";
|
|
7
|
-
//#region src/plugins/jwt/index.d.ts
|
|
8
7
|
declare module "@better-auth/core" {
|
|
9
8
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
10
9
|
jwt: {
|
|
@@ -239,5 +238,4 @@ export declare const jwt: <O extends JwtOptions>(options?: O) => {
|
|
|
239
238
|
};
|
|
240
239
|
};
|
|
241
240
|
};
|
|
242
|
-
//#endregion
|
|
243
241
|
export { type JWKOptions, type JWSAlgorithms, type Jwk, type JwtOptions, type ResolvedSigningKey, createJwk, generateExportedKeyPair, getJwtToken, resolveSigningKey, signJWT, toExpJWT, verifyJWT };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { mergeSchema } from "../../db/schema.mjs";
|
|
2
|
-
import { sessionMiddleware } from "../../api/routes/session.mjs";
|
|
3
1
|
import { APIError as APIError$1 } from "../../api/index.mjs";
|
|
2
|
+
import { sessionMiddleware } from "../../api/routes/session.mjs";
|
|
3
|
+
import { mergeSchema } from "../../db/schema.mjs";
|
|
4
4
|
import { PACKAGE_VERSION } from "../../version.mjs";
|
|
5
5
|
import { getDefaultKeyAlg, getJwksAdapter } from "./adapter.mjs";
|
|
6
|
-
import { createJwk, generateExportedKeyPair, toExpJWT } from "./utils.mjs";
|
|
7
|
-
import { getJwtToken, resolveSigningKey, signJWT } from "./sign.mjs";
|
|
8
6
|
import { createCookieCacheSigner } from "./cookie-cache.mjs";
|
|
9
7
|
import { schema } from "./schema.mjs";
|
|
8
|
+
import { getJwtToken, resolveSigningKey, signJWT } from "./sign.mjs";
|
|
9
|
+
import { createJwk, generateExportedKeyPair, toExpJWT } from "./utils.mjs";
|
|
10
10
|
import { verifyJWT } from "./verify.mjs";
|
|
11
11
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
12
12
|
import { createAuthEndpoint, createAuthMiddleware } from "@better-auth/core/api";
|
|
13
13
|
import * as z from "zod";
|
|
14
|
-
|
|
14
|
+
// src/plugins/jwt/index.ts
|
|
15
15
|
const signJWTBodySchema = z.object({
|
|
16
16
|
payload: z.record(z.string(), z.any()),
|
|
17
17
|
overrideOptions: z.record(z.string(), z.any()).optional()
|
|
@@ -210,5 +210,4 @@ const jwt = (options) => {
|
|
|
210
210
|
schema: mergeSchema(schema, options?.schema)
|
|
211
211
|
};
|
|
212
212
|
};
|
|
213
|
-
//#endregion
|
|
214
213
|
export { createJwk, generateExportedKeyPair, getJwtToken, jwt, resolveSigningKey, signJWT, toExpJWT, verifyJWT };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/plugins/jwt/schema.ts
|
|
2
2
|
const schema = { jwks: { fields: {
|
|
3
3
|
publicKey: {
|
|
4
4
|
type: "string",
|
|
@@ -25,5 +25,4 @@ const schema = { jwks: { fields: {
|
|
|
25
25
|
required: false
|
|
26
26
|
}
|
|
27
27
|
} } };
|
|
28
|
-
//#endregion
|
|
29
28
|
export { schema };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { JWSAlgorithms, JwtOptions, ResolvedSigningKey } from "./types.mjs";
|
|
2
2
|
import { GenericEndpointContext } from "@better-auth/core";
|
|
3
|
-
//#region src/plugins/jwt/sign.d.ts
|
|
4
3
|
type JWTPayloadWithOptional = {
|
|
5
4
|
/**
|
|
6
5
|
* JWT Issuer
|
|
@@ -125,5 +124,4 @@ export declare function signJWT(ctx: GenericEndpointContext, config: {
|
|
|
125
124
|
signingAlgorithm?: JWSAlgorithms | undefined;
|
|
126
125
|
}): Promise<string>;
|
|
127
126
|
export declare function getJwtToken(ctx: GenericEndpointContext, options?: JwtOptions | undefined): Promise<string>;
|
|
128
|
-
//#endregion
|
|
129
127
|
export {};
|
|
@@ -3,7 +3,7 @@ import { getDefaultKeyAlg, getJwksAdapter } from "./adapter.mjs";
|
|
|
3
3
|
import { createJwk, toExpJWT } from "./utils.mjs";
|
|
4
4
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
5
5
|
import { SignJWT, importJWK } from "jose";
|
|
6
|
-
|
|
6
|
+
// src/plugins/jwt/sign.ts
|
|
7
7
|
/**
|
|
8
8
|
* Resolves the JWKS signing key, decrypts it, and imports it
|
|
9
9
|
* for use with jose's SignJWT. Returns null when signing is
|
|
@@ -127,5 +127,4 @@ async function getJwtToken(ctx, options) {
|
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
129
|
}
|
|
130
|
-
//#endregion
|
|
131
130
|
export { getJwtToken, resolveSigningKey, signJWT };
|
|
@@ -4,7 +4,6 @@ import "../../types/index.mjs";
|
|
|
4
4
|
import { schema } from "./schema.mjs";
|
|
5
5
|
import { Awaitable, GenericEndpointContext } from "@better-auth/core";
|
|
6
6
|
import { JWTPayload } from "jose";
|
|
7
|
-
//#region src/plugins/jwt/types.d.ts
|
|
8
7
|
export interface JwtOptions {
|
|
9
8
|
/**
|
|
10
9
|
* Use the JWT plugin's locally managed signing keys for JWT session cookie
|
|
@@ -251,5 +250,4 @@ export interface ResolvedSigningKey {
|
|
|
251
250
|
alg: string;
|
|
252
251
|
kid: string;
|
|
253
252
|
privateKey: CryptoKey | Uint8Array;
|
|
254
|
-
}
|
|
255
|
-
//#endregion
|
|
253
|
+
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Jwk, JwtOptions } from "./types.mjs";
|
|
2
2
|
import { GenericEndpointContext } from "@better-auth/core";
|
|
3
|
-
//#region src/plugins/jwt/utils.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Converts an expirationTime to ISO seconds expiration time (the format of JWT exp)
|
|
6
5
|
*
|
|
@@ -34,5 +33,4 @@ export declare function generateExportedKeyPair(options?: JwtOptions | undefined
|
|
|
34
33
|
* @param options
|
|
35
34
|
* @returns
|
|
36
35
|
*/
|
|
37
|
-
export declare function createJwk(ctx: GenericEndpointContext, options?: JwtOptions | undefined): Promise<Jwk>;
|
|
38
|
-
//#endregion
|
|
36
|
+
export declare function createJwk(ctx: GenericEndpointContext, options?: JwtOptions | undefined): Promise<Jwk>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { sec } from "../../utils/time.mjs";
|
|
2
1
|
import { symmetricEncrypt } from "../../crypto/index.mjs";
|
|
2
|
+
import { sec } from "../../utils/time.mjs";
|
|
3
3
|
import { getJwksAdapter } from "./adapter.mjs";
|
|
4
4
|
import { exportJWK, generateKeyPair } from "jose";
|
|
5
|
-
|
|
5
|
+
// src/plugins/jwt/utils.ts
|
|
6
6
|
/**
|
|
7
7
|
* Converts an expirationTime to ISO seconds expiration time (the format of JWT exp)
|
|
8
8
|
*
|
|
@@ -60,5 +60,4 @@ async function createJwk(ctx, options) {
|
|
|
60
60
|
};
|
|
61
61
|
return await getJwksAdapter(ctx.context.adapter, options).createJwk(ctx, jwk);
|
|
62
62
|
}
|
|
63
|
-
//#endregion
|
|
64
63
|
export { createJwk, generateExportedKeyPair, toExpJWT };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { JwtOptions } from "./types.mjs";
|
|
2
2
|
import { JWTPayload } from "jose";
|
|
3
|
-
//#region src/plugins/jwt/verify.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* Verify a JWT token using the JWKS public keys
|
|
6
5
|
* Returns the payload if valid, null otherwise
|
|
7
6
|
*/
|
|
8
|
-
export declare function verifyJWT<T extends JWTPayload = JWTPayload>(token: string, options?: JwtOptions): Promise<(T & Required<Pick<JWTPayload, "sub" | "aud">>) | null>;
|
|
9
|
-
//#endregion
|
|
7
|
+
export declare function verifyJWT<T extends JWTPayload = JWTPayload>(token: string, options?: JwtOptions): Promise<(T & Required<Pick<JWTPayload, "sub" | "aud">>) | null>;
|
|
@@ -2,7 +2,7 @@ import { getDefaultKeyAlg, getJwksAdapter } from "./adapter.mjs";
|
|
|
2
2
|
import { getCurrentAuthEndpointContext } from "@better-auth/core/context";
|
|
3
3
|
import { base64 } from "@better-auth/utils/base64";
|
|
4
4
|
import { importJWK, jwtVerify } from "jose";
|
|
5
|
-
|
|
5
|
+
// src/plugins/jwt/verify.ts
|
|
6
6
|
/**
|
|
7
7
|
* Verify a JWT token using the JWKS public keys
|
|
8
8
|
* Returns the payload if valid, null otherwise
|
|
@@ -47,5 +47,4 @@ async function verifyJWT(token, options) {
|
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
//#endregion
|
|
51
50
|
export { verifyJWT };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/plugins/last-login-method/client.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Configuration for the client-side last login method plugin
|
|
4
3
|
*/
|
|
@@ -43,5 +42,4 @@ export declare const lastLoginMethodClient: (config?: LastLoginMethodClientConfi
|
|
|
43
42
|
*/
|
|
44
43
|
isLastUsedLoginMethod: (method: string) => boolean;
|
|
45
44
|
};
|
|
46
|
-
};
|
|
47
|
-
//#endregion
|
|
45
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseCookies } from "../../cookies/cookie-utils.mjs";
|
|
2
2
|
import { PACKAGE_VERSION } from "../../version.mjs";
|
|
3
|
-
|
|
3
|
+
// src/plugins/last-login-method/client.ts
|
|
4
4
|
function getCookieValue(name) {
|
|
5
5
|
if (typeof document === "undefined") return null;
|
|
6
6
|
return parseCookies(document.cookie).get(name) ?? null;
|
|
@@ -44,5 +44,4 @@ const lastLoginMethodClient = (config = {}) => {
|
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
-
//#endregion
|
|
48
47
|
export { lastLoginMethodClient };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { GenericEndpointContext } from "@better-auth/core";
|
|
2
|
-
//#region src/plugins/last-login-method/index.d.ts
|
|
3
2
|
declare module "@better-auth/core" {
|
|
4
3
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
5
4
|
"last-login-method": {
|
|
@@ -119,5 +118,4 @@ export declare const lastLoginMethod: <O extends LastLoginMethodOptions>(userCon
|
|
|
119
118
|
};
|
|
120
119
|
} : undefined;
|
|
121
120
|
options: NoInfer<O>;
|
|
122
|
-
};
|
|
123
|
-
//#endregion
|
|
121
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PACKAGE_VERSION } from "../../version.mjs";
|
|
2
2
|
import { createAuthMiddleware } from "@better-auth/core/api";
|
|
3
|
-
|
|
3
|
+
// src/plugins/last-login-method/index.ts
|
|
4
4
|
/**
|
|
5
5
|
* Plugin to track the last used login method
|
|
6
6
|
*/
|
|
@@ -95,5 +95,4 @@ const lastLoginMethod = (userConfig) => {
|
|
|
95
95
|
options: userConfig
|
|
96
96
|
};
|
|
97
97
|
};
|
|
98
|
-
//#endregion
|
|
99
98
|
export { lastLoginMethod };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PACKAGE_VERSION } from "../../version.mjs";
|
|
2
|
-
|
|
2
|
+
// src/plugins/magic-link/client.ts
|
|
3
3
|
const magicLinkClient = () => {
|
|
4
4
|
return {
|
|
5
5
|
id: "magic-link",
|
|
@@ -7,5 +7,4 @@ const magicLinkClient = () => {
|
|
|
7
7
|
$InferServerPlugin: {}
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
|
-
//#endregion
|
|
11
10
|
export { magicLinkClient };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Awaitable, GenericEndpointContext } from "@better-auth/core";
|
|
2
2
|
import * as z from "zod";
|
|
3
|
-
//#region src/plugins/magic-link/index.d.ts
|
|
4
3
|
declare module "@better-auth/core" {
|
|
5
4
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
6
5
|
"magic-link": {
|
|
@@ -206,5 +205,4 @@ export declare const magicLink: (options: MagicLinkOptions) => {
|
|
|
206
205
|
max: number;
|
|
207
206
|
}[];
|
|
208
207
|
options: MagicLinkOptions;
|
|
209
|
-
};
|
|
210
|
-
//#endregion
|
|
208
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { isAPIError } from "../../utils/is-api-error.mjs";
|
|
2
1
|
import { formCsrfMiddleware, originCheck } from "../../api/middlewares/origin-check.mjs";
|
|
3
|
-
import { parseSessionOutput, parseUserOutput } from "../../db/schema.mjs";
|
|
4
|
-
import { generateRandomString } from "../../crypto/random.mjs";
|
|
5
2
|
import { setSessionCookie } from "../../cookies/index.mjs";
|
|
3
|
+
import { generateRandomString } from "../../crypto/random.mjs";
|
|
4
|
+
import { parseSessionOutput, parseUserOutput } from "../../db/schema.mjs";
|
|
6
5
|
import { revokeUnprovenAccountAccess } from "../../db/revoke-unproven-account-access.mjs";
|
|
6
|
+
import { isAPIError } from "../../utils/is-api-error.mjs";
|
|
7
7
|
import { PACKAGE_VERSION } from "../../version.mjs";
|
|
8
8
|
import { defaultKeyHasher } from "./utils.mjs";
|
|
9
9
|
import { createAuthEndpoint } from "@better-auth/core/api";
|
|
10
10
|
import * as z from "zod";
|
|
11
|
-
|
|
11
|
+
// src/plugins/magic-link/index.ts
|
|
12
12
|
const signInMagicLinkBodySchema = z.object({
|
|
13
13
|
email: z.email().meta({ description: "Email address to send the magic link" }),
|
|
14
14
|
name: z.string().meta({ description: "User display name. Only used if the user is registering for the first time. Eg: \"my-name\"" }).optional(),
|
|
@@ -220,5 +220,4 @@ const magicLink = (options) => {
|
|
|
220
220
|
options
|
|
221
221
|
};
|
|
222
222
|
};
|
|
223
|
-
//#endregion
|
|
224
223
|
export { magicLink };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { base64Url } from "@better-auth/utils/base64";
|
|
2
2
|
import { createHash } from "@better-auth/utils/hash";
|
|
3
|
-
|
|
3
|
+
// src/plugins/magic-link/utils.ts
|
|
4
4
|
const defaultKeyHasher = async (otp) => {
|
|
5
5
|
const hash = await createHash("SHA-256").digest(new TextEncoder().encode(otp));
|
|
6
6
|
return base64Url.encode(new Uint8Array(hash), { padding: false });
|
|
7
7
|
};
|
|
8
|
-
//#endregion
|
|
9
8
|
export { defaultKeyHasher };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { MULTI_SESSION_ERROR_CODES } from "./error-codes.mjs";
|
|
2
2
|
import { MultiSessionConfig, multiSession } from "./index.mjs";
|
|
3
|
-
//#region src/plugins/multi-session/client.d.ts
|
|
4
3
|
export declare const multiSessionClient: () => {
|
|
5
4
|
id: "multi-session";
|
|
6
5
|
version: string;
|
|
@@ -13,5 +12,4 @@ export declare const multiSessionClient: () => {
|
|
|
13
12
|
INVALID_SESSION_TOKEN: import("@better-auth/core/utils/error-codes").RawError<"INVALID_SESSION_TOKEN">;
|
|
14
13
|
};
|
|
15
14
|
};
|
|
16
|
-
//#endregion
|
|
17
15
|
export { MULTI_SESSION_ERROR_CODES, type MultiSessionConfig };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PACKAGE_VERSION } from "../../version.mjs";
|
|
2
2
|
import { MULTI_SESSION_ERROR_CODES } from "./error-codes.mjs";
|
|
3
|
-
|
|
3
|
+
// src/plugins/multi-session/client.ts
|
|
4
4
|
const multiSessionClient = () => {
|
|
5
5
|
return {
|
|
6
6
|
id: "multi-session",
|
|
@@ -15,5 +15,4 @@ const multiSessionClient = () => {
|
|
|
15
15
|
$ERROR_CODES: MULTI_SESSION_ERROR_CODES
|
|
16
16
|
};
|
|
17
17
|
};
|
|
18
|
-
//#endregion
|
|
19
18
|
export { MULTI_SESSION_ERROR_CODES, multiSessionClient };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { defineErrorCodes } from "@better-auth/core/utils/error-codes";
|
|
2
|
-
|
|
2
|
+
// src/plugins/multi-session/error-codes.ts
|
|
3
3
|
const MULTI_SESSION_ERROR_CODES = defineErrorCodes({ INVALID_SESSION_TOKEN: "Invalid session token" });
|
|
4
|
-
//#endregion
|
|
5
4
|
export { MULTI_SESSION_ERROR_CODES };
|