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

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
package/dist/cookie.cjs CHANGED
@@ -1,201 +1,207 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
1
+ "use strict"
2
+ var __defProp = Object.defineProperty
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor
4
+ var __getOwnPropNames = Object.getOwnPropertyNames
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty
6
6
  var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
7
+ for (var name in all) __defProp(target, name, { get: all[name], enumerable: true })
8
+ }
10
9
  var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
10
+ if ((from && typeof from === "object") || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable })
14
+ }
15
+ return to
16
+ }
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod)
19
18
 
20
19
  // src/cookie.ts
21
- var cookie_exports = {};
20
+ var cookie_exports = {}
22
21
  __export(cookie_exports, {
23
- COOKIE_NAME: () => COOKIE_NAME,
24
- createSessionCookie: () => createSessionCookie,
25
- defaultCookieConfig: () => defaultCookieConfig,
26
- defaultCookieOptions: () => defaultCookieOptions,
27
- defaultHostCookieConfig: () => defaultHostCookieConfig,
28
- defaultSecureCookieConfig: () => defaultSecureCookieConfig,
29
- defaultStandardCookieConfig: () => defaultStandardCookieConfig,
30
- defineDefaultCookieOptions: () => defineDefaultCookieOptions,
31
- expireCookie: () => expireCookie,
32
- expiredCookieOptions: () => expiredCookieOptions,
33
- getCookie: () => getCookie,
34
- oauthCookie: () => oauthCookie,
35
- parse: () => import_cookie2.parse,
36
- secureCookieOptions: () => secureCookieOptions,
37
- setCookie: () => setCookie
38
- });
39
- module.exports = __toCommonJS(cookie_exports);
40
- var import_cookie = require("cookie");
22
+ COOKIE_NAME: () => COOKIE_NAME,
23
+ createSessionCookie: () => createSessionCookie,
24
+ defaultCookieConfig: () => defaultCookieConfig,
25
+ defaultCookieOptions: () => defaultCookieOptions,
26
+ defaultHostCookieConfig: () => defaultHostCookieConfig,
27
+ defaultSecureCookieConfig: () => defaultSecureCookieConfig,
28
+ defaultStandardCookieConfig: () => defaultStandardCookieConfig,
29
+ defineDefaultCookieOptions: () => defineDefaultCookieOptions,
30
+ expireCookie: () => expireCookie,
31
+ expiredCookieOptions: () => expiredCookieOptions,
32
+ getCookie: () => getCookie,
33
+ oauthCookie: () => oauthCookie,
34
+ parse: () => import_cookie2.parse,
35
+ secureCookieOptions: () => secureCookieOptions,
36
+ setCookie: () => setCookie,
37
+ })
38
+ module.exports = __toCommonJS(cookie_exports)
39
+ var import_cookie = require("cookie")
41
40
 
42
41
  // src/error.ts
43
42
  var AuthError = class extends Error {
44
- constructor(type, message) {
45
- super(message);
46
- this.type = type;
47
- this.name = "AuthError";
48
- }
49
- };
43
+ constructor(type, message) {
44
+ super(message)
45
+ this.type = type
46
+ this.name = "AuthError"
47
+ }
48
+ }
50
49
 
51
50
  // src/assert.ts
52
51
  var isRequest = (value) => {
53
- return typeof Request !== "undefined" && value instanceof Request;
54
- };
52
+ return typeof Request !== "undefined" && value instanceof Request
53
+ }
55
54
 
56
55
  // src/cookie.ts
