@aura-stack/auth 0.1.0-rc.6 → 0.1.0-rc.8
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 +31 -9
- package/dist/@types/index.js +1 -1
- package/dist/@types/router.d.cjs +1 -1
- package/dist/@types/router.d.d.ts +7 -9
- package/dist/@types/utility.cjs +15 -15
- package/dist/@types/utility.d.ts +8 -4
- package/dist/@types/utility.js +1 -1
- package/dist/actions/callback/access-token.cjs +143 -143
- package/dist/actions/callback/access-token.d.ts +20 -17
- package/dist/actions/callback/access-token.js +4 -8
- package/dist/actions/callback/callback.cjs +455 -437
- package/dist/actions/callback/callback.d.ts +12 -11
- package/dist/actions/callback/callback.js +12 -16
- package/dist/actions/callback/userinfo.cjs +134 -131
- package/dist/actions/callback/userinfo.d.ts +9 -11
- package/dist/actions/callback/userinfo.js +6 -10
- package/dist/actions/csrfToken/csrfToken.cjs +171 -162
- package/dist/actions/csrfToken/csrfToken.d.ts +3 -3
- package/dist/actions/csrfToken/csrfToken.js +8 -12
- package/dist/actions/index.cjs +773 -746
- package/dist/actions/index.d.ts +13 -14
- package/dist/actions/index.js +18 -34
- package/dist/actions/session/session.cjs +155 -149
- package/dist/actions/session/session.d.ts +3 -3
- package/dist/actions/session/session.js +7 -11
- package/dist/actions/signIn/authorization.cjs +249 -231
- package/dist/actions/signIn/authorization.d.ts +18 -14
- package/dist/actions/signIn/authorization.js +6 -16
- package/dist/actions/signIn/signIn.cjs +423 -396
- package/dist/actions/signIn/signIn.d.ts +10 -11
- package/dist/actions/signIn/signIn.js +10 -14
- package/dist/actions/signOut/signOut.cjs +440 -417
- package/dist/actions/signOut/signOut.d.ts +3 -3
- package/dist/actions/signOut/signOut.js +11 -15
- package/dist/assert.cjs +36 -35
- package/dist/assert.d.ts +4 -4
- package/dist/assert.js +2 -10
- package/dist/chunk-256KIVJL.js +96 -85
- package/dist/chunk-42XB3YCW.js +17 -19
- package/dist/chunk-6SM22VVJ.js +10 -13
- package/dist/chunk-CAKJT3KS.js +69 -84
- package/dist/chunk-E3OXBRYF.js +17 -19
- package/dist/chunk-EBPE35JT.js +26 -28
- package/dist/chunk-FIPU4MLT.js +16 -18
- package/dist/chunk-FJUDBLCP.js +43 -50
- package/dist/chunk-FKRDCWBF.js +17 -19
- package/dist/chunk-GZU3RBTB.js +40 -51
- package/dist/chunk-HGJ4TXY4.js +100 -132
- package/dist/chunk-HMRKN75I.js +63 -63
- package/dist/chunk-IKHPGFCW.js +9 -11
- package/dist/chunk-JAPMIE6S.js +5 -7
- package/dist/chunk-KRNOMBXQ.js +17 -19
- package/dist/chunk-LLR722CL.js +70 -91
- package/dist/chunk-RLT4RFKV.js +30 -39
- package/dist/chunk-SJPDVKUS.js +88 -107
- package/dist/chunk-SMQO5WD7.js +16 -26
- package/dist/chunk-STHEPPUZ.js +6 -8
- package/dist/chunk-UJJ7R56J.js +37 -47
- package/dist/chunk-UTDLUEEG.js +25 -0
- package/dist/chunk-VFTYH33W.js +37 -54
- package/dist/chunk-XXJKNKGQ.js +23 -33
- package/dist/chunk-ZV4BH47P.js +134 -132
- package/dist/cookie.cjs +175 -169
- package/dist/cookie.d.ts +51 -25
- package/dist/cookie.js +34 -34
- package/dist/error.cjs +75 -75
- package/dist/error.d.ts +30 -32
- package/dist/error.js +8 -15
- package/dist/headers.cjs +28 -28
- package/dist/headers.d.ts +2 -2
- package/dist/headers.js +2 -6
- package/dist/{index-CKVRbv5V.d.ts → index-DpfbvTZ_.d.ts} +304 -244
- package/dist/index.cjs +969 -933
- package/dist/index.d.ts +30 -19
- package/dist/index.js +50 -70
- package/dist/jose.cjs +67 -52
- package/dist/jose.d.ts +8 -8
- package/dist/jose.js +5 -9
- package/dist/oauth/bitbucket.cjs +38 -38
- package/dist/oauth/bitbucket.d.ts +7 -9
- package/dist/oauth/bitbucket.js +2 -6
- package/dist/oauth/discord.cjs +48 -48
- package/dist/oauth/discord.d.ts +7 -9
- package/dist/oauth/discord.js +2 -6
- package/dist/oauth/figma.cjs +39 -39
- package/dist/oauth/figma.d.ts +7 -9
- package/dist/oauth/figma.js +2 -6
- package/dist/oauth/github.cjs +31 -31
- package/dist/oauth/github.d.ts +7 -9
- package/dist/oauth/github.js +2 -6
- package/dist/oauth/gitlab.cjs +39 -39
- package/dist/oauth/gitlab.d.ts +7 -9
- package/dist/oauth/gitlab.js +2 -6
- package/dist/oauth/index.cjs +180 -180
- package/dist/oauth/index.d.ts +26 -9
- package/dist/oauth/index.js +9 -36
- package/dist/oauth/spotify.cjs +39 -39
- package/dist/oauth/spotify.d.ts +7 -9
- package/dist/oauth/spotify.js +2 -6
- package/dist/oauth/x.cjs +39 -39
- package/dist/oauth/x.d.ts +7 -9
- package/dist/oauth/x.js +2 -6
- package/dist/response.cjs +27 -27
- package/dist/response.d.ts +2 -2
- package/dist/response.js +2 -6
- package/dist/schemas.cjs +91 -91
- package/dist/schemas.d.ts +126 -93
- package/dist/schemas.js +18 -18
- package/dist/secure.cjs +98 -95
- package/dist/secure.d.ts +17 -19
- package/dist/secure.js +4 -18
- package/dist/utils.cjs +132 -119
- package/dist/utils.d.ts +26 -11
- package/dist/utils.js +21 -21
- package/package.json +1 -1
- package/dist/chunk-X7M4CQTN.js +0 -25
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import { z } from
|
|
2
|
-
import {
|
|
3
|
-
import { OAuthAuthorizationErrorResponse, OAuthAccessTokenErrorResponse } from
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { LiteralUnion } from './@types/utility.js';
|
|
7
|
-
import { JWTPayload } from '@aura-stack/jose/jose';
|
|
1
|
+
import { z } from "zod/v4"
|
|
2
|
+
import { JWTPayload } from "@aura-stack/jose/jose"
|
|
3
|
+
import { OAuthAuthorizationErrorResponse, OAuthAccessTokenErrorResponse } from "./schemas.js"
|
|
4
|
+
import { SerializeOptions } from "cookie"
|
|
5
|
+
import { LiteralUnion, Prettify } from "./@types/utility.js"
|
|
8
6
|
|
|
9
7
|
/**
|
|
10
8
|
* @see [X - Get my User](https://docs.x.com/x-api/users/get-my-user)
|
|
11
9
|
*/
|
|
12
10
|
interface XProfile {
|
|
13
11
|
data: {
|
|
14
|
-
id: string
|
|
15
|
-
name: string
|
|
16
|
-
username: string
|
|
17
|
-
profile_image_url: string
|
|
18
|
-
}
|
|
12
|
+
id: string
|
|
13
|
+
name: string
|
|
14
|
+
username: string
|
|
15
|
+
profile_image_url: string
|
|
16
|
+
}
|
|
19
17
|
}
|
|
20
18
|
/**
|
|
21
19
|
* @see [X - Developer Portal](https://developer.x.com/en/portal/projects-and-apps)
|
|
@@ -24,37 +22,37 @@ interface XProfile {
|
|
|
24
22
|
* @see [X - OAuth 2.0 Scopes](https://docs.x.com/fundamentals/authentication/oauth-2-0/authorization-code#scopes)
|
|
25
23
|
* @see [X - OAuth 2.0 Bearer Token](https://docs.x.com/fundamentals/authentication/oauth-2-0/application-only)
|
|
26
24
|
*/
|
|
27
|
-
declare const x: OAuthProviderConfig<XProfile
|
|
25
|
+
declare const x: OAuthProviderConfig<XProfile>
|
|
28
26
|
|
|
29
27
|
interface Image {
|
|
30
|
-
url: string
|
|
31
|
-
height: number
|
|
32
|
-
width: number
|
|
28
|
+
url: string
|
|
29
|
+
height: number
|
|
30
|
+
width: number
|
|
33
31
|
}
|
|
34
32
|
/**
|
|
35
33
|
* @see [Spotify - User Object](https://developer.spotify.com/documentation/web-api/reference/object-model/#user-object-private)
|
|
36
34
|
*/
|
|
37
35
|
interface SpotifyProfile {
|
|
38
|
-
id: string
|
|
39
|
-
display_name: string
|
|
40
|
-
email: string
|
|
41
|
-
type: string
|
|
42
|
-
uri: string
|
|
43
|
-
country: string
|
|
44
|
-
href: string
|
|
45
|
-
images: Image[]
|
|
46
|
-
product: string
|
|
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
|
|
47
45
|
explicit_content: {
|
|
48
|
-
filter_enabled: boolean
|
|
49
|
-
filter_locked: boolean
|
|
50
|
-
}
|
|
46
|
+
filter_enabled: boolean
|
|
47
|
+
filter_locked: boolean
|
|
48
|
+
}
|
|
51
49
|
external_urls: {
|
|
52
|
-
spotify: string
|
|
53
|
-
}
|
|
50
|
+
spotify: string
|
|
51
|
+
}
|
|
54
52
|
followers: {
|
|
55
|
-
href: string
|
|
56
|
-
total: number
|
|
57
|
-
}
|
|
53
|
+
href: string
|
|
54
|
+
total: number
|
|
55
|
+
}
|
|
58
56
|
}
|
|
59
57
|
/**
|
|
60
58
|
* @see [Spotify - Spotify Developer Dashboard](https://developer.spotify.com/dashboard)
|
|
@@ -63,59 +61,59 @@ interface SpotifyProfile {
|
|
|
63
61
|
* @see [Spotify - Scopes](https://developer.spotify.com/documentation/web-api/concepts/scopes)
|
|
64
62
|
* @see [Spotify - Redirect URIs](https://developer.spotify.com/documentation/web-api/concepts/redirect_uri)
|
|
65
63
|
*/
|
|
66
|
-
declare const spotify: OAuthProviderConfig<SpotifyProfile
|
|
64
|
+
declare const spotify: OAuthProviderConfig<SpotifyProfile>
|
|
67
65
|
|
|
68
66
|
/**
|
|
69
67
|
* @see [GitLab - Get the current user](https://docs.gitlab.com/api/users/#get-the-current-user)
|
|
70
68
|
*/
|
|
71
69
|
interface GitLabProfile {
|
|
72
|
-
id: number
|
|
73
|
-
username: string
|
|
74
|
-
email: string
|
|
75
|
-
name: string
|
|
76
|
-
state: string
|
|
77
|
-
locked: boolean
|
|
78
|
-
avatar_url: string
|
|
79
|
-
web_url: string
|
|
80
|
-
created_at: string
|
|
81
|
-
bio: string
|
|
82
|
-
location: string | null
|
|
83
|
-
public_email: string
|
|
84
|
-
linkedin: string
|
|
85
|
-
twitter: string
|
|
86
|
-
discord: string
|
|
87
|
-
github: string
|
|
88
|
-
website_url: string
|
|
89
|
-
organization: string
|
|
90
|
-
job_title: string
|
|
91
|
-
pronouns: string
|
|
92
|
-
bot: boolean
|
|
93
|
-
work_information: string | null
|
|
94
|
-
followers: number
|
|
95
|
-
following: number
|
|
96
|
-
local_time: string
|
|
97
|
-
last_sign_in_at: string
|
|
98
|
-
confirmed_at: string
|
|
99
|
-
theme_id: number
|
|
100
|
-
last_activity_on: string
|
|
101
|
-
color_scheme_id: number
|
|
102
|
-
projects_limit: number
|
|
103
|
-
current_sign_in_at: string
|
|
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
|
|
104
102
|
identities: {
|
|
105
|
-
provider: string
|
|
106
|
-
extern_uid: string
|
|
107
|
-
saml_provider_id: number | null
|
|
108
|
-
}[]
|
|
109
|
-
can_create_group: boolean
|
|
110
|
-
can_create_project: boolean
|
|
111
|
-
two_factor_enabled: boolean
|
|
112
|
-
external: boolean
|
|
113
|
-
private_profile: boolean
|
|
114
|
-
commit_email: string
|
|
115
|
-
preferred_language: string
|
|
116
|
-
shared_runners_minutes_limit: number | null
|
|
117
|
-
extra_shared_runners_minutes_limit: number | null
|
|
118
|
-
scim_identities: unknown[]
|
|
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[]
|
|
119
117
|
}
|
|
120
118
|
/**
|
|
121
119
|
* @see [GitLab - Applications](https://gitlab.com/-/user_settings/applications)
|
|
@@ -123,16 +121,16 @@ interface GitLabProfile {
|
|
|
123
121
|
* @see [GitLab - Scopes](https://docs.gitlab.com/integration/oauth_provider/#view-all-authorized-applications)
|
|
124
122
|
* @see [GitLab - Get current user](https://docs.gitlab.com/api/users/#get-the-current-user)
|
|
125
123
|
*/
|
|
126
|
-
declare const gitlab: OAuthProviderConfig<GitLabProfile
|
|
124
|
+
declare const gitlab: OAuthProviderConfig<GitLabProfile>
|
|
127
125
|
|
|
128
126
|
/**
|
|
129
127
|
* @see [Discord - Nameplate Object](https://discord.com/developers/docs/resources/user#nameplate-nameplate-structure)
|
|
130
128
|
*/
|
|
131
129
|
interface Nameplate {
|
|
132
|
-
sku_id: string
|
|
133
|
-
asset: string
|
|
134
|
-
label: string
|
|
135
|
-
palette: string
|
|
130
|
+
sku_id: string
|
|
131
|
+
asset: string
|
|
132
|
+
label: string
|
|
133
|
+
palette: string
|
|
136
134
|
}
|
|
137
135
|
/**
|
|
138
136
|
* The `snowflake` type is a string type. The attributes defined with this type are:
|
|
@@ -143,33 +141,33 @@ interface Nameplate {
|
|
|
143
141
|
* @see [Discord - User Object](https://discord.com/developers/docs/resources/user#user-object)
|
|
144
142
|
*/
|
|
145
143
|
interface DiscordProfile {
|
|
146
|
-
id: string
|
|
147
|
-
username: string
|
|
148
|
-
discriminator: string
|
|
149
|
-
global_name: string | null
|
|
150
|
-
avatar: string | null
|
|
151
|
-
bot?: boolean
|
|
152
|
-
system?: boolean
|
|
153
|
-
mfa_enabled?: boolean
|
|
154
|
-
banner?: string | null
|
|
155
|
-
accent_color?: number | null
|
|
156
|
-
locale?: string
|
|
157
|
-
verified?: boolean
|
|
158
|
-
email?: string | null
|
|
159
|
-
flags?: number
|
|
160
|
-
premium_type?: number
|
|
161
|
-
public_flags?: number
|
|
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
|
|
162
160
|
avatar_decoration_data?: {
|
|
163
|
-
asset: string
|
|
164
|
-
sku_id: string
|
|
165
|
-
}
|
|
166
|
-
collections?: Record<string, Nameplate
|
|
161
|
+
asset: string
|
|
162
|
+
sku_id: string
|
|
163
|
+
}
|
|
164
|
+
collections?: Record<string, Nameplate>
|
|
167
165
|
primary_guild?: {
|
|
168
|
-
identity_guild_id: string
|
|
169
|
-
identity_enabled: boolean | null
|
|
170
|
-
tag: string | null
|
|
171
|
-
badge: string | null
|
|
172
|
-
}
|
|
166
|
+
identity_guild_id: string
|
|
167
|
+
identity_enabled: boolean | null
|
|
168
|
+
tag: string | null
|
|
169
|
+
badge: string | null
|
|
170
|
+
}
|
|
173
171
|
}
|
|
174
172
|
/**
|
|
175
173
|
* @see [Discord - Applications](https://discord.com/developers/applications)
|
|
@@ -179,16 +177,16 @@ interface DiscordProfile {
|
|
|
179
177
|
* @see [Discord - OAuth2 Scopes](https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes)
|
|
180
178
|
* @see [Discord - Image Formatting](https://discord.com/developers/docs/reference#image-formatting)
|
|
181
179
|
*/
|
|
182
|
-
declare const discord: OAuthProviderConfig<DiscordProfile
|
|
180
|
+
declare const discord: OAuthProviderConfig<DiscordProfile>
|
|
183
181
|
|
|
184
182
|
/**
|
|
185
183
|
* @see [Figma API - Users](https://developers.figma.com/docs/rest-api/users-types/)
|
|
186
184
|
*/
|
|
187
185
|
interface FigmaProfile {
|
|
188
|
-
id: string
|
|
189
|
-
handle: string
|
|
190
|
-
img_url: string
|
|
191
|
-
email: string
|
|
186
|
+
id: string
|
|
187
|
+
handle: string
|
|
188
|
+
img_url: string
|
|
189
|
+
email: string
|
|
192
190
|
}
|
|
193
191
|
/**
|
|
194
192
|
* @see [Figma - REST API Introduction](https://developers.figma.com/docs/rest-api/)
|
|
@@ -196,26 +194,29 @@ interface FigmaProfile {
|
|
|
196
194
|
* @see [Figma - Create an OAuth App](https://developers.figma.com/docs/rest-api/authentication/#create-an-oauth-app)
|
|
197
195
|
* @see [Figma - OAuth Scopes](https://developers.figma.com/docs/rest-api/scopes/)
|
|
198
196
|
*/
|
|
199
|
-
declare const figma: OAuthProviderConfig<FigmaProfile
|
|
197
|
+
declare const figma: OAuthProviderConfig<FigmaProfile>
|
|
200
198
|
|
|
201
199
|
/**
|
|
202
200
|
* @see [Get current user](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-users/#api-user-get)
|
|
203
201
|
*/
|
|
204
202
|
interface BitbucketProfile {
|
|
205
|
-
display_name: string
|
|
206
|
-
links: Record<
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
203
|
+
display_name: string
|
|
204
|
+
links: Record<
|
|
205
|
+
LiteralUnion<"self" | "avatar" | "repositories" | "snippets" | "html" | "hooks">,
|
|
206
|
+
{
|
|
207
|
+
href?: string
|
|
208
|
+
}
|
|
209
|
+
>
|
|
210
|
+
created_on: string
|
|
211
|
+
type: string
|
|
212
|
+
uuid: string
|
|
213
|
+
has_2fa_enabled: boolean
|
|
214
|
+
username: string
|
|
215
|
+
nickname: string
|
|
216
|
+
is_staff: boolean
|
|
217
|
+
account_id: string
|
|
218
|
+
account_status: LiteralUnion<"active" | "inactive" | "closed">
|
|
219
|
+
location: string | null
|
|
219
220
|
}
|
|
220
221
|
/**
|
|
221
222
|
* Bitbucket OAuth Provider
|
|
@@ -228,58 +229,58 @@ interface BitbucketProfile {
|
|
|
228
229
|
* @see [Bitbucket - Cloud REST API](https://developer.atlassian.com/cloud/bitbucket/rest/intro/)
|
|
229
230
|
* @see [Bitbucket - User Endpoint](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-users/#api-users-endpoint)
|
|
230
231
|
*/
|
|
231
|
-
declare const bitbucket: OAuthProviderConfig<BitbucketProfile
|
|
232
|
+
declare const bitbucket: OAuthProviderConfig<BitbucketProfile>
|
|
232
233
|
|
|
233
234
|
/**
|
|
234
235
|
* @see [Get the authenticated user](https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user)
|
|
235
236
|
*/
|
|
236
237
|
interface GitHubProfile {
|
|
237
|
-
login: string
|
|
238
|
-
id: number
|
|
239
|
-
user_view_type: string
|
|
240
|
-
node_id: string
|
|
241
|
-
avatar_url: string
|
|
242
|
-
gravatar_id: string | null
|
|
243
|
-
url: string
|
|
244
|
-
html_url: string
|
|
245
|
-
followers_url: string
|
|
246
|
-
following_url: string
|
|
247
|
-
gists_url: string
|
|
248
|
-
starred_url: string
|
|
249
|
-
subscriptions_url: string
|
|
250
|
-
organizations_url: string
|
|
251
|
-
repos_url: string
|
|
252
|
-
events_url: string
|
|
253
|
-
received_events_url: string
|
|
254
|
-
type: string
|
|
255
|
-
site_admin: boolean
|
|
256
|
-
name: string | null
|
|
257
|
-
company: string | null
|
|
258
|
-
blog: string | null
|
|
259
|
-
location: string | null
|
|
260
|
-
email: string | null
|
|
261
|
-
notification_email: string | null
|
|
262
|
-
hireable: boolean | null
|
|
263
|
-
bio: string | null
|
|
264
|
-
twitter_username?: string | null
|
|
265
|
-
public_repos: number
|
|
266
|
-
public_gists: number
|
|
267
|
-
followers: number
|
|
268
|
-
following: number
|
|
269
|
-
created_at: string
|
|
270
|
-
updated_at: string
|
|
271
|
-
private_gists?: number
|
|
272
|
-
total_private_repos?: number
|
|
273
|
-
owned_private_repos?: number
|
|
274
|
-
disk_usage?: number
|
|
275
|
-
collaborators?: number
|
|
276
|
-
two_factor_authentication: boolean
|
|
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
|
|
277
278
|
plan?: {
|
|
278
|
-
collaborators: number
|
|
279
|
-
name: string
|
|
280
|
-
space: number
|
|
281
|
-
private_repos: number
|
|
282
|
-
}
|
|
279
|
+
collaborators: number
|
|
280
|
+
name: string
|
|
281
|
+
space: number
|
|
282
|
+
private_repos: number
|
|
283
|
+
}
|
|
283
284
|
}
|
|
284
285
|
/**
|
|
285
286
|
* GitHub OAuth Provider
|
|
@@ -288,17 +289,17 @@ interface GitHubProfile {
|
|
|
288
289
|
* @see [GitHub - Configure your GitHub OAuth Apps](https://github.com/settings/developers)
|
|
289
290
|
* @see [Github - Get the authenticated user](https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user)
|
|
290
291
|
*/
|
|
291
|
-
declare const github: OAuthProviderConfig<GitHubProfile
|
|
292
|
+
declare const github: OAuthProviderConfig<GitHubProfile>
|
|
292
293
|
|
|
293
294
|
declare const builtInOAuthProviders: {
|
|
294
|
-
github: OAuthProviderConfig<GitHubProfile
|
|
295
|
-
bitbucket: OAuthProviderConfig<BitbucketProfile
|
|
296
|
-
figma: OAuthProviderConfig<FigmaProfile
|
|
297
|
-
discord: OAuthProviderConfig<DiscordProfile
|
|
298
|
-
gitlab: OAuthProviderConfig<GitLabProfile
|
|
299
|
-
spotify: OAuthProviderConfig<SpotifyProfile
|
|
300
|
-
x: OAuthProviderConfig<XProfile
|
|
301
|
-
}
|
|
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
|
+
}
|
|
302
303
|
/**
|
|
303
304
|
* Constructs OAuth provider configurations from an array of provider names or configurations.
|
|
304
305
|
* It loads the client ID and client secret from environment variables if only the provider name is provided.
|
|
@@ -306,106 +307,110 @@ declare const builtInOAuthProviders: {
|
|
|
306
307
|
* @param oauth - Array of OAuth provider configurations or provider names to be defined from environment variables
|
|
307
308
|
* @returns A record of OAuth provider configurations
|
|
308
309
|
*/
|
|
309
|
-
declare const createBuiltInOAuthProviders: (
|
|
310
|
-
|
|
310
|
+
declare const createBuiltInOAuthProviders: (
|
|
311
|
+
oauth?: (BuiltInOAuthProvider | OAuthProviderCredentials)[]
|
|
312
|
+
) => Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>
|
|
313
|
+
type BuiltInOAuthProvider = keyof typeof builtInOAuthProviders
|
|
311
314
|
|
|
312
315
|
/**
|
|
313
316
|
* Standard JWT claims that are managed internally by the token system.
|
|
314
317
|
* These fields are typically filtered out before returning user data.
|
|
315
318
|
*/
|
|
316
|
-
type JWTStandardClaims = Pick<JWTPayload, "exp" | "iat" | "jti" | "nbf" | "sub" | "aud" | "iss"
|
|
319
|
+
type JWTStandardClaims = Pick<JWTPayload, "exp" | "iat" | "jti" | "nbf" | "sub" | "aud" | "iss">
|
|
317
320
|
/**
|
|
318
321
|
* Standardized user profile returned by OAuth providers after fetching user information
|
|
319
322
|
* and mapping the response to this format by default or via the `profile` custom function.
|
|
320
323
|
*/
|
|
321
324
|
interface User {
|
|
322
|
-
sub: string
|
|
323
|
-
name?: string
|
|
324
|
-
email?: string
|
|
325
|
-
image?: string
|
|
325
|
+
sub: string
|
|
326
|
+
name?: string
|
|
327
|
+
email?: string
|
|
328
|
+
image?: string
|
|
326
329
|
}
|
|
327
330
|
/**
|
|
328
331
|
* Session data returned by the session endpoint.
|
|
329
332
|
*/
|
|
330
333
|
interface Session {
|
|
331
|
-
user: User
|
|
332
|
-
expires: string
|
|
334
|
+
user: User
|
|
335
|
+
expires: string
|
|
333
336
|
}
|
|
334
337
|
/**
|
|
335
338
|
* Configuration for an OAuth provider without credentials.
|
|
336
339
|
* Use this type when defining provider metadata and endpoints.
|
|
337
340
|
*/
|
|
338
341
|
interface OAuthProviderConfig<Profile extends object = {}> {
|
|
339
|
-
id: string
|
|
340
|
-
name: string
|
|
341
|
-
authorizeURL: string
|
|
342
|
-
accessToken: string
|
|
343
|
-
userInfo: string
|
|
344
|
-
scope: string
|
|
345
|
-
responseType: string
|
|
346
|
-
profile?: (profile: Profile) => User | Promise<User
|
|
342
|
+
id: string
|
|
343
|
+
name: string
|
|
344
|
+
authorizeURL: string
|
|
345
|
+
accessToken: string
|
|
346
|
+
userInfo: string
|
|
347
|
+
scope: string
|
|
348
|
+
responseType: string
|
|
349
|
+
profile?: (profile: Profile) => User | Promise<User>
|
|
347
350
|
}
|
|
348
351
|
/**
|
|
349
352
|
* OAuth provider configuration with client credentials.
|
|
350
353
|
* Extends OAuthProviderConfig with clientId and clientSecret.
|
|
351
354
|
*/
|
|
352
355
|
interface OAuthProviderCredentials extends OAuthProviderConfig {
|
|
353
|
-
clientId: string
|
|
354
|
-
clientSecret: string
|
|
356
|
+
clientId: string
|
|
357
|
+
clientSecret: string
|
|
355
358
|
}
|
|
356
359
|
/**
|
|
357
360
|
* Complete OAuth provider type combining configuration and credentials.
|
|
358
361
|
*/
|
|
359
|
-
type OAuthProvider<Profile extends Record<string, unknown> = {}> = OAuthProviderConfig<Profile> & OAuthProviderCredentials
|
|
362
|
+
type OAuthProvider<Profile extends Record<string, unknown> = {}> = OAuthProviderConfig<Profile> & OAuthProviderCredentials
|
|
360
363
|
/**
|
|
361
364
|
* Cookie type with __Secure- prefix, must be Secure.
|
|
362
365
|
* @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__secure-prefix
|
|
363
366
|
*/
|
|
364
367
|
type SecureCookie = {
|
|
365
|
-
strategy: "secure"
|
|
368
|
+
strategy: "secure"
|
|
366
369
|
} & {
|
|
367
|
-
options?: Prettify<Omit<SerializeOptions, "secure" | "encode"
|
|
368
|
-
}
|
|
370
|
+
options?: Prettify<Omit<SerializeOptions, "secure" | "encode">>
|
|
371
|
+
}
|
|
369
372
|
/**
|
|
370
373
|
* Cookie type with __Host- prefix, must be Secure, Path=/, no Domain attribute.
|
|
371
374
|
* @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__host-prefix
|
|
372
375
|
*/
|
|
373
376
|
type HostCookie = {
|
|
374
|
-
strategy: "host"
|
|
377
|
+
strategy: "host"
|
|
375
378
|
} & {
|
|
376
|
-
options?: Prettify<Omit<SerializeOptions, "secure" | "path" | "domain" | "encode"
|
|
377
|
-
}
|
|
379
|
+
options?: Prettify<Omit<SerializeOptions, "secure" | "path" | "domain" | "encode">>
|
|
380
|
+
}
|
|
378
381
|
/**
|
|
379
382
|
* Standard cookie type without security prefixes.
|
|
380
383
|
* Can be sent over both HTTP and HTTPS connections (default in development).
|
|
381
384
|
*/
|
|
382
385
|
type StandardCookie = {
|
|
383
|
-
strategy?: "standard"
|
|
386
|
+
strategy?: "standard"
|
|
384
387
|
} & {
|
|
385
|
-
options?: Prettify<Omit<SerializeOptions, "encode"
|
|
386
|
-
}
|
|
388
|
+
options?: Prettify<Omit<SerializeOptions, "encode">>
|
|
389
|
+
}
|
|
387
390
|
/**
|
|
388
391
|
* Union type for cookie options based on the specified strategy.
|
|
389
392
|
* - `secure`: Cookies are only sent over HTTPS connections
|
|
390
393
|
* - `host`: Cookies use the __Host- prefix and are only sent over HTTPS connections
|
|
391
394
|
* - `standard`: Cookies can be sent over both HTTP and HTTPS connections (default in development)
|
|
392
395
|
*/
|
|
393
|
-
type CookieStrategyOptions = StandardCookie | SecureCookie | HostCookie
|
|
396
|
+
type CookieStrategyOptions = StandardCookie | SecureCookie | HostCookie
|
|
394
397
|
/**
|
|
395
398
|
* Configuration options for cookies used in Aura Auth.
|
|
396
399
|
* @see {@link AuthConfig.cookies}
|
|
397
400
|
*/
|
|
398
|
-
type CookieConfig = Prettify<
|
|
399
|
-
|
|
400
|
-
|
|
401
|
+
type CookieConfig = Prettify<
|
|
402
|
+
{
|
|
403
|
+
name?: string
|
|
404
|
+
} & CookieStrategyOptions
|
|
405
|
+
>
|
|
401
406
|
/**
|
|
402
407
|
* Internal representation of cookie configuration with all options resolved.
|
|
403
408
|
* @internal
|
|
404
409
|
*/
|
|
405
410
|
type CookieConfigInternal = {
|
|
406
|
-
name?: string
|
|
407
|
-
prefix?: string
|
|
408
|
-
} & SerializeOptions
|
|
411
|
+
name?: string
|
|
412
|
+
prefix?: string
|
|
413
|
+
} & SerializeOptions
|
|
409
414
|
/**
|
|
410
415
|
* Names of cookies used by Aura Auth for session management and OAuth flows.
|
|
411
416
|
* - `sessionToken`: User session JWT
|
|
@@ -416,7 +421,7 @@ type CookieConfigInternal = {
|
|
|
416
421
|
* - `redirect_to`: Post-authentication redirect path
|
|
417
422
|
* - `nonce`: OpenID Connect nonce parameter
|
|
418
423
|
*/
|
|
419
|
-
type CookieName = "sessionToken" | "csrfToken" | "state" | "nonce" | "code_verifier" | "redirect_to" | "redirect_uri"
|
|
424
|
+
type CookieName = "sessionToken" | "csrfToken" | "state" | "nonce" | "code_verifier" | "redirect_to" | "redirect_uri"
|
|
420
425
|
/**
|
|
421
426
|
* Main configuration interface for Aura Auth.
|
|
422
427
|
* This is the user-facing configuration object passed to `createAuth()`.
|
|
@@ -445,7 +450,7 @@ interface AuthConfig {
|
|
|
445
450
|
* }
|
|
446
451
|
* ]
|
|
447
452
|
*/
|
|
448
|
-
oauth: (BuiltInOAuthProvider | OAuthProviderCredentials)[]
|
|
453
|
+
oauth: (BuiltInOAuthProvider | OAuthProviderCredentials)[]
|
|
449
454
|
/**
|
|
450
455
|
* Cookie options defines the configuration for cookies used in Aura Auth.
|
|
451
456
|
* It includes a prefix for cookie names and flag options to determine
|
|
@@ -464,17 +469,17 @@ interface AuthConfig {
|
|
|
464
469
|
* @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__secure-prefix
|
|
465
470
|
* @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__host-prefix
|
|
466
471
|
*/
|
|
467
|
-
cookies?: CookieConfig
|
|
472
|
+
cookies?: CookieConfig
|
|
468
473
|
/**
|
|
469
474
|
* Secret used to sign and verify JWT tokens for session and csrf protection.
|
|
470
475
|
* If not provided, it will load from the environment variable `AURA_AUTH_SECRET`, but if it
|
|
471
476
|
* doesn't exist, it will throw an error during the initialization of the Auth module.
|
|
472
477
|
*/
|
|
473
|
-
secret?: string
|
|
478
|
+
secret?: string
|
|
474
479
|
/**
|
|
475
480
|
* Base path for all authentication routes. Default is `/auth`.
|
|
476
481
|
*/
|
|
477
|
-
basePath?:
|
|
482
|
+
basePath?: `/${string}`
|
|
478
483
|
/**
|
|
479
484
|
* Enable trusted proxy headers for scenarios where the application is behind a reverse proxy or load balancer.
|
|
480
485
|
* This setting allows Aura Auth to correctly interpret headers like `X-Forwarded-For` and `X-Forwarded-Proto`
|
|
@@ -489,49 +494,104 @@ interface AuthConfig {
|
|
|
489
494
|
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded
|
|
490
495
|
* @experimental
|
|
491
496
|
*/
|
|
492
|
-
trustedProxyHeaders?: boolean
|
|
497
|
+
trustedProxyHeaders?: boolean
|
|
498
|
+
}
|
|
499
|
+
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>
|
|
493
504
|
}
|
|
494
|
-
type JoseInstance = ReturnType<typeof createJoseInstance>;
|
|
495
505
|
/**
|
|
496
506
|
* Internal runtime configuration used within Aura Auth after initialization.
|
|
497
507
|
* All optional fields from AuthConfig are resolved to their default values.
|
|
498
508
|
* @internal
|
|
509
|
+
* @todo: is this needed?
|
|
499
510
|
*/
|
|
500
511
|
interface AuthRuntimeConfig {
|
|
501
|
-
oauth: Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials
|
|
502
|
-
cookies: CookieConfig
|
|
503
|
-
secret: string
|
|
504
|
-
jose: JoseInstance
|
|
512
|
+
oauth: Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>
|
|
513
|
+
cookies: CookieConfig
|
|
514
|
+
secret: string
|
|
515
|
+
jose: JoseInstance
|
|
505
516
|
}
|
|
506
517
|
interface RouterGlobalContext {
|
|
507
|
-
oauth: Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
trustedProxyHeaders: boolean
|
|
518
|
+
oauth: Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>
|
|
519
|
+
cookies: CookieConfigInternal
|
|
520
|
+
jose: JoseInstance
|
|
521
|
+
basePath: string
|
|
522
|
+
trustedProxyHeaders: boolean
|
|
523
|
+
}
|
|
524
|
+
interface AuthInstance {
|
|
525
|
+
handlers: {
|
|
526
|
+
GET: (request: Request) => Response | Promise<Response>
|
|
527
|
+
POST: (request: Request) => Response | Promise<Response>
|
|
528
|
+
}
|
|
529
|
+
jose: JoseInstance
|
|
512
530
|
}
|
|
513
531
|
/**
|
|
514
532
|
* Base OAuth error response structure.
|
|
515
533
|
*/
|
|
516
534
|
interface OAuthError<T extends string> {
|
|
517
|
-
error: T
|
|
518
|
-
error_description?: string
|
|
535
|
+
error: T
|
|
536
|
+
error_description?: string
|
|
519
537
|
}
|
|
520
538
|
/**
|
|
521
539
|
* OAuth 2.0 Authorization Error Response Types
|
|
522
540
|
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1
|
|
523
541
|
*/
|
|
524
|
-
type AuthorizationError = OAuthError<z.infer<typeof OAuthAuthorizationErrorResponse>["error"]
|
|
542
|
+
type AuthorizationError = OAuthError<z.infer<typeof OAuthAuthorizationErrorResponse>["error"]>
|
|
525
543
|
/**
|
|
526
544
|
* OAuth 2.0 Access Token Error Response Types
|
|
527
545
|
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-5.2
|
|
528
546
|
*/
|
|
529
|
-
type AccessTokenError = OAuthError<z.infer<typeof OAuthAccessTokenErrorResponse>["error"]
|
|
547
|
+
type AccessTokenError = OAuthError<z.infer<typeof OAuthAccessTokenErrorResponse>["error"]>
|
|
530
548
|
/**
|
|
531
549
|
* OAuth 2.0 Token Revocation Error Response Types
|
|
532
550
|
* @see https://datatracker.ietf.org/doc/html/rfc7009#section-2.2.1
|
|
533
551
|
*/
|
|
534
|
-
type TokenRevocationError = OAuthError<"invalid_session_token" | "invalid_csrf_token" | "invalid_redirect_to"
|
|
535
|
-
type ErrorType = AuthorizationError["error"] | AccessTokenError["error"] | TokenRevocationError["error"]
|
|
552
|
+
type TokenRevocationError = OAuthError<"invalid_session_token" | "invalid_csrf_token" | "invalid_redirect_to">
|
|
553
|
+
type ErrorType = AuthorizationError["error"] | AccessTokenError["error"] | TokenRevocationError["error"]
|
|
536
554
|
|
|
537
|
-
export {
|
|
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
|
+
}
|