@better-auth/core 1.7.0-rc.4 → 1.7.0-rc.6
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 +39 -60
- package/dist/api/index.mjs +39 -26
- package/dist/async_hooks/index.d.mts +1 -0
- package/dist/async_hooks/pure.index.d.mts +1 -0
- package/dist/context/endpoint-context.d.mts +1 -1
- package/dist/context/global.d.mts +1 -0
- package/dist/context/global.mjs +1 -1
- package/dist/context/request-state.d.mts +1 -0
- package/dist/context/transaction.d.mts +2 -3
- package/dist/db/adapter/factory.d.mts +5 -3
- package/dist/db/adapter/factory.mjs +1 -1
- package/dist/db/adapter/get-default-field-name.d.mts +9 -2
- package/dist/db/adapter/get-default-model-name.d.mts +5 -1
- package/dist/db/adapter/get-field-attributes.d.mts +11 -4
- package/dist/db/adapter/get-field-name.d.mts +9 -2
- package/dist/db/adapter/get-id-field.d.mts +12 -4
- package/dist/db/adapter/get-model-name.d.mts +5 -1
- package/dist/db/adapter/index.d.mts +32 -7
- package/dist/db/adapter/types.d.mts +17 -5
- package/dist/db/adapter/utils.d.mts +1 -0
- package/dist/db/database-index.d.mts +12 -2
- package/dist/db/get-tables.d.mts +0 -1
- package/dist/db/plugin.d.mts +3 -3
- package/dist/db/schema/account.d.mts +1 -1
- package/dist/db/schema/rate-limit.d.mts +1 -1
- package/dist/db/schema/session.d.mts +1 -1
- package/dist/db/schema/shared.d.mts +1 -0
- package/dist/db/schema/user.d.mts +1 -1
- package/dist/db/schema/verification.d.mts +1 -1
- package/dist/db/type.d.mts +11 -8
- package/dist/env/logger.d.mts +25 -25
- package/dist/error/codes.d.mts +1 -0
- package/dist/error/index.d.mts +1 -0
- package/dist/index.d.mts +1 -1
- package/dist/instrumentation/attributes.d.mts +1 -0
- package/dist/instrumentation/pure.index.d.mts +1 -0
- package/dist/instrumentation/tracer.mjs +1 -1
- package/dist/oauth2/authorization-params.d.mts +1 -0
- package/dist/oauth2/client-assertion.d.mts +13 -3
- package/dist/oauth2/client-credentials-token.d.mts +17 -3
- package/dist/oauth2/create-authorization-url.d.mts +21 -3
- package/dist/oauth2/dpop.d.mts +23 -2
- package/dist/oauth2/dpop.mjs +1 -1
- package/dist/oauth2/oauth-provider.d.mts +7 -13
- package/dist/oauth2/refresh-access-token.d.mts +19 -3
- package/dist/oauth2/refresh-access-token.mjs +1 -1
- package/dist/oauth2/reject-redirects.mjs +1 -1
- package/dist/oauth2/token-endpoint-auth.d.mts +1 -0
- package/dist/oauth2/utils.d.mts +1 -0
- package/dist/oauth2/utils.mjs +1 -1
- package/dist/oauth2/validate-authorization-code.d.mts +29 -5
- package/dist/oauth2/verify-id-token.d.mts +1 -1
- package/dist/oauth2/verify.d.mts +7 -5
- package/dist/oauth2/verify.mjs +2 -2
- package/dist/social-providers/apple.d.mts +18 -5
- package/dist/social-providers/atlassian.d.mts +15 -4
- package/dist/social-providers/cognito.d.mts +18 -5
- package/dist/social-providers/discord.d.mts +13 -4
- package/dist/social-providers/dropbox.d.mts +15 -4
- package/dist/social-providers/facebook.d.mts +18 -6
- package/dist/social-providers/figma.d.mts +15 -4
- package/dist/social-providers/github.d.mts +16 -4
- package/dist/social-providers/gitlab.d.mts +16 -4
- package/dist/social-providers/google.d.mts +25 -6
- package/dist/social-providers/huggingface.d.mts +15 -4
- package/dist/social-providers/index.d.mts +504 -113
- package/dist/social-providers/kakao.d.mts +13 -4
- package/dist/social-providers/kick.d.mts +15 -4
- package/dist/social-providers/line.d.mts +16 -4
- package/dist/social-providers/linear.d.mts +14 -4
- package/dist/social-providers/linkedin.d.mts +14 -4
- package/dist/social-providers/microsoft-entra-id.d.mts +14 -5
- package/dist/social-providers/microsoft-entra-id.mjs +1 -2
- package/dist/social-providers/naver.d.mts +22 -23
- package/dist/social-providers/notion.d.mts +14 -4
- package/dist/social-providers/paybin.d.mts +16 -4
- package/dist/social-providers/paypal.d.mts +13 -4
- package/dist/social-providers/polar.d.mts +15 -4
- package/dist/social-providers/railway.d.mts +15 -4
- package/dist/social-providers/reddit.d.mts +13 -4
- package/dist/social-providers/roblox.d.mts +13 -4
- package/dist/social-providers/salesforce.d.mts +15 -4
- package/dist/social-providers/slack.d.mts +13 -4
- package/dist/social-providers/spotify.d.mts +15 -4
- package/dist/social-providers/tiktok.d.mts +14 -6
- package/dist/social-providers/twitch.d.mts +13 -4
- package/dist/social-providers/twitter.d.mts +19 -26
- package/dist/social-providers/vercel.d.mts +15 -4
- package/dist/social-providers/vk.d.mts +16 -4
- package/dist/social-providers/wechat.d.mts +12 -4
- package/dist/social-providers/zoom.d.mts +18 -6
- package/dist/types/context.d.mts +2 -2
- package/dist/types/cookie.d.mts +1 -1
- package/dist/types/helper.d.mts +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/init-options.d.mts +18 -26
- package/dist/types/plugin-client.d.mts +3 -1
- package/dist/types/plugin.d.mts +2 -2
- package/dist/utils/async.d.mts +1 -0
- package/dist/utils/db.d.mts +0 -1
- package/dist/utils/deprecate.d.mts +1 -0
- package/dist/utils/email.d.mts +4 -1
- package/dist/utils/error-codes.d.mts +2 -2
- package/dist/utils/host.d.mts +1 -27
- package/dist/utils/host.mjs +1 -1
- package/dist/utils/ip.d.mts +0 -1
- package/dist/utils/ip.mjs +1 -1
- package/dist/utils/is-api-error.d.mts +1 -0
- package/dist/utils/redirect-uri.d.mts +1 -0
- package/package.json +4 -4
- package/src/api/index.ts +96 -95
- package/src/db/type.ts +2 -1
- package/src/types/init-options.ts +6 -4
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { AwaitableFunction } from "../types/helper.mjs";
|
|
2
|
-
import "../types/index.mjs";
|
|
3
2
|
import { OAuth2Tokens, ProviderOptions } from "./oauth-provider.mjs";
|
|
4
3
|
import { TokenEndpointAuth, TokenEndpointSecretAuthentication } from "./token-endpoint-auth.mjs";
|
|
5
|
-
import "
|
|
4
|
+
import * as _$jose from "jose";
|
|
5
|
+
|
|
6
6
|
//#region src/oauth2/validate-authorization-code.d.ts
|
|
7
7
|
interface AuthorizationCodeRequestInput {
|
|
8
8
|
code: string;
|
|
@@ -20,14 +20,38 @@ interface AuthorizationCodeRequestInput {
|
|
|
20
20
|
interface ValidateAuthorizationCodeInput extends AuthorizationCodeRequestInput {
|
|
21
21
|
tokenEndpoint: string;
|
|
22
22
|
}
|
|
23
|
-
declare function authorizationCodeRequest({
|
|
23
|
+
declare function authorizationCodeRequest({
|
|
24
|
+
code,
|
|
25
|
+
codeVerifier,
|
|
26
|
+
redirectURI,
|
|
27
|
+
options,
|
|
28
|
+
authentication,
|
|
29
|
+
tokenEndpointAuth,
|
|
30
|
+
tokenEndpoint,
|
|
31
|
+
deviceId,
|
|
32
|
+
headers,
|
|
33
|
+
additionalParams,
|
|
34
|
+
resource
|
|
35
|
+
}: AuthorizationCodeRequestInput): Promise<{
|
|
24
36
|
body: URLSearchParams;
|
|
25
37
|
headers: Record<string, string>;
|
|
26
38
|
}>;
|
|
27
|
-
declare function validateAuthorizationCode({
|
|
39
|
+
declare function validateAuthorizationCode({
|
|
40
|
+
code,
|
|
41
|
+
codeVerifier,
|
|
42
|
+
redirectURI,
|
|
43
|
+
options,
|
|
44
|
+
tokenEndpoint,
|
|
45
|
+
authentication,
|
|
46
|
+
tokenEndpointAuth,
|
|
47
|
+
deviceId,
|
|
48
|
+
headers,
|
|
49
|
+
additionalParams,
|
|
50
|
+
resource
|
|
51
|
+
}: ValidateAuthorizationCodeInput): Promise<OAuth2Tokens>;
|
|
28
52
|
declare function validateToken(token: string, jwksEndpoint: string, options?: {
|
|
29
53
|
audience?: string | string[];
|
|
30
54
|
issuer?: string | string[];
|
|
31
|
-
}): Promise<
|
|
55
|
+
}): Promise<_$jose.JWTVerifyResult<_$jose.JWTPayload> & _$jose.ResolvedKey>;
|
|
32
56
|
//#endregion
|
|
33
57
|
export { authorizationCodeRequest, validateAuthorizationCode, validateToken };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GenericEndpointContext } from "../types/context.mjs";
|
|
2
|
-
import "../types/index.mjs";
|
|
3
2
|
import { OAuthProvider } from "./oauth-provider.mjs";
|
|
3
|
+
|
|
4
4
|
//#region src/oauth2/verify-id-token.d.ts
|
|
5
5
|
type ProviderWithIdTokenConfig = Pick<OAuthProvider, "idToken" | "options">;
|
|
6
6
|
/**
|
package/dist/oauth2/verify.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { DpopReplayStore } from "./dpop.mjs";
|
|
2
2
|
import { APIError } from "better-call";
|
|
3
3
|
import { JSONWebKeySet, JWTPayload, JWTVerifyOptions } from "jose";
|
|
4
|
+
|
|
4
5
|
//#region src/oauth2/verify.d.ts
|
|
5
6
|
type JwksFetchOptions = {
|
|
6
|
-
/** Jwks url or promise of a Jwks */
|
|
7
|
-
jwksFetch: string | (() => Promise<JSONWebKeySet | undefined>);
|
|
7
|
+
/** Jwks url or promise of a Jwks */jwksFetch: string | (() => Promise<JSONWebKeySet | undefined>);
|
|
8
8
|
/**
|
|
9
9
|
* Stable object to cache the result of a function `jwksFetch` under,
|
|
10
10
|
* with the same TTL and kid-miss refetch rules as string sources.
|
|
@@ -12,6 +12,9 @@ type JwksFetchOptions = {
|
|
|
12
12
|
*/
|
|
13
13
|
jwksCacheKey?: object;
|
|
14
14
|
};
|
|
15
|
+
/**
|
|
16
|
+
* @internal
|
|
17
|
+
*/
|
|
15
18
|
interface VerifyAccessTokenRemote {
|
|
16
19
|
/** Full url of the introspect endpoint. Should end with `/oauth2/introspect` */
|
|
17
20
|
introspectUrl: string;
|
|
@@ -90,8 +93,7 @@ declare function requestToResourceInput(request: Request): ResourceRequestInput;
|
|
|
90
93
|
* Can also be configured for remote verification.
|
|
91
94
|
*/
|
|
92
95
|
declare function verifyJwsAccessToken(token: string, opts: JwksFetchOptions & {
|
|
93
|
-
/** Verify options */
|
|
94
|
-
verifyOptions: JWTVerifyOptions & Required<Pick<JWTVerifyOptions, "audience" | "issuer">>;
|
|
96
|
+
/** Verify options */verifyOptions: JWTVerifyOptions & Required<Pick<JWTVerifyOptions, "audience" | "issuer">>;
|
|
95
97
|
}): Promise<JWTPayload>;
|
|
96
98
|
declare function getJwks(token: string, opts: JwksFetchOptions): Promise<JSONWebKeySet>;
|
|
97
99
|
declare function createInsufficientScopeError(requiredScopes: readonly string[], description?: string): APIError;
|
|
@@ -121,4 +123,4 @@ declare function verifyBearerToken(token: string, opts: VerifyAccessTokenOptions
|
|
|
121
123
|
*/
|
|
122
124
|
declare function verifyAccessTokenRequest(request: ResourceRequestInput, opts: VerifyAccessTokenRequestOptions): Promise<JWTPayload>;
|
|
123
125
|
//#endregion
|
|
124
|
-
export { ResourceRequestInput, VerifyAccessTokenOptions,
|
|
126
|
+
export { ResourceRequestInput, VerifyAccessTokenOptions, VerifyAccessTokenRequestOptions, createInsufficientScopeError, getJwks, isInsufficientScopeError, requestToResourceInput, verifyAccessTokenRequest, verifyBearerToken, verifyJwsAccessToken };
|
package/dist/oauth2/verify.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { createInMemoryDpopReplayStore, enforceDpopBinding, getDpopJktFromPayloa
|
|
|
4
4
|
import { APIError } from "better-call";
|
|
5
5
|
import { UnsecuredJWT, createLocalJWKSet, decodeProtectedHeader, errors, jwtVerify } from "jose";
|
|
6
6
|
//#region src/oauth2/verify.ts
|
|
7
|
-
const joseInfrastructureErrorCodes =
|
|
7
|
+
const joseInfrastructureErrorCodes = new Set([
|
|
8
8
|
errors.JWKSTimeout.code,
|
|
9
9
|
errors.JWKSInvalid.code,
|
|
10
10
|
errors.JWKSMultipleMatchingKeys.code
|
|
@@ -330,4 +330,4 @@ async function verifyAccessTokenRequest(request, opts) {
|
|
|
330
330
|
return payload;
|
|
331
331
|
}
|
|
332
332
|
//#endregion
|
|
333
|
-
export { createInsufficientScopeError, getJwks, isInsufficientScopeError,
|
|
333
|
+
export { createInsufficientScopeError, getJwks, isInsufficientScopeError, requestToResourceInput, verifyAccessTokenRequest, verifyBearerToken, verifyJwsAccessToken };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
-
import "
|
|
2
|
+
import * as _$jose from "jose";
|
|
3
|
+
|
|
3
4
|
//#region src/social-providers/apple.d.ts
|
|
4
5
|
interface AppleProfile {
|
|
5
6
|
/**
|
|
@@ -68,9 +69,17 @@ interface AppleOptions extends ProviderOptions<AppleProfile> {
|
|
|
68
69
|
declare const apple: (options: AppleOptions) => {
|
|
69
70
|
id: "apple";
|
|
70
71
|
name: string;
|
|
71
|
-
accountSubject: ({
|
|
72
|
+
accountSubject: ({
|
|
73
|
+
profile
|
|
74
|
+
}: OAuthAccountKeyContext<AppleProfile>) => string;
|
|
72
75
|
accountIssuer: string;
|
|
73
|
-
createAuthorizationURL({
|
|
76
|
+
createAuthorizationURL({
|
|
77
|
+
state,
|
|
78
|
+
scopes,
|
|
79
|
+
redirectURI,
|
|
80
|
+
additionalParams,
|
|
81
|
+
codeVerifier
|
|
82
|
+
}: {
|
|
74
83
|
state: string;
|
|
75
84
|
codeVerifier: string;
|
|
76
85
|
scopes?: string[] | undefined;
|
|
@@ -80,14 +89,18 @@ declare const apple: (options: AppleOptions) => {
|
|
|
80
89
|
idTokenNonce?: string | undefined;
|
|
81
90
|
additionalParams?: Record<string, string> | undefined;
|
|
82
91
|
}): Promise<URL>;
|
|
83
|
-
validateAuthorizationCode: ({
|
|
92
|
+
validateAuthorizationCode: ({
|
|
93
|
+
code,
|
|
94
|
+
codeVerifier,
|
|
95
|
+
redirectURI
|
|
96
|
+
}: {
|
|
84
97
|
code: string;
|
|
85
98
|
redirectURI: string;
|
|
86
99
|
codeVerifier?: string | undefined;
|
|
87
100
|
deviceId?: string | undefined;
|
|
88
101
|
}) => Promise<OAuth2Tokens>;
|
|
89
102
|
idToken: {
|
|
90
|
-
jwks: (header:
|
|
103
|
+
jwks: (header: _$jose.JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
|
|
91
104
|
issuer: string;
|
|
92
105
|
audience: string | string[];
|
|
93
106
|
maxTokenAge: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
-
import "../oauth2/index.mjs";
|
|
3
2
|
//#region src/social-providers/atlassian.d.ts
|
|
4
3
|
interface AtlassianProfile {
|
|
5
4
|
account_type?: string | undefined;
|
|
@@ -22,8 +21,16 @@ interface AtlassianOptions extends ProviderOptions<AtlassianProfile> {
|
|
|
22
21
|
declare const atlassian: (options: AtlassianOptions) => {
|
|
23
22
|
id: "atlassian";
|
|
24
23
|
name: string;
|
|
25
|
-
accountSubject: ({
|
|
26
|
-
|
|
24
|
+
accountSubject: ({
|
|
25
|
+
profile
|
|
26
|
+
}: OAuthAccountKeyContext<AtlassianProfile>) => string;
|
|
27
|
+
createAuthorizationURL({
|
|
28
|
+
state,
|
|
29
|
+
scopes,
|
|
30
|
+
codeVerifier,
|
|
31
|
+
redirectURI,
|
|
32
|
+
additionalParams
|
|
33
|
+
}: {
|
|
27
34
|
state: string;
|
|
28
35
|
codeVerifier: string;
|
|
29
36
|
scopes?: string[] | undefined;
|
|
@@ -33,7 +40,11 @@ declare const atlassian: (options: AtlassianOptions) => {
|
|
|
33
40
|
idTokenNonce?: string | undefined;
|
|
34
41
|
additionalParams?: Record<string, string> | undefined;
|
|
35
42
|
}): Promise<URL>;
|
|
36
|
-
validateAuthorizationCode: ({
|
|
43
|
+
validateAuthorizationCode: ({
|
|
44
|
+
code,
|
|
45
|
+
codeVerifier,
|
|
46
|
+
redirectURI
|
|
47
|
+
}: {
|
|
37
48
|
code: string;
|
|
38
49
|
redirectURI: string;
|
|
39
50
|
codeVerifier?: string | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
-
import "
|
|
2
|
+
import * as _$jose from "jose";
|
|
3
|
+
|
|
3
4
|
//#region src/social-providers/cognito.d.ts
|
|
4
5
|
interface CognitoProfile {
|
|
5
6
|
sub: string;
|
|
@@ -48,9 +49,17 @@ interface CognitoOptions extends ProviderOptions<CognitoProfile> {
|
|
|
48
49
|
declare const cognito: (options: CognitoOptions) => {
|
|
49
50
|
id: "cognito";
|
|
50
51
|
name: string;
|
|
51
|
-
accountSubject: ({
|
|
52
|
+
accountSubject: ({
|
|
53
|
+
profile
|
|
54
|
+
}: OAuthAccountKeyContext<CognitoProfile>) => string;
|
|
52
55
|
accountIssuer: string;
|
|
53
|
-
createAuthorizationURL({
|
|
56
|
+
createAuthorizationURL({
|
|
57
|
+
state,
|
|
58
|
+
scopes,
|
|
59
|
+
codeVerifier,
|
|
60
|
+
redirectURI,
|
|
61
|
+
additionalParams
|
|
62
|
+
}: {
|
|
54
63
|
state: string;
|
|
55
64
|
codeVerifier: string;
|
|
56
65
|
scopes?: string[] | undefined;
|
|
@@ -60,7 +69,11 @@ declare const cognito: (options: CognitoOptions) => {
|
|
|
60
69
|
idTokenNonce?: string | undefined;
|
|
61
70
|
additionalParams?: Record<string, string> | undefined;
|
|
62
71
|
}): Promise<URL>;
|
|
63
|
-
validateAuthorizationCode: ({
|
|
72
|
+
validateAuthorizationCode: ({
|
|
73
|
+
code,
|
|
74
|
+
codeVerifier,
|
|
75
|
+
redirectURI
|
|
76
|
+
}: {
|
|
64
77
|
code: string;
|
|
65
78
|
redirectURI: string;
|
|
66
79
|
codeVerifier?: string | undefined;
|
|
@@ -68,7 +81,7 @@ declare const cognito: (options: CognitoOptions) => {
|
|
|
68
81
|
}) => Promise<OAuth2Tokens>;
|
|
69
82
|
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
70
83
|
idToken: {
|
|
71
|
-
jwks: (header:
|
|
84
|
+
jwks: (header: _$jose.JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
|
|
72
85
|
issuer: string;
|
|
73
86
|
audience: string | string[];
|
|
74
87
|
maxTokenAge: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
-
import "../oauth2/index.mjs";
|
|
3
2
|
//#region src/social-providers/discord.d.ts
|
|
4
3
|
interface DiscordProfile extends Record<string, any> {
|
|
5
4
|
/** the user's id (i.e. the numerical snowflake) */
|
|
@@ -78,8 +77,15 @@ interface DiscordOptions extends ProviderOptions<DiscordProfile> {
|
|
|
78
77
|
declare const discord: (options: DiscordOptions) => {
|
|
79
78
|
id: "discord";
|
|
80
79
|
name: string;
|
|
81
|
-
accountSubject: ({
|
|
82
|
-
|
|
80
|
+
accountSubject: ({
|
|
81
|
+
profile
|
|
82
|
+
}: OAuthAccountKeyContext<DiscordProfile>) => string;
|
|
83
|
+
createAuthorizationURL({
|
|
84
|
+
state,
|
|
85
|
+
scopes,
|
|
86
|
+
redirectURI,
|
|
87
|
+
additionalParams
|
|
88
|
+
}: {
|
|
83
89
|
state: string;
|
|
84
90
|
codeVerifier: string;
|
|
85
91
|
scopes?: string[] | undefined;
|
|
@@ -89,7 +95,10 @@ declare const discord: (options: DiscordOptions) => {
|
|
|
89
95
|
idTokenNonce?: string | undefined;
|
|
90
96
|
additionalParams?: Record<string, string> | undefined;
|
|
91
97
|
}): Promise<URL>;
|
|
92
|
-
validateAuthorizationCode: ({
|
|
98
|
+
validateAuthorizationCode: ({
|
|
99
|
+
code,
|
|
100
|
+
redirectURI
|
|
101
|
+
}: {
|
|
93
102
|
code: string;
|
|
94
103
|
redirectURI: string;
|
|
95
104
|
codeVerifier?: string | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
-
import "../oauth2/index.mjs";
|
|
3
2
|
//#region src/social-providers/dropbox.d.ts
|
|
4
3
|
interface DropboxProfile {
|
|
5
4
|
account_id: string;
|
|
@@ -21,8 +20,16 @@ interface DropboxOptions extends ProviderOptions<DropboxProfile> {
|
|
|
21
20
|
declare const dropbox: (options: DropboxOptions) => {
|
|
22
21
|
id: "dropbox";
|
|
23
22
|
name: string;
|
|
24
|
-
accountSubject: ({
|
|
25
|
-
|
|
23
|
+
accountSubject: ({
|
|
24
|
+
profile
|
|
25
|
+
}: OAuthAccountKeyContext<DropboxProfile>) => string;
|
|
26
|
+
createAuthorizationURL: ({
|
|
27
|
+
state,
|
|
28
|
+
scopes,
|
|
29
|
+
codeVerifier,
|
|
30
|
+
redirectURI,
|
|
31
|
+
additionalParams
|
|
32
|
+
}: {
|
|
26
33
|
state: string;
|
|
27
34
|
codeVerifier: string;
|
|
28
35
|
scopes?: string[] | undefined;
|
|
@@ -32,7 +39,11 @@ declare const dropbox: (options: DropboxOptions) => {
|
|
|
32
39
|
idTokenNonce?: string | undefined;
|
|
33
40
|
additionalParams?: Record<string, string> | undefined;
|
|
34
41
|
}) => Promise<URL>;
|
|
35
|
-
validateAuthorizationCode: ({
|
|
42
|
+
validateAuthorizationCode: ({
|
|
43
|
+
code,
|
|
44
|
+
codeVerifier,
|
|
45
|
+
redirectURI
|
|
46
|
+
}: {
|
|
36
47
|
code: string;
|
|
37
48
|
redirectURI: string;
|
|
38
49
|
codeVerifier?: string | undefined;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
-
import "
|
|
2
|
+
import * as _$jose from "jose";
|
|
3
|
+
|
|
3
4
|
//#region src/social-providers/facebook.d.ts
|
|
4
5
|
interface FacebookGraphProfile {
|
|
5
6
|
id: string;
|
|
@@ -38,9 +39,17 @@ interface FacebookOptions extends ProviderOptions<FacebookProfile> {
|
|
|
38
39
|
declare const facebook: (options: FacebookOptions) => {
|
|
39
40
|
id: "facebook";
|
|
40
41
|
name: string;
|
|
41
|
-
accountSubject: ({
|
|
42
|
+
accountSubject: ({
|
|
43
|
+
profile
|
|
44
|
+
}: OAuthAccountKeyContext<FacebookProfile>) => string;
|
|
42
45
|
accountIssuer: string;
|
|
43
|
-
createAuthorizationURL({
|
|
46
|
+
createAuthorizationURL({
|
|
47
|
+
state,
|
|
48
|
+
scopes,
|
|
49
|
+
redirectURI,
|
|
50
|
+
loginHint,
|
|
51
|
+
additionalParams
|
|
52
|
+
}: {
|
|
44
53
|
state: string;
|
|
45
54
|
codeVerifier: string;
|
|
46
55
|
scopes?: string[] | undefined;
|
|
@@ -50,7 +59,10 @@ declare const facebook: (options: FacebookOptions) => {
|
|
|
50
59
|
idTokenNonce?: string | undefined;
|
|
51
60
|
additionalParams?: Record<string, string> | undefined;
|
|
52
61
|
}): Promise<URL>;
|
|
53
|
-
validateAuthorizationCode: ({
|
|
62
|
+
validateAuthorizationCode: ({
|
|
63
|
+
code,
|
|
64
|
+
redirectURI
|
|
65
|
+
}: {
|
|
54
66
|
code: string;
|
|
55
67
|
redirectURI: string;
|
|
56
68
|
codeVerifier?: string | undefined;
|
|
@@ -58,12 +70,12 @@ declare const facebook: (options: FacebookOptions) => {
|
|
|
58
70
|
}) => Promise<OAuth2Tokens>;
|
|
59
71
|
idToken: {
|
|
60
72
|
jwks: {
|
|
61
|
-
(protectedHeader?:
|
|
73
|
+
(protectedHeader?: _$jose.JWSHeaderParameters, token?: _$jose.FlattenedJWSInput): Promise<_$jose.CryptoKey>;
|
|
62
74
|
coolingDown: boolean;
|
|
63
75
|
fresh: boolean;
|
|
64
76
|
reloading: boolean;
|
|
65
77
|
reload: () => Promise<void>;
|
|
66
|
-
jwks: () =>
|
|
78
|
+
jwks: () => _$jose.JSONWebKeySet | undefined;
|
|
67
79
|
};
|
|
68
80
|
issuer: string;
|
|
69
81
|
audience: string | string[];
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
-
import "../oauth2/index.mjs";
|
|
3
2
|
//#region src/social-providers/figma.d.ts
|
|
4
3
|
interface FigmaProfile {
|
|
5
4
|
id: string;
|
|
@@ -13,8 +12,16 @@ interface FigmaOptions extends ProviderOptions<FigmaProfile> {
|
|
|
13
12
|
declare const figma: (options: FigmaOptions) => {
|
|
14
13
|
id: "figma";
|
|
15
14
|
name: string;
|
|
16
|
-
accountSubject: ({
|
|
17
|
-
|
|
15
|
+
accountSubject: ({
|
|
16
|
+
profile
|
|
17
|
+
}: OAuthAccountKeyContext<FigmaProfile>) => string;
|
|
18
|
+
createAuthorizationURL({
|
|
19
|
+
state,
|
|
20
|
+
scopes,
|
|
21
|
+
codeVerifier,
|
|
22
|
+
redirectURI,
|
|
23
|
+
additionalParams
|
|
24
|
+
}: {
|
|
18
25
|
state: string;
|
|
19
26
|
codeVerifier: string;
|
|
20
27
|
scopes?: string[] | undefined;
|
|
@@ -24,7 +31,11 @@ declare const figma: (options: FigmaOptions) => {
|
|
|
24
31
|
idTokenNonce?: string | undefined;
|
|
25
32
|
additionalParams?: Record<string, string> | undefined;
|
|
26
33
|
}): Promise<URL>;
|
|
27
|
-
validateAuthorizationCode: ({
|
|
34
|
+
validateAuthorizationCode: ({
|
|
35
|
+
code,
|
|
36
|
+
codeVerifier,
|
|
37
|
+
redirectURI
|
|
38
|
+
}: {
|
|
28
39
|
code: string;
|
|
29
40
|
redirectURI: string;
|
|
30
41
|
codeVerifier?: string | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
-
import "../oauth2/index.mjs";
|
|
3
2
|
//#region src/social-providers/github.d.ts
|
|
4
3
|
interface GithubProfile {
|
|
5
4
|
login: string;
|
|
@@ -53,8 +52,17 @@ interface GithubOptions extends ProviderOptions<GithubProfile> {
|
|
|
53
52
|
declare const github: (options: GithubOptions) => {
|
|
54
53
|
id: "github";
|
|
55
54
|
name: string;
|
|
56
|
-
accountSubject: ({
|
|
57
|
-
|
|
55
|
+
accountSubject: ({
|
|
56
|
+
profile
|
|
57
|
+
}: OAuthAccountKeyContext<GithubProfile>) => string;
|
|
58
|
+
createAuthorizationURL({
|
|
59
|
+
state,
|
|
60
|
+
scopes,
|
|
61
|
+
loginHint,
|
|
62
|
+
codeVerifier,
|
|
63
|
+
redirectURI,
|
|
64
|
+
additionalParams
|
|
65
|
+
}: {
|
|
58
66
|
state: string;
|
|
59
67
|
codeVerifier: string;
|
|
60
68
|
scopes?: string[] | undefined;
|
|
@@ -64,7 +72,11 @@ declare const github: (options: GithubOptions) => {
|
|
|
64
72
|
idTokenNonce?: string | undefined;
|
|
65
73
|
additionalParams?: Record<string, string> | undefined;
|
|
66
74
|
}): Promise<URL>;
|
|
67
|
-
validateAuthorizationCode: ({
|
|
75
|
+
validateAuthorizationCode: ({
|
|
76
|
+
code,
|
|
77
|
+
codeVerifier,
|
|
78
|
+
redirectURI
|
|
79
|
+
}: {
|
|
68
80
|
code: string;
|
|
69
81
|
redirectURI: string;
|
|
70
82
|
codeVerifier?: string | undefined;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
-
import "../oauth2/index.mjs";
|
|
3
2
|
//#region src/social-providers/gitlab.d.ts
|
|
4
3
|
interface GitlabProfile extends Record<string, any> {
|
|
5
4
|
id: number;
|
|
@@ -53,8 +52,17 @@ interface GitlabOptions extends ProviderOptions<GitlabProfile> {
|
|
|
53
52
|
declare const gitlab: (options: GitlabOptions) => {
|
|
54
53
|
id: "gitlab";
|
|
55
54
|
name: string;
|
|
56
|
-
accountSubject: ({
|
|
57
|
-
|
|
55
|
+
accountSubject: ({
|
|
56
|
+
profile
|
|
57
|
+
}: OAuthAccountKeyContext<GitlabProfile>) => number;
|
|
58
|
+
createAuthorizationURL: ({
|
|
59
|
+
state,
|
|
60
|
+
scopes,
|
|
61
|
+
codeVerifier,
|
|
62
|
+
loginHint,
|
|
63
|
+
redirectURI,
|
|
64
|
+
additionalParams
|
|
65
|
+
}: {
|
|
58
66
|
state: string;
|
|
59
67
|
codeVerifier: string;
|
|
60
68
|
scopes?: string[] | undefined;
|
|
@@ -64,7 +72,11 @@ declare const gitlab: (options: GitlabOptions) => {
|
|
|
64
72
|
idTokenNonce?: string | undefined;
|
|
65
73
|
additionalParams?: Record<string, string> | undefined;
|
|
66
74
|
}) => Promise<URL>;
|
|
67
|
-
validateAuthorizationCode: ({
|
|
75
|
+
validateAuthorizationCode: ({
|
|
76
|
+
code,
|
|
77
|
+
redirectURI,
|
|
78
|
+
codeVerifier
|
|
79
|
+
}: {
|
|
68
80
|
code: string;
|
|
69
81
|
redirectURI: string;
|
|
70
82
|
codeVerifier?: string | undefined;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
-
import "
|
|
2
|
+
import * as _$jose from "jose";
|
|
3
3
|
import { JWTPayload } from "jose";
|
|
4
|
+
|
|
4
5
|
//#region src/social-providers/google.d.ts
|
|
5
6
|
interface GoogleProfile {
|
|
6
7
|
aud: string;
|
|
@@ -68,7 +69,11 @@ interface VerifyGoogleIdTokenOptions {
|
|
|
68
69
|
* Verifies a Google ID token against Google's issuer, audience, signature,
|
|
69
70
|
* expiry, and maximum token age.
|
|
70
71
|
*/
|
|
71
|
-
declare const verifyGoogleIdToken: ({
|
|
72
|
+
declare const verifyGoogleIdToken: ({
|
|
73
|
+
token,
|
|
74
|
+
audience,
|
|
75
|
+
nonce
|
|
76
|
+
}: VerifyGoogleIdTokenOptions) => Promise<JWTPayload | null>;
|
|
72
77
|
/**
|
|
73
78
|
* Checks whether Google's verified `hd` claim satisfies the configured hosted
|
|
74
79
|
* domain restriction. `hd: "*"` accepts any Google Workspace hosted domain.
|
|
@@ -77,9 +82,19 @@ declare const isGoogleHostedDomainAllowed: (configuredHostedDomain: string | und
|
|
|
77
82
|
declare const google: (options: GoogleOptions) => {
|
|
78
83
|
id: "google";
|
|
79
84
|
name: string;
|
|
80
|
-
accountSubject: ({
|
|
85
|
+
accountSubject: ({
|
|
86
|
+
profile
|
|
87
|
+
}: OAuthAccountKeyContext<GoogleProfile>) => string;
|
|
81
88
|
accountIssuer: string;
|
|
82
|
-
createAuthorizationURL({
|
|
89
|
+
createAuthorizationURL({
|
|
90
|
+
state,
|
|
91
|
+
scopes,
|
|
92
|
+
codeVerifier,
|
|
93
|
+
redirectURI,
|
|
94
|
+
loginHint,
|
|
95
|
+
display,
|
|
96
|
+
additionalParams
|
|
97
|
+
}: {
|
|
83
98
|
state: string;
|
|
84
99
|
codeVerifier: string;
|
|
85
100
|
scopes?: string[] | undefined;
|
|
@@ -89,7 +104,11 @@ declare const google: (options: GoogleOptions) => {
|
|
|
89
104
|
idTokenNonce?: string | undefined;
|
|
90
105
|
additionalParams?: Record<string, string> | undefined;
|
|
91
106
|
}): Promise<URL>;
|
|
92
|
-
validateAuthorizationCode: ({
|
|
107
|
+
validateAuthorizationCode: ({
|
|
108
|
+
code,
|
|
109
|
+
codeVerifier,
|
|
110
|
+
redirectURI
|
|
111
|
+
}: {
|
|
93
112
|
code: string;
|
|
94
113
|
redirectURI: string;
|
|
95
114
|
codeVerifier?: string | undefined;
|
|
@@ -97,7 +116,7 @@ declare const google: (options: GoogleOptions) => {
|
|
|
97
116
|
}) => Promise<OAuth2Tokens>;
|
|
98
117
|
refreshAccessToken: (refreshToken: string) => Promise<OAuth2Tokens>;
|
|
99
118
|
idToken: {
|
|
100
|
-
jwks: (header:
|
|
119
|
+
jwks: (header: _$jose.JWTHeaderParameters) => Promise<Uint8Array<ArrayBufferLike> | CryptoKey>;
|
|
101
120
|
issuer: string[];
|
|
102
121
|
audience: string | string[];
|
|
103
122
|
maxTokenAge: string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { OAuth2Tokens, OAuth2UserInfo, OAuthAccountKeyContext, ProviderOptions } from "../oauth2/oauth-provider.mjs";
|
|
2
|
-
import "../oauth2/index.mjs";
|
|
3
2
|
//#region src/social-providers/huggingface.d.ts
|
|
4
3
|
interface HuggingFaceProfile {
|
|
5
4
|
sub: string;
|
|
@@ -35,8 +34,16 @@ interface HuggingFaceOptions extends ProviderOptions<HuggingFaceProfile> {
|
|
|
35
34
|
declare const huggingface: (options: HuggingFaceOptions) => {
|
|
36
35
|
id: "huggingface";
|
|
37
36
|
name: string;
|
|
38
|
-
accountSubject: ({
|
|
39
|
-
|
|
37
|
+
accountSubject: ({
|
|
38
|
+
profile
|
|
39
|
+
}: OAuthAccountKeyContext<HuggingFaceProfile>) => string;
|
|
40
|
+
createAuthorizationURL({
|
|
41
|
+
state,
|
|
42
|
+
scopes,
|
|
43
|
+
codeVerifier,
|
|
44
|
+
redirectURI,
|
|
45
|
+
additionalParams
|
|
46
|
+
}: {
|
|
40
47
|
state: string;
|
|
41
48
|
codeVerifier: string;
|
|
42
49
|
scopes?: string[] | undefined;
|
|
@@ -46,7 +53,11 @@ declare const huggingface: (options: HuggingFaceOptions) => {
|
|
|
46
53
|
idTokenNonce?: string | undefined;
|
|
47
54
|
additionalParams?: Record<string, string> | undefined;
|
|
48
55
|
}): Promise<URL>;
|
|
49
|
-
validateAuthorizationCode: ({
|
|
56
|
+
validateAuthorizationCode: ({
|
|
57
|
+
code,
|
|
58
|
+
codeVerifier,
|
|
59
|
+
redirectURI
|
|
60
|
+
}: {
|
|
50
61
|
code: string;
|
|
51
62
|
redirectURI: string;
|
|
52
63
|
codeVerifier?: string | undefined;
|