@aura-stack/auth 0.2.0 → 0.4.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) 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 +26 -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.d.ts +3 -1
  14. package/dist/actions/csrfToken/csrfToken.js +2 -2
  15. package/dist/actions/index.cjs +93 -71
  16. package/dist/actions/index.d.ts +3 -2
  17. package/dist/actions/index.js +15 -14
  18. package/dist/actions/session/session.d.ts +3 -1
  19. package/dist/actions/session/session.js +2 -2
  20. package/dist/actions/signIn/authorization.cjs +40 -40
  21. package/dist/actions/signIn/authorization.d.ts +3 -2
  22. package/dist/actions/signIn/authorization.js +2 -2
  23. package/dist/actions/signIn/signIn.cjs +63 -50
  24. package/dist/actions/signIn/signIn.d.ts +25 -3
  25. package/dist/actions/signIn/signIn.js +4 -3
  26. package/dist/actions/signOut/signOut.cjs +66 -66
  27. package/dist/actions/signOut/signOut.d.ts +9 -1
  28. package/dist/actions/signOut/signOut.js +4 -4
  29. package/dist/assert.d.ts +3 -2
  30. package/dist/{chunk-2RXNXMCZ.js → chunk-3EUWD5BB.js} +15 -7
  31. package/dist/{chunk-NEVKX6K2.js → chunk-A3N4PVAT.js} +3 -3
  32. package/dist/chunk-B737EUJV.js +22 -0
  33. package/dist/{chunk-7H3OR6UU.js → chunk-EMKJA2GJ.js} +18 -10
  34. package/dist/{chunk-4V4JNXVF.js → chunk-GA2SMTJO.js} +9 -6
  35. package/dist/chunk-HP34YGGJ.js +22 -0
  36. package/dist/{chunk-QDO2KSRJ.js → chunk-HT4YLL7N.js} +1 -1
  37. package/dist/{chunk-ZLR3LI6X.js → chunk-IVET23KF.js} +7 -4
  38. package/dist/{chunk-PTJUYB33.js → chunk-JVFTCTTE.js} +1 -1
  39. package/dist/{chunk-UEH3LVON.js → chunk-KSWLO5ZU.js} +21 -16
  40. package/dist/{chunk-QEZL7EYN.js → chunk-N4SX7TZT.js} +3 -3
  41. package/dist/{chunk-IMICRJ5U.js → chunk-W6LG7BFW.js} +14 -14
  42. package/dist/{chunk-WD7AUHQ5.js → chunk-YRCB5FLE.js} +8 -8
  43. package/dist/chunk-ZNCZVF6U.js +14 -0
  44. package/dist/cookie.cjs +14 -14
  45. package/dist/cookie.d.ts +3 -2
  46. package/dist/cookie.js +1 -1
  47. package/dist/errors.d.ts +3 -2
  48. package/dist/{index-EqsoyjrF.d.ts → index-B8jeIElf.d.ts} +57 -8
  49. package/dist/index.cjs +159 -95
  50. package/dist/index.d.ts +66 -5
  51. package/dist/index.js +23 -19
  52. package/dist/jose.cjs +2 -2
  53. package/dist/oauth/bitbucket.d.ts +3 -2
  54. package/dist/oauth/discord.d.ts +3 -2
  55. package/dist/oauth/figma.d.ts +3 -2
  56. package/dist/oauth/github.d.ts +3 -2
  57. package/dist/oauth/gitlab.d.ts +3 -2
  58. package/dist/oauth/index.cjs +85 -41
  59. package/dist/oauth/index.d.ts +3 -2
  60. package/dist/oauth/index.js +16 -8
  61. package/dist/oauth/mailchimp.cjs +46 -0
  62. package/dist/oauth/mailchimp.d.ts +7 -0
  63. package/dist/oauth/mailchimp.js +6 -0
  64. package/dist/oauth/pinterest.cjs +46 -0
  65. package/dist/oauth/pinterest.d.ts +7 -0
  66. package/dist/oauth/pinterest.js +6 -0
  67. package/dist/oauth/spotify.d.ts +3 -2
  68. package/dist/oauth/strava.d.ts +3 -2
  69. package/dist/oauth/x.d.ts +3 -2
  70. package/dist/request.cjs +38 -0
  71. package/dist/request.d.ts +13 -0
  72. package/dist/request.js +6 -0
  73. package/dist/schemas.cjs +40 -40
  74. package/dist/schemas.d.ts +15 -15
  75. package/dist/schemas.js +1 -1
  76. package/dist/secure.cjs +5 -5
  77. package/dist/secure.d.ts +3 -2
  78. package/dist/utils.d.ts +3 -3
  79. package/package.json +7 -5