57
- var import_cookie2 = require("cookie");
58
- var COOKIE_NAME = "aura-auth";
56
+ var import_cookie2 = require("cookie")
57
+ var COOKIE_NAME = "aura-auth"
59
58
  var defaultCookieOptions = {
60
- httpOnly: true,
61
- sameSite: "lax",
62
- path: "/",
63
- maxAge: 60 * 60 * 24 * 15
64
- };
59
+ httpOnly: true,
60
+ sameSite: "lax",
61
+ path: "/",
62
+ maxAge: 60 * 60 * 24 * 15,
63
+ }
65
64
  var defaultCookieConfig = {
66
- strategy: "standard",
67
- name: COOKIE_NAME,
68
- options: defaultCookieOptions
69
- };
65
+ strategy: "standard",
66
+ name: COOKIE_NAME,
67
+ options: defaultCookieOptions,
68
+ }
70
69
  var defaultStandardCookieConfig = {
71
- secure: false,
72
- httpOnly: true,
73
- prefix: ""
74
- };
70
+ secure: false,
71
+ httpOnly: true,
72
+ prefix: "",
73
+ }
75
74
  var defaultSecureCookieConfig = {
76
- secure: true,
77
- prefix: "__Secure-"
78
- };
75
+ secure: true,
76
+ prefix: "__Secure-",
77
+ }
79
78
  var defaultHostCookieConfig = {
80
- secure: true,
81
- prefix: "__Host-",
82
- path: "/",
83
- domain: void 0
84
- };
79
+ secure: true,
80
+ prefix: "__Host-",
81
+ path: "/",
82
+ domain: void 0,
83
+ }
85
84
  var expiredCookieOptions = {
86
- ...defaultCookieOptions,
87
- expires: /* @__PURE__ */ new Date(0),
88
- maxAge: 0
89
- };
90
- var defineDefaultCookieOptions = (options) => {
91
- return {
92
- name: options?.name ?? COOKIE_NAME,
93
- prefix: options?.prefix ?? (options?.secure ? "__Secure-" : ""),
94
85
  ...defaultCookieOptions,
95
- ...options
96
- };
97
- };
86
+ expires: /* @__PURE__ */ new Date(0),
87
+ maxAge: 0,
88
+ }
89
+ var defineDefaultCookieOptions = (options) => {
90
+ return {
91
+ name: options?.name ?? COOKIE_NAME,
92
+ prefix: options?.prefix ?? (options?.secure ? "__Secure-" : ""),
93
+ ...defaultCookieOptions,
94
+ ...options,
95
+ }
96
+ }
98
97
  var setCookie = (cookieName, value, options) => {
99
- const { prefix, name } = defineDefaultCookieOptions(options);
100
- const cookieNameWithPrefix = `${prefix}${name}.${cookieName}`;
101
- return (0, import_cookie.serialize)(cookieNameWithPrefix, value, {
102
- ...defaultCookieOptions,
103
- ...options
104
- });
105
- };
98
+ const { prefix, name } = defineDefaultCookieOptions(options)
99
+ const cookieNameWithPrefix = `${prefix}${name}.${cookieName}`
100
+ return (0, import_cookie.serialize)(cookieNameWithPrefix, value, {
101
+ ...defaultCookieOptions,
102
+ ...options,
103
+ })
104
+ }
106
105
  var getCookie = (petition, cookie, options, optional = false) => {
107
- const cookies = isRequest(petition) ? petition.headers.get("Cookie") : petition.headers.getSetCookie().join("; ");
108
- if (!cookies) {
109
- if (optional) {
110
- return "";
106
+ const cookies = isRequest(petition) ? petition.headers.get("Cookie") : petition.headers.getSetCookie().join("; ")
107
+ if (!cookies) {
108
+ if (optional) {
109
+ return ""
110
+ }
111
+ throw new AuthError("invalid_request", "No cookies found. There is no active session")
111
112
  }
112
- throw new AuthError("invalid_request", "No cookies found. There is no active session");
113
- }
114
- const { name, prefix } = defineDefaultCookieOptions(options);
115
- const parsedCookies = (0, import_cookie.parse)(cookies);
116
- const value = parsedCookies[`${prefix}${name}.${cookie}`];
117
- if (value === void 0) {
118
- if (optional) {
119
- return "";
113
+ const { name, prefix } = defineDefaultCookieOptions(options)
114
+ const parsedCookies = (0, import_cookie.parse)(cookies)
115
+ const value = parsedCookies[`${prefix}${name}.${cookie}`]
116
+ if (value === void 0) {
117
+ if (optional) {
118
+ return ""
119
+ }
120
+ throw new AuthError("invalid_request", `Cookie "${cookie}" not found. There is no active session`)
120
121
  }
121
- throw new AuthError("invalid_request", `Cookie "${cookie}" not found. There is no active session`);
122
- }
123
- return value;
124
- };
122
+ return value
123
+ }
125
124
  var createSessionCookie = async (session, cookieOptions, jose) => {
126
- try {
127
- const encoded = await jose.encodeJWT(session);
128
- return setCookie("sessionToken", encoded, cookieOptions);
129
- } catch (error) {
130
- throw new AuthError("server_error", "Failed to create session cookie", { cause: error });
131
- }
132
- };
125
+ try {
126
+ const encoded = await jose.encodeJWT(session)
127
+ return setCookie("sessionToken", encoded, cookieOptions)
128
+ } catch (error) {
129
+ throw new AuthError("server_error", "Failed to create session cookie", { cause: error })
130
+ }
131
+ }
133
132
  var secureCookieOptions = (request, cookieOptions, trustedProxyHeaders) => {
134
- const name = cookieOptions.name ?? COOKIE_NAME;
135
- const isSecure = trustedProxyHeaders ? request.url.startsWith("https://") || request.headers.get("X-Forwarded-Proto") === "https" || request.headers.get("Forwarded")?.includes("proto=https") : request.url.startsWith("https://");
136
- if (!cookieOptions.options?.httpOnly) {
137
- console.warn(
138
- "[WARNING]: Cookie is configured without HttpOnly. This allows JavaScript access via document.cookie and increases XSS risk."
139
- );
140
- }
141
- if (cookieOptions.options?.domain === "*") {
142
- console.warn("[WARNING]: Cookie 'Domain' is set to '*', which is insecure. Avoid wildcard domains.");
143
- }
144
- if (!isSecure) {
145
- const options = cookieOptions.options;
146
- if (options?.secure) {
147
- console.warn(
148
- "[WARNING]: The 'Secure' attribute will be disabled for this cookie. Serve over HTTPS to enforce Secure cookies."
149
- );
133
+ const name = cookieOptions.name ?? COOKIE_NAME
134
+ const isSecure = trustedProxyHeaders
135
+ ? request.url.startsWith("https://") ||
136
+ request.headers.get("X-Forwarded-Proto") === "https" ||
137
+ request.headers.get("Forwarded")?.includes("proto=https")
138
+ : request.url.startsWith("https://")
139
+ if (!cookieOptions.options?.httpOnly) {
140
+ console.warn(
141
+ "[WARNING]: Cookie is configured without HttpOnly. This allows JavaScript access via document.cookie and increases XSS risk."
142
+ )
150
143
  }
151
- if (options?.sameSite == "none") {
152
- console.warn("[WARNING]: SameSite=None without a secure connection can be blocked by browsers.");
144
+ if (cookieOptions.options?.domain === "*") {
145
+ console.warn("[WARNING]: Cookie 'Domain' is set to '*', which is insecure. Avoid wildcard domains.")
153
146
  }
154
- if (process.env.NODE_ENV === "production") {
155
- console.warn("[WARNING]: In production, ensure cookies are served over HTTPS to maintain security.");
147
+ if (!isSecure) {
148
+ const options = cookieOptions.options
149
+ if (options?.secure) {
150
+ console.warn(
151
+ "[WARNING]: The 'Secure' attribute will be disabled for this cookie. Serve over HTTPS to enforce Secure cookies."
152
+ )
153
+ }
154
+ if (options?.sameSite == "none") {
155
+ console.warn("[WARNING]: SameSite=None without a secure connection can be blocked by browsers.")
156
+ }
157
+ if (process.env.NODE_ENV === "production") {
158
+ console.warn("[WARNING]: In production, ensure cookies are served over HTTPS to maintain security.")
159
+ }
160
+ return {
161
+ ...defaultCookieOptions,
162
+ ...cookieOptions.options,
163
+ sameSite: options?.sameSite === "none" ? "lax" : (options?.sameSite ?? "lax"),
164
+ ...defaultStandardCookieConfig,
165
+ name,
166
+ }
156
167
  }
157
- return {
158
- ...defaultCookieOptions,
159
- ...cookieOptions.options,
160
- sameSite: options?.sameSite === "none" ? "lax" : options?.sameSite ?? "lax",
161
- ...defaultStandardCookieConfig,
162
- name
163
- };
164
- }
165
- return cookieOptions.strategy === "host" ? {
166
- ...defaultCookieOptions,
167
- ...cookieOptions.options,
168
- ...defaultHostCookieConfig,
169
- name
170
- } : { ...defaultCookieOptions, ...cookieOptions.options, ...defaultSecureCookieConfig, name };
171
- };
168
+ return cookieOptions.strategy === "host"
169
+ ? {
170
+ ...defaultCookieOptions,
171
+ ...cookieOptions.options,
172
+ ...defaultHostCookieConfig,
173
+ name,
174
+ }
175
+ : { ...defaultCookieOptions, ...cookieOptions.options, ...defaultSecureCookieConfig, name }
176
+ }
172
177
  var expireCookie = (name, options) => {
173
- return setCookie(name, "", { ...options, ...expiredCookieOptions });
174
- };
178
+ return setCookie(name, "", { ...options, ...expiredCookieOptions })
179
+ }
175
180
  var oauthCookie = (options) => {
176
- return {
177
- ...options,
178
- secure: options.secure,
179
- httpOnly: options.httpOnly,
180
- maxAge: 5 * 60,
181
- expires: new Date(Date.now() + 5 * 60 * 1e3)
182
- };
183
- };
181
+ return {
182
+ ...options,
183
+ secure: options.secure,
184
+ httpOnly: options.httpOnly,
185
+ maxAge: 5 * 60,
186
+ expires: new Date(Date.now() + 5 * 60 * 1e3),
187
+ }
188
+ }
184
189
  // Annotate the CommonJS export names for ESM import in node:
185
- 0 && (module.exports = {
186
- COOKIE_NAME,
187
- createSessionCookie,
188
- defaultCookieConfig,
189
- defaultCookieOptions,
190
- defaultHostCookieConfig,
191
- defaultSecureCookieConfig,
192
- defaultStandardCookieConfig,
193
- defineDefaultCookieOptions,
194
- expireCookie,
195
- expiredCookieOptions,
196
- getCookie,
197
- oauthCookie,
198
- parse,
199
- secureCookieOptions,
200
- setCookie
201
- });
190
+ 0 &&
191
+ (module.exports = {
192
+ COOKIE_NAME,
193
+ createSessionCookie,
194
+ defaultCookieConfig,
195
+ defaultCookieOptions,
196
+ defaultHostCookieConfig,
197
+ defaultSecureCookieConfig,
198
+ defaultStandardCookieConfig,
199
+ defineDefaultCookieOptions,
200
+ expireCookie,
201
+ expiredCookieOptions,
202
+ getCookie,
203
+ oauthCookie,
204
+ parse,
205
+ secureCookieOptions,
206
+ setCookie,
207
+ })
package/dist/cookie.d.ts CHANGED
@@ -1,40 +1,40 @@
1
- import { SerializeOptions } from 'cookie';
2
- export { parse } from 'cookie';
3
- import { JWTPayload } from '@aura-stack/jose/jose';
4
- import { C as CookieConfig, a as CookieConfigInternal, b as CookieName, A as AuthRuntimeConfig } from './index-DpfbvTZ_.js';
5
- import { LiteralUnion } from './@types/utility.js';
6
- import 'zod/v4';
7
- import './schemas.js';
8
- import 'zod/v4/core';
1
+ import { SerializeOptions } from "cookie"
2
+ export { parse } from "cookie"
3
+ import { JWTPayload } from "@aura-stack/jose/jose"
4
+ import { C as CookieConfig, a as CookieConfigInternal, b as CookieName, A as AuthRuntimeConfig } from "./index-DpfbvTZ_.js"
5
+ import { LiteralUnion } from "./@types/utility.js"
6
+ import "zod/v4"
7
+ import "./schemas.js"
8
+ import "zod/v4/core"
9
9
 
