@hammadj/better-auth-core 1.5.0-beta.9
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/.turbo/turbo-build.log +266 -0
- package/.turbo/turbo-test.log +2 -0
- package/LICENSE.md +20 -0
- package/dist/api/index.d.mts +181 -0
- package/dist/api/index.mjs +34 -0
- package/dist/api/index.mjs.map +1 -0
- package/dist/async_hooks/index.d.mts +7 -0
- package/dist/async_hooks/index.mjs +22 -0
- package/dist/async_hooks/index.mjs.map +1 -0
- package/dist/async_hooks/pure.index.d.mts +7 -0
- package/dist/async_hooks/pure.index.mjs +35 -0
- package/dist/async_hooks/pure.index.mjs.map +1 -0
- package/dist/context/endpoint-context.d.mts +19 -0
- package/dist/context/endpoint-context.mjs +32 -0
- package/dist/context/endpoint-context.mjs.map +1 -0
- package/dist/context/global.d.mts +7 -0
- package/dist/context/global.mjs +38 -0
- package/dist/context/global.mjs.map +1 -0
- package/dist/context/index.d.mts +5 -0
- package/dist/context/index.mjs +6 -0
- package/dist/context/request-state.d.mts +26 -0
- package/dist/context/request-state.mjs +50 -0
- package/dist/context/request-state.mjs.map +1 -0
- package/dist/context/transaction.d.mts +25 -0
- package/dist/context/transaction.mjs +96 -0
- package/dist/context/transaction.mjs.map +1 -0
- package/dist/db/adapter/factory.d.mts +28 -0
- package/dist/db/adapter/factory.mjs +716 -0
- package/dist/db/adapter/factory.mjs.map +1 -0
- package/dist/db/adapter/get-default-field-name.d.mts +19 -0
- package/dist/db/adapter/get-default-field-name.mjs +39 -0
- package/dist/db/adapter/get-default-field-name.mjs.map +1 -0
- package/dist/db/adapter/get-default-model-name.d.mts +13 -0
- package/dist/db/adapter/get-default-model-name.mjs +33 -0
- package/dist/db/adapter/get-default-model-name.mjs.map +1 -0
- package/dist/db/adapter/get-field-attributes.d.mts +30 -0
- package/dist/db/adapter/get-field-attributes.mjs +40 -0
- package/dist/db/adapter/get-field-attributes.mjs.map +1 -0
- package/dist/db/adapter/get-field-name.d.mts +19 -0
- package/dist/db/adapter/get-field-name.mjs +34 -0
- package/dist/db/adapter/get-field-name.mjs.map +1 -0
- package/dist/db/adapter/get-id-field.d.mts +40 -0
- package/dist/db/adapter/get-id-field.mjs +68 -0
- package/dist/db/adapter/get-id-field.mjs.map +1 -0
- package/dist/db/adapter/get-model-name.d.mts +13 -0
- package/dist/db/adapter/get-model-name.mjs +24 -0
- package/dist/db/adapter/get-model-name.mjs.map +1 -0
- package/dist/db/adapter/index.d.mts +515 -0
- package/dist/db/adapter/index.mjs +10 -0
- package/dist/db/adapter/types.d.mts +140 -0
- package/dist/db/adapter/utils.d.mts +8 -0
- package/dist/db/adapter/utils.mjs +39 -0
- package/dist/db/adapter/utils.mjs.map +1 -0
- package/dist/db/get-tables.d.mts +9 -0
- package/dist/db/get-tables.mjs +267 -0
- package/dist/db/get-tables.mjs.map +1 -0
- package/dist/db/index.d.mts +10 -0
- package/dist/db/index.mjs +9 -0
- package/dist/db/plugin.d.mts +13 -0
- package/dist/db/schema/account.d.mts +27 -0
- package/dist/db/schema/account.mjs +20 -0
- package/dist/db/schema/account.mjs.map +1 -0
- package/dist/db/schema/rate-limit.d.mts +15 -0
- package/dist/db/schema/rate-limit.mjs +12 -0
- package/dist/db/schema/rate-limit.mjs.map +1 -0
- package/dist/db/schema/session.d.mts +22 -0
- package/dist/db/schema/session.mjs +15 -0
- package/dist/db/schema/session.mjs.map +1 -0
- package/dist/db/schema/shared.d.mts +11 -0
- package/dist/db/schema/shared.mjs +12 -0
- package/dist/db/schema/shared.mjs.map +1 -0
- package/dist/db/schema/user.d.mts +21 -0
- package/dist/db/schema/user.mjs +14 -0
- package/dist/db/schema/user.mjs.map +1 -0
- package/dist/db/schema/verification.d.mts +20 -0
- package/dist/db/schema/verification.mjs +13 -0
- package/dist/db/schema/verification.mjs.map +1 -0
- package/dist/db/type.d.mts +147 -0
- package/dist/env/color-depth.d.mts +5 -0
- package/dist/env/color-depth.mjs +89 -0
- package/dist/env/color-depth.mjs.map +1 -0
- package/dist/env/env-impl.d.mts +33 -0
- package/dist/env/env-impl.mjs +83 -0
- package/dist/env/env-impl.mjs.map +1 -0
- package/dist/env/index.d.mts +4 -0
- package/dist/env/index.mjs +5 -0
- package/dist/env/logger.d.mts +49 -0
- package/dist/env/logger.mjs +82 -0
- package/dist/env/logger.mjs.map +1 -0
- package/dist/error/codes.d.mts +199 -0
- package/dist/error/codes.mjs +57 -0
- package/dist/error/codes.mjs.map +1 -0
- package/dist/error/index.d.mts +20 -0
- package/dist/error/index.mjs +30 -0
- package/dist/error/index.mjs.map +1 -0
- package/dist/index.d.mts +8 -0
- package/dist/index.mjs +1 -0
- package/dist/oauth2/client-credentials-token.d.mts +37 -0
- package/dist/oauth2/client-credentials-token.mjs +55 -0
- package/dist/oauth2/client-credentials-token.mjs.map +1 -0
- package/dist/oauth2/create-authorization-url.d.mts +46 -0
- package/dist/oauth2/create-authorization-url.mjs +43 -0
- package/dist/oauth2/create-authorization-url.mjs.map +1 -0
- package/dist/oauth2/index.d.mts +8 -0
- package/dist/oauth2/index.mjs +8 -0
- package/dist/oauth2/oauth-provider.d.mts +195 -0
- package/dist/oauth2/refresh-access-token.d.mts +36 -0
- package/dist/oauth2/refresh-access-token.mjs +59 -0
- package/dist/oauth2/refresh-access-token.mjs.map +1 -0
- package/dist/oauth2/utils.d.mts +8 -0
- package/dist/oauth2/utils.mjs +28 -0
- package/dist/oauth2/utils.mjs.map +1 -0
- package/dist/oauth2/validate-authorization-code.d.mts +56 -0
- package/dist/oauth2/validate-authorization-code.mjs +72 -0
- package/dist/oauth2/validate-authorization-code.mjs.map +1 -0
- package/dist/oauth2/verify.d.mts +43 -0
- package/dist/oauth2/verify.mjs +96 -0
- package/dist/oauth2/verify.mjs.map +1 -0
- package/dist/social-providers/apple.d.mts +120 -0
- package/dist/social-providers/apple.mjs +105 -0
- package/dist/social-providers/apple.mjs.map +1 -0
- package/dist/social-providers/atlassian.d.mts +73 -0
- package/dist/social-providers/atlassian.mjs +84 -0
- package/dist/social-providers/atlassian.mjs.map +1 -0
- package/dist/social-providers/cognito.d.mts +88 -0
- package/dist/social-providers/cognito.mjs +166 -0
- package/dist/social-providers/cognito.mjs.map +1 -0
- package/dist/social-providers/discord.d.mts +127 -0
- package/dist/social-providers/discord.mjs +65 -0
- package/dist/social-providers/discord.mjs.map +1 -0
- package/dist/social-providers/dropbox.d.mts +72 -0
- package/dist/social-providers/dropbox.mjs +76 -0
- package/dist/social-providers/dropbox.mjs.map +1 -0
- package/dist/social-providers/facebook.d.mts +82 -0
- package/dist/social-providers/facebook.mjs +121 -0
- package/dist/social-providers/facebook.mjs.map +1 -0
- package/dist/social-providers/figma.d.mts +64 -0
- package/dist/social-providers/figma.mjs +87 -0
- package/dist/social-providers/figma.mjs.map +1 -0
- package/dist/social-providers/github.d.mts +105 -0
- package/dist/social-providers/github.mjs +97 -0
- package/dist/social-providers/github.mjs.map +1 -0
- package/dist/social-providers/gitlab.d.mts +126 -0
- package/dist/social-providers/gitlab.mjs +83 -0
- package/dist/social-providers/gitlab.mjs.map +1 -0
- package/dist/social-providers/google.d.mts +100 -0
- package/dist/social-providers/google.mjs +109 -0
- package/dist/social-providers/google.mjs.map +1 -0
- package/dist/social-providers/huggingface.d.mts +86 -0
- package/dist/social-providers/huggingface.mjs +76 -0
- package/dist/social-providers/huggingface.mjs.map +1 -0
- package/dist/social-providers/index.d.mts +1725 -0
- package/dist/social-providers/index.mjs +77 -0
- package/dist/social-providers/index.mjs.map +1 -0
- package/dist/social-providers/kakao.d.mts +164 -0
- package/dist/social-providers/kakao.mjs +73 -0
- package/dist/social-providers/kakao.mjs.map +1 -0
- package/dist/social-providers/kick.d.mts +76 -0
- package/dist/social-providers/kick.mjs +72 -0
- package/dist/social-providers/kick.mjs.map +1 -0
- package/dist/social-providers/line.d.mts +108 -0
- package/dist/social-providers/line.mjs +114 -0
- package/dist/social-providers/line.mjs.map +1 -0
- package/dist/social-providers/linear.d.mts +71 -0
- package/dist/social-providers/linear.mjs +89 -0
- package/dist/social-providers/linear.mjs.map +1 -0
- package/dist/social-providers/linkedin.d.mts +70 -0
- package/dist/social-providers/linkedin.mjs +77 -0
- package/dist/social-providers/linkedin.mjs.map +1 -0
- package/dist/social-providers/microsoft-entra-id.d.mts +175 -0
- package/dist/social-providers/microsoft-entra-id.mjs +107 -0
- package/dist/social-providers/microsoft-entra-id.mjs.map +1 -0
- package/dist/social-providers/naver.d.mts +95 -0
- package/dist/social-providers/naver.mjs +68 -0
- package/dist/social-providers/naver.mjs.map +1 -0
- package/dist/social-providers/notion.d.mts +67 -0
- package/dist/social-providers/notion.mjs +76 -0
- package/dist/social-providers/notion.mjs.map +1 -0
- package/dist/social-providers/paybin.d.mts +74 -0
- package/dist/social-providers/paybin.mjs +86 -0
- package/dist/social-providers/paybin.mjs.map +1 -0
- package/dist/social-providers/paypal.d.mts +132 -0
- package/dist/social-providers/paypal.mjs +145 -0
- package/dist/social-providers/paypal.mjs.map +1 -0
- package/dist/social-providers/polar.d.mts +77 -0
- package/dist/social-providers/polar.mjs +74 -0
- package/dist/social-providers/polar.mjs.map +1 -0
- package/dist/social-providers/reddit.d.mts +65 -0
- package/dist/social-providers/reddit.mjs +84 -0
- package/dist/social-providers/reddit.mjs.map +1 -0
- package/dist/social-providers/roblox.d.mts +73 -0
- package/dist/social-providers/roblox.mjs +60 -0
- package/dist/social-providers/roblox.mjs.map +1 -0
- package/dist/social-providers/salesforce.d.mts +82 -0
- package/dist/social-providers/salesforce.mjs +92 -0
- package/dist/social-providers/salesforce.mjs.map +1 -0
- package/dist/social-providers/slack.d.mts +86 -0
- package/dist/social-providers/slack.mjs +69 -0
- package/dist/social-providers/slack.mjs.map +1 -0
- package/dist/social-providers/spotify.d.mts +66 -0
- package/dist/social-providers/spotify.mjs +72 -0
- package/dist/social-providers/spotify.mjs.map +1 -0
- package/dist/social-providers/tiktok.d.mts +171 -0
- package/dist/social-providers/tiktok.mjs +63 -0
- package/dist/social-providers/tiktok.mjs.map +1 -0
- package/dist/social-providers/twitch.d.mts +82 -0
- package/dist/social-providers/twitch.mjs +79 -0
- package/dist/social-providers/twitch.mjs.map +1 -0
- package/dist/social-providers/twitter.d.mts +129 -0
- package/dist/social-providers/twitter.mjs +88 -0
- package/dist/social-providers/twitter.mjs.map +1 -0
- package/dist/social-providers/vercel.d.mts +65 -0
- package/dist/social-providers/vercel.mjs +62 -0
- package/dist/social-providers/vercel.mjs.map +1 -0
- package/dist/social-providers/vk.d.mts +73 -0
- package/dist/social-providers/vk.mjs +84 -0
- package/dist/social-providers/vk.mjs.map +1 -0
- package/dist/social-providers/zoom.d.mts +173 -0
- package/dist/social-providers/zoom.mjs +73 -0
- package/dist/social-providers/zoom.mjs.map +1 -0
- package/dist/types/context.d.mts +267 -0
- package/dist/types/cookie.d.mts +16 -0
- package/dist/types/helper.d.mts +10 -0
- package/dist/types/index.d.mts +8 -0
- package/dist/types/init-options.d.mts +1314 -0
- package/dist/types/plugin-client.d.mts +112 -0
- package/dist/types/plugin.d.mts +125 -0
- package/dist/utils/db.d.mts +12 -0
- package/dist/utils/db.mjs +17 -0
- package/dist/utils/db.mjs.map +1 -0
- package/dist/utils/deprecate.d.mts +10 -0
- package/dist/utils/deprecate.mjs +18 -0
- package/dist/utils/deprecate.mjs.map +1 -0
- package/dist/utils/error-codes.d.mts +13 -0
- package/dist/utils/error-codes.mjs +12 -0
- package/dist/utils/error-codes.mjs.map +1 -0
- package/dist/utils/id.d.mts +5 -0
- package/dist/utils/id.mjs +10 -0
- package/dist/utils/id.mjs.map +1 -0
- package/dist/utils/ip.d.mts +55 -0
- package/dist/utils/ip.mjs +119 -0
- package/dist/utils/ip.mjs.map +1 -0
- package/dist/utils/json.d.mts +5 -0
- package/dist/utils/json.mjs +26 -0
- package/dist/utils/json.mjs.map +1 -0
- package/dist/utils/string.d.mts +5 -0
- package/dist/utils/string.mjs +8 -0
- package/dist/utils/string.mjs.map +1 -0
- package/dist/utils/url.d.mts +21 -0
- package/dist/utils/url.mjs +33 -0
- package/dist/utils/url.mjs.map +1 -0
- package/package.json +147 -0
- package/src/api/index.ts +106 -0
- package/src/async_hooks/index.ts +40 -0
- package/src/async_hooks/pure.index.ts +46 -0
- package/src/context/endpoint-context.ts +50 -0
- package/src/context/global.ts +57 -0
- package/src/context/index.ts +23 -0
- package/src/context/request-state.test.ts +94 -0
- package/src/context/request-state.ts +91 -0
- package/src/context/transaction.ts +136 -0
- package/src/db/adapter/factory.ts +1362 -0
- package/src/db/adapter/get-default-field-name.ts +59 -0
- package/src/db/adapter/get-default-model-name.ts +51 -0
- package/src/db/adapter/get-field-attributes.ts +62 -0
- package/src/db/adapter/get-field-name.ts +43 -0
- package/src/db/adapter/get-id-field.ts +141 -0
- package/src/db/adapter/get-model-name.ts +36 -0
- package/src/db/adapter/index.ts +554 -0
- package/src/db/adapter/types.ts +171 -0
- package/src/db/adapter/utils.ts +61 -0
- package/src/db/get-tables.ts +296 -0
- package/src/db/index.ts +18 -0
- package/src/db/plugin.ts +11 -0
- package/src/db/schema/account.ts +34 -0
- package/src/db/schema/rate-limit.ts +21 -0
- package/src/db/schema/session.ts +17 -0
- package/src/db/schema/shared.ts +7 -0
- package/src/db/schema/user.ts +16 -0
- package/src/db/schema/verification.ts +15 -0
- package/src/db/test/get-tables.test.ts +116 -0
- package/src/db/type.ts +180 -0
- package/src/env/color-depth.ts +172 -0
- package/src/env/env-impl.ts +124 -0
- package/src/env/index.ts +23 -0
- package/src/env/logger.test.ts +34 -0
- package/src/env/logger.ts +145 -0
- package/src/error/codes.ts +58 -0
- package/src/error/index.ts +35 -0
- package/src/index.ts +1 -0
- package/src/oauth2/client-credentials-token.ts +102 -0
- package/src/oauth2/create-authorization-url.ts +87 -0
- package/src/oauth2/index.ts +26 -0
- package/src/oauth2/oauth-provider.ts +222 -0
- package/src/oauth2/refresh-access-token.ts +124 -0
- package/src/oauth2/utils.ts +38 -0
- package/src/oauth2/validate-authorization-code.ts +149 -0
- package/src/oauth2/validate-token.test.ts +174 -0
- package/src/oauth2/verify.ts +221 -0
- package/src/social-providers/apple.ts +223 -0
- package/src/social-providers/atlassian.ts +132 -0
- package/src/social-providers/cognito.ts +279 -0
- package/src/social-providers/discord.ts +169 -0
- package/src/social-providers/dropbox.ts +112 -0
- package/src/social-providers/facebook.ts +206 -0
- package/src/social-providers/figma.ts +117 -0
- package/src/social-providers/github.ts +184 -0
- package/src/social-providers/gitlab.ts +155 -0
- package/src/social-providers/google.ts +199 -0
- package/src/social-providers/huggingface.ts +118 -0
- package/src/social-providers/index.ts +127 -0
- package/src/social-providers/kakao.ts +178 -0
- package/src/social-providers/kick.ts +109 -0
- package/src/social-providers/line.ts +169 -0
- package/src/social-providers/linear.ts +121 -0
- package/src/social-providers/linkedin.ts +110 -0
- package/src/social-providers/microsoft-entra-id.ts +259 -0
- package/src/social-providers/naver.ts +112 -0
- package/src/social-providers/notion.ts +108 -0
- package/src/social-providers/paybin.ts +122 -0
- package/src/social-providers/paypal.ts +263 -0
- package/src/social-providers/polar.ts +110 -0
- package/src/social-providers/reddit.ts +122 -0
- package/src/social-providers/roblox.ts +111 -0
- package/src/social-providers/salesforce.ts +159 -0
- package/src/social-providers/slack.ts +111 -0
- package/src/social-providers/spotify.ts +93 -0
- package/src/social-providers/tiktok.ts +209 -0
- package/src/social-providers/twitch.ts +111 -0
- package/src/social-providers/twitter.ts +198 -0
- package/src/social-providers/vercel.ts +87 -0
- package/src/social-providers/vk.ts +124 -0
- package/src/social-providers/zoom.ts +238 -0
- package/src/types/context.ts +396 -0
- package/src/types/cookie.ts +10 -0
- package/src/types/helper.ts +26 -0
- package/src/types/index.ts +32 -0
- package/src/types/init-options.ts +1529 -0
- package/src/types/plugin-client.ts +127 -0
- package/src/types/plugin.ts +157 -0
- package/src/utils/db.ts +20 -0
- package/src/utils/deprecate.test.ts +72 -0
- package/src/utils/deprecate.ts +21 -0
- package/src/utils/error-codes.ts +65 -0
- package/src/utils/id.ts +5 -0
- package/src/utils/ip.test.ts +255 -0
- package/src/utils/ip.ts +211 -0
- package/src/utils/json.ts +25 -0
- package/src/utils/string.ts +3 -0
- package/src/utils/url.ts +43 -0
- package/tsconfig.json +7 -0
- package/tsdown.config.ts +35 -0
- package/vitest.config.ts +3 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { apple, getApplePublicKey } from "./apple.mjs";
|
|
2
|
+
import { atlassian } from "./atlassian.mjs";
|
|
3
|
+
import { cognito, getCognitoPublicKey } from "./cognito.mjs";
|
|
4
|
+
import { discord } from "./discord.mjs";
|
|
5
|
+
import { dropbox } from "./dropbox.mjs";
|
|
6
|
+
import { facebook } from "./facebook.mjs";
|
|
7
|
+
import { figma } from "./figma.mjs";
|
|
8
|
+
import { github } from "./github.mjs";
|
|
9
|
+
import { gitlab } from "./gitlab.mjs";
|
|
10
|
+
import { getGooglePublicKey, google } from "./google.mjs";
|
|
11
|
+
import { huggingface } from "./huggingface.mjs";
|
|
12
|
+
import { kakao } from "./kakao.mjs";
|
|
13
|
+
import { kick } from "./kick.mjs";
|
|
14
|
+
import { line } from "./line.mjs";
|
|
15
|
+
import { linear } from "./linear.mjs";
|
|
16
|
+
import { linkedin } from "./linkedin.mjs";
|
|
17
|
+
import { microsoft } from "./microsoft-entra-id.mjs";
|
|
18
|
+
import { naver } from "./naver.mjs";
|
|
19
|
+
import { notion } from "./notion.mjs";
|
|
20
|
+
import { paybin } from "./paybin.mjs";
|
|
21
|
+
import { paypal } from "./paypal.mjs";
|
|
22
|
+
import { polar } from "./polar.mjs";
|
|
23
|
+
import { reddit } from "./reddit.mjs";
|
|
24
|
+
import { roblox } from "./roblox.mjs";
|
|
25
|
+
import { salesforce } from "./salesforce.mjs";
|
|
26
|
+
import { slack } from "./slack.mjs";
|
|
27
|
+
import { spotify } from "./spotify.mjs";
|
|
28
|
+
import { tiktok } from "./tiktok.mjs";
|
|
29
|
+
import { twitch } from "./twitch.mjs";
|
|
30
|
+
import { twitter } from "./twitter.mjs";
|
|
31
|
+
import { vercel } from "./vercel.mjs";
|
|
32
|
+
import { vk } from "./vk.mjs";
|
|
33
|
+
import { zoom } from "./zoom.mjs";
|
|
34
|
+
import * as z from "zod";
|
|
35
|
+
|
|
36
|
+
//#region src/social-providers/index.ts
|
|
37
|
+
const socialProviders = {
|
|
38
|
+
apple,
|
|
39
|
+
atlassian,
|
|
40
|
+
cognito,
|
|
41
|
+
discord,
|
|
42
|
+
facebook,
|
|
43
|
+
figma,
|
|
44
|
+
github,
|
|
45
|
+
microsoft,
|
|
46
|
+
google,
|
|
47
|
+
huggingface,
|
|
48
|
+
slack,
|
|
49
|
+
spotify,
|
|
50
|
+
twitch,
|
|
51
|
+
twitter,
|
|
52
|
+
dropbox,
|
|
53
|
+
kick,
|
|
54
|
+
linear,
|
|
55
|
+
linkedin,
|
|
56
|
+
gitlab,
|
|
57
|
+
tiktok,
|
|
58
|
+
reddit,
|
|
59
|
+
roblox,
|
|
60
|
+
salesforce,
|
|
61
|
+
vk,
|
|
62
|
+
zoom,
|
|
63
|
+
notion,
|
|
64
|
+
kakao,
|
|
65
|
+
naver,
|
|
66
|
+
line,
|
|
67
|
+
paybin,
|
|
68
|
+
paypal,
|
|
69
|
+
polar,
|
|
70
|
+
vercel
|
|
71
|
+
};
|
|
72
|
+
const socialProviderList = Object.keys(socialProviders);
|
|
73
|
+
const SocialProviderListEnum = z.enum(socialProviderList).or(z.string());
|
|
74
|
+
|
|
75
|
+
//#endregion
|
|
76
|
+
export { SocialProviderListEnum, apple, atlassian, cognito, discord, dropbox, facebook, figma, getApplePublicKey, getCognitoPublicKey, getGooglePublicKey, github, gitlab, google, huggingface, kakao, kick, line, linear, linkedin, microsoft, naver, notion, paybin, paypal, polar, reddit, roblox, salesforce, slack, socialProviderList, socialProviders, spotify, tiktok, twitch, twitter, vercel, vk, zoom };
|
|
77
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/social-providers/index.ts"],"sourcesContent":["import * as z from \"zod\";\nimport { apple } from \"./apple\";\nimport { atlassian } from \"./atlassian\";\nimport { cognito } from \"./cognito\";\nimport { discord } from \"./discord\";\nimport { dropbox } from \"./dropbox\";\nimport { facebook } from \"./facebook\";\nimport { figma } from \"./figma\";\nimport { github } from \"./github\";\nimport { gitlab } from \"./gitlab\";\nimport { google } from \"./google\";\nimport { huggingface } from \"./huggingface\";\nimport { kakao } from \"./kakao\";\nimport { kick } from \"./kick\";\nimport { line } from \"./line\";\nimport { linear } from \"./linear\";\nimport { linkedin } from \"./linkedin\";\nimport { microsoft } from \"./microsoft-entra-id\";\nimport { naver } from \"./naver\";\nimport { notion } from \"./notion\";\nimport { paybin } from \"./paybin\";\nimport { paypal } from \"./paypal\";\nimport { polar } from \"./polar\";\nimport { reddit } from \"./reddit\";\nimport { roblox } from \"./roblox\";\nimport { salesforce } from \"./salesforce\";\nimport { slack } from \"./slack\";\nimport { spotify } from \"./spotify\";\nimport { tiktok } from \"./tiktok\";\nimport { twitch } from \"./twitch\";\nimport { twitter } from \"./twitter\";\nimport { vercel } from \"./vercel\";\nimport { vk } from \"./vk\";\nimport { zoom } from \"./zoom\";\n\nexport const socialProviders = {\n\tapple,\n\tatlassian,\n\tcognito,\n\tdiscord,\n\tfacebook,\n\tfigma,\n\tgithub,\n\tmicrosoft,\n\tgoogle,\n\thuggingface,\n\tslack,\n\tspotify,\n\ttwitch,\n\ttwitter,\n\tdropbox,\n\tkick,\n\tlinear,\n\tlinkedin,\n\tgitlab,\n\ttiktok,\n\treddit,\n\troblox,\n\tsalesforce,\n\tvk,\n\tzoom,\n\tnotion,\n\tkakao,\n\tnaver,\n\tline,\n\tpaybin,\n\tpaypal,\n\tpolar,\n\tvercel,\n};\n\nexport const socialProviderList = Object.keys(socialProviders) as [\n\t\"github\",\n\t...(keyof typeof socialProviders)[],\n];\n\nexport const SocialProviderListEnum = z\n\t.enum(socialProviderList)\n\t.or(z.string()) as z.ZodType<SocialProviderList[number] | (string & {})>;\n\nexport type SocialProvider = z.infer<typeof SocialProviderListEnum>;\n\nexport type SocialProviders = {\n\t[K in SocialProviderList[number]]?: Parameters<\n\t\t(typeof socialProviders)[K]\n\t>[0] & {\n\t\tenabled?: boolean | undefined;\n\t};\n};\n\nexport * from \"./apple\";\nexport * from \"./atlassian\";\nexport * from \"./cognito\";\nexport * from \"./discord\";\nexport * from \"./dropbox\";\nexport * from \"./facebook\";\nexport * from \"./figma\";\nexport * from \"./github\";\nexport * from \"./gitlab\";\nexport * from \"./google\";\nexport * from \"./huggingface\";\nexport * from \"./kakao\";\nexport * from \"./kick\";\nexport * from \"./kick\";\nexport * from \"./line\";\nexport * from \"./linear\";\nexport * from \"./linkedin\";\nexport * from \"./linkedin\";\nexport * from \"./microsoft-entra-id\";\nexport * from \"./naver\";\nexport * from \"./notion\";\nexport * from \"./paybin\";\nexport * from \"./paypal\";\nexport * from \"./polar\";\nexport * from \"./reddit\";\nexport * from \"./roblox\";\nexport * from \"./salesforce\";\nexport * from \"./slack\";\nexport * from \"./spotify\";\nexport * from \"./tiktok\";\nexport * from \"./twitch\";\nexport * from \"./twitter\";\nexport * from \"./vercel\";\nexport * from \"./vk\";\nexport * from \"./zoom\";\n\nexport type SocialProviderList = typeof socialProviderList;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAa,kBAAkB;CAC9B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AAED,MAAa,qBAAqB,OAAO,KAAK,gBAAgB;AAK9D,MAAa,yBAAyB,EACpC,KAAK,mBAAmB,CACxB,GAAG,EAAE,QAAQ,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/social-providers/kakao.d.ts
|
|
5
|
+
interface Partner {
|
|
6
|
+
/** Partner-specific ID (consent required: kakaotalk_message) */
|
|
7
|
+
uuid?: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
interface Profile {
|
|
10
|
+
/** Nickname (consent required: profile/nickname) */
|
|
11
|
+
nickname?: string | undefined;
|
|
12
|
+
/** Thumbnail image URL (consent required: profile/profile image) */
|
|
13
|
+
thumbnail_image_url?: string | undefined;
|
|
14
|
+
/** Profile image URL (consent required: profile/profile image) */
|
|
15
|
+
profile_image_url?: string | undefined;
|
|
16
|
+
/** Whether the profile image is the default */
|
|
17
|
+
is_default_image?: boolean | undefined;
|
|
18
|
+
/** Whether the nickname is the default */
|
|
19
|
+
is_default_nickname?: boolean | undefined;
|
|
20
|
+
}
|
|
21
|
+
interface KakaoAccount {
|
|
22
|
+
/** Consent required: profile info (nickname/profile image) */
|
|
23
|
+
profile_needs_agreement?: boolean | undefined;
|
|
24
|
+
/** Consent required: nickname */
|
|
25
|
+
profile_nickname_needs_agreement?: boolean | undefined;
|
|
26
|
+
/** Consent required: profile image */
|
|
27
|
+
profile_image_needs_agreement?: boolean | undefined;
|
|
28
|
+
/** Profile info */
|
|
29
|
+
profile?: Profile | undefined;
|
|
30
|
+
/** Consent required: name */
|
|
31
|
+
name_needs_agreement?: boolean | undefined;
|
|
32
|
+
/** Name */
|
|
33
|
+
name?: string | undefined;
|
|
34
|
+
/** Consent required: email */
|
|
35
|
+
email_needs_agreement?: boolean | undefined;
|
|
36
|
+
/** Email valid */
|
|
37
|
+
is_email_valid?: boolean | undefined;
|
|
38
|
+
/** Email verified */
|
|
39
|
+
is_email_verified?: boolean | undefined;
|
|
40
|
+
/** Email */
|
|
41
|
+
email?: string | undefined;
|
|
42
|
+
/** Consent required: age range */
|
|
43
|
+
age_range_needs_agreement?: boolean | undefined;
|
|
44
|
+
/** Age range */
|
|
45
|
+
age_range?: string | undefined;
|
|
46
|
+
/** Consent required: birth year */
|
|
47
|
+
birthyear_needs_agreement?: boolean | undefined;
|
|
48
|
+
/** Birth year (YYYY) */
|
|
49
|
+
birthyear?: string | undefined;
|
|
50
|
+
/** Consent required: birthday */
|
|
51
|
+
birthday_needs_agreement?: boolean | undefined;
|
|
52
|
+
/** Birthday (MMDD) */
|
|
53
|
+
birthday?: string | undefined;
|
|
54
|
+
/** Birthday type (SOLAR/LUNAR) */
|
|
55
|
+
birthday_type?: string | undefined;
|
|
56
|
+
/** Whether birthday is in a leap month */
|
|
57
|
+
is_leap_month?: boolean | undefined;
|
|
58
|
+
/** Consent required: gender */
|
|
59
|
+
gender_needs_agreement?: boolean | undefined;
|
|
60
|
+
/** Gender (male/female) */
|
|
61
|
+
gender?: string | undefined;
|
|
62
|
+
/** Consent required: phone number */
|
|
63
|
+
phone_number_needs_agreement?: boolean | undefined;
|
|
64
|
+
/** Phone number */
|
|
65
|
+
phone_number?: string | undefined;
|
|
66
|
+
/** Consent required: CI */
|
|
67
|
+
ci_needs_agreement?: boolean | undefined;
|
|
68
|
+
/** CI (unique identifier) */
|
|
69
|
+
ci?: string | undefined;
|
|
70
|
+
/** CI authentication time (UTC) */
|
|
71
|
+
ci_authenticated_at?: string | undefined;
|
|
72
|
+
}
|
|
73
|
+
interface KakaoProfile {
|
|
74
|
+
/** Kakao user ID */
|
|
75
|
+
id: number;
|
|
76
|
+
/**
|
|
77
|
+
* Whether the user has signed up (only present if auto-connection is disabled)
|
|
78
|
+
* false: preregistered, true: registered
|
|
79
|
+
*/
|
|
80
|
+
has_signed_up?: boolean | undefined;
|
|
81
|
+
/** UTC datetime when the user connected the service */
|
|
82
|
+
connected_at?: string | undefined;
|
|
83
|
+
/** UTC datetime when the user signed up via Kakao Sync */
|
|
84
|
+
synched_at?: string | undefined;
|
|
85
|
+
/** Custom user properties */
|
|
86
|
+
properties?: Record<string, any> | undefined;
|
|
87
|
+
/** Kakao account info */
|
|
88
|
+
kakao_account: KakaoAccount;
|
|
89
|
+
/** Partner info */
|
|
90
|
+
for_partner?: Partner | undefined;
|
|
91
|
+
}
|
|
92
|
+
interface KakaoOptions extends ProviderOptions<KakaoProfile> {
|
|
93
|
+
clientId: string;
|
|
94
|
+
}
|
|
95
|
+
declare const kakao: (options: KakaoOptions) => {
|
|
96
|
+
id: "kakao";
|
|
97
|
+
name: string;
|
|
98
|
+
createAuthorizationURL({
|
|
99
|
+
state,
|
|
100
|
+
scopes,
|
|
101
|
+
redirectURI
|
|
102
|
+
}: {
|
|
103
|
+
state: string;
|
|
104
|
+
codeVerifier: string;
|
|
105
|
+
scopes?: string[] | undefined;
|
|
106
|
+
redirectURI: string;
|
|
107
|
+
display?: string | undefined;
|
|
108
|
+
loginHint?: string | undefined;
|
|
109
|
+
}): Promise<URL>;
|
|
110
|
+
validateAuthorizationCode: ({
|
|
111
|
+
code,
|
|
112
|
+
redirectURI
|
|
113
|
+
}: {
|
|
114
|
+
code: string;
|
|
115
|
+
redirectURI: string;
|
|
116
|
+
codeVerifier?: string | undefined;
|
|
117
|
+
deviceId?: string | undefined;
|
|
118
|
+
}) => Promise<OAuth2Tokens>;
|
|
119
|
+
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
120
|
+
getUserInfo(token: OAuth2Tokens & {
|
|
121
|
+
user?: {
|
|
122
|
+
name?: {
|
|
123
|
+
firstName?: string;
|
|
124
|
+
lastName?: string;
|
|
125
|
+
};
|
|
126
|
+
email?: string;
|
|
127
|
+
} | undefined;
|
|
128
|
+
}): Promise<{
|
|
129
|
+
user: {
|
|
130
|
+
id: string;
|
|
131
|
+
name?: string;
|
|
132
|
+
email?: string | null;
|
|
133
|
+
image?: string;
|
|
134
|
+
emailVerified: boolean;
|
|
135
|
+
[key: string]: any;
|
|
136
|
+
};
|
|
137
|
+
data: any;
|
|
138
|
+
} | {
|
|
139
|
+
user: {
|
|
140
|
+
id: string;
|
|
141
|
+
name: string | undefined;
|
|
142
|
+
email: string | undefined;
|
|
143
|
+
image: string | undefined;
|
|
144
|
+
emailVerified: boolean;
|
|
145
|
+
} | {
|
|
146
|
+
id: string;
|
|
147
|
+
name: string;
|
|
148
|
+
email: string | null;
|
|
149
|
+
image: string;
|
|
150
|
+
emailVerified: boolean;
|
|
151
|
+
} | {
|
|
152
|
+
id: string;
|
|
153
|
+
name: string;
|
|
154
|
+
email: string | null;
|
|
155
|
+
image: string;
|
|
156
|
+
emailVerified: boolean;
|
|
157
|
+
};
|
|
158
|
+
data: KakaoProfile;
|
|
159
|
+
} | null>;
|
|
160
|
+
options: KakaoOptions;
|
|
161
|
+
};
|
|
162
|
+
//#endregion
|
|
163
|
+
export { KakaoOptions, KakaoProfile, kakao };
|
|
164
|
+
//# sourceMappingURL=kakao.d.mts.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
|
|
2
|
+
import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
|
|
3
|
+
import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
|
|
4
|
+
import "../oauth2/index.mjs";
|
|
5
|
+
import { betterFetch } from "@better-fetch/fetch";
|
|
6
|
+
|
|
7
|
+
//#region src/social-providers/kakao.ts
|
|
8
|
+
const kakao = (options) => {
|
|
9
|
+
return {
|
|
10
|
+
id: "kakao",
|
|
11
|
+
name: "Kakao",
|
|
12
|
+
createAuthorizationURL({ state, scopes, redirectURI }) {
|
|
13
|
+
const _scopes = options.disableDefaultScope ? [] : [
|
|
14
|
+
"account_email",
|
|
15
|
+
"profile_image",
|
|
16
|
+
"profile_nickname"
|
|
17
|
+
];
|
|
18
|
+
if (options.scope) _scopes.push(...options.scope);
|
|
19
|
+
if (scopes) _scopes.push(...scopes);
|
|
20
|
+
return createAuthorizationURL({
|
|
21
|
+
id: "kakao",
|
|
22
|
+
options,
|
|
23
|
+
authorizationEndpoint: "https://kauth.kakao.com/oauth/authorize",
|
|
24
|
+
scopes: _scopes,
|
|
25
|
+
state,
|
|
26
|
+
redirectURI
|
|
27
|
+
});
|
|
28
|
+
},
|
|
29
|
+
validateAuthorizationCode: async ({ code, redirectURI }) => {
|
|
30
|
+
return validateAuthorizationCode({
|
|
31
|
+
code,
|
|
32
|
+
redirectURI,
|
|
33
|
+
options,
|
|
34
|
+
tokenEndpoint: "https://kauth.kakao.com/oauth/token"
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
refreshAccessToken: options.refreshAccessToken ? options.refreshAccessToken : async (refreshToken) => {
|
|
38
|
+
return refreshAccessToken({
|
|
39
|
+
refreshToken,
|
|
40
|
+
options: {
|
|
41
|
+
clientId: options.clientId,
|
|
42
|
+
clientKey: options.clientKey,
|
|
43
|
+
clientSecret: options.clientSecret
|
|
44
|
+
},
|
|
45
|
+
tokenEndpoint: "https://kauth.kakao.com/oauth/token"
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
async getUserInfo(token) {
|
|
49
|
+
if (options.getUserInfo) return options.getUserInfo(token);
|
|
50
|
+
const { data: profile, error } = await betterFetch("https://kapi.kakao.com/v2/user/me", { headers: { Authorization: `Bearer ${token.accessToken}` } });
|
|
51
|
+
if (error || !profile) return null;
|
|
52
|
+
const userMap = await options.mapProfileToUser?.(profile);
|
|
53
|
+
const account = profile.kakao_account || {};
|
|
54
|
+
const kakaoProfile = account.profile || {};
|
|
55
|
+
return {
|
|
56
|
+
user: {
|
|
57
|
+
id: String(profile.id),
|
|
58
|
+
name: kakaoProfile.nickname || account.name || void 0,
|
|
59
|
+
email: account.email,
|
|
60
|
+
image: kakaoProfile.profile_image_url || kakaoProfile.thumbnail_image_url,
|
|
61
|
+
emailVerified: !!account.is_email_valid && !!account.is_email_verified,
|
|
62
|
+
...userMap
|
|
63
|
+
},
|
|
64
|
+
data: profile
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
options
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
export { kakao };
|
|
73
|
+
//# sourceMappingURL=kakao.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kakao.mjs","names":[],"sources":["../../src/social-providers/kakao.ts"],"sourcesContent":["import { betterFetch } from \"@better-fetch/fetch\";\nimport type { OAuthProvider, ProviderOptions } from \"../oauth2\";\nimport {\n\tcreateAuthorizationURL,\n\trefreshAccessToken,\n\tvalidateAuthorizationCode,\n} from \"../oauth2\";\n\ninterface Partner {\n\t/** Partner-specific ID (consent required: kakaotalk_message) */\n\tuuid?: string | undefined;\n}\n\ninterface Profile {\n\t/** Nickname (consent required: profile/nickname) */\n\tnickname?: string | undefined;\n\t/** Thumbnail image URL (consent required: profile/profile image) */\n\tthumbnail_image_url?: string | undefined;\n\t/** Profile image URL (consent required: profile/profile image) */\n\tprofile_image_url?: string | undefined;\n\t/** Whether the profile image is the default */\n\tis_default_image?: boolean | undefined;\n\t/** Whether the nickname is the default */\n\tis_default_nickname?: boolean | undefined;\n}\n\ninterface KakaoAccount {\n\t/** Consent required: profile info (nickname/profile image) */\n\tprofile_needs_agreement?: boolean | undefined;\n\t/** Consent required: nickname */\n\tprofile_nickname_needs_agreement?: boolean | undefined;\n\t/** Consent required: profile image */\n\tprofile_image_needs_agreement?: boolean | undefined;\n\t/** Profile info */\n\tprofile?: Profile | undefined;\n\t/** Consent required: name */\n\tname_needs_agreement?: boolean | undefined;\n\t/** Name */\n\tname?: string | undefined;\n\t/** Consent required: email */\n\temail_needs_agreement?: boolean | undefined;\n\t/** Email valid */\n\tis_email_valid?: boolean | undefined;\n\t/** Email verified */\n\tis_email_verified?: boolean | undefined;\n\t/** Email */\n\temail?: string | undefined;\n\t/** Consent required: age range */\n\tage_range_needs_agreement?: boolean | undefined;\n\t/** Age range */\n\tage_range?: string | undefined;\n\t/** Consent required: birth year */\n\tbirthyear_needs_agreement?: boolean | undefined;\n\t/** Birth year (YYYY) */\n\tbirthyear?: string | undefined;\n\t/** Consent required: birthday */\n\tbirthday_needs_agreement?: boolean | undefined;\n\t/** Birthday (MMDD) */\n\tbirthday?: string | undefined;\n\t/** Birthday type (SOLAR/LUNAR) */\n\tbirthday_type?: string | undefined;\n\t/** Whether birthday is in a leap month */\n\tis_leap_month?: boolean | undefined;\n\t/** Consent required: gender */\n\tgender_needs_agreement?: boolean | undefined;\n\t/** Gender (male/female) */\n\tgender?: string | undefined;\n\t/** Consent required: phone number */\n\tphone_number_needs_agreement?: boolean | undefined;\n\t/** Phone number */\n\tphone_number?: string | undefined;\n\t/** Consent required: CI */\n\tci_needs_agreement?: boolean | undefined;\n\t/** CI (unique identifier) */\n\tci?: string | undefined;\n\t/** CI authentication time (UTC) */\n\tci_authenticated_at?: string | undefined;\n}\n\nexport interface KakaoProfile {\n\t/** Kakao user ID */\n\tid: number;\n\t/**\n\t * Whether the user has signed up (only present if auto-connection is disabled)\n\t * false: preregistered, true: registered\n\t */\n\thas_signed_up?: boolean | undefined;\n\t/** UTC datetime when the user connected the service */\n\tconnected_at?: string | undefined;\n\t/** UTC datetime when the user signed up via Kakao Sync */\n\tsynched_at?: string | undefined;\n\t/** Custom user properties */\n\tproperties?: Record<string, any> | undefined;\n\t/** Kakao account info */\n\tkakao_account: KakaoAccount;\n\t/** Partner info */\n\tfor_partner?: Partner | undefined;\n}\n\nexport interface KakaoOptions extends ProviderOptions<KakaoProfile> {\n\tclientId: string;\n}\n\nexport const kakao = (options: KakaoOptions) => {\n\treturn {\n\t\tid: \"kakao\",\n\t\tname: \"Kakao\",\n\t\tcreateAuthorizationURL({ state, scopes, redirectURI }) {\n\t\t\tconst _scopes = options.disableDefaultScope\n\t\t\t\t? []\n\t\t\t\t: [\"account_email\", \"profile_image\", \"profile_nickname\"];\n\t\t\tif (options.scope) _scopes.push(...options.scope);\n\t\t\tif (scopes) _scopes.push(...scopes);\n\t\t\treturn createAuthorizationURL({\n\t\t\t\tid: \"kakao\",\n\t\t\t\toptions,\n\t\t\t\tauthorizationEndpoint: \"https://kauth.kakao.com/oauth/authorize\",\n\t\t\t\tscopes: _scopes,\n\t\t\t\tstate,\n\t\t\t\tredirectURI,\n\t\t\t});\n\t\t},\n\t\tvalidateAuthorizationCode: async ({ code, redirectURI }) => {\n\t\t\treturn validateAuthorizationCode({\n\t\t\t\tcode,\n\t\t\t\tredirectURI,\n\t\t\t\toptions,\n\t\t\t\ttokenEndpoint: \"https://kauth.kakao.com/oauth/token\",\n\t\t\t});\n\t\t},\n\t\trefreshAccessToken: options.refreshAccessToken\n\t\t\t? options.refreshAccessToken\n\t\t\t: async (refreshToken) => {\n\t\t\t\t\treturn refreshAccessToken({\n\t\t\t\t\t\trefreshToken,\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tclientId: options.clientId,\n\t\t\t\t\t\t\tclientKey: options.clientKey,\n\t\t\t\t\t\t\tclientSecret: options.clientSecret,\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttokenEndpoint: \"https://kauth.kakao.com/oauth/token\",\n\t\t\t\t\t});\n\t\t\t\t},\n\t\tasync getUserInfo(token) {\n\t\t\tif (options.getUserInfo) {\n\t\t\t\treturn options.getUserInfo(token);\n\t\t\t}\n\t\t\tconst { data: profile, error } = await betterFetch<KakaoProfile>(\n\t\t\t\t\"https://kapi.kakao.com/v2/user/me\",\n\t\t\t\t{\n\t\t\t\t\theaders: {\n\t\t\t\t\t\tAuthorization: `Bearer ${token.accessToken}`,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\t\t\tif (error || !profile) {\n\t\t\t\treturn null;\n\t\t\t}\n\t\t\tconst userMap = await options.mapProfileToUser?.(profile);\n\t\t\tconst account = profile.kakao_account || {};\n\t\t\tconst kakaoProfile = account.profile || {};\n\t\t\tconst user = {\n\t\t\t\tid: String(profile.id),\n\t\t\t\tname: kakaoProfile.nickname || account.name || undefined,\n\t\t\t\temail: account.email,\n\t\t\t\timage:\n\t\t\t\t\tkakaoProfile.profile_image_url || kakaoProfile.thumbnail_image_url,\n\t\t\t\temailVerified: !!account.is_email_valid && !!account.is_email_verified,\n\t\t\t\t...userMap,\n\t\t\t};\n\t\t\treturn {\n\t\t\t\tuser,\n\t\t\t\tdata: profile,\n\t\t\t};\n\t\t},\n\t\toptions,\n\t} satisfies OAuthProvider<KakaoProfile>;\n};\n"],"mappings":";;;;;;;AAuGA,MAAa,SAAS,YAA0B;AAC/C,QAAO;EACN,IAAI;EACJ,MAAM;EACN,uBAAuB,EAAE,OAAO,QAAQ,eAAe;GACtD,MAAM,UAAU,QAAQ,sBACrB,EAAE,GACF;IAAC;IAAiB;IAAiB;IAAmB;AACzD,OAAI,QAAQ,MAAO,SAAQ,KAAK,GAAG,QAAQ,MAAM;AACjD,OAAI,OAAQ,SAAQ,KAAK,GAAG,OAAO;AACnC,UAAO,uBAAuB;IAC7B,IAAI;IACJ;IACA,uBAAuB;IACvB,QAAQ;IACR;IACA;IACA,CAAC;;EAEH,2BAA2B,OAAO,EAAE,MAAM,kBAAkB;AAC3D,UAAO,0BAA0B;IAChC;IACA;IACA;IACA,eAAe;IACf,CAAC;;EAEH,oBAAoB,QAAQ,qBACzB,QAAQ,qBACR,OAAO,iBAAiB;AACxB,UAAO,mBAAmB;IACzB;IACA,SAAS;KACR,UAAU,QAAQ;KAClB,WAAW,QAAQ;KACnB,cAAc,QAAQ;KACtB;IACD,eAAe;IACf,CAAC;;EAEL,MAAM,YAAY,OAAO;AACxB,OAAI,QAAQ,YACX,QAAO,QAAQ,YAAY,MAAM;GAElC,MAAM,EAAE,MAAM,SAAS,UAAU,MAAM,YACtC,qCACA,EACC,SAAS,EACR,eAAe,UAAU,MAAM,eAC/B,EACD,CACD;AACD,OAAI,SAAS,CAAC,QACb,QAAO;GAER,MAAM,UAAU,MAAM,QAAQ,mBAAmB,QAAQ;GACzD,MAAM,UAAU,QAAQ,iBAAiB,EAAE;GAC3C,MAAM,eAAe,QAAQ,WAAW,EAAE;AAU1C,UAAO;IACN,MAVY;KACZ,IAAI,OAAO,QAAQ,GAAG;KACtB,MAAM,aAAa,YAAY,QAAQ,QAAQ;KAC/C,OAAO,QAAQ;KACf,OACC,aAAa,qBAAqB,aAAa;KAChD,eAAe,CAAC,CAAC,QAAQ,kBAAkB,CAAC,CAAC,QAAQ;KACrD,GAAG;KACH;IAGA,MAAM;IACN;;EAEF;EACA"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/social-providers/kick.d.ts
|
|
5
|
+
interface KickProfile {
|
|
6
|
+
/**
|
|
7
|
+
* The user id of the user
|
|
8
|
+
*/
|
|
9
|
+
user_id: string;
|
|
10
|
+
/**
|
|
11
|
+
* The name of the user
|
|
12
|
+
*/
|
|
13
|
+
name: string;
|
|
14
|
+
/**
|
|
15
|
+
* The email of the user
|
|
16
|
+
*/
|
|
17
|
+
email: string;
|
|
18
|
+
/**
|
|
19
|
+
* The picture of the user
|
|
20
|
+
*/
|
|
21
|
+
profile_picture: string;
|
|
22
|
+
}
|
|
23
|
+
interface KickOptions extends ProviderOptions<KickProfile> {
|
|
24
|
+
clientId: string;
|
|
25
|
+
}
|
|
26
|
+
declare const kick: (options: KickOptions) => {
|
|
27
|
+
id: "kick";
|
|
28
|
+
name: string;
|
|
29
|
+
createAuthorizationURL({
|
|
30
|
+
state,
|
|
31
|
+
scopes,
|
|
32
|
+
redirectURI,
|
|
33
|
+
codeVerifier
|
|
34
|
+
}: {
|
|
35
|
+
state: string;
|
|
36
|
+
codeVerifier: string;
|
|
37
|
+
scopes?: string[] | undefined;
|
|
38
|
+
redirectURI: string;
|
|
39
|
+
display?: string | undefined;
|
|
40
|
+
loginHint?: string | undefined;
|
|
41
|
+
}): Promise<URL>;
|
|
42
|
+
validateAuthorizationCode({
|
|
43
|
+
code,
|
|
44
|
+
redirectURI,
|
|
45
|
+
codeVerifier
|
|
46
|
+
}: {
|
|
47
|
+
code: string;
|
|
48
|
+
redirectURI: string;
|
|
49
|
+
codeVerifier?: string | undefined;
|
|
50
|
+
deviceId?: string | undefined;
|
|
51
|
+
}): Promise<OAuth2Tokens>;
|
|
52
|
+
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
53
|
+
getUserInfo(token: OAuth2Tokens & {
|
|
54
|
+
user?: {
|
|
55
|
+
name?: {
|
|
56
|
+
firstName?: string;
|
|
57
|
+
lastName?: string;
|
|
58
|
+
};
|
|
59
|
+
email?: string;
|
|
60
|
+
} | undefined;
|
|
61
|
+
}): Promise<{
|
|
62
|
+
user: {
|
|
63
|
+
id: string;
|
|
64
|
+
name?: string;
|
|
65
|
+
email?: string | null;
|
|
66
|
+
image?: string;
|
|
67
|
+
emailVerified: boolean;
|
|
68
|
+
[key: string]: any;
|
|
69
|
+
};
|
|
70
|
+
data: any;
|
|
71
|
+
} | null>;
|
|
72
|
+
options: KickOptions;
|
|
73
|
+
};
|
|
74
|
+
//#endregion
|
|
75
|
+
export { KickOptions, KickProfile, kick };
|
|
76
|
+
//# sourceMappingURL=kick.d.mts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { createAuthorizationURL } from "../oauth2/create-authorization-url.mjs";
|
|
2
|
+
import { refreshAccessToken } from "../oauth2/refresh-access-token.mjs";
|
|
3
|
+
import { validateAuthorizationCode } from "../oauth2/validate-authorization-code.mjs";
|
|
4
|
+
import "../oauth2/index.mjs";
|
|
5
|
+
import { betterFetch } from "@better-fetch/fetch";
|
|
6
|
+
|
|
7
|
+
//#region src/social-providers/kick.ts
|
|
8
|
+
const kick = (options) => {
|
|
9
|
+
return {
|
|
10
|
+
id: "kick",
|
|
11
|
+
name: "Kick",
|
|
12
|
+
createAuthorizationURL({ state, scopes, redirectURI, codeVerifier }) {
|
|
13
|
+
const _scopes = options.disableDefaultScope ? [] : ["user:read"];
|
|
14
|
+
if (options.scope) _scopes.push(...options.scope);
|
|
15
|
+
if (scopes) _scopes.push(...scopes);
|
|
16
|
+
return createAuthorizationURL({
|
|
17
|
+
id: "kick",
|
|
18
|
+
redirectURI,
|
|
19
|
+
options,
|
|
20
|
+
authorizationEndpoint: "https://id.kick.com/oauth/authorize",
|
|
21
|
+
scopes: _scopes,
|
|
22
|
+
codeVerifier,
|
|
23
|
+
state
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
async validateAuthorizationCode({ code, redirectURI, codeVerifier }) {
|
|
27
|
+
return validateAuthorizationCode({
|
|
28
|
+
code,
|
|
29
|
+
redirectURI,
|
|
30
|
+
options,
|
|
31
|
+
tokenEndpoint: "https://id.kick.com/oauth/token",
|
|
32
|
+
codeVerifier
|
|
33
|
+
});
|
|
34
|
+
},
|
|
35
|
+
refreshAccessToken: options.refreshAccessToken ? options.refreshAccessToken : async (refreshToken) => {
|
|
36
|
+
return refreshAccessToken({
|
|
37
|
+
refreshToken,
|
|
38
|
+
options: {
|
|
39
|
+
clientId: options.clientId,
|
|
40
|
+
clientSecret: options.clientSecret
|
|
41
|
+
},
|
|
42
|
+
tokenEndpoint: "https://id.kick.com/oauth/token"
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
async getUserInfo(token) {
|
|
46
|
+
if (options.getUserInfo) return options.getUserInfo(token);
|
|
47
|
+
const { data, error } = await betterFetch("https://api.kick.com/public/v1/users", {
|
|
48
|
+
method: "GET",
|
|
49
|
+
headers: { Authorization: `Bearer ${token.accessToken}` }
|
|
50
|
+
});
|
|
51
|
+
if (error) return null;
|
|
52
|
+
const profile = data.data[0];
|
|
53
|
+
const userMap = await options.mapProfileToUser?.(profile);
|
|
54
|
+
return {
|
|
55
|
+
user: {
|
|
56
|
+
id: profile.user_id,
|
|
57
|
+
name: profile.name,
|
|
58
|
+
email: profile.email,
|
|
59
|
+
image: profile.profile_picture,
|
|
60
|
+
emailVerified: false,
|
|
61
|
+
...userMap
|
|
62
|
+
},
|
|
63
|
+
data: profile
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
options
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
export { kick };
|
|
72
|
+
//# sourceMappingURL=kick.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kick.mjs","names":[],"sources":["../../src/social-providers/kick.ts"],"sourcesContent":["import { betterFetch } from \"@better-fetch/fetch\";\nimport type { OAuthProvider, ProviderOptions } from \"../oauth2\";\nimport {\n\tcreateAuthorizationURL,\n\trefreshAccessToken,\n\tvalidateAuthorizationCode,\n} from \"../oauth2\";\n\nexport interface KickProfile {\n\t/**\n\t * The user id of the user\n\t */\n\tuser_id: string;\n\t/**\n\t * The name of the user\n\t */\n\tname: string;\n\t/**\n\t * The email of the user\n\t */\n\temail: string;\n\t/**\n\t * The picture of the user\n\t */\n\tprofile_picture: string;\n}\n\nexport interface KickOptions extends ProviderOptions<KickProfile> {\n\tclientId: string;\n}\n\nexport const kick = (options: KickOptions) => {\n\treturn {\n\t\tid: \"kick\",\n\t\tname: \"Kick\",\n\t\tcreateAuthorizationURL({ state, scopes, redirectURI, codeVerifier }) {\n\t\t\tconst _scopes = options.disableDefaultScope ? [] : [\"user:read\"];\n\t\t\tif (options.scope) _scopes.push(...options.scope);\n\t\t\tif (scopes) _scopes.push(...scopes);\n\n\t\t\treturn createAuthorizationURL({\n\t\t\t\tid: \"kick\",\n\t\t\t\tredirectURI,\n\t\t\t\toptions,\n\t\t\t\tauthorizationEndpoint: \"https://id.kick.com/oauth/authorize\",\n\t\t\t\tscopes: _scopes,\n\t\t\t\tcodeVerifier,\n\t\t\t\tstate,\n\t\t\t});\n\t\t},\n\t\tasync validateAuthorizationCode({ code, redirectURI, codeVerifier }) {\n\t\t\treturn validateAuthorizationCode({\n\t\t\t\tcode,\n\t\t\t\tredirectURI,\n\t\t\t\toptions,\n\t\t\t\ttokenEndpoint: \"https://id.kick.com/oauth/token\",\n\t\t\t\tcodeVerifier,\n\t\t\t});\n\t\t},\n\t\trefreshAccessToken: options.refreshAccessToken\n\t\t\t? options.refreshAccessToken\n\t\t\t: async (refreshToken) => {\n\t\t\t\t\treturn refreshAccessToken({\n\t\t\t\t\t\trefreshToken,\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\tclientId: options.clientId,\n\t\t\t\t\t\t\tclientSecret: options.clientSecret,\n\t\t\t\t\t\t},\n\t\t\t\t\t\ttokenEndpoint: \"https://id.kick.com/oauth/token\",\n\t\t\t\t\t});\n\t\t\t\t},\n\t\tasync getUserInfo(token) {\n\t\t\tif (options.getUserInfo) {\n\t\t\t\treturn options.getUserInfo(token);\n\t\t\t}\n\n\t\t\tconst { data, error } = await betterFetch<{\n\t\t\t\tdata: KickProfile[];\n\t\t\t}>(\"https://api.kick.com/public/v1/users\", {\n\t\t\t\tmethod: \"GET\",\n\t\t\t\theaders: {\n\t\t\t\t\tAuthorization: `Bearer ${token.accessToken}`,\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tif (error) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tconst profile = data.data[0]!;\n\n\t\t\tconst userMap = await options.mapProfileToUser?.(profile);\n\t\t\t// Kick does not provide email_verified claim.\n\t\t\t// We default to false for security consistency.\n\t\t\treturn {\n\t\t\t\tuser: {\n\t\t\t\t\tid: profile.user_id,\n\t\t\t\t\tname: profile.name,\n\t\t\t\t\temail: profile.email,\n\t\t\t\t\timage: profile.profile_picture,\n\t\t\t\t\temailVerified: false,\n\t\t\t\t\t...userMap,\n\t\t\t\t},\n\t\t\t\tdata: profile,\n\t\t\t};\n\t\t},\n\t\toptions,\n\t} satisfies OAuthProvider<KickProfile>;\n};\n"],"mappings":";;;;;;;AA+BA,MAAa,QAAQ,YAAyB;AAC7C,QAAO;EACN,IAAI;EACJ,MAAM;EACN,uBAAuB,EAAE,OAAO,QAAQ,aAAa,gBAAgB;GACpE,MAAM,UAAU,QAAQ,sBAAsB,EAAE,GAAG,CAAC,YAAY;AAChE,OAAI,QAAQ,MAAO,SAAQ,KAAK,GAAG,QAAQ,MAAM;AACjD,OAAI,OAAQ,SAAQ,KAAK,GAAG,OAAO;AAEnC,UAAO,uBAAuB;IAC7B,IAAI;IACJ;IACA;IACA,uBAAuB;IACvB,QAAQ;IACR;IACA;IACA,CAAC;;EAEH,MAAM,0BAA0B,EAAE,MAAM,aAAa,gBAAgB;AACpE,UAAO,0BAA0B;IAChC;IACA;IACA;IACA,eAAe;IACf;IACA,CAAC;;EAEH,oBAAoB,QAAQ,qBACzB,QAAQ,qBACR,OAAO,iBAAiB;AACxB,UAAO,mBAAmB;IACzB;IACA,SAAS;KACR,UAAU,QAAQ;KAClB,cAAc,QAAQ;KACtB;IACD,eAAe;IACf,CAAC;;EAEL,MAAM,YAAY,OAAO;AACxB,OAAI,QAAQ,YACX,QAAO,QAAQ,YAAY,MAAM;GAGlC,MAAM,EAAE,MAAM,UAAU,MAAM,YAE3B,wCAAwC;IAC1C,QAAQ;IACR,SAAS,EACR,eAAe,UAAU,MAAM,eAC/B;IACD,CAAC;AAEF,OAAI,MACH,QAAO;GAGR,MAAM,UAAU,KAAK,KAAK;GAE1B,MAAM,UAAU,MAAM,QAAQ,mBAAmB,QAAQ;AAGzD,UAAO;IACN,MAAM;KACL,IAAI,QAAQ;KACZ,MAAM,QAAQ;KACd,OAAO,QAAQ;KACf,OAAO,QAAQ;KACf,eAAe;KACf,GAAG;KACH;IACD,MAAM;IACN;;EAEF;EACA"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/social-providers/line.d.ts
|
|
5
|
+
interface LineIdTokenPayload {
|
|
6
|
+
iss: string;
|
|
7
|
+
sub: string;
|
|
8
|
+
aud: string;
|
|
9
|
+
exp: number;
|
|
10
|
+
iat: number;
|
|
11
|
+
name?: string | undefined;
|
|
12
|
+
picture?: string | undefined;
|
|
13
|
+
email?: string | undefined;
|
|
14
|
+
amr?: string[] | undefined;
|
|
15
|
+
nonce?: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
interface LineUserInfo {
|
|
18
|
+
sub: string;
|
|
19
|
+
name?: string | undefined;
|
|
20
|
+
picture?: string | undefined;
|
|
21
|
+
email?: string | undefined;
|
|
22
|
+
}
|
|
23
|
+
interface LineOptions extends ProviderOptions<LineUserInfo | LineIdTokenPayload> {
|
|
24
|
+
clientId: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* LINE Login v2.1
|
|
28
|
+
* - Authorization endpoint: https://access.line.me/oauth2/v2.1/authorize
|
|
29
|
+
* - Token endpoint: https://api.line.me/oauth2/v2.1/token
|
|
30
|
+
* - UserInfo endpoint: https://api.line.me/oauth2/v2.1/userinfo
|
|
31
|
+
* - Verify ID token: https://api.line.me/oauth2/v2.1/verify
|
|
32
|
+
*
|
|
33
|
+
* Docs: https://developers.line.biz/en/reference/line-login/#issue-access-token
|
|
34
|
+
*/
|
|
35
|
+
declare const line: (options: LineOptions) => {
|
|
36
|
+
id: "line";
|
|
37
|
+
name: string;
|
|
38
|
+
createAuthorizationURL({
|
|
39
|
+
state,
|
|
40
|
+
scopes,
|
|
41
|
+
codeVerifier,
|
|
42
|
+
redirectURI,
|
|
43
|
+
loginHint
|
|
44
|
+
}: {
|
|
45
|
+
state: string;
|
|
46
|
+
codeVerifier: string;
|
|
47
|
+
scopes?: string[] | undefined;
|
|
48
|
+
redirectURI: string;
|
|
49
|
+
display?: string | undefined;
|
|
50
|
+
loginHint?: string | undefined;
|
|
51
|
+
}): Promise<URL>;
|
|
52
|
+
validateAuthorizationCode: ({
|
|
53
|
+
code,
|
|
54
|
+
codeVerifier,
|
|
55
|
+
redirectURI
|
|
56
|
+
}: {
|
|
57
|
+
code: string;
|
|
58
|
+
redirectURI: string;
|
|
59
|
+
codeVerifier?: string | undefined;
|
|
60
|
+
deviceId?: string | undefined;
|
|
61
|
+
}) => Promise<OAuth2Tokens>;
|
|
62
|
+
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
63
|
+
verifyIdToken(token: string, nonce: string | undefined): Promise<boolean>;
|
|
64
|
+
getUserInfo(token: OAuth2Tokens & {
|
|
65
|
+
user?: {
|
|
66
|
+
name?: {
|
|
67
|
+
firstName?: string;
|
|
68
|
+
lastName?: string;
|
|
69
|
+
};
|
|
70
|
+
email?: string;
|
|
71
|
+
} | undefined;
|
|
72
|
+
}): Promise<{
|
|
73
|
+
user: {
|
|
74
|
+
id: string;
|
|
75
|
+
name?: string;
|
|
76
|
+
email?: string | null;
|
|
77
|
+
image?: string;
|
|
78
|
+
emailVerified: boolean;
|
|
79
|
+
[key: string]: any;
|
|
80
|
+
};
|
|
81
|
+
data: any;
|
|
82
|
+
} | {
|
|
83
|
+
user: {
|
|
84
|
+
id: any;
|
|
85
|
+
name: any;
|
|
86
|
+
email: any;
|
|
87
|
+
image: any;
|
|
88
|
+
emailVerified: false;
|
|
89
|
+
} | {
|
|
90
|
+
id: any;
|
|
91
|
+
name: any;
|
|
92
|
+
email: any;
|
|
93
|
+
image: any;
|
|
94
|
+
emailVerified: boolean;
|
|
95
|
+
} | {
|
|
96
|
+
id: any;
|
|
97
|
+
name: any;
|
|
98
|
+
email: any;
|
|
99
|
+
image: any;
|
|
100
|
+
emailVerified: boolean;
|
|
101
|
+
};
|
|
102
|
+
data: any;
|
|
103
|
+
} | null>;
|
|
104
|
+
options: LineOptions;
|
|
105
|
+
};
|
|
106
|
+
//#endregion
|
|
107
|
+
export { LineIdTokenPayload, LineOptions, LineUserInfo, line };
|
|
108
|
+
//# sourceMappingURL=line.d.mts.map
|