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
package/dist/chunk-M5XMVH2M.js
DELETED
|
@@ -1,1114 +0,0 @@
|
|
|
1
|
-
import { validateAuthorizationCode, createAuthorizationURL, getOAuth2Tokens } from './chunk-R42K7GPF.js';
|
|
2
|
-
import { logger } from './chunk-KLDFBLYL.js';
|
|
3
|
-
import { BetterAuthError } from './chunk-UNWCXKMP.js';
|
|
4
|
-
import { betterFetch } from '@better-fetch/fetch';
|
|
5
|
-
import { APIError } from 'better-call';
|
|
6
|
-
import { decodeProtectedHeader, jwtVerify, decodeJwt, importJWK, createRemoteJWKSet } from 'jose';
|
|
7
|
-
import { base64 } from '@better-auth/utils/base64';
|
|
8
|
-
import { z } from 'zod';
|
|
9
|
-
|
|
10
|
-
var apple = (options) => {
|
|
11
|
-
const tokenEndpoint = "https://appleid.apple.com/auth/token";
|
|
12
|
-
return {
|
|
13
|
-
id: "apple",
|
|
14
|
-
name: "Apple",
|
|
15
|
-
createAuthorizationURL({ state, scopes, redirectURI }) {
|
|
16
|
-
const _scope = options.disableDefaultScope ? [] : ["email", "name"];
|
|
17
|
-
options.scope && _scope.push(...options.scope);
|
|
18
|
-
scopes && _scope.push(...scopes);
|
|
19
|
-
return new URL(
|
|
20
|
-
`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`
|
|
21
|
-
);
|
|
22
|
-
},
|
|
23
|
-
validateAuthorizationCode: async ({ code, codeVerifier, redirectURI }) => {
|
|
24
|
-
return validateAuthorizationCode({
|
|
25
|
-
code,
|
|
26
|
-
codeVerifier,
|
|
27
|
-
redirectURI,
|
|
28
|
-
options,
|
|
29
|
-
tokenEndpoint
|
|
30
|
-
});
|
|
31
|
-
},
|
|
32
|
-
async verifyIdToken(token, nonce) {
|
|
33
|
-
if (options.disableIdTokenSignIn) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
if (options.verifyIdToken) {
|
|
37
|
-
return options.verifyIdToken(token, nonce);
|
|
38
|
-
}
|
|
39
|
-
const decodedHeader = decodeProtectedHeader(token);
|
|
40
|
-
const { kid, alg: jwtAlg } = decodedHeader;
|
|
41
|
-
if (!kid || !jwtAlg) return false;
|
|
42
|
-
const publicKey = await getApplePublicKey(kid);
|
|
43
|
-
const { payload: jwtClaims } = await jwtVerify(token, publicKey, {
|
|
44
|
-
algorithms: [jwtAlg],
|
|
45
|
-
issuer: "https://appleid.apple.com",
|
|
46
|
-
audience: options.appBundleIdentifier || options.clientId,
|
|
47
|
-
maxTokenAge: "1h"
|
|
48
|
-
});
|
|
49
|
-
["email_verified", "is_private_email"].forEach((field) => {
|
|
50
|
-
if (jwtClaims[field] !== undefined) {
|
|
51
|
-
jwtClaims[field] = Boolean(jwtClaims[field]);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
if (nonce && jwtClaims.nonce !== nonce) {
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
return !!jwtClaims;
|
|
58
|
-
},
|
|
59
|
-
async getUserInfo(token) {
|
|
60
|
-
if (options.getUserInfo) {
|
|
61
|
-
return options.getUserInfo(token);
|
|
62
|
-
}
|
|
63
|
-
if (!token.idToken) {
|
|
64
|
-
return null;
|
|
65
|
-
}
|
|
66
|
-
const profile = decodeJwt(token.idToken);
|
|
67
|
-
if (!profile) {
|
|
68
|
-
return null;
|
|
69
|
-
}
|
|
70
|
-
const name = profile.user ? `${profile.user.name.firstName} ${profile.user.name.lastName}` : profile.email;
|
|
71
|
-
const userMap = await options.mapProfileToUser?.(profile);
|
|
72
|
-
return {
|
|
73
|
-
user: {
|
|
74
|
-
id: profile.sub,
|
|
75
|
-
name,
|
|
76
|
-
emailVerified: false,
|
|
77
|
-
email: profile.email,
|
|
78
|
-
...userMap
|
|
79
|
-
},
|
|
80
|
-
data: profile
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
};
|
|
85
|
-
var getApplePublicKey = async (kid) => {
|
|
86
|
-
const APPLE_BASE_URL = "https://appleid.apple.com";
|
|
87
|
-
const JWKS_APPLE_URI = "/auth/keys";
|
|
88
|
-
const { data } = await betterFetch(`${APPLE_BASE_URL}${JWKS_APPLE_URI}`);
|
|
89
|
-
if (!data?.keys) {
|
|
90
|
-
throw new APIError("BAD_REQUEST", {
|
|
91
|
-
message: "Keys not found"
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
const jwk = data.keys.find((key) => key.kid === kid);
|
|
95
|
-
if (!jwk) {
|
|
96
|
-
throw new Error(`JWK with kid ${kid} not found`);
|
|
97
|
-
}
|
|
98
|
-
return await importJWK(jwk, jwk.alg);
|
|
99
|
-
};
|
|
100
|
-
var discord = (options) => {
|
|
101
|
-
return {
|
|
102
|
-
id: "discord",
|
|
103
|
-
name: "Discord",
|
|
104
|
-
createAuthorizationURL({ state, scopes, redirectURI }) {
|
|
105
|
-
const _scopes = options.disableDefaultScope ? [] : ["identify", "email"];
|
|
106
|
-
scopes && _scopes.push(...scopes);
|
|
107
|
-
options.scope && _scopes.push(...options.scope);
|
|
108
|
-
return new URL(
|
|
109
|
-
`https://discord.com/api/oauth2/authorize?scope=${_scopes.join(
|
|
110
|
-
"+"
|
|
111
|
-
)}&response_type=code&client_id=${options.clientId}&redirect_uri=${encodeURIComponent(
|
|
112
|
-
options.redirectURI || redirectURI
|
|
113
|
-
)}&state=${state}&prompt=${options.prompt || "none"}`
|
|
114
|
-
);
|
|
115
|
-
},
|
|
116
|
-
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
117
|
-
return validateAuthorizationCode({
|
|
118
|
-
code,
|
|
119
|
-
redirectURI,
|
|
120
|
-
options,
|
|
121
|
-
tokenEndpoint: "https://discord.com/api/oauth2/token"
|
|
122
|
-
});
|
|
123
|
-
},
|
|
124
|
-
async getUserInfo(token) {
|
|
125
|
-
if (options.getUserInfo) {
|
|
126
|
-
return options.getUserInfo(token);
|
|
127
|
-
}
|
|
128
|
-
const { data: profile, error } = await betterFetch(
|
|
129
|
-
"https://discord.com/api/users/@me",
|
|
130
|
-
{
|
|
131
|
-
headers: {
|
|
132
|
-
authorization: `Bearer ${token.accessToken}`
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
);
|
|
136
|
-
if (error) {
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
if (profile.avatar === null) {
|
|
140
|
-
const defaultAvatarNumber = profile.discriminator === "0" ? Number(BigInt(profile.id) >> BigInt(22)) % 6 : parseInt(profile.discriminator) % 5;
|
|
141
|
-
profile.image_url = `https://cdn.discordapp.com/embed/avatars/${defaultAvatarNumber}.png`;
|
|
142
|
-
} else {
|
|
143
|
-
const format = profile.avatar.startsWith("a_") ? "gif" : "png";
|
|
144
|
-
profile.image_url = `https://cdn.discordapp.com/avatars/${profile.id}/${profile.avatar}.${format}`;
|
|
145
|
-
}
|
|
146
|
-
const userMap = await options.mapProfileToUser?.(profile);
|
|
147
|
-
return {
|
|
148
|
-
user: {
|
|
149
|
-
id: profile.id,
|
|
150
|
-
name: profile.display_name || profile.username || "",
|
|
151
|
-
email: profile.email,
|
|
152
|
-
emailVerified: profile.verified,
|
|
153
|
-
image: profile.image_url,
|
|
154
|
-
...userMap
|
|
155
|
-
},
|
|
156
|
-
data: profile
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
};
|
|
161
|
-
var facebook = (options) => {
|
|
162
|
-
return {
|
|
163
|
-
id: "facebook",
|
|
164
|
-
name: "Facebook",
|
|
165
|
-
async createAuthorizationURL({ state, scopes, redirectURI }) {
|
|
166
|
-
const _scopes = options.disableDefaultScope ? [] : ["email", "public_profile"];
|
|
167
|
-
options.scope && _scopes.push(...options.scope);
|
|
168
|
-
scopes && _scopes.push(...scopes);
|
|
169
|
-
return await createAuthorizationURL({
|
|
170
|
-
id: "facebook",
|
|
171
|
-
options,
|
|
172
|
-
authorizationEndpoint: "https://www.facebook.com/v21.0/dialog/oauth",
|
|
173
|
-
scopes: _scopes,
|
|
174
|
-
state,
|
|
175
|
-
redirectURI
|
|
176
|
-
});
|
|
177
|
-
},
|
|
178
|
-
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
179
|
-
return validateAuthorizationCode({
|
|
180
|
-
code,
|
|
181
|
-
redirectURI,
|
|
182
|
-
options,
|
|
183
|
-
tokenEndpoint: "https://graph.facebook.com/oauth/access_token"
|
|
184
|
-
});
|
|
185
|
-
},
|
|
186
|
-
async verifyIdToken(token, nonce) {
|
|
187
|
-
if (options.disableIdTokenSignIn) {
|
|
188
|
-
return false;
|
|
189
|
-
}
|
|
190
|
-
if (options.verifyIdToken) {
|
|
191
|
-
return options.verifyIdToken(token, nonce);
|
|
192
|
-
}
|
|
193
|
-
if (token.split(".").length) {
|
|
194
|
-
try {
|
|
195
|
-
const { payload: jwtClaims } = await jwtVerify(
|
|
196
|
-
token,
|
|
197
|
-
createRemoteJWKSet(
|
|
198
|
-
new URL("https://www.facebook.com/.well-known/oauth/openid/jwks")
|
|
199
|
-
),
|
|
200
|
-
{
|
|
201
|
-
algorithms: ["RS256"],
|
|
202
|
-
audience: options.clientId,
|
|
203
|
-
issuer: "https://www.facebook.com"
|
|
204
|
-
}
|
|
205
|
-
);
|
|
206
|
-
if (nonce && jwtClaims.nonce !== nonce) {
|
|
207
|
-
return false;
|
|
208
|
-
}
|
|
209
|
-
return !!jwtClaims;
|
|
210
|
-
} catch (error) {
|
|
211
|
-
return false;
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return true;
|
|
215
|
-
},
|
|
216
|
-
async getUserInfo(token) {
|
|
217
|
-
if (options.getUserInfo) {
|
|
218
|
-
return options.getUserInfo(token);
|
|
219
|
-
}
|
|
220
|
-
if (token.idToken) {
|
|
221
|
-
const profile2 = decodeJwt(token.idToken);
|
|
222
|
-
const user = {
|
|
223
|
-
id: profile2.sub,
|
|
224
|
-
name: profile2.name,
|
|
225
|
-
email: profile2.email,
|
|
226
|
-
picture: {
|
|
227
|
-
data: {
|
|
228
|
-
url: profile2.picture,
|
|
229
|
-
height: 100,
|
|
230
|
-
width: 100,
|
|
231
|
-
is_silhouette: false
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
const userMap2 = await options.mapProfileToUser?.({
|
|
236
|
-
...user,
|
|
237
|
-
email_verified: true
|
|
238
|
-
});
|
|
239
|
-
return {
|
|
240
|
-
user: {
|
|
241
|
-
...user,
|
|
242
|
-
emailVerified: true,
|
|
243
|
-
...userMap2
|
|
244
|
-
},
|
|
245
|
-
data: profile2
|
|
246
|
-
};
|
|
247
|
-
}
|
|
248
|
-
const fields = [
|
|
249
|
-
"id",
|
|
250
|
-
"name",
|
|
251
|
-
"email",
|
|
252
|
-
"picture",
|
|
253
|
-
...options?.fields || []
|
|
254
|
-
];
|
|
255
|
-
const { data: profile, error } = await betterFetch(
|
|
256
|
-
"https://graph.facebook.com/me?fields=" + fields.join(","),
|
|
257
|
-
{
|
|
258
|
-
auth: {
|
|
259
|
-
type: "Bearer",
|
|
260
|
-
token: token.accessToken
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
);
|
|
264
|
-
if (error) {
|
|
265
|
-
return null;
|
|
266
|
-
}
|
|
267
|
-
const userMap = await options.mapProfileToUser?.(profile);
|
|
268
|
-
return {
|
|
269
|
-
user: {
|
|
270
|
-
id: profile.id,
|
|
271
|
-
name: profile.name,
|
|
272
|
-
email: profile.email,
|
|
273
|
-
image: profile.picture.data.url,
|
|
274
|
-
emailVerified: profile.email_verified,
|
|
275
|
-
...userMap
|
|
276
|
-
},
|
|
277
|
-
data: profile
|
|
278
|
-
};
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
};
|
|
282
|
-
var github = (options) => {
|
|
283
|
-
const tokenEndpoint = "https://github.com/login/oauth/access_token";
|
|
284
|
-
return {
|
|
285
|
-
id: "github",
|
|
286
|
-
name: "GitHub",
|
|
287
|
-
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }) {
|
|
288
|
-
const _scopes = scopes || ["read:user", "user:email"];
|
|
289
|
-
options.scope && _scopes.push(...options.scope);
|
|
290
|
-
scopes && _scopes.push(...scopes);
|
|
291
|
-
return createAuthorizationURL({
|
|
292
|
-
id: "github",
|
|
293
|
-
options,
|
|
294
|
-
authorizationEndpoint: "https://github.com/login/oauth/authorize",
|
|
295
|
-
scopes: _scopes,
|
|
296
|
-
state,
|
|
297
|
-
redirectURI
|
|
298
|
-
});
|
|
299
|
-
},
|
|
300
|
-
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
301
|
-
return validateAuthorizationCode({
|
|
302
|
-
code,
|
|
303
|
-
redirectURI,
|
|
304
|
-
options,
|
|
305
|
-
tokenEndpoint
|
|
306
|
-
});
|
|
307
|
-
},
|
|
308
|
-
async getUserInfo(token) {
|
|
309
|
-
if (options.getUserInfo) {
|
|
310
|
-
return options.getUserInfo(token);
|
|
311
|
-
}
|
|
312
|
-
const { data: profile, error } = await betterFetch(
|
|
313
|
-
"https://api.github.com/user",
|
|
314
|
-
{
|
|
315
|
-
headers: {
|
|
316
|
-
"User-Agent": "better-auth",
|
|
317
|
-
authorization: `Bearer ${token.accessToken}`
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
);
|
|
321
|
-
if (error) {
|
|
322
|
-
return null;
|
|
323
|
-
}
|
|
324
|
-
let emailVerified = false;
|
|
325
|
-
if (!profile.email) {
|
|
326
|
-
const { data } = await betterFetch("https://api.github.com/user/emails", {
|
|
327
|
-
headers: {
|
|
328
|
-
Authorization: `Bearer ${token.accessToken}`,
|
|
329
|
-
"User-Agent": "better-auth"
|
|
330
|
-
}
|
|
331
|
-
});
|
|
332
|
-
if (data) {
|
|
333
|
-
profile.email = (data.find((e) => e.primary) ?? data[0])?.email;
|
|
334
|
-
emailVerified = data.find((e) => e.email === profile.email)?.verified ?? false;
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
const userMap = await options.mapProfileToUser?.(profile);
|
|
338
|
-
return {
|
|
339
|
-
user: {
|
|
340
|
-
id: profile.id.toString(),
|
|
341
|
-
name: profile.name || profile.login,
|
|
342
|
-
email: profile.email,
|
|
343
|
-
image: profile.avatar_url,
|
|
344
|
-
emailVerified,
|
|
345
|
-
...userMap
|
|
346
|
-
},
|
|
347
|
-
data: profile
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
};
|
|
351
|
-
};
|
|
352
|
-
var google = (options) => {
|
|
353
|
-
return {
|
|
354
|
-
id: "google",
|
|
355
|
-
name: "Google",
|
|
356
|
-
async createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }) {
|
|
357
|
-
if (!options.clientId || !options.clientSecret) {
|
|
358
|
-
logger.error(
|
|
359
|
-
"Client Id and Client Secret is required for Google. Make sure to provide them in the options."
|
|
360
|
-
);
|
|
361
|
-
throw new BetterAuthError("CLIENT_ID_AND_SECRET_REQUIRED");
|
|
362
|
-
}
|
|
363
|
-
if (!codeVerifier) {
|
|
364
|
-
throw new BetterAuthError("codeVerifier is required for Google");
|
|
365
|
-
}
|
|
366
|
-
const _scopes = options.disableDefaultScope ? [] : ["email", "profile", "openid"];
|
|
367
|
-
options.scope && _scopes.push(...options.scope);
|
|
368
|
-
scopes && _scopes.push(...scopes);
|
|
369
|
-
const url = await createAuthorizationURL({
|
|
370
|
-
id: "google",
|
|
371
|
-
options,
|
|
372
|
-
authorizationEndpoint: "https://accounts.google.com/o/oauth2/auth",
|
|
373
|
-
scopes: _scopes,
|
|
374
|
-
state,
|
|
375
|
-
codeVerifier,
|
|
376
|
-
redirectURI
|
|
377
|
-
});
|
|
378
|
-
options.accessType && url.searchParams.set("access_type", options.accessType);
|
|
379
|
-
options.prompt && url.searchParams.set("prompt", options.prompt);
|
|
380
|
-
options.display && url.searchParams.set("display", options.display);
|
|
381
|
-
options.hd && url.searchParams.set("hd", options.hd);
|
|
382
|
-
return url;
|
|
383
|
-
},
|
|
384
|
-
validateAuthorizationCode: async ({ code, codeVerifier, redirectURI }) => {
|
|
385
|
-
return validateAuthorizationCode({
|
|
386
|
-
code,
|
|
387
|
-
codeVerifier,
|
|
388
|
-
redirectURI,
|
|
389
|
-
options,
|
|
390
|
-
tokenEndpoint: "https://oauth2.googleapis.com/token"
|
|
391
|
-
});
|
|
392
|
-
},
|
|
393
|
-
async verifyIdToken(token, nonce) {
|
|
394
|
-
if (options.disableIdTokenSignIn) {
|
|
395
|
-
return false;
|
|
396
|
-
}
|
|
397
|
-
if (options.verifyIdToken) {
|
|
398
|
-
return options.verifyIdToken(token, nonce);
|
|
399
|
-
}
|
|
400
|
-
const googlePublicKeyUrl = `https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=${token}`;
|
|
401
|
-
const { data: tokenInfo } = await betterFetch(googlePublicKeyUrl);
|
|
402
|
-
if (!tokenInfo) {
|
|
403
|
-
return false;
|
|
404
|
-
}
|
|
405
|
-
const isValid = tokenInfo.aud === options.clientId && (tokenInfo.iss === "https://accounts.google.com" || tokenInfo.iss === "accounts.google.com");
|
|
406
|
-
return isValid;
|
|
407
|
-
},
|
|
408
|
-
async getUserInfo(token) {
|
|
409
|
-
if (options.getUserInfo) {
|
|
410
|
-
return options.getUserInfo(token);
|
|
411
|
-
}
|
|
412
|
-
if (!token.idToken) {
|
|
413
|
-
return null;
|
|
414
|
-
}
|
|
415
|
-
const user = decodeJwt(token.idToken);
|
|
416
|
-
const userMap = await options.mapProfileToUser?.(user);
|
|
417
|
-
return {
|
|
418
|
-
user: {
|
|
419
|
-
id: user.sub,
|
|
420
|
-
name: user.name,
|
|
421
|
-
email: user.email,
|
|
422
|
-
image: user.picture,
|
|
423
|
-
emailVerified: user.email_verified,
|
|
424
|
-
...userMap
|
|
425
|
-
},
|
|
426
|
-
data: user
|
|
427
|
-
};
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
};
|
|
431
|
-
var microsoft = (options) => {
|
|
432
|
-
const tenant = options.tenantId || "common";
|
|
433
|
-
const authorizationEndpoint = `https://login.microsoftonline.com/${tenant}/oauth2/v2.0/authorize`;
|
|
434
|
-
const tokenEndpoint = `https://login.microsoftonline.com/${tenant}/oauth2/v2.0/token`;
|
|
435
|
-
return {
|
|
436
|
-
id: "microsoft",
|
|
437
|
-
name: "Microsoft EntraID",
|
|
438
|
-
createAuthorizationURL(data) {
|
|
439
|
-
const scopes = options.disableDefaultScope ? [] : ["openid", "profile", "email", "User.Read"];
|
|
440
|
-
options.scope && scopes.push(...options.scope);
|
|
441
|
-
data.scopes && scopes.push(...scopes);
|
|
442
|
-
return createAuthorizationURL({
|
|
443
|
-
id: "microsoft",
|
|
444
|
-
options,
|
|
445
|
-
authorizationEndpoint,
|
|
446
|
-
state: data.state,
|
|
447
|
-
codeVerifier: data.codeVerifier,
|
|
448
|
-
scopes,
|
|
449
|
-
redirectURI: data.redirectURI,
|
|
450
|
-
prompt: options.requireSelectAccount || false
|
|
451
|
-
});
|
|
452
|
-
},
|
|
453
|
-
validateAuthorizationCode({ code, codeVerifier, redirectURI }) {
|
|
454
|
-
return validateAuthorizationCode({
|
|
455
|
-
code,
|
|
456
|
-
codeVerifier,
|
|
457
|
-
redirectURI,
|
|
458
|
-
options,
|
|
459
|
-
tokenEndpoint
|
|
460
|
-
});
|
|
461
|
-
},
|
|
462
|
-
async getUserInfo(token) {
|
|
463
|
-
if (options.getUserInfo) {
|
|
464
|
-
return options.getUserInfo(token);
|
|
465
|
-
}
|
|
466
|
-
if (!token.idToken) {
|
|
467
|
-
return null;
|
|
468
|
-
}
|
|
469
|
-
const user = decodeJwt(token.idToken);
|
|
470
|
-
const profilePhotoSize = options.profilePhotoSize || 48;
|
|
471
|
-
await betterFetch(
|
|
472
|
-
`https://graph.microsoft.com/v1.0/me/photos/${profilePhotoSize}x${profilePhotoSize}/$value`,
|
|
473
|
-
{
|
|
474
|
-
headers: {
|
|
475
|
-
Authorization: `Bearer ${token.accessToken}`
|
|
476
|
-
},
|
|
477
|
-
async onResponse(context) {
|
|
478
|
-
if (options.disableProfilePhoto || !context.response.ok) {
|
|
479
|
-
return;
|
|
480
|
-
}
|
|
481
|
-
try {
|
|
482
|
-
const response = context.response.clone();
|
|
483
|
-
const pictureBuffer = await response.arrayBuffer();
|
|
484
|
-
const pictureBase64 = base64.encode(pictureBuffer);
|
|
485
|
-
user.picture = `data:image/jpeg;base64, ${pictureBase64}`;
|
|
486
|
-
} catch (e) {
|
|
487
|
-
logger.error(
|
|
488
|
-
e && typeof e === "object" && "name" in e ? e.name : "",
|
|
489
|
-
e
|
|
490
|
-
);
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
);
|
|
495
|
-
const userMap = await options.mapProfileToUser?.(user);
|
|
496
|
-
return {
|
|
497
|
-
user: {
|
|
498
|
-
id: user.sub,
|
|
499
|
-
name: user.name,
|
|
500
|
-
email: user.email,
|
|
501
|
-
image: user.picture,
|
|
502
|
-
emailVerified: true,
|
|
503
|
-
...userMap
|
|
504
|
-
},
|
|
505
|
-
data: user
|
|
506
|
-
};
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
};
|
|
510
|
-
var spotify = (options) => {
|
|
511
|
-
return {
|
|
512
|
-
id: "spotify",
|
|
513
|
-
name: "Spotify",
|
|
514
|
-
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }) {
|
|
515
|
-
const _scopes = options.disableDefaultScope ? [] : ["user-read-email"];
|
|
516
|
-
options.scope && _scopes.push(...options.scope);
|
|
517
|
-
scopes && _scopes.push(...scopes);
|
|
518
|
-
return createAuthorizationURL({
|
|
519
|
-
id: "spotify",
|
|
520
|
-
options,
|
|
521
|
-
authorizationEndpoint: "https://accounts.spotify.com/authorize",
|
|
522
|
-
scopes: _scopes,
|
|
523
|
-
state,
|
|
524
|
-
codeVerifier,
|
|
525
|
-
redirectURI
|
|
526
|
-
});
|
|
527
|
-
},
|
|
528
|
-
validateAuthorizationCode: async ({ code, codeVerifier, redirectURI }) => {
|
|
529
|
-
return validateAuthorizationCode({
|
|
530
|
-
code,
|
|
531
|
-
codeVerifier,
|
|
532
|
-
redirectURI,
|
|
533
|
-
options,
|
|
534
|
-
tokenEndpoint: "https://accounts.spotify.com/api/token"
|
|
535
|
-
});
|
|
536
|
-
},
|
|
537
|
-
async getUserInfo(token) {
|
|
538
|
-
if (options.getUserInfo) {
|
|
539
|
-
return options.getUserInfo(token);
|
|
540
|
-
}
|
|
541
|
-
const { data: profile, error } = await betterFetch(
|
|
542
|
-
"https://api.spotify.com/v1/me",
|
|
543
|
-
{
|
|
544
|
-
method: "GET",
|
|
545
|
-
headers: {
|
|
546
|
-
Authorization: `Bearer ${token.accessToken}`
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
);
|
|
550
|
-
if (error) {
|
|
551
|
-
return null;
|
|
552
|
-
}
|
|
553
|
-
const userMap = await options.mapProfileToUser?.(profile);
|
|
554
|
-
return {
|
|
555
|
-
user: {
|
|
556
|
-
id: profile.id,
|
|
557
|
-
name: profile.display_name,
|
|
558
|
-
email: profile.email,
|
|
559
|
-
image: profile.images[0]?.url,
|
|
560
|
-
emailVerified: false,
|
|
561
|
-
...userMap
|
|
562
|
-
},
|
|
563
|
-
data: profile
|
|
564
|
-
};
|
|
565
|
-
}
|
|
566
|
-
};
|
|
567
|
-
};
|
|
568
|
-
var twitch = (options) => {
|
|
569
|
-
return {
|
|
570
|
-
id: "twitch",
|
|
571
|
-
name: "Twitch",
|
|
572
|
-
createAuthorizationURL({ state, scopes, redirectURI }) {
|
|
573
|
-
const _scopes = options.disableDefaultScope ? [] : ["user:read:email", "openid"];
|
|
574
|
-
options.scope && _scopes.push(...options.scope);
|
|
575
|
-
scopes && _scopes.push(...scopes);
|
|
576
|
-
return createAuthorizationURL({
|
|
577
|
-
id: "twitch",
|
|
578
|
-
redirectURI,
|
|
579
|
-
options,
|
|
580
|
-
authorizationEndpoint: "https://id.twitch.tv/oauth2/authorize",
|
|
581
|
-
scopes: _scopes,
|
|
582
|
-
state,
|
|
583
|
-
claims: options.claims || [
|
|
584
|
-
"email",
|
|
585
|
-
"email_verified",
|
|
586
|
-
"preferred_username",
|
|
587
|
-
"picture"
|
|
588
|
-
]
|
|
589
|
-
});
|
|
590
|
-
},
|
|
591
|
-
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
592
|
-
return validateAuthorizationCode({
|
|
593
|
-
code,
|
|
594
|
-
redirectURI,
|
|
595
|
-
options,
|
|
596
|
-
tokenEndpoint: "https://id.twitch.tv/oauth2/token"
|
|
597
|
-
});
|
|
598
|
-
},
|
|
599
|
-
async getUserInfo(token) {
|
|
600
|
-
if (options.getUserInfo) {
|
|
601
|
-
return options.getUserInfo(token);
|
|
602
|
-
}
|
|
603
|
-
const idToken = token.idToken;
|
|
604
|
-
if (!idToken) {
|
|
605
|
-
logger.error("No idToken found in token");
|
|
606
|
-
return null;
|
|
607
|
-
}
|
|
608
|
-
const profile = decodeJwt(idToken);
|
|
609
|
-
const userMap = await options.mapProfileToUser?.(profile);
|
|
610
|
-
return {
|
|
611
|
-
user: {
|
|
612
|
-
id: profile.sub,
|
|
613
|
-
name: profile.preferred_username,
|
|
614
|
-
email: profile.email,
|
|
615
|
-
image: profile.picture,
|
|
616
|
-
emailVerified: false,
|
|
617
|
-
...userMap
|
|
618
|
-
},
|
|
619
|
-
data: profile
|
|
620
|
-
};
|
|
621
|
-
}
|
|
622
|
-
};
|
|
623
|
-
};
|
|
624
|
-
var twitter = (options) => {
|
|
625
|
-
return {
|
|
626
|
-
id: "twitter",
|
|
627
|
-
name: "Twitter",
|
|
628
|
-
createAuthorizationURL(data) {
|
|
629
|
-
const _scopes = options.disableDefaultScope ? [] : ["users.read", "tweet.read", "offline.access"];
|
|
630
|
-
options.scope && _scopes.push(...options.scope);
|
|
631
|
-
data.scopes && _scopes.push(...data.scopes);
|
|
632
|
-
return createAuthorizationURL({
|
|
633
|
-
id: "twitter",
|
|
634
|
-
options,
|
|
635
|
-
authorizationEndpoint: "https://x.com/i/oauth2/authorize",
|
|
636
|
-
scopes: _scopes,
|
|
637
|
-
state: data.state,
|
|
638
|
-
codeVerifier: data.codeVerifier,
|
|
639
|
-
redirectURI: data.redirectURI
|
|
640
|
-
});
|
|
641
|
-
},
|
|
642
|
-
validateAuthorizationCode: async ({ code, codeVerifier, redirectURI }) => {
|
|
643
|
-
return validateAuthorizationCode({
|
|
644
|
-
code,
|
|
645
|
-
codeVerifier,
|
|
646
|
-
authentication: "basic",
|
|
647
|
-
redirectURI,
|
|
648
|
-
options,
|
|
649
|
-
tokenEndpoint: "https://api.x.com/2/oauth2/token"
|
|
650
|
-
});
|
|
651
|
-
},
|
|
652
|
-
async getUserInfo(token) {
|
|
653
|
-
if (options.getUserInfo) {
|
|
654
|
-
return options.getUserInfo(token);
|
|
655
|
-
}
|
|
656
|
-
const { data: profile, error } = await betterFetch(
|
|
657
|
-
"https://api.x.com/2/users/me?user.fields=profile_image_url",
|
|
658
|
-
{
|
|
659
|
-
method: "GET",
|
|
660
|
-
headers: {
|
|
661
|
-
Authorization: `Bearer ${token.accessToken}`
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
);
|
|
665
|
-
if (error) {
|
|
666
|
-
return null;
|
|
667
|
-
}
|
|
668
|
-
const userMap = await options.mapProfileToUser?.(profile);
|
|
669
|
-
return {
|
|
670
|
-
user: {
|
|
671
|
-
id: profile.data.id,
|
|
672
|
-
name: profile.data.name,
|
|
673
|
-
email: profile.data.username || null,
|
|
674
|
-
image: profile.data.profile_image_url,
|
|
675
|
-
emailVerified: profile.data.verified || false,
|
|
676
|
-
...userMap
|
|
677
|
-
},
|
|
678
|
-
data: profile
|
|
679
|
-
};
|
|
680
|
-
}
|
|
681
|
-
};
|
|
682
|
-
};
|
|
683
|
-
var dropbox = (options) => {
|
|
684
|
-
const tokenEndpoint = "https://api.dropboxapi.com/oauth2/token";
|
|
685
|
-
return {
|
|
686
|
-
id: "dropbox",
|
|
687
|
-
name: "Dropbox",
|
|
688
|
-
createAuthorizationURL: async ({
|
|
689
|
-
state,
|
|
690
|
-
scopes,
|
|
691
|
-
codeVerifier,
|
|
692
|
-
redirectURI
|
|
693
|
-
}) => {
|
|
694
|
-
const _scopes = options.disableDefaultScope ? [] : ["account_info.read"];
|
|
695
|
-
options.scope && _scopes.push(...options.scope);
|
|
696
|
-
scopes && _scopes.push(...scopes);
|
|
697
|
-
return await createAuthorizationURL({
|
|
698
|
-
id: "dropbox",
|
|
699
|
-
options,
|
|
700
|
-
authorizationEndpoint: "https://www.dropbox.com/oauth2/authorize",
|
|
701
|
-
scopes: _scopes,
|
|
702
|
-
state,
|
|
703
|
-
redirectURI,
|
|
704
|
-
codeVerifier
|
|
705
|
-
});
|
|
706
|
-
},
|
|
707
|
-
validateAuthorizationCode: async ({ code, codeVerifier, redirectURI }) => {
|
|
708
|
-
return await validateAuthorizationCode({
|
|
709
|
-
code,
|
|
710
|
-
codeVerifier,
|
|
711
|
-
redirectURI,
|
|
712
|
-
options,
|
|
713
|
-
tokenEndpoint
|
|
714
|
-
});
|
|
715
|
-
},
|
|
716
|
-
async getUserInfo(token) {
|
|
717
|
-
if (options.getUserInfo) {
|
|
718
|
-
return options.getUserInfo(token);
|
|
719
|
-
}
|
|
720
|
-
const { data: profile, error } = await betterFetch(
|
|
721
|
-
"https://api.dropboxapi.com/2/users/get_current_account",
|
|
722
|
-
{
|
|
723
|
-
method: "POST",
|
|
724
|
-
headers: {
|
|
725
|
-
Authorization: `Bearer ${token.accessToken}`
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
);
|
|
729
|
-
if (error) {
|
|
730
|
-
return null;
|
|
731
|
-
}
|
|
732
|
-
const userMap = await options.mapProfileToUser?.(profile);
|
|
733
|
-
return {
|
|
734
|
-
user: {
|
|
735
|
-
id: profile.account_id,
|
|
736
|
-
name: profile.name?.display_name,
|
|
737
|
-
email: profile.email,
|
|
738
|
-
emailVerified: profile.email_verified || false,
|
|
739
|
-
image: profile.profile_photo_url,
|
|
740
|
-
...userMap
|
|
741
|
-
},
|
|
742
|
-
data: profile
|
|
743
|
-
};
|
|
744
|
-
}
|
|
745
|
-
};
|
|
746
|
-
};
|
|
747
|
-
var linkedin = (options) => {
|
|
748
|
-
const authorizationEndpoint = "https://www.linkedin.com/oauth/v2/authorization";
|
|
749
|
-
const tokenEndpoint = "https://www.linkedin.com/oauth/v2/accessToken";
|
|
750
|
-
return {
|
|
751
|
-
id: "linkedin",
|
|
752
|
-
name: "Linkedin",
|
|
753
|
-
createAuthorizationURL: async ({ state, scopes, redirectURI }) => {
|
|
754
|
-
const _scopes = options.disableDefaultScope ? [] : ["profile", "email", "openid"];
|
|
755
|
-
options.scope && _scopes.push(...options.scope);
|
|
756
|
-
scopes && _scopes.push(...scopes);
|
|
757
|
-
return await createAuthorizationURL({
|
|
758
|
-
id: "linkedin",
|
|
759
|
-
options,
|
|
760
|
-
authorizationEndpoint,
|
|
761
|
-
scopes: _scopes,
|
|
762
|
-
state,
|
|
763
|
-
redirectURI
|
|
764
|
-
});
|
|
765
|
-
},
|
|
766
|
-
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
767
|
-
return await validateAuthorizationCode({
|
|
768
|
-
code,
|
|
769
|
-
redirectURI,
|
|
770
|
-
options,
|
|
771
|
-
tokenEndpoint
|
|
772
|
-
});
|
|
773
|
-
},
|
|
774
|
-
async getUserInfo(token) {
|
|
775
|
-
const { data: profile, error } = await betterFetch(
|
|
776
|
-
"https://api.linkedin.com/v2/userinfo",
|
|
777
|
-
{
|
|
778
|
-
method: "GET",
|
|
779
|
-
headers: {
|
|
780
|
-
Authorization: `Bearer ${token.accessToken}`
|
|
781
|
-
}
|
|
782
|
-
}
|
|
783
|
-
);
|
|
784
|
-
if (error) {
|
|
785
|
-
return null;
|
|
786
|
-
}
|
|
787
|
-
const userMap = await options.mapProfileToUser?.(profile);
|
|
788
|
-
return {
|
|
789
|
-
user: {
|
|
790
|
-
id: profile.sub,
|
|
791
|
-
name: profile.name,
|
|
792
|
-
email: profile.email,
|
|
793
|
-
emailVerified: profile.email_verified || false,
|
|
794
|
-
image: profile.picture,
|
|
795
|
-
...userMap
|
|
796
|
-
},
|
|
797
|
-
data: profile
|
|
798
|
-
};
|
|
799
|
-
}
|
|
800
|
-
};
|
|
801
|
-
};
|
|
802
|
-
var cleanDoubleSlashes = (input = "") => {
|
|
803
|
-
return input.split("://").map((str) => str.replace(/\/{2,}/g, "/")).join("://");
|
|
804
|
-
};
|
|
805
|
-
var issuerToEndpoints = (issuer) => {
|
|
806
|
-
let baseUrl = issuer || "https://gitlab.com";
|
|
807
|
-
return {
|
|
808
|
-
authorizationEndpoint: cleanDoubleSlashes(`${baseUrl}/oauth/authorize`),
|
|
809
|
-
tokenEndpoint: cleanDoubleSlashes(`${baseUrl}/oauth/token`),
|
|
810
|
-
userinfoEndpoint: cleanDoubleSlashes(`${baseUrl}/api/v4/user`)
|
|
811
|
-
};
|
|
812
|
-
};
|
|
813
|
-
var gitlab = (options) => {
|
|
814
|
-
const { authorizationEndpoint, tokenEndpoint, userinfoEndpoint } = issuerToEndpoints(options.issuer);
|
|
815
|
-
const issuerId = "gitlab";
|
|
816
|
-
const issuerName = "Gitlab";
|
|
817
|
-
return {
|
|
818
|
-
id: issuerId,
|
|
819
|
-
name: issuerName,
|
|
820
|
-
createAuthorizationURL: async ({
|
|
821
|
-
state,
|
|
822
|
-
scopes,
|
|
823
|
-
codeVerifier,
|
|
824
|
-
redirectURI
|
|
825
|
-
}) => {
|
|
826
|
-
const _scopes = options.disableDefaultScope ? [] : ["read_user"];
|
|
827
|
-
options.scope && _scopes.push(...options.scope);
|
|
828
|
-
scopes && _scopes.push(...scopes);
|
|
829
|
-
return await createAuthorizationURL({
|
|
830
|
-
id: issuerId,
|
|
831
|
-
options,
|
|
832
|
-
authorizationEndpoint,
|
|
833
|
-
scopes: _scopes,
|
|
834
|
-
state,
|
|
835
|
-
redirectURI,
|
|
836
|
-
codeVerifier
|
|
837
|
-
});
|
|
838
|
-
},
|
|
839
|
-
validateAuthorizationCode: async ({ code, redirectURI, codeVerifier }) => {
|
|
840
|
-
return validateAuthorizationCode({
|
|
841
|
-
code,
|
|
842
|
-
redirectURI,
|
|
843
|
-
options,
|
|
844
|
-
codeVerifier,
|
|
845
|
-
tokenEndpoint
|
|
846
|
-
});
|
|
847
|
-
},
|
|
848
|
-
async getUserInfo(token) {
|
|
849
|
-
if (options.getUserInfo) {
|
|
850
|
-
return options.getUserInfo(token);
|
|
851
|
-
}
|
|
852
|
-
const { data: profile, error } = await betterFetch(
|
|
853
|
-
userinfoEndpoint,
|
|
854
|
-
{ headers: { authorization: `Bearer ${token.accessToken}` } }
|
|
855
|
-
);
|
|
856
|
-
if (error || profile.state !== "active" || profile.locked) {
|
|
857
|
-
return null;
|
|
858
|
-
}
|
|
859
|
-
const userMap = await options.mapProfileToUser?.(profile);
|
|
860
|
-
return {
|
|
861
|
-
user: {
|
|
862
|
-
id: profile.id.toString(),
|
|
863
|
-
name: profile.name ?? profile.username,
|
|
864
|
-
email: profile.email,
|
|
865
|
-
image: profile.avatar_url,
|
|
866
|
-
emailVerified: true,
|
|
867
|
-
...userMap
|
|
868
|
-
},
|
|
869
|
-
data: profile
|
|
870
|
-
};
|
|
871
|
-
}
|
|
872
|
-
};
|
|
873
|
-
};
|
|
874
|
-
var reddit = (options) => {
|
|
875
|
-
return {
|
|
876
|
-
id: "reddit",
|
|
877
|
-
name: "Reddit",
|
|
878
|
-
createAuthorizationURL({ state, scopes, redirectURI }) {
|
|
879
|
-
const _scopes = options.disableDefaultScope ? [] : ["identity"];
|
|
880
|
-
options.scope && _scopes.push(...options.scope);
|
|
881
|
-
scopes && _scopes.push(...scopes);
|
|
882
|
-
return createAuthorizationURL({
|
|
883
|
-
id: "reddit",
|
|
884
|
-
options,
|
|
885
|
-
authorizationEndpoint: "https://www.reddit.com/api/v1/authorize",
|
|
886
|
-
scopes: _scopes,
|
|
887
|
-
state,
|
|
888
|
-
redirectURI,
|
|
889
|
-
duration: options.duration
|
|
890
|
-
});
|
|
891
|
-
},
|
|
892
|
-
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
893
|
-
const body = new URLSearchParams({
|
|
894
|
-
grant_type: "authorization_code",
|
|
895
|
-
code,
|
|
896
|
-
redirect_uri: options.redirectURI || redirectURI
|
|
897
|
-
});
|
|
898
|
-
const headers = {
|
|
899
|
-
"content-type": "application/x-www-form-urlencoded",
|
|
900
|
-
accept: "text/plain",
|
|
901
|
-
"user-agent": "better-auth",
|
|
902
|
-
Authorization: `Basic ${base64.encode(
|
|
903
|
-
`${options.clientId}:${options.clientSecret}`
|
|
904
|
-
)}`
|
|
905
|
-
};
|
|
906
|
-
const { data, error } = await betterFetch(
|
|
907
|
-
"https://www.reddit.com/api/v1/access_token",
|
|
908
|
-
{
|
|
909
|
-
method: "POST",
|
|
910
|
-
headers,
|
|
911
|
-
body: body.toString()
|
|
912
|
-
}
|
|
913
|
-
);
|
|
914
|
-
if (error) {
|
|
915
|
-
throw error;
|
|
916
|
-
}
|
|
917
|
-
return getOAuth2Tokens(data);
|
|
918
|
-
},
|
|
919
|
-
async getUserInfo(token) {
|
|
920
|
-
if (options.getUserInfo) {
|
|
921
|
-
return options.getUserInfo(token);
|
|
922
|
-
}
|
|
923
|
-
const { data: profile, error } = await betterFetch(
|
|
924
|
-
"https://oauth.reddit.com/api/v1/me",
|
|
925
|
-
{
|
|
926
|
-
headers: {
|
|
927
|
-
Authorization: `Bearer ${token.accessToken}`,
|
|
928
|
-
"User-Agent": "better-auth"
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
);
|
|
932
|
-
if (error) {
|
|
933
|
-
return null;
|
|
934
|
-
}
|
|
935
|
-
const userMap = await options.mapProfileToUser?.(profile);
|
|
936
|
-
return {
|
|
937
|
-
user: {
|
|
938
|
-
id: profile.id,
|
|
939
|
-
name: profile.name,
|
|
940
|
-
email: profile.oauth_client_id,
|
|
941
|
-
emailVerified: profile.has_verified_email,
|
|
942
|
-
image: profile.icon_img?.split("?")[0],
|
|
943
|
-
...userMap
|
|
944
|
-
},
|
|
945
|
-
data: profile
|
|
946
|
-
};
|
|
947
|
-
}
|
|
948
|
-
};
|
|
949
|
-
};
|
|
950
|
-
var roblox = (options) => {
|
|
951
|
-
return {
|
|
952
|
-
id: "roblox",
|
|
953
|
-
name: "Roblox",
|
|
954
|
-
createAuthorizationURL({ state, scopes, redirectURI }) {
|
|
955
|
-
const _scopes = scopes || ["openid", "profile"];
|
|
956
|
-
options.scope && _scopes.push(...options.scope);
|
|
957
|
-
return new URL(
|
|
958
|
-
`https://apis.roblox.com/oauth/v1/authorize?scope=${_scopes.join(
|
|
959
|
-
"+"
|
|
960
|
-
)}&response_type=code&client_id=${options.clientId}&redirect_uri=${encodeURIComponent(
|
|
961
|
-
options.redirectURI || redirectURI
|
|
962
|
-
)}&state=${state}&prompt=${options.prompt || "select_account+consent"}`
|
|
963
|
-
);
|
|
964
|
-
},
|
|
965
|
-
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
966
|
-
return validateAuthorizationCode({
|
|
967
|
-
code,
|
|
968
|
-
redirectURI: options.redirectURI || redirectURI,
|
|
969
|
-
options,
|
|
970
|
-
tokenEndpoint: "https://apis.roblox.com/oauth/v1/token",
|
|
971
|
-
authentication: "post"
|
|
972
|
-
});
|
|
973
|
-
},
|
|
974
|
-
async getUserInfo(token) {
|
|
975
|
-
if (options.getUserInfo) {
|
|
976
|
-
return options.getUserInfo(token);
|
|
977
|
-
}
|
|
978
|
-
const { data: profile, error } = await betterFetch(
|
|
979
|
-
"https://apis.roblox.com/oauth/v1/userinfo",
|
|
980
|
-
{
|
|
981
|
-
headers: {
|
|
982
|
-
authorization: `Bearer ${token.accessToken}`
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
);
|
|
986
|
-
if (error) {
|
|
987
|
-
return null;
|
|
988
|
-
}
|
|
989
|
-
return {
|
|
990
|
-
user: {
|
|
991
|
-
id: profile.sub,
|
|
992
|
-
name: profile.nickname || profile.preferred_username || "",
|
|
993
|
-
image: profile.picture,
|
|
994
|
-
email: profile.preferred_username || null,
|
|
995
|
-
// Roblox does not provide email
|
|
996
|
-
emailVerified: true
|
|
997
|
-
},
|
|
998
|
-
data: {
|
|
999
|
-
...profile
|
|
1000
|
-
}
|
|
1001
|
-
};
|
|
1002
|
-
}
|
|
1003
|
-
};
|
|
1004
|
-
};
|
|
1005
|
-
var LANG = /* @__PURE__ */ ((LANG2) => {
|
|
1006
|
-
LANG2[LANG2["RUS"] = 0] = "RUS";
|
|
1007
|
-
LANG2[LANG2["UKR"] = 1] = "UKR";
|
|
1008
|
-
LANG2[LANG2["ENG"] = 3] = "ENG";
|
|
1009
|
-
LANG2[LANG2["SPA"] = 4] = "SPA";
|
|
1010
|
-
LANG2[LANG2["GERMAN"] = 6] = "GERMAN";
|
|
1011
|
-
LANG2[LANG2["POL"] = 15] = "POL";
|
|
1012
|
-
LANG2[LANG2["FRA"] = 16] = "FRA";
|
|
1013
|
-
LANG2[LANG2["TURKEY"] = 82] = "TURKEY";
|
|
1014
|
-
return LANG2;
|
|
1015
|
-
})(LANG || {});
|
|
1016
|
-
var vk = (options) => {
|
|
1017
|
-
return {
|
|
1018
|
-
id: "vk",
|
|
1019
|
-
name: "VK",
|
|
1020
|
-
async createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }) {
|
|
1021
|
-
const _scopes = scopes || ["email", "phone"];
|
|
1022
|
-
options.scope && _scopes.push(...options.scope);
|
|
1023
|
-
const authorizationEndpoint = "https://id.vk.com/authorize";
|
|
1024
|
-
return createAuthorizationURL({
|
|
1025
|
-
id: "vk",
|
|
1026
|
-
options,
|
|
1027
|
-
authorizationEndpoint,
|
|
1028
|
-
scopes: _scopes,
|
|
1029
|
-
state,
|
|
1030
|
-
redirectURI,
|
|
1031
|
-
codeVerifier
|
|
1032
|
-
});
|
|
1033
|
-
},
|
|
1034
|
-
validateAuthorizationCode: async ({
|
|
1035
|
-
code,
|
|
1036
|
-
codeVerifier,
|
|
1037
|
-
redirectURI,
|
|
1038
|
-
deviceId
|
|
1039
|
-
}) => {
|
|
1040
|
-
return validateAuthorizationCode({
|
|
1041
|
-
code,
|
|
1042
|
-
codeVerifier,
|
|
1043
|
-
redirectURI: options.redirectURI || redirectURI,
|
|
1044
|
-
options,
|
|
1045
|
-
deviceId,
|
|
1046
|
-
tokenEndpoint: "https://id.vk.com/oauth2/auth"
|
|
1047
|
-
});
|
|
1048
|
-
},
|
|
1049
|
-
async getUserInfo(data) {
|
|
1050
|
-
if (!data.accessToken) {
|
|
1051
|
-
return null;
|
|
1052
|
-
}
|
|
1053
|
-
const formBody = new URLSearchParams({
|
|
1054
|
-
access_token: data.accessToken,
|
|
1055
|
-
client_id: options.clientId
|
|
1056
|
-
}).toString();
|
|
1057
|
-
const { data: profile, error } = await betterFetch(
|
|
1058
|
-
"https://id.vk.com/oauth2/user_info",
|
|
1059
|
-
{
|
|
1060
|
-
method: "POST",
|
|
1061
|
-
headers: {
|
|
1062
|
-
"Content-Type": "application/x-www-form-urlencoded"
|
|
1063
|
-
},
|
|
1064
|
-
body: formBody
|
|
1065
|
-
}
|
|
1066
|
-
);
|
|
1067
|
-
if (error) {
|
|
1068
|
-
return null;
|
|
1069
|
-
}
|
|
1070
|
-
if (!profile.user.email) {
|
|
1071
|
-
return null;
|
|
1072
|
-
}
|
|
1073
|
-
return {
|
|
1074
|
-
user: {
|
|
1075
|
-
id: profile.user.user_id,
|
|
1076
|
-
first_name: profile.user.first_name,
|
|
1077
|
-
last_name: profile.user.last_name,
|
|
1078
|
-
email: profile.user.email,
|
|
1079
|
-
image: profile.user.avatar,
|
|
1080
|
-
/** @note VK does not provide emailVerified*/
|
|
1081
|
-
emailVerified: !!profile.user.email,
|
|
1082
|
-
birthday: profile.user.birthday,
|
|
1083
|
-
sex: profile.user.sex
|
|
1084
|
-
},
|
|
1085
|
-
data: profile
|
|
1086
|
-
};
|
|
1087
|
-
}
|
|
1088
|
-
};
|
|
1089
|
-
};
|
|
1090
|
-
|
|
1091
|
-
// src/social-providers/index.ts
|
|
1092
|
-
var socialProviders = {
|
|
1093
|
-
apple,
|
|
1094
|
-
discord,
|
|
1095
|
-
facebook,
|
|
1096
|
-
github,
|
|
1097
|
-
microsoft,
|
|
1098
|
-
google,
|
|
1099
|
-
spotify,
|
|
1100
|
-
twitch,
|
|
1101
|
-
twitter,
|
|
1102
|
-
dropbox,
|
|
1103
|
-
linkedin,
|
|
1104
|
-
gitlab,
|
|
1105
|
-
reddit,
|
|
1106
|
-
roblox,
|
|
1107
|
-
vk
|
|
1108
|
-
};
|
|
1109
|
-
var socialProviderList = Object.keys(socialProviders);
|
|
1110
|
-
var SocialProviderListEnum = z.enum(socialProviderList, {
|
|
1111
|
-
description: "OAuth2 provider to use"
|
|
1112
|
-
});
|
|
1113
|
-
|
|
1114
|
-
export { LANG, SocialProviderListEnum, apple, discord, dropbox, facebook, getApplePublicKey, github, gitlab, google, linkedin, microsoft, reddit, roblox, socialProviderList, socialProviders, spotify, twitch, twitter, vk };
|