@@ -1,8 +1,3 @@
1
- import {
2
- OAuthAccessToken,
3
- OAuthAccessTokenErrorResponse,
4
- OAuthAccessTokenResponse
5
- } from "./chunk-WD7AUHQ5.js";
6
1
  import {
7
2
  formatZodError
8
3
  } from "./chunk-CXLATHS5.js";
@@ -10,6 +5,14 @@ import {
10
5
  AuthInternalError,
11
6
  OAuthProtocolError
12
7
  } from "./chunk-RRLIF4PQ.js";
8
+ import {
9
+ fetchAsync
10
+ } from "./chunk-ZNCZVF6U.js";
11
+ import {
12
+ OAuthAccessToken,
13
+ OAuthAccessTokenErrorResponse,
14
+ OAuthAccessTokenResponse
15
+ } from "./chunk-YRCB5FLE.js";
13
16
 
14
17
  // src/actions/callback/access-token.ts
15
18
  var createAccessToken = async (oauthConfig, redirectURI, code, codeVerifier) => {
@@ -20,7 +23,7 @@ var createAccessToken = async (oauthConfig, redirectURI, code, codeVerifier) =>
20
23
  }
21
24
  const { accessToken, clientId, clientSecret, code: codeParsed, redirectURI: redirectParsed } = parsed.data;
