@aura-stack/auth 0.2.0 → 0.3.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 (76) hide show
  1. package/dist/@types/index.d.ts +3 -2
  2. package/dist/@types/router.d.d.ts +3 -2
  3. package/dist/actions/callback/access-token.cjs +52 -41
  4. package/dist/actions/callback/access-token.d.ts +5 -4
  5. package/dist/actions/callback/access-token.js +3 -2
  6. package/dist/actions/callback/callback.cjs +69 -52
  7. package/dist/actions/callback/callback.d.ts +4 -3
  8. package/dist/actions/callback/callback.js +6 -5
  9. package/dist/actions/callback/userinfo.cjs +54 -43
  10. package/dist/actions/callback/userinfo.d.ts +3 -2
  11. package/dist/actions/callback/userinfo.js +3 -2
  12. package/dist/actions/csrfToken/csrfToken.cjs +2 -2
  13. package/dist/actions/csrfToken/csrfToken.js +2 -2
  14. package/dist/actions/index.cjs +93 -71
  15. package/dist/actions/index.d.ts +3 -2
  16. package/dist/actions/index.js +15 -14
  17. package/dist/actions/session/session.js +2 -2
  18. package/dist/actions/signIn/authorization.cjs +40 -40
  19. package/dist/actions/signIn/authorization.d.ts +3 -2
  20. package/dist/actions/signIn/authorization.js +2 -2
  21. package/dist/actions/signIn/signIn.cjs +63 -50
  22. package/dist/actions/signIn/signIn.d.ts +4 -3
  23. package/dist/actions/signIn/signIn.js +4 -3
  24. package/dist/actions/signOut/signOut.cjs +66 -66
  25. package/dist/actions/signOut/signOut.js +4 -4
  26. package/dist/assert.d.ts +3 -2
  27. package/dist/{chunk-2RXNXMCZ.js → chunk-3EUWD5BB.js} +15 -7
  28. package/dist/{chunk-NEVKX6K2.js → chunk-A3N4PVAT.js} +3 -3
  29. package/dist/chunk-B737EUJV.js +22 -0
  30. package/dist/{chunk-7H3OR6UU.js → chunk-EMKJA2GJ.js} +18 -10
  31. package/dist/{chunk-4V4JNXVF.js → chunk-GA2SMTJO.js} +9 -6
  32. package/dist/chunk-HP34YGGJ.js +22 -0
  33. package/dist/{chunk-QDO2KSRJ.js → chunk-HT4YLL7N.js} +1 -1
  34. package/dist/{chunk-ZLR3LI6X.js → chunk-IVET23KF.js} +7 -4
  35. package/dist/{chunk-PTJUYB33.js → chunk-JVFTCTTE.js} +1 -1
  36. package/dist/{chunk-UEH3LVON.js → chunk-KSWLO5ZU.js} +21 -16
  37. package/dist/{chunk-QEZL7EYN.js → chunk-N4SX7TZT.js} +3 -3
  38. package/dist/{chunk-IMICRJ5U.js → chunk-W6LG7BFW.js} +14 -14
  39. package/dist/{chunk-WD7AUHQ5.js → chunk-YRCB5FLE.js} +8 -8
  40. package/dist/chunk-ZNCZVF6U.js +14 -0
  41. package/dist/cookie.cjs +14 -14
  42. package/dist/cookie.d.ts +3 -2
  43. package/dist/cookie.js +1 -1
  44. package/dist/errors.d.ts +3 -2
  45. package/dist/{index-EqsoyjrF.d.ts → index-DkaLJFn8.d.ts} +57 -8
  46. package/dist/index.cjs +155 -93
  47. package/dist/index.d.ts +4 -3
  48. package/dist/index.js +20 -17
  49. package/dist/jose.cjs +2 -2
  50. package/dist/oauth/bitbucket.d.ts +3 -2
  51. package/dist/oauth/discord.d.ts +3 -2
  52. package/dist/oauth/figma.d.ts +3 -2
  53. package/dist/oauth/github.d.ts +3 -2
  54. package/dist/oauth/gitlab.d.ts +3 -2
  55. package/dist/oauth/index.cjs +85 -41
  56. package/dist/oauth/index.d.ts +3 -2
  57. package/dist/oauth/index.js +16 -8
  58. package/dist/oauth/mailchimp.cjs +46 -0
  59. package/dist/oauth/mailchimp.d.ts +7 -0
  60. package/dist/oauth/mailchimp.js +6 -0
  61. package/dist/oauth/pinterest.cjs +46 -0
  62. package/dist/oauth/pinterest.d.ts +7 -0
  63. package/dist/oauth/pinterest.js +6 -0
  64. package/dist/oauth/spotify.d.ts +3 -2
  65. package/dist/oauth/strava.d.ts +3 -2
  66. package/dist/oauth/x.d.ts +3 -2
  67. package/dist/request.cjs +38 -0
  68. package/dist/request.d.ts +13 -0
  69. package/dist/request.js +6 -0
  70. package/dist/schemas.cjs +40 -40
  71. package/dist/schemas.d.ts +15 -15
  72. package/dist/schemas.js +1 -1
  73. package/dist/secure.cjs +5 -5
  74. package/dist/secure.d.ts +3 -2
  75. package/dist/utils.d.ts +3 -3
  76. package/package.json +6 -4
