@aura-stack/auth 0.1.0-rc.8 → 0.1.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.
Files changed (116) hide show
  1. package/dist/@types/index.cjs +15 -15
  2. package/dist/@types/index.d.ts +7 -31
  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 +15 -20
  11. package/dist/actions/callback/access-token.js +8 -4
  12. package/dist/actions/callback/callback.cjs +437 -455
  13. package/dist/actions/callback/callback.d.ts +10 -12
  14. package/dist/actions/callback/callback.js +16 -12
  15. package/dist/actions/callback/userinfo.cjs +131 -134
  16. package/dist/actions/callback/userinfo.d.ts +9 -9
  17. package/dist/actions/callback/userinfo.js +10 -6
  18. package/dist/actions/csrfToken/csrfToken.cjs +162 -171
  19. package/dist/actions/csrfToken/csrfToken.d.ts +3 -3
  20. package/dist/actions/csrfToken/csrfToken.js +12 -8
  21. package/dist/actions/index.cjs +746 -773
  22. package/dist/actions/index.d.ts +13 -13
  23. package/dist/actions/index.js +34 -18
  24. package/dist/actions/session/session.cjs +149 -155
  25. package/dist/actions/session/session.d.ts +3 -3
  26. package/dist/actions/session/session.js +11 -7
  27. package/dist/actions/signIn/authorization.cjs +231 -249
  28. package/dist/actions/signIn/authorization.d.ts +12 -18
  29. package/dist/actions/signIn/authorization.js +16 -6
  30. package/dist/actions/signIn/signIn.cjs +396 -423
  31. package/dist/actions/signIn/signIn.d.ts +10 -10
  32. package/dist/actions/signIn/signIn.js +14 -10
  33. package/dist/actions/signOut/signOut.cjs +417 -440
  34. package/dist/actions/signOut/signOut.d.ts +3 -3
  35. package/dist/actions/signOut/signOut.js +15 -11
  36. package/dist/assert.cjs +35 -36
  37. package/dist/assert.d.ts +4 -4
  38. package/dist/assert.js +10 -2
  39. package/dist/chunk-256KIVJL.js +85 -96
  40. package/dist/chunk-42XB3YCW.js +19 -17
  41. package/dist/chunk-6SM22VVJ.js +13 -10
  42. package/dist/chunk-CAKJT3KS.js +84 -69
  43. package/dist/chunk-E3OXBRYF.js +19 -17
  44. package/dist/chunk-EBPE35JT.js +28 -26
  45. package/dist/chunk-FIPU4MLT.js +18 -16
  46. package/dist/chunk-FJUDBLCP.js +50 -43
  47. package/dist/chunk-FKRDCWBF.js +19 -17
  48. package/dist/chunk-GZU3RBTB.js +51 -40
  49. package/dist/chunk-HGJ4TXY4.js +132 -100
  50. package/dist/chunk-HMRKN75I.js +63 -63
  51. package/dist/chunk-IKHPGFCW.js +11 -9
  52. package/dist/chunk-JAPMIE6S.js +7 -5
  53. package/dist/chunk-KRNOMBXQ.js +19 -17
  54. package/dist/chunk-LLR722CL.js +91 -70
  55. package/dist/chunk-RLT4RFKV.js +39 -30
  56. package/dist/chunk-SJPDVKUS.js +107 -88
  57. package/dist/chunk-SMQO5WD7.js +26 -16
  58. package/dist/chunk-STHEPPUZ.js +8 -6
  59. package/dist/chunk-UJJ7R56J.js +47 -37
  60. package/dist/chunk-UTDLUEEG.js +27 -21
  61. package/dist/chunk-VFTYH33W.js +54 -37
  62. package/dist/chunk-XXJKNKGQ.js +33 -23
  63. package/dist/chunk-ZV4BH47P.js +132 -134
  64. package/dist/cookie.cjs +169 -175
  65. package/dist/cookie.d.ts +23 -51
  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 +15 -8
  70. package/dist/headers.cjs +28 -28
  71. package/dist/headers.d.ts +2 -2
  72. package/dist/headers.js +6 -2
  73. package/dist/index-DpfbvTZ_.d.ts +249 -298
  74. package/dist/index.cjs +936 -969
  75. package/dist/index.d.ts +10 -31
  76. package/dist/index.js +70 -50
  77. package/dist/jose.cjs +61 -64
  78. package/dist/jose.d.ts +8 -8
  79. package/dist/jose.js +9 -5
  80. package/dist/oauth/bitbucket.cjs +38 -38
  81. package/dist/oauth/bitbucket.d.ts +7 -7
  82. package/dist/oauth/bitbucket.js +6 -2
  83. package/dist/oauth/discord.cjs +48 -48
  84. package/dist/oauth/discord.d.ts +7 -7
  85. package/dist/oauth/discord.js +6 -2
  86. package/dist/oauth/figma.cjs +39 -39
  87. package/dist/oauth/figma.d.ts +7 -7
  88. package/dist/oauth/figma.js +6 -2
  89. package/dist/oauth/github.cjs +31 -31
  90. package/dist/oauth/github.d.ts +7 -7
  91. package/dist/oauth/github.js +6 -2
  92. package/dist/oauth/gitlab.cjs +39 -39
  93. package/dist/oauth/gitlab.d.ts +7 -7
  94. package/dist/oauth/gitlab.js +6 -2
  95. package/dist/oauth/index.cjs +180 -180
  96. package/dist/oauth/index.d.ts +7 -26
  97. package/dist/oauth/index.js +36 -9
  98. package/dist/oauth/spotify.cjs +39 -39
  99. package/dist/oauth/spotify.d.ts +7 -7
  100. package/dist/oauth/spotify.js +6 -2
  101. package/dist/oauth/x.cjs +39 -39
  102. package/dist/oauth/x.d.ts +7 -7
  103. package/dist/oauth/x.js +6 -2
  104. package/dist/response.cjs +27 -27
  105. package/dist/response.d.ts +2 -2
  106. package/dist/response.js +6 -2
  107. package/dist/schemas.cjs +91 -91
  108. package/dist/schemas.d.ts +93 -126
  109. package/dist/schemas.js +18 -18
  110. package/dist/secure.cjs +95 -98
  111. package/dist/secure.d.ts +17 -17
  112. package/dist/secure.js +18 -4
  113. package/dist/utils.cjs +119 -132
  114. package/dist/utils.d.ts +11 -26
  115. package/dist/utils.js +21 -21
  116. package/package.json +2 -2
