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,5 +1,5 @@
|
|
|
1
1
|
import { getCurrentInstance, getCurrentScope, onScopeDispose, readonly, shallowRef } from "vue";
|
|
2
|
-
|
|
2
|
+
// src/client/vue/vue-store.ts
|
|
3
3
|
function registerStore(store) {
|
|
4
4
|
const instance = getCurrentInstance();
|
|
5
5
|
if (instance && instance.proxy) {
|
|
@@ -19,5 +19,4 @@ function useStore(store) {
|
|
|
19
19
|
}
|
|
20
20
|
return state;
|
|
21
21
|
}
|
|
22
|
-
//#endregion
|
|
23
22
|
export { useStore };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { checkEndpointConflicts } from "../api/index.mjs";
|
|
2
2
|
import { matchesOriginPattern } from "../auth/trusted-origins.mjs";
|
|
3
|
-
import { hasServerSessionStore } from "./store-capabilities.mjs";
|
|
4
|
-
import { isPromise } from "../utils/is-promise.mjs";
|
|
5
|
-
import { hashPassword, verifyPassword } from "../crypto/password.mjs";
|
|
6
3
|
import { createCookieGetter, getCookies } from "../cookies/index.mjs";
|
|
4
|
+
import { hashPassword, verifyPassword } from "../crypto/password.mjs";
|
|
7
5
|
import { createInternalAdapter } from "../db/internal-adapter.mjs";
|
|
8
|
-
import { getInternalPlugins, getTrustedOrigins, getTrustedProviders, runPluginInit } from "./helpers.mjs";
|
|
9
|
-
import { checkPassword } from "../utils/password.mjs";
|
|
10
|
-
import { checkEndpointConflicts } from "../api/index.mjs";
|
|
11
6
|
import { DEFAULT_SECRET } from "../utils/constants.mjs";
|
|
7
|
+
import { isPromise } from "../utils/is-promise.mjs";
|
|
8
|
+
import { checkPassword } from "../utils/password.mjs";
|
|
9
|
+
import { getBaseURL, isDynamicBaseURLConfig } from "../utils/url.mjs";
|
|
10
|
+
import { getInternalPlugins, getTrustedOrigins, getTrustedProviders, runPluginInit } from "./helpers.mjs";
|
|
12
11
|
import { buildSecretConfig, parseSecretsEnv, validateSecretsArray } from "./secret-utils.mjs";
|
|
12
|
+
import { hasServerSessionStore } from "./store-capabilities.mjs";
|
|
13
13
|
import { getBetterAuthVersion } from "@better-auth/core/context";
|
|
14
14
|
import { getAuthTables } from "@better-auth/core/db";
|
|
15
15
|
import { createLogger, env, isProduction, isTest } from "@better-auth/core/env";
|
|
@@ -20,7 +20,7 @@ import { socialProviders } from "@better-auth/core/social-providers";
|
|
|
20
20
|
import { findInvalidTrustedProxies } from "@better-auth/core/utils/ip";
|
|
21
21
|
import { createTelemetry } from "@better-auth/telemetry";
|
|
22
22
|
import defu from "defu";
|
|
23
|
-
|
|
23
|
+
// src/context/create-context.ts
|
|
24
24
|
/**
|
|
25
25
|
* Estimates the entropy of a string in bits.
|
|
26
26
|
* This is a simple approximation that helps detect low-entropy secrets.
|
|
@@ -232,5 +232,4 @@ Most of the features of Better Auth will not work correctly.`);
|
|
|
232
232
|
ctx.explicitSchemaCheck = schemaCheckFor(ctx.adapter);
|
|
233
233
|
return ctx;
|
|
234
234
|
}
|
|
235
|
-
//#endregion
|
|
236
235
|
export { createAuthContext };
|
package/dist/context/helpers.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { getBaseURL, getOrigin, isDynamicBaseURLConfig, isRequestLike, resolveBaseURL } from "../utils/url.mjs";
|
|
2
|
-
import { isPromise } from "../utils/is-promise.mjs";
|
|
3
1
|
import { createCookieGetter, getCookies } from "../cookies/index.mjs";
|
|
4
2
|
import { createInternalAdapter } from "../db/internal-adapter.mjs";
|
|
3
|
+
import { isPromise } from "../utils/is-promise.mjs";
|
|
4
|
+
import { getBaseURL, getOrigin, isDynamicBaseURLConfig, isRequestLike, resolveBaseURL } from "../utils/url.mjs";
|
|
5
5
|
import { env } from "@better-auth/core/env";
|
|
6
6
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
7
7
|
import { defu as defu$1 } from "defu";
|
|
8
8
|
import { isLoopbackHost } from "@better-auth/core/utils/host";
|
|
9
|
-
|
|
9
|
+
// src/context/helpers.ts
|
|
10
10
|
async function runPluginInit(context) {
|
|
11
11
|
let options = context.options;
|
|
12
12
|
const plugins = options.plugins || [];
|
|
@@ -156,5 +156,4 @@ async function getTrustedProviders(options, request) {
|
|
|
156
156
|
if (Array.isArray(trustedProviders)) return trustedProviders.filter((v) => Boolean(v));
|
|
157
157
|
return (await trustedProviders(request) ?? []).filter((v) => Boolean(v));
|
|
158
158
|
}
|
|
159
|
-
//#endregion
|
|
160
159
|
export { getAwaitableValue, getInternalPlugins, getTrustedOrigins, getTrustedProviders, pickSource, resolveDynamicTrustedProxyHeaders, resolveRequestContext, runPluginInit };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getBaseAdapter } from "../db/adapter-base.mjs";
|
|
2
2
|
import { createAuthContext } from "./create-context.mjs";
|
|
3
3
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
4
|
-
|
|
4
|
+
// src/context/init-minimal.ts
|
|
5
5
|
const initMinimal = async (options) => {
|
|
6
6
|
const adapter = await getBaseAdapter(options, async () => {
|
|
7
7
|
throw new BetterAuthError("Direct database connection requires Kysely. Please use `better-auth` instead of `better-auth/minimal`, or provide an adapter (drizzleAdapter, prismaAdapter, etc.)");
|
|
@@ -13,5 +13,4 @@ const initMinimal = async (options) => {
|
|
|
13
13
|
};
|
|
14
14
|
return ctx;
|
|
15
15
|
};
|
|
16
|
-
//#endregion
|
|
17
16
|
export { initMinimal };
|
package/dist/context/init.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { getMigrations } from "../db/get-migration.mjs";
|
|
|
3
3
|
import { createAuthContext } from "./create-context.mjs";
|
|
4
4
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
5
5
|
import { getKyselyDatabaseType } from "@better-auth/kysely-adapter";
|
|
6
|
-
|
|
6
|
+
// src/context/init.ts
|
|
7
7
|
const init = async (options) => {
|
|
8
8
|
const adapter = await getAdapter(options);
|
|
9
9
|
const getDatabaseType = (database) => getKyselyDatabaseType(database) || "unknown";
|
|
@@ -15,5 +15,4 @@ const init = async (options) => {
|
|
|
15
15
|
};
|
|
16
16
|
return ctx;
|
|
17
17
|
};
|
|
18
|
-
//#endregion
|
|
19
18
|
export { init };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "../utils/constants.mjs";
|
|
2
2
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
3
|
-
|
|
3
|
+
// src/context/secret-utils.ts
|
|
4
4
|
/**
|
|
5
5
|
* Estimates the entropy of a string in bits.
|
|
6
6
|
* This is a simple approximation that helps detect low-entropy secrets.
|
|
@@ -49,5 +49,4 @@ function buildSecretConfig(secrets, legacySecret) {
|
|
|
49
49
|
legacySecret: legacySecret && legacySecret !== "better-auth-secret-12345678901234567890" ? legacySecret : void 0
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
//#endregion
|
|
53
52
|
export { buildSecretConfig, parseSecretsEnv, validateSecretsArray };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/context/store-capabilities.ts
|
|
2
2
|
function hasServerSessionStore(options) {
|
|
3
3
|
return !!options.database || !!options.secondaryStorage;
|
|
4
4
|
}
|
|
@@ -8,5 +8,4 @@ function hasServerAccountStore(options) {
|
|
|
8
8
|
function shouldBindAccountCookieToSessionUser(options) {
|
|
9
9
|
return hasServerAccountStore(options);
|
|
10
10
|
}
|
|
11
|
-
//#endregion
|
|
12
11
|
export { hasServerSessionStore, shouldBindAccountCookieToSessionUser };
|
package/dist/cookies/cache.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import { sessionSchema, userSchema } from "@better-auth/core/db";
|
|
|
2
2
|
import { logger } from "@better-auth/core/env";
|
|
3
3
|
import { safeJSONParse } from "@better-auth/core/utils/json";
|
|
4
4
|
import * as z from "zod";
|
|
5
|
-
|
|
5
|
+
// src/cookies/cache.ts
|
|
6
6
|
const cookieCachePayloadSchema = z.looseObject({
|
|
7
7
|
session: sessionSchema.loose(),
|
|
8
8
|
user: userSchema.loose(),
|
|
@@ -29,5 +29,4 @@ function parseCompactCookieCache(value) {
|
|
|
29
29
|
const result = compactCookieCacheSchema.safeParse(value);
|
|
30
30
|
return result.success ? result.data : null;
|
|
31
31
|
}
|
|
32
|
-
//#endregion
|
|
33
32
|
export { parseCompactCookieCache, parseCookieCachePayload };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/cookies/cookie-utils.d.ts
|
|
2
1
|
export interface CookieAttributes {
|
|
3
2
|
value: string;
|
|
4
3
|
"max-age"?: number | undefined;
|
|
@@ -68,5 +67,4 @@ export declare function applySetCookies(target: Headers, setCookieValues: Iterab
|
|
|
68
67
|
export declare function setCookieToHeader(headers: Headers): (context: {
|
|
69
68
|
response: Response;
|
|
70
69
|
}) => void;
|
|
71
|
-
//#endregion
|
|
72
70
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/cookies/cookie-utils.ts
|
|
2
2
|
function tryDecode(str) {
|
|
3
3
|
if (str.indexOf("%") === -1) return str;
|
|
4
4
|
try {
|
|
@@ -197,5 +197,4 @@ function setCookieToHeader(headers) {
|
|
|
197
197
|
applySetCookies(headers, [setCookieHeader]);
|
|
198
198
|
};
|
|
199
199
|
}
|
|
200
|
-
//#endregion
|
|
201
200
|
export { HOST_COOKIE_PREFIX, SECURE_COOKIE_PREFIX, applySetCookies, cookieNameRegex, parseCookies, parseSetCookieHeader, setCookieToHeader, setRequestCookie, splitSetCookieHeader, stripSecureCookiePrefix, toCookieOptions };
|
package/dist/cookies/index.d.mts
CHANGED
|
@@ -5,7 +5,6 @@ import { createSessionStore, getAccountCookie, getChunkedCookie, setAccountCooki
|
|
|
5
5
|
import { Awaitable, BetterAuthCookie, BetterAuthCookies, BetterAuthOptions, CookieCachePayload, GenericEndpointContext } from "@better-auth/core";
|
|
6
6
|
import { CookieOptions } from "better-call";
|
|
7
7
|
import { JSONWebKeySet } from "jose";
|
|
8
|
-
//#region src/cookies/index.d.ts
|
|
9
8
|
export declare function createCookieGetter(options: BetterAuthOptions): (cookieName: string, overrideAttributes?: Partial<CookieOptions>) => {
|
|
10
9
|
name: string;
|
|
11
10
|
attributes: {
|
|
@@ -119,5 +118,4 @@ export declare const getCookieCache: <S extends CookieCachePayload = CookieCache
|
|
|
119
118
|
} | undefined;
|
|
120
119
|
version?: CookieCacheVersion;
|
|
121
120
|
} | undefined) => Promise<S | null>;
|
|
122
|
-
//#endregion
|
|
123
121
|
export { CookieAttributes, HOST_COOKIE_PREFIX, SECURE_COOKIE_PREFIX, applySetCookies, cookieNameRegex, createSessionStore, getAccountCookie, getChunkedCookie, parseCookies, parseSetCookieHeader, setAccountCookie, setCookieToHeader, setRequestCookie, splitSetCookieHeader, stripSecureCookiePrefix, toCookieOptions };
|
package/dist/cookies/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { isDynamicBaseURLConfig } from "../utils/url.mjs";
|
|
2
1
|
import { shouldBindAccountCookieToSessionUser } from "../context/store-capabilities.mjs";
|
|
3
2
|
import { signJWT, symmetricDecodeJWT, symmetricEncodeJWT, verifyJWT } from "../crypto/jwt.mjs";
|
|
4
3
|
import { parseUserOutput } from "../db/schema.mjs";
|
|
5
4
|
import { getDate } from "../utils/date.mjs";
|
|
6
5
|
import { isPromise } from "../utils/is-promise.mjs";
|
|
7
6
|
import { sec } from "../utils/time.mjs";
|
|
7
|
+
import { isDynamicBaseURLConfig } from "../utils/url.mjs";
|
|
8
8
|
import { parseCompactCookieCache, parseCookieCachePayload } from "./cache.mjs";
|
|
9
9
|
import { HOST_COOKIE_PREFIX, SECURE_COOKIE_PREFIX, applySetCookies, cookieNameRegex, parseCookies, parseSetCookieHeader, setCookieToHeader, setRequestCookie, splitSetCookieHeader, stripSecureCookiePrefix, toCookieOptions } from "./cookie-utils.mjs";
|
|
10
10
|
import { verifySessionCookieJwtWithJwks } from "./jwt.mjs";
|
|
@@ -16,7 +16,7 @@ import { filterOutputFields } from "@better-auth/core/utils/db";
|
|
|
16
16
|
import { base64Url } from "@better-auth/utils/base64";
|
|
17
17
|
import { binary } from "@better-auth/utils/binary";
|
|
18
18
|
import { createHMAC } from "@better-auth/utils/hmac";
|
|
19
|
-
|
|
19
|
+
// src/cookies/index.ts
|
|
20
20
|
function createCookieGetter(options) {
|
|
21
21
|
const baseURLString = typeof options.baseURL === "string" ? options.baseURL : void 0;
|
|
22
22
|
const dynamicProtocol = typeof options.baseURL === "object" && options.baseURL !== null ? options.baseURL.protocol : void 0;
|
|
@@ -351,5 +351,4 @@ const getCookieCache = async (request, config) => {
|
|
|
351
351
|
}
|
|
352
352
|
return null;
|
|
353
353
|
};
|
|
354
|
-
//#endregion
|
|
355
354
|
export { HOST_COOKIE_PREFIX, SECURE_COOKIE_PREFIX, applySetCookies, cookieNameRegex, createCookieGetter, createSessionStore, decodeCookieCache, deleteSessionCookie, expireCookie, getAccountCookie, getChunkedCookie, getCookieCache, getCookies, getSessionCookie, parseCookies, parseSetCookieHeader, setAccountCookie, setCookieCache, setCookieToHeader, setRequestCookie, setSessionCookie, splitSetCookieHeader, stripSecureCookiePrefix, toCookieOptions };
|
package/dist/cookies/jwt.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { parseCookieCachePayload } from "./cache.mjs";
|
|
2
2
|
import { decodeProtectedHeader, importJWK, jwtVerify } from "jose";
|
|
3
|
-
|
|
3
|
+
// src/cookies/jwt.ts
|
|
4
4
|
const SESSION_COOKIE_JWT_TYPE = "better-auth.session-cache+jwt";
|
|
5
5
|
const SESSION_COOKIE_JWT_AUDIENCE = "better-auth:session-cache";
|
|
6
6
|
const SESSION_COOKIE_JWT_ISSUER = "better-auth:session-cache";
|
|
@@ -41,5 +41,4 @@ async function verifySessionCookieJwtWithJwks(token, jwks, options) {
|
|
|
41
41
|
return null;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
//#endregion
|
|
45
44
|
export { SESSION_COOKIE_JWT_AUDIENCE, SESSION_COOKIE_JWT_ISSUER, SESSION_COOKIE_JWT_TYPE, getSessionCookieJwtVerifyOptions, parseSessionCookieJwtPayload, verifySessionCookieJwtWithJwks };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { GenericEndpointContext } from "@better-auth/core";
|
|
2
2
|
import { CookieOptions } from "better-call";
|
|
3
3
|
import "zod";
|
|
4
|
-
//#region src/cookies/session-store.d.ts
|
|
5
4
|
interface Cookie {
|
|
6
5
|
name: string;
|
|
7
6
|
value: string;
|
|
@@ -29,5 +28,4 @@ export declare function getAccountCookie(c: GenericEndpointContext): Promise<{
|
|
|
29
28
|
scope?: string | null | undefined;
|
|
30
29
|
password?: string | null | undefined;
|
|
31
30
|
} | null>;
|
|
32
|
-
//#endregion
|
|
33
31
|
export {};
|
|
@@ -3,7 +3,7 @@ import { parseCookies } from "./cookie-utils.mjs";
|
|
|
3
3
|
import { safeJSONParse } from "@better-auth/core/utils/json";
|
|
4
4
|
import { serializeCookie } from "better-call";
|
|
5
5
|
import * as z from "zod";
|
|
6
|
-
|
|
6
|
+
// src/cookies/session-store.ts
|
|
7
7
|
/**
|
|
8
8
|
* Per-cookie byte ceiling.
|
|
9
9
|
* Safari's ~4093 floor is the lowest among browsers.
|
|
@@ -180,5 +180,4 @@ const getSessionQuerySchema = z.optional(z.object({
|
|
|
180
180
|
disableCookieCache: z.coerce.boolean().meta({ description: "Disable cookie cache and fetch session from database" }).optional(),
|
|
181
181
|
disableRefresh: z.coerce.boolean().meta({ description: "Disable session refresh. Useful for checking session status, without updating the session" }).optional()
|
|
182
182
|
}));
|
|
183
|
-
//#endregion
|
|
184
183
|
export { createAccountStore, createSessionStore, getAccountCookie, getChunkedCookie, getSessionQuerySchema, setAccountCookie };
|
package/dist/crypto/buffer.d.mts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
//#region src/crypto/buffer.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* Compare two buffers in constant time.
|
|
4
3
|
*/
|
|
5
|
-
export declare function constantTimeEqual(a: ArrayBuffer | Uint8Array | string, b: ArrayBuffer | Uint8Array | string): boolean;
|
|
6
|
-
//#endregion
|
|
4
|
+
export declare function constantTimeEqual(a: ArrayBuffer | Uint8Array | string, b: ArrayBuffer | Uint8Array | string): boolean;
|
package/dist/crypto/buffer.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/crypto/buffer.ts
|
|
2
2
|
/**
|
|
3
3
|
* Compare two buffers in constant time.
|
|
4
4
|
*/
|
|
@@ -12,5 +12,4 @@ function constantTimeEqual(a, b) {
|
|
|
12
12
|
for (let i = 0; i < length; i++) c |= (i < aBuffer.length ? aBuffer[i] : 0) ^ (i < bBuffer.length ? bBuffer[i] : 0);
|
|
13
13
|
return c === 0;
|
|
14
14
|
}
|
|
15
|
-
//#endregion
|
|
16
15
|
export { constantTimeEqual };
|
package/dist/crypto/index.d.mts
CHANGED
|
@@ -3,7 +3,6 @@ import { signJWT, symmetricDecodeJWT, symmetricEncodeJWT, verifyJWT } from "./jw
|
|
|
3
3
|
import { hashPassword, verifyPassword } from "./password.mjs";
|
|
4
4
|
import { generateRandomString } from "./random.mjs";
|
|
5
5
|
import { SecretConfig } from "@better-auth/core";
|
|
6
|
-
//#region src/crypto/index.d.ts
|
|
7
6
|
export declare function parseEnvelope(data: string): {
|
|
8
7
|
version: number;
|
|
9
8
|
ciphertext: string;
|
|
@@ -21,5 +20,4 @@ export type SymmetricDecryptOptions = {
|
|
|
21
20
|
export declare const symmetricDecrypt: ({ key, data }: SymmetricDecryptOptions) => Promise<string>;
|
|
22
21
|
export declare const getCryptoKey: (secret: string | BufferSource) => Promise<CryptoKey>;
|
|
23
22
|
export declare const makeSignature: (value: string, secret: string | BufferSource) => Promise<string>;
|
|
24
|
-
//#endregion
|
|
25
23
|
export { type SecretConfig, constantTimeEqual, generateRandomString, hashPassword, signJWT, symmetricDecodeJWT, symmetricEncodeJWT, verifyJWT, verifyPassword };
|
package/dist/crypto/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { signJWT, symmetricDecodeJWT, symmetricEncodeJWT, verifyJWT } from "./jwt.mjs";
|
|
2
1
|
import { constantTimeEqual } from "./buffer.mjs";
|
|
2
|
+
import { signJWT, symmetricDecodeJWT, symmetricEncodeJWT, verifyJWT } from "./jwt.mjs";
|
|
3
3
|
import { hashPassword, verifyPassword } from "./password.mjs";
|
|
4
4
|
import { generateRandomString } from "./random.mjs";
|
|
5
5
|
import { getWebcryptoSubtle } from "@better-auth/utils";
|
|
6
6
|
import { createHash } from "@better-auth/utils/hash";
|
|
7
7
|
import { xchacha20poly1305 } from "@noble/ciphers/chacha.js";
|
|
8
8
|
import { bytesToHex, hexToBytes, managedNonce, utf8ToBytes } from "@noble/ciphers/utils.js";
|
|
9
|
-
|
|
9
|
+
// src/crypto/index.ts
|
|
10
10
|
const algorithm = {
|
|
11
11
|
name: "HMAC",
|
|
12
12
|
hash: "SHA-256"
|
|
@@ -66,5 +66,4 @@ const makeSignature = async (value, secret) => {
|
|
|
66
66
|
const signature = await getWebcryptoSubtle().sign(algorithm.name, key, new TextEncoder().encode(value));
|
|
67
67
|
return btoa(String.fromCharCode(...new Uint8Array(signature)));
|
|
68
68
|
};
|
|
69
|
-
//#endregion
|
|
70
69
|
export { constantTimeEqual, formatEnvelope, generateRandomString, getCryptoKey, hashPassword, makeSignature, parseEnvelope, signJWT, symmetricDecodeJWT, symmetricDecrypt, symmetricEncodeJWT, symmetricEncrypt, verifyJWT, verifyPassword };
|
package/dist/crypto/jwt.d.mts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { SecretConfig } from "./index.mjs";
|
|
2
|
-
//#region src/crypto/jwt.d.ts
|
|
3
2
|
export declare function signJWT(payload: any, secret: string, expiresIn?: number): Promise<string>;
|
|
4
3
|
export declare function verifyJWT<T = any>(token: string, secret: string): Promise<T | null>;
|
|
5
4
|
export declare function symmetricEncodeJWT<T extends Record<string, any>>(payload: T, secret: string | SecretConfig, salt: string, expiresIn?: number): Promise<string>;
|
|
6
|
-
export declare function symmetricDecodeJWT<T = any>(token: string, secret: string | SecretConfig, salt: string): Promise<T | null>;
|
|
7
|
-
//#endregion
|
|
5
|
+
export declare function symmetricDecodeJWT<T = any>(token: string, secret: string | SecretConfig, salt: string): Promise<T | null>;
|
package/dist/crypto/jwt.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hkdf } from "@noble/hashes/hkdf.js";
|
|
2
2
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
3
3
|
import { EncryptJWT, SignJWT, base64url, calculateJwkThumbprint, decodeProtectedHeader, jwtDecrypt, jwtVerify } from "jose";
|
|
4
|
-
|
|
4
|
+
// src/crypto/jwt.ts
|
|
5
5
|
async function signJWT(payload, secret, expiresIn = 3600) {
|
|
6
6
|
return await new SignJWT(payload).setProtectedHeader({ alg: "HS256" }).setIssuedAt().setExpirationTime(Math.floor(Date.now() / 1e3) + expiresIn).sign(new TextEncoder().encode(secret));
|
|
7
7
|
}
|
|
@@ -138,5 +138,4 @@ async function symmetricDecodeJWT(token, secret, salt) {
|
|
|
138
138
|
return null;
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
//#endregion
|
|
142
141
|
export { signJWT, symmetricDecodeJWT, symmetricEncodeJWT, verifyJWT };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { hashPassword } from "@better-auth/utils/password";
|
|
2
|
-
//#region src/crypto/password.d.ts
|
|
3
2
|
declare const hashPassword$1: typeof hashPassword;
|
|
4
3
|
declare const verifyPassword$1: ({ hash, password }: {
|
|
5
4
|
hash: string;
|
|
6
5
|
password: string;
|
|
7
6
|
}) => Promise<boolean>;
|
|
8
|
-
//#endregion
|
|
9
7
|
export { hashPassword$1 as hashPassword, verifyPassword$1 as verifyPassword };
|
package/dist/crypto/password.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { hashPassword, verifyPassword } from "@better-auth/utils/password";
|
|
2
|
-
|
|
2
|
+
// src/crypto/password.ts
|
|
3
3
|
/**
|
|
4
4
|
* `@better-auth/utils/password` uses the "node" export condition in package.json
|
|
5
5
|
* to automatically pick the right implementation:
|
|
@@ -10,5 +10,4 @@ const hashPassword$1 = hashPassword;
|
|
|
10
10
|
const verifyPassword$1 = async ({ hash, password }) => {
|
|
11
11
|
return verifyPassword(hash, password);
|
|
12
12
|
};
|
|
13
|
-
//#endregion
|
|
14
13
|
export { hashPassword$1 as hashPassword, verifyPassword$1 as verifyPassword };
|
package/dist/crypto/purpose.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { hkdf } from "@noble/hashes/hkdf.js";
|
|
2
2
|
import { sha256 } from "@noble/hashes/sha2.js";
|
|
3
3
|
import { bytesToHex, utf8ToBytes } from "@noble/hashes/utils.js";
|
|
4
|
-
|
|
4
|
+
// src/crypto/purpose.ts
|
|
5
5
|
const salt = utf8ToBytes("better-auth:oauth-encryption:v1");
|
|
6
6
|
function deriveSecret(secret, purpose) {
|
|
7
7
|
return bytesToHex(hkdf(sha256, utf8ToBytes(secret), salt, utf8ToBytes(`better-auth:${purpose}:v1`), 32));
|
|
@@ -15,5 +15,4 @@ function derivePurposeKey(secret, purpose) {
|
|
|
15
15
|
...secret.legacySecret && { legacySecret: deriveSecret(secret.legacySecret, purpose) }
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
-
//#endregion
|
|
19
18
|
export { derivePurposeKey };
|
package/dist/crypto/random.d.mts
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const generateRandomString: <SubA extends "a-z" | "A-Z" | "0-9" | "-_">(length: number, ...alphabets: SubA[]) => string;
|
|
3
|
-
//#endregion
|
|
1
|
+
export declare const generateRandomString: <SubA extends "a-z" | "A-Z" | "0-9" | "-_">(length: number, ...alphabets: SubA[]) => string;
|
package/dist/crypto/random.mjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
2
2
|
import { DBAdapter } from "@better-auth/core/db/adapter";
|
|
3
|
-
|
|
4
|
-
export declare function getBaseAdapter(options: BetterAuthOptions, handleDirectDatabase: (options: BetterAuthOptions) => Promise<DBAdapter<BetterAuthOptions>>): Promise<DBAdapter<BetterAuthOptions>>;
|
|
5
|
-
//#endregion
|
|
3
|
+
export declare function getBaseAdapter(options: BetterAuthOptions, handleDirectDatabase: (options: BetterAuthOptions) => Promise<DBAdapter<BetterAuthOptions>>): Promise<DBAdapter<BetterAuthOptions>>;
|
package/dist/db/adapter-base.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getAuthTables } from "@better-auth/core/db";
|
|
2
2
|
import { logger } from "@better-auth/core/env";
|
|
3
|
-
|
|
3
|
+
// src/db/adapter-base.ts
|
|
4
4
|
async function getBaseAdapter(options, handleDirectDatabase) {
|
|
5
5
|
let adapter;
|
|
6
6
|
if (!options.database) {
|
|
@@ -21,5 +21,4 @@ async function getBaseAdapter(options, handleDirectDatabase) {
|
|
|
21
21
|
}
|
|
22
22
|
return adapter;
|
|
23
23
|
}
|
|
24
|
-
//#endregion
|
|
25
24
|
export { getBaseAdapter };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
2
2
|
import { DBAdapter } from "@better-auth/core/db/adapter";
|
|
3
|
-
|
|
4
|
-
export declare function getAdapter(options: BetterAuthOptions): Promise<DBAdapter<BetterAuthOptions>>;
|
|
5
|
-
//#endregion
|
|
3
|
+
export declare function getAdapter(options: BetterAuthOptions): Promise<DBAdapter<BetterAuthOptions>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getBaseAdapter } from "./adapter-base.mjs";
|
|
2
2
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
3
|
-
|
|
3
|
+
// src/db/adapter-kysely.ts
|
|
4
4
|
async function getAdapter(options) {
|
|
5
5
|
return getBaseAdapter(options, async (opts) => {
|
|
6
6
|
const { createKyselyAdapter, kyselyAdapter } = await import("../adapters/kysely-adapter/index.mjs");
|
|
@@ -13,5 +13,4 @@ async function getAdapter(options) {
|
|
|
13
13
|
})(opts);
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { getAdapter };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import { DBFieldAttribute } from "@better-auth/core/db";
|
|
2
|
-
//#region src/db/field-converter.d.ts
|
|
3
2
|
export declare function convertToDB<T extends Record<string, any>>(fields: Record<string, DBFieldAttribute>, values: T): T;
|
|
4
|
-
export declare function convertFromDB<T extends Record<string, any>>(fields: Record<string, DBFieldAttribute>, values: T | null): T | null;
|
|
5
|
-
//#endregion
|
|
3
|
+
export declare function convertFromDB<T extends Record<string, any>>(fields: Record<string, DBFieldAttribute>, values: T | null): T | null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/db/field-converter.ts
|
|
2
2
|
function convertToDB(fields, values) {
|
|
3
3
|
const result = values.id ? { id: values.id } : {};
|
|
4
4
|
for (const key in fields) {
|
|
@@ -15,5 +15,4 @@ function convertFromDB(fields, values) {
|
|
|
15
15
|
for (const [key, value] of Object.entries(fields)) result[key] = values[value.fieldName || key];
|
|
16
16
|
return result;
|
|
17
17
|
}
|
|
18
|
-
//#endregion
|
|
19
18
|
export { convertFromDB, convertToDB };
|
package/dist/db/field.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DBFieldAttribute, InferDBValueType } from "@better-auth/core/db";
|
|
2
|
-
//#region src/db/field.d.ts
|
|
3
2
|
export type InferFieldsOutput<Fields extends Record<string, DBFieldAttribute>> = Fields extends Record<infer Key, DBFieldAttribute> ? { [key in Key as Fields[key]["returned"] extends false ? never : Fields[key]["required"] extends false ? Fields[key]["defaultValue"] extends boolean | string | number | Date ? key : never : key]: InferFieldOutput<Fields[key]>; } & { [key in Key as Fields[key]["returned"] extends false ? never : Fields[key]["required"] extends false ? Fields[key]["defaultValue"] extends boolean | string | number | Date ? never : key : never]?: InferFieldOutput<Fields[key]> | null; } : never;
|
|
4
3
|
/**
|
|
5
4
|
* For client will add "?" on optional fields
|
|
@@ -36,5 +35,4 @@ export type InferAdditionalFieldsFromPluginOptions<SchemaName extends string, Op
|
|
|
36
35
|
type RemoveFieldsWithInputFalse<T extends Record<string, DBFieldAttribute>> = { [K in keyof T as T[K]["input"] extends false ? never : K]: T[K]; };
|
|
37
36
|
export type RemoveFieldsWithReturnedFalse<T extends Record<string, DBFieldAttribute>> = { [K in keyof T as T[K]["returned"] extends false ? never : K]: T[K]; };
|
|
38
37
|
type InferFieldInput<T extends DBFieldAttribute> = InferDBValueType<T["type"]>;
|
|
39
|
-
//#endregion
|
|
40
38
|
export {};
|
|
@@ -3,7 +3,6 @@ import { DBFieldAttribute, DBFieldType } from "@better-auth/core/db";
|
|
|
3
3
|
import { BetterAuthError } from "@better-auth/core/error";
|
|
4
4
|
import { KyselyDatabaseType } from "@better-auth/kysely-adapter";
|
|
5
5
|
import { ResolvedDBTableIndex } from "@better-auth/core/db/internal";
|
|
6
|
-
//#region src/db/get-migration.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* Thrown when {@link getMigrations} refuses to add a required column with no
|
|
9
8
|
* default value to a populated table. Distinct from the plain
|
|
@@ -48,5 +47,4 @@ export declare function getMigrations(config: BetterAuthOptions, { throwOnUnsafe
|
|
|
48
47
|
schemaProblems: string[];
|
|
49
48
|
runMigrations: () => Promise<void>;
|
|
50
49
|
compileMigrations: () => Promise<string>;
|
|
51
|
-
}>;
|
|
52
|
-
//#endregion
|
|
50
|
+
}>;
|
|
@@ -5,7 +5,7 @@ import { createKyselyAdapter, getMssqlSchema, getPostgresSchema, introspectPostg
|
|
|
5
5
|
import { initGetFieldName, initGetModelName } from "@better-auth/core/db/adapter";
|
|
6
6
|
import { diffSchema, formatSchemaFinding, getDatabaseFieldIndexName, getDatabaseIndexStringLength, getPortableDatabaseIdentifierKey, invalidateSchemaChecks } from "@better-auth/core/db/internal";
|
|
7
7
|
import { sql } from "kysely";
|
|
8
|
-
|
|
8
|
+
// src/db/get-migration.ts
|
|
9
9
|
const map = {
|
|
10
10
|
postgres: {
|
|
11
11
|
string: [
|
|
@@ -682,5 +682,4 @@ async function getMigrations(config, { throwOnUnsafe = true } = {}) {
|
|
|
682
682
|
compileMigrations
|
|
683
683
|
};
|
|
684
684
|
}
|
|
685
|
-
//#endregion
|
|
686
685
|
export { UnsafeMigrationError, getMigrations, matchType };
|
package/dist/db/get-schema.d.mts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { BetterAuthOptions } from "@better-auth/core";
|
|
2
2
|
import { DBFieldAttribute } from "@better-auth/core/db";
|
|
3
3
|
import { ResolvedDBTableIndex } from "@better-auth/core/db/internal";
|
|
4
|
-
//#region src/db/get-schema.d.ts
|
|
5
4
|
export declare function getSchema(config: BetterAuthOptions): Record<string, {
|
|
6
5
|
fields: Record<string, DBFieldAttribute>;
|
|
7
6
|
indexes?: readonly ResolvedDBTableIndex[] | undefined;
|
|
8
7
|
order: number;
|
|
9
8
|
disableMigrations?: boolean | undefined;
|
|
10
|
-
}>;
|
|
11
|
-
//#endregion
|
|
9
|
+
}>;
|
package/dist/db/get-schema.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getAuthTablesWithResolvedIndexes } from "@better-auth/core/db/internal";
|
|
2
|
-
|
|
2
|
+
// src/db/get-schema.ts
|
|
3
3
|
function getSchema(config) {
|
|
4
4
|
return buildSchema(config).schema;
|
|
5
5
|
}
|
|
@@ -51,5 +51,4 @@ function buildSchema(config) {
|
|
|
51
51
|
referenceKeys
|
|
52
52
|
};
|
|
53
53
|
}
|
|
54
|
-
//#endregion
|
|
55
54
|
export { buildSchema, getSchema };
|
package/dist/db/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { FieldAttributeToObject, InferAdditionalFieldsFromPluginOptions, InferFieldsInputClient, InferFieldsOutput, RemoveFieldsWithReturnedFalse } from "./field.mjs";
|
|
2
2
|
import { convertFromDB, convertToDB } from "./field-converter.mjs";
|
|
3
3
|
import { getSchema } from "./get-schema.mjs";
|
|
4
|
-
import { DatabaseHooksEntry, getWithHooks } from "./with-hooks.mjs";
|
|
5
4
|
import { createInternalAdapter } from "./internal-adapter.mjs";
|
|
6
5
|
import { revokeUnprovenAccountAccess } from "./revoke-unproven-account-access.mjs";
|
|
7
6
|
import { buildSyntheticUserOutput, getSessionDefaultFields, mergeSchema, parseAccountInput, parseAccountOutput, parseAdditionalUserInput, parseAdditionalUserInputFromProviderProfile, parseInputData, parseSessionInput, parseSessionOutput, parseUserInput, parseUserOutput } from "./schema.mjs";
|
|
8
7
|
import { FieldAttributeToSchema, toZodSchema } from "./to-zod.mjs";
|
|
8
|
+
import { DatabaseHooksEntry, getWithHooks } from "./with-hooks.mjs";
|
|
9
9
|
export * from "@better-auth/core/db";
|
|
10
10
|
export { DatabaseHooksEntry, FieldAttributeToObject, FieldAttributeToSchema, InferAdditionalFieldsFromPluginOptions, InferFieldsInputClient, InferFieldsOutput, RemoveFieldsWithReturnedFalse, buildSyntheticUserOutput, convertFromDB, convertToDB, createInternalAdapter, getSchema, getSessionDefaultFields, getWithHooks, mergeSchema, parseAccountInput, parseAccountOutput, parseAdditionalUserInput, parseAdditionalUserInputFromProviderProfile, parseInputData, parseSessionInput, parseSessionOutput, parseUserInput, parseUserOutput, revokeUnprovenAccountAccess, toZodSchema };
|
package/dist/db/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { __exportAll, __reExport } from "../_virtual/_rolldown/runtime.mjs";
|
|
2
|
-
import { getSchema } from "./get-schema.mjs";
|
|
3
|
-
import { buildSyntheticUserOutput, getSessionDefaultFields, mergeSchema, parseAccountInput, parseAccountOutput, parseAdditionalUserInput, parseAdditionalUserInputFromProviderProfile, parseInputData, parseSessionInput, parseSessionOutput, parseUserInput, parseUserOutput } from "./schema.mjs";
|
|
4
2
|
import { convertFromDB, convertToDB } from "./field-converter.mjs";
|
|
5
|
-
import {
|
|
3
|
+
import { getSchema } from "./get-schema.mjs";
|
|
6
4
|
import { createInternalAdapter } from "./internal-adapter.mjs";
|
|
7
5
|
import { revokeUnprovenAccountAccess } from "./revoke-unproven-account-access.mjs";
|
|
6
|
+
import { buildSyntheticUserOutput, getSessionDefaultFields, mergeSchema, parseAccountInput, parseAccountOutput, parseAdditionalUserInput, parseAdditionalUserInputFromProviderProfile, parseInputData, parseSessionInput, parseSessionOutput, parseUserInput, parseUserOutput } from "./schema.mjs";
|
|
8
7
|
import { toZodSchema } from "./to-zod.mjs";
|
|
8
|
+
import { getWithHooks } from "./with-hooks.mjs";
|
|
9
9
|
export * from "@better-auth/core/db";
|
|
10
|
-
|
|
10
|
+
// src/db/index.ts
|
|
11
11
|
var db_exports = /* @__PURE__ */ __exportAll({
|
|
12
12
|
buildSyntheticUserOutput: () => buildSyntheticUserOutput,
|
|
13
13
|
convertFromDB: () => convertFromDB,
|
|
@@ -31,5 +31,4 @@ var db_exports = /* @__PURE__ */ __exportAll({
|
|
|
31
31
|
});
|
|
32
32
|
import * as import__better_auth_core_db from "@better-auth/core/db";
|
|
33
33
|
__reExport(db_exports, import__better_auth_core_db);
|
|
34
|
-
//#endregion
|
|
35
34
|
export { buildSyntheticUserOutput, convertFromDB, convertToDB, createInternalAdapter, db_exports, getSchema, getSessionDefaultFields, getWithHooks, mergeSchema, parseAccountInput, parseAccountOutput, parseAdditionalUserInput, parseAdditionalUserInputFromProviderProfile, parseInputData, parseSessionInput, parseSessionOutput, parseUserInput, parseUserOutput, revokeUnprovenAccountAccess, toZodSchema };
|
|
@@ -2,11 +2,9 @@ import { DatabaseHooksEntry } from "./with-hooks.mjs";
|
|
|
2
2
|
import { AuthContext, BetterAuthOptions, InternalAdapter } from "@better-auth/core";
|
|
3
3
|
import { InternalLogger } from "@better-auth/core/env";
|
|
4
4
|
import { DBAdapter } from "@better-auth/core/db/adapter";
|
|
5
|
-
//#region src/db/internal-adapter.d.ts
|
|
6
5
|
export declare const createInternalAdapter: (adapter: DBAdapter<BetterAuthOptions>, ctx: {
|
|
7
6
|
options: Omit<BetterAuthOptions, "logger">;
|
|
8
7
|
logger: InternalLogger;
|
|
9
8
|
hooks: DatabaseHooksEntry[];
|
|
10
9
|
generateId: AuthContext["generateId"];
|
|
11
|
-
}) => InternalAdapter;
|
|
12
|
-
//#endregion
|
|
10
|
+
}) => InternalAdapter;
|