@@ -39,11 +39,19 @@ __export(actions_exports, {
39
39
  module.exports = __toCommonJS(actions_exports);
40
40
 
41
41
  // src/actions/signIn/signIn.ts
42
- var import_zod = __toESM(require("zod"), 1);
42
+ var import_zod2 = require("zod");
43
43
  var import_router2 = require("@aura-stack/router");
44
44
 
45
+ // src/headers.ts
46
+ var cacheControl = {
47
+ "Cache-Control": "no-store",
48
+ Pragma: "no-cache",
49
+ Expires: "0",
50
+ Vary: "Cookie"
51
+ };
52
+
45
53
  // src/secure.ts
46
- var import_node_crypto = __toESM(require("crypto"), 1);
54
+ var import_crypto = __toESM(require("crypto"), 1);
47
55
 
48
56
  // src/utils.ts
49
57
  var import_router = require("@aura-stack/router");
@@ -190,10 +198,10 @@ var isJWTPayloadWithToken = (payload) => {
190
198
 
191
199
  // src/secure.ts
192
200
  var generateSecure = (length = 32) => {
193
- return import_node_crypto.default.randomBytes(length).toString("base64url");
201
+ return import_crypto.default.randomBytes(length).toString("base64url");
194
202
  };
195
203
  var createHash = (data, base = "hex") => {
196
- return import_node_crypto.default.createHash("sha256").update(data).digest().toString(base);
204
+ return import_crypto.default.createHash("sha256").update(data).digest().toString(base);
197
205
  };
198
206
  var createPKCE = async (verifier) => {
199
207
  const codeVerifier = verifier ?? generateSecure(86);
@@ -228,7 +236,7 @@ var verifyCSRF = async (jose, cookie, header) => {
228
236
  if (!equals(headerBuffer.length, cookieBuffer.length)) {
229
237
  throw new AuthSecurityError("CSRF_TOKEN_INVALID", "The CSRF tokens do not match.");
230
238
  }
231
- if (!import_node_crypto.default.timingSafeEqual(cookieBuffer, headerBuffer)) {
239
+ if (!import_crypto.default.timingSafeEqual(cookieBuffer, headerBuffer)) {
232
240
  throw new AuthSecurityError("CSRF_TOKEN_INVALID", "The CSRF tokens do not match.");
233
241
  }
234
242
  return true;
@@ -238,28 +246,28 @@ var verifyCSRF = async (jose, cookie, header) => {
238
246
  };
239
247
 
240
248
  // src/schemas.ts
241
- var import_v4 = require("zod/v4");
242
- var OAuthProviderConfigSchema = (0, import_v4.object)({
243
- authorizeURL: (0, import_v4.httpUrl)(),
244
- accessToken: (0, import_v4.httpUrl)(),
245
- scope: (0, import_v4.string)().optional(),
246
- userInfo: (0, import_v4.httpUrl)(),
247
- responseType: (0, import_v4.enum)(["code", "token", "id_token"]),
248
- clientId: (0, import_v4.string)(),
249
- clientSecret: (0, import_v4.string)()
249
+ var import_zod = require("zod");
250
+ var OAuthProviderConfigSchema = (0, import_zod.object)({
251
+ authorizeURL: (0, import_zod.string)().url(),
252
+ accessToken: (0, import_zod.string)().url(),
253
+ scope: (0, import_zod.string)().optional(),
254
+ userInfo: (0, import_zod.string)().url(),
255
+ responseType: (0, import_zod.enum)(["code", "token", "id_token"]),
256
+ clientId: (0, import_zod.string)(),
257
+ clientSecret: (0, import_zod.string)()
250
258
  });
251
259
  var OAuthAuthorization = OAuthProviderConfigSchema.extend({
252
- redirectURI: (0, import_v4.string)(),
253
- state: (0, import_v4.string)(),
254
- codeChallenge: (0, import_v4.string)(),
255
- codeChallengeMethod: (0, import_v4.enum)(["plain", "S256"])
260
+ redirectURI: (0, import_zod.string)(),
261
+ state: (0, import_zod.string)(),
262
+ codeChallenge: (0, import_zod.string)(),
263
+ codeChallengeMethod: (0, import_zod.enum)(["plain", "S256"])
256
264
  });
257
- var OAuthAuthorizationResponse = (0, import_v4.object)({
258
- state: (0, import_v4.string)("Missing state parameter in the OAuth authorization response."),
259
- code: (0, import_v4.string)("Missing code parameter in the OAuth authorization response.")
265
+ var OAuthAuthorizationResponse = (0, import_zod.object)({
266
+ state: (0, import_zod.string)({ message: "Missing state parameter in the OAuth authorization response." }),
267
+ code: (0, import_zod.string)({ message: "Missing code parameter in the OAuth authorization response." })
260
268
  });
261
- var OAuthAuthorizationErrorResponse = (0, import_v4.object)({
262
- error: (0, import_v4.enum)([
269
+ var OAuthAuthorizationErrorResponse = (0, import_zod.object)({
270
+ error: (0, import_zod.enum)([
263
271
  "invalid_request",
264
272
  "unauthorized_client",
265
273
  "access_denied",
@@ -268,24 +276,24 @@ var OAuthAuthorizationErrorResponse = (0, import_v4.object)({
268
276
  "server_error",
269
277
  "temporarily_unavailable"
270
278
  ]),
271
- error_description: (0, import_v4.string)().optional(),
272
- error_uri: (0, import_v4.string)().optional(),
273
- state: (0, import_v4.string)()
279
+ error_description: (0, import_zod.string)().optional(),
280
+ error_uri: (0, import_zod.string)().optional(),
281
+ state: (0, import_zod.string)()
274
282
  });
275
283
  var OAuthAccessToken = OAuthProviderConfigSchema.extend({
276
- redirectURI: (0, import_v4.string)(),
277
- code: (0, import_v4.string)(),
278
- codeVerifier: (0, import_v4.string)().min(43).max(128)
284
+ redirectURI: (0, import_zod.string)(),
285
+ code: (0, import_zod.string)(),
286
+ codeVerifier: (0, import_zod.string)().min(43).max(128)
279
287
  });
280
- var OAuthAccessTokenResponse = (0, import_v4.object)({
281
- access_token: (0, import_v4.string)(),
282
- token_type: (0, import_v4.string)(),
283
- expires_in: (0, import_v4.number)().optional(),
284
- refresh_token: (0, import_v4.string)().optional(),
285
- scope: (0, import_v4.string)().optional()
288
+ var OAuthAccessTokenResponse = (0, import_zod.object)({
289
+ access_token: (0, import_zod.string)(),
290
+ token_type: (0, import_zod.string)().optional(),
291
+ expires_in: (0, import_zod.number)().optional(),
292
+ refresh_token: (0, import_zod.string)().optional(),
293
+ scope: (0, import_zod.string)().optional().or((0, import_zod.null)())
286
294
  });
287
- var OAuthAccessTokenErrorResponse = (0, import_v4.object)({
288
- error: (0, import_v4.enum)([
295
+ var OAuthAccessTokenErrorResponse = (0, import_zod.object)({
296
+ error: (0, import_zod.enum)([
289
297
  "invalid_request",
290
298
  "invalid_client",
291
299
  "invalid_grant",
@@ -293,16 +301,16 @@ var OAuthAccessTokenErrorResponse = (0, import_v4.object)({
293
301
  "unsupported_grant_type",
294
302
  "invalid_scope"
295
303
  ]),
296
- error_description: (0, import_v4.string)().optional(),
297
- error_uri: (0, import_v4.string)().optional()
304
+ error_description: (0, import_zod.string)().optional(),
305
+ error_uri: (0, import_zod.string)().optional()
298
306
  });
299
- var OAuthErrorResponse = (0, import_v4.object)({
300
- error: (0, import_v4.string)(),
301
- error_description: (0, import_v4.string)().optional()
307
+ var OAuthErrorResponse = (0, import_zod.object)({
308
+ error: (0, import_zod.string)(),
309
+ error_description: (0, import_zod.string)().optional()
302
310
  });
303
- var OAuthEnvSchema = (0, import_v4.object)({
304
- clientId: import_v4.z.string().min(1, "OAuth Client ID is required in the environment variables."),
305
- clientSecret: import_v4.z.string().min(1, "OAuth Client Secret is required in the environment variables.")
311
+ var OAuthEnvSchema = (0, import_zod.object)({
312
+ clientId: import_zod.z.string().min(1, "OAuth Client ID is required in the environment variables."),
313
+ clientSecret: import_zod.z.string().min(1, "OAuth Client Secret is required in the environment variables.")
306
314
  });
307
315
 
308
316
  // src/actions/signIn/authorization.ts
@@ -380,9 +388,14 @@ var createRedirectTo = (request, redirectTo, trustedProxyHeaders) => {
380
388
  var signInConfig = (oauth) => {
381
389
  return (0, import_router2.createEndpointConfig)("/signIn/:oauth", {
382
390
  schemas: {
383
- params: import_zod.default.object({
384
- oauth: import_zod.default.enum(Object.keys(oauth), "The OAuth provider is not supported or invalid."),
385
- redirectTo: import_zod.default.string().optional()
391
+ params: import_zod2.z.object({
392
+ oauth: import_zod2.z.enum(
393
+ Object.keys(oauth),
394
+ "The OAuth provider is not supported or invalid."
395
+ )
396
+ }),
397
+ searchParams: import_zod2.z.object({
398
+ redirectTo: import_zod2.z.string().optional()
386
399
  })
387
400
  }
388
401
  });
@@ -394,8 +407,8 @@ var signInAction = (oauth) => {
394
407
  async (ctx) => {
395
408
  const {
396
409
  request,
397
- headers: headersBuilder,
398
- params: { oauth: oauth2, redirectTo },
410
+ params: { oauth: oauth2 },
411
+ searchParams: { redirectTo },
399
412
  context: { oauth: providers, cookies, trustedProxyHeaders, basePath }
400
413
  } = ctx;
401
414
  const state = generateSecure();
@@ -403,7 +416,7 @@ var signInAction = (oauth) => {
403
416
  const redirectToValue = createRedirectTo(request, redirectTo, trustedProxyHeaders);
404
417
  const { codeVerifier, codeChallenge, method } = await createPKCE();
405
418
  const authorization = createAuthorizationURL(providers[oauth2], redirectURI, state, codeChallenge, method);
406
- const headers = headersBuilder.setHeader("Location", authorization).setCookie(cookies.state.name, state, cookies.state.attributes).setCookie(cookies.redirect_uri.name, redirectURI, cookies.redirect_uri.attributes).setCookie(cookies.redirect_to.name, redirectToValue, cookies.redirect_to.attributes).setCookie(cookies.code_verifier.name, codeVerifier, cookies.code_verifier.attributes).toHeaders();
419
+ const headers = new import_router2.HeadersBuilder(cacheControl).setHeader("Location", authorization).setCookie(cookies.state.name, state, cookies.state.attributes).setCookie(cookies.redirectURI.name, redirectURI, cookies.redirectURI.attributes).setCookie(cookies.redirectTo.name, redirectToValue, cookies.redirectTo.attributes).setCookie(cookies.codeVerifier.name, codeVerifier, cookies.codeVerifier.attributes).toHeaders();
407
420
  return Response.json(
408
421
  { oauth: oauth2 },
409
422
  {
@@ -417,15 +430,18 @@ var signInAction = (oauth) => {
417
430
  };
418
431
 
419
432
  // src/actions/callback/callback.ts
420
- var import_zod2 = __toESM(require("zod"), 1);
433
+ var import_zod3 = require("zod");
421
434
  var import_router3 = require("@aura-stack/router");
422
435
 
423
- // src/headers.ts
424
- var cacheControl = {
425
- "Cache-Control": "no-store",
426
- Pragma: "no-cache",
427
- Expires: "0",
428
- Vary: "Cookie"
436
+ // src/request.ts
437
+ var fetchAsync = async (url, options2 = {}, timeout = 5e3) => {
438
+ const controller = new AbortController();
439
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
440
+ const response = await fetch(url, {
441
+ ...options2,
442
+ signal: controller.signal
443
+ }).finally(() => clearTimeout(timeoutId));
444
+ return response;
429
445
  };
430
446
 
431
447
  // src/actions/callback/userinfo.ts
@@ -441,7 +457,7 @@ var getDefaultUserInfo = (profile) => {
441
457
  var getUserInfo = async (oauthConfig, accessToken) => {
442
458
  const userinfoEndpoint = oauthConfig.userInfo;
443
459
  try {
444
- const response = await fetch(userinfoEndpoint, {
460
+ const response = await fetchAsync(userinfoEndpoint, {
445
461
  method: "GET",
446
462
  headers: {
447
463
  Accept: "application/json",
@@ -477,7 +493,7 @@ var createAccessToken = async (oauthConfig, redirectURI, code, codeVerifier) =>
477
493
  }
478
494
  const { accessToken, clientId, clientSecret, code: codeParsed, redirectURI: redirectParsed } = parsed.data;
479
495
  try {
480
- const response = await fetch(accessToken, {
496
+ const response = await fetchAsync(accessToken, {
481
497
  method: "POST",
482
498
  headers: {
483
499
  Accept: "application/json",
@@ -553,9 +569,15 @@ var createSessionCookie = async (jose, session) => {
553
569
  var callbackConfig = (oauth) => {
554
570
  return (0, import_router3.createEndpointConfig)("/callback/:oauth", {
555
571
  schemas: {
556
- searchParams: OAuthAuthorizationResponse,
557
- params: import_zod2.default.object({
558
- oauth: import_zod2.default.enum(Object.keys(oauth), "The OAuth provider is not supported or invalid.")
572
+ params: import_zod3.z.object({
573
+ oauth: import_zod3.z.enum(
574
+ Object.keys(oauth),
575
+ "The OAuth provider is not supported or invalid."
576
+ )
577
+ }),
578
+ searchParams: import_zod3.z.object({
579
+ code: import_zod3.z.string("Missing code parameter in the OAuth authorization response."),
580
+ state: import_zod3.z.string("Missing state parameter in the OAuth authorization response.")
559
581
  })
560
582
  },
561
583
  middlewares: [
@@ -583,9 +605,9 @@ var callbackAction = (oauth) => {
583
605
  } = ctx;
584
606
  const oauthConfig = providers[oauth2];
585
607
  const cookieState = getCookie(request, cookies.state.name);
586
- const cookieRedirectTo = getCookie(request, cookies.redirect_to.name);
587
- const cookieRedirectURI = getCookie(request, cookies.redirect_uri.name);
588
- const codeVerifier = getCookie(request, cookies.code_verifier.name);
608
+ const cookieRedirectTo = getCookie(request, cookies.redirectTo.name);
609
+ const cookieRedirectURI = getCookie(request, cookies.redirectURI.name);
610
+ const codeVerifier = getCookie(request, cookies.codeVerifier.name);
589
611
  if (!equals(cookieState, state)) {
590
612
  throw new AuthSecurityError(
591
613
  "MISMATCHING_STATE",
@@ -603,7 +625,7 @@ var callbackAction = (oauth) => {
603
625
  const userInfo = await getUserInfo(oauthConfig, accessToken.access_token);
604
626
  const sessionCookie = await createSessionCookie(jose, userInfo);
605
627
  const csrfToken = await createCSRF(jose);
606
- const headers = new import_router3.HeadersBuilder(cacheControl).setHeader("Location", sanitized).setCookie(cookies.sessionToken.name, sessionCookie, cookies.sessionToken.attributes).setCookie(cookies.csrfToken.name, csrfToken, cookies.csrfToken.attributes).setCookie(cookies.state.name, "", expiredCookieAttributes).setCookie(cookies.redirect_uri.name, "", expiredCookieAttributes).setCookie(cookies.redirect_to.name, "", expiredCookieAttributes).setCookie(cookies.code_verifier.name, "", expiredCookieAttributes).toHeaders();
628
+ const headers = new import_router3.HeadersBuilder(cacheControl).setHeader("Location", sanitized).setCookie(cookies.sessionToken.name, sessionCookie, cookies.sessionToken.attributes).setCookie(cookies.csrfToken.name, csrfToken, cookies.csrfToken.attributes).setCookie(cookies.state.name, "", expiredCookieAttributes).setCookie(cookies.redirectURI.name, "", expiredCookieAttributes).setCookie(cookies.redirectTo.name, "", expiredCookieAttributes).setCookie(cookies.codeVerifier.name, "", expiredCookieAttributes).toHeaders();
607
629
  return Response.json({ oauth: oauth2 }, { status: 302, headers });
608
630
  },
609
631
  callbackConfig(oauth)
@@ -630,13 +652,13 @@ var sessionAction = (0, import_router4.createEndpoint)("GET", "/session", async
630
652
  });
631
653
 
632
654
  // src/actions/signOut/signOut.ts
633
- var import_zod3 = __toESM(require("zod"), 1);
655
+ var import_zod4 = require("zod");
634
656
  var import_router5 = require("@aura-stack/router");
635
657
  var config = (0, import_router5.createEndpointConfig)({
636
658
  schemas: {
637
- searchParams: import_zod3.default.object({
638
- token_type_hint: import_zod3.default.literal("session_token"),
639
- redirectTo: import_zod3.default.string().optional()
659
+ searchParams: import_zod4.z.object({
660
+ token_type_hint: import_zod4.z.literal("session_token"),
661
+ redirectTo: import_zod4.z.string().optional()
640
662
  })
641
663
  }
642
664
  });
@@ -4,9 +4,10 @@ export { sessionAction } from './session/session.js';
4
4
  export { signOutAction } from './signOut/signOut.js';
5
5
  export { csrfTokenAction } from './csrfToken/csrfToken.js';
6
6
  import '@aura-stack/router';
7
- import '../index-EqsoyjrF.js';
8
- import 'zod/v4';
7
+ import '../index-DkaLJFn8.js';
8
+ import 'zod';
9
9
  import '../schemas.js';
10
10
  import '@aura-stack/router/cookie';
11
+ import '@aura-stack/jose';
11
12
  import '@aura-stack/jose/jose';
12
13
  import '../@types/utility.js';
@@ -1,29 +1,30 @@
1
1
  import "../chunk-ITQ7352M.js";
2
+ import {
3
+ signOutAction
4
+ } from "../chunk-A3N4PVAT.js";
2
5
  import {
3
6
  csrfTokenAction
4
- } from "../chunk-QDO2KSRJ.js";
7
+ } from "../chunk-HT4YLL7N.js";
5
8
  import {
6
- signInAction
7
- } from "../chunk-2RXNXMCZ.js";
9
+ callbackAction
10
+ } from "../chunk-KSWLO5ZU.js";
11
+ import "../chunk-GA2SMTJO.js";
12
+ import "../chunk-IVET23KF.js";
8
13
  import {
9
14
  sessionAction
10
- } from "../chunk-PTJUYB33.js";
15
+ } from "../chunk-JVFTCTTE.js";
11
16
  import {
12
- signOutAction
13
- } from "../chunk-NEVKX6K2.js";
14
- import "../chunk-QEZL7EYN.js";
15
- import {
16
- callbackAction
17
- } from "../chunk-UEH3LVON.js";
18
- import "../chunk-ZLR3LI6X.js";
19
- import "../chunk-4V4JNXVF.js";
20
- import "../chunk-IMICRJ5U.js";
17
+ signInAction
18
+ } from "../chunk-3EUWD5BB.js";
19
+ import "../chunk-N4SX7TZT.js";
20
+ import "../chunk-W6LG7BFW.js";
21
21
  import "../chunk-STHEPPUZ.js";
22
- import "../chunk-WD7AUHQ5.js";
23
22
  import "../chunk-N2APGLXA.js";
24
23
  import "../chunk-CXLATHS5.js";
25
24
  import "../chunk-EIL2FPSS.js";
26
25
  import "../chunk-RRLIF4PQ.js";
26
+ import "../chunk-ZNCZVF6U.js";
27
+ import "../chunk-YRCB5FLE.js";
27
28
  export {
28
29
  callbackAction,
29
30
  csrfTokenAction,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  sessionAction
3
- } from "../../chunk-PTJUYB33.js";
4
- import "../../chunk-IMICRJ5U.js";
3
+ } from "../../chunk-JVFTCTTE.js";
4
+ import "../../chunk-W6LG7BFW.js";
5
5
  import "../../chunk-STHEPPUZ.js";
6
6
  import "../../chunk-CXLATHS5.js";
7
7
  import "../../chunk-RRLIF4PQ.js";
@@ -35,28 +35,28 @@ var isValidURL = (value) => {
35
35
  };
36
36
 
37
37
  // src/schemas.ts
38
- var import_v4 = require("zod/v4");
39
- var OAuthProviderConfigSchema = (0, import_v4.object)({
40
- authorizeURL: (0, import_v4.httpUrl)(),
41
- accessToken: (0, import_v4.httpUrl)(),
42
- scope: (0, import_v4.string)().optional(),
43
- userInfo: (0, import_v4.httpUrl)(),
44
- responseType: (0, import_v4.enum)(["code", "token", "id_token"]),
45
- clientId: (0, import_v4.string)(),
46
- clientSecret: (0, import_v4.string)()
38
+ var import_zod = require("zod");
39
+ var OAuthProviderConfigSchema = (0, import_zod.object)({
40
+ authorizeURL: (0, import_zod.string)().url(),
41
+ accessToken: (0, import_zod.string)().url(),
42
+ scope: (0, import_zod.string)().optional(),
43
+ userInfo: (0, import_zod.string)().url(),
44
+ responseType: (0, import_zod.enum)(["code", "token", "id_token"]),
45
+ clientId: (0, import_zod.string)(),
46
+ clientSecret: (0, import_zod.string)()
47
47
  });
48
48
  var OAuthAuthorization = OAuthProviderConfigSchema.extend({
49
- redirectURI: (0, import_v4.string)(),
50
- state: (0, import_v4.string)(),
51
- codeChallenge: (0, import_v4.string)(),
52
- codeChallengeMethod: (0, import_v4.enum)(["plain", "S256"])
49
+ redirectURI: (0, import_zod.string)(),
50
+ state: (0, import_zod.string)(),
51
+ codeChallenge: (0, import_zod.string)(),
52
+ codeChallengeMethod: (0, import_zod.enum)(["plain", "S256"])
53
53
  });
54
- var OAuthAuthorizationResponse = (0, import_v4.object)({
55
- state: (0, import_v4.string)("Missing state parameter in the OAuth authorization response."),
56
- code: (0, import_v4.string)("Missing code parameter in the OAuth authorization response.")
54
+ var OAuthAuthorizationResponse = (0, import_zod.object)({
55
+ state: (0, import_zod.string)({ message: "Missing state parameter in the OAuth authorization response." }),
56
+ code: (0, import_zod.string)({ message: "Missing code parameter in the OAuth authorization response." })
57
57
  });
58
- var OAuthAuthorizationErrorResponse = (0, import_v4.object)({
59
- error: (0, import_v4.enum)([
58
+ var OAuthAuthorizationErrorResponse = (0, import_zod.object)({
59
+ error: (0, import_zod.enum)([
60
60
  "invalid_request",
61
61
  "unauthorized_client",
62
62
  "access_denied",
@@ -65,24 +65,24 @@ var OAuthAuthorizationErrorResponse = (0, import_v4.object)({
65
65
  "server_error",
66
66
  "temporarily_unavailable"
67
67
  ]),
68
- error_description: (0, import_v4.string)().optional(),
69
- error_uri: (0, import_v4.string)().optional(),
70
- state: (0, import_v4.string)()
68
+ error_description: (0, import_zod.string)().optional(),
69
+ error_uri: (0, import_zod.string)().optional(),
70
+ state: (0, import_zod.string)()
71
71
  });
72
72
  var OAuthAccessToken = OAuthProviderConfigSchema.extend({
73
- redirectURI: (0, import_v4.string)(),
74
- code: (0, import_v4.string)(),
75
- codeVerifier: (0, import_v4.string)().min(43).max(128)
73
+ redirectURI: (0, import_zod.string)(),
74
+ code: (0, import_zod.string)(),
75
+ codeVerifier: (0, import_zod.string)().min(43).max(128)
76
76
  });
77
- var OAuthAccessTokenResponse = (0, import_v4.object)({
78
- access_token: (0, import_v4.string)(),
79
- token_type: (0, import_v4.string)(),
80
- expires_in: (0, import_v4.number)().optional(),
81
- refresh_token: (0, import_v4.string)().optional(),
82
- scope: (0, import_v4.string)().optional()
77
+ var OAuthAccessTokenResponse = (0, import_zod.object)({
78
+ access_token: (0, import_zod.string)(),
79
+ token_type: (0, import_zod.string)().optional(),
80
+ expires_in: (0, import_zod.number)().optional(),
81
+ refresh_token: (0, import_zod.string)().optional(),
82
+ scope: (0, import_zod.string)().optional().or((0, import_zod.null)())
83
83
  });
84
- var OAuthAccessTokenErrorResponse = (0, import_v4.object)({
85
- error: (0, import_v4.enum)([
84
+ var OAuthAccessTokenErrorResponse = (0, import_zod.object)({
85
+ error: (0, import_zod.enum)([
86
86
  "invalid_request",
87
87
  "invalid_client",
88
88
  "invalid_grant",
@@ -90,16 +90,16 @@ var OAuthAccessTokenErrorResponse = (0, import_v4.object)({
90
90
  "unsupported_grant_type",
91
91
  "invalid_scope"
92
92
  ]),
93
- error_description: (0, import_v4.string)().optional(),
94
- error_uri: (0, import_v4.string)().optional()
93
+ error_description: (0, import_zod.string)().optional(),
94
+ error_uri: (0, import_zod.string)().optional()
95
95
  });
96
- var OAuthErrorResponse = (0, import_v4.object)({
97
- error: (0, import_v4.string)(),
98
- error_description: (0, import_v4.string)().optional()
96
+ var OAuthErrorResponse = (0, import_zod.object)({
97
+ error: (0, import_zod.string)(),
98
+ error_description: (0, import_zod.string)().optional()
99
99
  });
100
- var OAuthEnvSchema = (0, import_v4.object)({
101
- clientId: import_v4.z.string().min(1, "OAuth Client ID is required in the environment variables."),
102
- clientSecret: import_v4.z.string().min(1, "OAuth Client Secret is required in the environment variables.")
100
+ var OAuthEnvSchema = (0, import_zod.object)({
101
+ clientId: import_zod.z.string().min(1, "OAuth Client ID is required in the environment variables."),
102
+ clientSecret: import_zod.z.string().min(1, "OAuth Client Secret is required in the environment variables.")
103
103
  });
104
104
 
105
105
  // src/errors.ts
@@ -1,7 +1,8 @@
1
- import { h as OAuthProviderCredentials } from '../../index-EqsoyjrF.js';
2
- import 'zod/v4';
1
+ import { h as OAuthProviderCredentials } from '../../index-DkaLJFn8.js';
2
+ import 'zod';
3
3
  import '../../schemas.js';
4
4
  import '@aura-stack/router/cookie';
5
+ import '@aura-stack/jose';
5
6
  import '@aura-stack/jose/jose';
6
7
  import '../../@types/utility.js';
7
8
 
@@ -3,11 +3,11 @@ import {
3
3
  createRedirectTo,
4
4
  createRedirectURI,
5
5
  getOriginURL
6
- } from "../../chunk-QEZL7EYN.js";
7
- import "../../chunk-WD7AUHQ5.js";
6
+ } from "../../chunk-N4SX7TZT.js";
8
7
  import "../../chunk-CXLATHS5.js";
9
8
  import "../../chunk-EIL2FPSS.js";
10
9
  import "../../chunk-RRLIF4PQ.js";
10
+ import "../../chunk-YRCB5FLE.js";
11
11
  export {
12
12
  createAuthorizationURL,
13
13
  createRedirectTo,