10
10
  /**
11
11
  * Prefix for all cookies set by Aura Auth.
12
12
  */
13
- declare const COOKIE_NAME = "aura-auth";
13
+ declare const COOKIE_NAME = "aura-auth"
14
14
  /**
15
15
  * Default cookie options used by Aura Auth.
16
16
  */
17
- declare const defaultCookieOptions: SerializeOptions;
17
+ declare const defaultCookieOptions: SerializeOptions
18
18
  /**
19
19
  * Default cookie options for "standard" cookies.
20
20
  */
21
- declare const defaultCookieConfig: CookieConfig;
22
- declare const defaultStandardCookieConfig: CookieConfigInternal;
21
+ declare const defaultCookieConfig: CookieConfig
22
+ declare const defaultStandardCookieConfig: CookieConfigInternal
23
23
  /**
24
24
  * Default cookie options for "secure" cookies.
25
25
  * @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__secure-prefix
26
26
  */
27
- declare const defaultSecureCookieConfig: CookieConfigInternal;
27
+ declare const defaultSecureCookieConfig: CookieConfigInternal
28
28
  /**
29
29
  * Default cookie options for "host" cookies.
30
30
  * @see https://httpwg.org/http-extensions/draft-ietf-httpbis-rfc6265bis.html#name-the-__host-prefix
31
31
  */