22
25
  try {
23
- const response = await fetch(accessToken, {
26
+ const response = await fetchAsync(accessToken, {
24
27
  method: "POST",
25
28
  headers: {
26
29
  Accept: "application/json",
@@ -0,0 +1,22 @@
1
+ // src/oauth/pinterest.ts
2
+ var pinterest = {
3
+ id: "pinterest",
4
+ name: "Pinterest",
5
+ authorizeURL: "https://api.pinterest.com/oauth/",
6
+ accessToken: "https://api.pinterest.com/v5/oauth/token",
7
+ userInfo: "https://api.pinterest.com/v5/user_account",
8
+ scope: "user_accounts:read",
9
+ responseType: "code",
10
+ profile(profile) {
11
+ return {
12
+ sub: profile.id,
13
+ name: profile.username,
14
+ email: null,
15
+ image: profile.profile_image
16
+ };
17
+ }
18
+ };
19
+
20
+ export {
21
+ pinterest
22
+ };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getCookie,
3
3
  setCookie
4
- } from "./chunk-IMICRJ5U.js";
4
+ } from "./chunk-W6LG7BFW.js";
5
5
  import {
6
6
  cacheControl
7
7
  } from "./chunk-STHEPPUZ.js";
@@ -1,6 +1,3 @@
1
- import {
2
- OAuthErrorResponse
3
- } from "./chunk-WD7AUHQ5.js";
4
1
  import {
5
2
  generateSecure
6
3
  } from "./chunk-N2APGLXA.js";
@@ -9,6 +6,12 @@ import {
9
6
  isNativeError,
10
7
  isOAuthProtocolError
11
8
  } from "./chunk-RRLIF4PQ.js";
9
+ import {
10
+ fetchAsync
11
+ } from "./chunk-ZNCZVF6U.js";
12
+ import {
13
+ OAuthErrorResponse
14
+ } from "./chunk-YRCB5FLE.js";
12
15
 
13
16
  // src/actions/callback/userinfo.ts
14
17
  var getDefaultUserInfo = (profile) => {
@@ -23,7 +26,7 @@ var getDefaultUserInfo = (profile) => {
23
26
  var getUserInfo = async (oauthConfig, accessToken) => {
24
27
  const userinfoEndpoint = oauthConfig.userInfo;
25
28
  try {
26
- const response = await fetch(userinfoEndpoint, {
29
+ const response = await fetchAsync(userinfoEndpoint, {
27
30
  method: "GET",
28
31
  headers: {
29
32
  Accept: "application/json",
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  expiredCookieAttributes,
3
3
  getCookie
4
- } from "./chunk-IMICRJ5U.js";
4
+ } from "./chunk-W6LG7BFW.js";
5
5
  import {
6
6
  cacheControl
7
7
  } from "./chunk-STHEPPUZ.js";
@@ -1,21 +1,17 @@
1
- import {
2
- getUserInfo
3
- } from "./chunk-ZLR3LI6X.js";
4
1
  import {
5
2
  createAccessToken
6
- } from "./chunk-4V4JNXVF.js";
3
+ } from "./chunk-GA2SMTJO.js";
4
+ import {
5
+ getUserInfo
6
+ } from "./chunk-IVET23KF.js";
7
7
  import {
8
8
  createSessionCookie,
9
9
  expiredCookieAttributes,
10
10
  getCookie
11
- } from "./chunk-IMICRJ5U.js";
11
+ } from "./chunk-W6LG7BFW.js";
12
12
  import {
13
13
  cacheControl
14
14
  } from "./chunk-STHEPPUZ.js";
15
- import {
16
- OAuthAuthorizationErrorResponse,
17
- OAuthAuthorizationResponse
18
- } from "./chunk-WD7AUHQ5.js";
19
15
  import {
20
16
  createCSRF
21
17
  } from "./chunk-N2APGLXA.js";
@@ -28,16 +24,25 @@ import {
28
24
  AuthSecurityError,
29
25
  OAuthProtocolError
30
26
  } from "./chunk-RRLIF4PQ.js";
27
+ import {
28
+ OAuthAuthorizationErrorResponse
29
+ } from "./chunk-YRCB5FLE.js";
31
30
 
32
31
  // src/actions/callback/callback.ts
33
- import z from "zod";
32
+ import { z } from "zod";
34
33
  import { createEndpoint, createEndpointConfig, HeadersBuilder } from "@aura-stack/router";
35
34
  var callbackConfig = (oauth) => {
36
35
  return createEndpointConfig("/callback/:oauth", {
37
36
  schemas: {
38
- searchParams: OAuthAuthorizationResponse,
39
37
  params: z.object({
40
- oauth: z.enum(Object.keys(oauth), "The OAuth provider is not supported or invalid.")
38
+ oauth: z.enum(
39
+ Object.keys(oauth),
40
+ "The OAuth provider is not supported or invalid."
41
+ )
42
+ }),
43
+ searchParams: z.object({
44
+ code: z.string("Missing code parameter in the OAuth authorization response."),
45
+ state: z.string("Missing state parameter in the OAuth authorization response.")
41
46
  })
42
47
  },
43
48
  middlewares: [
@@ -65,9 +70,9 @@ var callbackAction = (oauth) => {
65
70
  } = ctx;
66
71
  const oauthConfig = providers[oauth2];
67
72
  const cookieState = getCookie(request, cookies.state.name);
68
- const cookieRedirectTo = getCookie(request, cookies.redirect_to.name);
69
- const cookieRedirectURI = getCookie(request, cookies.redirect_uri.name);
70
- const codeVerifier = getCookie(request, cookies.code_verifier.name);
73
+ const cookieRedirectTo = getCookie(request, cookies.redirectTo.name);
74
+ const cookieRedirectURI = getCookie(request, cookies.redirectURI.name);
75
+ const codeVerifier = getCookie(request, cookies.codeVerifier.name);
71
76
  if (!equals(cookieState, state)) {
72
77
  throw new AuthSecurityError(
73
78
  "MISMATCHING_STATE",
@@ -85,7 +90,7 @@ var callbackAction = (oauth) => {
85
90
  const userInfo = await getUserInfo(oauthConfig, accessToken.access_token);
86
91
  const sessionCookie = await createSessionCookie(jose, userInfo);
87
92
  const csrfToken = await createCSRF(jose);
88
- const headers = new 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();
93
+ const headers = new 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();
89
94
  return Response.json({ oauth: oauth2 }, { status: 302, headers });
90
95
  },
91
96
  callbackConfig(oauth)
@@ -1,6 +1,3 @@
1
- import {
2
- OAuthAuthorization
3
- } from "./chunk-WD7AUHQ5.js";
4
1
  import {
5
2
  equals,
6
3
  formatZodError,
@@ -16,6 +13,9 @@ import {
16
13
  AuthSecurityError,
17
14
  isAuthSecurityError
18
15
  } from "./chunk-RRLIF4PQ.js";
16
+ import {
17
+ OAuthAuthorization
18
+ } from "./chunk-YRCB5FLE.js";
19
19
 
20
20
  // src/actions/signIn/authorization.ts
21
21
  var createAuthorizationURL = (oauthConfig, redirectURI, state, codeChallenge, codeChallengeMethod) => {
@@ -113,7 +113,7 @@ var createCookieStore = (useSecure, prefix, overrides) => {
113
113
  const hostPrefix = useSecure ? "__Host-" : "";
114
114
  return {
115
115
  sessionToken: {
116
- name: `${securePrefix}${prefix}.${overrides?.sessionToken?.name ?? "sessionToken"}`,
116
+ name: `${securePrefix}${prefix}.${overrides?.sessionToken?.name ?? "session_token"}`,
117
117
  attributes: defineSecureCookieOptions(
118
118
  useSecure,
119
119
  {
@@ -135,7 +135,7 @@ var createCookieStore = (useSecure, prefix, overrides) => {
135
135
  )
136
136
  },
137
137
  csrfToken: {
138
- name: `${hostPrefix}${prefix}.${overrides?.csrfToken?.name ?? "csrfToken"}`,
138
+ name: `${hostPrefix}${prefix}.${overrides?.csrfToken?.name ?? "csrf_token"}`,
139
139
  attributes: defineSecureCookieOptions(
140
140
  useSecure,
141
141
  {
@@ -145,37 +145,37 @@ var createCookieStore = (useSecure, prefix, overrides) => {
145
145
  overrides?.csrfToken?.attributes?.strategy ?? "host"
146
146
  )
147
147
  },
148
- redirect_to: {
149
- name: `${securePrefix}${prefix}.${overrides?.redirect_to?.name ?? "redirect_to"}`,
148
+ redirectTo: {
149
+ name: `${securePrefix}${prefix}.${overrides?.redirectTo?.name ?? "redirect_to"}`,
150
150
  attributes: defineSecureCookieOptions(
151
151
  useSecure,
152
152
  {
153
153
  ...oauthCookieOptions,
154
- ...overrides?.redirect_to?.attributes
154
+ ...overrides?.redirectTo?.attributes
155
155
  },
156
- overrides?.redirect_to?.attributes?.strategy ?? "secure"
156
+ overrides?.redirectTo?.attributes?.strategy ?? "secure"
157
157
  )
158
158
  },
159
- redirect_uri: {
160
- name: `${securePrefix}${prefix}.${overrides?.redirect_uri?.name ?? "redirect_uri"}`,
159
+ redirectURI: {
160
+ name: `${securePrefix}${prefix}.${overrides?.redirectURI?.name ?? "redirect_uri"}`,
161
161
  attributes: defineSecureCookieOptions(
162
162
  useSecure,
163
163
  {
164
164
  ...oauthCookieOptions,
165
- ...overrides?.redirect_uri?.attributes
165
+ ...overrides?.redirectURI?.attributes
166
166
  },
167
- overrides?.redirect_uri?.attributes?.strategy ?? "secure"
167
+ overrides?.redirectURI?.attributes?.strategy ?? "secure"
168
168
  )
169
169
  },
170
- code_verifier: {
171
- name: `${securePrefix}${prefix}.${overrides?.code_verifier?.name ?? "code_verifier"}`,
170
+ codeVerifier: {
171
+ name: `${securePrefix}${prefix}.${overrides?.codeVerifier?.name ?? "code_verifier"}`,
172
172
  attributes: defineSecureCookieOptions(
173
173
  useSecure,
174
174
  {
175
175
  ...oauthCookieOptions,
176
- ...overrides?.code_verifier?.attributes
176
+ ...overrides?.codeVerifier?.attributes
177
177
  },
178
- overrides?.code_verifier?.attributes?.strategy ?? "secure"
178
+ overrides?.codeVerifier?.attributes?.strategy ?? "secure"
179
179
  )
180
180
  }
181
181
  };
@@ -1,10 +1,10 @@
1
1
  // src/schemas.ts
2
- import { object, string, enum as options, number, httpUrl, z } from "zod/v4";
2
+ import { object, string, enum as options, number, z, null as nullable } from "zod";
3
3
  var OAuthProviderConfigSchema = object({
4
- authorizeURL: httpUrl(),
5
- accessToken: httpUrl(),
4
+ authorizeURL: string().url(),
5
+ accessToken: string().url(),
6
6
  scope: string().optional(),
7
- userInfo: httpUrl(),
7
+ userInfo: string().url(),
8
8
  responseType: options(["code", "token", "id_token"]),
9
9
  clientId: string(),
10
10
  clientSecret: string()
@@ -16,8 +16,8 @@ var OAuthAuthorization = OAuthProviderConfigSchema.extend({
16
16
  codeChallengeMethod: options(["plain", "S256"])
17
17
  });
18
18
  var OAuthAuthorizationResponse = object({
19
- state: string("Missing state parameter in the OAuth authorization response."),
20
- code: string("Missing code parameter in the OAuth authorization response.")
19
+ state: string({ message: "Missing state parameter in the OAuth authorization response." }),
20
+ code: string({ message: "Missing code parameter in the OAuth authorization response." })
21
21
  });
22
22
  var OAuthAuthorizationErrorResponse = object({
23
23
  error: options([
@@ -40,10 +40,10 @@ var OAuthAccessToken = OAuthProviderConfigSchema.extend({
40
40
  });
41
41
  var OAuthAccessTokenResponse = object({
42
42
  access_token: string(),
43
- token_type: string(),
43
+ token_type: string().optional(),
44
44
  expires_in: number().optional(),
45
45
  refresh_token: string().optional(),
46
- scope: string().optional()
46
+ scope: string().optional().or(nullable())
47
47
  });
48
48
  var OAuthAccessTokenErrorResponse = object({
49
49
  error: options([
@@ -0,0 +1,14 @@
1
+ // src/request.ts
2
+ var fetchAsync = async (url, options = {}, timeout = 5e3) => {
3
+ const controller = new AbortController();
4
+ const timeoutId = setTimeout(() => controller.abort(), timeout);
5
+ const response = await fetch(url, {
6
+ ...options,
7
+ signal: controller.signal
8
+ }).finally(() => clearTimeout(timeoutId));
9
+ return response;
10
+ };
11
+
12
+ export {
13
+ fetchAsync
14
+ };
package/dist/cookie.cjs CHANGED
@@ -158,7 +158,7 @@ var createCookieStore = (useSecure, prefix, overrides) => {
158
158
  const hostPrefix = useSecure ? "__Host-" : "";
159
159
  return {
160
160
  sessionToken: {
161
- name: `${securePrefix}${prefix}.${overrides?.sessionToken?.name ?? "sessionToken"}`,
161
+ name: `${securePrefix}${prefix}.${overrides?.sessionToken?.name ?? "session_token"}`,
162
162
  attributes: defineSecureCookieOptions(
163
163
  useSecure,
164
164
  {
@@ -180,7 +180,7 @@ var createCookieStore = (useSecure, prefix, overrides) => {
180
180
  )
181
181
  },
182
182
  csrfToken: {
183
- name: `${hostPrefix}${prefix}.${overrides?.csrfToken?.name ?? "csrfToken"}`,
183
+ name: `${hostPrefix}${prefix}.${overrides?.csrfToken?.name ?? "csrf_token"}`,
184
184
  attributes: defineSecureCookieOptions(
185
185
  useSecure,
186
186
  {
@@ -190,37 +190,37 @@ var createCookieStore = (useSecure, prefix, overrides) => {
190
190
  overrides?.csrfToken?.attributes?.strategy ?? "host"
191
191
  )
192
192
  },
193
- redirect_to: {
194
- name: `${securePrefix}${prefix}.${overrides?.redirect_to?.name ?? "redirect_to"}`,
193
+ redirectTo: {
194
+ name: `${securePrefix}${prefix}.${overrides?.redirectTo?.name ?? "redirect_to"}`,
195
195
  attributes: defineSecureCookieOptions(
196
196
  useSecure,
197
197
  {
198
198
  ...oauthCookieOptions,
199
- ...overrides?.redirect_to?.attributes
199
+ ...overrides?.redirectTo?.attributes
200
200
  },
201
- overrides?.redirect_to?.attributes?.strategy ?? "secure"
201
+ overrides?.redirectTo?.attributes?.strategy ?? "secure"
202
202
  )
203
203
  },
204
- redirect_uri: {
205
- name: `${securePrefix}${prefix}.${overrides?.redirect_uri?.name ?? "redirect_uri"}`,
204
+ redirectURI: {
205
+ name: `${securePrefix}${prefix}.${overrides?.redirectURI?.name ?? "redirect_uri"}`,
206
206
  attributes: defineSecureCookieOptions(
207
207
  useSecure,
208
208
  {
209
209
  ...oauthCookieOptions,
210
- ...overrides?.redirect_uri?.attributes
210
+ ...overrides?.redirectURI?.attributes
211
211
  },
212
- overrides?.redirect_uri?.attributes?.strategy ?? "secure"
212
+ overrides?.redirectURI?.attributes?.strategy ?? "secure"
213
213
  )
214
214
  },
215
- code_verifier: {
216
- name: `${securePrefix}${prefix}.${overrides?.code_verifier?.name ?? "code_verifier"}`,
215
+ codeVerifier: {
216
+ name: `${securePrefix}${prefix}.${overrides?.codeVerifier?.name ?? "code_verifier"}`,
217
217
  attributes: defineSecureCookieOptions(
218
218
  useSecure,
219
219
  {
220
220
  ...oauthCookieOptions,
221
- ...overrides?.code_verifier?.attributes
221
+ ...overrides?.codeVerifier?.attributes
222
222
  },
223
- overrides?.code_verifier?.attributes?.strategy ?? "secure"
223
+ overrides?.codeVerifier?.attributes?.strategy ?? "secure"
224
224
  )
225
225
  }
226
226
  };
package/dist/cookie.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { SerializeOptions } from '@aura-stack/router/cookie';
2
2
  import { JWTPayload } from '@aura-stack/jose/jose';
3
- import { A as AuthRuntimeConfig, C as CookieConfig, a as CookieStoreConfig } from './index-EqsoyjrF.js';
4
- import 'zod/v4';
3
+ import { A as AuthRuntimeConfig, C as CookieConfig, a as CookieStoreConfig } from './index-B8jeIElf.js';
4
+ import 'zod';
5
5
  import './schemas.js';
6
+ import '@aura-stack/jose';
6
7
  import './@types/utility.js';
7
8
 
8
9
  /**
package/dist/cookie.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  getCookie,
12
12
  getSetCookie,
13
13
  setCookie
14
- } from "./chunk-IMICRJ5U.js";
14
+ } from "./chunk-W6LG7BFW.js";
15
15
  import "./chunk-RRLIF4PQ.js";
16
16
  export {
17
17
  COOKIE_NAME,
package/dist/errors.d.ts CHANGED
@@ -1,8 +1,9 @@
1
- import { E as ErrorType, b as AuthInternalErrorCode, c as AuthSecurityErrorCode } from './index-EqsoyjrF.js';
1
+ import { E as ErrorType, b as AuthInternalErrorCode, c as AuthSecurityErrorCode } from './index-B8jeIElf.js';
2
2
  import { LiteralUnion } from './@types/utility.js';
3
- import 'zod/v4';
3
+ import 'zod';
4
4
  import './schemas.js';
5
5
  import '@aura-stack/router/cookie';
6
+ import '@aura-stack/jose';
6
7
  import '@aura-stack/jose/jose';
7
8
 
8
9
  /**
@@ -1,9 +1,55 @@
1
- import { z } from 'zod/v4';
1
+ import { z } from 'zod';
2
2
  import { OAuthAuthorizationErrorResponse, OAuthAccessTokenErrorResponse, OAuthEnvSchema } from './schemas.js';
3
3
  import { SerializeOptions } from '@aura-stack/router/cookie';
4
+ import { JWTVerifyOptions, EncryptOptions, JWTDecryptOptions } from '@aura-stack/jose';
4
5
  import { JWTPayload } from '@aura-stack/jose/jose';
5
6
  import { LiteralUnion, Prettify } from './@types/utility.js';
6
7
 
8
+ /**
9
+ * @see [Pinterest - Get User Account](https://developers.pinterest.com/docs/api/v5/user_account-get)
10
+ */
11
+ interface PinterestProfile {
12
+ account_type: LiteralUnion<"PINNER">;
13
+ id: string;
14
+ profile_image: string;
15
+ website_url: string;
16
+ username: string;
17
+ about: string;
18
+ business_name: string;
19
+ board_count: number;
20
+ pin_count: number;
21
+ follower_count: number;
22
+ following_count: number;
23
+ monthly_views: number;
24
+ }
25
+ /**
26
+ * @see [Pinterest - Connect App](https://developers.pinterest.com/docs/getting-started/connect-app/)
27
+ * @see [Pinterest - My Apps](https://developers.pinterest.com/apps/)
28
+ * @see [Pinterest - Get User Account](https://developers.pinterest.com/docs/api/v5/user_account-get)
29
+ */
30
+ declare const pinterest: OAuthProviderConfig<PinterestProfile>;
31
+
32
+ interface Login {
33
+ email: string;
34
+ avatar: string | null;
35
+ login_id: number;
36
+ login_name: string;
37
+ login_email: string;
38
+ }
39
+ interface MailchimpProfile {
40
+ dc: string;
41
+ role: string;
42
+ accountname: string;
43
+ user_id: string;
44
+ login: Login;
45
+ login_url: string;
46
+ api_endpoint: string;
47
+ }
48
+ /**
49
+ * @see [Mailchimp - Access Data on Behalf of Other Users with OAuth 2](https://mailchimp.com/developer/marketing/guides/access-user-data-oauth-2/)
50
+ */
51
+ declare const mailchimp: OAuthProviderConfig<MailchimpProfile>;
52
+
7
53
  /**
8
54
  * @see [Strava - SummaryClub](https://developers.strava.com/docs/reference/#api-models-SummaryClub)
9
55
  */
@@ -379,6 +425,8 @@ declare const builtInOAuthProviders: {
379
425
  readonly spotify: OAuthProviderConfig<SpotifyProfile>;
380
426
  readonly x: OAuthProviderConfig<XProfile>;
381
427
  readonly strava: OAuthProviderConfig<StravaProfile>;
428
+ readonly mailchimp: OAuthProviderConfig<MailchimpProfile>;
429
+ readonly pinterest: OAuthProviderConfig<PinterestProfile>;
382
430
  };
383
431
  /**
384
432
  * Constructs OAuth provider configurations from an array of provider names or configurations.
@@ -482,7 +530,7 @@ type CookieStrategyAttributes = StandardCookie | SecureCookie | HostCookie;
482
530
  * - `redirect_to`: Post-authentication redirect path
483
531
  * - `nonce`: OpenID Connect nonce parameter
484
532
  */
485
- type CookieName = "sessionToken" | "csrfToken" | "state" | "code_verifier" | "redirect_to" | "redirect_uri";
533
+ type CookieName = "sessionToken" | "csrfToken" | "state" | "codeVerifier" | "redirectTo" | "redirectURI";
486
534
  type CookieStoreConfig = Record<CookieName, {
487
535
  name: string;
488
536
  attributes: CookieStrategyAttributes;
@@ -544,7 +592,7 @@ interface AuthConfig {
544
592
  cookies?: Partial<CookieConfig>;
545
593
  /**
546
594
  * Secret used to sign and verify JWT tokens for session and csrf protection.
547
- * If not provided, it will load from the environment variable `AURA_AUTH_SECRET`, but if it
595
+ * If not provided, it will load from the environment variable `AURA_AUTH_SECRET` or `AUTH_SECRET`, but if it
548
596
  * doesn't exist, it will throw an error during the initialization of the Auth module.
549
597
  */
550
598
  secret?: string;
@@ -572,12 +620,13 @@ interface JoseInstance {
572
620
  decodeJWT: (token: string) => Promise<JWTPayload>;
573
621
  encodeJWT: (payload: JWTPayload) => Promise<string>;
574
622
  signJWS: (payload: JWTPayload) => Promise<string>;
575
- verifyJWS: (payload: string) => Promise<JWTPayload>;
576
- encryptJWE: (payload: string) => Promise<string>;
577
- decryptJWE: (payload: string) => Promise<string>;
623
+ verifyJWS: (payload: string, options?: JWTVerifyOptions) => Promise<JWTPayload>;
624
+ encryptJWE: (payload: string, options?: EncryptOptions) => Promise<string>;
625
+ decryptJWE: (payload: string, options?: JWTDecryptOptions) => Promise<string>;
578
626
  }
627
+ type OAuthProviderRecord = Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>;
579
628
  interface RouterGlobalContext {
580
- oauth: Record<LiteralUnion<BuiltInOAuthProvider>, OAuthProviderCredentials>;
629
+ oauth: OAuthProviderRecord;
581
630
  cookies: CookieStoreConfig;
582
631
  jose: JoseInstance;
583
632
  secret?: string;
@@ -627,4 +676,4 @@ type APIErrorMap = Record<string, {
627
676
  message: string;
628
677
  }>;
629
678
 
630
- export { type AuthRuntimeConfig as A, type BitbucketProfile as B, type CookieConfig as C, type DiscordProfile as D, type ErrorType as E, type FigmaProfile as F, type GitLabProfile as G, type SecureCookie as H, type Image as I, type JWTPayloadWithToken as J, type HostCookie as K, type StandardCookie as L, type CookieStrategyAttributes as M, type Nameplate as N, type OAuthProvider as O, type CookieName as P, type OAuthError as Q, type RouterGlobalContext as R, type Session as S, type AuthorizationError as T, type User as U, type AccessTokenError as V, type TokenRevocationError as W, type XProfile as X, type OAuthEnv as Y, type CookieStoreConfig as a, type AuthInternalErrorCode as b, type AuthSecurityErrorCode as c, type AuthConfig as d, type AuthInstance as e, type JoseInstance as f, type OAuthProviderConfig as g, type OAuthProviderCredentials as h, type APIErrorMap as i, type SummaryClub as j, type SummaryGear as k, type StravaProfile as l, type SpotifyProfile as m, spotify as n, gitlab as o, discord as p, figma as q, bitbucket as r, strava as s, type GitHubProfile as t, github as u, builtInOAuthProviders as v, createBuiltInOAuthProviders as w, x, type BuiltInOAuthProvider as y, type JWTStandardClaims as z };
679
+ export { type AuthorizationError as $, 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, createBuiltInOAuthProviders as H, type Image as I, type JWTPayloadWithToken as J, type BuiltInOAuthProvider as K, type Login as L, type MailchimpProfile as M, type Nameplate as N, type OAuthProvider as O, type PinterestProfile as P, type JWTStandardClaims as Q, type RouterGlobalContext as R, type Session as S, type SecureCookie as T, type User as U, type HostCookie as V, type StandardCookie as W, type XProfile as X, type CookieStrategyAttributes as Y, type CookieName as Z, type OAuthError as _, type CookieStoreConfig as a, type AccessTokenError as a0, type TokenRevocationError as a1, type OAuthEnv as a2, type AuthInternalErrorCode as b, type AuthSecurityErrorCode as c, type AuthConfig as d, type JoseInstance as e, type AuthInstance as f, type OAuthProviderConfig as g, type OAuthProviderCredentials as h, type APIErrorMap as i, type OAuthProviderRecord as j, type SummaryClub as k, type SummaryGear as l, mailchimp as m, type StravaProfile as n, type SpotifyProfile as o, pinterest as p, spotify as q, gitlab as r, strava as s, discord as t, figma as u, bitbucket as v, type GitHubProfile as w, x, github as y, builtInOAuthProviders as z };