@aura-stack/auth 0.1.0-rc.9 → 0.2.0
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/@types/index.cjs +15 -15
- package/dist/@types/index.d.ts +6 -31
- package/dist/@types/index.js +1 -1
- package/dist/@types/router.d.cjs +1 -1
- package/dist/@types/router.d.d.ts +6 -7
- package/dist/@types/utility.cjs +15 -15
- package/dist/@types/utility.d.ts +4 -8
- package/dist/@types/utility.js +1 -1
- package/dist/actions/callback/access-token.cjs +159 -149
- package/dist/actions/callback/access-token.d.ts +14 -20
- package/dist/actions/callback/access-token.js +9 -4
- package/dist/actions/callback/callback.cjs +371 -484
- package/dist/actions/callback/callback.d.ts +9 -12
- package/dist/actions/callback/callback.js +15 -12
- package/dist/actions/callback/userinfo.cjs +149 -139
- package/dist/actions/callback/userinfo.d.ts +8 -9
- package/dist/actions/callback/userinfo.js +11 -6
- package/dist/actions/csrfToken/csrfToken.cjs +112 -190
- package/dist/actions/csrfToken/csrfToken.d.ts +3 -3
- package/dist/actions/csrfToken/csrfToken.js +12 -8
- package/dist/actions/index.cjs +623 -807
- package/dist/actions/index.d.ts +12 -13
- package/dist/actions/index.js +33 -18
- package/dist/actions/session/session.cjs +86 -176
- package/dist/actions/session/session.d.ts +3 -3
- package/dist/actions/session/session.js +10 -7
- package/dist/actions/signIn/authorization.cjs +248 -257
- package/dist/actions/signIn/authorization.d.ts +11 -18
- package/dist/actions/signIn/authorization.js +16 -6
- package/dist/actions/signIn/signIn.cjs +302 -451
- package/dist/actions/signIn/signIn.d.ts +9 -10
- package/dist/actions/signIn/signIn.js +12 -10
- package/dist/actions/signOut/signOut.cjs +299 -468
- package/dist/actions/signOut/signOut.d.ts +3 -3
- package/dist/actions/signOut/signOut.js +14 -11
- package/dist/assert.cjs +40 -36
- package/dist/assert.d.ts +12 -4
- package/dist/assert.js +12 -2
- package/dist/chunk-2RXNXMCZ.js +55 -0
- package/dist/chunk-42XB3YCW.js +19 -17
- package/dist/chunk-4V4JNXVF.js +55 -0
- package/dist/chunk-6R2YZ4AC.js +22 -0
- package/dist/chunk-7H3OR6UU.js +81 -0
- package/dist/chunk-CXLATHS5.js +143 -0
- package/dist/chunk-E3OXBRYF.js +19 -17
- package/dist/chunk-EIL2FPSS.js +22 -0
- package/dist/chunk-FIPU4MLT.js +18 -16
- package/dist/chunk-FKRDCWBF.js +19 -17
- package/dist/chunk-IKHPGFCW.js +11 -9
- package/dist/chunk-IMICRJ5U.js +197 -0
- package/dist/chunk-IUYZQTJV.js +30 -0
- package/dist/chunk-KRNOMBXQ.js +19 -17
- package/dist/chunk-N2APGLXA.js +71 -0
- package/dist/chunk-NEVKX6K2.js +70 -0
- package/dist/chunk-PTJUYB33.js +33 -0
- package/dist/chunk-QDO2KSRJ.js +35 -0
- package/dist/chunk-QEZL7EYN.js +96 -0
- package/dist/chunk-RRLIF4PQ.js +55 -0
- package/dist/chunk-STHEPPUZ.js +8 -6
- package/dist/chunk-TLE4PXY3.js +39 -0
- package/dist/chunk-UEH3LVON.js +97 -0
- package/dist/chunk-WD7AUHQ5.js +79 -0
- package/dist/chunk-ZLR3LI6X.js +55 -0
- package/dist/cookie.cjs +222 -187
- package/dist/cookie.d.ts +38 -76
- package/dist/cookie.js +27 -34
- package/dist/errors.cjs +85 -0
- package/dist/errors.d.ts +48 -0
- package/dist/errors.js +18 -0
- package/dist/headers.cjs +28 -28
- package/dist/headers.d.ts +2 -2
- package/dist/headers.js +6 -2
- package/dist/{index-DpfbvTZ_.d.ts → index-EqsoyjrF.d.ts} +351 -318
- package/dist/index.cjs +1006 -1001
- package/dist/index.d.ts +9 -31
- package/dist/index.js +82 -51
- package/dist/jose.cjs +74 -66
- package/dist/jose.d.ts +11 -8
- package/dist/jose.js +10 -5
- package/dist/oauth/bitbucket.cjs +38 -38
- package/dist/oauth/bitbucket.d.ts +6 -7
- package/dist/oauth/bitbucket.js +6 -2
- package/dist/oauth/discord.cjs +47 -48
- package/dist/oauth/discord.d.ts +6 -7
- package/dist/oauth/discord.js +6 -2
- package/dist/oauth/figma.cjs +39 -39
- package/dist/oauth/figma.d.ts +6 -7
- package/dist/oauth/figma.js +6 -2
- package/dist/oauth/github.cjs +31 -31
- package/dist/oauth/github.d.ts +6 -7
- package/dist/oauth/github.js +6 -2
- package/dist/oauth/gitlab.cjs +39 -39
- package/dist/oauth/gitlab.d.ts +6 -7
- package/dist/oauth/gitlab.js +6 -2
- package/dist/oauth/index.cjs +306 -180
- package/dist/oauth/index.d.ts +6 -26
- package/dist/oauth/index.js +43 -9
- package/dist/oauth/spotify.cjs +39 -39
- package/dist/oauth/spotify.d.ts +6 -7
- package/dist/oauth/spotify.js +6 -2
- package/dist/oauth/strava.cjs +46 -0
- package/dist/oauth/strava.d.ts +6 -0
- package/dist/oauth/strava.js +6 -0
- package/dist/oauth/x.cjs +39 -39
- package/dist/oauth/x.d.ts +6 -7
- package/dist/oauth/x.js +6 -2
- package/dist/schemas.cjs +97 -91
- package/dist/schemas.d.ts +96 -126
- package/dist/schemas.js +20 -18
- package/dist/secure.cjs +106 -101
- package/dist/secure.d.ts +16 -17
- package/dist/secure.js +19 -4
- package/dist/utils.cjs +197 -135
- package/dist/utils.d.ts +20 -26
- package/dist/utils.js +25 -21
- package/package.json +5 -6
- package/dist/chunk-256KIVJL.js +0 -110
- package/dist/chunk-6SM22VVJ.js +0 -15
- package/dist/chunk-CAKJT3KS.js +0 -77
- package/dist/chunk-EBPE35JT.js +0 -29
- package/dist/chunk-FJUDBLCP.js +0 -52
- package/dist/chunk-GZU3RBTB.js +0 -51
- package/dist/chunk-HGJ4TXY4.js +0 -105
- package/dist/chunk-HMRKN75I.js +0 -74
- package/dist/chunk-JAPMIE6S.js +0 -8
- package/dist/chunk-LLR722CL.js +0 -75
- package/dist/chunk-RLT4RFKV.js +0 -36
- package/dist/chunk-SJPDVKUS.js +0 -93
- package/dist/chunk-SMQO5WD7.js +0 -20
- package/dist/chunk-UJJ7R56J.js +0 -42
- package/dist/chunk-UTDLUEEG.js +0 -25
- package/dist/chunk-VFTYH33W.js +0 -44
- package/dist/chunk-XXJKNKGQ.js +0 -27
- package/dist/chunk-ZV4BH47P.js +0 -156
- package/dist/error.cjs +0 -88
- package/dist/error.d.ts +0 -62
- package/dist/error.js +0 -9
- package/dist/response.cjs +0 -34
- package/dist/response.d.ts +0 -10
- package/dist/response.js +0 -2
|
@@ -1,136 +1,213 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { LiteralUnion, Prettify } from
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
import { OAuthAuthorizationErrorResponse, OAuthAccessTokenErrorResponse, OAuthEnvSchema } from './schemas.js';
|
|
3
|
+
import { SerializeOptions } from '@aura-stack/router/cookie';
|
|
4
|
+
import { JWTPayload } from '@aura-stack/jose/jose';
|
|
5
|
+
import { LiteralUnion, Prettify } from './@types/utility.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @see [Strava - SummaryClub](https://developers.strava.com/docs/reference/#api-models-SummaryClub)
|
|
9
|
+
*/
|
|
10
|
+
interface SummaryClub {
|
|
11
|
+
id: number;
|
|
12
|
+
resource_state: number;
|
|
13
|
+
name: string;
|
|
14
|
+
profile_medium: string;
|
|
15
|
+
cover_photo: string;
|
|
16
|
+
cover_photo_small: string;
|
|
17
|
+
sport_type: "cycling" | "running" | "triathlon" | "other";
|
|
18
|
+
activity_types: string[];
|
|
19
|
+
city: string;
|
|
20
|
+
state: string;
|
|
21
|
+
country: string;
|
|
22
|
+
private: boolean;
|
|
23
|
+
member_count: number;
|
|
24
|
+
featured: boolean;
|
|
25
|
+
verified: boolean;
|
|
26
|
+
url: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @see [Strava - SummaryGear](https://developers.strava.com/docs/reference/#api-models-SummaryGear)
|
|
30
|
+
*/
|
|
31
|
+
interface SummaryGear {
|
|
32
|
+
id: string;
|
|
33
|
+
resource_state: number;
|
|
34
|
+
primary: boolean;
|
|
35
|
+
name: string;
|
|
36
|
+
distance: number;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* @see [Strava - DetailedAthlete](https://developers.strava.com/docs/reference/#api-models-DetailedAthlete)
|
|
40
|
+
*/
|
|
41
|
+
interface StravaProfile {
|
|
42
|
+
id: number;
|
|
43
|
+
resource_state: number;
|
|
44
|
+
firstname: string;
|
|
45
|
+
lastname: string;
|
|
46
|
+
bio: string | null;
|
|
47
|
+
profile: string;
|
|
48
|
+
profile_medium: string;
|
|
49
|
+
city: string;
|
|
50
|
+
state: string;
|
|
51
|
+
country: string;
|
|
52
|
+
sex: string;
|
|
53
|
+
premium: boolean;
|
|
54
|
+
summit: boolean;
|
|
55
|
+
created_at: Date;
|
|
56
|
+
updated_at: Date;
|
|
57
|
+
badge_type_id: number;
|
|
58
|
+
weight: number;
|
|
59
|
+
friend: null;
|
|
60
|
+
follower: null;
|
|
61
|
+
follower_count: number;
|
|
62
|
+
friend_count: number;
|
|
63
|
+
measurement_preference: string;
|
|
64
|
+
ftp: number;
|
|
65
|
+
clubs: SummaryClub[];
|
|
66
|
+
bikes: SummaryGear[];
|
|
67
|
+
shoes: SummaryGear[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Strava OAuth Provider
|
|
71
|
+
* @see [Strava - Getting Started with the Strava API](https://developers.strava.com/docs/getting-started/)
|
|
72
|
+
* @see [Strava - My Applications](https://www.strava.com/settings/api)
|
|
73
|
+
* @see [Strava - Authentication](https://developers.strava.com/docs/authentication/)
|
|
74
|
+
* @see [Strava - API Application](https://www.strava.com/settings/api)
|
|
75
|
+
* @see [Strava - API Reference](https://developers.strava.com/docs/reference/)
|
|
76
|
+
*/
|
|
77
|
+
declare const strava: OAuthProviderConfig<StravaProfile>;
|
|
6
78
|
|
|
7
79
|
/**
|
|
8
80
|
* @see [X - Get my User](https://docs.x.com/x-api/users/get-my-user)
|
|
9
81
|
*/
|
|
10
82
|
interface XProfile {
|
|
11
83
|
data: {
|
|
12
|
-
id: string
|
|
13
|
-
name: string
|
|
14
|
-
username: string
|
|
15
|
-
profile_image_url: string
|
|
16
|
-
}
|
|
84
|
+
id: string;
|
|
85
|
+
name: string;
|
|
86
|
+
username: string;
|
|
87
|
+
profile_image_url: string;
|
|
88
|
+
};
|
|
17
89
|
}
|
|
18
90
|
/**
|
|
91
|
+
* X (Twitter) OAuth Provider
|
|
19
92
|
* @see [X - Developer Portal](https://developer.x.com/en/portal/projects-and-apps)
|
|
20
93
|
* @see [X - Get my User](https://docs.x.com/x-api/users/get-my-user)
|
|
21
94
|
* @see [X - OAuth 2.0 Authorization Code Flow with PKCE](https://docs.x.com/fundamentals/authentication/oauth-2-0/authorization-code)
|
|
22
95
|
* @see [X - OAuth 2.0 Scopes](https://docs.x.com/fundamentals/authentication/oauth-2-0/authorization-code#scopes)
|
|
23
96
|
* @see [X - OAuth 2.0 Bearer Token](https://docs.x.com/fundamentals/authentication/oauth-2-0/application-only)
|
|
24
97
|
*/
|
|
25
|
-
declare const x: OAuthProviderConfig<XProfile
|
|
98
|
+
declare const x: OAuthProviderConfig<XProfile>;
|
|
26
99
|
|
|
27
100
|
interface Image {
|
|
28
|
-
url: string
|
|
29
|
-
height: number
|
|
30
|
-
width: number
|
|
101
|
+
url: string;
|
|
102
|
+
height: number;
|
|
103
|
+
width: number;
|
|
31
104
|
}
|
|
32
105
|
/**
|
|
33
106
|
* @see [Spotify - User Object](https://developer.spotify.com/documentation/web-api/reference/object-model/#user-object-private)
|
|
34
107
|
*/
|
|
35
108
|
interface SpotifyProfile {
|
|
36
|
-
id: string
|
|
37
|
-
display_name: string
|
|
38
|
-
email: string
|
|
39
|
-
type: string
|
|
40
|
-
uri: string
|
|
41
|
-
country: string
|
|
42
|
-
href: string
|
|
43
|
-
images: Image[]
|
|
44
|
-
product: string
|
|
109
|
+
id: string;
|
|
110
|
+
display_name: string;
|
|
111
|
+
email: string;
|
|
112
|
+
type: string;
|
|
113
|
+
uri: string;
|
|
114
|
+
country: string;
|
|
115
|
+
href: string;
|
|
116
|
+
images: Image[];
|
|
117
|
+
product: string;
|
|
45
118
|
explicit_content: {
|
|
46
|
-
filter_enabled: boolean
|
|
47
|
-
filter_locked: boolean
|
|
48
|
-
}
|
|
119
|
+
filter_enabled: boolean;
|
|
120
|
+
filter_locked: boolean;
|
|
121
|
+
};
|
|
49
122
|
external_urls: {
|
|
50
|
-
spotify: string
|
|
51
|
-
}
|
|
123
|
+
spotify: string;
|
|
124
|
+
};
|
|
52
125
|
followers: {
|
|
53
|
-
href: string
|
|
54
|
-
total: number
|
|
55
|
-
}
|
|
126
|
+
href: string;
|
|
127
|
+
total: number;
|
|
128
|
+
};
|
|
56
129
|
}
|
|
57
130
|
/**
|
|
131
|
+
* Spotify OAuth Provider
|
|
132
|
+
*
|
|
58
133
|
* @see [Spotify - Spotify Developer Dashboard](https://developer.spotify.com/dashboard)
|
|
59
134
|
* @see [Spotify - Getting started with Web API](https://developer.spotify.com/documentation/web-api/tutorials/getting-started)
|
|
60
135
|
* @see [Spotify - Get Current User's Profile](https://developer.spotify.com/documentation/web-api/reference/get-current-users-profile)
|
|
61
136
|
* @see [Spotify - Scopes](https://developer.spotify.com/documentation/web-api/concepts/scopes)
|
|
62
137
|
* @see [Spotify - Redirect URIs](https://developer.spotify.com/documentation/web-api/concepts/redirect_uri)
|
|
63
138
|
*/
|
|
64
|
-
declare const spotify: OAuthProviderConfig<SpotifyProfile
|
|
139
|
+
declare const spotify: OAuthProviderConfig<SpotifyProfile>;
|
|
65
140
|
|
|
66
141
|
/**
|
|
67
142
|
* @see [GitLab - Get the current user](https://docs.gitlab.com/api/users/#get-the-current-user)
|
|
68
143
|
*/
|
|
69
144
|
interface GitLabProfile {
|
|
70
|
-
id: number
|
|
71
|
-
username: string
|
|
72
|
-
email: string
|
|
73
|
-
name: string
|
|
74
|
-
state: string
|
|
75
|
-
locked: boolean
|
|
76
|
-
avatar_url: string
|
|
77
|
-
web_url: string
|
|
78
|
-
created_at: string
|
|
79
|
-
bio: string
|
|
80
|
-
location: string | null
|
|
81
|
-
public_email: string
|
|
82
|
-
linkedin: string
|
|
83
|
-
twitter: string
|
|
84
|
-
discord: string
|
|
85
|
-
github: string
|
|
86
|
-
website_url: string
|
|
87
|
-
organization: string
|
|
88
|
-
job_title: string
|
|
89
|
-
pronouns: string
|
|
90
|
-
bot: boolean
|
|
91
|
-
work_information: string | null
|
|
92
|
-
followers: number
|
|
93
|
-
following: number
|
|
94
|
-
local_time: string
|
|
95
|
-
last_sign_in_at: string
|
|
96
|
-
confirmed_at: string
|
|
97
|
-
theme_id: number
|
|
98
|
-
last_activity_on: string
|
|
99
|
-
color_scheme_id: number
|
|
100
|
-
projects_limit: number
|
|
101
|
-
current_sign_in_at: string
|
|
145
|
+
id: number;
|
|
146
|
+
username: string;
|
|
147
|
+
email: string;
|
|
148
|
+
name: string;
|
|
149
|
+
state: string;
|
|
150
|
+
locked: boolean;
|
|
151
|
+
avatar_url: string;
|
|
152
|
+
web_url: string;
|
|
153
|
+
created_at: string;
|
|
154
|
+
bio: string;
|
|
155
|
+
location: string | null;
|
|
156
|
+
public_email: string;
|
|
157
|
+
linkedin: string;
|
|
158
|
+
twitter: string;
|
|
159
|
+
discord: string;
|
|
160
|
+
github: string;
|
|
161
|
+
website_url: string;
|
|
162
|
+
organization: string;
|
|
163
|
+
job_title: string;
|
|
164
|
+
pronouns: string;
|
|
165
|
+
bot: boolean;
|
|
166
|
+
work_information: string | null;
|
|
167
|
+
followers: number;
|
|
168
|
+
following: number;
|
|
169
|
+
local_time: string;
|
|
170
|
+
last_sign_in_at: string;
|
|
171
|
+
confirmed_at: string;
|
|
172
|
+
theme_id: number;
|
|
173
|
+
last_activity_on: string;
|
|
174
|
+
color_scheme_id: number;
|
|
175
|
+
projects_limit: number;
|
|
176
|
+
current_sign_in_at: string;
|
|
102
177
|
identities: {
|
|
103
|
-
provider: string
|
|
104
|
-
extern_uid: string
|
|
105
|
-
saml_provider_id: number | null
|
|
106
|
-
}[]
|
|
107
|
-
can_create_group: boolean
|
|
108
|
-
can_create_project: boolean
|
|
109
|
-
two_factor_enabled: boolean
|
|
110
|
-
external: boolean
|
|
111
|
-
private_profile: boolean
|
|
112
|
-
commit_email: string
|
|
113
|
-
preferred_language: string
|
|
114
|
-
shared_runners_minutes_limit: number | null
|
|
115
|
-
extra_shared_runners_minutes_limit: number | null
|
|
116
|
-
scim_identities: unknown[]
|
|
178
|
+
provider: string;
|
|
179
|
+
extern_uid: string;
|
|
180
|
+
saml_provider_id: number | null;
|
|
181
|
+
}[];
|
|
182
|
+
can_create_group: boolean;
|
|
183
|
+
can_create_project: boolean;
|
|
184
|
+
two_factor_enabled: boolean;
|
|
185
|
+
external: boolean;
|
|
186
|
+
private_profile: boolean;
|
|
187
|
+
commit_email: string;
|
|
188
|
+
preferred_language: string;
|
|
189
|
+
shared_runners_minutes_limit: number | null;
|
|
190
|
+
extra_shared_runners_minutes_limit: number | null;
|
|
191
|
+
scim_identities: unknown[];
|
|
117
192
|
}
|
|
118
193
|
/**
|
|
194
|
+
* GitLab OAuth Provider
|
|
195
|
+
*
|
|
119
196
|
* @see [GitLab - Applications](https://gitlab.com/-/user_settings/applications)
|
|
120
197
|
* @see [GitLab - OAuth 2.0 identify provider API](https://docs.gitlab.com/api/oauth2/)
|
|
121
198
|
* @see [GitLab - Scopes](https://docs.gitlab.com/integration/oauth_provider/#view-all-authorized-applications)
|
|
122
199
|
* @see [GitLab - Get current user](https://docs.gitlab.com/api/users/#get-the-current-user)
|
|
123
200
|
*/
|
|
124
|
-
declare const gitlab: OAuthProviderConfig<GitLabProfile
|
|
201
|
+
declare const gitlab: OAuthProviderConfig<GitLabProfile>;
|
|
125
202
|
|
|
126
203
|
/**
|
|
127
204
|
* @see [Discord - Nameplate Object](https://discord.com/developers/docs/resources/user#nameplate-nameplate-structure)
|
|
128
205
|
*/
|
|
129
206
|
interface Nameplate {
|
|
130
|
-
sku_id: string
|
|
131
|
-
asset: string
|
|
132
|
-
label: string
|
|
133
|
-
palette: string
|
|
207
|
+
sku_id: string;
|
|
208
|
+
asset: string;
|
|
209
|
+
label: string;
|
|
210
|
+
palette: string;
|
|
134
211
|
}
|
|
135
212
|
/**
|
|
136
213
|
* The `snowflake` type is a string type. The attributes defined with this type are:
|
|
@@ -141,82 +218,83 @@ interface Nameplate {
|
|
|
141
218
|
* @see [Discord - User Object](https://discord.com/developers/docs/resources/user#user-object)
|
|
142
219
|
*/
|
|
143
220
|
interface DiscordProfile {
|
|
144
|
-
id: string
|
|
145
|
-
username: string
|
|
146
|
-
discriminator: string
|
|
147
|
-
global_name: string | null
|
|
148
|
-
avatar: string | null
|
|
149
|
-
bot?: boolean
|
|
150
|
-
system?: boolean
|
|
151
|
-
mfa_enabled?: boolean
|
|
152
|
-
banner?: string | null
|
|
153
|
-
accent_color?: number | null
|
|
154
|
-
locale?: string
|
|
155
|
-
verified?: boolean
|
|
156
|
-
email?: string | null
|
|
157
|
-
flags?: number
|
|
158
|
-
premium_type?: number
|
|
159
|
-
public_flags?: number
|
|
221
|
+
id: string;
|
|
222
|
+
username: string;
|
|
223
|
+
discriminator: string;
|
|
224
|
+
global_name: string | null;
|
|
225
|
+
avatar: string | null;
|
|
226
|
+
bot?: boolean;
|
|
227
|
+
system?: boolean;
|
|
228
|
+
mfa_enabled?: boolean;
|
|
229
|
+
banner?: string | null;
|
|
230
|
+
accent_color?: number | null;
|
|
231
|
+
locale?: string;
|
|
232
|
+
verified?: boolean;
|
|
233
|
+
email?: string | null;
|
|
234
|
+
flags?: number;
|
|
235
|
+
premium_type?: number;
|
|
236
|
+
public_flags?: number;
|
|
160
237
|
avatar_decoration_data?: {
|
|
161
|
-
asset: string
|
|
162
|
-
sku_id: string
|
|
163
|
-
}
|
|
164
|
-
collections?: Record<string, Nameplate
|
|
238
|
+
asset: string;
|
|
239
|
+
sku_id: string;
|
|
240
|
+
};
|
|
241
|
+
collections?: Record<string, Nameplate>;
|
|
165
242
|
primary_guild?: {
|
|
166
|
-
identity_guild_id: string
|
|
167
|
-
identity_enabled: boolean | null
|
|
168
|
-
tag: string | null
|
|
169
|
-
badge: string | null
|
|
170
|
-
}
|
|
243
|
+
identity_guild_id: string;
|
|
244
|
+
identity_enabled: boolean | null;
|
|
245
|
+
tag: string | null;
|
|
246
|
+
badge: string | null;
|
|
247
|
+
};
|
|
171
248
|
}
|
|
172
249
|
/**
|
|
250
|
+
* Discord OAuth Provider
|
|
251
|
+
*
|
|
173
252
|
* @see [Discord - Applications](https://discord.com/developers/applications)
|
|
174
253
|
* @see [Discord - OAuth2](https://discord.com/developers/docs/topics/oauth2)
|
|
175
254
|
* @see [Discord - Get Current User](https://discord.com/developers/docs/resources/user#get-current-user)
|
|
176
255
|
* @see [Discord - User Object](https://discord.com/developers/docs/resources/user#user-object)
|
|
177
256
|
* @see [Discord - OAuth2 Scopes](https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes)
|
|
178
257
|
* @see [Discord - Image Formatting](https://discord.com/developers/docs/reference#image-formatting)
|
|
258
|
+
* @see [Discord - Display Names](https://discord.com/developers/docs/change-log#display-names)
|
|
179
259
|
*/
|
|
180
|
-
declare const discord: OAuthProviderConfig<DiscordProfile
|
|
260
|
+
declare const discord: OAuthProviderConfig<DiscordProfile>;
|
|
181
261
|
|
|
182
262
|
/**
|
|
183
263
|
* @see [Figma API - Users](https://developers.figma.com/docs/rest-api/users-types/)
|
|
184
264
|
*/
|
|
185
265
|
interface FigmaProfile {
|
|
186
|
-
id: string
|
|
187
|
-
handle: string
|
|
188
|
-
img_url: string
|
|
189
|
-
email: string
|
|
266
|
+
id: string;
|
|
267
|
+
handle: string;
|
|
268
|
+
img_url: string;
|
|
269
|
+
email: string;
|
|
190
270
|
}
|
|
191
271
|
/**
|
|
272
|
+
* Figma OAuth Provider
|
|
192
273
|
* @see [Figma - REST API Introduction](https://developers.figma.com/docs/rest-api/)
|
|
193
274
|
* @see [Figma - OAuth App](https://www.figma.com/developers/apps/)
|
|
194
275
|
* @see [Figma - Create an OAuth App](https://developers.figma.com/docs/rest-api/authentication/#create-an-oauth-app)
|
|
195
276
|
* @see [Figma - OAuth Scopes](https://developers.figma.com/docs/rest-api/scopes/)
|
|
196
277
|
*/
|
|
197
|
-
declare const figma: OAuthProviderConfig<FigmaProfile
|
|
278
|
+
declare const figma: OAuthProviderConfig<FigmaProfile>;
|
|
198
279
|
|
|
199
280
|
/**
|
|
200
281
|
* @see [Get current user](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-users/#api-user-get)
|
|
201
282
|
*/
|
|
202
283
|
interface BitbucketProfile {
|
|
203
|
-
display_name: string
|
|
204
|
-
links: Record<
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
account_id: string
|
|
218
|
-
account_status: LiteralUnion<"active" | "inactive" | "closed">
|
|
219
|
-
location: string | null
|
|
284
|
+
display_name: string;
|
|
285
|
+
links: Record<LiteralUnion<"self" | "avatar" | "repositories" | "snippets" | "html" | "hooks">, {
|
|
286
|
+
href?: string;
|
|
287
|
+
}>;
|
|
288
|
+
created_on: string;
|
|
289
|
+
type: string;
|
|
290
|
+
uuid: string;
|
|
291
|
+
has_2fa_enabled: boolean;
|
|
292
|
+
username: string;
|
|
293
|
+
nickname: string;
|
|
294
|
+
is_staff: boolean;
|
|
295
|
+
account_id: string;
|
|
296
|
+
account_status: LiteralUnion<"active" | "inactive" | "closed">;
|
|
297
|
+
location: string | null;
|
|
220
298
|
}
|
|
221
299
|
/**
|
|
222
300
|
* Bitbucket OAuth Provider
|
|
@@ -229,77 +307,79 @@ interface BitbucketProfile {
|
|
|
229
307
|
* @see [Bitbucket - Cloud REST API](https://developer.atlassian.com/cloud/bitbucket/rest/intro/)
|
|
230
308
|
* @see [Bitbucket - User Endpoint](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-users/#api-users-endpoint)
|
|
231
309
|
*/
|
|
232
|
-
declare const bitbucket: OAuthProviderConfig<BitbucketProfile
|
|
310
|
+
declare const bitbucket: OAuthProviderConfig<BitbucketProfile>;
|
|
233
311
|
|
|
234
312
|
/**
|
|
235
313
|
* @see [Get the authenticated user](https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user)
|
|
236
314
|
*/
|
|
237
315
|
interface GitHubProfile {
|
|
238
|
-
login: string
|
|
239
|
-
id: number
|
|
240
|
-
user_view_type: string
|
|
241
|
-
node_id: string
|
|
242
|
-
avatar_url: string
|
|
243
|
-
gravatar_id: string | null
|
|
244
|
-
url: string
|
|
245
|
-
html_url: string
|
|
246
|
-
followers_url: string
|
|
247
|
-
following_url: string
|
|
248
|
-
gists_url: string
|
|
249
|
-
starred_url: string
|
|
250
|
-
subscriptions_url: string
|
|
251
|
-
organizations_url: string
|
|
252
|
-
repos_url: string
|
|
253
|
-
events_url: string
|
|
254
|
-
received_events_url: string
|
|
255
|
-
type: string
|
|
256
|
-
site_admin: boolean
|
|
257
|
-
name: string | null
|
|
258
|
-
company: string | null
|
|
259
|
-
blog: string | null
|
|
260
|
-
location: string | null
|
|
261
|
-
email: string | null
|
|
262
|
-
notification_email: string | null
|
|
263
|
-
hireable: boolean | null
|
|
264
|
-
bio: string | null
|
|
265
|
-
twitter_username?: string | null
|
|
266
|
-
public_repos: number
|
|
267
|
-
public_gists: number
|
|
268
|
-
followers: number
|
|
269
|
-
following: number
|
|
270
|
-
created_at: string
|
|
271
|
-
updated_at: string
|
|
272
|
-
private_gists?: number
|
|
273
|
-
total_private_repos?: number
|
|
274
|
-
owned_private_repos?: number
|
|
275
|
-
disk_usage?: number
|
|
276
|
-
collaborators?: number
|
|
277
|
-
two_factor_authentication: boolean
|
|
316
|
+
login: string;
|
|
317
|
+
id: number;
|
|
318
|
+
user_view_type: string;
|
|
319
|
+
node_id: string;
|
|
320
|
+
avatar_url: string;
|
|
321
|
+
gravatar_id: string | null;
|
|
322
|
+
url: string;
|
|
323
|
+
html_url: string;
|
|
324
|
+
followers_url: string;
|
|
325
|
+
following_url: string;
|
|
326
|
+
gists_url: string;
|
|
327
|
+
starred_url: string;
|
|
328
|
+
subscriptions_url: string;
|
|
329
|
+
organizations_url: string;
|
|
330
|
+
repos_url: string;
|
|
331
|
+
events_url: string;
|
|
332
|
+
received_events_url: string;
|
|
333
|
+
type: string;
|
|
334
|
+
site_admin: boolean;
|
|
335
|
+
name: string | null;
|
|
336
|
+
company: string | null;
|
|
337
|
+
blog: string | null;
|
|
338
|
+
location: string | null;
|
|
339
|
+
email: string | null;
|
|
340
|
+
notification_email: string | null;
|
|
341
|
+
hireable: boolean | null;
|
|
342
|
+
bio: string | null;
|
|
343
|
+
twitter_username?: string | null;
|
|
344
|
+
public_repos: number;
|
|
345
|
+
public_gists: number;
|
|
346
|
+
followers: number;
|
|
347
|
+
following: number;
|
|
348
|
+
created_at: string;
|
|
349
|
+
updated_at: string;
|
|
350
|
+
private_gists?: number;
|
|
351
|
+
total_private_repos?: number;
|
|
352
|
+
owned_private_repos?: number;
|
|
353
|
+
disk_usage?: number;
|
|
354
|
+
collaborators?: number;
|
|
355
|
+
two_factor_authentication: boolean;
|
|
278
356
|
plan?: {
|
|
279
|
-
collaborators: number
|
|
280
|
-
name: string
|
|
281
|
-
space: number
|
|
282
|
-
private_repos: number
|
|
283
|
-
}
|
|
357
|
+
collaborators: number;
|
|
358
|
+
name: string;
|
|
359
|
+
space: number;
|
|
360
|
+
private_repos: number;
|
|
361
|
+
};
|
|
284
362
|
}
|
|
285
363
|
/**
|
|
286
364
|
* GitHub OAuth Provider
|
|
365
|
+
*
|
|
287
366
|
* @see [GitHub - Creating an OAuth App](https://docs.github.com/en/developers/apps/building-oauth-apps/creating-an-oauth-app)
|
|
288
367
|
* @see [GitHub - Authorizing OAuth Apps](https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps)
|
|
289
368
|
* @see [GitHub - Configure your GitHub OAuth Apps](https://github.com/settings/developers)
|
|
290
369
|
* @see [Github - Get the authenticated user](https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user)
|
|
291
370
|
*/
|
|
292
|
-
declare const github: OAuthProviderConfig<GitHubProfile
|
|
371
|
+
declare const github: OAuthProviderConfig<GitHubProfile>;
|
|
293
372
|
|
|
294
373
|
declare const builtInOAuthProviders: {
|
|
295
|
-
github: OAuthProviderConfig<GitHubProfile
|
|
296
|
-
bitbucket: OAuthProviderConfig<BitbucketProfile
|
|
297
|
-
figma: OAuthProviderConfig<FigmaProfile
|
|
298
|
-
discord: OAuthProviderConfig<DiscordProfile
|
|
299
|
-
gitlab: OAuthProviderConfig<GitLabProfile
|
|
300
|
-
spotify: OAuthProviderConfig<SpotifyProfile
|
|
301
|
-
x: OAuthProviderConfig<XProfile
|
|
302
|
-
|
|
374
|
+
readonly github: OAuthProviderConfig<GitHubProfile>;
|
|
375
|
+
readonly bitbucket: OAuthProviderConfig<BitbucketProfile>;
|
|
376
|
+
readonly figma: OAuthProviderConfig<FigmaProfile>;
|
|
377
|
+
readonly discord: OAuthProviderConfig<DiscordProfile>;
|
|
378
|
+
readonly gitlab: OAuthProviderConfig<GitLabProfile>;
|
|
379
|
+
readonly spotify: OAuthProviderConfig<SpotifyProfile>;
|
|
380
|
+
readonly x: OAuthProviderConfig<XProfile>;
|
|
381
|
+
readonly strava: OAuthProviderConfig<StravaProfile>;
|
|
382
|
+
};
|
|
303
383
|
/**
|
|
304
384
|
* Constructs OAuth provider configurations from an array of provider names or configurations.
|
|
305
385
|
* It loads the client ID and client secret from environment variables if only the provider name is provided.
|
|
@@ -307,110 +387,91 @@ declare const builtInOAuthProviders: {
|
|
|
307
387
|
* @param oauth - Array of OAuth provider configurations or provider names to be defined from environment variables
|
|
308
388
|
* @returns A record of OAuth provider configurations
|
|
309
389
|
*/
|
|
310
|
-
declare const createBuiltInOAuthProviders: (
|
|
311
|
-
|
|
312
|
-
) => Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>
|
|
313
|
-
type BuiltInOAuthProvider = keyof typeof builtInOAuthProviders
|
|
390
|
+
declare const createBuiltInOAuthProviders: (oauth?: (BuiltInOAuthProvider | OAuthProviderCredentials)[]) => Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>;
|
|
391
|
+
type BuiltInOAuthProvider = keyof typeof builtInOAuthProviders;
|
|
314
392
|
|
|
315
393
|
/**
|
|
316
394
|
* Standard JWT claims that are managed internally by the token system.
|
|
317
395
|
* These fields are typically filtered out before returning user data.
|
|
318
396
|
*/
|
|
319
|
-
type JWTStandardClaims = Pick<JWTPayload, "exp" | "iat" | "jti" | "nbf" | "sub" | "aud" | "iss"
|
|
397
|
+
type JWTStandardClaims = Pick<JWTPayload, "exp" | "iat" | "jti" | "nbf" | "sub" | "aud" | "iss">;
|
|
398
|
+
/**
|
|
399
|
+
* JWT payload structure that includes a mandatory `token` field used to verify CSRF Tokens
|
|
400
|
+
*/
|
|
401
|
+
type JWTPayloadWithToken = JWTPayload & {
|
|
402
|
+
token: string;
|
|
403
|
+
};
|
|
320
404
|
/**
|
|
321
405
|
* Standardized user profile returned by OAuth providers after fetching user information
|
|
322
406
|
* and mapping the response to this format by default or via the `profile` custom function.
|
|
323
407
|
*/
|
|
324
408
|
interface User {
|
|
325
|
-
sub: string
|
|
326
|
-
name?: string
|
|
327
|
-
email?: string
|
|
328
|
-
image?: string
|
|
409
|
+
sub: string;
|
|
410
|
+
name?: string | null;
|
|
411
|
+
email?: string | null;
|
|
412
|
+
image?: string | null;
|
|
329
413
|
}
|
|
330
414
|
/**
|
|
331
415
|
* Session data returned by the session endpoint.
|
|
332
416
|
*/
|
|
333
417
|
interface Session {
|
|
334
|
-
user: User
|
|
335
|
-
expires: string
|
|
418
|
+
user: User;
|
|
419
|
+
expires: string;
|
|
336
420
|
}
|
|
337
421
|
/**
|
|
338
422
|
* Configuration for an OAuth provider without credentials.
|
|
339
423
|
* Use this type when defining provider metadata and endpoints.
|
|
340
424
|
*/
|
|
341
425
|
interface OAuthProviderConfig<Profile extends object = {}> {
|
|
342
|
-
id: string
|
|
343
|
-
name: string
|
|
344
|
-
authorizeURL: string
|
|
345
|
-
accessToken: string
|
|
346
|
-
userInfo: string
|
|
347
|
-
scope: string
|
|
348
|
-
responseType:
|
|
349
|
-
profile?: (profile: Profile) => User | Promise<User
|
|
426
|
+
id: string;
|
|
427
|
+
name: string;
|
|
428
|
+
authorizeURL: string;
|
|
429
|
+
accessToken: string;
|
|
430
|
+
userInfo: string;
|
|
431
|
+
scope: string;
|
|
432
|
+
responseType: "code" | "token" | "refresh_token" | "id_token";
|
|
433
|
+
profile?: (profile: Profile) => User | Promise<User>;
|
|
350
434
|
}
|
|
351
435
|
/**
|
|
352
436
|
* OAuth provider configuration with client credentials.
|
|
353
437
|
* Extends OAuthProviderConfig with clientId and clientSecret.
|
|
354
438
|
*/
|
|
355
|
-
interface OAuthProviderCredentials extends OAuthProviderConfig {
|
|
356
|
-
clientId: string
|
|
357
|
-
clientSecret: string
|
|
439
|
+
interface OAuthProviderCredentials<Profile extends object = {}> extends OAuthProviderConfig<Profile> {
|
|
440
|
+
clientId: string;
|
|
441
|
+
clientSecret: string;
|
|
358
442
|
}
|
|
359
443
|
/**
|
|
360
444
|
* Complete OAuth provider type combining configuration and credentials.
|
|
361
445
|
*/
|
|
362
|
-
type OAuthProvider<Profile extends
|
|
446
|
+
type OAuthProvider<Profile extends object = {}> = OAuthProviderCredentials<Profile>;
|
|
363
447
|
/**
|
|
364
448
|
* Cookie type with __Secure- prefix, must be Secure.
|
|
365
449
|
* @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__secure-prefix
|
|
366
450
|
*/
|
|
367
451
|
type SecureCookie = {
|
|
368
|
-
strategy: "secure"
|
|
369
|
-
} &
|
|
370
|
-
options?: Prettify<Omit<SerializeOptions, "secure" | "encode">>
|
|
371
|
-
}
|
|
452
|
+
strategy: "secure";
|
|
453
|
+
} & Prettify<Omit<SerializeOptions, "secure" | "encode">>;
|
|
372
454
|
/**
|
|
373
455
|
* Cookie type with __Host- prefix, must be Secure, Path=/, no Domain attribute.
|
|
374
456
|
* @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__host-prefix
|
|
375
457
|
*/
|
|
376
458
|
type HostCookie = {
|
|
377
|
-
strategy: "host"
|
|
378
|
-
} &
|
|
379
|
-
options?: Prettify<Omit<SerializeOptions, "secure" | "path" | "domain" | "encode">>
|
|
380
|
-
}
|
|
459
|
+
strategy: "host";
|
|
460
|
+
} & Prettify<Omit<SerializeOptions, "secure" | "path" | "domain" | "encode">>;
|
|
381
461
|
/**
|
|
382
462
|
* Standard cookie type without security prefixes.
|
|
383
463
|
* Can be sent over both HTTP and HTTPS connections (default in development).
|
|
384
464
|
*/
|
|
385
465
|
type StandardCookie = {
|
|
386
|
-
strategy?: "standard"
|
|
387
|
-
} &
|
|
388
|
-
options?: Prettify<Omit<SerializeOptions, "encode">>
|
|
389
|
-
}
|
|
466
|
+
strategy?: "standard";
|
|
467
|
+
} & Prettify<Omit<SerializeOptions, "encode">>;
|
|
390
468
|
/**
|
|
391
469
|
* Union type for cookie options based on the specified strategy.
|
|
392
470
|
* - `secure`: Cookies are only sent over HTTPS connections
|
|
393
471
|
* - `host`: Cookies use the __Host- prefix and are only sent over HTTPS connections
|
|
394
472
|
* - `standard`: Cookies can be sent over both HTTP and HTTPS connections (default in development)
|
|
395
473
|
*/
|
|
396
|
-
type
|
|
397
|
-
/**
|
|
398
|
-
* Configuration options for cookies used in Aura Auth.
|
|
399
|
-
* @see {@link AuthConfig.cookies}
|
|
400
|
-
*/
|
|
401
|
-
type CookieConfig = Prettify<
|
|
402
|
-
{
|
|
403
|
-
name?: string
|
|
404
|
-
} & CookieStrategyOptions
|
|
405
|
-
>
|
|
406
|
-
/**
|
|
407
|
-
* Internal representation of cookie configuration with all options resolved.
|
|
408
|
-
* @internal
|
|
409
|
-
*/
|
|
410
|
-
type CookieConfigInternal = {
|
|
411
|
-
name?: string
|
|
412
|
-
prefix?: string
|
|
413
|
-
} & SerializeOptions
|
|
474
|
+
type CookieStrategyAttributes = StandardCookie | SecureCookie | HostCookie;
|
|
414
475
|
/**
|
|
415
476
|
* Names of cookies used by Aura Auth for session management and OAuth flows.
|
|
416
477
|
* - `sessionToken`: User session JWT
|
|
@@ -421,7 +482,18 @@ type CookieConfigInternal = {
|
|
|
421
482
|
* - `redirect_to`: Post-authentication redirect path
|
|
422
483
|
* - `nonce`: OpenID Connect nonce parameter
|
|
423
484
|
*/
|
|
424
|
-
type CookieName = "sessionToken" | "csrfToken" | "state" | "
|
|
485
|
+
type CookieName = "sessionToken" | "csrfToken" | "state" | "code_verifier" | "redirect_to" | "redirect_uri";
|
|
486
|
+
type CookieStoreConfig = Record<CookieName, {
|
|
487
|
+
name: string;
|
|
488
|
+
attributes: CookieStrategyAttributes;
|
|
489
|
+
}>;
|
|
490
|
+
interface CookieConfig {
|
|
491
|
+
/**
|
|
492
|
+
* Prefix to be added to all cookie names. By default "aura-stack".
|
|
493
|
+
*/
|
|
494
|
+
prefix?: string;
|
|
495
|
+
overrides?: Partial<CookieStoreConfig>;
|
|
496
|
+
}
|
|
425
497
|
/**
|
|
426
498
|
* Main configuration interface for Aura Auth.
|
|
427
499
|
* This is the user-facing configuration object passed to `createAuth()`.
|
|
@@ -450,7 +522,7 @@ interface AuthConfig {
|
|
|
450
522
|
* }
|
|
451
523
|
* ]
|
|
452
524
|
*/
|
|
453
|
-
oauth: (BuiltInOAuthProvider | OAuthProviderCredentials)[]
|
|
525
|
+
oauth: (BuiltInOAuthProvider | OAuthProviderCredentials)[];
|
|
454
526
|
/**
|
|
455
527
|
* Cookie options defines the configuration for cookies used in Aura Auth.
|
|
456
528
|
* It includes a prefix for cookie names and flag options to determine
|
|
@@ -469,17 +541,17 @@ interface AuthConfig {
|
|
|
469
541
|
* @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__secure-prefix
|
|
470
542
|
* @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__host-prefix
|
|
471
543
|
*/
|
|
472
|
-
cookies?: CookieConfig
|
|
544
|
+
cookies?: Partial<CookieConfig>;
|
|
473
545
|
/**
|
|
474
546
|
* Secret used to sign and verify JWT tokens for session and csrf protection.
|
|
475
547
|
* If not provided, it will load from the environment variable `AURA_AUTH_SECRET`, but if it
|
|
476
548
|
* doesn't exist, it will throw an error during the initialization of the Auth module.
|
|
477
549
|
*/
|
|
478
|
-
secret?: string
|
|
550
|
+
secret?: string;
|
|
479
551
|
/**
|
|
480
552
|
* Base path for all authentication routes. Default is `/auth`.
|
|
481
553
|
*/
|
|
482
|
-
basePath?: `/${string}
|
|
554
|
+
basePath?: `/${string}`;
|
|
483
555
|
/**
|
|
484
556
|
* Enable trusted proxy headers for scenarios where the application is behind a reverse proxy or load balancer.
|
|
485
557
|
* This setting allows Aura Auth to correctly interpret headers like `X-Forwarded-For` and `X-Forwarded-Proto`
|
|
@@ -494,104 +566,65 @@ interface AuthConfig {
|
|
|
494
566
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded
|
|
495
567
|
* @experimental
|
|
496
568
|
*/
|
|
497
|
-
trustedProxyHeaders?: boolean
|
|
569
|
+
trustedProxyHeaders?: boolean;
|
|
498
570
|
}
|
|
499
571
|
interface JoseInstance {
|
|
500
|
-
decodeJWT: (token: string) => Promise<JWTPayload
|
|
501
|
-
encodeJWT: (payload: JWTPayload) => Promise<string
|
|
502
|
-
signJWS: (payload: JWTPayload) => Promise<string
|
|
503
|
-
verifyJWS: (payload: string) => Promise<JWTPayload
|
|
572
|
+
decodeJWT: (token: string) => Promise<JWTPayload>;
|
|
573
|
+
encodeJWT: (payload: JWTPayload) => Promise<string>;
|
|
574
|
+
signJWS: (payload: JWTPayload) => Promise<string>;
|
|
575
|
+
verifyJWS: (payload: string) => Promise<JWTPayload>;
|
|
576
|
+
encryptJWE: (payload: string) => Promise<string>;
|
|
577
|
+
decryptJWE: (payload: string) => Promise<string>;
|
|
578
|
+
}
|
|
579
|
+
interface RouterGlobalContext {
|
|
580
|
+
oauth: Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>;
|
|
581
|
+
cookies: CookieStoreConfig;
|
|
582
|
+
jose: JoseInstance;
|
|
583
|
+
secret?: string;
|
|
584
|
+
basePath: string;
|
|
585
|
+
trustedProxyHeaders: boolean;
|
|
504
586
|
}
|
|
505
587
|
/**
|
|
506
588
|
* Internal runtime configuration used within Aura Auth after initialization.
|
|
507
589
|
* All optional fields from AuthConfig are resolved to their default values.
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
*/
|
|
511
|
-
interface AuthRuntimeConfig {
|
|
512
|
-
oauth: Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>
|
|
513
|
-
cookies: CookieConfig
|
|
514
|
-
secret: string
|
|
515
|
-
jose: JoseInstance
|
|
516
|
-
}
|
|
517
|
-
interface RouterGlobalContext {
|
|
518
|
-
oauth: Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>
|
|
519
|
-
cookies: CookieConfigInternal
|
|
520
|
-
jose: JoseInstance
|
|
521
|
-
basePath: string
|
|
522
|
-
trustedProxyHeaders: boolean
|
|
523
|
-
}
|
|
590
|
+
*/
|
|
591
|
+
type AuthRuntimeConfig = RouterGlobalContext;
|
|
524
592
|
interface AuthInstance {
|
|
525
593
|
handlers: {
|
|
526
|
-
GET: (request: Request) => Response | Promise<Response
|
|
527
|
-
POST: (request: Request) => Response | Promise<Response
|
|
528
|
-
}
|
|
529
|
-
jose: JoseInstance
|
|
594
|
+
GET: (request: Request) => Response | Promise<Response>;
|
|
595
|
+
POST: (request: Request) => Response | Promise<Response>;
|
|
596
|
+
};
|
|
597
|
+
jose: JoseInstance;
|
|
530
598
|
}
|
|
531
599
|
/**
|
|
532
600
|
* Base OAuth error response structure.
|
|
533
601
|
*/
|
|
534
602
|
interface OAuthError<T extends string> {
|
|
535
|
-
error: T
|
|
536
|
-
error_description?: string
|
|
603
|
+
error: T;
|
|
604
|
+
error_description?: string;
|
|
537
605
|
}
|
|
538
606
|
/**
|
|
539
607
|
* OAuth 2.0 Authorization Error Response Types
|
|
540
608
|
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1
|
|
541
609
|
*/
|
|
542
|
-
type AuthorizationError = OAuthError<z.infer<typeof OAuthAuthorizationErrorResponse>["error"]
|
|
610
|
+
type AuthorizationError = OAuthError<z.infer<typeof OAuthAuthorizationErrorResponse>["error"]>;
|
|
543
611
|
/**
|
|
544
612
|
* OAuth 2.0 Access Token Error Response Types
|
|
545
613
|
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-5.2
|
|
546
614
|
*/
|
|
547
|
-
type AccessTokenError = OAuthError<z.infer<typeof OAuthAccessTokenErrorResponse>["error"]
|
|
615
|
+
type AccessTokenError = OAuthError<z.infer<typeof OAuthAccessTokenErrorResponse>["error"]>;
|
|
548
616
|
/**
|
|
549
617
|
* OAuth 2.0 Token Revocation Error Response Types
|
|
550
618
|
* @see https://datatracker.ietf.org/doc/html/rfc7009#section-2.2.1
|
|
551
619
|
*/
|
|
552
|
-
type TokenRevocationError = OAuthError<"invalid_session_token"
|
|
553
|
-
type ErrorType = AuthorizationError["error"] | AccessTokenError["error"] | TokenRevocationError["error"]
|
|
620
|
+
type TokenRevocationError = OAuthError<"invalid_session_token">;
|
|
621
|
+
type ErrorType = AuthorizationError["error"] | AccessTokenError["error"] | TokenRevocationError["error"];
|
|
622
|
+
type AuthInternalErrorCode = "INVALID_OAUTH_CONFIGURATION" | "INVALID_JWT_TOKEN" | "JOSE_INITIALIZATION_FAILED" | "SESSION_STORE_NOT_INITIALIZED" | "COOKIE_STORE_NOT_INITIALIZED" | "COOKIE_PARSING_FAILED" | "COOKIE_NOT_FOUND" | "INVALID_ENVIRONMENT_CONFIGURATION";
|
|
623
|
+
type AuthSecurityErrorCode = "INVALID_STATE" | "MISMATCHING_STATE" | "POTENTIAL_OPEN_REDIRECT_ATTACK_DETECTED" | "CSRF_TOKEN_INVALID" | "CSRF_TOKEN_MISSING" | "SESSION_TOKEN_MISSING";
|
|
624
|
+
type OAuthEnv = z.infer<typeof OAuthEnvSchema>;
|
|
625
|
+
type APIErrorMap = Record<string, {
|
|
626
|
+
code: string;
|
|
627
|
+
message: string;
|
|
628
|
+
}>;
|
|
554
629
|
|
|
555
|
-
export {
|
|
556
|
-
type AuthRuntimeConfig as A,
|
|
557
|
-
type BitbucketProfile as B,
|
|
558
|
-
type CookieConfig as C,
|
|
559
|
-
type DiscordProfile as D,
|
|
560
|
-
type ErrorType as E,
|
|
561
|
-
type FigmaProfile as F,
|
|
562
|
-
type GitLabProfile as G,
|
|
563
|
-
type HostCookie as H,
|
|
564
|
-
type JoseInstance as J,
|
|
565
|
-
type Nameplate as N,
|
|
566
|
-
type OAuthProvider as O,
|
|
567
|
-
type RouterGlobalContext as R,
|
|
568
|
-
type Session as S,
|
|
569
|
-
type TokenRevocationError as T,
|
|
570
|
-
type User as U,
|
|
571
|
-
type XProfile as X,
|
|
572
|
-
type CookieConfigInternal as a,
|
|
573
|
-
type CookieName as b,
|
|
574
|
-
type AuthConfig as c,
|
|
575
|
-
type AuthInstance as d,
|
|
576
|
-
type OAuthProviderConfig as e,
|
|
577
|
-
type OAuthProviderCredentials as f,
|
|
578
|
-
type SpotifyProfile as g,
|
|
579
|
-
gitlab as h,
|
|
580
|
-
discord as i,
|
|
581
|
-
figma as j,
|
|
582
|
-
bitbucket as k,
|
|
583
|
-
type GitHubProfile as l,
|
|
584
|
-
github as m,
|
|
585
|
-
builtInOAuthProviders as n,
|
|
586
|
-
createBuiltInOAuthProviders as o,
|
|
587
|
-
type BuiltInOAuthProvider as p,
|
|
588
|
-
type JWTStandardClaims as q,
|
|
589
|
-
type SecureCookie as r,
|
|
590
|
-
spotify as s,
|
|
591
|
-
type StandardCookie as t,
|
|
592
|
-
type CookieStrategyOptions as u,
|
|
593
|
-
type OAuthError as v,
|
|
594
|
-
type AuthorizationError as w,
|
|
595
|
-
x,
|
|
596
|
-
type AccessTokenError as y,
|
|
597
|
-
}
|
|
630
|
+
export { type AuthRuntimeConfig as A, type BitbucketProfile as B, type CookieConfig as C, type DiscordProfile as D, type ErrorType as E, type FigmaProfile as F, type GitLabProfile as G, type SecureCookie as H, type Image as I, type JWTPayloadWithToken as J, type HostCookie as K, type StandardCookie as L, type CookieStrategyAttributes as M, type Nameplate as N, type OAuthProvider as O, type CookieName as P, type OAuthError as Q, type RouterGlobalContext as R, type Session as S, type AuthorizationError as T, type User as U, type AccessTokenError as V, type TokenRevocationError as W, type XProfile as X, type OAuthEnv as Y, type CookieStoreConfig as a, type AuthInternalErrorCode as b, type AuthSecurityErrorCode as c, type AuthConfig as d, type AuthInstance as e, type JoseInstance as f, type OAuthProviderConfig as g, type OAuthProviderCredentials as h, type APIErrorMap as i, type SummaryClub as j, type SummaryGear as k, type StravaProfile as l, type SpotifyProfile as m, spotify as n, gitlab as o, discord as p, figma as q, bitbucket as r, strava as s, type GitHubProfile as t, github as u, builtInOAuthProviders as v, createBuiltInOAuthProviders as w, x, type BuiltInOAuthProvider as y, type JWTStandardClaims as z };
|