@aura-stack/auth 0.1.0 → 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.d.ts +3 -4
- package/dist/@types/router.d.d.ts +3 -4
- package/dist/@types/utility.d.ts +1 -5
- package/dist/actions/callback/access-token.cjs +51 -41
- package/dist/actions/callback/access-token.d.ts +3 -4
- package/dist/actions/callback/access-token.js +4 -3
- package/dist/actions/callback/callback.cjs +115 -210
- package/dist/actions/callback/callback.d.ts +3 -4
- package/dist/actions/callback/callback.js +9 -10
- package/dist/actions/callback/userinfo.cjs +35 -22
- package/dist/actions/callback/userinfo.d.ts +3 -4
- package/dist/actions/callback/userinfo.js +6 -5
- package/dist/actions/csrfToken/csrfToken.cjs +34 -103
- package/dist/actions/csrfToken/csrfToken.js +6 -6
- package/dist/actions/index.cjs +234 -391
- package/dist/actions/index.d.ts +3 -4
- package/dist/actions/index.js +16 -17
- package/dist/actions/session/session.cjs +25 -109
- package/dist/actions/session/session.js +4 -5
- package/dist/actions/signIn/authorization.cjs +64 -55
- package/dist/actions/signIn/authorization.d.ts +3 -4
- package/dist/actions/signIn/authorization.js +5 -5
- package/dist/actions/signIn/signIn.cjs +84 -206
- package/dist/actions/signIn/signIn.d.ts +3 -4
- package/dist/actions/signIn/signIn.js +7 -9
- package/dist/actions/signOut/signOut.cjs +88 -234
- package/dist/actions/signOut/signOut.js +8 -9
- package/dist/assert.cjs +5 -0
- package/dist/assert.d.ts +9 -1
- package/dist/assert.js +3 -1
- package/dist/chunk-2RXNXMCZ.js +55 -0
- package/dist/{chunk-UJJ7R56J.js → chunk-4V4JNXVF.js} +13 -10
- package/dist/chunk-6R2YZ4AC.js +22 -0
- package/dist/{chunk-VFTYH33W.js → chunk-7H3OR6UU.js} +29 -9
- package/dist/{chunk-256KIVJL.js → chunk-CXLATHS5.js} +53 -9
- package/dist/{chunk-6SM22VVJ.js → chunk-EIL2FPSS.js} +5 -1
- package/dist/chunk-IMICRJ5U.js +197 -0
- package/dist/{chunk-EBPE35JT.js → chunk-IUYZQTJV.js} +0 -1
- package/dist/{chunk-GZU3RBTB.js → chunk-N2APGLXA.js} +19 -10
- package/dist/chunk-NEVKX6K2.js +70 -0
- package/dist/{chunk-XXJKNKGQ.js → chunk-PTJUYB33.js} +9 -13
- package/dist/chunk-QDO2KSRJ.js +35 -0
- package/dist/{chunk-CAKJT3KS.js → chunk-QEZL7EYN.js} +21 -17
- package/dist/chunk-RRLIF4PQ.js +55 -0
- package/dist/chunk-TLE4PXY3.js +39 -0
- package/dist/chunk-UEH3LVON.js +97 -0
- package/dist/{chunk-HMRKN75I.js → chunk-WD7AUHQ5.js} +12 -7
- package/dist/{chunk-RLT4RFKV.js → chunk-ZLR3LI6X.js} +19 -9
- package/dist/cookie.cjs +140 -99
- package/dist/cookie.d.ts +33 -43
- package/dist/cookie.js +10 -17
- package/dist/errors.cjs +85 -0
- package/dist/errors.d.ts +48 -0
- package/dist/errors.js +18 -0
- package/dist/{index-DpfbvTZ_.d.ts → index-EqsoyjrF.d.ts} +139 -57
- package/dist/index.cjs +427 -389
- package/dist/index.d.ts +4 -5
- package/dist/index.js +37 -26
- package/dist/jose.cjs +23 -12
- package/dist/jose.d.ts +4 -1
- package/dist/jose.js +5 -4
- package/dist/oauth/bitbucket.d.ts +3 -4
- package/dist/oauth/discord.cjs +0 -1
- package/dist/oauth/discord.d.ts +3 -4
- package/dist/oauth/discord.js +1 -1
- package/dist/oauth/figma.d.ts +3 -4
- package/dist/oauth/github.d.ts +3 -4
- package/dist/oauth/gitlab.d.ts +3 -4
- package/dist/oauth/index.cjs +132 -6
- package/dist/oauth/index.d.ts +3 -4
- package/dist/oauth/index.js +12 -5
- package/dist/oauth/spotify.d.ts +3 -4
- package/dist/{response.cjs → oauth/strava.cjs} +21 -9
- package/dist/oauth/strava.d.ts +6 -0
- package/dist/oauth/strava.js +6 -0
- package/dist/oauth/x.d.ts +3 -4
- package/dist/schemas.cjs +11 -5
- package/dist/schemas.d.ts +70 -67
- package/dist/schemas.js +3 -1
- package/dist/secure.cjs +27 -19
- package/dist/secure.d.ts +3 -4
- package/dist/secure.js +4 -3
- package/dist/utils.cjs +90 -15
- package/dist/utils.d.ts +11 -2
- package/dist/utils.js +8 -4
- package/package.json +5 -6
- package/dist/chunk-FJUDBLCP.js +0 -59
- package/dist/chunk-HGJ4TXY4.js +0 -137
- package/dist/chunk-JAPMIE6S.js +0 -10
- package/dist/chunk-LLR722CL.js +0 -96
- package/dist/chunk-SJPDVKUS.js +0 -112
- package/dist/chunk-SMQO5WD7.js +0 -30
- package/dist/chunk-UTDLUEEG.js +0 -31
- package/dist/chunk-ZV4BH47P.js +0 -154
- package/dist/error.cjs +0 -88
- package/dist/error.d.ts +0 -62
- package/dist/error.js +0 -16
- package/dist/response.d.ts +0 -10
- package/dist/response.js +0 -6
|
@@ -1,9 +1,81 @@
|
|
|
1
1
|
import { z } from 'zod/v4';
|
|
2
|
+
import { OAuthAuthorizationErrorResponse, OAuthAccessTokenErrorResponse, OAuthEnvSchema } from './schemas.js';
|
|
3
|
+
import { SerializeOptions } from '@aura-stack/router/cookie';
|
|
2
4
|
import { JWTPayload } from '@aura-stack/jose/jose';
|
|
3
|
-
import { OAuthAuthorizationErrorResponse, OAuthAccessTokenErrorResponse } from './schemas.js';
|
|
4
|
-
import { SerializeOptions } from 'cookie';
|
|
5
5
|
import { LiteralUnion, Prettify } from './@types/utility.js';
|
|
6
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>;
|
|
78
|
+
|
|
7
79
|
/**
|
|
8
80
|
* @see [X - Get my User](https://docs.x.com/x-api/users/get-my-user)
|
|
9
81
|
*/
|
|
@@ -16,6 +88,7 @@ interface XProfile {
|
|
|
16
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)
|
|
@@ -55,6 +128,8 @@ interface SpotifyProfile {
|
|
|
55
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)
|
|
@@ -116,6 +191,8 @@ interface GitLabProfile {
|
|
|
116
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)
|
|
@@ -170,12 +247,15 @@ interface DiscordProfile {
|
|
|
170
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
260
|
declare const discord: OAuthProviderConfig<DiscordProfile>;
|
|
181
261
|
|
|
@@ -189,6 +269,7 @@ interface FigmaProfile {
|
|
|
189
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)
|
|
@@ -281,6 +362,7 @@ interface GitHubProfile {
|
|
|
281
362
|
}
|
|
282
363
|
/**
|
|
283
364
|
* GitHub OAuth Provider
|
|
365
|
+
*
|
|
284
366
|
* @see [GitHub - Creating an OAuth App](https://docs.github.com/en/developers/apps/building-oauth-apps/creating-an-oauth-app)
|
|
285
367
|
* @see [GitHub - Authorizing OAuth Apps](https://docs.github.com/en/developers/apps/building-oauth-apps/authorizing-oauth-apps)
|
|
286
368
|
* @see [GitHub - Configure your GitHub OAuth Apps](https://github.com/settings/developers)
|
|
@@ -289,13 +371,14 @@ interface GitHubProfile {
|
|
|
289
371
|
declare const github: OAuthProviderConfig<GitHubProfile>;
|
|
290
372
|
|
|
291
373
|
declare const builtInOAuthProviders: {
|
|
292
|
-
github: OAuthProviderConfig<GitHubProfile>;
|
|
293
|
-
bitbucket: OAuthProviderConfig<BitbucketProfile>;
|
|
294
|
-
figma: OAuthProviderConfig<FigmaProfile>;
|
|
295
|
-
discord: OAuthProviderConfig<DiscordProfile>;
|
|
296
|
-
gitlab: OAuthProviderConfig<GitLabProfile>;
|
|
297
|
-
spotify: OAuthProviderConfig<SpotifyProfile>;
|
|
298
|
-
x: OAuthProviderConfig<XProfile>;
|
|
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>;
|
|
299
382
|
};
|
|
300
383
|
/**
|
|
301
384
|
* Constructs OAuth provider configurations from an array of provider names or configurations.
|
|
@@ -312,15 +395,21 @@ type BuiltInOAuthProvider = keyof typeof builtInOAuthProviders;
|
|
|
312
395
|
* These fields are typically filtered out before returning user data.
|
|
313
396
|
*/
|
|
314
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
|
+
};
|
|
315
404
|
/**
|
|
316
405
|
* Standardized user profile returned by OAuth providers after fetching user information
|
|
317
406
|
* and mapping the response to this format by default or via the `profile` custom function.
|
|
318
407
|
*/
|
|
319
408
|
interface User {
|
|
320
409
|
sub: string;
|
|
321
|
-
name?: string;
|
|
322
|
-
email?: string;
|
|
323
|
-
image?: string;
|
|
410
|
+
name?: string | null;
|
|
411
|
+
email?: string | null;
|
|
412
|
+
image?: string | null;
|
|
324
413
|
}
|
|
325
414
|
/**
|
|
326
415
|
* Session data returned by the session endpoint.
|
|
@@ -340,70 +429,49 @@ interface OAuthProviderConfig<Profile extends object = {}> {
|
|
|
340
429
|
accessToken: string;
|
|
341
430
|
userInfo: string;
|
|
342
431
|
scope: string;
|
|
343
|
-
responseType:
|
|
432
|
+
responseType: "code" | "token" | "refresh_token" | "id_token";
|
|
344
433
|
profile?: (profile: Profile) => User | Promise<User>;
|
|
345
434
|
}
|
|
346
435
|
/**
|
|
347
436
|
* OAuth provider configuration with client credentials.
|
|
348
437
|
* Extends OAuthProviderConfig with clientId and clientSecret.
|
|
349
438
|
*/
|
|
350
|
-
interface OAuthProviderCredentials extends OAuthProviderConfig {
|
|
439
|
+
interface OAuthProviderCredentials<Profile extends object = {}> extends OAuthProviderConfig<Profile> {
|
|
351
440
|
clientId: string;
|
|
352
441
|
clientSecret: string;
|
|
353
442
|
}
|
|
354
443
|
/**
|
|
355
444
|
* Complete OAuth provider type combining configuration and credentials.
|
|
356
445
|
*/
|
|
357
|
-
type OAuthProvider<Profile extends
|
|
446
|
+
type OAuthProvider<Profile extends object = {}> = OAuthProviderCredentials<Profile>;
|
|
358
447
|
/**
|
|
359
448
|
* Cookie type with __Secure- prefix, must be Secure.
|
|
360
449
|
* @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__secure-prefix
|
|
361
450
|
*/
|
|
362
451
|
type SecureCookie = {
|
|
363
452
|
strategy: "secure";
|
|
364
|
-
} &
|
|
365
|
-
options?: Prettify<Omit<SerializeOptions, "secure" | "encode">>;
|
|
366
|
-
};
|
|
453
|
+
} & Prettify<Omit<SerializeOptions, "secure" | "encode">>;
|
|
367
454
|
/**
|
|
368
455
|
* Cookie type with __Host- prefix, must be Secure, Path=/, no Domain attribute.
|
|
369
456
|
* @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__host-prefix
|
|
370
457
|
*/
|
|
371
458
|
type HostCookie = {
|
|
372
459
|
strategy: "host";
|
|
373
|
-
} &
|
|
374
|
-
options?: Prettify<Omit<SerializeOptions, "secure" | "path" | "domain" | "encode">>;
|
|
375
|
-
};
|
|
460
|
+
} & Prettify<Omit<SerializeOptions, "secure" | "path" | "domain" | "encode">>;
|
|
376
461
|
/**
|
|
377
462
|
* Standard cookie type without security prefixes.
|
|
378
463
|
* Can be sent over both HTTP and HTTPS connections (default in development).
|
|
379
464
|
*/
|
|
380
465
|
type StandardCookie = {
|
|
381
466
|
strategy?: "standard";
|
|
382
|
-
} &
|
|
383
|
-
options?: Prettify<Omit<SerializeOptions, "encode">>;
|
|
384
|
-
};
|
|
467
|
+
} & Prettify<Omit<SerializeOptions, "encode">>;
|
|
385
468
|
/**
|
|
386
469
|
* Union type for cookie options based on the specified strategy.
|
|
387
470
|
* - `secure`: Cookies are only sent over HTTPS connections
|
|
388
471
|
* - `host`: Cookies use the __Host- prefix and are only sent over HTTPS connections
|
|
389
472
|
* - `standard`: Cookies can be sent over both HTTP and HTTPS connections (default in development)
|
|
390
473
|
*/
|
|
391
|
-
type
|
|
392
|
-
/**
|
|
393
|
-
* Configuration options for cookies used in Aura Auth.
|
|
394
|
-
* @see {@link AuthConfig.cookies}
|
|
395
|
-
*/
|
|
396
|
-
type CookieConfig = Prettify<{
|
|
397
|
-
name?: string;
|
|
398
|
-
} & CookieStrategyOptions>;
|
|
399
|
-
/**
|
|
400
|
-
* Internal representation of cookie configuration with all options resolved.
|
|
401
|
-
* @internal
|
|
402
|
-
*/
|
|
403
|
-
type CookieConfigInternal = {
|
|
404
|
-
name?: string;
|
|
405
|
-
prefix?: string;
|
|
406
|
-
} & SerializeOptions;
|
|
474
|
+
type CookieStrategyAttributes = StandardCookie | SecureCookie | HostCookie;
|
|
407
475
|
/**
|
|
408
476
|
* Names of cookies used by Aura Auth for session management and OAuth flows.
|
|
409
477
|
* - `sessionToken`: User session JWT
|
|
@@ -414,7 +482,18 @@ type CookieConfigInternal = {
|
|
|
414
482
|
* - `redirect_to`: Post-authentication redirect path
|
|
415
483
|
* - `nonce`: OpenID Connect nonce parameter
|
|
416
484
|
*/
|
|
417
|
-
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
|
+
}
|
|
418
497
|
/**
|
|
419
498
|
* Main configuration interface for Aura Auth.
|
|
420
499
|
* This is the user-facing configuration object passed to `createAuth()`.
|
|
@@ -462,7 +541,7 @@ interface AuthConfig {
|
|
|
462
541
|
* @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__secure-prefix
|
|
463
542
|
* @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__host-prefix
|
|
464
543
|
*/
|
|
465
|
-
cookies?: CookieConfig
|
|
544
|
+
cookies?: Partial<CookieConfig>;
|
|
466
545
|
/**
|
|
467
546
|
* Secret used to sign and verify JWT tokens for session and csrf protection.
|
|
468
547
|
* If not provided, it will load from the environment variable `AURA_AUTH_SECRET`, but if it
|
|
@@ -494,26 +573,22 @@ interface JoseInstance {
|
|
|
494
573
|
encodeJWT: (payload: JWTPayload) => Promise<string>;
|
|
495
574
|
signJWS: (payload: JWTPayload) => Promise<string>;
|
|
496
575
|
verifyJWS: (payload: string) => Promise<JWTPayload>;
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
* Internal runtime configuration used within Aura Auth after initialization.
|
|
500
|
-
* All optional fields from AuthConfig are resolved to their default values.
|
|
501
|
-
* @internal
|
|
502
|
-
* @todo: is this needed?
|
|
503
|
-
*/
|
|
504
|
-
interface AuthRuntimeConfig {
|
|
505
|
-
oauth: Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>;
|
|
506
|
-
cookies: CookieConfig;
|
|
507
|
-
secret: string;
|
|
508
|
-
jose: JoseInstance;
|
|
576
|
+
encryptJWE: (payload: string) => Promise<string>;
|
|
577
|
+
decryptJWE: (payload: string) => Promise<string>;
|
|
509
578
|
}
|
|
510
579
|
interface RouterGlobalContext {
|
|
511
580
|
oauth: Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>;
|
|
512
|
-
cookies:
|
|
581
|
+
cookies: CookieStoreConfig;
|
|
513
582
|
jose: JoseInstance;
|
|
583
|
+
secret?: string;
|
|
514
584
|
basePath: string;
|
|
515
585
|
trustedProxyHeaders: boolean;
|
|
516
586
|
}
|
|
587
|
+
/**
|
|
588
|
+
* Internal runtime configuration used within Aura Auth after initialization.
|
|
589
|
+
* All optional fields from AuthConfig are resolved to their default values.
|
|
590
|
+
*/
|
|
591
|
+
type AuthRuntimeConfig = RouterGlobalContext;
|
|
517
592
|
interface AuthInstance {
|
|
518
593
|
handlers: {
|
|
519
594
|
GET: (request: Request) => Response | Promise<Response>;
|
|
@@ -542,7 +617,14 @@ type AccessTokenError = OAuthError<z.infer<typeof OAuthAccessTokenErrorResponse>
|
|
|
542
617
|
* OAuth 2.0 Token Revocation Error Response Types
|
|
543
618
|
* @see https://datatracker.ietf.org/doc/html/rfc7009#section-2.2.1
|
|
544
619
|
*/
|
|
545
|
-
type TokenRevocationError = OAuthError<"invalid_session_token"
|
|
620
|
+
type TokenRevocationError = OAuthError<"invalid_session_token">;
|
|
546
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
|
+
}>;
|
|
547
629
|
|
|
548
|
-
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
|
|
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 };
|