@@ -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,29 +194,26 @@ 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<
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
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;
220
217
  }
221
218
  /**
222
219
  * Bitbucket OAuth Provider
@@ -229,58 +226,58 @@ interface BitbucketProfile {
229
226
  * @see [Bitbucket - Cloud REST API](https://developer.atlassian.com/cloud/bitbucket/rest/intro/)
230
227
  * @see [Bitbucket - User Endpoint](https://developer.atlassian.com/cloud/bitbucket/rest/api-group-users/#api-users-endpoint)
231
228
  */
232
- declare const bitbucket: OAuthProviderConfig<BitbucketProfile>
229
+ declare const bitbucket: OAuthProviderConfig<BitbucketProfile>;
233
230
 
234
231
  /**
235
232
  * @see [Get the authenticated user](https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user)
236
233
  */
237
234
  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
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;
278
275
  plan?: {
279
- collaborators: number
280
- name: string
281
- space: number
282
- private_repos: number
283
- }
276
+ collaborators: number;
277
+ name: string;
278
+ space: number;
279
+ private_repos: number;
280
+ };
284
281
  }
285
282
  /**
286
283
  * GitHub OAuth Provider
@@ -289,17 +286,17 @@ interface GitHubProfile {
289
286
  * @see [GitHub - Configure your GitHub OAuth Apps](https://github.com/settings/developers)
290
287
  * @see [Github - Get the authenticated user](https://docs.github.com/en/rest/users/users?apiVersion=2022-11-28#get-the-authenticated-user)
291
288
  */
292
- declare const github: OAuthProviderConfig<GitHubProfile>
289
+ declare const github: OAuthProviderConfig<GitHubProfile>;
293
290
 
