better-auth 1.2.0-beta.16 → 1.2.0-beta.19
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/adapters/drizzle-adapter/drizzle-adapter.d.ts +67 -0
- package/dist/adapters/drizzle-adapter/drizzle-adapter.d.ts.map +1 -0
- package/dist/adapters/drizzle-adapter/index.cjs +285 -0
- package/dist/adapters/drizzle-adapter/index.d.ts +2 -0
- package/dist/adapters/drizzle-adapter/index.d.ts.map +1 -0
- package/dist/adapters/drizzle-adapter/index.mjs +283 -0
- package/dist/adapters/kysely-adapter/dialect.d.ts +8 -0
- package/dist/adapters/kysely-adapter/dialect.d.ts.map +1 -0
- package/dist/adapters/kysely-adapter/index.cjs +29 -0
- package/dist/adapters/kysely-adapter/index.d.ts +4 -0
- package/dist/adapters/kysely-adapter/index.d.ts.map +1 -0
- package/dist/adapters/kysely-adapter/index.mjs +22 -0
- package/dist/adapters/kysely-adapter/kysely-adapter.d.ts +57 -0
- package/dist/adapters/kysely-adapter/kysely-adapter.d.ts.map +1 -0
- package/dist/adapters/kysely-adapter/types.d.ts +2 -0
- package/dist/adapters/kysely-adapter/types.d.ts.map +1 -0
- package/dist/adapters/memory-adapter/index.cjs +28 -0
- package/dist/adapters/memory-adapter/index.d.ts +2 -0
- package/dist/adapters/memory-adapter/index.d.ts.map +1 -0
- package/dist/adapters/memory-adapter/index.mjs +22 -0
- package/dist/adapters/memory-adapter/memory-adapter.d.ts +50 -0
- package/dist/adapters/memory-adapter/memory-adapter.d.ts.map +1 -0
- package/dist/adapters/mongodb-adapter/index.cjs +282 -0
- package/dist/adapters/mongodb-adapter/index.d.ts +2 -0
- package/dist/adapters/mongodb-adapter/index.d.ts.map +1 -0
- package/dist/adapters/mongodb-adapter/index.mjs +280 -0
- package/dist/adapters/mongodb-adapter/mongodb-adapter.d.ts +48 -0
- package/dist/adapters/mongodb-adapter/mongodb-adapter.d.ts.map +1 -0
- package/dist/adapters/prisma-adapter/index.cjs +254 -0
- package/dist/adapters/prisma-adapter/index.d.ts +2 -0
- package/dist/adapters/prisma-adapter/index.d.ts.map +1 -0
- package/dist/adapters/prisma-adapter/index.mjs +252 -0
- package/dist/adapters/prisma-adapter/prisma-adapter.d.ts +57 -0
- package/dist/adapters/prisma-adapter/prisma-adapter.d.ts.map +1 -0
- package/dist/adapters/test.cjs +18 -6
- package/dist/adapters/test.d.ts +4 -12
- package/dist/adapters/test.d.ts.map +1 -0
- package/dist/adapters/test.mjs +439 -0
- package/dist/adapters/utils.d.ts +3 -0
- package/dist/adapters/utils.d.ts.map +1 -0
- package/dist/api/call.d.ts +1143 -0
- package/dist/api/call.d.ts.map +1 -0
- package/dist/api/index.cjs +788 -0
- package/dist/api/index.d.ts +7145 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.mjs +745 -0
- package/dist/api/middlewares/index.d.ts +2 -0
- package/dist/api/middlewares/index.d.ts.map +1 -0
- package/dist/api/middlewares/origin-check.d.ts +24 -0
- package/dist/api/middlewares/origin-check.d.ts.map +1 -0
- package/dist/api/rate-limiter/index.d.ts +7 -0
- package/dist/api/rate-limiter/index.d.ts.map +1 -0
- package/dist/api/routes/account.d.ts +283 -0
- package/dist/api/routes/account.d.ts.map +1 -0
- package/dist/api/routes/callback.d.ts +84 -0
- package/dist/api/routes/callback.d.ts.map +1 -0
- package/dist/api/routes/email-verification.d.ts +205 -0
- package/dist/api/routes/email-verification.d.ts.map +1 -0
- package/dist/api/routes/error.d.ts +46 -0
- package/dist/api/routes/error.d.ts.map +1 -0
- package/dist/api/routes/forget-password.d.ts +221 -0
- package/dist/api/routes/forget-password.d.ts.map +1 -0
- package/dist/api/routes/index.d.ts +12 -0
- package/dist/api/routes/index.d.ts.map +1 -0
- package/dist/api/routes/ok.d.ts +55 -0
- package/dist/api/routes/ok.d.ts.map +1 -0
- package/dist/api/routes/session.d.ts +606 -0
- package/dist/api/routes/session.d.ts.map +1 -0
- package/dist/api/routes/sign-in.d.ts +329 -0
- package/dist/api/routes/sign-in.d.ts.map +1 -0
- package/dist/api/routes/sign-out.d.ts +55 -0
- package/dist/api/routes/sign-out.d.ts.map +1 -0
- package/dist/api/routes/sign-up.d.ts +768 -0
- package/dist/api/routes/sign-up.d.ts.map +1 -0
- package/dist/api/routes/update-user.d.ts +1160 -0
- package/dist/api/routes/update-user.d.ts.map +1 -0
- package/dist/api/to-auth-endpoints.d.ts +4 -0
- package/dist/api/to-auth-endpoints.d.ts.map +1 -0
- package/dist/auth.d.ts +3590 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/client/config.d.ts +74 -0
- package/dist/client/config.d.ts.map +1 -0
- package/dist/client/fetch-plugins.d.ts +8 -0
- package/dist/client/fetch-plugins.d.ts.map +1 -0
- package/dist/client/index.cjs +51 -0
- package/dist/client/index.d.ts +11 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.mjs +47 -0
- package/dist/client/parser.d.ts +13 -0
- package/dist/client/parser.d.ts.map +1 -0
- package/dist/client/path-to-object.d.ts +63 -0
- package/dist/client/path-to-object.d.ts.map +1 -0
- package/dist/client/plugins/index.cjs +569 -0
- package/dist/client/plugins/index.d.ts +21 -0
- package/dist/client/plugins/index.d.ts.map +1 -0
- package/dist/client/plugins/index.mjs +548 -0
- package/dist/client/plugins/infer-plugin.d.ts +12 -0
- package/dist/client/plugins/infer-plugin.d.ts.map +1 -0
- package/dist/client/proxy.d.ts +9 -0
- package/dist/client/proxy.d.ts.map +1 -0
- package/dist/client/query.d.ts +14 -0
- package/dist/client/query.d.ts.map +1 -0
- package/dist/client/react/index.cjs +65 -0
- package/dist/client/react/index.d.ts +113 -0
- package/dist/client/react/index.d.ts.map +1 -0
- package/dist/client/react/index.mjs +61 -0
- package/dist/client/react/react-store.d.ts +21 -0
- package/dist/client/react/react-store.d.ts.map +1 -0
- package/dist/client/session-atom.d.ts +16 -0
- package/dist/client/session-atom.d.ts.map +1 -0
- package/dist/client/solid/index.cjs +58 -0
- package/dist/client/solid/index.d.ts +106 -0
- package/dist/client/solid/index.d.ts.map +1 -0
- package/dist/client/solid/index.mjs +56 -0
- package/dist/client/solid/solid-store.d.ts +10 -0
- package/dist/client/solid/solid-store.d.ts.map +1 -0
- package/dist/client/svelte/index.cjs +42 -0
- package/dist/client/svelte/index.d.ts +111 -0
- package/dist/client/svelte/index.d.ts.map +1 -0
- package/dist/client/svelte/index.mjs +40 -0
- package/dist/client/test-plugin.d.ts +130 -0
- package/dist/client/test-plugin.d.ts.map +1 -0
- package/dist/client/types.d.ts +79 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/vanilla.d.ts +110 -0
- package/dist/client/vanilla.d.ts.map +1 -0
- package/dist/client/vue/index.cjs +87 -0
- package/dist/client/vue/index.d.ts +134 -0
- package/dist/client/vue/index.d.ts.map +1 -0
- package/dist/client/vue/index.mjs +85 -0
- package/dist/client/vue/vue-store.d.ts +5 -0
- package/dist/client/vue/vue-store.d.ts.map +1 -0
- package/dist/cookies/check-cookies.d.ts +5 -0
- package/dist/cookies/check-cookies.d.ts.map +1 -0
- package/dist/cookies/cookie-utils.d.ts +17 -0
- package/dist/cookies/cookie-utils.d.ts.map +1 -0
- package/dist/cookies/index.cjs +392 -0
- package/dist/cookies/index.d.ts +51 -0
- package/dist/cookies/index.d.ts.map +1 -0
- package/dist/cookies/index.mjs +381 -0
- package/dist/crypto/buffer.d.ts +5 -0
- package/dist/crypto/buffer.d.ts.map +1 -0
- package/dist/crypto/hash.d.ts +3 -0
- package/dist/crypto/hash.d.ts.map +1 -0
- package/dist/crypto/index.cjs +57 -0
- package/dist/crypto/index.d.ts +16 -0
- package/dist/crypto/index.d.ts.map +1 -0
- package/dist/crypto/index.mjs +48 -0
- package/dist/crypto/jwt.d.ts +2 -0
- package/dist/crypto/jwt.d.ts.map +1 -0
- package/dist/crypto/password.d.ts +6 -0
- package/dist/crypto/password.d.ts.map +1 -0
- package/dist/crypto/random.d.ts +2 -0
- package/dist/crypto/random.d.ts.map +1 -0
- package/dist/db/field.d.ts +148 -0
- package/dist/db/field.d.ts.map +1 -0
- package/dist/db/get-migration.d.ts +19 -0
- package/dist/db/get-migration.d.ts.map +1 -0
- package/dist/db/get-schema.d.ts +7 -0
- package/dist/db/get-schema.d.ts.map +1 -0
- package/dist/db/get-tables.d.ts +23 -0
- package/dist/db/get-tables.d.ts.map +1 -0
- package/dist/db/index.cjs +99 -0
- package/dist/db/index.d.ts +10 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.mjs +72 -0
- package/dist/db/internal-adapter.d.ts +219 -0
- package/dist/db/internal-adapter.d.ts.map +1 -0
- package/dist/db/schema.d.ts +216 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/to-zod.d.ts +4 -0
- package/dist/db/to-zod.d.ts.map +1 -0
- package/dist/db/utils.d.ts +6 -0
- package/dist/db/utils.d.ts.map +1 -0
- package/dist/db/with-hooks.d.ts +19 -0
- package/dist/db/with-hooks.d.ts.map +1 -0
- package/dist/error/codes.d.ts +26 -0
- package/dist/error/codes.d.ts.map +1 -0
- package/dist/error/index.d.ts +7 -0
- package/dist/error/index.d.ts.map +1 -0
- package/dist/index.cjs +98 -101
- package/dist/index.d.ts +7 -26
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +249 -0
- package/dist/init.d.ts +71 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/integrations/next-js.cjs +101 -0
- package/dist/integrations/next-js.d.ts +24 -0
- package/dist/integrations/next-js.d.ts.map +1 -0
- package/dist/integrations/next-js.mjs +98 -0
- package/dist/integrations/node.cjs +23 -0
- package/dist/integrations/node.d.ts +7 -0
- package/dist/integrations/node.d.ts.map +1 -0
- package/dist/integrations/node.mjs +20 -0
- package/dist/integrations/solid-start.cjs +13 -0
- package/dist/integrations/solid-start.d.ts +11 -0
- package/dist/integrations/solid-start.d.ts.map +1 -0
- package/dist/integrations/solid-start.mjs +11 -0
- package/dist/integrations/svelte-kit.cjs +37 -0
- package/dist/integrations/svelte-kit.d.ts +20 -0
- package/dist/integrations/svelte-kit.d.ts.map +1 -0
- package/dist/integrations/svelte-kit.mjs +33 -0
- package/dist/oauth2/create-authorization-url.d.ts +14 -0
- package/dist/oauth2/create-authorization-url.d.ts.map +1 -0
- package/dist/oauth2/index.cjs +30 -0
- package/dist/oauth2/index.d.ts +6 -0
- package/dist/oauth2/index.d.ts.map +1 -0
- package/dist/oauth2/index.mjs +18 -0
- package/dist/oauth2/link-account.d.ts +40 -0
- package/dist/oauth2/link-account.d.ts.map +1 -0
- package/dist/oauth2/state.d.ts +20 -0
- package/dist/oauth2/state.d.ts.map +1 -0
- package/dist/oauth2/types.d.ts +112 -0
- package/dist/oauth2/types.d.ts.map +1 -0
- package/dist/oauth2/utils.d.ts +4 -0
- package/dist/oauth2/utils.d.ts.map +1 -0
- package/dist/oauth2/validate-authorization-code.d.ts +12 -0
- package/dist/oauth2/validate-authorization-code.d.ts.map +1 -0
- package/dist/plugins/access/access.d.ts +26 -0
- package/dist/plugins/access/access.d.ts.map +1 -0
- package/dist/plugins/access/index.cjs +72 -0
- package/dist/plugins/access/index.d.ts +3 -0
- package/dist/plugins/access/index.d.ts.map +1 -0
- package/dist/plugins/access/index.mjs +69 -0
- package/dist/plugins/access/types.d.ts +15 -0
- package/dist/plugins/access/types.d.ts.map +1 -0
- package/dist/plugins/additional-fields/client.d.ts +93 -0
- package/dist/plugins/additional-fields/client.d.ts.map +1 -0
- package/dist/plugins/admin/access/index.cjs +28 -0
- package/dist/plugins/admin/access/index.d.ts +2 -0
- package/dist/plugins/admin/access/index.d.ts.map +1 -0
- package/dist/plugins/admin/access/index.mjs +22 -0
- package/dist/plugins/admin/access/statement.d.ts +111 -0
- package/dist/plugins/admin/access/statement.d.ts.map +1 -0
- package/dist/plugins/admin/admin.d.ts +1390 -0
- package/dist/plugins/admin/admin.d.ts.map +1 -0
- package/dist/plugins/admin/call.d.ts +23 -0
- package/dist/plugins/admin/call.d.ts.map +1 -0
- package/dist/plugins/admin/client.d.ts +43 -0
- package/dist/plugins/admin/client.d.ts.map +1 -0
- package/dist/plugins/admin/error-codes.d.ts +14 -0
- package/dist/plugins/admin/error-codes.d.ts.map +1 -0
- package/dist/plugins/admin/has-permission.d.ts +10 -0
- package/dist/plugins/admin/has-permission.d.ts.map +1 -0
- package/dist/plugins/admin/index.cjs +44 -0
- package/dist/plugins/admin/index.d.ts +2 -0
- package/dist/plugins/admin/index.d.ts.map +1 -0
- package/dist/plugins/admin/index.mjs +38 -0
- package/dist/plugins/anonymous/client.d.ts +9 -0
- package/dist/plugins/anonymous/client.d.ts.map +1 -0
- package/dist/plugins/anonymous/index.cjs +186 -0
- package/dist/plugins/anonymous/index.d.ts +152 -0
- package/dist/plugins/anonymous/index.d.ts.map +1 -0
- package/dist/plugins/anonymous/index.mjs +184 -0
- package/dist/plugins/api-key/client.d.ts +9 -0
- package/dist/plugins/api-key/client.d.ts.map +1 -0
- package/dist/plugins/api-key/index.d.ts +873 -0
- package/dist/plugins/api-key/index.d.ts.map +1 -0
- package/dist/plugins/api-key/rate-limit.d.ts +21 -0
- package/dist/plugins/api-key/rate-limit.d.ts.map +1 -0
- package/dist/plugins/api-key/routes/create-api-key.d.ts +137 -0
- package/dist/plugins/api-key/routes/create-api-key.d.ts.map +1 -0
- package/dist/plugins/api-key/routes/delete-all-expired-api-keys.d.ts +40 -0
- package/dist/plugins/api-key/routes/delete-all-expired-api-keys.d.ts.map +1 -0
- package/dist/plugins/api-key/routes/delete-api-key.d.ts +80 -0
- package/dist/plugins/api-key/routes/delete-api-key.d.ts.map +1 -0
- package/dist/plugins/api-key/routes/get-api-key.d.ts +118 -0
- package/dist/plugins/api-key/routes/get-api-key.d.ts.map +1 -0
- package/dist/plugins/api-key/routes/index.d.ts +709 -0
- package/dist/plugins/api-key/routes/index.d.ts.map +1 -0
- package/dist/plugins/api-key/routes/list-api-keys.d.ts +108 -0
- package/dist/plugins/api-key/routes/list-api-keys.d.ts.map +1 -0
- package/dist/plugins/api-key/routes/update-api-key.d.ts +135 -0
- package/dist/plugins/api-key/routes/update-api-key.d.ts.map +1 -0
- package/dist/plugins/api-key/routes/verify-api-key.d.ts +137 -0
- package/dist/plugins/api-key/routes/verify-api-key.d.ts.map +1 -0
- package/dist/plugins/api-key/schema.d.ts +189 -0
- package/dist/plugins/api-key/schema.d.ts.map +1 -0
- package/dist/plugins/api-key/types.d.ts +267 -0
- package/dist/plugins/api-key/types.d.ts.map +1 -0
- package/dist/plugins/bearer/index.cjs +120 -0
- package/dist/plugins/bearer/index.d.ts +48 -0
- package/dist/plugins/bearer/index.d.ts.map +1 -0
- package/dist/plugins/bearer/index.mjs +118 -0
- package/dist/plugins/captcha/constants.d.ts +8 -0
- package/dist/plugins/captcha/constants.d.ts.map +1 -0
- package/dist/plugins/captcha/error-codes.d.ts +7 -0
- package/dist/plugins/captcha/error-codes.d.ts.map +1 -0
- package/dist/plugins/captcha/index.cjs +134 -0
- package/dist/plugins/captcha/index.d.ts +14 -0
- package/dist/plugins/captcha/index.d.ts.map +1 -0
- package/dist/plugins/captcha/index.mjs +132 -0
- package/dist/plugins/captcha/types.d.ts +21 -0
- package/dist/plugins/captcha/types.d.ts.map +1 -0
- package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.d.ts +10 -0
- package/dist/plugins/captcha/verify-handlers/cloudflare-turnstile.d.ts.map +1 -0
- package/dist/plugins/captcha/verify-handlers/google-recaptcha.d.ts +10 -0
- package/dist/plugins/captcha/verify-handlers/google-recaptcha.d.ts.map +1 -0
- package/dist/plugins/captcha/verify-handlers/index.d.ts +3 -0
- package/dist/plugins/captcha/verify-handlers/index.d.ts.map +1 -0
- package/dist/plugins/custom-session/client.d.ts +12 -0
- package/dist/plugins/custom-session/client.d.ts.map +1 -0
- package/dist/plugins/custom-session/index.cjs +76 -0
- package/dist/plugins/custom-session/index.d.ts +58 -0
- package/dist/plugins/custom-session/index.d.ts.map +1 -0
- package/dist/plugins/custom-session/index.mjs +74 -0
- package/dist/plugins/email-otp/client.d.ts +6 -0
- package/dist/plugins/email-otp/client.d.ts.map +1 -0
- package/dist/plugins/email-otp/index.cjs +707 -0
- package/dist/plugins/email-otp/index.d.ts +606 -0
- package/dist/plugins/email-otp/index.d.ts.map +1 -0
- package/dist/plugins/email-otp/index.mjs +705 -0
- package/dist/plugins/generic-oauth/client.d.ts +6 -0
- package/dist/plugins/generic-oauth/client.d.ts.map +1 -0
- package/dist/plugins/generic-oauth/index.cjs +542 -0
- package/dist/plugins/generic-oauth/index.d.ts +354 -0
- package/dist/plugins/generic-oauth/index.d.ts.map +1 -0
- package/dist/plugins/generic-oauth/index.mjs +540 -0
- package/dist/plugins/index.cjs +1396 -0
- package/dist/plugins/index.d.ts +23 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.mjs +1371 -0
- package/dist/plugins/jwt/adapter.d.ts +23 -0
- package/dist/plugins/jwt/adapter.d.ts.map +1 -0
- package/dist/plugins/jwt/client.d.ts +6 -0
- package/dist/plugins/jwt/client.d.ts.map +1 -0
- package/dist/plugins/jwt/index.cjs +282 -0
- package/dist/plugins/jwt/index.d.ts +277 -0
- package/dist/plugins/jwt/index.d.ts.map +1 -0
- package/dist/plugins/jwt/index.mjs +280 -0
- package/dist/plugins/jwt/schema.d.ts +37 -0
- package/dist/plugins/jwt/schema.d.ts.map +1 -0
- package/dist/plugins/jwt/utils.d.ts +11 -0
- package/dist/plugins/jwt/utils.d.ts.map +1 -0
- package/dist/plugins/magic-link/client.d.ts +6 -0
- package/dist/plugins/magic-link/client.d.ts.map +1 -0
- package/dist/plugins/magic-link/index.cjs +242 -0
- package/dist/plugins/magic-link/index.d.ts +218 -0
- package/dist/plugins/magic-link/index.d.ts.map +1 -0
- package/dist/plugins/magic-link/index.mjs +240 -0
- package/dist/plugins/multi-session/client.d.ts +10 -0
- package/dist/plugins/multi-session/client.d.ts.map +1 -0
- package/dist/plugins/multi-session/index.cjs +271 -0
- package/dist/plugins/multi-session/index.d.ts +257 -0
- package/dist/plugins/multi-session/index.d.ts.map +1 -0
- package/dist/plugins/multi-session/index.mjs +269 -0
- package/dist/plugins/oauth-proxy/index.cjs +174 -0
- package/dist/plugins/oauth-proxy/index.d.ts +134 -0
- package/dist/plugins/oauth-proxy/index.d.ts.map +1 -0
- package/dist/plugins/oauth-proxy/index.mjs +172 -0
- package/dist/plugins/oidc-provider/authorize.d.ts +4 -0
- package/dist/plugins/oidc-provider/authorize.d.ts.map +1 -0
- package/dist/plugins/oidc-provider/client.d.ts +6 -0
- package/dist/plugins/oidc-provider/client.d.ts.map +1 -0
- package/dist/plugins/oidc-provider/index.cjs +1039 -0
- package/dist/plugins/oidc-provider/index.d.ts +483 -0
- package/dist/plugins/oidc-provider/index.d.ts.map +1 -0
- package/dist/plugins/oidc-provider/index.mjs +1037 -0
- package/dist/plugins/oidc-provider/schema.d.ts +105 -0
- package/dist/plugins/oidc-provider/schema.d.ts.map +1 -0
- package/dist/plugins/oidc-provider/types.d.ts +496 -0
- package/dist/plugins/oidc-provider/types.d.ts.map +1 -0
- package/dist/plugins/oidc-provider/ui.d.ts +9 -0
- package/dist/plugins/oidc-provider/ui.d.ts.map +1 -0
- package/dist/plugins/one-tap/client.d.ts +82 -0
- package/dist/plugins/one-tap/client.d.ts.map +1 -0
- package/dist/plugins/one-tap/index.cjs +197 -0
- package/dist/plugins/one-tap/index.d.ts +114 -0
- package/dist/plugins/one-tap/index.d.ts.map +1 -0
- package/dist/plugins/one-tap/index.mjs +195 -0
- package/dist/plugins/open-api/generator.d.ts +101 -0
- package/dist/plugins/open-api/generator.d.ts.map +1 -0
- package/dist/plugins/open-api/index.cjs +480 -0
- package/dist/plugins/open-api/index.d.ts +152 -0
- package/dist/plugins/open-api/index.d.ts.map +1 -0
- package/dist/plugins/open-api/index.mjs +478 -0
- package/dist/plugins/open-api/logo.d.ts +2 -0
- package/dist/plugins/open-api/logo.d.ts.map +1 -0
- package/dist/plugins/organization/access/index.d.ts +2 -0
- package/dist/plugins/organization/access/index.d.ts.map +1 -0
- package/dist/plugins/organization/access/statement.d.ts +180 -0
- package/dist/plugins/organization/access/statement.d.ts.map +1 -0
- package/dist/plugins/organization/adapter.d.ts +291 -0
- package/dist/plugins/organization/adapter.d.ts.map +1 -0
- package/dist/plugins/organization/call.d.ts +41 -0
- package/dist/plugins/organization/call.d.ts.map +1 -0
- package/dist/plugins/organization/client.d.ts +334 -0
- package/dist/plugins/organization/client.d.ts.map +1 -0
- package/dist/plugins/organization/error-codes.d.ts +31 -0
- package/dist/plugins/organization/error-codes.d.ts.map +1 -0
- package/dist/plugins/organization/has-permission.d.ts +9 -0
- package/dist/plugins/organization/has-permission.d.ts.map +1 -0
- package/dist/plugins/organization/index.cjs +44 -0
- package/dist/plugins/organization/index.d.ts +2 -0
- package/dist/plugins/organization/index.d.ts.map +1 -0
- package/dist/plugins/organization/index.mjs +38 -0
- package/dist/plugins/organization/organization.d.ts +6764 -0
- package/dist/plugins/organization/organization.d.ts.map +1 -0
- package/dist/plugins/organization/routes/crud-invites.d.ts +2382 -0
- package/dist/plugins/organization/routes/crud-invites.d.ts.map +1 -0
- package/dist/plugins/organization/routes/crud-members.d.ts +578 -0
- package/dist/plugins/organization/routes/crud-members.d.ts.map +1 -0
- package/dist/plugins/organization/routes/crud-org.d.ts +789 -0
- package/dist/plugins/organization/routes/crud-org.d.ts.map +1 -0
- package/dist/plugins/organization/routes/crud-team.d.ts +348 -0
- package/dist/plugins/organization/routes/crud-team.d.ts.map +1 -0
- package/dist/plugins/organization/schema.d.ts +159 -0
- package/dist/plugins/organization/schema.d.ts.map +1 -0
- package/dist/plugins/passkey/client.d.ts +140 -0
- package/dist/plugins/passkey/client.d.ts.map +1 -0
- package/dist/plugins/passkey/index.cjs +831 -0
- package/dist/plugins/passkey/index.d.ts +847 -0
- package/dist/plugins/passkey/index.d.ts.map +1 -0
- package/dist/plugins/passkey/index.mjs +829 -0
- package/dist/plugins/phone-number/client.d.ts +10 -0
- package/dist/plugins/phone-number/client.d.ts.map +1 -0
- package/dist/plugins/phone-number/index.cjs +605 -0
- package/dist/plugins/phone-number/index.d.ts +477 -0
- package/dist/plugins/phone-number/index.d.ts.map +1 -0
- package/dist/plugins/phone-number/index.mjs +603 -0
- package/dist/plugins/sso/client.d.ts +6 -0
- package/dist/plugins/sso/client.d.ts.map +1 -0
- package/dist/plugins/sso/index.cjs +582 -0
- package/dist/plugins/sso/index.d.ts +490 -0
- package/dist/plugins/sso/index.d.ts.map +1 -0
- package/dist/plugins/sso/index.mjs +580 -0
- package/dist/plugins/two-factor/backup-codes/index.d.ts +348 -0
- package/dist/plugins/two-factor/backup-codes/index.d.ts.map +1 -0
- package/dist/plugins/two-factor/client.d.ts +29 -0
- package/dist/plugins/two-factor/client.d.ts.map +1 -0
- package/dist/plugins/two-factor/constant.d.ts +3 -0
- package/dist/plugins/two-factor/constant.d.ts.map +1 -0
- package/dist/plugins/two-factor/error-code.d.ts +9 -0
- package/dist/plugins/two-factor/error-code.d.ts.map +1 -0
- package/dist/plugins/two-factor/index.cjs +982 -0
- package/dist/plugins/two-factor/index.d.ts +1199 -0
- package/dist/plugins/two-factor/index.d.ts.map +1 -0
- package/dist/plugins/two-factor/index.mjs +979 -0
- package/dist/plugins/two-factor/otp/index.d.ts +352 -0
- package/dist/plugins/two-factor/otp/index.d.ts.map +1 -0
- package/dist/plugins/two-factor/schema.d.ts +36 -0
- package/dist/plugins/two-factor/schema.d.ts.map +1 -0
- package/dist/plugins/two-factor/totp/index.d.ts +367 -0
- package/dist/plugins/two-factor/totp/index.d.ts.map +1 -0
- package/dist/plugins/two-factor/types.d.ts +52 -0
- package/dist/plugins/two-factor/types.d.ts.map +1 -0
- package/dist/plugins/two-factor/verify-middleware.d.ts +76 -0
- package/dist/plugins/two-factor/verify-middleware.d.ts.map +1 -0
- package/dist/plugins/username/client.d.ts +6 -0
- package/dist/plugins/username/client.d.ts.map +1 -0
- package/dist/plugins/username/index.cjs +302 -0
- package/dist/plugins/username/index.d.ts +166 -0
- package/dist/plugins/username/index.d.ts.map +1 -0
- package/dist/plugins/username/index.mjs +300 -0
- package/dist/plugins/username/schema.d.ts +21 -0
- package/dist/plugins/username/schema.d.ts.map +1 -0
- package/dist/shared/better-auth.0TC26uRi.mjs +16 -0
- package/dist/shared/better-auth.0YzTc-oD.mjs +349 -0
- package/dist/shared/better-auth.8zoxzg-F.mjs +40 -0
- package/dist/shared/better-auth.ANpbi45u.cjs +22 -0
- package/dist/shared/better-auth.B4Qoxdgc.mjs +10 -0
- package/dist/shared/better-auth.B5NYxGA3.mjs +1126 -0
- package/dist/shared/better-auth.BBVHlTCJ.mjs +140 -0
- package/dist/shared/better-auth.BEphVDyL.cjs +251 -0
- package/dist/shared/better-auth.BG6vHVNT.cjs +30 -0
- package/dist/shared/better-auth.BIdFil5c.mjs +2966 -0
- package/dist/shared/better-auth.BLDOwz3i.cjs +7 -0
- package/dist/shared/better-auth.BMYo0QR-.cjs +10 -0
- package/dist/shared/better-auth.BUPPRXfK.mjs +7 -0
- package/dist/shared/better-auth.BXzrqpD0.mjs +89 -0
- package/dist/shared/better-auth.BcoSd9tC.mjs +10 -0
- package/dist/shared/better-auth.Bg6iw3ig.cjs +9 -0
- package/dist/shared/better-auth.BgkOX1Ei.cjs +36 -0
- package/dist/shared/better-auth.BopGaOCJ.mjs +1072 -0
- package/dist/shared/better-auth.BsGMIUYy.cjs +144 -0
- package/dist/shared/better-auth.BtJHz7JQ.mjs +21 -0
- package/dist/shared/better-auth.C1-vpKly.cjs +12 -0
- package/dist/shared/better-auth.C1hdVENX.cjs +7 -0
- package/dist/shared/better-auth.C24Bzw4w.mjs +174 -0
- package/dist/shared/better-auth.CDXNofOe.cjs +44 -0
- package/dist/shared/better-auth.CHh0hgk_.cjs +3007 -0
- package/dist/shared/better-auth.CHyZMcYK.cjs +190 -0
- package/dist/shared/better-auth.CKg1f8vU.cjs +1135 -0
- package/dist/shared/better-auth.CQvoVIBD.mjs +81 -0
- package/dist/shared/better-auth.CUdxApHl.cjs +18 -0
- package/dist/shared/better-auth.CW6D9eSx.mjs +5 -0
- package/dist/shared/better-auth.CYeOI8C-.cjs +12 -0
- package/dist/shared/better-auth.CZu6g_Il.cjs +92 -0
- package/dist/shared/better-auth.C_Zl7Etp.cjs +83 -0
- package/dist/shared/better-auth.CuZPmFi8.mjs +30 -0
- package/dist/shared/better-auth.Cytp8fGy.cjs +200 -0
- package/dist/shared/better-auth.D-2CmEwz.mjs +5 -0
- package/dist/shared/better-auth.D3mtHEZg.cjs +23 -0
- package/dist/shared/better-auth.D7syfoJW.mjs +133 -0
- package/dist/shared/better-auth.D8LeJoj0.mjs +173 -0
- package/dist/shared/better-auth.DDEbWX-S.mjs +8 -0
- package/dist/shared/better-auth.DH3YjMQH.mjs +55 -0
- package/dist/shared/better-auth.DMLPzZdQ.cjs +23 -0
- package/dist/shared/better-auth.DNqtHmvg.cjs +22 -0
- package/dist/shared/better-auth.DORkW_Ge.mjs +249 -0
- package/dist/shared/better-auth.DQI8AD7d.mjs +20 -0
- package/dist/shared/better-auth.DQRQ_nOW.cjs +1074 -0
- package/dist/shared/better-auth.DZnoWLte.cjs +175 -0
- package/dist/shared/better-auth.D_yrCdEQ.mjs +59 -0
- package/dist/shared/better-auth.DdjqxOIu.cjs +139 -0
- package/dist/shared/better-auth.Ddw8bVyV.mjs +35 -0
- package/dist/shared/better-auth.DdzSJf-n.mjs +19 -0
- package/dist/shared/better-auth.DhsGZ30Q.cjs +126 -0
- package/dist/shared/better-auth.DiSjtgs9.cjs +45 -0
- package/dist/shared/better-auth.DnER2-iT.cjs +37 -0
- package/dist/shared/better-auth.DssCybTk.cjs +64 -0
- package/dist/shared/better-auth.Duk7IG0N.mjs +34 -0
- package/dist/shared/better-auth.Ffl9CCnn.mjs +2293 -0
- package/dist/shared/better-auth.GpOOav9x.cjs +60 -0
- package/dist/shared/better-auth.HHZU10im.mjs +405 -0
- package/dist/shared/better-auth.OT3XFeFk.mjs +48 -0
- package/dist/shared/better-auth.YUF6P-PB.cjs +52 -0
- package/dist/shared/better-auth.YwDQhoPc.mjs +41 -0
- package/dist/shared/better-auth.am4QbDex.cjs +37 -0
- package/dist/shared/better-auth.cd8Jd_oV.mjs +197 -0
- package/dist/shared/better-auth.ffWeg50w.mjs +124 -0
- package/dist/shared/better-auth.fsvwNeUx.mjs +28 -0
- package/dist/shared/better-auth.lwzD09PV.cjs +408 -0
- package/dist/shared/better-auth.sN5DUs9C.cjs +351 -0
- package/dist/shared/better-auth.tB5eU6EY.mjs +21 -0
- package/dist/shared/better-auth.uUYJdWSr.cjs +2319 -0
- package/dist/social-providers/apple.d.ts +93 -0
- package/dist/social-providers/apple.d.ts.map +1 -0
- package/dist/social-providers/discord.d.ts +101 -0
- package/dist/social-providers/discord.d.ts.map +1 -0
- package/dist/social-providers/dropbox.d.ts +44 -0
- package/dist/social-providers/dropbox.d.ts.map +1 -0
- package/dist/social-providers/facebook.d.ts +52 -0
- package/dist/social-providers/facebook.d.ts.map +1 -0
- package/dist/social-providers/github.d.ts +77 -0
- package/dist/social-providers/github.d.ts.map +1 -0
- package/dist/social-providers/gitlab.d.ts +76 -0
- package/dist/social-providers/gitlab.d.ts.map +1 -0
- package/dist/social-providers/google.d.ts +62 -0
- package/dist/social-providers/google.d.ts.map +1 -0
- package/dist/social-providers/index.cjs +1217 -0
- package/dist/social-providers/index.d.ts +477 -0
- package/dist/social-providers/index.d.ts.map +1 -0
- package/dist/social-providers/index.mjs +1195 -0
- package/dist/social-providers/linkedin.d.ts +55 -0
- package/dist/social-providers/linkedin.d.ts.map +1 -0
- package/dist/social-providers/microsoft-entra-id.d.ts +56 -0
- package/dist/social-providers/microsoft-entra-id.d.ts.map +1 -0
- package/dist/social-providers/reddit.d.ts +40 -0
- package/dist/social-providers/reddit.d.ts.map +1 -0
- package/dist/social-providers/roblox.d.ts +48 -0
- package/dist/social-providers/roblox.d.ts.map +1 -0
- package/dist/social-providers/spotify.d.ts +39 -0
- package/dist/social-providers/spotify.d.ts.map +1 -0
- package/dist/social-providers/tiktok.d.ts +145 -0
- package/dist/social-providers/tiktok.d.ts.map +1 -0
- package/dist/social-providers/twitch.d.ts +50 -0
- package/dist/social-providers/twitch.d.ts.map +1 -0
- package/dist/social-providers/twitter.d.ts +119 -0
- package/dist/social-providers/twitter.d.ts.map +1 -0
- package/dist/social-providers/vk.d.ts +59 -0
- package/dist/social-providers/vk.d.ts.map +1 -0
- package/dist/tsconfig.declarations.tsbuildinfo +1 -0
- package/dist/types/adapter.d.ts +119 -0
- package/dist/types/adapter.d.ts.map +1 -0
- package/dist/types/api.d.ts +28 -0
- package/dist/types/api.d.ts.map +1 -0
- package/dist/types/context.d.ts +13 -0
- package/dist/types/context.d.ts.map +1 -0
- package/dist/types/helper.d.ts +32 -0
- package/dist/types/helper.d.ts.map +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/models.d.ts +35 -0
- package/dist/types/models.d.ts.map +1 -0
- package/dist/types/options.d.ts +794 -0
- package/dist/types/options.d.ts.map +1 -0
- package/dist/types/plugins.d.ts +120 -0
- package/dist/types/plugins.d.ts.map +1 -0
- package/dist/utils/boolean.d.ts +2 -0
- package/dist/utils/boolean.d.ts.map +1 -0
- package/dist/utils/callback-url.d.ts +7 -0
- package/dist/utils/callback-url.d.ts.map +1 -0
- package/dist/utils/clone.d.ts +2 -0
- package/dist/utils/clone.d.ts.map +1 -0
- package/dist/utils/constants.d.ts +2 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/date.d.ts +2 -0
- package/dist/utils/date.d.ts.map +1 -0
- package/dist/utils/env.d.ts +10 -0
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/get-request-ip.d.ts +3 -0
- package/dist/utils/get-request-ip.d.ts.map +1 -0
- package/dist/utils/hide-metadata.d.ts +4 -0
- package/dist/utils/hide-metadata.d.ts.map +1 -0
- package/dist/utils/id.d.ts +2 -0
- package/dist/utils/id.d.ts.map +1 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/json.d.ts +2 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +15 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/merger.d.ts +2 -0
- package/dist/utils/merger.d.ts.map +1 -0
- package/dist/utils/middleware-response.d.ts +9 -0
- package/dist/utils/middleware-response.d.ts.map +1 -0
- package/dist/utils/misc.d.ts +2 -0
- package/dist/utils/misc.d.ts.map +1 -0
- package/dist/utils/password.d.ts +7 -0
- package/dist/utils/password.d.ts.map +1 -0
- package/dist/utils/plugin-helper.d.ts +6 -0
- package/dist/utils/plugin-helper.d.ts.map +1 -0
- package/dist/utils/shim.d.ts +4 -0
- package/dist/utils/shim.d.ts.map +1 -0
- package/dist/utils/time.d.ts +29 -0
- package/dist/utils/time.d.ts.map +1 -0
- package/dist/utils/url.d.ts +6 -0
- package/dist/utils/url.d.ts.map +1 -0
- package/dist/utils/wildcard.d.ts +46 -0
- package/dist/utils/wildcard.d.ts.map +1 -0
- package/package.json +220 -218
- package/dist/adapters/drizzle.cjs +0 -274
- package/dist/adapters/drizzle.d.cts +0 -76
- package/dist/adapters/drizzle.d.ts +0 -76
- package/dist/adapters/drizzle.js +0 -272
- package/dist/adapters/kysely.cjs +0 -24
- package/dist/adapters/kysely.d.cts +0 -68
- package/dist/adapters/kysely.d.ts +0 -68
- package/dist/adapters/kysely.js +0 -11
- package/dist/adapters/memory.cjs +0 -20
- package/dist/adapters/memory.d.cts +0 -59
- package/dist/adapters/memory.d.ts +0 -59
- package/dist/adapters/memory.js +0 -11
- package/dist/adapters/mongodb.cjs +0 -273
- package/dist/adapters/mongodb.d.cts +0 -57
- package/dist/adapters/mongodb.d.ts +0 -57
- package/dist/adapters/mongodb.js +0 -271
- package/dist/adapters/prisma.cjs +0 -244
- package/dist/adapters/prisma.d.cts +0 -65
- package/dist/adapters/prisma.d.ts +0 -65
- package/dist/adapters/prisma.js +0 -242
- package/dist/adapters/test.d.cts +0 -16
- package/dist/adapters/test.js +0 -427
- package/dist/api.cjs +0 -179
- package/dist/api.d.cts +0 -8
- package/dist/api.d.ts +0 -8
- package/dist/api.js +0 -14
- package/dist/auth-B79moDlX.d.cts +0 -17513
- package/dist/auth-Kwau5-bb.d.ts +0 -17513
- package/dist/chunk-24JP47BJ.cjs +0 -514
- package/dist/chunk-2HPSCSV7.cjs +0 -8
- package/dist/chunk-2NRCW4MM.cjs +0 -276
- package/dist/chunk-36B4OZI7.cjs +0 -108
- package/dist/chunk-3XTQSPPA.js +0 -6
- package/dist/chunk-3YL6DMDX.cjs +0 -579
- package/dist/chunk-42QFDXM5.js +0 -168
- package/dist/chunk-4O3PNNJ5.js +0 -22
- package/dist/chunk-4YAPAKAB.cjs +0 -73
- package/dist/chunk-53IPO2PJ.js +0 -22
- package/dist/chunk-5ILVRGRP.cjs +0 -1066
- package/dist/chunk-6AFMN526.cjs +0 -45
- package/dist/chunk-6YBMZW4E.js +0 -274
- package/dist/chunk-74IS7WMH.js +0 -89
- package/dist/chunk-7KKMYVNZ.js +0 -42
- package/dist/chunk-7T4E7I7S.cjs +0 -1084
- package/dist/chunk-BAFWUSRZ.cjs +0 -277
- package/dist/chunk-BVPUB4ND.cjs +0 -2225
- package/dist/chunk-CAT6XI46.js +0 -275
- package/dist/chunk-CCKQSGIR.cjs +0 -8
- package/dist/chunk-CDEGAT2X.cjs +0 -38
- package/dist/chunk-CF7NIEGH.cjs +0 -38
- package/dist/chunk-COHCMRZR.cjs +0 -448
- package/dist/chunk-CWVCOYJV.cjs +0 -28
- package/dist/chunk-DINP2XPU.js +0 -677
- package/dist/chunk-DMXPQ4IV.js +0 -98
- package/dist/chunk-EHFDU6IF.cjs +0 -45
- package/dist/chunk-ENJOFIER.js +0 -212
- package/dist/chunk-EORFSCDW.cjs +0 -91
- package/dist/chunk-FDBO3FVG.cjs +0 -1135
- package/dist/chunk-FURNA6HY.js +0 -6
- package/dist/chunk-GBOJH32L.cjs +0 -82
- package/dist/chunk-GEW4G4Y7.cjs +0 -1007
- package/dist/chunk-GYDUPG7X.js +0 -36
- package/dist/chunk-H74YRRNV.cjs +0 -92
- package/dist/chunk-HC2USFT2.cjs +0 -214
- package/dist/chunk-HVHN3Y2L.js +0 -126
- package/dist/chunk-IGDRZOHV.js +0 -134
- package/dist/chunk-IX6WCVID.cjs +0 -1971
- package/dist/chunk-J6F3TU5V.js +0 -1082
- package/dist/chunk-JEYF2ARX.js +0 -21
- package/dist/chunk-JOH6QBAP.cjs +0 -362
- package/dist/chunk-JUPDDQC4.cjs +0 -23
- package/dist/chunk-KEQSKZI2.js +0 -239
- package/dist/chunk-KIQWU6Z4.cjs +0 -278
- package/dist/chunk-KLDFBLYL.js +0 -85
- package/dist/chunk-LJJIONSX.cjs +0 -45
- package/dist/chunk-LKPN4Y5Z.js +0 -31
- package/dist/chunk-M5XMVH2M.js +0 -1114
- package/dist/chunk-NC57F4RJ.cjs +0 -3703
- package/dist/chunk-NSBXOWUM.js +0 -1064
- package/dist/chunk-NTBGYF7H.cjs +0 -241
- package/dist/chunk-OA7Z7IZT.cjs +0 -24
- package/dist/chunk-PEZRSDZS.cjs +0 -23
- package/dist/chunk-Q4E77C7B.js +0 -1005
- package/dist/chunk-Q4XYQ7DC.js +0 -156
- package/dist/chunk-QUVBQTGS.js +0 -274
- package/dist/chunk-R42K7GPF.js +0 -132
- package/dist/chunk-REY76NPL.cjs +0 -136
- package/dist/chunk-RJUH2LYP.js +0 -577
- package/dist/chunk-RXJOBUFI.js +0 -43
- package/dist/chunk-S5UORXJH.cjs +0 -65
- package/dist/chunk-SENLFMI2.js +0 -142
- package/dist/chunk-SVC7H7K4.cjs +0 -138
- package/dist/chunk-TBGNSOTL.js +0 -1955
- package/dist/chunk-THOAPE5K.js +0 -70
- package/dist/chunk-TJWK22XS.js +0 -446
- package/dist/chunk-TOKZL3ZI.js +0 -42
- package/dist/chunk-TOSIKQ2I.cjs +0 -144
- package/dist/chunk-TQQSPPNA.js +0 -41
- package/dist/chunk-U4I57HJ4.cjs +0 -129
- package/dist/chunk-UNWCXKMP.js +0 -20
- package/dist/chunk-UQC2FUXC.cjs +0 -224
- package/dist/chunk-VOUL66AG.js +0 -512
- package/dist/chunk-VXYIYABQ.cjs +0 -46
- package/dist/chunk-WBFH3ZYN.js +0 -352
- package/dist/chunk-WMXBA6LX.js +0 -11
- package/dist/chunk-WVVF7K6P.js +0 -79
- package/dist/chunk-WZ6OIVJK.js +0 -207
- package/dist/chunk-X3J3BWQR.js +0 -2223
- package/dist/chunk-XDMVO6BH.cjs +0 -170
- package/dist/chunk-XFCIANZX.js +0 -60
- package/dist/chunk-XRF73UDB.js +0 -3654
- package/dist/chunk-Y64QYLA4.cjs +0 -158
- package/dist/chunk-Y6QT4U6Z.cjs +0 -679
- package/dist/chunk-ZBKCS3KP.cjs +0 -13
- package/dist/client/plugins.cjs +0 -572
- package/dist/client/plugins.d.cts +0 -758
- package/dist/client/plugins.d.ts +0 -758
- package/dist/client/plugins.js +0 -549
- package/dist/client.cjs +0 -24
- package/dist/client.d.cts +0 -138
- package/dist/client.d.ts +0 -138
- package/dist/client.js +0 -7
- package/dist/cookies.cjs +0 -46
- package/dist/cookies.d.cts +0 -8
- package/dist/cookies.d.ts +0 -8
- package/dist/cookies.js +0 -5
- package/dist/crypto.cjs +0 -42
- package/dist/crypto.d.cts +0 -30
- package/dist/crypto.d.ts +0 -30
- package/dist/crypto.js +0 -1
- package/dist/db.cjs +0 -120
- package/dist/db.d.cts +0 -56
- package/dist/db.d.ts +0 -56
- package/dist/db.js +0 -11
- package/dist/helper-DFk-nDjL.d.cts +0 -29
- package/dist/helper-DFk-nDjL.d.ts +0 -29
- package/dist/hide-metadata-DEHJp1rk.d.cts +0 -5
- package/dist/hide-metadata-DEHJp1rk.d.ts +0 -5
- package/dist/index-BKfxieJM.d.ts +0 -1500
- package/dist/index-Bo3yOPaO.d.cts +0 -1500
- package/dist/index-CpB6VxxI.d.ts +0 -5116
- package/dist/index-UqpJkXzo.d.cts +0 -5116
- package/dist/index.d.cts +0 -26
- package/dist/index.js +0 -217
- package/dist/next-js.cjs +0 -100
- package/dist/next-js.d.cts +0 -34
- package/dist/next-js.d.ts +0 -34
- package/dist/next-js.js +0 -97
- package/dist/node.cjs +0 -24
- package/dist/node.d.cts +0 -17
- package/dist/node.d.ts +0 -17
- package/dist/node.js +0 -21
- package/dist/oauth2.cjs +0 -37
- package/dist/oauth2.d.cts +0 -39
- package/dist/oauth2.d.ts +0 -39
- package/dist/oauth2.js +0 -4
- package/dist/plugins/access.cjs +0 -15
- package/dist/plugins/access.d.cts +0 -42
- package/dist/plugins/access.d.ts +0 -42
- package/dist/plugins/access.js +0 -2
- package/dist/plugins/admin/access.cjs +0 -28
- package/dist/plugins/admin/access.d.cts +0 -116
- package/dist/plugins/admin/access.d.ts +0 -116
- package/dist/plugins/admin/access.js +0 -3
- package/dist/plugins/admin.cjs +0 -28
- package/dist/plugins/admin.d.cts +0 -1398
- package/dist/plugins/admin.d.ts +0 -1398
- package/dist/plugins/admin.js +0 -19
- package/dist/plugins/anonymous.cjs +0 -24
- package/dist/plugins/anonymous.d.cts +0 -160
- package/dist/plugins/anonymous.d.ts +0 -160
- package/dist/plugins/anonymous.js +0 -15
- package/dist/plugins/bearer.cjs +0 -24
- package/dist/plugins/bearer.d.cts +0 -57
- package/dist/plugins/bearer.d.ts +0 -57
- package/dist/plugins/bearer.js +0 -15
- package/dist/plugins/captcha.cjs +0 -10
- package/dist/plugins/captcha.d.cts +0 -21
- package/dist/plugins/captcha.d.ts +0 -21
- package/dist/plugins/captcha.js +0 -1
- package/dist/plugins/custom-session.cjs +0 -24
- package/dist/plugins/custom-session.d.cts +0 -66
- package/dist/plugins/custom-session.d.ts +0 -66
- package/dist/plugins/custom-session.js +0 -15
- package/dist/plugins/email-otp.cjs +0 -25
- package/dist/plugins/email-otp.d.cts +0 -615
- package/dist/plugins/email-otp.d.ts +0 -615
- package/dist/plugins/email-otp.js +0 -16
- package/dist/plugins/generic-oauth.cjs +0 -24
- package/dist/plugins/generic-oauth.d.cts +0 -356
- package/dist/plugins/generic-oauth.d.ts +0 -356
- package/dist/plugins/generic-oauth.js +0 -15
- package/dist/plugins/jwt.cjs +0 -24
- package/dist/plugins/jwt.d.cts +0 -303
- package/dist/plugins/jwt.d.ts +0 -303
- package/dist/plugins/jwt.js +0 -15
- package/dist/plugins/magic-link.cjs +0 -24
- package/dist/plugins/magic-link.d.cts +0 -220
- package/dist/plugins/magic-link.d.ts +0 -220
- package/dist/plugins/magic-link.js +0 -15
- package/dist/plugins/multi-session.cjs +0 -24
- package/dist/plugins/multi-session.d.cts +0 -265
- package/dist/plugins/multi-session.d.ts +0 -265
- package/dist/plugins/multi-session.js +0 -15
- package/dist/plugins/oidc-provider.cjs +0 -24
- package/dist/plugins/oidc-provider.d.cts +0 -977
- package/dist/plugins/oidc-provider.d.ts +0 -977
- package/dist/plugins/oidc-provider.js +0 -15
- package/dist/plugins/one-tap.cjs +0 -24
- package/dist/plugins/one-tap.d.cts +0 -116
- package/dist/plugins/one-tap.d.ts +0 -116
- package/dist/plugins/one-tap.js +0 -15
- package/dist/plugins/open-api.cjs +0 -26
- package/dist/plugins/open-api.d.cts +0 -260
- package/dist/plugins/open-api.d.ts +0 -260
- package/dist/plugins/open-api.js +0 -17
- package/dist/plugins/organization.cjs +0 -27
- package/dist/plugins/organization.d.cts +0 -10
- package/dist/plugins/organization.d.ts +0 -10
- package/dist/plugins/organization.js +0 -18
- package/dist/plugins/passkey.cjs +0 -799
- package/dist/plugins/passkey.d.cts +0 -833
- package/dist/plugins/passkey.d.ts +0 -833
- package/dist/plugins/passkey.js +0 -797
- package/dist/plugins/phone-number.cjs +0 -24
- package/dist/plugins/phone-number.d.cts +0 -483
- package/dist/plugins/phone-number.d.ts +0 -483
- package/dist/plugins/phone-number.js +0 -15
- package/dist/plugins/sso.cjs +0 -566
- package/dist/plugins/sso.d.cts +0 -496
- package/dist/plugins/sso.d.ts +0 -496
- package/dist/plugins/sso.js +0 -564
- package/dist/plugins/two-factor.cjs +0 -31
- package/dist/plugins/two-factor.d.cts +0 -1394
- package/dist/plugins/two-factor.d.ts +0 -1394
- package/dist/plugins/two-factor.js +0 -18
- package/dist/plugins/username.cjs +0 -25
- package/dist/plugins/username.d.cts +0 -194
- package/dist/plugins/username.d.ts +0 -194
- package/dist/plugins/username.js +0 -16
- package/dist/plugins.cjs +0 -139
- package/dist/plugins.d.cts +0 -164
- package/dist/plugins.d.ts +0 -164
- package/dist/plugins.js +0 -42
- package/dist/react.cjs +0 -64
- package/dist/react.d.cts +0 -140
- package/dist/react.d.ts +0 -140
- package/dist/react.js +0 -60
- package/dist/social.cjs +0 -93
- package/dist/social.d.cts +0 -4
- package/dist/social.d.ts +0 -4
- package/dist/social.js +0 -8
- package/dist/solid-start.cjs +0 -14
- package/dist/solid-start.d.cts +0 -12
- package/dist/solid-start.d.ts +0 -12
- package/dist/solid-start.js +0 -12
- package/dist/solid.cjs +0 -56
- package/dist/solid.d.cts +0 -115
- package/dist/solid.d.ts +0 -115
- package/dist/solid.js +0 -54
- package/dist/state-C7IUhB_Z.d.cts +0 -22
- package/dist/state-D32_8TuF.d.ts +0 -22
- package/dist/svelte-kit.cjs +0 -38
- package/dist/svelte-kit.d.cts +0 -29
- package/dist/svelte-kit.d.ts +0 -29
- package/dist/svelte-kit.js +0 -34
- package/dist/svelte.cjs +0 -40
- package/dist/svelte.d.cts +0 -120
- package/dist/svelte.d.ts +0 -120
- package/dist/svelte.js +0 -38
- package/dist/types.cjs +0 -4
- package/dist/types.d.cts +0 -137
- package/dist/types.d.ts +0 -137
- package/dist/types.js +0 -1
- package/dist/vue.cjs +0 -85
- package/dist/vue.d.cts +0 -143
- package/dist/vue.d.ts +0 -143
- package/dist/vue.js +0 -83
- /package/dist/{chunk-NIMYOIVU.cjs → types/index.cjs} +0 -0
- /package/dist/{chunk-SK6Y2YH6.js → types/index.mjs} +0 -0
|
@@ -0,0 +1,1195 @@
|
|
|
1
|
+
import { betterFetch } from '@better-fetch/fetch';
|
|
2
|
+
import { APIError } from 'better-call';
|
|
3
|
+
import { decodeJwt, decodeProtectedHeader, jwtVerify, importJWK, createRemoteJWKSet } from 'jose';
|
|
4
|
+
import '@better-auth/utils/hash';
|
|
5
|
+
import { base64 } from '@better-auth/utils/base64';
|
|
6
|
+
import { v as validateAuthorizationCode, c as createAuthorizationURL, b as getOAuth2Tokens } from '../shared/better-auth.D7syfoJW.mjs';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import '@noble/ciphers/chacha';
|
|
9
|
+
import '@noble/ciphers/utils';
|
|
10
|
+
import '@noble/ciphers/webcrypto';
|
|
11
|
+
import '@noble/hashes/scrypt';
|
|
12
|
+
import '@better-auth/utils';
|
|
13
|
+
import '@better-auth/utils/hex';
|
|
14
|
+
import '@noble/hashes/utils';
|
|
15
|
+
import '../shared/better-auth.B4Qoxdgc.mjs';
|
|
16
|
+
import { B as BetterAuthError } from '../shared/better-auth.DdzSJf-n.mjs';
|
|
17
|
+
import { a as logger } from '../shared/better-auth.DH3YjMQH.mjs';
|
|
18
|
+
import '@better-auth/utils/random';
|
|
19
|
+
import '../shared/better-auth.CW6D9eSx.mjs';
|
|
20
|
+
|
|
21
|
+
const apple = (options) => {
|
|
22
|
+
const tokenEndpoint = "https://appleid.apple.com/auth/token";
|
|
23
|
+
return {
|
|
24
|
+
id: "apple",
|
|
25
|
+
name: "Apple",
|
|
26
|
+
createAuthorizationURL({ state, scopes, redirectURI }) {
|
|
27
|
+
const _scope = options.disableDefaultScope ? [] : ["email", "name"];
|
|
28
|
+
options.scope && _scope.push(...options.scope);
|
|
29
|
+
scopes && _scope.push(...scopes);
|
|
30
|
+
return new URL(
|
|
31
|
+
`https://appleid.apple.com/auth/authorize?client_id=${options.clientId}&response_type=code&redirect_uri=${options.redirectURI || redirectURI}&scope=${_scope.join(" ")}&state=${state}&response_mode=form_post`
|
|
32
|
+
);
|
|
33
|
+
},
|
|
34
|
+
validateAuthorizationCode: async ({ code, codeVerifier, redirectURI }) => {
|
|
35
|
+
return validateAuthorizationCode({
|
|
36
|
+
code,
|
|
37
|
+
codeVerifier,
|
|
38
|
+
redirectURI,
|
|
39
|
+
options,
|
|
40
|
+
tokenEndpoint
|
|
41
|
+
});
|
|
42
|
+
},
|
|
43
|
+
async verifyIdToken(token, nonce) {
|
|
44
|
+
if (options.disableIdTokenSignIn) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
if (options.verifyIdToken) {
|
|
48
|
+
return options.verifyIdToken(token, nonce);
|
|
49
|
+
}
|
|
50
|
+
const decodedHeader = decodeProtectedHeader(token);
|
|
51
|
+
const { kid, alg: jwtAlg } = decodedHeader;
|
|
52
|
+
if (!kid || !jwtAlg) return false;
|
|
53
|
+
const publicKey = await getApplePublicKey(kid);
|
|
54
|
+
const { payload: jwtClaims } = await jwtVerify(token, publicKey, {
|
|
55
|
+
algorithms: [jwtAlg],
|
|
56
|
+
issuer: "https://appleid.apple.com",
|
|
57
|
+
audience: options.appBundleIdentifier || options.clientId,
|
|
58
|
+
maxTokenAge: "1h"
|
|
59
|
+
});
|
|
60
|
+
["email_verified", "is_private_email"].forEach((field) => {
|
|
61
|
+
if (jwtClaims[field] !== void 0) {
|
|
62
|
+
jwtClaims[field] = Boolean(jwtClaims[field]);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
if (nonce && jwtClaims.nonce !== nonce) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
return !!jwtClaims;
|
|
69
|
+
},
|
|
70
|
+
async getUserInfo(token) {
|
|
71
|
+
if (options.getUserInfo) {
|
|
72
|
+
return options.getUserInfo(token);
|
|
73
|
+
}
|
|
74
|
+
if (!token.idToken) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
const profile = decodeJwt(token.idToken);
|
|
78
|
+
if (!profile) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
const name = profile.user ? `${profile.user.name.firstName} ${profile.user.name.lastName}` : profile.email;
|
|
82
|
+
const userMap = await options.mapProfileToUser?.(profile);
|
|
83
|
+
return {
|
|
84
|
+
user: {
|
|
85
|
+
id: profile.sub,
|
|
86
|
+
name,
|
|
87
|
+
emailVerified: false,
|
|
88
|
+
email: profile.email,
|
|
89
|
+
...userMap
|
|
90
|
+
},
|
|
91
|
+
data: profile
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
const getApplePublicKey = async (kid) => {
|
|
97
|
+
const APPLE_BASE_URL = "https://appleid.apple.com";
|
|
98
|
+
const JWKS_APPLE_URI = "/auth/keys";
|
|
99
|
+
const { data } = await betterFetch(`${APPLE_BASE_URL}${JWKS_APPLE_URI}`);
|
|
100
|
+
if (!data?.keys) {
|
|
101
|
+
throw new APIError("BAD_REQUEST", {
|
|
102
|
+
message: "Keys not found"
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
const jwk = data.keys.find((key) => key.kid === kid);
|
|
106
|
+
if (!jwk) {
|
|
107
|
+
throw new Error(`JWK with kid ${kid} not found`);
|
|
108
|
+
}
|
|
109
|
+
return await importJWK(jwk, jwk.alg);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
const discord = (options) => {
|
|
113
|
+
return {
|
|
114
|
+
id: "discord",
|
|
115
|
+
name: "Discord",
|
|
116
|
+
createAuthorizationURL({ state, scopes, redirectURI }) {
|
|
117
|
+
const _scopes = options.disableDefaultScope ? [] : ["identify", "email"];
|
|
118
|
+
scopes && _scopes.push(...scopes);
|
|
119
|
+
options.scope && _scopes.push(...options.scope);
|
|
120
|
+
return new URL(
|
|
121
|
+
`https://discord.com/api/oauth2/authorize?scope=${_scopes.join(
|
|
122
|
+
"+"
|
|
123
|
+
)}&response_type=code&client_id=${options.clientId}&redirect_uri=${encodeURIComponent(
|
|
124
|
+
options.redirectURI || redirectURI
|
|
125
|
+
)}&state=${state}&prompt=${options.prompt || "none"}`
|
|
126
|
+
);
|
|
127
|
+
},
|
|
128
|
+
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
129
|
+
return validateAuthorizationCode({
|
|
130
|
+
code,
|
|
131
|
+
redirectURI,
|
|
132
|
+
options,
|
|
133
|
+
tokenEndpoint: "https://discord.com/api/oauth2/token"
|
|
134
|
+
});
|
|
135
|
+
},
|
|
136
|
+
async getUserInfo(token) {
|
|
137
|
+
if (options.getUserInfo) {
|
|
138
|
+
return options.getUserInfo(token);
|
|
139
|
+
}
|
|
140
|
+
const { data: profile, error } = await betterFetch(
|
|
141
|
+
"https://discord.com/api/users/@me",
|
|
142
|
+
{
|
|
143
|
+
headers: {
|
|
144
|
+
authorization: `Bearer ${token.accessToken}`
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
if (error) {
|
|
149
|
+
return null;
|
|
150
|
+
}
|
|
151
|
+
if (profile.avatar === null) {
|
|
152
|
+
const defaultAvatarNumber = profile.discriminator === "0" ? Number(BigInt(profile.id) >> BigInt(22)) % 6 : parseInt(profile.discriminator) % 5;
|
|
153
|
+
profile.image_url = `https://cdn.discordapp.com/embed/avatars/${defaultAvatarNumber}.png`;
|
|
154
|
+
} else {
|
|
155
|
+
const format = profile.avatar.startsWith("a_") ? "gif" : "png";
|
|
156
|
+
profile.image_url = `https://cdn.discordapp.com/avatars/${profile.id}/${profile.avatar}.${format}`;
|
|
157
|
+
}
|
|
158
|
+
const userMap = await options.mapProfileToUser?.(profile);
|
|
159
|
+
return {
|
|
160
|
+
user: {
|
|
161
|
+
id: profile.id,
|
|
162
|
+
name: profile.display_name || profile.username || "",
|
|
163
|
+
email: profile.email,
|
|
164
|
+
emailVerified: profile.verified,
|
|
165
|
+
image: profile.image_url,
|
|
166
|
+
...userMap
|
|
167
|
+
},
|
|
168
|
+
data: profile
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
const facebook = (options) => {
|
|
175
|
+
return {
|
|
176
|
+
id: "facebook",
|
|
177
|
+
name: "Facebook",
|
|
178
|
+
async createAuthorizationURL({ state, scopes, redirectURI }) {
|
|
179
|
+
const _scopes = options.disableDefaultScope ? [] : ["email", "public_profile"];
|
|
180
|
+
options.scope && _scopes.push(...options.scope);
|
|
181
|
+
scopes && _scopes.push(...scopes);
|
|
182
|
+
return await createAuthorizationURL({
|
|
183
|
+
id: "facebook",
|
|
184
|
+
options,
|
|
185
|
+
authorizationEndpoint: "https://www.facebook.com/v21.0/dialog/oauth",
|
|
186
|
+
scopes: _scopes,
|
|
187
|
+
state,
|
|
188
|
+
redirectURI
|
|
189
|
+
});
|
|
190
|
+
},
|
|
191
|
+
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
192
|
+
return validateAuthorizationCode({
|
|
193
|
+
code,
|
|
194
|
+
redirectURI,
|
|
195
|
+
options,
|
|
196
|
+
tokenEndpoint: "https://graph.facebook.com/oauth/access_token"
|
|
197
|
+
});
|
|
198
|
+
},
|
|
199
|
+
async verifyIdToken(token, nonce) {
|
|
200
|
+
if (options.disableIdTokenSignIn) {
|
|
201
|
+
return false;
|
|
202
|
+
}
|
|
203
|
+
if (options.verifyIdToken) {
|
|
204
|
+
return options.verifyIdToken(token, nonce);
|
|
205
|
+
}
|
|
206
|
+
if (token.split(".").length) {
|
|
207
|
+
try {
|
|
208
|
+
const { payload: jwtClaims } = await jwtVerify(
|
|
209
|
+
token,
|
|
210
|
+
createRemoteJWKSet(
|
|
211
|
+
new URL("https://www.facebook.com/.well-known/oauth/openid/jwks")
|
|
212
|
+
),
|
|
213
|
+
{
|
|
214
|
+
algorithms: ["RS256"],
|
|
215
|
+
audience: options.clientId,
|
|
216
|
+
issuer: "https://www.facebook.com"
|
|
217
|
+
}
|
|
218
|
+
);
|
|
219
|
+
if (nonce && jwtClaims.nonce !== nonce) {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
return !!jwtClaims;
|
|
223
|
+
} catch (error) {
|
|
224
|
+
return false;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return true;
|
|
228
|
+
},
|
|
229
|
+
async getUserInfo(token) {
|
|
230
|
+
if (options.getUserInfo) {
|
|
231
|
+
return options.getUserInfo(token);
|
|
232
|
+
}
|
|
233
|
+
if (token.idToken) {
|
|
234
|
+
const profile2 = decodeJwt(token.idToken);
|
|
235
|
+
const user = {
|
|
236
|
+
id: profile2.sub,
|
|
237
|
+
name: profile2.name,
|
|
238
|
+
email: profile2.email,
|
|
239
|
+
picture: {
|
|
240
|
+
data: {
|
|
241
|
+
url: profile2.picture,
|
|
242
|
+
height: 100,
|
|
243
|
+
width: 100,
|
|
244
|
+
is_silhouette: false
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
const userMap2 = await options.mapProfileToUser?.({
|
|
249
|
+
...user,
|
|
250
|
+
email_verified: true
|
|
251
|
+
});
|
|
252
|
+
return {
|
|
253
|
+
user: {
|
|
254
|
+
...user,
|
|
255
|
+
emailVerified: true,
|
|
256
|
+
...userMap2
|
|
257
|
+
},
|
|
258
|
+
data: profile2
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
const fields = [
|
|
262
|
+
"id",
|
|
263
|
+
"name",
|
|
264
|
+
"email",
|
|
265
|
+
"picture",
|
|
266
|
+
...options?.fields || []
|
|
267
|
+
];
|
|
268
|
+
const { data: profile, error } = await betterFetch(
|
|
269
|
+
"https://graph.facebook.com/me?fields=" + fields.join(","),
|
|
270
|
+
{
|
|
271
|
+
auth: {
|
|
272
|
+
type: "Bearer",
|
|
273
|
+
token: token.accessToken
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
);
|
|
277
|
+
if (error) {
|
|
278
|
+
return null;
|
|
279
|
+
}
|
|
280
|
+
const userMap = await options.mapProfileToUser?.(profile);
|
|
281
|
+
return {
|
|
282
|
+
user: {
|
|
283
|
+
id: profile.id,
|
|
284
|
+
name: profile.name,
|
|
285
|
+
email: profile.email,
|
|
286
|
+
image: profile.picture.data.url,
|
|
287
|
+
emailVerified: profile.email_verified,
|
|
288
|
+
...userMap
|
|
289
|
+
},
|
|
290
|
+
data: profile
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
const github = (options) => {
|
|
297
|
+
const tokenEndpoint = "https://github.com/login/oauth/access_token";
|
|
298
|
+
return {
|
|
299
|
+
id: "github",
|
|
300
|
+
name: "GitHub",
|
|
301
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }) {
|
|
302
|
+
const _scopes = scopes || ["read:user", "user:email"];
|
|
303
|
+
options.scope && _scopes.push(...options.scope);
|
|
304
|
+
scopes && _scopes.push(...scopes);
|
|
305
|
+
return createAuthorizationURL({
|
|
306
|
+
id: "github",
|
|
307
|
+
options,
|
|
308
|
+
authorizationEndpoint: "https://github.com/login/oauth/authorize",
|
|
309
|
+
scopes: _scopes,
|
|
310
|
+
state,
|
|
311
|
+
redirectURI
|
|
312
|
+
});
|
|
313
|
+
},
|
|
314
|
+
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
315
|
+
return validateAuthorizationCode({
|
|
316
|
+
code,
|
|
317
|
+
redirectURI,
|
|
318
|
+
options,
|
|
319
|
+
tokenEndpoint
|
|
320
|
+
});
|
|
321
|
+
},
|
|
322
|
+
async getUserInfo(token) {
|
|
323
|
+
if (options.getUserInfo) {
|
|
324
|
+
return options.getUserInfo(token);
|
|
325
|
+
}
|
|
326
|
+
const { data: profile, error } = await betterFetch(
|
|
327
|
+
"https://api.github.com/user",
|
|
328
|
+
{
|
|
329
|
+
headers: {
|
|
330
|
+
"User-Agent": "better-auth",
|
|
331
|
+
authorization: `Bearer ${token.accessToken}`
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
);
|
|
335
|
+
if (error) {
|
|
336
|
+
return null;
|
|
337
|
+
}
|
|
338
|
+
let emailVerified = false;
|
|
339
|
+
if (!profile.email) {
|
|
340
|
+
const { data } = await betterFetch("https://api.github.com/user/emails", {
|
|
341
|
+
headers: {
|
|
342
|
+
Authorization: `Bearer ${token.accessToken}`,
|
|
343
|
+
"User-Agent": "better-auth"
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
if (data) {
|
|
347
|
+
profile.email = (data.find((e) => e.primary) ?? data[0])?.email;
|
|
348
|
+
emailVerified = data.find((e) => e.email === profile.email)?.verified ?? false;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
const userMap = await options.mapProfileToUser?.(profile);
|
|
352
|
+
return {
|
|
353
|
+
user: {
|
|
354
|
+
id: profile.id.toString(),
|
|
355
|
+
name: profile.name || profile.login,
|
|
356
|
+
email: profile.email,
|
|
357
|
+
image: profile.avatar_url,
|
|
358
|
+
emailVerified,
|
|
359
|
+
...userMap
|
|
360
|
+
},
|
|
361
|
+
data: profile
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
const google = (options) => {
|
|
368
|
+
return {
|
|
369
|
+
id: "google",
|
|
370
|
+
name: "Google",
|
|
371
|
+
async createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }) {
|
|
372
|
+
if (!options.clientId || !options.clientSecret) {
|
|
373
|
+
logger.error(
|
|
374
|
+
"Client Id and Client Secret is required for Google. Make sure to provide them in the options."
|
|
375
|
+
);
|
|
376
|
+
throw new BetterAuthError("CLIENT_ID_AND_SECRET_REQUIRED");
|
|
377
|
+
}
|
|
378
|
+
if (!codeVerifier) {
|
|
379
|
+
throw new BetterAuthError("codeVerifier is required for Google");
|
|
380
|
+
}
|
|
381
|
+
const _scopes = options.disableDefaultScope ? [] : ["email", "profile", "openid"];
|
|
382
|
+
options.scope && _scopes.push(...options.scope);
|
|
383
|
+
scopes && _scopes.push(...scopes);
|
|
384
|
+
const url = await createAuthorizationURL({
|
|
385
|
+
id: "google",
|
|
386
|
+
options,
|
|
387
|
+
authorizationEndpoint: "https://accounts.google.com/o/oauth2/auth",
|
|
388
|
+
scopes: _scopes,
|
|
389
|
+
state,
|
|
390
|
+
codeVerifier,
|
|
391
|
+
redirectURI
|
|
392
|
+
});
|
|
393
|
+
options.accessType && url.searchParams.set("access_type", options.accessType);
|
|
394
|
+
options.prompt && url.searchParams.set("prompt", options.prompt);
|
|
395
|
+
options.display && url.searchParams.set("display", options.display);
|
|
396
|
+
options.hd && url.searchParams.set("hd", options.hd);
|
|
397
|
+
return url;
|
|
398
|
+
},
|
|
399
|
+
validateAuthorizationCode: async ({ code, codeVerifier, redirectURI }) => {
|
|
400
|
+
return validateAuthorizationCode({
|
|
401
|
+
code,
|
|
402
|
+
codeVerifier,
|
|
403
|
+
redirectURI,
|
|
404
|
+
options,
|
|
405
|
+
tokenEndpoint: "https://oauth2.googleapis.com/token"
|
|
406
|
+
});
|
|
407
|
+
},
|
|
408
|
+
async verifyIdToken(token, nonce) {
|
|
409
|
+
if (options.disableIdTokenSignIn) {
|
|
410
|
+
return false;
|
|
411
|
+
}
|
|
412
|
+
if (options.verifyIdToken) {
|
|
413
|
+
return options.verifyIdToken(token, nonce);
|
|
414
|
+
}
|
|
415
|
+
const googlePublicKeyUrl = `https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=${token}`;
|
|
416
|
+
const { data: tokenInfo } = await betterFetch(googlePublicKeyUrl);
|
|
417
|
+
if (!tokenInfo) {
|
|
418
|
+
return false;
|
|
419
|
+
}
|
|
420
|
+
const isValid = tokenInfo.aud === options.clientId && (tokenInfo.iss === "https://accounts.google.com" || tokenInfo.iss === "accounts.google.com");
|
|
421
|
+
return isValid;
|
|
422
|
+
},
|
|
423
|
+
async getUserInfo(token) {
|
|
424
|
+
if (options.getUserInfo) {
|
|
425
|
+
return options.getUserInfo(token);
|
|
426
|
+
}
|
|
427
|
+
if (!token.idToken) {
|
|
428
|
+
return null;
|
|
429
|
+
}
|
|
430
|
+
const user = decodeJwt(token.idToken);
|
|
431
|
+
const userMap = await options.mapProfileToUser?.(user);
|
|
432
|
+
return {
|
|
433
|
+
user: {
|
|
434
|
+
id: user.sub,
|
|
435
|
+
name: user.name,
|
|
436
|
+
email: user.email,
|
|
437
|
+
image: user.picture,
|
|
438
|
+
emailVerified: user.email_verified,
|
|
439
|
+
...userMap
|
|
440
|
+
},
|
|
441
|
+
data: user
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
const microsoft = (options) => {
|
|
448
|
+
const tenant = options.tenantId || "common";
|
|
449
|
+
const authorizationEndpoint = `https://login.microsoftonline.com/${tenant}/oauth2/v2.0/authorize`;
|
|
450
|
+
const tokenEndpoint = `https://login.microsoftonline.com/${tenant}/oauth2/v2.0/token`;
|
|
451
|
+
return {
|
|
452
|
+
id: "microsoft",
|
|
453
|
+
name: "Microsoft EntraID",
|
|
454
|
+
createAuthorizationURL(data) {
|
|
455
|
+
const scopes = options.disableDefaultScope ? [] : ["openid", "profile", "email", "User.Read"];
|
|
456
|
+
options.scope && scopes.push(...options.scope);
|
|
457
|
+
data.scopes && scopes.push(...scopes);
|
|
458
|
+
return createAuthorizationURL({
|
|
459
|
+
id: "microsoft",
|
|
460
|
+
options,
|
|
461
|
+
authorizationEndpoint,
|
|
462
|
+
state: data.state,
|
|
463
|
+
codeVerifier: data.codeVerifier,
|
|
464
|
+
scopes,
|
|
465
|
+
redirectURI: data.redirectURI,
|
|
466
|
+
prompt: options.requireSelectAccount || false
|
|
467
|
+
});
|
|
468
|
+
},
|
|
469
|
+
validateAuthorizationCode({ code, codeVerifier, redirectURI }) {
|
|
470
|
+
return validateAuthorizationCode({
|
|
471
|
+
code,
|
|
472
|
+
codeVerifier,
|
|
473
|
+
redirectURI,
|
|
474
|
+
options,
|
|
475
|
+
tokenEndpoint
|
|
476
|
+
});
|
|
477
|
+
},
|
|
478
|
+
async getUserInfo(token) {
|
|
479
|
+
if (options.getUserInfo) {
|
|
480
|
+
return options.getUserInfo(token);
|
|
481
|
+
}
|
|
482
|
+
if (!token.idToken) {
|
|
483
|
+
return null;
|
|
484
|
+
}
|
|
485
|
+
const user = decodeJwt(token.idToken);
|
|
486
|
+
const profilePhotoSize = options.profilePhotoSize || 48;
|
|
487
|
+
await betterFetch(
|
|
488
|
+
`https://graph.microsoft.com/v1.0/me/photos/${profilePhotoSize}x${profilePhotoSize}/$value`,
|
|
489
|
+
{
|
|
490
|
+
headers: {
|
|
491
|
+
Authorization: `Bearer ${token.accessToken}`
|
|
492
|
+
},
|
|
493
|
+
async onResponse(context) {
|
|
494
|
+
if (options.disableProfilePhoto || !context.response.ok) {
|
|
495
|
+
return;
|
|
496
|
+
}
|
|
497
|
+
try {
|
|
498
|
+
const response = context.response.clone();
|
|
499
|
+
const pictureBuffer = await response.arrayBuffer();
|
|
500
|
+
const pictureBase64 = base64.encode(pictureBuffer);
|
|
501
|
+
user.picture = `data:image/jpeg;base64, ${pictureBase64}`;
|
|
502
|
+
} catch (e) {
|
|
503
|
+
logger.error(
|
|
504
|
+
e && typeof e === "object" && "name" in e ? e.name : "",
|
|
505
|
+
e
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
);
|
|
511
|
+
const userMap = await options.mapProfileToUser?.(user);
|
|
512
|
+
return {
|
|
513
|
+
user: {
|
|
514
|
+
id: user.sub,
|
|
515
|
+
name: user.name,
|
|
516
|
+
email: user.email,
|
|
517
|
+
image: user.picture,
|
|
518
|
+
emailVerified: true,
|
|
519
|
+
...userMap
|
|
520
|
+
},
|
|
521
|
+
data: user
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
|
|
527
|
+
const spotify = (options) => {
|
|
528
|
+
return {
|
|
529
|
+
id: "spotify",
|
|
530
|
+
name: "Spotify",
|
|
531
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }) {
|
|
532
|
+
const _scopes = options.disableDefaultScope ? [] : ["user-read-email"];
|
|
533
|
+
options.scope && _scopes.push(...options.scope);
|
|
534
|
+
scopes && _scopes.push(...scopes);
|
|
535
|
+
return createAuthorizationURL({
|
|
536
|
+
id: "spotify",
|
|
537
|
+
options,
|
|
538
|
+
authorizationEndpoint: "https://accounts.spotify.com/authorize",
|
|
539
|
+
scopes: _scopes,
|
|
540
|
+
state,
|
|
541
|
+
codeVerifier,
|
|
542
|
+
redirectURI
|
|
543
|
+
});
|
|
544
|
+
},
|
|
545
|
+
validateAuthorizationCode: async ({ code, codeVerifier, redirectURI }) => {
|
|
546
|
+
return validateAuthorizationCode({
|
|
547
|
+
code,
|
|
548
|
+
codeVerifier,
|
|
549
|
+
redirectURI,
|
|
550
|
+
options,
|
|
551
|
+
tokenEndpoint: "https://accounts.spotify.com/api/token"
|
|
552
|
+
});
|
|
553
|
+
},
|
|
554
|
+
async getUserInfo(token) {
|
|
555
|
+
if (options.getUserInfo) {
|
|
556
|
+
return options.getUserInfo(token);
|
|
557
|
+
}
|
|
558
|
+
const { data: profile, error } = await betterFetch(
|
|
559
|
+
"https://api.spotify.com/v1/me",
|
|
560
|
+
{
|
|
561
|
+
method: "GET",
|
|
562
|
+
headers: {
|
|
563
|
+
Authorization: `Bearer ${token.accessToken}`
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
);
|
|
567
|
+
if (error) {
|
|
568
|
+
return null;
|
|
569
|
+
}
|
|
570
|
+
const userMap = await options.mapProfileToUser?.(profile);
|
|
571
|
+
return {
|
|
572
|
+
user: {
|
|
573
|
+
id: profile.id,
|
|
574
|
+
name: profile.display_name,
|
|
575
|
+
email: profile.email,
|
|
576
|
+
image: profile.images[0]?.url,
|
|
577
|
+
emailVerified: false,
|
|
578
|
+
...userMap
|
|
579
|
+
},
|
|
580
|
+
data: profile
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
};
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
const twitch = (options) => {
|
|
587
|
+
return {
|
|
588
|
+
id: "twitch",
|
|
589
|
+
name: "Twitch",
|
|
590
|
+
createAuthorizationURL({ state, scopes, redirectURI }) {
|
|
591
|
+
const _scopes = options.disableDefaultScope ? [] : ["user:read:email", "openid"];
|
|
592
|
+
options.scope && _scopes.push(...options.scope);
|
|
593
|
+
scopes && _scopes.push(...scopes);
|
|
594
|
+
return createAuthorizationURL({
|
|
595
|
+
id: "twitch",
|
|
596
|
+
redirectURI,
|
|
597
|
+
options,
|
|
598
|
+
authorizationEndpoint: "https://id.twitch.tv/oauth2/authorize",
|
|
599
|
+
scopes: _scopes,
|
|
600
|
+
state,
|
|
601
|
+
claims: options.claims || [
|
|
602
|
+
"email",
|
|
603
|
+
"email_verified",
|
|
604
|
+
"preferred_username",
|
|
605
|
+
"picture"
|
|
606
|
+
]
|
|
607
|
+
});
|
|
608
|
+
},
|
|
609
|
+
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
610
|
+
return validateAuthorizationCode({
|
|
611
|
+
code,
|
|
612
|
+
redirectURI,
|
|
613
|
+
options,
|
|
614
|
+
tokenEndpoint: "https://id.twitch.tv/oauth2/token"
|
|
615
|
+
});
|
|
616
|
+
},
|
|
617
|
+
async getUserInfo(token) {
|
|
618
|
+
if (options.getUserInfo) {
|
|
619
|
+
return options.getUserInfo(token);
|
|
620
|
+
}
|
|
621
|
+
const idToken = token.idToken;
|
|
622
|
+
if (!idToken) {
|
|
623
|
+
logger.error("No idToken found in token");
|
|
624
|
+
return null;
|
|
625
|
+
}
|
|
626
|
+
const profile = decodeJwt(idToken);
|
|
627
|
+
const userMap = await options.mapProfileToUser?.(profile);
|
|
628
|
+
return {
|
|
629
|
+
user: {
|
|
630
|
+
id: profile.sub,
|
|
631
|
+
name: profile.preferred_username,
|
|
632
|
+
email: profile.email,
|
|
633
|
+
image: profile.picture,
|
|
634
|
+
emailVerified: false,
|
|
635
|
+
...userMap
|
|
636
|
+
},
|
|
637
|
+
data: profile
|
|
638
|
+
};
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
};
|
|
642
|
+
|
|
643
|
+
const twitter = (options) => {
|
|
644
|
+
return {
|
|
645
|
+
id: "twitter",
|
|
646
|
+
name: "Twitter",
|
|
647
|
+
createAuthorizationURL(data) {
|
|
648
|
+
const _scopes = options.disableDefaultScope ? [] : ["users.read", "tweet.read", "offline.access"];
|
|
649
|
+
options.scope && _scopes.push(...options.scope);
|
|
650
|
+
data.scopes && _scopes.push(...data.scopes);
|
|
651
|
+
return createAuthorizationURL({
|
|
652
|
+
id: "twitter",
|
|
653
|
+
options,
|
|
654
|
+
authorizationEndpoint: "https://x.com/i/oauth2/authorize",
|
|
655
|
+
scopes: _scopes,
|
|
656
|
+
state: data.state,
|
|
657
|
+
codeVerifier: data.codeVerifier,
|
|
658
|
+
redirectURI: data.redirectURI
|
|
659
|
+
});
|
|
660
|
+
},
|
|
661
|
+
validateAuthorizationCode: async ({ code, codeVerifier, redirectURI }) => {
|
|
662
|
+
return validateAuthorizationCode({
|
|
663
|
+
code,
|
|
664
|
+
codeVerifier,
|
|
665
|
+
authentication: "basic",
|
|
666
|
+
redirectURI,
|
|
667
|
+
options,
|
|
668
|
+
tokenEndpoint: "https://api.x.com/2/oauth2/token"
|
|
669
|
+
});
|
|
670
|
+
},
|
|
671
|
+
async getUserInfo(token) {
|
|
672
|
+
if (options.getUserInfo) {
|
|
673
|
+
return options.getUserInfo(token);
|
|
674
|
+
}
|
|
675
|
+
const { data: profile, error } = await betterFetch(
|
|
676
|
+
"https://api.x.com/2/users/me?user.fields=profile_image_url",
|
|
677
|
+
{
|
|
678
|
+
method: "GET",
|
|
679
|
+
headers: {
|
|
680
|
+
Authorization: `Bearer ${token.accessToken}`
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
);
|
|
684
|
+
if (error) {
|
|
685
|
+
return null;
|
|
686
|
+
}
|
|
687
|
+
const userMap = await options.mapProfileToUser?.(profile);
|
|
688
|
+
return {
|
|
689
|
+
user: {
|
|
690
|
+
id: profile.data.id,
|
|
691
|
+
name: profile.data.name,
|
|
692
|
+
email: profile.data.username || null,
|
|
693
|
+
image: profile.data.profile_image_url,
|
|
694
|
+
emailVerified: profile.data.verified || false,
|
|
695
|
+
...userMap
|
|
696
|
+
},
|
|
697
|
+
data: profile
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
const dropbox = (options) => {
|
|
704
|
+
const tokenEndpoint = "https://api.dropboxapi.com/oauth2/token";
|
|
705
|
+
return {
|
|
706
|
+
id: "dropbox",
|
|
707
|
+
name: "Dropbox",
|
|
708
|
+
createAuthorizationURL: async ({
|
|
709
|
+
state,
|
|
710
|
+
scopes,
|
|
711
|
+
codeVerifier,
|
|
712
|
+
redirectURI
|
|
713
|
+
}) => {
|
|
714
|
+
const _scopes = options.disableDefaultScope ? [] : ["account_info.read"];
|
|
715
|
+
options.scope && _scopes.push(...options.scope);
|
|
716
|
+
scopes && _scopes.push(...scopes);
|
|
717
|
+
return await createAuthorizationURL({
|
|
718
|
+
id: "dropbox",
|
|
719
|
+
options,
|
|
720
|
+
authorizationEndpoint: "https://www.dropbox.com/oauth2/authorize",
|
|
721
|
+
scopes: _scopes,
|
|
722
|
+
state,
|
|
723
|
+
redirectURI,
|
|
724
|
+
codeVerifier
|
|
725
|
+
});
|
|
726
|
+
},
|
|
727
|
+
validateAuthorizationCode: async ({ code, codeVerifier, redirectURI }) => {
|
|
728
|
+
return await validateAuthorizationCode({
|
|
729
|
+
code,
|
|
730
|
+
codeVerifier,
|
|
731
|
+
redirectURI,
|
|
732
|
+
options,
|
|
733
|
+
tokenEndpoint
|
|
734
|
+
});
|
|
735
|
+
},
|
|
736
|
+
async getUserInfo(token) {
|
|
737
|
+
if (options.getUserInfo) {
|
|
738
|
+
return options.getUserInfo(token);
|
|
739
|
+
}
|
|
740
|
+
const { data: profile, error } = await betterFetch(
|
|
741
|
+
"https://api.dropboxapi.com/2/users/get_current_account",
|
|
742
|
+
{
|
|
743
|
+
method: "POST",
|
|
744
|
+
headers: {
|
|
745
|
+
Authorization: `Bearer ${token.accessToken}`
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
);
|
|
749
|
+
if (error) {
|
|
750
|
+
return null;
|
|
751
|
+
}
|
|
752
|
+
const userMap = await options.mapProfileToUser?.(profile);
|
|
753
|
+
return {
|
|
754
|
+
user: {
|
|
755
|
+
id: profile.account_id,
|
|
756
|
+
name: profile.name?.display_name,
|
|
757
|
+
email: profile.email,
|
|
758
|
+
emailVerified: profile.email_verified || false,
|
|
759
|
+
image: profile.profile_photo_url,
|
|
760
|
+
...userMap
|
|
761
|
+
},
|
|
762
|
+
data: profile
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
};
|
|
766
|
+
};
|
|
767
|
+
|
|
768
|
+
const linkedin = (options) => {
|
|
769
|
+
const authorizationEndpoint = "https://www.linkedin.com/oauth/v2/authorization";
|
|
770
|
+
const tokenEndpoint = "https://www.linkedin.com/oauth/v2/accessToken";
|
|
771
|
+
return {
|
|
772
|
+
id: "linkedin",
|
|
773
|
+
name: "Linkedin",
|
|
774
|
+
createAuthorizationURL: async ({ state, scopes, redirectURI }) => {
|
|
775
|
+
const _scopes = options.disableDefaultScope ? [] : ["profile", "email", "openid"];
|
|
776
|
+
options.scope && _scopes.push(...options.scope);
|
|
777
|
+
scopes && _scopes.push(...scopes);
|
|
778
|
+
return await createAuthorizationURL({
|
|
779
|
+
id: "linkedin",
|
|
780
|
+
options,
|
|
781
|
+
authorizationEndpoint,
|
|
782
|
+
scopes: _scopes,
|
|
783
|
+
state,
|
|
784
|
+
redirectURI
|
|
785
|
+
});
|
|
786
|
+
},
|
|
787
|
+
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
788
|
+
return await validateAuthorizationCode({
|
|
789
|
+
code,
|
|
790
|
+
redirectURI,
|
|
791
|
+
options,
|
|
792
|
+
tokenEndpoint
|
|
793
|
+
});
|
|
794
|
+
},
|
|
795
|
+
async getUserInfo(token) {
|
|
796
|
+
const { data: profile, error } = await betterFetch(
|
|
797
|
+
"https://api.linkedin.com/v2/userinfo",
|
|
798
|
+
{
|
|
799
|
+
method: "GET",
|
|
800
|
+
headers: {
|
|
801
|
+
Authorization: `Bearer ${token.accessToken}`
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
);
|
|
805
|
+
if (error) {
|
|
806
|
+
return null;
|
|
807
|
+
}
|
|
808
|
+
const userMap = await options.mapProfileToUser?.(profile);
|
|
809
|
+
return {
|
|
810
|
+
user: {
|
|
811
|
+
id: profile.sub,
|
|
812
|
+
name: profile.name,
|
|
813
|
+
email: profile.email,
|
|
814
|
+
emailVerified: profile.email_verified || false,
|
|
815
|
+
image: profile.picture,
|
|
816
|
+
...userMap
|
|
817
|
+
},
|
|
818
|
+
data: profile
|
|
819
|
+
};
|
|
820
|
+
}
|
|
821
|
+
};
|
|
822
|
+
};
|
|
823
|
+
|
|
824
|
+
const cleanDoubleSlashes = (input = "") => {
|
|
825
|
+
return input.split("://").map((str) => str.replace(/\/{2,}/g, "/")).join("://");
|
|
826
|
+
};
|
|
827
|
+
const issuerToEndpoints = (issuer) => {
|
|
828
|
+
let baseUrl = issuer || "https://gitlab.com";
|
|
829
|
+
return {
|
|
830
|
+
authorizationEndpoint: cleanDoubleSlashes(`${baseUrl}/oauth/authorize`),
|
|
831
|
+
tokenEndpoint: cleanDoubleSlashes(`${baseUrl}/oauth/token`),
|
|
832
|
+
userinfoEndpoint: cleanDoubleSlashes(`${baseUrl}/api/v4/user`)
|
|
833
|
+
};
|
|
834
|
+
};
|
|
835
|
+
const gitlab = (options) => {
|
|
836
|
+
const { authorizationEndpoint, tokenEndpoint, userinfoEndpoint } = issuerToEndpoints(options.issuer);
|
|
837
|
+
const issuerId = "gitlab";
|
|
838
|
+
const issuerName = "Gitlab";
|
|
839
|
+
return {
|
|
840
|
+
id: issuerId,
|
|
841
|
+
name: issuerName,
|
|
842
|
+
createAuthorizationURL: async ({
|
|
843
|
+
state,
|
|
844
|
+
scopes,
|
|
845
|
+
codeVerifier,
|
|
846
|
+
redirectURI
|
|
847
|
+
}) => {
|
|
848
|
+
const _scopes = options.disableDefaultScope ? [] : ["read_user"];
|
|
849
|
+
options.scope && _scopes.push(...options.scope);
|
|
850
|
+
scopes && _scopes.push(...scopes);
|
|
851
|
+
return await createAuthorizationURL({
|
|
852
|
+
id: issuerId,
|
|
853
|
+
options,
|
|
854
|
+
authorizationEndpoint,
|
|
855
|
+
scopes: _scopes,
|
|
856
|
+
state,
|
|
857
|
+
redirectURI,
|
|
858
|
+
codeVerifier
|
|
859
|
+
});
|
|
860
|
+
},
|
|
861
|
+
validateAuthorizationCode: async ({ code, redirectURI, codeVerifier }) => {
|
|
862
|
+
return validateAuthorizationCode({
|
|
863
|
+
code,
|
|
864
|
+
redirectURI,
|
|
865
|
+
options,
|
|
866
|
+
codeVerifier,
|
|
867
|
+
tokenEndpoint
|
|
868
|
+
});
|
|
869
|
+
},
|
|
870
|
+
async getUserInfo(token) {
|
|
871
|
+
if (options.getUserInfo) {
|
|
872
|
+
return options.getUserInfo(token);
|
|
873
|
+
}
|
|
874
|
+
const { data: profile, error } = await betterFetch(
|
|
875
|
+
userinfoEndpoint,
|
|
876
|
+
{ headers: { authorization: `Bearer ${token.accessToken}` } }
|
|
877
|
+
);
|
|
878
|
+
if (error || profile.state !== "active" || profile.locked) {
|
|
879
|
+
return null;
|
|
880
|
+
}
|
|
881
|
+
const userMap = await options.mapProfileToUser?.(profile);
|
|
882
|
+
return {
|
|
883
|
+
user: {
|
|
884
|
+
id: profile.id.toString(),
|
|
885
|
+
name: profile.name ?? profile.username,
|
|
886
|
+
email: profile.email,
|
|
887
|
+
image: profile.avatar_url,
|
|
888
|
+
emailVerified: true,
|
|
889
|
+
...userMap
|
|
890
|
+
},
|
|
891
|
+
data: profile
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
};
|
|
896
|
+
|
|
897
|
+
const tiktok = (options) => {
|
|
898
|
+
return {
|
|
899
|
+
id: "tiktok",
|
|
900
|
+
name: "TikTok",
|
|
901
|
+
createAuthorizationURL({ state, scopes, redirectURI }) {
|
|
902
|
+
const _scopes = scopes || ["user.info.profile"];
|
|
903
|
+
options.scope && _scopes.push(...options.scope);
|
|
904
|
+
return new URL(
|
|
905
|
+
`https://www.tiktok.com/v2/auth/authorize?scope=${_scopes.join(
|
|
906
|
+
","
|
|
907
|
+
)}&response_type=code&client_key=${options.clientKey}&client_secret=${options.clientSecret}&redirect_uri=${encodeURIComponent(
|
|
908
|
+
options.redirectURI || redirectURI
|
|
909
|
+
)}&state=${state}`
|
|
910
|
+
);
|
|
911
|
+
},
|
|
912
|
+
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
913
|
+
return validateAuthorizationCode({
|
|
914
|
+
code,
|
|
915
|
+
redirectURI: options.redirectURI || redirectURI,
|
|
916
|
+
options,
|
|
917
|
+
tokenEndpoint: "https://open.tiktokapis.com/v2/oauth/token/"
|
|
918
|
+
});
|
|
919
|
+
},
|
|
920
|
+
async getUserInfo(token) {
|
|
921
|
+
const fields = [
|
|
922
|
+
"open_id",
|
|
923
|
+
"avatar_large_url",
|
|
924
|
+
"display_name",
|
|
925
|
+
"username"
|
|
926
|
+
];
|
|
927
|
+
const { data: profile, error } = await betterFetch(
|
|
928
|
+
`https://open.tiktokapis.com/v2/user/info/?fields=${fields.join(",")}`,
|
|
929
|
+
{
|
|
930
|
+
headers: {
|
|
931
|
+
authorization: `Bearer ${token.accessToken}`
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
);
|
|
935
|
+
if (error) {
|
|
936
|
+
return null;
|
|
937
|
+
}
|
|
938
|
+
return {
|
|
939
|
+
user: {
|
|
940
|
+
email: profile.data.user.email || profile.data.user.username,
|
|
941
|
+
id: profile.data.user.open_id,
|
|
942
|
+
name: profile.data.user.display_name || profile.data.user.username,
|
|
943
|
+
image: profile.data.user.avatar_large_url,
|
|
944
|
+
/** @note Tiktok does not provide emailVerified or even email*/
|
|
945
|
+
emailVerified: profile.data.user.email ? true : false
|
|
946
|
+
},
|
|
947
|
+
data: profile
|
|
948
|
+
};
|
|
949
|
+
}
|
|
950
|
+
};
|
|
951
|
+
};
|
|
952
|
+
|
|
953
|
+
const reddit = (options) => {
|
|
954
|
+
return {
|
|
955
|
+
id: "reddit",
|
|
956
|
+
name: "Reddit",
|
|
957
|
+
createAuthorizationURL({ state, scopes, redirectURI }) {
|
|
958
|
+
const _scopes = options.disableDefaultScope ? [] : ["identity"];
|
|
959
|
+
options.scope && _scopes.push(...options.scope);
|
|
960
|
+
scopes && _scopes.push(...scopes);
|
|
961
|
+
return createAuthorizationURL({
|
|
962
|
+
id: "reddit",
|
|
963
|
+
options,
|
|
964
|
+
authorizationEndpoint: "https://www.reddit.com/api/v1/authorize",
|
|
965
|
+
scopes: _scopes,
|
|
966
|
+
state,
|
|
967
|
+
redirectURI,
|
|
968
|
+
duration: options.duration
|
|
969
|
+
});
|
|
970
|
+
},
|
|
971
|
+
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
972
|
+
const body = new URLSearchParams({
|
|
973
|
+
grant_type: "authorization_code",
|
|
974
|
+
code,
|
|
975
|
+
redirect_uri: options.redirectURI || redirectURI
|
|
976
|
+
});
|
|
977
|
+
const headers = {
|
|
978
|
+
"content-type": "application/x-www-form-urlencoded",
|
|
979
|
+
accept: "text/plain",
|
|
980
|
+
"user-agent": "better-auth",
|
|
981
|
+
Authorization: `Basic ${base64.encode(
|
|
982
|
+
`${options.clientId}:${options.clientSecret}`
|
|
983
|
+
)}`
|
|
984
|
+
};
|
|
985
|
+
const { data, error } = await betterFetch(
|
|
986
|
+
"https://www.reddit.com/api/v1/access_token",
|
|
987
|
+
{
|
|
988
|
+
method: "POST",
|
|
989
|
+
headers,
|
|
990
|
+
body: body.toString()
|
|
991
|
+
}
|
|
992
|
+
);
|
|
993
|
+
if (error) {
|
|
994
|
+
throw error;
|
|
995
|
+
}
|
|
996
|
+
return getOAuth2Tokens(data);
|
|
997
|
+
},
|
|
998
|
+
async getUserInfo(token) {
|
|
999
|
+
if (options.getUserInfo) {
|
|
1000
|
+
return options.getUserInfo(token);
|
|
1001
|
+
}
|
|
1002
|
+
const { data: profile, error } = await betterFetch(
|
|
1003
|
+
"https://oauth.reddit.com/api/v1/me",
|
|
1004
|
+
{
|
|
1005
|
+
headers: {
|
|
1006
|
+
Authorization: `Bearer ${token.accessToken}`,
|
|
1007
|
+
"User-Agent": "better-auth"
|
|
1008
|
+
}
|
|
1009
|
+
}
|
|
1010
|
+
);
|
|
1011
|
+
if (error) {
|
|
1012
|
+
return null;
|
|
1013
|
+
}
|
|
1014
|
+
const userMap = await options.mapProfileToUser?.(profile);
|
|
1015
|
+
return {
|
|
1016
|
+
user: {
|
|
1017
|
+
id: profile.id,
|
|
1018
|
+
name: profile.name,
|
|
1019
|
+
email: profile.oauth_client_id,
|
|
1020
|
+
emailVerified: profile.has_verified_email,
|
|
1021
|
+
image: profile.icon_img?.split("?")[0],
|
|
1022
|
+
...userMap
|
|
1023
|
+
},
|
|
1024
|
+
data: profile
|
|
1025
|
+
};
|
|
1026
|
+
}
|
|
1027
|
+
};
|
|
1028
|
+
};
|
|
1029
|
+
|
|
1030
|
+
const roblox = (options) => {
|
|
1031
|
+
return {
|
|
1032
|
+
id: "roblox",
|
|
1033
|
+
name: "Roblox",
|
|
1034
|
+
createAuthorizationURL({ state, scopes, redirectURI }) {
|
|
1035
|
+
const _scopes = scopes || ["openid", "profile"];
|
|
1036
|
+
options.scope && _scopes.push(...options.scope);
|
|
1037
|
+
return new URL(
|
|
1038
|
+
`https://apis.roblox.com/oauth/v1/authorize?scope=${_scopes.join(
|
|
1039
|
+
"+"
|
|
1040
|
+
)}&response_type=code&client_id=${options.clientId}&redirect_uri=${encodeURIComponent(
|
|
1041
|
+
options.redirectURI || redirectURI
|
|
1042
|
+
)}&state=${state}&prompt=${options.prompt || "select_account+consent"}`
|
|
1043
|
+
);
|
|
1044
|
+
},
|
|
1045
|
+
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
1046
|
+
return validateAuthorizationCode({
|
|
1047
|
+
code,
|
|
1048
|
+
redirectURI: options.redirectURI || redirectURI,
|
|
1049
|
+
options,
|
|
1050
|
+
tokenEndpoint: "https://apis.roblox.com/oauth/v1/token",
|
|
1051
|
+
authentication: "post"
|
|
1052
|
+
});
|
|
1053
|
+
},
|
|
1054
|
+
async getUserInfo(token) {
|
|
1055
|
+
if (options.getUserInfo) {
|
|
1056
|
+
return options.getUserInfo(token);
|
|
1057
|
+
}
|
|
1058
|
+
const { data: profile, error } = await betterFetch(
|
|
1059
|
+
"https://apis.roblox.com/oauth/v1/userinfo",
|
|
1060
|
+
{
|
|
1061
|
+
headers: {
|
|
1062
|
+
authorization: `Bearer ${token.accessToken}`
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
);
|
|
1066
|
+
if (error) {
|
|
1067
|
+
return null;
|
|
1068
|
+
}
|
|
1069
|
+
return {
|
|
1070
|
+
user: {
|
|
1071
|
+
id: profile.sub,
|
|
1072
|
+
name: profile.nickname || profile.preferred_username || "",
|
|
1073
|
+
image: profile.picture,
|
|
1074
|
+
email: profile.preferred_username || null,
|
|
1075
|
+
// Roblox does not provide email
|
|
1076
|
+
emailVerified: true
|
|
1077
|
+
},
|
|
1078
|
+
data: {
|
|
1079
|
+
...profile
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1082
|
+
}
|
|
1083
|
+
};
|
|
1084
|
+
};
|
|
1085
|
+
|
|
1086
|
+
var LANG = /* @__PURE__ */ ((LANG2) => {
|
|
1087
|
+
LANG2[LANG2["RUS"] = 0] = "RUS";
|
|
1088
|
+
LANG2[LANG2["UKR"] = 1] = "UKR";
|
|
1089
|
+
LANG2[LANG2["ENG"] = 3] = "ENG";
|
|
1090
|
+
LANG2[LANG2["SPA"] = 4] = "SPA";
|
|
1091
|
+
LANG2[LANG2["GERMAN"] = 6] = "GERMAN";
|
|
1092
|
+
LANG2[LANG2["POL"] = 15] = "POL";
|
|
1093
|
+
LANG2[LANG2["FRA"] = 16] = "FRA";
|
|
1094
|
+
LANG2[LANG2["TURKEY"] = 82] = "TURKEY";
|
|
1095
|
+
return LANG2;
|
|
1096
|
+
})(LANG || {});
|
|
1097
|
+
const vk = (options) => {
|
|
1098
|
+
return {
|
|
1099
|
+
id: "vk",
|
|
1100
|
+
name: "VK",
|
|
1101
|
+
async createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }) {
|
|
1102
|
+
const _scopes = scopes || ["email", "phone"];
|
|
1103
|
+
options.scope && _scopes.push(...options.scope);
|
|
1104
|
+
const authorizationEndpoint = "https://id.vk.com/authorize";
|
|
1105
|
+
return createAuthorizationURL({
|
|
1106
|
+
id: "vk",
|
|
1107
|
+
options,
|
|
1108
|
+
authorizationEndpoint,
|
|
1109
|
+
scopes: _scopes,
|
|
1110
|
+
state,
|
|
1111
|
+
redirectURI,
|
|
1112
|
+
codeVerifier
|
|
1113
|
+
});
|
|
1114
|
+
},
|
|
1115
|
+
validateAuthorizationCode: async ({
|
|
1116
|
+
code,
|
|
1117
|
+
codeVerifier,
|
|
1118
|
+
redirectURI,
|
|
1119
|
+
deviceId
|
|
1120
|
+
}) => {
|
|
1121
|
+
return validateAuthorizationCode({
|
|
1122
|
+
code,
|
|
1123
|
+
codeVerifier,
|
|
1124
|
+
redirectURI: options.redirectURI || redirectURI,
|
|
1125
|
+
options,
|
|
1126
|
+
deviceId,
|
|
1127
|
+
tokenEndpoint: "https://id.vk.com/oauth2/auth"
|
|
1128
|
+
});
|
|
1129
|
+
},
|
|
1130
|
+
async getUserInfo(data) {
|
|
1131
|
+
if (!data.accessToken) {
|
|
1132
|
+
return null;
|
|
1133
|
+
}
|
|
1134
|
+
const formBody = new URLSearchParams({
|
|
1135
|
+
access_token: data.accessToken,
|
|
1136
|
+
client_id: options.clientId
|
|
1137
|
+
}).toString();
|
|
1138
|
+
const { data: profile, error } = await betterFetch(
|
|
1139
|
+
"https://id.vk.com/oauth2/user_info",
|
|
1140
|
+
{
|
|
1141
|
+
method: "POST",
|
|
1142
|
+
headers: {
|
|
1143
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
1144
|
+
},
|
|
1145
|
+
body: formBody
|
|
1146
|
+
}
|
|
1147
|
+
);
|
|
1148
|
+
if (error) {
|
|
1149
|
+
return null;
|
|
1150
|
+
}
|
|
1151
|
+
if (!profile.user.email) {
|
|
1152
|
+
return null;
|
|
1153
|
+
}
|
|
1154
|
+
return {
|
|
1155
|
+
user: {
|
|
1156
|
+
id: profile.user.user_id,
|
|
1157
|
+
first_name: profile.user.first_name,
|
|
1158
|
+
last_name: profile.user.last_name,
|
|
1159
|
+
email: profile.user.email,
|
|
1160
|
+
image: profile.user.avatar,
|
|
1161
|
+
/** @note VK does not provide emailVerified*/
|
|
1162
|
+
emailVerified: !!profile.user.email,
|
|
1163
|
+
birthday: profile.user.birthday,
|
|
1164
|
+
sex: profile.user.sex
|
|
1165
|
+
},
|
|
1166
|
+
data: profile
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
};
|
|
1170
|
+
};
|
|
1171
|
+
|
|
1172
|
+
const socialProviders = {
|
|
1173
|
+
apple,
|
|
1174
|
+
discord,
|
|
1175
|
+
facebook,
|
|
1176
|
+
github,
|
|
1177
|
+
microsoft,
|
|
1178
|
+
google,
|
|
1179
|
+
spotify,
|
|
1180
|
+
twitch,
|
|
1181
|
+
twitter,
|
|
1182
|
+
dropbox,
|
|
1183
|
+
linkedin,
|
|
1184
|
+
gitlab,
|
|
1185
|
+
tiktok,
|
|
1186
|
+
reddit,
|
|
1187
|
+
roblox,
|
|
1188
|
+
vk
|
|
1189
|
+
};
|
|
1190
|
+
const socialProviderList = Object.keys(socialProviders);
|
|
1191
|
+
const SocialProviderListEnum = z.enum(socialProviderList, {
|
|
1192
|
+
description: "OAuth2 provider to use"
|
|
1193
|
+
});
|
|
1194
|
+
|
|
1195
|
+
export { LANG, SocialProviderListEnum, apple, discord, dropbox, facebook, getApplePublicKey, github, gitlab, google, linkedin, microsoft, reddit, roblox, socialProviderList, socialProviders, spotify, tiktok, twitch, twitter, vk };
|