32
- declare const defaultHostCookieConfig: CookieConfigInternal;
32
+ declare const defaultHostCookieConfig: CookieConfigInternal
33
33
  /**
34
34
  * Cookie options for expired cookies.
35
35
  */
36
- declare const expiredCookieOptions: SerializeOptions;
37
- declare const defineDefaultCookieOptions: (options?: CookieConfigInternal) => CookieConfigInternal;
36
+ declare const expiredCookieOptions: SerializeOptions
37
+ declare const defineDefaultCookieOptions: (options?: CookieConfigInternal) => CookieConfigInternal
38
38
  /**
39
39
  * Set a cookie with the given name, value and `CookieOptionsInternal`; supports secure
40
40
  * cookies with the `__Secure-` and `__Host-` prefixes.
@@ -42,7 +42,7 @@ declare const defineDefaultCookieOptions: (options?: CookieConfigInternal) => Co
42
42
  * Cookie attributes are serialized in the following order:
43
43
  * Expires, Max-Age, Domain, Path, Secure, HttpOnly, SameSite, Partitioned, Priority.
44
44
  */
45
- declare const setCookie: (cookieName: LiteralUnion<CookieName>, value: string, options?: CookieConfigInternal) => string;
45
+ declare const setCookie: (cookieName: LiteralUnion<CookieName>, value: string, options?: CookieConfigInternal) => string
46
46
  /**
47
47
  * Get a cookie by name from the request.
48
48
  *
@@ -52,7 +52,12 @@ declare const setCookie: (cookieName: LiteralUnion<CookieName>, value: string, o
52
52
  * @param optional If true, returns an empty string instead of throwing an error when the cookie is not found
53
53
  * @returns The value of the cookie or undefined if not found
54
54
  */
55
- declare const getCookie: (petition: Request | Response, cookie: LiteralUnion<CookieName>, options?: CookieConfigInternal, optional?: boolean) => string;
55
+ declare const getCookie: (
56
+ petition: Request | Response,
57
+ cookie: LiteralUnion<CookieName>,
58
+ options?: CookieConfigInternal,
59
+ optional?: boolean
60
+ ) => string
56
61
  /**
57
62
  * Create a session cookie containing a signed and encrypted JWT, using the
58
63
  * `@aura-stack/jose` package for the encoding.
@@ -60,7 +65,11 @@ declare const getCookie: (petition: Request | Response, cookie: LiteralUnion<Coo
60
65
  * @param session - The JWT payload to be encoded in the session cookie
61
66
  * @returns The serialized session cookie string
62
67
  */
63
- declare const createSessionCookie: (session: JWTPayload, cookieOptions: CookieConfigInternal, jose: AuthRuntimeConfig["jose"]) => Promise<string>;
68
+ declare const createSessionCookie: (
69
+ session: JWTPayload,
70
+ cookieOptions: CookieConfigInternal,
71
+ jose: AuthRuntimeConfig["jose"]
72
+ ) => Promise<string>
64
73
  /**
65
74
  * Defines the cookie configuration based on the request security and cookie options passed
66
75
  * in the Aura Auth configuration (`createAuth` function). This function ensures the correct
@@ -73,7 +82,11 @@ declare const createSessionCookie: (session: JWTPayload, cookieOptions: CookieCo
73
82
  * @param cookieOptions Cookie options from the Aura Auth configuration
74
83
  * @returns The finalized cookie options to be used for setting cookies
75
84
  */
76
- declare const secureCookieOptions: (request: Request, cookieOptions: CookieConfig, trustedProxyHeaders?: boolean) => CookieConfigInternal;
85
+ declare const secureCookieOptions: (
86
+ request: Request,
87
+ cookieOptions: CookieConfig,
88
+ trustedProxyHeaders?: boolean
89
+ ) => CookieConfigInternal
77
90
  /**
78
91
  * Expire a cookie by setting its value to an empty string and applying expired cookie options.
79
92
  *
@@ -81,13 +94,28 @@ declare const secureCookieOptions: (request: Request, cookieOptions: CookieConfi
81
94
  * @param options cookie options obtained from secureCookieOptions
82
95
  * @returns formatted cookie options for an expired cookie
83
96
  */