294
291
  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
- }
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
+ };
303
300
  /**
304
301
  * Constructs OAuth provider configurations from an array of provider names or configurations.
305
302
  * It loads the client ID and client secret from environment variables if only the provider name is provided.
@@ -307,110 +304,106 @@ declare const builtInOAuthProviders: {
307
304
  * @param oauth - Array of OAuth provider configurations or provider names to be defined from environment variables
308
305
  * @returns A record of OAuth provider configurations
309
306
  */
310
- declare const createBuiltInOAuthProviders: (
311
- oauth?: (BuiltInOAuthProvider | OAuthProviderCredentials)[]
312
- ) => Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>
313
- type BuiltInOAuthProvider = keyof typeof builtInOAuthProviders
307
+ declare const createBuiltInOAuthProviders: (oauth?: (BuiltInOAuthProvider | OAuthProviderCredentials)[]) => Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>;
308
+ type BuiltInOAuthProvider = keyof typeof builtInOAuthProviders;
314
309
 
315
310
  /**
316
311
  * Standard JWT claims that are managed internally by the token system.
317
312
  * These fields are typically filtered out before returning user data.
318
313
  */
319
- type JWTStandardClaims = Pick<JWTPayload, "exp" | "iat" | "jti" | "nbf" | "sub" | "aud" | "iss">
314
+ type JWTStandardClaims = Pick<JWTPayload, "exp" | "iat" | "jti" | "nbf" | "sub" | "aud" | "iss">;
320
315
  /**
321
316
  * Standardized user profile returned by OAuth providers after fetching user information
322
317
  * and mapping the response to this format by default or via the `profile` custom function.
323
318
  */
324
319
  interface User {
325
- sub: string
326
- name?: string
327
- email?: string
328
- image?: string
320
+ sub: string;
321
+ name?: string;
322
+ email?: string;
323
+ image?: string;
329
324
  }
330
325
  /**
331
326
  * Session data returned by the session endpoint.
332
327
  */
333
328
  interface Session {
334
- user: User
335
- expires: string
329
+ user: User;
330
+ expires: string;
336
331
  }
337
332
  /**
338
333
  * Configuration for an OAuth provider without credentials.
339
334
  * Use this type when defining provider metadata and endpoints.
340
335
  */
341
336
  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>
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>;
350
345
  }
351
346
  /**
352
347
  * OAuth provider configuration with client credentials.
353
348
  * Extends OAuthProviderConfig with clientId and clientSecret.
354
349
  */
355
350
  interface OAuthProviderCredentials extends OAuthProviderConfig {
356
- clientId: string
357
- clientSecret: string
351
+ clientId: string;
352
+ clientSecret: string;
358
353
  }
359
354
  /**
360
355
  * Complete OAuth provider type combining configuration and credentials.
361
356
  */
362
- type OAuthProvider<Profile extends Record<string, unknown> = {}> = OAuthProviderConfig<Profile> & OAuthProviderCredentials
357
+ type OAuthProvider<Profile extends Record<string, unknown> = {}> = OAuthProviderConfig<Profile> & OAuthProviderCredentials;
363
358
  /**
364
359
  * Cookie type with __Secure- prefix, must be Secure.
365
360
  * @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__secure-prefix
366
361
  */
367
362
  type SecureCookie = {
368
- strategy: "secure"
363
+ strategy: "secure";
369
364
  } & {
370
- options?: Prettify<Omit<SerializeOptions, "secure" | "encode">>
371
- }
365
+ options?: Prettify<Omit<SerializeOptions, "secure" | "encode">>;
366
+ };
372
367
  /**
373
368
  * Cookie type with __Host- prefix, must be Secure, Path=/, no Domain attribute.
374
369
  * @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__host-prefix
375
370
  */
376
371
  type HostCookie = {
377
- strategy: "host"
372
+ strategy: "host";
378
373
  } & {
379
- options?: Prettify<Omit<SerializeOptions, "secure" | "path" | "domain" | "encode">>
380
- }
374
+ options?: Prettify<Omit<SerializeOptions, "secure" | "path" | "domain" | "encode">>;
375
+ };
381
376
  /**
382
377
  * Standard cookie type without security prefixes.
383
378
  * Can be sent over both HTTP and HTTPS connections (default in development).
384
379
  */
