@aura-stack/auth 0.1.0-rc.7 → 0.1.0-rc.9

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