@better-auth/core 1.6.23 → 1.6.25
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/api/index.d.mts +28 -28
- package/dist/async_hooks/index.d.mts +0 -1
- package/dist/async_hooks/pure.index.d.mts +0 -1
- package/dist/context/endpoint-context.d.mts +1 -1
- package/dist/context/global.d.mts +0 -1
- package/dist/context/global.mjs +1 -1
- package/dist/context/request-state.d.mts +0 -1
- package/dist/context/request-state.mjs +8 -5
- package/dist/context/transaction.d.mts +1 -1
- package/dist/db/adapter/factory.d.mts +3 -5
- package/dist/db/adapter/factory.mjs +1 -1
- package/dist/db/adapter/get-default-field-name.d.mts +2 -9
- package/dist/db/adapter/get-default-model-name.d.mts +1 -5
- package/dist/db/adapter/get-default-model-name.mjs +6 -5
- package/dist/db/adapter/get-field-attributes.d.mts +4 -11
- package/dist/db/adapter/get-field-name.d.mts +2 -9
- package/dist/db/adapter/get-id-field.d.mts +4 -12
- package/dist/db/adapter/get-model-name.d.mts +1 -5
- package/dist/db/adapter/index.d.mts +7 -32
- package/dist/db/adapter/types.d.mts +5 -17
- package/dist/db/adapter/utils.d.mts +0 -1
- package/dist/db/get-tables.d.mts +1 -0
- package/dist/db/get-tables.mjs +2 -2
- package/dist/db/plugin.d.mts +1 -2
- package/dist/db/schema/account.d.mts +1 -1
- package/dist/db/schema/account.mjs +12 -0
- package/dist/db/schema/rate-limit.d.mts +1 -1
- package/dist/db/schema/rate-limit.mjs +9 -0
- package/dist/db/schema/session.d.mts +1 -1
- package/dist/db/schema/shared.d.mts +0 -1
- package/dist/db/schema/user.d.mts +1 -1
- package/dist/db/schema/verification.d.mts +1 -1
- package/dist/db/type.d.mts +5 -8
- package/dist/env/logger.d.mts +25 -25
- package/dist/error/codes.d.mts +0 -1
- package/dist/error/index.d.mts +0 -1
- package/dist/index.d.mts +1 -1
- package/dist/instrumentation/attributes.d.mts +0 -1
- package/dist/instrumentation/pure.index.d.mts +0 -1
- package/dist/instrumentation/tracer.mjs +1 -1
- package/dist/oauth2/client-credentials-token.d.mts +4 -20
- package/dist/oauth2/client-credentials-token.mjs +1 -4
- package/dist/oauth2/create-authorization-url.d.mts +3 -20
- package/dist/oauth2/oauth-provider.d.mts +9 -3
- package/dist/oauth2/refresh-access-token.d.mts +4 -22
- package/dist/oauth2/refresh-access-token.mjs +2 -8
- package/dist/oauth2/reject-redirects.mjs +1 -1
- package/dist/oauth2/utils.d.mts +0 -1
- package/dist/oauth2/utils.mjs +1 -2
- package/dist/oauth2/validate-authorization-code.d.mts +6 -37
- package/dist/oauth2/verify.d.mts +12 -10
- package/dist/oauth2/verify.mjs +2 -2
- package/dist/social-providers/apple.d.mts +7 -28
- package/dist/social-providers/apple.mjs +4 -3
- package/dist/social-providers/atlassian.d.mts +3 -11
- package/dist/social-providers/cognito.d.mts +6 -12
- package/dist/social-providers/cognito.mjs +2 -2
- package/dist/social-providers/discord.d.mts +3 -9
- package/dist/social-providers/dropbox.d.mts +3 -11
- package/dist/social-providers/facebook.d.mts +6 -11
- package/dist/social-providers/facebook.mjs +2 -2
- package/dist/social-providers/figma.d.mts +3 -11
- package/dist/social-providers/github.d.mts +3 -12
- package/dist/social-providers/gitlab.d.mts +3 -12
- package/dist/social-providers/google.d.mts +7 -20
- package/dist/social-providers/google.mjs +2 -2
- package/dist/social-providers/huggingface.d.mts +3 -11
- package/dist/social-providers/index.d.mts +78 -362
- package/dist/social-providers/kakao.d.mts +3 -9
- package/dist/social-providers/kick.d.mts +3 -11
- package/dist/social-providers/line.d.mts +6 -13
- package/dist/social-providers/line.mjs +2 -2
- package/dist/social-providers/linear.d.mts +3 -10
- package/dist/social-providers/linkedin.d.mts +3 -10
- package/dist/social-providers/microsoft-entra-id.d.mts +5 -6
- package/dist/social-providers/microsoft-entra-id.mjs +4 -3
- package/dist/social-providers/naver.d.mts +22 -18
- package/dist/social-providers/notion.d.mts +3 -10
- package/dist/social-providers/paybin.d.mts +3 -12
- package/dist/social-providers/paypal.d.mts +6 -10
- package/dist/social-providers/paypal.mjs +2 -2
- package/dist/social-providers/polar.d.mts +3 -11
- package/dist/social-providers/railway.d.mts +3 -11
- package/dist/social-providers/reddit.d.mts +3 -9
- package/dist/social-providers/roblox.d.mts +3 -9
- package/dist/social-providers/salesforce.d.mts +3 -11
- package/dist/social-providers/slack.d.mts +3 -9
- package/dist/social-providers/spotify.d.mts +3 -11
- package/dist/social-providers/tiktok.d.mts +5 -10
- package/dist/social-providers/twitch.d.mts +3 -9
- package/dist/social-providers/twitter.d.mts +26 -17
- package/dist/social-providers/vercel.d.mts +3 -11
- package/dist/social-providers/vk.d.mts +3 -12
- package/dist/social-providers/vk.mjs +4 -5
- package/dist/social-providers/wechat.d.mts +3 -8
- package/dist/social-providers/zoom.d.mts +5 -14
- package/dist/types/context.d.mts +2 -1
- package/dist/types/cookie.d.mts +0 -1
- package/dist/types/helper.d.mts +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/init-options.d.mts +10 -7
- package/dist/types/plugin-client.d.mts +1 -3
- package/dist/types/plugin.d.mts +2 -2
- package/dist/utils/async.d.mts +0 -1
- package/dist/utils/db.d.mts +1 -0
- package/dist/utils/deprecate.d.mts +0 -1
- package/dist/utils/error-codes.d.mts +2 -2
- package/dist/utils/host.d.mts +27 -1
- package/dist/utils/host.mjs +1 -1
- package/dist/utils/ip.d.mts +1 -0
- package/dist/utils/ip.mjs +1 -1
- package/dist/utils/is-api-error.d.mts +0 -1
- package/dist/utils/redirect-uri.d.mts +0 -1
- package/package.json +2 -2
- package/src/context/request-state.ts +26 -6
- package/src/db/adapter/get-default-model-name.ts +23 -14
- package/src/db/get-tables.ts +17 -2
- package/src/oauth2/oauth-provider.ts +20 -4
- package/src/social-providers/apple.ts +9 -3
- package/src/social-providers/cognito.ts +7 -2
- package/src/social-providers/facebook.ts +7 -2
- package/src/social-providers/google.ts +7 -2
- package/src/social-providers/line.ts +7 -2
- package/src/social-providers/microsoft-entra-id.ts +7 -2
- package/src/social-providers/paypal.ts +7 -2
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/atlassian.d.ts
|
|
3
4
|
interface AtlassianProfile {
|
|
4
5
|
account_type?: string | undefined;
|
|
@@ -21,12 +22,7 @@ interface AtlassianOptions extends ProviderOptions<AtlassianProfile> {
|
|
|
21
22
|
declare const atlassian: (options: AtlassianOptions) => {
|
|
22
23
|
id: "atlassian";
|
|
23
24
|
name: string;
|
|
24
|
-
createAuthorizationURL({
|
|
25
|
-
state,
|
|
26
|
-
scopes,
|
|
27
|
-
codeVerifier,
|
|
28
|
-
redirectURI
|
|
29
|
-
}: {
|
|
25
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }: {
|
|
30
26
|
state: string;
|
|
31
27
|
codeVerifier: string;
|
|
32
28
|
scopes?: string[] | undefined;
|
|
@@ -34,11 +30,7 @@ declare const atlassian: (options: AtlassianOptions) => {
|
|
|
34
30
|
display?: string | undefined;
|
|
35
31
|
loginHint?: string | undefined;
|
|
36
32
|
}): Promise<URL>;
|
|
37
|
-
validateAuthorizationCode: ({
|
|
38
|
-
code,
|
|
39
|
-
codeVerifier,
|
|
40
|
-
redirectURI
|
|
41
|
-
}: {
|
|
33
|
+
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
|
|
42
34
|
code: string;
|
|
43
35
|
redirectURI: string;
|
|
44
36
|
codeVerifier?: string | undefined;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { GenericEndpointContext } from "../types/context.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
1
3
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
4
|
+
import "../oauth2/index.mjs";
|
|
2
5
|
//#region src/social-providers/cognito.d.ts
|
|
3
6
|
interface CognitoProfile {
|
|
4
7
|
sub: string;
|
|
@@ -34,12 +37,7 @@ interface CognitoOptions extends ProviderOptions<CognitoProfile> {
|
|
|
34
37
|
declare const cognito: (options: CognitoOptions) => {
|
|
35
38
|
id: "cognito";
|
|
36
39
|
name: string;
|
|
37
|
-
createAuthorizationURL({
|
|
38
|
-
state,
|
|
39
|
-
scopes,
|
|
40
|
-
codeVerifier,
|
|
41
|
-
redirectURI
|
|
42
|
-
}: {
|
|
40
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }: {
|
|
43
41
|
state: string;
|
|
44
42
|
codeVerifier: string;
|
|
45
43
|
scopes?: string[] | undefined;
|
|
@@ -47,18 +45,14 @@ declare const cognito: (options: CognitoOptions) => {
|
|
|
47
45
|
display?: string | undefined;
|
|
48
46
|
loginHint?: string | undefined;
|
|
49
47
|
}): Promise<URL>;
|
|
50
|
-
validateAuthorizationCode: ({
|
|
51
|
-
code,
|
|
52
|
-
codeVerifier,
|
|
53
|
-
redirectURI
|
|
54
|
-
}: {
|
|
48
|
+
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
|
|
55
49
|
code: string;
|
|
56
50
|
redirectURI: string;
|
|
57
51
|
codeVerifier?: string | undefined;
|
|
58
52
|
deviceId?: string | undefined;
|
|
59
53
|
}) => Promise<OAuth2Tokens>;
|
|
60
54
|
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
61
|
-
verifyIdToken(token: string, nonce
|
|
55
|
+
verifyIdToken(token: string, nonce?: string, ctx?: GenericEndpointContext): Promise<boolean>;
|
|
62
56
|
getUserInfo(token: OAuth2Tokens & {
|
|
63
57
|
user?: {
|
|
64
58
|
name?: {
|
|
@@ -75,9 +75,9 @@ const cognito = (options) => {
|
|
|
75
75
|
tokenEndpoint
|
|
76
76
|
});
|
|
77
77
|
},
|
|
78
|
-
async verifyIdToken(token, nonce) {
|
|
78
|
+
async verifyIdToken(token, nonce, ctx) {
|
|
79
79
|
if (options.disableIdTokenSignIn) return false;
|
|
80
|
-
if (options.verifyIdToken) return options.verifyIdToken(token, nonce);
|
|
80
|
+
if (options.verifyIdToken) return options.verifyIdToken(token, nonce, ctx);
|
|
81
81
|
try {
|
|
82
82
|
const { kid, alg: jwtAlg } = decodeProtectedHeader(token);
|
|
83
83
|
if (!kid || !jwtAlg) return false;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/discord.d.ts
|
|
3
4
|
interface DiscordProfile extends Record<string, any> {
|
|
4
5
|
/** the user's id (i.e. the numerical snowflake) */
|
|
@@ -77,11 +78,7 @@ interface DiscordOptions extends ProviderOptions<DiscordProfile> {
|
|
|
77
78
|
declare const discord: (options: DiscordOptions) => {
|
|
78
79
|
id: "discord";
|
|
79
80
|
name: string;
|
|
80
|
-
createAuthorizationURL({
|
|
81
|
-
state,
|
|
82
|
-
scopes,
|
|
83
|
-
redirectURI
|
|
84
|
-
}: {
|
|
81
|
+
createAuthorizationURL({ state, scopes, redirectURI }: {
|
|
85
82
|
state: string;
|
|
86
83
|
codeVerifier: string;
|
|
87
84
|
scopes?: string[] | undefined;
|
|
@@ -89,10 +86,7 @@ declare const discord: (options: DiscordOptions) => {
|
|
|
89
86
|
display?: string | undefined;
|
|
90
87
|
loginHint?: string | undefined;
|
|
91
88
|
}): URL;
|
|
92
|
-
validateAuthorizationCode: ({
|
|
93
|
-
code,
|
|
94
|
-
redirectURI
|
|
95
|
-
}: {
|
|
89
|
+
validateAuthorizationCode: ({ code, redirectURI }: {
|
|
96
90
|
code: string;
|
|
97
91
|
redirectURI: string;
|
|
98
92
|
codeVerifier?: string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/dropbox.d.ts
|
|
3
4
|
interface DropboxProfile {
|
|
4
5
|
account_id: string;
|
|
@@ -20,12 +21,7 @@ interface DropboxOptions extends ProviderOptions<DropboxProfile> {
|
|
|
20
21
|
declare const dropbox: (options: DropboxOptions) => {
|
|
21
22
|
id: "dropbox";
|
|
22
23
|
name: string;
|
|
23
|
-
createAuthorizationURL: ({
|
|
24
|
-
state,
|
|
25
|
-
scopes,
|
|
26
|
-
codeVerifier,
|
|
27
|
-
redirectURI
|
|
28
|
-
}: {
|
|
24
|
+
createAuthorizationURL: ({ state, scopes, codeVerifier, redirectURI }: {
|
|
29
25
|
state: string;
|
|
30
26
|
codeVerifier: string;
|
|
31
27
|
scopes?: string[] | undefined;
|
|
@@ -33,11 +29,7 @@ declare const dropbox: (options: DropboxOptions) => {
|
|
|
33
29
|
display?: string | undefined;
|
|
34
30
|
loginHint?: string | undefined;
|
|
35
31
|
}) => Promise<URL>;
|
|
36
|
-
validateAuthorizationCode: ({
|
|
37
|
-
code,
|
|
38
|
-
codeVerifier,
|
|
39
|
-
redirectURI
|
|
40
|
-
}: {
|
|
32
|
+
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
|
|
41
33
|
code: string;
|
|
42
34
|
redirectURI: string;
|
|
43
35
|
codeVerifier?: string | undefined;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import { GenericEndpointContext } from "../types/context.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
1
3
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
4
|
+
import "../oauth2/index.mjs";
|
|
2
5
|
//#region src/social-providers/facebook.d.ts
|
|
3
6
|
interface FacebookProfile {
|
|
4
7
|
id: string;
|
|
@@ -30,12 +33,7 @@ interface FacebookOptions extends ProviderOptions<FacebookProfile> {
|
|
|
30
33
|
declare const facebook: (options: FacebookOptions) => {
|
|
31
34
|
id: "facebook";
|
|
32
35
|
name: string;
|
|
33
|
-
createAuthorizationURL({
|
|
34
|
-
state,
|
|
35
|
-
scopes,
|
|
36
|
-
redirectURI,
|
|
37
|
-
loginHint
|
|
38
|
-
}: {
|
|
36
|
+
createAuthorizationURL({ state, scopes, redirectURI, loginHint }: {
|
|
39
37
|
state: string;
|
|
40
38
|
codeVerifier: string;
|
|
41
39
|
scopes?: string[] | undefined;
|
|
@@ -43,16 +41,13 @@ declare const facebook: (options: FacebookOptions) => {
|
|
|
43
41
|
display?: string | undefined;
|
|
44
42
|
loginHint?: string | undefined;
|
|
45
43
|
}): Promise<URL>;
|
|
46
|
-
validateAuthorizationCode: ({
|
|
47
|
-
code,
|
|
48
|
-
redirectURI
|
|
49
|
-
}: {
|
|
44
|
+
validateAuthorizationCode: ({ code, redirectURI }: {
|
|
50
45
|
code: string;
|
|
51
46
|
redirectURI: string;
|
|
52
47
|
codeVerifier?: string | undefined;
|
|
53
48
|
deviceId?: string | undefined;
|
|
54
49
|
}) => Promise<OAuth2Tokens>;
|
|
55
|
-
verifyIdToken(token: string, nonce
|
|
50
|
+
verifyIdToken(token: string, nonce?: string, ctx?: GenericEndpointContext): Promise<boolean>;
|
|
56
51
|
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
57
52
|
getUserInfo(token: OAuth2Tokens & {
|
|
58
53
|
user?: {
|
|
@@ -66,9 +66,9 @@ const facebook = (options) => {
|
|
|
66
66
|
tokenEndpoint: "https://graph.facebook.com/v24.0/oauth/access_token"
|
|
67
67
|
});
|
|
68
68
|
},
|
|
69
|
-
async verifyIdToken(token, nonce) {
|
|
69
|
+
async verifyIdToken(token, nonce, ctx) {
|
|
70
70
|
if (options.disableIdTokenSignIn) return false;
|
|
71
|
-
if (options.verifyIdToken) return options.verifyIdToken(token, nonce);
|
|
71
|
+
if (options.verifyIdToken) return options.verifyIdToken(token, nonce, ctx);
|
|
72
72
|
if (token.split(".").length === 3) try {
|
|
73
73
|
const { payload: jwtClaims } = await jwtVerify(token, createRemoteJWKSet(new URL("https://limited.facebook.com/.well-known/oauth/openid/jwks/")), {
|
|
74
74
|
algorithms: ["RS256"],
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/figma.d.ts
|
|
3
4
|
interface FigmaProfile {
|
|
4
5
|
id: string;
|
|
@@ -12,12 +13,7 @@ interface FigmaOptions extends ProviderOptions<FigmaProfile> {
|
|
|
12
13
|
declare const figma: (options: FigmaOptions) => {
|
|
13
14
|
id: "figma";
|
|
14
15
|
name: string;
|
|
15
|
-
createAuthorizationURL({
|
|
16
|
-
state,
|
|
17
|
-
scopes,
|
|
18
|
-
codeVerifier,
|
|
19
|
-
redirectURI
|
|
20
|
-
}: {
|
|
16
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }: {
|
|
21
17
|
state: string;
|
|
22
18
|
codeVerifier: string;
|
|
23
19
|
scopes?: string[] | undefined;
|
|
@@ -25,11 +21,7 @@ declare const figma: (options: FigmaOptions) => {
|
|
|
25
21
|
display?: string | undefined;
|
|
26
22
|
loginHint?: string | undefined;
|
|
27
23
|
}): Promise<URL>;
|
|
28
|
-
validateAuthorizationCode: ({
|
|
29
|
-
code,
|
|
30
|
-
codeVerifier,
|
|
31
|
-
redirectURI
|
|
32
|
-
}: {
|
|
24
|
+
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
|
|
33
25
|
code: string;
|
|
34
26
|
redirectURI: string;
|
|
35
27
|
codeVerifier?: string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/github.d.ts
|
|
3
4
|
interface GithubProfile {
|
|
4
5
|
login: string;
|
|
@@ -52,13 +53,7 @@ interface GithubOptions extends ProviderOptions<GithubProfile> {
|
|
|
52
53
|
declare const github: (options: GithubOptions) => {
|
|
53
54
|
id: "github";
|
|
54
55
|
name: string;
|
|
55
|
-
createAuthorizationURL({
|
|
56
|
-
state,
|
|
57
|
-
scopes,
|
|
58
|
-
loginHint,
|
|
59
|
-
codeVerifier,
|
|
60
|
-
redirectURI
|
|
61
|
-
}: {
|
|
56
|
+
createAuthorizationURL({ state, scopes, loginHint, codeVerifier, redirectURI }: {
|
|
62
57
|
state: string;
|
|
63
58
|
codeVerifier: string;
|
|
64
59
|
scopes?: string[] | undefined;
|
|
@@ -66,11 +61,7 @@ declare const github: (options: GithubOptions) => {
|
|
|
66
61
|
display?: string | undefined;
|
|
67
62
|
loginHint?: string | undefined;
|
|
68
63
|
}): Promise<URL>;
|
|
69
|
-
validateAuthorizationCode: ({
|
|
70
|
-
code,
|
|
71
|
-
codeVerifier,
|
|
72
|
-
redirectURI
|
|
73
|
-
}: {
|
|
64
|
+
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
|
|
74
65
|
code: string;
|
|
75
66
|
redirectURI: string;
|
|
76
67
|
codeVerifier?: string | undefined;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/gitlab.d.ts
|
|
3
4
|
interface GitlabProfile extends Record<string, any> {
|
|
4
5
|
id: number;
|
|
@@ -52,13 +53,7 @@ interface GitlabOptions extends ProviderOptions<GitlabProfile> {
|
|
|
52
53
|
declare const gitlab: (options: GitlabOptions) => {
|
|
53
54
|
id: "gitlab";
|
|
54
55
|
name: string;
|
|
55
|
-
createAuthorizationURL: ({
|
|
56
|
-
state,
|
|
57
|
-
scopes,
|
|
58
|
-
codeVerifier,
|
|
59
|
-
loginHint,
|
|
60
|
-
redirectURI
|
|
61
|
-
}: {
|
|
56
|
+
createAuthorizationURL: ({ state, scopes, codeVerifier, loginHint, redirectURI }: {
|
|
62
57
|
state: string;
|
|
63
58
|
codeVerifier: string;
|
|
64
59
|
scopes?: string[] | undefined;
|
|
@@ -66,11 +61,7 @@ declare const gitlab: (options: GitlabOptions) => {
|
|
|
66
61
|
display?: string | undefined;
|
|
67
62
|
loginHint?: string | undefined;
|
|
68
63
|
}) => Promise<URL>;
|
|
69
|
-
validateAuthorizationCode: ({
|
|
70
|
-
code,
|
|
71
|
-
redirectURI,
|
|
72
|
-
codeVerifier
|
|
73
|
-
}: {
|
|
64
|
+
validateAuthorizationCode: ({ code, redirectURI, codeVerifier }: {
|
|
74
65
|
code: string;
|
|
75
66
|
redirectURI: string;
|
|
76
67
|
codeVerifier?: string | undefined;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { GenericEndpointContext } from "../types/context.mjs";
|
|
2
|
+
import "../types/index.mjs";
|
|
1
3
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
4
|
+
import "../oauth2/index.mjs";
|
|
2
5
|
import { JWTPayload } from "jose";
|
|
3
|
-
|
|
4
6
|
//#region src/social-providers/google.d.ts
|
|
5
7
|
interface GoogleProfile {
|
|
6
8
|
aud: string;
|
|
@@ -57,11 +59,7 @@ interface VerifyGoogleIdTokenOptions {
|
|
|
57
59
|
* Verifies a Google ID token against Google's issuer, audience, signature,
|
|
58
60
|
* expiry, and maximum token age.
|
|
59
61
|
*/
|
|
60
|
-
declare const verifyGoogleIdToken: ({
|
|
61
|
-
token,
|
|
62
|
-
audience,
|
|
63
|
-
nonce
|
|
64
|
-
}: VerifyGoogleIdTokenOptions) => Promise<JWTPayload | null>;
|
|
62
|
+
declare const verifyGoogleIdToken: ({ token, audience, nonce }: VerifyGoogleIdTokenOptions) => Promise<JWTPayload | null>;
|
|
65
63
|
/**
|
|
66
64
|
* Checks whether Google's verified `hd` claim satisfies the configured hosted
|
|
67
65
|
* domain restriction. `hd: "*"` accepts any Google Workspace hosted domain.
|
|
@@ -70,14 +68,7 @@ declare const isGoogleHostedDomainAllowed: (configuredHostedDomain: string | und
|
|
|
70
68
|
declare const google: (options: GoogleOptions) => {
|
|
71
69
|
id: "google";
|
|
72
70
|
name: string;
|
|
73
|
-
createAuthorizationURL({
|
|
74
|
-
state,
|
|
75
|
-
scopes,
|
|
76
|
-
codeVerifier,
|
|
77
|
-
redirectURI,
|
|
78
|
-
loginHint,
|
|
79
|
-
display
|
|
80
|
-
}: {
|
|
71
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI, loginHint, display }: {
|
|
81
72
|
state: string;
|
|
82
73
|
codeVerifier: string;
|
|
83
74
|
scopes?: string[] | undefined;
|
|
@@ -85,18 +76,14 @@ declare const google: (options: GoogleOptions) => {
|
|
|
85
76
|
display?: string | undefined;
|
|
86
77
|
loginHint?: string | undefined;
|
|
87
78
|
}): Promise<URL>;
|
|
88
|
-
validateAuthorizationCode: ({
|
|
89
|
-
code,
|
|
90
|
-
codeVerifier,
|
|
91
|
-
redirectURI
|
|
92
|
-
}: {
|
|
79
|
+
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
|
|
93
80
|
code: string;
|
|
94
81
|
redirectURI: string;
|
|
95
82
|
codeVerifier?: string | undefined;
|
|
96
83
|
deviceId?: string | undefined;
|
|
97
84
|
}) => Promise<OAuth2Tokens>;
|
|
98
85
|
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
99
|
-
verifyIdToken(token: string, nonce
|
|
86
|
+
verifyIdToken(token: string, nonce?: string, ctx?: GenericEndpointContext): Promise<boolean>;
|
|
100
87
|
getUserInfo(token: OAuth2Tokens & {
|
|
101
88
|
user?: {
|
|
102
89
|
name?: {
|
|
@@ -91,9 +91,9 @@ const google = (options) => {
|
|
|
91
91
|
tokenEndpoint: "https://oauth2.googleapis.com/token"
|
|
92
92
|
});
|
|
93
93
|
},
|
|
94
|
-
async verifyIdToken(token, nonce) {
|
|
94
|
+
async verifyIdToken(token, nonce, ctx) {
|
|
95
95
|
if (options.disableIdTokenSignIn) return false;
|
|
96
|
-
if (options.verifyIdToken) return options.verifyIdToken(token, nonce);
|
|
96
|
+
if (options.verifyIdToken) return options.verifyIdToken(token, nonce, ctx);
|
|
97
97
|
const jwtClaims = await verifyGoogleIdToken({
|
|
98
98
|
token,
|
|
99
99
|
audience: options.clientId,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { OAuth2Tokens, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
+
import "../oauth2/index.mjs";
|
|
2
3
|
//#region src/social-providers/huggingface.d.ts
|
|
3
4
|
interface HuggingFaceProfile {
|
|
4
5
|
sub: string;
|
|
@@ -34,12 +35,7 @@ interface HuggingFaceOptions extends ProviderOptions<HuggingFaceProfile> {
|
|
|
34
35
|
declare const huggingface: (options: HuggingFaceOptions) => {
|
|
35
36
|
id: "huggingface";
|
|
36
37
|
name: string;
|
|
37
|
-
createAuthorizationURL({
|
|
38
|
-
state,
|
|
39
|
-
scopes,
|
|
40
|
-
codeVerifier,
|
|
41
|
-
redirectURI
|
|
42
|
-
}: {
|
|
38
|
+
createAuthorizationURL({ state, scopes, codeVerifier, redirectURI }: {
|
|
43
39
|
state: string;
|
|
44
40
|
codeVerifier: string;
|
|
45
41
|
scopes?: string[] | undefined;
|
|
@@ -47,11 +43,7 @@ declare const huggingface: (options: HuggingFaceOptions) => {
|
|
|
47
43
|
display?: string | undefined;
|
|
48
44
|
loginHint?: string | undefined;
|
|
49
45
|
}): Promise<URL>;
|
|
50
|
-
validateAuthorizationCode: ({
|
|
51
|
-
code,
|
|
52
|
-
codeVerifier,
|
|
53
|
-
redirectURI
|
|
54
|
-
}: {
|
|
46
|
+
validateAuthorizationCode: ({ code, codeVerifier, redirectURI }: {
|
|
55
47
|
code: string;
|
|
56
48
|
redirectURI: string;
|
|
57
49
|
codeVerifier?: string | undefined;
|