385
380
  type StandardCookie = {
386
- strategy?: "standard"
381
+ strategy?: "standard";
387
382
  } & {
388
- options?: Prettify<Omit<SerializeOptions, "encode">>
389
- }
383
+ options?: Prettify<Omit<SerializeOptions, "encode">>;
384
+ };
390
385
  /**
391
386
  * Union type for cookie options based on the specified strategy.
392
387
  * - `secure`: Cookies are only sent over HTTPS connections
393
388
  * - `host`: Cookies use the __Host- prefix and are only sent over HTTPS connections
394
389
  * - `standard`: Cookies can be sent over both HTTP and HTTPS connections (default in development)
395
390
  */
396
- type CookieStrategyOptions = StandardCookie | SecureCookie | HostCookie
391
+ type CookieStrategyOptions = StandardCookie | SecureCookie | HostCookie;
397
392
  /**
398
393
  * Configuration options for cookies used in Aura Auth.
399
394
  * @see {@link AuthConfig.cookies}
400
395
  */
401
- type CookieConfig = Prettify<
402
- {
403
- name?: string
404
- } & CookieStrategyOptions
405
- >
396
+ type CookieConfig = Prettify<{
397
+ name?: string;
398
+ } & CookieStrategyOptions>;
406
399
  /**
407
400
  * Internal representation of cookie configuration with all options resolved.
408
401
  * @internal
409
402
  */
410
403
  type CookieConfigInternal = {
411
- name?: string
412
- prefix?: string
413
- } & SerializeOptions
404
+ name?: string;
405
+ prefix?: string;
406
+ } & SerializeOptions;
414
407
  /**
415
408
  * Names of cookies used by Aura Auth for session management and OAuth flows.
416
409
  * - `sessionToken`: User session JWT
@@ -421,7 +414,7 @@ type CookieConfigInternal = {
421
414
  * - `redirect_to`: Post-authentication redirect path
422
415
  * - `nonce`: OpenID Connect nonce parameter
423
416
  */
424
- type CookieName = "sessionToken" | "csrfToken" | "state" | "nonce" | "code_verifier" | "redirect_to" | "redirect_uri"
417
+ type CookieName = "sessionToken" | "csrfToken" | "state" | "nonce" | "code_verifier" | "redirect_to" | "redirect_uri";
425
418
  /**
426
419
  * Main configuration interface for Aura Auth.
427
420
  * This is the user-facing configuration object passed to `createAuth()`.
@@ -450,7 +443,7 @@ interface AuthConfig {
450
443
  * }
451
444
  * ]
452
445
  */
453
- oauth: (BuiltInOAuthProvider | OAuthProviderCredentials)[]
446
+ oauth: (BuiltInOAuthProvider | OAuthProviderCredentials)[];
454
447
  /**
455
448
  * Cookie options defines the configuration for cookies used in Aura Auth.
456
449
  * It includes a prefix for cookie names and flag options to determine
@@ -469,17 +462,17 @@ interface AuthConfig {
469
462
  * @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__secure-prefix
470
463
  * @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__host-prefix
471
464
  */
472
- cookies?: CookieConfig
465
+ cookies?: CookieConfig;
473
466
  /**
474
467
  * Secret used to sign and verify JWT tokens for session and csrf protection.
475
468
  * If not provided, it will load from the environment variable `AURA_AUTH_SECRET`, but if it
476
469
  * doesn't exist, it will throw an error during the initialization of the Auth module.
477
470
  */
478
- secret?: string
471
+ secret?: string;
479
472
  /**
480
473
  * Base path for all authentication routes. Default is `/auth`.
481
474
  */
482
- basePath?: `/${string}`
475
+ basePath?: `/${string}`;
483
476
  /**
484
477
  * Enable trusted proxy headers for scenarios where the application is behind a reverse proxy or load balancer.
485
478
  * This setting allows Aura Auth to correctly interpret headers like `X-Forwarded-For` and `X-Forwarded-Proto`
@@ -494,13 +487,13 @@ interface AuthConfig {
494
487
  * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded
495
488
  * @experimental
496
489
  */