84
- declare const expireCookie: (name: LiteralUnion<CookieName>, options: CookieConfigInternal) => string;
97
+ declare const expireCookie: (name: LiteralUnion<CookieName>, options: CookieConfigInternal) => string
85
98
  /**
86
99
  * Set OAuth-specific cookie options, including a short maxAge of 5 minutes.
87
100
  *
88
101
  * @param options cookie options obtained from secureCookieOptions
89
102
  * @returns formatted cookie options for OAuth cookies
90
103
  */
91
- declare const oauthCookie: (options: CookieConfigInternal) => CookieConfigInternal;
104
+ declare const oauthCookie: (options: CookieConfigInternal) => CookieConfigInternal
92
105
 
93
- export { COOKIE_NAME, createSessionCookie, defaultCookieConfig, defaultCookieOptions, defaultHostCookieConfig, defaultSecureCookieConfig, defaultStandardCookieConfig, defineDefaultCookieOptions, expireCookie, expiredCookieOptions, getCookie, oauthCookie, secureCookieOptions, setCookie };
106
+ export {
107
+ COOKIE_NAME,
108
+ createSessionCookie,
109
+ defaultCookieConfig,
110
+ defaultCookieOptions,
111
+ defaultHostCookieConfig,
112
+ defaultSecureCookieConfig,
113
+ defaultStandardCookieConfig,
114
+ defineDefaultCookieOptions,
115
+ expireCookie,
116
+ expiredCookieOptions,
117
+ getCookie,
118
+ oauthCookie,
119
+ secureCookieOptions,
120
+ setCookie,
121
+ }
package/dist/cookie.js CHANGED
@@ -1,36 +1,36 @@
1
1
  import {
2
- COOKIE_NAME,
3
- createSessionCookie,
4
- defaultCookieConfig,
5
- defaultCookieOptions,
6
- defaultHostCookieConfig,
7
- defaultSecureCookieConfig,
8
- defaultStandardCookieConfig,
9
- defineDefaultCookieOptions,
10
- expireCookie,
11
- expiredCookieOptions,
12
- getCookie,
13
- oauthCookie,
14
- parse,
15
- secureCookieOptions,
16
- setCookie
17
- } from "./chunk-ZV4BH47P.js";
18
- import "./chunk-6SM22VVJ.js";
19
- import "./chunk-FJUDBLCP.js";
2
+ COOKIE_NAME,
3
+ createSessionCookie,
4
+ defaultCookieConfig,
5
+ defaultCookieOptions,
6
+ defaultHostCookieConfig,
7
+ defaultSecureCookieConfig,
8
+ defaultStandardCookieConfig,
9
+ defineDefaultCookieOptions,
10
+ expireCookie,
11
+ expiredCookieOptions,
12
+ getCookie,
13
+ oauthCookie,
14
+ parse,
15
+ secureCookieOptions,
16
+ setCookie,
17
+ } from "./chunk-ZV4BH47P.js"
18
+ import "./chunk-6SM22VVJ.js"
19
+ import "./chunk-FJUDBLCP.js"
20
20
  export {
21
- COOKIE_NAME,
22
- createSessionCookie,
23
- defaultCookieConfig,
24
- defaultCookieOptions,
25
- defaultHostCookieConfig,
26
- defaultSecureCookieConfig,
27
- defaultStandardCookieConfig,
28
- defineDefaultCookieOptions,
29
- expireCookie,
30
- expiredCookieOptions,
31
- getCookie,
32
- oauthCookie,
33
- parse,
34
- secureCookieOptions,
35
- setCookie
36
- };
21
+ COOKIE_NAME,
22
+ createSessionCookie,
23
+ defaultCookieConfig,
24
+ defaultCookieOptions,
25
+ defaultHostCookieConfig,
26
+ defaultSecureCookieConfig,
27
+ defaultStandardCookieConfig,
28
+ defineDefaultCookieOptions,
29
+ expireCookie,
30
+ expiredCookieOptions,
31
+ getCookie,
32
+ oauthCookie,
33
+ parse,
34
+ secureCookieOptions,
35
+ setCookie,
36
+ }