@aura-stack/auth 0.1.0-rc.9 → 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
package/dist/cookie.cjs CHANGED
@@ -1,207 +1,201 @@
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) __defProp(target, name, { get: all[name], enumerable: true })
8
- }
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
9
10
  var __copyProps = (to, from, except, desc) => {
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)
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);
18
19
 
19
20
  // src/cookie.ts
20
- var cookie_exports = {}
21
+ var cookie_exports = {};
21
22
  __export(cookie_exports, {
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")
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");
40
41
 
41
42
  // src/error.ts
42
43
  var AuthError = class extends Error {
43
- constructor(type, message) {
44
- super(message)
45
- this.type = type
46
- this.name = "AuthError"
47
- }
48
- }
44
+ constructor(type, message) {
45
+ super(message);
46
+ this.type = type;
47
+ this.name = "AuthError";
48
+ }
49
+ };
49
50
 
50
51
  // src/assert.ts
51
52
  var isRequest = (value) => {
52
- return typeof Request !== "undefined" && value instanceof Request
53
- }
53
+ return typeof Request !== "undefined" && value instanceof Request;
54
+ };
54
55
 
55
56
  // src/cookie.ts
56
- var import_cookie2 = require("cookie")
57
- var COOKIE_NAME = "aura-auth"
57
+ var import_cookie2 = require("cookie");
58
+ var COOKIE_NAME = "aura-auth";
58
59
  var defaultCookieOptions = {
59
- httpOnly: true,
60
- sameSite: "lax",
61
- path: "/",
62
- maxAge: 60 * 60 * 24 * 15,
63
- }
60
+ httpOnly: true,
61
+ sameSite: "lax",
62
+ path: "/",
63
+ maxAge: 60 * 60 * 24 * 15
64
+ };
64
65
  var defaultCookieConfig = {
65
- strategy: "standard",
66
- name: COOKIE_NAME,
67
- options: defaultCookieOptions,
68
- }
66
+ strategy: "standard",
67
+ name: COOKIE_NAME,
68
+ options: defaultCookieOptions
69
+ };
69
70
  var defaultStandardCookieConfig = {
70
- secure: false,
71
- httpOnly: true,
72
- prefix: "",
73
- }
71
+ secure: false,
72
+ httpOnly: true,
73
+ prefix: ""
74
+ };
74
75
  var defaultSecureCookieConfig = {
75
- secure: true,
76
- prefix: "__Secure-",
77
- }
76
+ secure: true,
77
+ prefix: "__Secure-"
78
+ };
78
79
  var defaultHostCookieConfig = {
79
- secure: true,
80
- prefix: "__Host-",
81
- path: "/",
82
- domain: void 0,
83
- }
80
+ secure: true,
81
+ prefix: "__Host-",
82
+ path: "/",
83
+ domain: void 0
84
+ };
84
85
  var expiredCookieOptions = {
85
- ...defaultCookieOptions,
86
- expires: /* @__PURE__ */ new Date(0),
87
- maxAge: 0,
88
- }
86
+ ...defaultCookieOptions,
87
+ expires: /* @__PURE__ */ new Date(0),
88
+ maxAge: 0
89
+ };
89
90
  var defineDefaultCookieOptions = (options) => {
90
- return {
91
- name: options?.name ?? COOKIE_NAME,
92
- prefix: options?.prefix ?? (options?.secure ? "__Secure-" : ""),
93
- ...defaultCookieOptions,
94
- ...options,
95
- }
96
- }
91
+ return {
92
+ name: options?.name ?? COOKIE_NAME,
93
+ prefix: options?.prefix ?? (options?.secure ? "__Secure-" : ""),
94
+ ...defaultCookieOptions,
95
+ ...options
96
+ };
97
+ };
97
98
  var setCookie = (cookieName, value, options) => {
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
- }
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
+ };
105
106
  var getCookie = (petition, cookie, options, optional = false) => {
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")
107
+ const cookies = isRequest(petition) ? petition.headers.get("Cookie") : petition.headers.getSetCookie().join("; ");
108
+ if (!cookies) {
109
+ if (optional) {
110
+ return "";
112
111
  }
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`)
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 "";
121
120
  }
122
- return value
123
- }
121
+ throw new AuthError("invalid_request", `Cookie "${cookie}" not found. There is no active session`);
122
+ }
123
+ return value;
124
+ };
124
125
  var createSessionCookie = async (session, cookieOptions, jose) => {
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
- }
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
+ };
132
133
  var secureCookieOptions = (request, cookieOptions, trustedProxyHeaders) => {
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
- )
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
+ );
143
150
  }
144
- if (cookieOptions.options?.domain === "*") {
145
- console.warn("[WARNING]: Cookie 'Domain' is set to '*', which is insecure. Avoid wildcard domains.")
151
+ if (options?.sameSite == "none") {
152
+ console.warn("[WARNING]: SameSite=None without a secure connection can be blocked by browsers.");
146
153
  }
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
- }
154
+ if (process.env.NODE_ENV === "production") {
155
+ console.warn("[WARNING]: In production, ensure cookies are served over HTTPS to maintain security.");
167
156
  }
168
- return cookieOptions.strategy === "host"
169
- ? {
170
- ...defaultCookieOptions,
171
- ...cookieOptions.options,
172
- ...defaultHostCookieConfig,
173
- name,
174
- }
175
- : { ...defaultCookieOptions, ...cookieOptions.options, ...defaultSecureCookieConfig, name }
176
- }
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
+ };
177
172
  var expireCookie = (name, options) => {
178
- return setCookie(name, "", { ...options, ...expiredCookieOptions })
179
- }
173
+ return setCookie(name, "", { ...options, ...expiredCookieOptions });
174
+ };
180
175
  var oauthCookie = (options) => {
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
- }
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
+ };
189
184
  // Annotate the CommonJS export names for ESM import in node:
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
- })
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
+ });
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,12 +52,7 @@ 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: (
56
- petition: Request | Response,
57
- cookie: LiteralUnion<CookieName>,
58
- options?: CookieConfigInternal,
59
- optional?: boolean
60
- ) => string
55
+ declare const getCookie: (petition: Request | Response, cookie: LiteralUnion<CookieName>, options?: CookieConfigInternal, optional?: boolean) => string;
61
56
  /**
62
57
  * Create a session cookie containing a signed and encrypted JWT, using the
63
58
  * `@aura-stack/jose` package for the encoding.
@@ -65,11 +60,7 @@ declare const getCookie: (
65
60
  * @param session - The JWT payload to be encoded in the session cookie
66
61
  * @returns The serialized session cookie string
67
62
  */
68
- declare const createSessionCookie: (
69
- session: JWTPayload,
70
- cookieOptions: CookieConfigInternal,
71
- jose: AuthRuntimeConfig["jose"]
72
- ) => Promise<string>
63
+ declare const createSessionCookie: (session: JWTPayload, cookieOptions: CookieConfigInternal, jose: AuthRuntimeConfig["jose"]) => Promise<string>;
73
64
  /**
74
65
  * Defines the cookie configuration based on the request security and cookie options passed
75
66
  * in the Aura Auth configuration (`createAuth` function). This function ensures the correct
@@ -82,11 +73,7 @@ declare const createSessionCookie: (
82
73
  * @param cookieOptions Cookie options from the Aura Auth configuration
83
74
  * @returns The finalized cookie options to be used for setting cookies
84
75
  */
85
- declare const secureCookieOptions: (
86
- request: Request,
87
- cookieOptions: CookieConfig,
88
- trustedProxyHeaders?: boolean
89
- ) => CookieConfigInternal
76
+ declare const secureCookieOptions: (request: Request, cookieOptions: CookieConfig, trustedProxyHeaders?: boolean) => CookieConfigInternal;
90
77
  /**
91
78
  * Expire a cookie by setting its value to an empty string and applying expired cookie options.
92
79
  *
@@ -94,28 +81,13 @@ declare const secureCookieOptions: (
94
81
  * @param options cookie options obtained from secureCookieOptions
95
82
  * @returns formatted cookie options for an expired cookie
96
83
  */
97
- declare const expireCookie: (name: LiteralUnion<CookieName>, options: CookieConfigInternal) => string
84
+ declare const expireCookie: (name: LiteralUnion<CookieName>, options: CookieConfigInternal) => string;
98
85
  /**
99
86
  * Set OAuth-specific cookie options, including a short maxAge of 5 minutes.
100
87
  *
101
88
  * @param options cookie options obtained from secureCookieOptions
102
89
  * @returns formatted cookie options for OAuth cookies
103
90
  */
104
- declare const oauthCookie: (options: CookieConfigInternal) => CookieConfigInternal
91
+ declare const oauthCookie: (options: CookieConfigInternal) => CookieConfigInternal;
105
92
 
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
- }
93
+ export { COOKIE_NAME, createSessionCookie, defaultCookieConfig, defaultCookieOptions, defaultHostCookieConfig, defaultSecureCookieConfig, defaultStandardCookieConfig, defineDefaultCookieOptions, expireCookie, expiredCookieOptions, getCookie, oauthCookie, secureCookieOptions, setCookie };
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
+ };