497
- trustedProxyHeaders?: boolean
490
+ trustedProxyHeaders?: boolean;
498
491
  }
499
492
  interface JoseInstance {
500
- decodeJWT: (token: string) => Promise<JWTPayload>
501
- encodeJWT: (payload: JWTPayload) => Promise<string>
502
- signJWS: (payload: JWTPayload) => Promise<string>
503
- verifyJWS: (payload: string) => Promise<JWTPayload>
493
+ decodeJWT: (token: string) => Promise<JWTPayload>;
494
+ encodeJWT: (payload: JWTPayload) => Promise<string>;
495
+ signJWS: (payload: JWTPayload) => Promise<string>;
496
+ verifyJWS: (payload: string) => Promise<JWTPayload>;
504
497
  }
505
498
  /**
506
499
  * Internal runtime configuration used within Aura Auth after initialization.
@@ -509,89 +502,47 @@ interface JoseInstance {
509
502
  * @todo: is this needed?
510
503
  */
511
504
  interface AuthRuntimeConfig {
512
- oauth: Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>
513
- cookies: CookieConfig
514
- secret: string
515
- jose: JoseInstance
505
+ oauth: Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>;
506
+ cookies: CookieConfig;
507
+ secret: string;
508
+ jose: JoseInstance;
516
509
  }
517
510
  interface RouterGlobalContext {
518
- oauth: Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>
519
- cookies: CookieConfigInternal
520
- jose: JoseInstance
521
- basePath: string
522
- trustedProxyHeaders: boolean
511
+ oauth: Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>;
512
+ cookies: CookieConfigInternal;
513
+ jose: JoseInstance;
514
+ basePath: string;
515
+ trustedProxyHeaders: boolean;
523
516
  }
524
517
  interface AuthInstance {
525
518
  handlers: {
526
- GET: (request: Request) => Response | Promise<Response>
527
- POST: (request: Request) => Response | Promise<Response>
528
- }
529
- jose: JoseInstance
519
+ GET: (request: Request) => Response | Promise<Response>;
520
+ POST: (request: Request) => Response | Promise<Response>;
521
+ };
522
+ jose: JoseInstance;
530
523
  }
531
524
  /**
532
525
  * Base OAuth error response structure.
533
526
  */
534
527
  interface OAuthError<T extends string> {
535
- error: T
536
- error_description?: string
528
+ error: T;
529
+ error_description?: string;
537
530
  }
538
531
  /**
539
532
  * OAuth 2.0 Authorization Error Response Types
540
533
  * @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1
541
534
  */
542
- type AuthorizationError = OAuthError<z.infer<typeof OAuthAuthorizationErrorResponse>["error"]>
535
+ type AuthorizationError = OAuthError<z.infer<typeof OAuthAuthorizationErrorResponse>["error"]>;
543
536
  /**
544
537
  * OAuth 2.0 Access Token Error Response Types
545
538
  * @see https://datatracker.ietf.org/doc/html/rfc6749#section-5.2
546
539
  */
547
- type AccessTokenError = OAuthError<z.infer<typeof OAuthAccessTokenErrorResponse>["error"]>
540
+ type AccessTokenError = OAuthError<z.infer<typeof OAuthAccessTokenErrorResponse>["error"]>;
548
541
  /**
549
542
  * OAuth 2.0 Token Revocation Error Response Types
550
543
  * @see https://datatracker.ietf.org/doc/html/rfc7009#section-2.2.1
551
544
  */
552
- type TokenRevocationError = OAuthError<"invalid_session_token" | "invalid_csrf_token" | "invalid_redirect_to">
553
- type ErrorType = AuthorizationError["error"] | AccessTokenError["error"] | TokenRevocationError["error"]
545
+ type TokenRevocationError = OAuthError<"invalid_session_token" | "invalid_csrf_token" | "invalid_redirect_to">;
546
+ type ErrorType = AuthorizationError["error"] | AccessTokenError["error"] | TokenRevocationError["error"];
554
547
 
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
- }
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 };