@hammadj/better-auth 1.5.0-beta.10
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/README.md +33 -0
- package/dist/_virtual/rolldown_runtime.mjs +36 -0
- package/dist/adapters/drizzle-adapter/index.d.mts +1 -0
- package/dist/adapters/drizzle-adapter/index.mjs +3 -0
- package/dist/adapters/index.d.mts +23 -0
- package/dist/adapters/index.mjs +13 -0
- package/dist/adapters/index.mjs.map +1 -0
- package/dist/adapters/kysely-adapter/index.d.mts +1 -0
- package/dist/adapters/kysely-adapter/index.mjs +3 -0
- package/dist/adapters/memory-adapter/index.d.mts +1 -0
- package/dist/adapters/memory-adapter/index.mjs +3 -0
- package/dist/adapters/mongodb-adapter/index.d.mts +1 -0
- package/dist/adapters/mongodb-adapter/index.mjs +3 -0
- package/dist/adapters/prisma-adapter/index.d.mts +1 -0
- package/dist/adapters/prisma-adapter/index.mjs +3 -0
- package/dist/api/index.d.mts +40 -0
- package/dist/api/index.mjs +205 -0
- package/dist/api/index.mjs.map +1 -0
- package/dist/api/middlewares/index.d.mts +1 -0
- package/dist/api/middlewares/index.mjs +3 -0
- package/dist/api/middlewares/origin-check.d.mts +17 -0
- package/dist/api/middlewares/origin-check.mjs +140 -0
- package/dist/api/middlewares/origin-check.mjs.map +1 -0
- package/dist/api/rate-limiter/index.mjs +177 -0
- package/dist/api/rate-limiter/index.mjs.map +1 -0
- package/dist/api/routes/account.d.mts +10 -0
- package/dist/api/routes/account.mjs +493 -0
- package/dist/api/routes/account.mjs.map +1 -0
- package/dist/api/routes/callback.d.mts +5 -0
- package/dist/api/routes/callback.mjs +178 -0
- package/dist/api/routes/callback.mjs.map +1 -0
- package/dist/api/routes/email-verification.d.mts +29 -0
- package/dist/api/routes/email-verification.mjs +301 -0
- package/dist/api/routes/email-verification.mjs.map +1 -0
- package/dist/api/routes/error.d.mts +5 -0
- package/dist/api/routes/error.mjs +386 -0
- package/dist/api/routes/error.mjs.map +1 -0
- package/dist/api/routes/index.d.mts +11 -0
- package/dist/api/routes/index.mjs +13 -0
- package/dist/api/routes/ok.d.mts +5 -0
- package/dist/api/routes/ok.mjs +30 -0
- package/dist/api/routes/ok.mjs.map +1 -0
- package/dist/api/routes/password.d.mts +8 -0
- package/dist/api/routes/password.mjs +198 -0
- package/dist/api/routes/password.mjs.map +1 -0
- package/dist/api/routes/session.d.mts +52 -0
- package/dist/api/routes/session.mjs +478 -0
- package/dist/api/routes/session.mjs.map +1 -0
- package/dist/api/routes/sign-in.d.mts +8 -0
- package/dist/api/routes/sign-in.mjs +262 -0
- package/dist/api/routes/sign-in.mjs.map +1 -0
- package/dist/api/routes/sign-out.d.mts +5 -0
- package/dist/api/routes/sign-out.mjs +33 -0
- package/dist/api/routes/sign-out.mjs.map +1 -0
- package/dist/api/routes/sign-up.d.mts +7 -0
- package/dist/api/routes/sign-up.mjs +227 -0
- package/dist/api/routes/sign-up.mjs.map +1 -0
- package/dist/api/routes/update-user.d.mts +12 -0
- package/dist/api/routes/update-user.mjs +493 -0
- package/dist/api/routes/update-user.mjs.map +1 -0
- package/dist/api/state/oauth.d.mts +5 -0
- package/dist/api/state/oauth.mjs +8 -0
- package/dist/api/state/oauth.mjs.map +1 -0
- package/dist/api/state/should-session-refresh.d.mts +13 -0
- package/dist/api/state/should-session-refresh.mjs +16 -0
- package/dist/api/state/should-session-refresh.mjs.map +1 -0
- package/dist/api/to-auth-endpoints.mjs +197 -0
- package/dist/api/to-auth-endpoints.mjs.map +1 -0
- package/dist/auth/base.mjs +44 -0
- package/dist/auth/base.mjs.map +1 -0
- package/dist/auth/full.d.mts +30 -0
- package/dist/auth/full.mjs +32 -0
- package/dist/auth/full.mjs.map +1 -0
- package/dist/auth/minimal.d.mts +12 -0
- package/dist/auth/minimal.mjs +14 -0
- package/dist/auth/minimal.mjs.map +1 -0
- package/dist/auth/trusted-origins.mjs +31 -0
- package/dist/auth/trusted-origins.mjs.map +1 -0
- package/dist/client/broadcast-channel.d.mts +20 -0
- package/dist/client/broadcast-channel.mjs +46 -0
- package/dist/client/broadcast-channel.mjs.map +1 -0
- package/dist/client/config.mjs +90 -0
- package/dist/client/config.mjs.map +1 -0
- package/dist/client/fetch-plugins.mjs +18 -0
- package/dist/client/fetch-plugins.mjs.map +1 -0
- package/dist/client/focus-manager.d.mts +11 -0
- package/dist/client/focus-manager.mjs +32 -0
- package/dist/client/focus-manager.mjs.map +1 -0
- package/dist/client/index.d.mts +30 -0
- package/dist/client/index.mjs +21 -0
- package/dist/client/index.mjs.map +1 -0
- package/dist/client/lynx/index.d.mts +62 -0
- package/dist/client/lynx/index.mjs +24 -0
- package/dist/client/lynx/index.mjs.map +1 -0
- package/dist/client/lynx/lynx-store.d.mts +47 -0
- package/dist/client/lynx/lynx-store.mjs +47 -0
- package/dist/client/lynx/lynx-store.mjs.map +1 -0
- package/dist/client/online-manager.d.mts +12 -0
- package/dist/client/online-manager.mjs +35 -0
- package/dist/client/online-manager.mjs.map +1 -0
- package/dist/client/parser.mjs +73 -0
- package/dist/client/parser.mjs.map +1 -0
- package/dist/client/path-to-object.d.mts +57 -0
- package/dist/client/plugins/index.d.mts +58 -0
- package/dist/client/plugins/index.mjs +33 -0
- package/dist/client/plugins/infer-plugin.d.mts +9 -0
- package/dist/client/plugins/infer-plugin.mjs +11 -0
- package/dist/client/plugins/infer-plugin.mjs.map +1 -0
- package/dist/client/proxy.mjs +79 -0
- package/dist/client/proxy.mjs.map +1 -0
- package/dist/client/query.d.mts +23 -0
- package/dist/client/query.mjs +98 -0
- package/dist/client/query.mjs.map +1 -0
- package/dist/client/react/index.d.mts +63 -0
- package/dist/client/react/index.mjs +24 -0
- package/dist/client/react/index.mjs.map +1 -0
- package/dist/client/react/react-store.d.mts +47 -0
- package/dist/client/react/react-store.mjs +47 -0
- package/dist/client/react/react-store.mjs.map +1 -0
- package/dist/client/session-atom.mjs +29 -0
- package/dist/client/session-atom.mjs.map +1 -0
- package/dist/client/session-refresh.d.mts +28 -0
- package/dist/client/session-refresh.mjs +140 -0
- package/dist/client/session-refresh.mjs.map +1 -0
- package/dist/client/solid/index.d.mts +57 -0
- package/dist/client/solid/index.mjs +22 -0
- package/dist/client/solid/index.mjs.map +1 -0
- package/dist/client/solid/solid-store.mjs +24 -0
- package/dist/client/solid/solid-store.mjs.map +1 -0
- package/dist/client/svelte/index.d.mts +63 -0
- package/dist/client/svelte/index.mjs +20 -0
- package/dist/client/svelte/index.mjs.map +1 -0
- package/dist/client/types.d.mts +58 -0
- package/dist/client/vanilla.d.mts +62 -0
- package/dist/client/vanilla.mjs +20 -0
- package/dist/client/vanilla.mjs.map +1 -0
- package/dist/client/vue/index.d.mts +86 -0
- package/dist/client/vue/index.mjs +38 -0
- package/dist/client/vue/index.mjs.map +1 -0
- package/dist/client/vue/vue-store.mjs +26 -0
- package/dist/client/vue/vue-store.mjs.map +1 -0
- package/dist/context/create-context.mjs +211 -0
- package/dist/context/create-context.mjs.map +1 -0
- package/dist/context/helpers.mjs +62 -0
- package/dist/context/helpers.mjs.map +1 -0
- package/dist/context/init-minimal.mjs +20 -0
- package/dist/context/init-minimal.mjs.map +1 -0
- package/dist/context/init.mjs +22 -0
- package/dist/context/init.mjs.map +1 -0
- package/dist/cookies/cookie-utils.d.mts +29 -0
- package/dist/cookies/cookie-utils.mjs +105 -0
- package/dist/cookies/cookie-utils.mjs.map +1 -0
- package/dist/cookies/index.d.mts +67 -0
- package/dist/cookies/index.mjs +264 -0
- package/dist/cookies/index.mjs.map +1 -0
- package/dist/cookies/session-store.d.mts +36 -0
- package/dist/cookies/session-store.mjs +200 -0
- package/dist/cookies/session-store.mjs.map +1 -0
- package/dist/crypto/buffer.d.mts +8 -0
- package/dist/crypto/buffer.mjs +18 -0
- package/dist/crypto/buffer.mjs.map +1 -0
- package/dist/crypto/index.d.mts +27 -0
- package/dist/crypto/index.mjs +38 -0
- package/dist/crypto/index.mjs.map +1 -0
- package/dist/crypto/jwt.d.mts +8 -0
- package/dist/crypto/jwt.mjs +95 -0
- package/dist/crypto/jwt.mjs.map +1 -0
- package/dist/crypto/password.d.mts +12 -0
- package/dist/crypto/password.mjs +36 -0
- package/dist/crypto/password.mjs.map +1 -0
- package/dist/crypto/random.d.mts +5 -0
- package/dist/crypto/random.mjs +8 -0
- package/dist/crypto/random.mjs.map +1 -0
- package/dist/db/adapter-base.d.mts +8 -0
- package/dist/db/adapter-base.mjs +28 -0
- package/dist/db/adapter-base.mjs.map +1 -0
- package/dist/db/adapter-kysely.d.mts +8 -0
- package/dist/db/adapter-kysely.mjs +21 -0
- package/dist/db/adapter-kysely.mjs.map +1 -0
- package/dist/db/field-converter.d.mts +8 -0
- package/dist/db/field-converter.mjs +21 -0
- package/dist/db/field-converter.mjs.map +1 -0
- package/dist/db/field.d.mts +55 -0
- package/dist/db/field.mjs +11 -0
- package/dist/db/field.mjs.map +1 -0
- package/dist/db/get-migration.d.mts +23 -0
- package/dist/db/get-migration.mjs +339 -0
- package/dist/db/get-migration.mjs.map +1 -0
- package/dist/db/get-schema.d.mts +11 -0
- package/dist/db/get-schema.mjs +39 -0
- package/dist/db/get-schema.mjs.map +1 -0
- package/dist/db/index.d.mts +9 -0
- package/dist/db/index.mjs +36 -0
- package/dist/db/index.mjs.map +1 -0
- package/dist/db/internal-adapter.d.mts +14 -0
- package/dist/db/internal-adapter.mjs +616 -0
- package/dist/db/internal-adapter.mjs.map +1 -0
- package/dist/db/schema.d.mts +26 -0
- package/dist/db/schema.mjs +118 -0
- package/dist/db/schema.mjs.map +1 -0
- package/dist/db/to-zod.d.mts +36 -0
- package/dist/db/to-zod.mjs +26 -0
- package/dist/db/to-zod.mjs.map +1 -0
- package/dist/db/verification-token-storage.mjs +28 -0
- package/dist/db/verification-token-storage.mjs.map +1 -0
- package/dist/db/with-hooks.d.mts +33 -0
- package/dist/db/with-hooks.mjs +159 -0
- package/dist/db/with-hooks.mjs.map +1 -0
- package/dist/index.d.mts +52 -0
- package/dist/index.mjs +26 -0
- package/dist/integrations/next-js.d.mts +14 -0
- package/dist/integrations/next-js.mjs +78 -0
- package/dist/integrations/next-js.mjs.map +1 -0
- package/dist/integrations/node.d.mts +13 -0
- package/dist/integrations/node.mjs +16 -0
- package/dist/integrations/node.mjs.map +1 -0
- package/dist/integrations/solid-start.d.mts +23 -0
- package/dist/integrations/solid-start.mjs +17 -0
- package/dist/integrations/solid-start.mjs.map +1 -0
- package/dist/integrations/svelte-kit.d.mts +29 -0
- package/dist/integrations/svelte-kit.mjs +57 -0
- package/dist/integrations/svelte-kit.mjs.map +1 -0
- package/dist/integrations/tanstack-start-solid.d.mts +22 -0
- package/dist/integrations/tanstack-start-solid.mjs +61 -0
- package/dist/integrations/tanstack-start-solid.mjs.map +1 -0
- package/dist/integrations/tanstack-start.d.mts +22 -0
- package/dist/integrations/tanstack-start.mjs +61 -0
- package/dist/integrations/tanstack-start.mjs.map +1 -0
- package/dist/oauth2/index.d.mts +5 -0
- package/dist/oauth2/index.mjs +7 -0
- package/dist/oauth2/link-account.d.mts +31 -0
- package/dist/oauth2/link-account.mjs +144 -0
- package/dist/oauth2/link-account.mjs.map +1 -0
- package/dist/oauth2/state.d.mts +26 -0
- package/dist/oauth2/state.mjs +51 -0
- package/dist/oauth2/state.mjs.map +1 -0
- package/dist/oauth2/utils.d.mts +8 -0
- package/dist/oauth2/utils.mjs +31 -0
- package/dist/oauth2/utils.mjs.map +1 -0
- package/dist/plugins/access/access.d.mts +30 -0
- package/dist/plugins/access/access.mjs +46 -0
- package/dist/plugins/access/access.mjs.map +1 -0
- package/dist/plugins/access/index.d.mts +3 -0
- package/dist/plugins/access/index.mjs +3 -0
- package/dist/plugins/access/types.d.mts +17 -0
- package/dist/plugins/additional-fields/client.d.mts +14 -0
- package/dist/plugins/additional-fields/client.mjs +11 -0
- package/dist/plugins/additional-fields/client.mjs.map +1 -0
- package/dist/plugins/admin/access/index.d.mts +2 -0
- package/dist/plugins/admin/access/index.mjs +3 -0
- package/dist/plugins/admin/access/statement.d.mts +118 -0
- package/dist/plugins/admin/access/statement.mjs +53 -0
- package/dist/plugins/admin/access/statement.mjs.map +1 -0
- package/dist/plugins/admin/admin.d.mts +14 -0
- package/dist/plugins/admin/admin.mjs +95 -0
- package/dist/plugins/admin/admin.mjs.map +1 -0
- package/dist/plugins/admin/client.d.mts +14 -0
- package/dist/plugins/admin/client.mjs +36 -0
- package/dist/plugins/admin/client.mjs.map +1 -0
- package/dist/plugins/admin/error-codes.d.mts +5 -0
- package/dist/plugins/admin/error-codes.mjs +30 -0
- package/dist/plugins/admin/error-codes.mjs.map +1 -0
- package/dist/plugins/admin/has-permission.mjs +16 -0
- package/dist/plugins/admin/has-permission.mjs.map +1 -0
- package/dist/plugins/admin/index.d.mts +3 -0
- package/dist/plugins/admin/index.mjs +3 -0
- package/dist/plugins/admin/routes.mjs +855 -0
- package/dist/plugins/admin/routes.mjs.map +1 -0
- package/dist/plugins/admin/schema.d.mts +6 -0
- package/dist/plugins/admin/schema.mjs +34 -0
- package/dist/plugins/admin/schema.mjs.map +1 -0
- package/dist/plugins/admin/types.d.mts +89 -0
- package/dist/plugins/anonymous/client.d.mts +9 -0
- package/dist/plugins/anonymous/client.mjs +22 -0
- package/dist/plugins/anonymous/client.mjs.map +1 -0
- package/dist/plugins/anonymous/error-codes.d.mts +5 -0
- package/dist/plugins/anonymous/error-codes.mjs +16 -0
- package/dist/plugins/anonymous/error-codes.mjs.map +1 -0
- package/dist/plugins/anonymous/index.d.mts +14 -0
- package/dist/plugins/anonymous/index.mjs +163 -0
- package/dist/plugins/anonymous/index.mjs.map +1 -0
- package/dist/plugins/anonymous/schema.d.mts +5 -0
- package/dist/plugins/anonymous/schema.mjs +11 -0
- package/dist/plugins/anonymous/schema.mjs.map +1 -0
- package/dist/plugins/anonymous/types.d.mts +68 -0
- package/dist/plugins/api-key/adapter.mjs +468 -0
- package/dist/plugins/api-key/adapter.mjs.map +1 -0
- package/dist/plugins/api-key/client.d.mts +9 -0
- package/dist/plugins/api-key/client.mjs +19 -0
- package/dist/plugins/api-key/client.mjs.map +1 -0
- package/dist/plugins/api-key/error-codes.d.mts +5 -0
- package/dist/plugins/api-key/error-codes.mjs +34 -0
- package/dist/plugins/api-key/error-codes.mjs.map +1 -0
- package/dist/plugins/api-key/index.d.mts +17 -0
- package/dist/plugins/api-key/index.mjs +134 -0
- package/dist/plugins/api-key/index.mjs.map +1 -0
- package/dist/plugins/api-key/rate-limit.mjs +74 -0
- package/dist/plugins/api-key/rate-limit.mjs.map +1 -0
- package/dist/plugins/api-key/routes/create-api-key.mjs +252 -0
- package/dist/plugins/api-key/routes/create-api-key.mjs.map +1 -0
- package/dist/plugins/api-key/routes/delete-all-expired-api-keys.mjs +24 -0
- package/dist/plugins/api-key/routes/delete-all-expired-api-keys.mjs.map +1 -0
- package/dist/plugins/api-key/routes/delete-api-key.mjs +74 -0
- package/dist/plugins/api-key/routes/delete-api-key.mjs.map +1 -0
- package/dist/plugins/api-key/routes/get-api-key.mjs +158 -0
- package/dist/plugins/api-key/routes/get-api-key.mjs.map +1 -0
- package/dist/plugins/api-key/routes/index.mjs +71 -0
- package/dist/plugins/api-key/routes/index.mjs.map +1 -0
- package/dist/plugins/api-key/routes/list-api-keys.mjs +194 -0
- package/dist/plugins/api-key/routes/list-api-keys.mjs.map +1 -0
- package/dist/plugins/api-key/routes/update-api-key.mjs +248 -0
- package/dist/plugins/api-key/routes/update-api-key.mjs.map +1 -0
- package/dist/plugins/api-key/routes/verify-api-key.mjs +223 -0
- package/dist/plugins/api-key/routes/verify-api-key.mjs.map +1 -0
- package/dist/plugins/api-key/schema.d.mts +11 -0
- package/dist/plugins/api-key/schema.mjs +130 -0
- package/dist/plugins/api-key/schema.mjs.map +1 -0
- package/dist/plugins/api-key/types.d.mts +346 -0
- package/dist/plugins/bearer/index.d.mts +25 -0
- package/dist/plugins/bearer/index.mjs +66 -0
- package/dist/plugins/bearer/index.mjs.map +1 -0
- package/dist/plugins/captcha/constants.d.mts +10 -0
- package/dist/plugins/captcha/constants.mjs +22 -0
- package/dist/plugins/captcha/constants.mjs.map +1 -0
- package/dist/plugins/captcha/error-codes.mjs +16 -0
- package/dist/plugins/captcha/error-codes.mjs.map +1 -0
- package/dist/plugins/captcha/index.d.mts +14 -0
- package/dist/plugins/captcha/index.mjs +60 -0
- package/dist/plugins/captcha/index.mjs.map +1 -0
- package/dist/plugins/captcha/types.d.mts +28 -0
- package/dist/plugins/captcha/utils.mjs +11 -0
- package/dist/plugins/captcha/utils.mjs.map +1 -0
- package/dist/plugins/captcha/verify-handlers/captchafox.mjs +27 -0
- package/dist/plugins/captcha/verify-handlers/captchafox.mjs.map +1 -0
- package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs +25 -0
- package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.mjs.map +1 -0
- package/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs +29 -0
- package/dist/plugins/captcha/verify-handlers/google-recaptcha.mjs.map +1 -0
- package/dist/plugins/captcha/verify-handlers/h-captcha.mjs +27 -0
- package/dist/plugins/captcha/verify-handlers/h-captcha.mjs.map +1 -0
- package/dist/plugins/captcha/verify-handlers/index.mjs +6 -0
- package/dist/plugins/custom-session/client.d.mts +10 -0
- package/dist/plugins/custom-session/client.mjs +11 -0
- package/dist/plugins/custom-session/client.mjs.map +1 -0
- package/dist/plugins/custom-session/index.d.mts +26 -0
- package/dist/plugins/custom-session/index.mjs +70 -0
- package/dist/plugins/custom-session/index.mjs.map +1 -0
- package/dist/plugins/device-authorization/client.d.mts +5 -0
- package/dist/plugins/device-authorization/client.mjs +18 -0
- package/dist/plugins/device-authorization/client.mjs.map +1 -0
- package/dist/plugins/device-authorization/error-codes.mjs +21 -0
- package/dist/plugins/device-authorization/error-codes.mjs.map +1 -0
- package/dist/plugins/device-authorization/index.d.mts +28 -0
- package/dist/plugins/device-authorization/index.mjs +50 -0
- package/dist/plugins/device-authorization/index.mjs.map +1 -0
- package/dist/plugins/device-authorization/routes.mjs +510 -0
- package/dist/plugins/device-authorization/routes.mjs.map +1 -0
- package/dist/plugins/device-authorization/schema.mjs +57 -0
- package/dist/plugins/device-authorization/schema.mjs.map +1 -0
- package/dist/plugins/email-otp/client.d.mts +7 -0
- package/dist/plugins/email-otp/client.mjs +18 -0
- package/dist/plugins/email-otp/client.mjs.map +1 -0
- package/dist/plugins/email-otp/error-codes.d.mts +5 -0
- package/dist/plugins/email-otp/error-codes.mjs +12 -0
- package/dist/plugins/email-otp/error-codes.mjs.map +1 -0
- package/dist/plugins/email-otp/index.d.mts +14 -0
- package/dist/plugins/email-otp/index.mjs +108 -0
- package/dist/plugins/email-otp/index.mjs.map +1 -0
- package/dist/plugins/email-otp/otp-token.mjs +29 -0
- package/dist/plugins/email-otp/otp-token.mjs.map +1 -0
- package/dist/plugins/email-otp/routes.mjs +564 -0
- package/dist/plugins/email-otp/routes.mjs.map +1 -0
- package/dist/plugins/email-otp/types.d.mts +74 -0
- package/dist/plugins/email-otp/utils.mjs +17 -0
- package/dist/plugins/email-otp/utils.mjs.map +1 -0
- package/dist/plugins/generic-oauth/client.d.mts +19 -0
- package/dist/plugins/generic-oauth/client.mjs +14 -0
- package/dist/plugins/generic-oauth/client.mjs.map +1 -0
- package/dist/plugins/generic-oauth/error-codes.d.mts +5 -0
- package/dist/plugins/generic-oauth/error-codes.mjs +15 -0
- package/dist/plugins/generic-oauth/error-codes.mjs.map +1 -0
- package/dist/plugins/generic-oauth/index.d.mts +34 -0
- package/dist/plugins/generic-oauth/index.mjs +137 -0
- package/dist/plugins/generic-oauth/index.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +37 -0
- package/dist/plugins/generic-oauth/providers/auth0.mjs +62 -0
- package/dist/plugins/generic-oauth/providers/auth0.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +32 -0
- package/dist/plugins/generic-oauth/providers/gumroad.mjs +60 -0
- package/dist/plugins/generic-oauth/providers/gumroad.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +37 -0
- package/dist/plugins/generic-oauth/providers/hubspot.mjs +60 -0
- package/dist/plugins/generic-oauth/providers/hubspot.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/index.d.mts +9 -0
- package/dist/plugins/generic-oauth/providers/index.mjs +11 -0
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +37 -0
- package/dist/plugins/generic-oauth/providers/keycloak.mjs +62 -0
- package/dist/plugins/generic-oauth/providers/keycloak.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/line.d.mts +55 -0
- package/dist/plugins/generic-oauth/providers/line.mjs +91 -0
- package/dist/plugins/generic-oauth/providers/line.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +37 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs +66 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/okta.d.mts +37 -0
- package/dist/plugins/generic-oauth/providers/okta.mjs +62 -0
- package/dist/plugins/generic-oauth/providers/okta.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +30 -0
- package/dist/plugins/generic-oauth/providers/patreon.mjs +59 -0
- package/dist/plugins/generic-oauth/providers/patreon.mjs.map +1 -0
- package/dist/plugins/generic-oauth/providers/slack.d.mts +30 -0
- package/dist/plugins/generic-oauth/providers/slack.mjs +61 -0
- package/dist/plugins/generic-oauth/providers/slack.mjs.map +1 -0
- package/dist/plugins/generic-oauth/routes.mjs +394 -0
- package/dist/plugins/generic-oauth/routes.mjs.map +1 -0
- package/dist/plugins/generic-oauth/types.d.mts +145 -0
- package/dist/plugins/haveibeenpwned/index.d.mts +21 -0
- package/dist/plugins/haveibeenpwned/index.mjs +56 -0
- package/dist/plugins/haveibeenpwned/index.mjs.map +1 -0
- package/dist/plugins/index.d.mts +68 -0
- package/dist/plugins/index.mjs +51 -0
- package/dist/plugins/jwt/adapter.mjs +27 -0
- package/dist/plugins/jwt/adapter.mjs.map +1 -0
- package/dist/plugins/jwt/client.d.mts +18 -0
- package/dist/plugins/jwt/client.mjs +19 -0
- package/dist/plugins/jwt/client.mjs.map +1 -0
- package/dist/plugins/jwt/index.d.mts +17 -0
- package/dist/plugins/jwt/index.mjs +202 -0
- package/dist/plugins/jwt/index.mjs.map +1 -0
- package/dist/plugins/jwt/schema.d.mts +5 -0
- package/dist/plugins/jwt/schema.mjs +23 -0
- package/dist/plugins/jwt/schema.mjs.map +1 -0
- package/dist/plugins/jwt/sign.d.mts +57 -0
- package/dist/plugins/jwt/sign.mjs +66 -0
- package/dist/plugins/jwt/sign.mjs.map +1 -0
- package/dist/plugins/jwt/types.d.mts +194 -0
- package/dist/plugins/jwt/utils.d.mts +42 -0
- package/dist/plugins/jwt/utils.mjs +64 -0
- package/dist/plugins/jwt/utils.mjs.map +1 -0
- package/dist/plugins/jwt/verify.d.mts +12 -0
- package/dist/plugins/jwt/verify.mjs +46 -0
- package/dist/plugins/jwt/verify.mjs.map +1 -0
- package/dist/plugins/last-login-method/client.d.mts +18 -0
- package/dist/plugins/last-login-method/client.mjs +32 -0
- package/dist/plugins/last-login-method/client.mjs.map +1 -0
- package/dist/plugins/last-login-method/index.d.mts +52 -0
- package/dist/plugins/last-login-method/index.mjs +77 -0
- package/dist/plugins/last-login-method/index.mjs.map +1 -0
- package/dist/plugins/magic-link/client.d.mts +5 -0
- package/dist/plugins/magic-link/client.mjs +11 -0
- package/dist/plugins/magic-link/client.mjs.map +1 -0
- package/dist/plugins/magic-link/index.d.mts +61 -0
- package/dist/plugins/magic-link/index.mjs +167 -0
- package/dist/plugins/magic-link/index.mjs.map +1 -0
- package/dist/plugins/magic-link/utils.mjs +12 -0
- package/dist/plugins/magic-link/utils.mjs.map +1 -0
- package/dist/plugins/mcp/authorize.mjs +133 -0
- package/dist/plugins/mcp/authorize.mjs.map +1 -0
- package/dist/plugins/mcp/index.d.mts +46 -0
- package/dist/plugins/mcp/index.mjs +717 -0
- package/dist/plugins/mcp/index.mjs.map +1 -0
- package/dist/plugins/multi-session/client.d.mts +8 -0
- package/dist/plugins/multi-session/client.mjs +20 -0
- package/dist/plugins/multi-session/client.mjs.map +1 -0
- package/dist/plugins/multi-session/error-codes.d.mts +5 -0
- package/dist/plugins/multi-session/error-codes.mjs +8 -0
- package/dist/plugins/multi-session/error-codes.mjs.map +1 -0
- package/dist/plugins/multi-session/index.d.mts +22 -0
- package/dist/plugins/multi-session/index.mjs +172 -0
- package/dist/plugins/multi-session/index.mjs.map +1 -0
- package/dist/plugins/oauth-proxy/index.d.mts +39 -0
- package/dist/plugins/oauth-proxy/index.mjs +305 -0
- package/dist/plugins/oauth-proxy/index.mjs.map +1 -0
- package/dist/plugins/oauth-proxy/utils.mjs +44 -0
- package/dist/plugins/oauth-proxy/utils.mjs.map +1 -0
- package/dist/plugins/oidc-provider/authorize.mjs +194 -0
- package/dist/plugins/oidc-provider/authorize.mjs.map +1 -0
- package/dist/plugins/oidc-provider/client.d.mts +8 -0
- package/dist/plugins/oidc-provider/client.mjs +11 -0
- package/dist/plugins/oidc-provider/client.mjs.map +1 -0
- package/dist/plugins/oidc-provider/error.mjs +17 -0
- package/dist/plugins/oidc-provider/error.mjs.map +1 -0
- package/dist/plugins/oidc-provider/index.d.mts +32 -0
- package/dist/plugins/oidc-provider/index.mjs +1093 -0
- package/dist/plugins/oidc-provider/index.mjs.map +1 -0
- package/dist/plugins/oidc-provider/schema.d.mts +26 -0
- package/dist/plugins/oidc-provider/schema.mjs +132 -0
- package/dist/plugins/oidc-provider/schema.mjs.map +1 -0
- package/dist/plugins/oidc-provider/types.d.mts +517 -0
- package/dist/plugins/oidc-provider/utils/prompt.mjs +19 -0
- package/dist/plugins/oidc-provider/utils/prompt.mjs.map +1 -0
- package/dist/plugins/oidc-provider/utils.mjs +15 -0
- package/dist/plugins/oidc-provider/utils.mjs.map +1 -0
- package/dist/plugins/one-tap/client.d.mts +159 -0
- package/dist/plugins/one-tap/client.mjs +214 -0
- package/dist/plugins/one-tap/client.mjs.map +1 -0
- package/dist/plugins/one-tap/index.d.mts +27 -0
- package/dist/plugins/one-tap/index.mjs +96 -0
- package/dist/plugins/one-tap/index.mjs.map +1 -0
- package/dist/plugins/one-time-token/client.d.mts +7 -0
- package/dist/plugins/one-time-token/client.mjs +11 -0
- package/dist/plugins/one-time-token/client.mjs.map +1 -0
- package/dist/plugins/one-time-token/index.d.mts +53 -0
- package/dist/plugins/one-time-token/index.mjs +82 -0
- package/dist/plugins/one-time-token/index.mjs.map +1 -0
- package/dist/plugins/one-time-token/utils.mjs +12 -0
- package/dist/plugins/one-time-token/utils.mjs.map +1 -0
- package/dist/plugins/open-api/generator.d.mts +115 -0
- package/dist/plugins/open-api/generator.mjs +315 -0
- package/dist/plugins/open-api/generator.mjs.map +1 -0
- package/dist/plugins/open-api/index.d.mts +45 -0
- package/dist/plugins/open-api/index.mjs +67 -0
- package/dist/plugins/open-api/index.mjs.map +1 -0
- package/dist/plugins/open-api/logo.mjs +15 -0
- package/dist/plugins/open-api/logo.mjs.map +1 -0
- package/dist/plugins/organization/access/index.d.mts +2 -0
- package/dist/plugins/organization/access/index.mjs +3 -0
- package/dist/plugins/organization/access/statement.d.mts +249 -0
- package/dist/plugins/organization/access/statement.mjs +81 -0
- package/dist/plugins/organization/access/statement.mjs.map +1 -0
- package/dist/plugins/organization/adapter.d.mts +205 -0
- package/dist/plugins/organization/adapter.mjs +624 -0
- package/dist/plugins/organization/adapter.mjs.map +1 -0
- package/dist/plugins/organization/call.mjs +19 -0
- package/dist/plugins/organization/call.mjs.map +1 -0
- package/dist/plugins/organization/client.d.mts +151 -0
- package/dist/plugins/organization/client.mjs +107 -0
- package/dist/plugins/organization/client.mjs.map +1 -0
- package/dist/plugins/organization/error-codes.d.mts +5 -0
- package/dist/plugins/organization/error-codes.mjs +65 -0
- package/dist/plugins/organization/error-codes.mjs.map +1 -0
- package/dist/plugins/organization/has-permission.mjs +35 -0
- package/dist/plugins/organization/has-permission.mjs.map +1 -0
- package/dist/plugins/organization/index.d.mts +5 -0
- package/dist/plugins/organization/index.mjs +4 -0
- package/dist/plugins/organization/organization.d.mts +252 -0
- package/dist/plugins/organization/organization.mjs +428 -0
- package/dist/plugins/organization/organization.mjs.map +1 -0
- package/dist/plugins/organization/permission.d.mts +26 -0
- package/dist/plugins/organization/permission.mjs +16 -0
- package/dist/plugins/organization/permission.mjs.map +1 -0
- package/dist/plugins/organization/routes/crud-access-control.d.mts +11 -0
- package/dist/plugins/organization/routes/crud-access-control.mjs +656 -0
- package/dist/plugins/organization/routes/crud-access-control.mjs.map +1 -0
- package/dist/plugins/organization/routes/crud-invites.d.mts +16 -0
- package/dist/plugins/organization/routes/crud-invites.mjs +555 -0
- package/dist/plugins/organization/routes/crud-invites.mjs.map +1 -0
- package/dist/plugins/organization/routes/crud-members.d.mts +13 -0
- package/dist/plugins/organization/routes/crud-members.mjs +473 -0
- package/dist/plugins/organization/routes/crud-members.mjs.map +1 -0
- package/dist/plugins/organization/routes/crud-org.d.mts +13 -0
- package/dist/plugins/organization/routes/crud-org.mjs +447 -0
- package/dist/plugins/organization/routes/crud-org.mjs.map +1 -0
- package/dist/plugins/organization/routes/crud-team.d.mts +15 -0
- package/dist/plugins/organization/routes/crud-team.mjs +676 -0
- package/dist/plugins/organization/routes/crud-team.mjs.map +1 -0
- package/dist/plugins/organization/schema.d.mts +376 -0
- package/dist/plugins/organization/schema.mjs +68 -0
- package/dist/plugins/organization/schema.mjs.map +1 -0
- package/dist/plugins/organization/types.d.mts +733 -0
- package/dist/plugins/phone-number/client.d.mts +8 -0
- package/dist/plugins/phone-number/client.mjs +20 -0
- package/dist/plugins/phone-number/client.mjs.map +1 -0
- package/dist/plugins/phone-number/error-codes.d.mts +5 -0
- package/dist/plugins/phone-number/error-codes.mjs +21 -0
- package/dist/plugins/phone-number/error-codes.mjs.map +1 -0
- package/dist/plugins/phone-number/index.d.mts +14 -0
- package/dist/plugins/phone-number/index.mjs +49 -0
- package/dist/plugins/phone-number/index.mjs.map +1 -0
- package/dist/plugins/phone-number/routes.mjs +459 -0
- package/dist/plugins/phone-number/routes.mjs.map +1 -0
- package/dist/plugins/phone-number/schema.d.mts +5 -0
- package/dist/plugins/phone-number/schema.mjs +20 -0
- package/dist/plugins/phone-number/schema.mjs.map +1 -0
- package/dist/plugins/phone-number/types.d.mts +118 -0
- package/dist/plugins/siwe/client.d.mts +5 -0
- package/dist/plugins/siwe/client.mjs +11 -0
- package/dist/plugins/siwe/client.mjs.map +1 -0
- package/dist/plugins/siwe/error-codes.mjs +13 -0
- package/dist/plugins/siwe/error-codes.mjs.map +1 -0
- package/dist/plugins/siwe/index.d.mts +26 -0
- package/dist/plugins/siwe/index.mjs +261 -0
- package/dist/plugins/siwe/index.mjs.map +1 -0
- package/dist/plugins/siwe/schema.d.mts +5 -0
- package/dist/plugins/siwe/schema.mjs +32 -0
- package/dist/plugins/siwe/schema.mjs.map +1 -0
- package/dist/plugins/siwe/types.d.mts +44 -0
- package/dist/plugins/two-factor/backup-codes/index.d.mts +91 -0
- package/dist/plugins/two-factor/backup-codes/index.mjs +277 -0
- package/dist/plugins/two-factor/backup-codes/index.mjs.map +1 -0
- package/dist/plugins/two-factor/client.d.mts +17 -0
- package/dist/plugins/two-factor/client.mjs +37 -0
- package/dist/plugins/two-factor/client.mjs.map +1 -0
- package/dist/plugins/two-factor/constant.mjs +8 -0
- package/dist/plugins/two-factor/constant.mjs.map +1 -0
- package/dist/plugins/two-factor/error-code.d.mts +5 -0
- package/dist/plugins/two-factor/error-code.mjs +18 -0
- package/dist/plugins/two-factor/error-code.mjs.map +1 -0
- package/dist/plugins/two-factor/index.d.mts +19 -0
- package/dist/plugins/two-factor/index.mjs +207 -0
- package/dist/plugins/two-factor/index.mjs.map +1 -0
- package/dist/plugins/two-factor/otp/index.d.mts +96 -0
- package/dist/plugins/two-factor/otp/index.mjs +199 -0
- package/dist/plugins/two-factor/otp/index.mjs.map +1 -0
- package/dist/plugins/two-factor/schema.d.mts +5 -0
- package/dist/plugins/two-factor/schema.mjs +36 -0
- package/dist/plugins/two-factor/schema.mjs.map +1 -0
- package/dist/plugins/two-factor/totp/index.d.mts +81 -0
- package/dist/plugins/two-factor/totp/index.mjs +157 -0
- package/dist/plugins/two-factor/totp/index.mjs.map +1 -0
- package/dist/plugins/two-factor/types.d.mts +65 -0
- package/dist/plugins/two-factor/utils.mjs +12 -0
- package/dist/plugins/two-factor/utils.mjs.map +1 -0
- package/dist/plugins/two-factor/verify-two-factor.mjs +76 -0
- package/dist/plugins/two-factor/verify-two-factor.mjs.map +1 -0
- package/dist/plugins/username/client.d.mts +7 -0
- package/dist/plugins/username/client.mjs +18 -0
- package/dist/plugins/username/client.mjs.map +1 -0
- package/dist/plugins/username/error-codes.d.mts +5 -0
- package/dist/plugins/username/error-codes.mjs +17 -0
- package/dist/plugins/username/error-codes.mjs.map +1 -0
- package/dist/plugins/username/index.d.mts +74 -0
- package/dist/plugins/username/index.mjs +237 -0
- package/dist/plugins/username/index.mjs.map +1 -0
- package/dist/plugins/username/schema.d.mts +9 -0
- package/dist/plugins/username/schema.mjs +26 -0
- package/dist/plugins/username/schema.mjs.map +1 -0
- package/dist/social-providers/index.d.mts +1 -0
- package/dist/social-providers/index.mjs +3 -0
- package/dist/state.d.mts +42 -0
- package/dist/state.mjs +107 -0
- package/dist/state.mjs.map +1 -0
- package/dist/test-utils/headers.d.mts +9 -0
- package/dist/test-utils/headers.mjs +24 -0
- package/dist/test-utils/headers.mjs.map +1 -0
- package/dist/test-utils/index.d.mts +3 -0
- package/dist/test-utils/index.mjs +4 -0
- package/dist/test-utils/test-instance.d.mts +181 -0
- package/dist/test-utils/test-instance.mjs +210 -0
- package/dist/test-utils/test-instance.mjs.map +1 -0
- package/dist/types/adapter.d.mts +24 -0
- package/dist/types/api.d.mts +62 -0
- package/dist/types/auth.d.mts +30 -0
- package/dist/types/helper.d.mts +21 -0
- package/dist/types/index.d.mts +11 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/models.d.mts +17 -0
- package/dist/types/plugins.d.mts +16 -0
- package/dist/utils/boolean.mjs +8 -0
- package/dist/utils/boolean.mjs.map +1 -0
- package/dist/utils/constants.mjs +6 -0
- package/dist/utils/constants.mjs.map +1 -0
- package/dist/utils/date.mjs +8 -0
- package/dist/utils/date.mjs.map +1 -0
- package/dist/utils/get-request-ip.d.mts +7 -0
- package/dist/utils/get-request-ip.mjs +23 -0
- package/dist/utils/get-request-ip.mjs.map +1 -0
- package/dist/utils/hashing.mjs +21 -0
- package/dist/utils/hashing.mjs.map +1 -0
- package/dist/utils/hide-metadata.d.mts +7 -0
- package/dist/utils/hide-metadata.mjs +6 -0
- package/dist/utils/hide-metadata.mjs.map +1 -0
- package/dist/utils/index.d.mts +3 -0
- package/dist/utils/index.mjs +5 -0
- package/dist/utils/is-api-error.d.mts +7 -0
- package/dist/utils/is-api-error.mjs +11 -0
- package/dist/utils/is-api-error.mjs.map +1 -0
- package/dist/utils/is-atom.mjs +8 -0
- package/dist/utils/is-atom.mjs.map +1 -0
- package/dist/utils/is-promise.mjs +8 -0
- package/dist/utils/is-promise.mjs.map +1 -0
- package/dist/utils/middleware-response.mjs +6 -0
- package/dist/utils/middleware-response.mjs.map +1 -0
- package/dist/utils/password.mjs +26 -0
- package/dist/utils/password.mjs.map +1 -0
- package/dist/utils/plugin-helper.mjs +17 -0
- package/dist/utils/plugin-helper.mjs.map +1 -0
- package/dist/utils/shim.mjs +24 -0
- package/dist/utils/shim.mjs.map +1 -0
- package/dist/utils/time.d.mts +49 -0
- package/dist/utils/time.mjs +100 -0
- package/dist/utils/time.mjs.map +1 -0
- package/dist/utils/url.mjs +92 -0
- package/dist/utils/url.mjs.map +1 -0
- package/dist/utils/wildcard.mjs +108 -0
- package/dist/utils/wildcard.mjs.map +1 -0
- package/package.json +601 -0
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
import { User } from "../../types/models.mjs";
|
|
2
|
+
import { InferOptionSchema } from "../../types/plugins.mjs";
|
|
3
|
+
import "../../types/index.mjs";
|
|
4
|
+
import { OAuthApplication, schema } from "./schema.mjs";
|
|
5
|
+
|
|
6
|
+
//#region src/plugins/oidc-provider/types.d.ts
|
|
7
|
+
interface OIDCOptions {
|
|
8
|
+
/**
|
|
9
|
+
* The amount of time in seconds that the access token is valid for.
|
|
10
|
+
*
|
|
11
|
+
* @default 3600 (1 hour) - Recommended by the OIDC spec
|
|
12
|
+
*/
|
|
13
|
+
accessTokenExpiresIn?: number | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Allow dynamic client registration.
|
|
16
|
+
*/
|
|
17
|
+
allowDynamicClientRegistration?: boolean | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The metadata for the OpenID Connect provider.
|
|
20
|
+
*/
|
|
21
|
+
metadata?: Partial<OIDCMetadata> | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* The amount of time in seconds that the refresh token is valid for.
|
|
24
|
+
*
|
|
25
|
+
* @default 604800 (7 days) - Recommended by the OIDC spec
|
|
26
|
+
*/
|
|
27
|
+
refreshTokenExpiresIn?: number | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* The amount of time in seconds that the authorization code is valid for.
|
|
30
|
+
*
|
|
31
|
+
* @default 600 (10 minutes) - Recommended by the OIDC spec
|
|
32
|
+
*/
|
|
33
|
+
codeExpiresIn?: number | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* The scopes that the client is allowed to request.
|
|
36
|
+
*
|
|
37
|
+
* @see https://openid.net/specs/openid-connect-core-1_0.html#ScopeClaims
|
|
38
|
+
* @default
|
|
39
|
+
* ```ts
|
|
40
|
+
* ["openid", "profile", "email", "offline_access"]
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
scopes?: string[] | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* The default scope to use if the client does not provide one.
|
|
46
|
+
*
|
|
47
|
+
* @default "openid"
|
|
48
|
+
*/
|
|
49
|
+
defaultScope?: string | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* A URL to the consent page where the user will be redirected if the client
|
|
52
|
+
* requests consent.
|
|
53
|
+
*
|
|
54
|
+
* After the user consents, they should be redirected by the client to the
|
|
55
|
+
* `redirect_uri` with the authorization code.
|
|
56
|
+
*
|
|
57
|
+
* When the server redirects the user to the consent page, it will include the
|
|
58
|
+
* following query parameters:
|
|
59
|
+
* - `consent_code` - The consent code to identify the authorization request.
|
|
60
|
+
* - `client_id` - The ID of the client.
|
|
61
|
+
* - `scope` - The requested scopes.
|
|
62
|
+
*
|
|
63
|
+
* Once the user consents, you need to call the `/oauth2/consent` endpoint
|
|
64
|
+
* with `accept: true` and optionally the `consent_code` (if using URL parameter flow)
|
|
65
|
+
* to complete the authorization. This will return the client to the `redirect_uri`
|
|
66
|
+
* with the authorization code.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* consentPage: "/oauth/authorize"
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
consentPage?: string | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* The HTML for the consent page. This is used if `consentPage` is not
|
|
76
|
+
* provided. This should be a function that returns an HTML string.
|
|
77
|
+
* The function will be called with the following props:
|
|
78
|
+
*/
|
|
79
|
+
getConsentHTML?: ((props: {
|
|
80
|
+
clientId: string;
|
|
81
|
+
clientName: string;
|
|
82
|
+
clientIcon?: string | undefined;
|
|
83
|
+
clientMetadata: Record<string, any> | null;
|
|
84
|
+
code: string;
|
|
85
|
+
scopes: string[];
|
|
86
|
+
}) => string) | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* The URL to the login page. This is used if the client requests the `login`
|
|
89
|
+
* prompt.
|
|
90
|
+
*/
|
|
91
|
+
loginPage: string;
|
|
92
|
+
/**
|
|
93
|
+
* Whether to require PKCE (proof key code exchange) or not
|
|
94
|
+
*
|
|
95
|
+
* According to OAuth2.1 spec this should be required. But in any
|
|
96
|
+
* case if you want to disable this you can use this options.
|
|
97
|
+
*
|
|
98
|
+
* @default true
|
|
99
|
+
*/
|
|
100
|
+
requirePKCE?: boolean | undefined;
|
|
101
|
+
/**
|
|
102
|
+
* Allow plain to be used as a code challenge method.
|
|
103
|
+
*
|
|
104
|
+
* @default true
|
|
105
|
+
*/
|
|
106
|
+
allowPlainCodeChallengeMethod?: boolean | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Custom function to generate a client ID.
|
|
109
|
+
*/
|
|
110
|
+
generateClientId?: (() => string) | undefined;
|
|
111
|
+
/**
|
|
112
|
+
* Custom function to generate a client secret.
|
|
113
|
+
*/
|
|
114
|
+
generateClientSecret?: (() => string) | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* Get the additional user info claims
|
|
117
|
+
*
|
|
118
|
+
* This applies to the `userinfo` endpoint and the `id_token`.
|
|
119
|
+
*
|
|
120
|
+
* @param user - The user object.
|
|
121
|
+
* @param scopes - The scopes that the client requested.
|
|
122
|
+
* @param client - The client object.
|
|
123
|
+
* @returns The user info claim.
|
|
124
|
+
*/
|
|
125
|
+
getAdditionalUserInfoClaim?: ((user: User & Record<string, any>, scopes: string[], client: Client) => Record<string, any> | Promise<Record<string, any>>) | undefined;
|
|
126
|
+
/**
|
|
127
|
+
* Trusted clients that are configured directly in the provider options.
|
|
128
|
+
* These clients bypass database lookups and can optionally skip consent screens.
|
|
129
|
+
*/
|
|
130
|
+
trustedClients?: Client[] | undefined;
|
|
131
|
+
/**
|
|
132
|
+
* Store the client secret in your database in a secure way
|
|
133
|
+
* Note: This will not affect the client secret sent to the user, it will only affect the client secret stored in your database
|
|
134
|
+
*
|
|
135
|
+
* - "hashed" - The client secret is hashed using the `hash` function.
|
|
136
|
+
* - "plain" - The client secret is stored in the database in plain text.
|
|
137
|
+
* - "encrypted" - The client secret is encrypted using the `encrypt` function.
|
|
138
|
+
* - { hash: (clientSecret: string) => Promise<string> } - A function that hashes the client secret.
|
|
139
|
+
* - { encrypt: (clientSecret: string) => Promise<string>, decrypt: (clientSecret: string) => Promise<string> } - A function that encrypts and decrypts the client secret.
|
|
140
|
+
*
|
|
141
|
+
* @default "plain"
|
|
142
|
+
*/
|
|
143
|
+
storeClientSecret?: ("hashed" | "plain" | "encrypted" | {
|
|
144
|
+
hash: (clientSecret: string) => Promise<string>;
|
|
145
|
+
} | {
|
|
146
|
+
encrypt: (clientSecret: string) => Promise<string>;
|
|
147
|
+
decrypt: (clientSecret: string) => Promise<string>;
|
|
148
|
+
}) | undefined;
|
|
149
|
+
/**
|
|
150
|
+
* Whether to use the JWT plugin to sign the ID token.
|
|
151
|
+
*
|
|
152
|
+
* @default false
|
|
153
|
+
*/
|
|
154
|
+
useJWTPlugin?: boolean | undefined;
|
|
155
|
+
/**
|
|
156
|
+
* Custom schema for the OIDC plugin
|
|
157
|
+
*/
|
|
158
|
+
schema?: InferOptionSchema<typeof schema> | undefined;
|
|
159
|
+
}
|
|
160
|
+
interface AuthorizationQuery {
|
|
161
|
+
/**
|
|
162
|
+
* The response type. Must be 'code' or 'token'. Code is for authorization code flow, token is
|
|
163
|
+
* for implicit flow.
|
|
164
|
+
*/
|
|
165
|
+
response_type: "code" | "token";
|
|
166
|
+
/**
|
|
167
|
+
* The redirect URI for the client. Must be one of the registered redirect URLs for the client.
|
|
168
|
+
*/
|
|
169
|
+
redirect_uri?: string | undefined;
|
|
170
|
+
/**
|
|
171
|
+
* The scope of the request. Must be a space-separated list of case sensitive strings.
|
|
172
|
+
*
|
|
173
|
+
* - "openid" is required for all requests
|
|
174
|
+
* - "profile" is required for requests that require user profile information.
|
|
175
|
+
* - "email" is required for requests that require user email information.
|
|
176
|
+
* - "offline_access" is required for requests that require a refresh token.
|
|
177
|
+
*/
|
|
178
|
+
scope?: string | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* Opaque value used to maintain state between the request and the callback. Typically,
|
|
181
|
+
* Cross-Site Request Forgery (CSRF, XSRF) mitigation is done by cryptographically binding the
|
|
182
|
+
* value of this parameter with a browser cookie.
|
|
183
|
+
*
|
|
184
|
+
* Note: Better Auth stores the state in a database instead of a cookie. - This is to minimize
|
|
185
|
+
* the complication with native apps and other clients that may not have access to cookies.
|
|
186
|
+
*/
|
|
187
|
+
state: string;
|
|
188
|
+
/**
|
|
189
|
+
* The client ID. Must be the ID of a registered client.
|
|
190
|
+
*/
|
|
191
|
+
client_id: string;
|
|
192
|
+
/**
|
|
193
|
+
* The prompt parameter is used to specify the type of user interaction that is required.
|
|
194
|
+
*/
|
|
195
|
+
prompt?: (string & {}) | ("none" | "consent" | "login" | "select_account") | undefined;
|
|
196
|
+
/**
|
|
197
|
+
* The display parameter is used to specify how the authorization server displays the
|
|
198
|
+
* authentication and consent user interface pages to the end user.
|
|
199
|
+
*/
|
|
200
|
+
display?: ("page" | "popup" | "touch" | "wap") | undefined;
|
|
201
|
+
/**
|
|
202
|
+
* End-User's preferred languages and scripts for the user interface, represented as a
|
|
203
|
+
* space-separated list of BCP47 [RFC5646] language tag values, ordered by preference. For
|
|
204
|
+
* instance, the value "fr-CA fr en" represents a preference for French as spoken in Canada,
|
|
205
|
+
* then French (without a region designation), followed by English (without a region
|
|
206
|
+
* designation).
|
|
207
|
+
*
|
|
208
|
+
* Better Auth does not support this parameter yet. It'll not throw an error if it's provided,
|
|
209
|
+
*
|
|
210
|
+
* 🏗️ currently not implemented
|
|
211
|
+
*/
|
|
212
|
+
ui_locales?: string | undefined;
|
|
213
|
+
/**
|
|
214
|
+
* The maximum authentication age.
|
|
215
|
+
*
|
|
216
|
+
* Specifies the allowable elapsed time in seconds since the last time the End-User was
|
|
217
|
+
* actively authenticated by the provider. If the elapsed time is greater than this value, the
|
|
218
|
+
* provider MUST attempt to actively re-authenticate the End-User.
|
|
219
|
+
*
|
|
220
|
+
* Note that max_age=0 is equivalent to prompt=login.
|
|
221
|
+
*/
|
|
222
|
+
max_age?: number | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* Requested Authentication Context Class Reference values.
|
|
225
|
+
*
|
|
226
|
+
* Space-separated string that
|
|
227
|
+
* specifies the acr values that the Authorization Server is being requested to use for
|
|
228
|
+
* processing this Authentication Request, with the values appearing in order of preference.
|
|
229
|
+
* The Authentication Context Class satisfied by the authentication performed is returned as
|
|
230
|
+
* the acr Claim Value, as specified in Section 2. The acr Claim is requested as a Voluntary
|
|
231
|
+
* Claim by this parameter.
|
|
232
|
+
*/
|
|
233
|
+
acr_values?: string | undefined;
|
|
234
|
+
/**
|
|
235
|
+
* Hint to the Authorization Server about the login identifier the End-User might use to log in
|
|
236
|
+
* (if necessary). This hint can be used by an RP if it first asks the End-User for their
|
|
237
|
+
* e-mail address (or other identifier) and then wants to pass that value as a hint to the
|
|
238
|
+
* discovered authorization service. It is RECOMMENDED that the hint value match the value used
|
|
239
|
+
* for discovery. This value MAY also be a phone number in the format specified for the
|
|
240
|
+
* phone_number Claim. The use of this parameter is left to the OP's discretion.
|
|
241
|
+
*/
|
|
242
|
+
login_hint?: string | undefined;
|
|
243
|
+
/**
|
|
244
|
+
* ID Token previously issued by the Authorization Server being passed as a hint about the
|
|
245
|
+
* End-User's current or past authenticated session with the Client.
|
|
246
|
+
*
|
|
247
|
+
* 🏗️ currently not implemented
|
|
248
|
+
*/
|
|
249
|
+
id_token_hint?: string | undefined;
|
|
250
|
+
/**
|
|
251
|
+
* Code challenge
|
|
252
|
+
*/
|
|
253
|
+
code_challenge?: string | undefined;
|
|
254
|
+
/**
|
|
255
|
+
* Code challenge method used
|
|
256
|
+
*/
|
|
257
|
+
code_challenge_method?: ("plain" | "s256") | undefined;
|
|
258
|
+
/**
|
|
259
|
+
* String value used to associate a Client session with an ID Token, and to mitigate replay
|
|
260
|
+
* attacks. The value is passed through unmodified from the Authentication Request to the ID Token.
|
|
261
|
+
* If present in the ID Token, Clients MUST verify that the nonce Claim Value is equal to the
|
|
262
|
+
* value of the nonce parameter sent in the Authentication Request. If present in the
|
|
263
|
+
* Authentication Request, Authorization Servers MUST include a nonce Claim in the ID Token
|
|
264
|
+
* with the Claim Value being the nonce value sent in the Authentication Request.
|
|
265
|
+
*/
|
|
266
|
+
nonce?: string | undefined;
|
|
267
|
+
}
|
|
268
|
+
type Client = Omit<OAuthApplication, "metadata" | "updatedAt" | "createdAt" | "redirectUrls" | "userId"> & {
|
|
269
|
+
metadata: Record<string, any> | null;
|
|
270
|
+
/**
|
|
271
|
+
* List of registered redirect URLs. Must include the whole URL, including the protocol, port,
|
|
272
|
+
* and path.
|
|
273
|
+
*
|
|
274
|
+
* For example, `https://example.com/auth/callback`
|
|
275
|
+
*/
|
|
276
|
+
redirectUrls: string[];
|
|
277
|
+
/**
|
|
278
|
+
* Whether to skip the consent screen for this client.
|
|
279
|
+
* Only applies to trusted clients.
|
|
280
|
+
*/
|
|
281
|
+
skipConsent?: boolean | undefined;
|
|
282
|
+
};
|
|
283
|
+
interface TokenBody {
|
|
284
|
+
/**
|
|
285
|
+
* The grant type. Must be 'authorization_code' or 'refresh_token'.
|
|
286
|
+
*/
|
|
287
|
+
grant_type: "authorization_code" | "refresh_token";
|
|
288
|
+
/**
|
|
289
|
+
* The authorization code received from the authorization server.
|
|
290
|
+
*/
|
|
291
|
+
code?: string | undefined;
|
|
292
|
+
/**
|
|
293
|
+
* The redirect URI of the client.
|
|
294
|
+
*/
|
|
295
|
+
redirect_uri?: string | undefined;
|
|
296
|
+
/**
|
|
297
|
+
* The client ID.
|
|
298
|
+
*/
|
|
299
|
+
client_id?: string | undefined;
|
|
300
|
+
/**
|
|
301
|
+
* The client secret.
|
|
302
|
+
*/
|
|
303
|
+
client_secret?: string | undefined;
|
|
304
|
+
/**
|
|
305
|
+
* The refresh token received from the authorization server.
|
|
306
|
+
*/
|
|
307
|
+
refresh_token?: string | undefined;
|
|
308
|
+
}
|
|
309
|
+
interface CodeVerificationValue {
|
|
310
|
+
/**
|
|
311
|
+
* The client ID
|
|
312
|
+
*/
|
|
313
|
+
clientId: string;
|
|
314
|
+
/**
|
|
315
|
+
* The redirect URI for the client
|
|
316
|
+
*/
|
|
317
|
+
redirectURI: string;
|
|
318
|
+
/**
|
|
319
|
+
* The scopes that the client requested
|
|
320
|
+
*/
|
|
321
|
+
scope: string[];
|
|
322
|
+
/**
|
|
323
|
+
* The user ID
|
|
324
|
+
*/
|
|
325
|
+
userId: string;
|
|
326
|
+
/**
|
|
327
|
+
* The time that the user authenticated
|
|
328
|
+
*/
|
|
329
|
+
authTime: number;
|
|
330
|
+
/**
|
|
331
|
+
* Whether the user needs to consent to the scopes
|
|
332
|
+
* before the code can be exchanged for an access token.
|
|
333
|
+
*
|
|
334
|
+
* If this is true, then the code is treated as a consent
|
|
335
|
+
* request. Once the user consents, the code will be updated
|
|
336
|
+
* with the actual code.
|
|
337
|
+
*/
|
|
338
|
+
requireConsent: boolean;
|
|
339
|
+
/**
|
|
340
|
+
* The state parameter from the request
|
|
341
|
+
*
|
|
342
|
+
* If the prompt is set to `consent`, then the state
|
|
343
|
+
* parameter is saved here. This is to prevent the client
|
|
344
|
+
* from using the code before the user consents.
|
|
345
|
+
*/
|
|
346
|
+
state: string | null;
|
|
347
|
+
/**
|
|
348
|
+
* Code challenge
|
|
349
|
+
*/
|
|
350
|
+
codeChallenge?: string | undefined;
|
|
351
|
+
/**
|
|
352
|
+
* Code Challenge Method
|
|
353
|
+
*/
|
|
354
|
+
codeChallengeMethod?: ("sha256" | "plain") | undefined;
|
|
355
|
+
/**
|
|
356
|
+
* Nonce
|
|
357
|
+
*/
|
|
358
|
+
nonce?: string | undefined;
|
|
359
|
+
}
|
|
360
|
+
interface OAuthAccessToken {
|
|
361
|
+
/**
|
|
362
|
+
* The access token
|
|
363
|
+
*/
|
|
364
|
+
accessToken: string;
|
|
365
|
+
/**
|
|
366
|
+
* The refresh token
|
|
367
|
+
*/
|
|
368
|
+
refreshToken: string;
|
|
369
|
+
/**
|
|
370
|
+
* The time that the access token expires
|
|
371
|
+
*/
|
|
372
|
+
accessTokenExpiresAt: Date;
|
|
373
|
+
/**
|
|
374
|
+
* The time that the refresh token expires
|
|
375
|
+
*/
|
|
376
|
+
refreshTokenExpiresAt: Date;
|
|
377
|
+
/**
|
|
378
|
+
* The client ID
|
|
379
|
+
*/
|
|
380
|
+
clientId: string;
|
|
381
|
+
/**
|
|
382
|
+
* The user ID
|
|
383
|
+
*/
|
|
384
|
+
userId: string;
|
|
385
|
+
/**
|
|
386
|
+
* The scopes that the access token has access to
|
|
387
|
+
*/
|
|
388
|
+
scopes: string;
|
|
389
|
+
}
|
|
390
|
+
interface OIDCMetadata {
|
|
391
|
+
/**
|
|
392
|
+
* The issuer identifier, this is the URL of the provider and can be used to verify
|
|
393
|
+
* the `iss` claim in the ID token.
|
|
394
|
+
*
|
|
395
|
+
* default: the base URL of the server (e.g. `https://example.com`)
|
|
396
|
+
*/
|
|
397
|
+
issuer: string;
|
|
398
|
+
/**
|
|
399
|
+
* The URL of the authorization endpoint.
|
|
400
|
+
*
|
|
401
|
+
* @default `/oauth2/authorize`
|
|
402
|
+
*/
|
|
403
|
+
authorization_endpoint: string;
|
|
404
|
+
/**
|
|
405
|
+
* The URL of the token endpoint.
|
|
406
|
+
*
|
|
407
|
+
* @default `/oauth2/token`
|
|
408
|
+
*/
|
|
409
|
+
token_endpoint: string;
|
|
410
|
+
/**
|
|
411
|
+
* The URL of the userinfo endpoint.
|
|
412
|
+
*
|
|
413
|
+
* @default `/oauth2/userinfo`
|
|
414
|
+
*/
|
|
415
|
+
userinfo_endpoint: string;
|
|
416
|
+
/**
|
|
417
|
+
* The URL of the jwks_uri endpoint.
|
|
418
|
+
*
|
|
419
|
+
* For JWKS to work, you must install the `jwt` plugin.
|
|
420
|
+
*
|
|
421
|
+
* This value is automatically set to `/jwks` if the `jwt` plugin is installed.
|
|
422
|
+
*
|
|
423
|
+
* @default `/jwks`
|
|
424
|
+
*/
|
|
425
|
+
jwks_uri: string;
|
|
426
|
+
/**
|
|
427
|
+
* The URL of the dynamic client registration endpoint.
|
|
428
|
+
*
|
|
429
|
+
* @default `/oauth2/register`
|
|
430
|
+
*/
|
|
431
|
+
registration_endpoint: string;
|
|
432
|
+
/**
|
|
433
|
+
* Supported scopes.
|
|
434
|
+
*/
|
|
435
|
+
scopes_supported: string[];
|
|
436
|
+
/**
|
|
437
|
+
* Supported response types.
|
|
438
|
+
*
|
|
439
|
+
* only `code` is supported.
|
|
440
|
+
*/
|
|
441
|
+
response_types_supported: ["code"];
|
|
442
|
+
/**
|
|
443
|
+
* Supported response modes.
|
|
444
|
+
*
|
|
445
|
+
* `query`: the authorization code is returned in the query string
|
|
446
|
+
*
|
|
447
|
+
* only `query` is supported.
|
|
448
|
+
*/
|
|
449
|
+
response_modes_supported: ["query"];
|
|
450
|
+
/**
|
|
451
|
+
* Supported grant types.
|
|
452
|
+
*
|
|
453
|
+
* The first element MUST be "authorization_code"; additional grant types like
|
|
454
|
+
* "refresh_token" can follow. Guarantees a non-empty array at the type level.
|
|
455
|
+
*/
|
|
456
|
+
grant_types_supported: ["authorization_code", ...("authorization_code" | "refresh_token")[]];
|
|
457
|
+
/**
|
|
458
|
+
* acr_values supported.
|
|
459
|
+
*
|
|
460
|
+
* - `urn:mace:incommon:iap:silver`: Silver level of assurance
|
|
461
|
+
* - `urn:mace:incommon:iap:bronze`: Bronze level of assurance
|
|
462
|
+
*
|
|
463
|
+
* only `urn:mace:incommon:iap:silver` and `urn:mace:incommon:iap:bronze` are supported.
|
|
464
|
+
*
|
|
465
|
+
*
|
|
466
|
+
* @default
|
|
467
|
+
* ["urn:mace:incommon:iap:silver", "urn:mace:incommon:iap:bronze"]
|
|
468
|
+
* @see https://incommon.org/federation/attributes.html
|
|
469
|
+
*/
|
|
470
|
+
acr_values_supported: string[];
|
|
471
|
+
/**
|
|
472
|
+
* Supported subject types.
|
|
473
|
+
*
|
|
474
|
+
* pairwise: the subject identifier is unique to the client
|
|
475
|
+
* public: the subject identifier is unique to the server
|
|
476
|
+
*
|
|
477
|
+
* only `public` is supported.
|
|
478
|
+
*/
|
|
479
|
+
subject_types_supported: ["public"];
|
|
480
|
+
/**
|
|
481
|
+
* Supported ID token signing algorithms.
|
|
482
|
+
*/
|
|
483
|
+
id_token_signing_alg_values_supported: string[];
|
|
484
|
+
/**
|
|
485
|
+
* Supported token endpoint authentication methods.
|
|
486
|
+
*
|
|
487
|
+
* only `client_secret_basic` and `client_secret_post` are supported.
|
|
488
|
+
*
|
|
489
|
+
* @default
|
|
490
|
+
* ["client_secret_basic", "client_secret_post"]
|
|
491
|
+
*/
|
|
492
|
+
token_endpoint_auth_methods_supported: ["client_secret_basic", "client_secret_post", "none"];
|
|
493
|
+
/**
|
|
494
|
+
* Supported claims.
|
|
495
|
+
*
|
|
496
|
+
* @default
|
|
497
|
+
* ["sub", "iss", "aud", "exp", "nbf", "iat", "jti", "email", "email_verified", "name"]
|
|
498
|
+
*/
|
|
499
|
+
claims_supported: string[];
|
|
500
|
+
/**
|
|
501
|
+
* Supported code challenge methods.
|
|
502
|
+
*
|
|
503
|
+
* only `S256` is supported.
|
|
504
|
+
*
|
|
505
|
+
* @default ["S256"]
|
|
506
|
+
*/
|
|
507
|
+
code_challenge_methods_supported: ["S256"];
|
|
508
|
+
/**
|
|
509
|
+
* The URL of the RP-initiated logout endpoint.
|
|
510
|
+
*
|
|
511
|
+
* @default `/oauth2/endsession`
|
|
512
|
+
*/
|
|
513
|
+
end_session_endpoint?: string;
|
|
514
|
+
}
|
|
515
|
+
//#endregion
|
|
516
|
+
export { AuthorizationQuery, Client, CodeVerificationValue, OAuthAccessToken, OIDCMetadata, OIDCOptions, TokenBody };
|
|
517
|
+
//# sourceMappingURL=types.d.mts.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { InvalidRequest } from "../error.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/plugins/oidc-provider/utils/prompt.ts
|
|
4
|
+
/**
|
|
5
|
+
* Parse space-separated prompt string into a set of prompts
|
|
6
|
+
*
|
|
7
|
+
* @param prompt
|
|
8
|
+
*/
|
|
9
|
+
function parsePrompt(prompt) {
|
|
10
|
+
const prompts = prompt.split(" ").map((p) => p.trim());
|
|
11
|
+
const set = /* @__PURE__ */ new Set();
|
|
12
|
+
for (const p of prompts) if (p === "login" || p === "consent" || p === "select_account" || p === "none") set.add(p);
|
|
13
|
+
if (set.has("none") && set.size > 1) throw new InvalidRequest("prompt none must only be used alone");
|
|
14
|
+
return new Set(set);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { parsePrompt };
|
|
19
|
+
//# sourceMappingURL=prompt.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.mjs","names":[],"sources":["../../../../src/plugins/oidc-provider/utils/prompt.ts"],"sourcesContent":["import { InvalidRequest } from \"../error\";\n\nexport type AuthorizePrompt = \"login\" | \"consent\" | \"select_account\" | \"none\";\nexport type AuthorizePromptSet = ReadonlySet<AuthorizePrompt>;\n\n/**\n * Parse space-separated prompt string into a set of prompts\n *\n * @param prompt\n */\nexport function parsePrompt(prompt: string) {\n\tconst prompts = prompt.split(\" \").map((p) => p.trim());\n\tconst set = new Set<AuthorizePrompt>();\n\tfor (const p of prompts) {\n\t\tif (\n\t\t\tp === \"login\" ||\n\t\t\tp === \"consent\" ||\n\t\t\tp === \"select_account\" ||\n\t\t\tp === \"none\"\n\t\t) {\n\t\t\tset.add(p);\n\t\t}\n\t}\n\n\tif (set.has(\"none\") && set.size > 1) {\n\t\tthrow new InvalidRequest(\"prompt none must only be used alone\");\n\t}\n\n\treturn new Set(set) as AuthorizePromptSet;\n}\n"],"mappings":";;;;;;;;AAUA,SAAgB,YAAY,QAAgB;CAC3C,MAAM,UAAU,OAAO,MAAM,IAAI,CAAC,KAAK,MAAM,EAAE,MAAM,CAAC;CACtD,MAAM,sBAAM,IAAI,KAAsB;AACtC,MAAK,MAAM,KAAK,QACf,KACC,MAAM,WACN,MAAM,aACN,MAAM,oBACN,MAAM,OAEN,KAAI,IAAI,EAAE;AAIZ,KAAI,IAAI,IAAI,OAAO,IAAI,IAAI,OAAO,EACjC,OAAM,IAAI,eAAe,sCAAsC;AAGhE,QAAO,IAAI,IAAI,IAAI"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createHash } from "@better-auth/utils/hash";
|
|
2
|
+
import { base64Url } from "@better-auth/utils/base64";
|
|
3
|
+
|
|
4
|
+
//#region src/plugins/oidc-provider/utils.ts
|
|
5
|
+
/**
|
|
6
|
+
* Default client secret hasher using SHA-256
|
|
7
|
+
*/
|
|
8
|
+
const defaultClientSecretHasher = async (clientSecret) => {
|
|
9
|
+
const hash = await createHash("SHA-256").digest(new TextEncoder().encode(clientSecret));
|
|
10
|
+
return base64Url.encode(new Uint8Array(hash), { padding: false });
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
export { defaultClientSecretHasher };
|
|
15
|
+
//# sourceMappingURL=utils.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../src/plugins/oidc-provider/utils.ts"],"sourcesContent":["import { base64Url } from \"@better-auth/utils/base64\";\nimport { createHash } from \"@better-auth/utils/hash\";\n\n/**\n * Default client secret hasher using SHA-256\n */\nexport const defaultClientSecretHasher = async (clientSecret: string) => {\n\tconst hash = await createHash(\"SHA-256\").digest(\n\t\tnew TextEncoder().encode(clientSecret),\n\t);\n\tconst hashed = base64Url.encode(new Uint8Array(hash), {\n\t\tpadding: false,\n\t});\n\treturn hashed;\n};\n"],"mappings":";;;;;;;AAMA,MAAa,4BAA4B,OAAO,iBAAyB;CACxE,MAAM,OAAO,MAAM,WAAW,UAAU,CAAC,OACxC,IAAI,aAAa,CAAC,OAAO,aAAa,CACtC;AAID,QAHe,UAAU,OAAO,IAAI,WAAW,KAAK,EAAE,EACrD,SAAS,OACT,CAAC"}
|