@aura-stack/auth 0.1.0-rc.9 → 0.2.0-rc.1
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 +7 -31
- package/dist/@types/index.js +1 -1
- package/dist/@types/router.d.cjs +1 -1
- package/dist/@types/router.d.d.ts +7 -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 +176 -155
- package/dist/actions/callback/access-token.d.ts +15 -20
- package/dist/actions/callback/access-token.js +10 -4
- package/dist/actions/callback/callback.cjs +394 -490
- package/dist/actions/callback/callback.d.ts +10 -12
- package/dist/actions/callback/callback.js +16 -12
- package/dist/actions/callback/userinfo.cjs +166 -145
- package/dist/actions/callback/userinfo.d.ts +9 -9
- package/dist/actions/callback/userinfo.js +12 -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 +652 -814
- package/dist/actions/index.d.ts +13 -13
- package/dist/actions/index.js +34 -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 +254 -263
- package/dist/actions/signIn/authorization.d.ts +12 -18
- package/dist/actions/signIn/authorization.js +16 -6
- package/dist/actions/signIn/signIn.cjs +320 -456
- package/dist/actions/signIn/signIn.d.ts +10 -10
- package/dist/actions/signIn/signIn.js +13 -10
- package/dist/actions/signOut/signOut.cjs +304 -473
- 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 +13 -4
- package/dist/assert.js +12 -2
- package/dist/chunk-3EUWD5BB.js +63 -0
- package/dist/chunk-42XB3YCW.js +19 -17
- package/dist/chunk-6R2YZ4AC.js +22 -0
- package/dist/chunk-A3N4PVAT.js +70 -0
- package/dist/chunk-B737EUJV.js +22 -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-EMKJA2GJ.js +89 -0
- package/dist/chunk-FIPU4MLT.js +18 -16
- package/dist/chunk-FKRDCWBF.js +19 -17
- package/dist/chunk-GA2SMTJO.js +58 -0
- package/dist/chunk-HP34YGGJ.js +22 -0
- package/dist/chunk-HT4YLL7N.js +35 -0
- package/dist/chunk-IKHPGFCW.js +11 -9
- package/dist/chunk-IUYZQTJV.js +30 -0
- package/dist/chunk-IVET23KF.js +58 -0
- package/dist/chunk-JVFTCTTE.js +33 -0
- package/dist/chunk-KRNOMBXQ.js +19 -17
- package/dist/chunk-KSWLO5ZU.js +102 -0
- package/dist/chunk-N2APGLXA.js +71 -0
- package/dist/chunk-N4SX7TZT.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-W6LG7BFW.js +197 -0
- package/dist/chunk-YRCB5FLE.js +79 -0
- package/dist/chunk-ZNCZVF6U.js +14 -0
- package/dist/cookie.cjs +222 -187
- package/dist/cookie.d.ts +39 -76
- package/dist/cookie.js +27 -34
- package/dist/errors.cjs +85 -0
- package/dist/errors.d.ts +49 -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-DkaLJFn8.d.ts +679 -0
- package/dist/index.cjs +1074 -1007
- package/dist/index.d.ts +10 -31
- package/dist/index.js +85 -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 +7 -7
- package/dist/oauth/bitbucket.js +6 -2
- package/dist/oauth/discord.cjs +47 -48
- package/dist/oauth/discord.d.ts +7 -7
- package/dist/oauth/discord.js +6 -2
- package/dist/oauth/figma.cjs +39 -39
- package/dist/oauth/figma.d.ts +7 -7
- package/dist/oauth/figma.js +6 -2
- package/dist/oauth/github.cjs +31 -31
- package/dist/oauth/github.d.ts +7 -7
- package/dist/oauth/github.js +6 -2
- package/dist/oauth/gitlab.cjs +39 -39
- package/dist/oauth/gitlab.d.ts +7 -7
- package/dist/oauth/gitlab.js +6 -2
- package/dist/oauth/index.cjs +350 -180
- package/dist/oauth/index.d.ts +7 -26
- package/dist/oauth/index.js +51 -9
- package/dist/oauth/mailchimp.cjs +46 -0
- package/dist/oauth/mailchimp.d.ts +7 -0
- package/dist/oauth/mailchimp.js +6 -0
- package/dist/oauth/pinterest.cjs +46 -0
- package/dist/oauth/pinterest.d.ts +7 -0
- package/dist/oauth/pinterest.js +6 -0
- package/dist/oauth/spotify.cjs +39 -39
- package/dist/oauth/spotify.d.ts +7 -7
- package/dist/oauth/spotify.js +6 -2
- package/dist/oauth/strava.cjs +46 -0
- package/dist/oauth/strava.d.ts +7 -0
- package/dist/oauth/strava.js +6 -0
- package/dist/oauth/x.cjs +39 -39
- package/dist/oauth/x.d.ts +7 -7
- package/dist/oauth/x.js +6 -2
- package/dist/request.cjs +38 -0
- package/dist/request.d.ts +13 -0
- package/dist/request.js +6 -0
- package/dist/schemas.cjs +103 -97
- package/dist/schemas.d.ts +96 -126
- package/dist/schemas.js +20 -18
- package/dist/secure.cjs +106 -101
- package/dist/secure.d.ts +17 -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 +8 -7
- 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/index-DpfbvTZ_.d.ts +0 -597
- package/dist/response.cjs +0 -34
- package/dist/response.d.ts +0 -10
- package/dist/response.js +0 -2
package/dist/index-DpfbvTZ_.d.ts
DELETED
|
@@ -1,597 +0,0 @@
|
|
|
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"
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @see [X - Get my User](https://docs.x.com/x-api/users/get-my-user)
|
|
9
|
-
*/
|
|
10
|
-
interface XProfile {
|
|
11
|
-
data: {
|
|
12
|
-
id: string
|
|
13
|
-
name: string
|
|
14
|
-
username: string
|
|
15
|
-
profile_image_url: string
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* @see [X - Developer Portal](https://developer.x.com/en/portal/projects-and-apps)
|
|
20
|
-
* @see [X - Get my User](https://docs.x.com/x-api/users/get-my-user)
|
|
21
|
-
* @see [X - OAuth 2.0 Authorization Code Flow with PKCE](https://docs.x.com/fundamentals/authentication/oauth-2-0/authorization-code)
|
|
22
|
-
* @see [X - OAuth 2.0 Scopes](https://docs.x.com/fundamentals/authentication/oauth-2-0/authorization-code#scopes)
|
|
23
|
-
* @see [X - OAuth 2.0 Bearer Token](https://docs.x.com/fundamentals/authentication/oauth-2-0/application-only)
|
|
24
|
-
*/
|
|
25
|
-
declare const x: OAuthProviderConfig<XProfile>
|
|
26
|
-
|
|
27
|
-
interface Image {
|
|
28
|
-
url: string
|
|
29
|
-
height: number
|
|
30
|
-
width: number
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* @see [Spotify - User Object](https://developer.spotify.com/documentation/web-api/reference/object-model/#user-object-private)
|
|
34
|
-
*/
|
|
35
|
-
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
|
|
45
|
-
explicit_content: {
|
|
46
|
-
filter_enabled: boolean
|
|
47
|
-
filter_locked: boolean
|
|
48
|
-
}
|
|
49
|
-
external_urls: {
|
|
50
|
-
spotify: string
|
|
51
|
-
}
|
|
52
|
-
followers: {
|
|
53
|
-
href: string
|
|
54
|
-
total: number
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* @see [Spotify - Spotify Developer Dashboard](https://developer.spotify.com/dashboard)
|
|
59
|
-
* @see [Spotify - Getting started with Web API](https://developer.spotify.com/documentation/web-api/tutorials/getting-started)
|
|
60
|
-
* @see [Spotify - Get Current User's Profile](https://developer.spotify.com/documentation/web-api/reference/get-current-users-profile)
|
|
61
|
-
* @see [Spotify - Scopes](https://developer.spotify.com/documentation/web-api/concepts/scopes)
|
|
62
|
-
* @see [Spotify - Redirect URIs](https://developer.spotify.com/documentation/web-api/concepts/redirect_uri)
|
|
63
|
-
*/
|
|
64
|
-
declare const spotify: OAuthProviderConfig<SpotifyProfile>
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* @see [GitLab - Get the current user](https://docs.gitlab.com/api/users/#get-the-current-user)
|
|
68
|
-
*/
|
|
69
|
-
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
|
|
102
|
-
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[]
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* @see [GitLab - Applications](https://gitlab.com/-/user_settings/applications)
|
|
120
|
-
* @see [GitLab - OAuth 2.0 identify provider API](https://docs.gitlab.com/api/oauth2/)
|
|
121
|
-
* @see [GitLab - Scopes](https://docs.gitlab.com/integration/oauth_provider/#view-all-authorized-applications)
|
|
122
|
-
* @see [GitLab - Get current user](https://docs.gitlab.com/api/users/#get-the-current-user)
|
|
123
|
-
*/
|
|
124
|
-
declare const gitlab: OAuthProviderConfig<GitLabProfile>
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* @see [Discord - Nameplate Object](https://discord.com/developers/docs/resources/user#nameplate-nameplate-structure)
|
|
128
|
-
*/
|
|
129
|
-
interface Nameplate {
|
|
130
|
-
sku_id: string
|
|
131
|
-
asset: string
|
|
132
|
-
label: string
|
|
133
|
-
palette: string
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* The `snowflake` type is a string type. The attributes defined with this type are:
|
|
137
|
-
* - `id`: The unique identifier for the object.
|
|
138
|
-
* - `primary_guild.identity_guild_id`: The unique identifier for the guild.
|
|
139
|
-
* - `avatar_decoration_data.sku_id`: The unique identifier for the SKU.
|
|
140
|
-
*
|
|
141
|
-
* @see [Discord - User Object](https://discord.com/developers/docs/resources/user#user-object)
|
|
142
|
-
*/
|
|
143
|
-
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
|
|
160
|
-
avatar_decoration_data?: {
|
|
161
|
-
asset: string
|
|
162
|
-
sku_id: string
|
|
163
|
-
}
|
|
164
|
-
collections?: Record<string, Nameplate>
|
|
165
|
-
primary_guild?: {
|
|
166
|
-
identity_guild_id: string
|
|
167
|
-
identity_enabled: boolean | null
|
|
168
|
-
tag: string | null
|
|
169
|
-
badge: string | null
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* @see [Discord - Applications](https://discord.com/developers/applications)
|
|
174
|
-
* @see [Discord - OAuth2](https://discord.com/developers/docs/topics/oauth2)
|
|
175
|
-
* @see [Discord - Get Current User](https://discord.com/developers/docs/resources/user#get-current-user)
|
|
176
|
-
* @see [Discord - User Object](https://discord.com/developers/docs/resources/user#user-object)
|
|
177
|
-
* @see [Discord - OAuth2 Scopes](https://discord.com/developers/docs/topics/oauth2#shared-resources-oauth2-scopes)
|
|
178
|
-
* @see [Discord - Image Formatting](https://discord.com/developers/docs/reference#image-formatting)
|
|
179
|
-
*/
|
|
180
|
-
declare const discord: OAuthProviderConfig<DiscordProfile>
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* @see [Figma API - Users](https://developers.figma.com/docs/rest-api/users-types/)
|
|
184
|
-
*/
|
|
185
|
-
interface FigmaProfile {
|
|
186
|
-
id: string
|
|
187
|
-
handle: string
|
|
188
|
-
img_url: string
|
|
189
|
-
email: string
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* @see [Figma - REST API Introduction](https://developers.figma.com/docs/rest-api/)
|
|
193
|
-
* @see [Figma - OAuth App](https://www.figma.com/developers/apps/)
|
|
194
|
-
* @see [Figma - Create an OAuth App](https://developers.figma.com/docs/rest-api/authentication/#create-an-oauth-app)
|
|
195
|
-
* @see [Figma - OAuth Scopes](https://developers.figma.com/docs/rest-api/scopes/)
|
|
196
|
-
*/
|
|
197
|
-
declare const figma: OAuthProviderConfig<FigmaProfile>
|
|
198
|
-
|
|
199
|
-
/**
|
|
200
|
-
* @see [Get current user](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-users/#api-user-get)
|
|
201
|
-
*/
|
|
202
|
-
interface BitbucketProfile {
|
|
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
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Bitbucket OAuth Provider
|
|
223
|
-
*
|
|
224
|
-
* @see [Bitbucket - Official App](https://bitbucket.org/)
|
|
225
|
-
* @see [Bitbucket - Workspaces](https://bitbucket.org/account/workspaces/)
|
|
226
|
-
* @see [Bitbucket - Workspace Settings](https://bitbucket.org/{workspace-name}/workspace/settings/)
|
|
227
|
-
* @see [Bitbucket - OAuth 2.0](https://developer.atlassian.com/cloud/bitbucket/oauth-2/)
|
|
228
|
-
* @see [Bitbucket - Use OAuth on Bitbucket Cloud](https://support.atlassian.com/bitbucket-cloud/docs/use-oauth-on-bitbucket-cloud/)
|
|
229
|
-
* @see [Bitbucket - Cloud REST API](https://developer.atlassian.com/cloud/bitbucket/rest/intro/)
|
|
230
|
-
* @see [Bitbucket - User Endpoint](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-users/#api-users-endpoint)
|
|
231
|
-
*/
|
|
232
|
-
declare const bitbucket: OAuthProviderConfig<BitbucketProfile>
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* @see [Get the authenticated user](https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user)
|
|
236
|
-
*/
|
|
237
|
-
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
|
|
278
|
-
plan?: {
|
|
279
|
-
collaborators: number
|
|
280
|
-
name: string
|
|
281
|
-
space: number
|
|
282
|
-
private_repos: number
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* GitHub OAuth Provider
|
|
287
|
-
* @see [GitHub - Creating an OAuth App](https://docs.github.com/en/developers/apps/building-oauth-apps/creating-an-oauth-app)
|
|
288
|
-
* @see [GitHub - Authorizing OAuth Apps](https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps)
|
|
289
|
-
* @see [GitHub - Configure your GitHub OAuth Apps](https://github.com/settings/developers)
|
|
290
|
-
* @see [Github - Get the authenticated user](https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user)
|
|
291
|
-
*/
|
|
292
|
-
declare const github: OAuthProviderConfig<GitHubProfile>
|
|
293
|
-
|
|
294
|
-
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
|
-
}
|
|
303
|
-
/**
|
|
304
|
-
* Constructs OAuth provider configurations from an array of provider names or configurations.
|
|
305
|
-
* It loads the client ID and client secret from environment variables if only the provider name is provided.
|
|
306
|
-
*
|
|
307
|
-
* @param oauth - Array of OAuth provider configurations or provider names to be defined from environment variables
|
|
308
|
-
* @returns A record of OAuth provider configurations
|
|
309
|
-
*/
|
|
310
|
-
declare const createBuiltInOAuthProviders: (
|
|
311
|
-
oauth?: (BuiltInOAuthProvider | OAuthProviderCredentials)[]
|
|
312
|
-
) => Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>
|
|
313
|
-
type BuiltInOAuthProvider = keyof typeof builtInOAuthProviders
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
* Standard JWT claims that are managed internally by the token system.
|
|
317
|
-
* These fields are typically filtered out before returning user data.
|
|
318
|
-
*/
|
|
319
|
-
type JWTStandardClaims = Pick<JWTPayload, "exp" | "iat" | "jti" | "nbf" | "sub" | "aud" | "iss">
|
|
320
|
-
/**
|
|
321
|
-
* Standardized user profile returned by OAuth providers after fetching user information
|
|
322
|
-
* and mapping the response to this format by default or via the `profile` custom function.
|
|
323
|
-
*/
|
|
324
|
-
interface User {
|
|
325
|
-
sub: string
|
|
326
|
-
name?: string
|
|
327
|
-
email?: string
|
|
328
|
-
image?: string
|
|
329
|
-
}
|
|
330
|
-
/**
|
|
331
|
-
* Session data returned by the session endpoint.
|
|
332
|
-
*/
|
|
333
|
-
interface Session {
|
|
334
|
-
user: User
|
|
335
|
-
expires: string
|
|
336
|
-
}
|
|
337
|
-
/**
|
|
338
|
-
* Configuration for an OAuth provider without credentials.
|
|
339
|
-
* Use this type when defining provider metadata and endpoints.
|
|
340
|
-
*/
|
|
341
|
-
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: string
|
|
349
|
-
profile?: (profile: Profile) => User | Promise<User>
|
|
350
|
-
}
|
|
351
|
-
/**
|
|
352
|
-
* OAuth provider configuration with client credentials.
|
|
353
|
-
* Extends OAuthProviderConfig with clientId and clientSecret.
|
|
354
|
-
*/
|
|
355
|
-
interface OAuthProviderCredentials extends OAuthProviderConfig {
|
|
356
|
-
clientId: string
|
|
357
|
-
clientSecret: string
|
|
358
|
-
}
|
|
359
|
-
/**
|
|
360
|
-
* Complete OAuth provider type combining configuration and credentials.
|
|
361
|
-
*/
|
|
362
|
-
type OAuthProvider<Profile extends Record<string, unknown> = {}> = OAuthProviderConfig<Profile> & OAuthProviderCredentials
|
|
363
|
-
/**
|
|
364
|
-
* Cookie type with __Secure- prefix, must be Secure.
|
|
365
|
-
* @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__secure-prefix
|
|
366
|
-
*/
|
|
367
|
-
type SecureCookie = {
|
|
368
|
-
strategy: "secure"
|
|
369
|
-
} & {
|
|
370
|
-
options?: Prettify<Omit<SerializeOptions, "secure" | "encode">>
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Cookie type with __Host- prefix, must be Secure, Path=/, no Domain attribute.
|
|
374
|
-
* @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__host-prefix
|
|
375
|
-
*/
|
|
376
|
-
type HostCookie = {
|
|
377
|
-
strategy: "host"
|
|
378
|
-
} & {
|
|
379
|
-
options?: Prettify<Omit<SerializeOptions, "secure" | "path" | "domain" | "encode">>
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* Standard cookie type without security prefixes.
|
|
383
|
-
* Can be sent over both HTTP and HTTPS connections (default in development).
|
|
384
|
-
*/
|
|
385
|
-
type StandardCookie = {
|
|
386
|
-
strategy?: "standard"
|
|
387
|
-
} & {
|
|
388
|
-
options?: Prettify<Omit<SerializeOptions, "encode">>
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Union type for cookie options based on the specified strategy.
|
|
392
|
-
* - `secure`: Cookies are only sent over HTTPS connections
|
|
393
|
-
* - `host`: Cookies use the __Host- prefix and are only sent over HTTPS connections
|
|
394
|
-
* - `standard`: Cookies can be sent over both HTTP and HTTPS connections (default in development)
|
|
395
|
-
*/
|
|
396
|
-
type CookieStrategyOptions = StandardCookie | SecureCookie | HostCookie
|
|
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
|
|
414
|
-
/**
|
|
415
|
-
* Names of cookies used by Aura Auth for session management and OAuth flows.
|
|
416
|
-
* - `sessionToken`: User session JWT
|
|
417
|
-
* - `csrfToken`: CSRF protection token
|
|
418
|
-
* - `state`: OAuth state parameter for CSRF protection
|
|
419
|
-
* - `code_verifier`: PKCE code verifier for authorization code flow
|
|
420
|
-
* - `redirect_uri`: OAuth callback URI
|
|
421
|
-
* - `redirect_to`: Post-authentication redirect path
|
|
422
|
-
* - `nonce`: OpenID Connect nonce parameter
|
|
423
|
-
*/
|
|
424
|
-
type CookieName = "sessionToken" | "csrfToken" | "state" | "nonce" | "code_verifier" | "redirect_to" | "redirect_uri"
|
|
425
|
-
/**
|
|
426
|
-
* Main configuration interface for Aura Auth.
|
|
427
|
-
* This is the user-facing configuration object passed to `createAuth()`.
|
|
428
|
-
*/
|
|
429
|
-
interface AuthConfig {
|
|
430
|
-
/**
|
|
431
|
-
* OAuth providers available in the authentication and authorization flows. It provides a type-inference
|
|
432
|
-
* for the OAuth providers that are supported by Aura Stack Auth; alternatively, you can provide a custom
|
|
433
|
-
* OAuth third-party authorization service by implementing the `OAuthProviderCredentials` interface.
|
|
434
|
-
*
|
|
435
|
-
* Built-in OAuth providers:
|
|
436
|
-
* oauth: ["github", "google"]
|
|
437
|
-
*
|
|
438
|
-
* Custom OAuth providers:
|
|
439
|
-
* oauth: [
|
|
440
|
-
* {
|
|
441
|
-
* id: "oauth-providers",
|
|
442
|
-
* name: "OAuth",
|
|
443
|
-
* authorizeURL: "https://example.com/oauth/authorize",
|
|
444
|
-
* accessToken: "https://example.com/oauth/token",
|
|
445
|
-
* scope: "profile email",
|
|
446
|
-
* responseType: "code",
|
|
447
|
-
* userInfo: "https://example.com/oauth/userinfo",
|
|
448
|
-
* clientId: process.env.AURA_AUTH_OAUTH_PROVIDER_CLIENT_ID!,
|
|
449
|
-
* clientSecret: process.env.AURA_AUTH_OAUTH_PROVIDER_CLIENT_SECRET!,
|
|
450
|
-
* }
|
|
451
|
-
* ]
|
|
452
|
-
*/
|
|
453
|
-
oauth: (BuiltInOAuthProvider | OAuthProviderCredentials)[]
|
|
454
|
-
/**
|
|
455
|
-
* Cookie options defines the configuration for cookies used in Aura Auth.
|
|
456
|
-
* It includes a prefix for cookie names and flag options to determine
|
|
457
|
-
* the security and scope of the cookies.
|
|
458
|
-
*
|
|
459
|
-
* **⚠️ WARNING:** Ensure that the cookie options are configured correctly to
|
|
460
|
-
* maintain the security and integrity of the authentication process. `Aura Auth`
|
|
461
|
-
* is not responsible for misconfigured cookies that may lead to security vulnerabilities.
|
|
462
|
-
*
|
|
463
|
-
* - prefix: A string prefix to be added to all cookie names, by default "aura-stack".
|
|
464
|
-
* - flag options (This attributes help to define the security level of the cookies):
|
|
465
|
-
* - secure: Cookies use the __Secure- prefix and are only sent over HTTPS connections.
|
|
466
|
-
* - host: Cookies use the __Host- prefix and are only sent over HTTPS connections.
|
|
467
|
-
* - standard: Cookies can be sent over both HTTP and HTTPS connections. (default in development)
|
|
468
|
-
*
|
|
469
|
-
* @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__secure-prefix
|
|
470
|
-
* @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__host-prefix
|
|
471
|
-
*/
|
|
472
|
-
cookies?: CookieConfig
|
|
473
|
-
/**
|
|
474
|
-
* Secret used to sign and verify JWT tokens for session and csrf protection.
|
|
475
|
-
* If not provided, it will load from the environment variable `AURA_AUTH_SECRET`, but if it
|
|
476
|
-
* doesn't exist, it will throw an error during the initialization of the Auth module.
|
|
477
|
-
*/
|
|
478
|
-
secret?: string
|
|
479
|
-
/**
|
|
480
|
-
* Base path for all authentication routes. Default is `/auth`.
|
|
481
|
-
*/
|
|
482
|
-
basePath?: `/${string}`
|
|
483
|
-
/**
|
|
484
|
-
* Enable trusted proxy headers for scenarios where the application is behind a reverse proxy or load balancer.
|
|
485
|
-
* This setting allows Aura Auth to correctly interpret headers like `X-Forwarded-For` and `X-Forwarded-Proto`
|
|
486
|
-
* to determine the original client IP address and protocol.
|
|
487
|
-
*
|
|
488
|
-
* Default is `false`. Enable this option only if you are certain that your application is behind a trusted proxy.
|
|
489
|
-
* Misconfiguration can lead to security vulnerabilities, such as incorrect handling of secure cookies or
|
|
490
|
-
* inaccurate client IP logging.
|
|
491
|
-
*
|
|
492
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For
|
|
493
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-Proto
|
|
494
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded
|
|
495
|
-
* @experimental
|
|
496
|
-
*/
|
|
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>
|
|
504
|
-
}
|
|
505
|
-
/**
|
|
506
|
-
* Internal runtime configuration used within Aura Auth after initialization.
|
|
507
|
-
* All optional fields from AuthConfig are resolved to their default values.
|
|
508
|
-
* @internal
|
|
509
|
-
* @todo: is this needed?
|
|
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
|
-
}
|
|
524
|
-
interface AuthInstance {
|
|
525
|
-
handlers: {
|
|
526
|
-
GET: (request: Request) => Response | Promise<Response>
|
|
527
|
-
POST: (request: Request) => Response | Promise<Response>
|
|
528
|
-
}
|
|
529
|
-
jose: JoseInstance
|
|
530
|
-
}
|
|
531
|
-
/**
|
|
532
|
-
* Base OAuth error response structure.
|
|
533
|
-
*/
|
|
534
|
-
interface OAuthError<T extends string> {
|
|
535
|
-
error: T
|
|
536
|
-
error_description?: string
|
|
537
|
-
}
|
|
538
|
-
/**
|
|
539
|
-
* OAuth 2.0 Authorization Error Response Types
|
|
540
|
-
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1
|
|
541
|
-
*/
|
|
542
|
-
type AuthorizationError = OAuthError<z.infer<typeof OAuthAuthorizationErrorResponse>["error"]>
|
|
543
|
-
/**
|
|
544
|
-
* OAuth 2.0 Access Token Error Response Types
|
|
545
|
-
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-5.2
|
|
546
|
-
*/
|
|
547
|
-
type AccessTokenError = OAuthError<z.infer<typeof OAuthAccessTokenErrorResponse>["error"]>
|
|
548
|
-
/**
|
|
549
|
-
* OAuth 2.0 Token Revocation Error Response Types
|
|
550
|
-
* @see https://datatracker.ietf.org/doc/html/rfc7009#section-2.2.1
|
|
551
|
-
*/
|
|
552
|
-
type TokenRevocationError = OAuthError<"invalid_session_token" | "invalid_csrf_token" | "invalid_redirect_to">
|
|
553
|
-
type ErrorType = AuthorizationError["error"] | AccessTokenError["error"] | TokenRevocationError["error"]
|
|
554
|
-
|
|
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
|
-
}
|
package/dist/response.cjs
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict"
|
|
2
|
-
var __defProp = Object.defineProperty
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all) __defProp(target, name, { get: all[name], enumerable: true })
|
|
8
|
-
}
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if ((from && typeof from === "object") || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable })
|
|
14
|
-
}
|
|
15
|
-
return to
|
|
16
|
-
}
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod)
|
|
18
|
-
|
|
19
|
-
// src/response.ts
|
|
20
|
-
var response_exports = {}
|
|
21
|
-
__export(response_exports, {
|
|
22
|
-
AuraResponse: () => AuraResponse,
|
|
23
|
-
})
|
|
24
|
-
module.exports = __toCommonJS(response_exports)
|
|
25
|
-
var AuraResponse = class extends Response {
|
|
26
|
-
static json(body, init) {
|
|
27
|
-
return Response.json(body, init)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
31
|
-
0 &&
|
|
32
|
-
(module.exports = {
|
|
33
|
-
AuraResponse,
|
|
34
|
-
})
|
package/dist/response.d.ts
DELETED
package/dist/response.js
DELETED