@aura-stack/auth 0.5.0 → 0.6.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 (215) hide show
  1. package/README.md +36 -1
  2. package/dist/@types/index.cjs +0 -18
  3. package/dist/@types/index.d.ts +2 -12
  4. package/dist/@types/index.js +0 -1
  5. package/dist/assert-B3iQSYlK.js +3 -0
  6. package/dist/assert-NJGroSJd.cjs +3 -0
  7. package/dist/client/index.cjs +1 -135
  8. package/dist/client/index.d.ts +11 -14
  9. package/dist/client/index.js +1 -10
  10. package/dist/crypto-Bz8nIciY.js +1 -0
  11. package/dist/crypto-CoXA5w_4.cjs +1 -0
  12. package/dist/env-bq387KyP.cjs +1 -0
  13. package/dist/env-nvh8QBNz.js +1 -0
  14. package/dist/errors-CCYPHuBO.cjs +1 -0
  15. package/dist/errors-DFWHOho6.js +1 -0
  16. package/dist/index-BkpwQ0l4.d.cts +2279 -0
  17. package/dist/index-nqLV2t91.d.ts +2279 -0
  18. package/dist/index.cjs +1 -2427
  19. package/dist/index.d.cts +2 -0
  20. package/dist/index.d.ts +2 -14
  21. package/dist/index.js +1 -59
  22. package/dist/logger-C59_CDMk.js +1 -0
  23. package/dist/logger-UnUhYL2V.cjs +1 -0
  24. package/dist/oauth/atlassian.cjs +1 -57
  25. package/dist/oauth/atlassian.d.ts +2 -12
  26. package/dist/oauth/atlassian.js +1 -6
  27. package/dist/oauth/bitbucket.cjs +1 -49
  28. package/dist/oauth/bitbucket.d.ts +2 -12
  29. package/dist/oauth/bitbucket.js +1 -6
  30. package/dist/oauth/discord.cjs +1 -57
  31. package/dist/oauth/discord.d.ts +2 -12
  32. package/dist/oauth/discord.js +1 -6
  33. package/dist/oauth/dropbox.cjs +1 -53
  34. package/dist/oauth/dropbox.d.ts +2 -12
  35. package/dist/oauth/dropbox.js +1 -6
  36. package/dist/oauth/figma.cjs +1 -49
  37. package/dist/oauth/figma.d.ts +2 -12
  38. package/dist/oauth/figma.js +1 -6
  39. package/dist/oauth/github.cjs +1 -49
  40. package/dist/oauth/github.d.ts +2 -12
  41. package/dist/oauth/github.js +1 -6
  42. package/dist/oauth/gitlab.cjs +1 -49
  43. package/dist/oauth/gitlab.d.ts +2 -12
  44. package/dist/oauth/gitlab.js +1 -6
  45. package/dist/oauth/index.cjs +1 -673
  46. package/dist/oauth/index.d.ts +2 -12
  47. package/dist/oauth/index.js +1 -68
  48. package/dist/oauth/mailchimp.cjs +1 -49
  49. package/dist/oauth/mailchimp.d.ts +2 -12
  50. package/dist/oauth/mailchimp.js +1 -6
  51. package/dist/oauth/notion.cjs +1 -131
  52. package/dist/oauth/notion.d.ts +2 -12
  53. package/dist/oauth/notion.js +1 -9
  54. package/dist/oauth/pinterest.cjs +1 -49
  55. package/dist/oauth/pinterest.d.ts +2 -12
  56. package/dist/oauth/pinterest.js +1 -6
  57. package/dist/oauth/spotify.cjs +1 -49
  58. package/dist/oauth/spotify.d.ts +2 -12
  59. package/dist/oauth/spotify.js +1 -6
  60. package/dist/oauth/strava.cjs +1 -49
  61. package/dist/oauth/strava.d.ts +2 -12
  62. package/dist/oauth/strava.js +1 -6
  63. package/dist/oauth/twitch.cjs +1 -95
  64. package/dist/oauth/twitch.d.ts +2 -12
  65. package/dist/oauth/twitch.js +1 -7
  66. package/dist/oauth/x.cjs +1 -49
  67. package/dist/oauth/x.d.ts +2 -12
  68. package/dist/oauth/x.js +1 -6
  69. package/dist/oauth-BntNm6aE.cjs +1 -0
  70. package/dist/oauth-DmHy9VrB.js +1 -0
  71. package/dist/shared/crypto.cjs +1 -0
  72. package/dist/shared/crypto.d.ts +47 -0
  73. package/dist/shared/crypto.js +1 -0
  74. package/dist/shared/identity.cjs +1 -0
  75. package/dist/shared/identity.d.ts +2 -0
  76. package/dist/shared/identity.js +1 -0
  77. package/dist/shared/index.cjs +1 -0
  78. package/dist/shared/index.d.ts +5 -0
  79. package/dist/shared/index.js +1 -0
  80. package/package.json +32 -9
  81. package/dist/@types/router.d.cjs +0 -1
  82. package/dist/@types/router.d.d.ts +0 -16
  83. package/dist/@types/router.d.js +0 -0
  84. package/dist/@types/utility.cjs +0 -18
  85. package/dist/@types/utility.d.ts +0 -6
  86. package/dist/@types/utility.js +0 -1
  87. package/dist/actions/callback/access-token.cjs +0 -250
  88. package/dist/actions/callback/access-token.d.ts +0 -33
  89. package/dist/actions/callback/access-token.js +0 -9
  90. package/dist/actions/callback/callback.cjs +0 -715
  91. package/dist/actions/callback/callback.d.ts +0 -42
  92. package/dist/actions/callback/callback.js +0 -18
  93. package/dist/actions/callback/userinfo.cjs +0 -283
  94. package/dist/actions/callback/userinfo.d.ts +0 -25
  95. package/dist/actions/callback/userinfo.js +0 -13
  96. package/dist/actions/csrfToken/csrfToken.cjs +0 -189
  97. package/dist/actions/csrfToken/csrfToken.d.ts +0 -7
  98. package/dist/actions/csrfToken/csrfToken.js +0 -13
  99. package/dist/actions/index.cjs +0 -1161
  100. package/dist/actions/index.d.ts +0 -17
  101. package/dist/actions/index.js +0 -39
  102. package/dist/actions/session/session.cjs +0 -188
  103. package/dist/actions/session/session.d.ts +0 -7
  104. package/dist/actions/session/session.js +0 -12
  105. package/dist/actions/signIn/authorization-url.cjs +0 -288
  106. package/dist/actions/signIn/authorization-url.d.ts +0 -31
  107. package/dist/actions/signIn/authorization-url.js +0 -16
  108. package/dist/actions/signIn/authorization.cjs +0 -281
  109. package/dist/actions/signIn/authorization.d.ts +0 -54
  110. package/dist/actions/signIn/authorization.js +0 -19
  111. package/dist/actions/signIn/signIn.cjs +0 -595
  112. package/dist/actions/signIn/signIn.d.ts +0 -42
  113. package/dist/actions/signIn/signIn.js +0 -16
  114. package/dist/actions/signOut/signOut.cjs +0 -492
  115. package/dist/actions/signOut/signOut.d.ts +0 -16
  116. package/dist/actions/signOut/signOut.js +0 -15
  117. package/dist/api/createApi.cjs +0 -750
  118. package/dist/api/createApi.d.ts +0 -12
  119. package/dist/api/createApi.js +0 -19
  120. package/dist/api/getSession.cjs +0 -141
  121. package/dist/api/getSession.d.ts +0 -16
  122. package/dist/api/getSession.js +0 -10
  123. package/dist/api/signIn.cjs +0 -549
  124. package/dist/api/signIn.d.ts +0 -26
  125. package/dist/api/signIn.js +0 -15
  126. package/dist/api/signOut.cjs +0 -279
  127. package/dist/api/signOut.d.ts +0 -16
  128. package/dist/api/signOut.js +0 -13
  129. package/dist/assert.cjs +0 -194
  130. package/dist/assert.d.ts +0 -37
  131. package/dist/assert.js +0 -26
  132. package/dist/chunk-2A5B7GWR.js +0 -125
  133. package/dist/chunk-2GQLSIJ2.js +0 -40
  134. package/dist/chunk-2IR674WX.js +0 -44
  135. package/dist/chunk-3J5TUH2I.js +0 -50
  136. package/dist/chunk-4RWSYUKX.js +0 -98
  137. package/dist/chunk-4YHJ4IEQ.js +0 -25
  138. package/dist/chunk-54CZPKR4.js +0 -25
  139. package/dist/chunk-5LZ7TOM3.js +0 -25
  140. package/dist/chunk-5X7JZMEF.js +0 -0
  141. package/dist/chunk-7BE46WWS.js +0 -88
  142. package/dist/chunk-7YYXFKLR.js +0 -35
  143. package/dist/chunk-C3A37LQC.js +0 -33
  144. package/dist/chunk-CITNGXDA.js +0 -31
  145. package/dist/chunk-CWX724AG.js +0 -78
  146. package/dist/chunk-D2CSIUKP.js +0 -74
  147. package/dist/chunk-E6G5YCI6.js +0 -25
  148. package/dist/chunk-EBAMFRB7.js +0 -34
  149. package/dist/chunk-EEE7UM5T.js +0 -25
  150. package/dist/chunk-FPCVZUVG.js +0 -37
  151. package/dist/chunk-FW4W3REU.js +0 -25
  152. package/dist/chunk-GNNBM2WJ.js +0 -83
  153. package/dist/chunk-IPKO6UQN.js +0 -25
  154. package/dist/chunk-ITQ7352M.js +0 -0
  155. package/dist/chunk-JOCGX3RP.js +0 -59
  156. package/dist/chunk-KBXWTD6E.js +0 -94
  157. package/dist/chunk-KMMAZFSJ.js +0 -25
  158. package/dist/chunk-LATR3NIV.js +0 -117
  159. package/dist/chunk-LAYPUDQF.js +0 -39
  160. package/dist/chunk-LDU7A2JE.js +0 -25
  161. package/dist/chunk-LX3TJ2TJ.js +0 -294
  162. package/dist/chunk-NHZBQNRR.js +0 -143
  163. package/dist/chunk-OVHNRULD.js +0 -33
  164. package/dist/chunk-PDP3PHB3.js +0 -127
  165. package/dist/chunk-PG7UYFG5.js +0 -0
  166. package/dist/chunk-PHYNROD4.js +0 -47
  167. package/dist/chunk-QQEKY4XP.js +0 -29
  168. package/dist/chunk-U4RK4LKJ.js +0 -348
  169. package/dist/chunk-U5663F2U.js +0 -70
  170. package/dist/chunk-UN7X6SU5.js +0 -53
  171. package/dist/chunk-UZQJJD6A.js +0 -100
  172. package/dist/chunk-V6LLEAR4.js +0 -80
  173. package/dist/chunk-WHNDRO3N.js +0 -50
  174. package/dist/chunk-XY5R3EHH.js +0 -204
  175. package/dist/chunk-ZNCZVF6U.js +0 -14
  176. package/dist/client/client.cjs +0 -135
  177. package/dist/client/client.d.ts +0 -85
  178. package/dist/client/client.js +0 -9
  179. package/dist/context.cjs +0 -1237
  180. package/dist/context.d.ts +0 -16
  181. package/dist/context.js +0 -28
  182. package/dist/cookie.cjs +0 -277
  183. package/dist/cookie.d.ts +0 -89
  184. package/dist/cookie.js +0 -30
  185. package/dist/createAuth.cjs +0 -2320
  186. package/dist/createAuth.d.ts +0 -12
  187. package/dist/createAuth.js +0 -48
  188. package/dist/env.cjs +0 -78
  189. package/dist/env.d.ts +0 -10
  190. package/dist/env.js +0 -12
  191. package/dist/errors.cjs +0 -102
  192. package/dist/errors.d.ts +0 -60
  193. package/dist/errors.js +0 -22
  194. package/dist/headers.cjs +0 -61
  195. package/dist/headers.d.ts +0 -33
  196. package/dist/headers.js +0 -12
  197. package/dist/index-_aXtxb_s.d.ts +0 -1377
  198. package/dist/jose.cjs +0 -166
  199. package/dist/jose.d.ts +0 -12
  200. package/dist/jose.js +0 -20
  201. package/dist/logger.cjs +0 -424
  202. package/dist/logger.d.ts +0 -12
  203. package/dist/logger.js +0 -17
  204. package/dist/request.cjs +0 -38
  205. package/dist/request.d.ts +0 -13
  206. package/dist/request.js +0 -6
  207. package/dist/schemas.cjs +0 -158
  208. package/dist/schemas.d.ts +0 -229
  209. package/dist/schemas.js +0 -24
  210. package/dist/secure.cjs +0 -170
  211. package/dist/secure.d.ts +0 -41
  212. package/dist/secure.js +0 -20
  213. package/dist/utils.cjs +0 -329
  214. package/dist/utils.d.ts +0 -35
  215. package/dist/utils.js +0 -36
@@ -1,281 +0,0 @@
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
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- 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);
19
-
20
- // src/actions/signIn/authorization.ts
21
- var authorization_exports = {};
22
- __export(authorization_exports, {
23
- createRedirectTo: () => createRedirectTo,
24
- createRedirectURI: () => createRedirectURI,
25
- createSignInURL: () => createSignInURL,
26
- getBaseURL: () => getBaseURL,
27
- getOriginURL: () => getOriginURL,
28
- getTrustedOrigins: () => getTrustedOrigins
29
- });
30
- module.exports = __toCommonJS(authorization_exports);
31
-
32
- // src/env.ts
33
- var import_meta = {};
34
- var env = new Proxy({}, {
35
- get(_, prop) {
36
- if (typeof prop !== "string") return void 0;
37
- const hasProperty = (process2) => {
38
- return process2 && Object.prototype.hasOwnProperty.call(process2, prop);
39
- };
40
- try {
41
- if (typeof process !== "undefined" && hasProperty(process.env)) {
42
- return process.env[prop];
43
- }
44
- if (typeof import_meta !== "undefined" && hasProperty(import_meta.env)) {
45
- return import_meta.env[prop];
46
- }
47
- if (typeof Deno !== "undefined" && Deno.env?.get) {
48
- return Deno.env.get(prop);
49
- }
50
- if (typeof Bun !== "undefined" && hasProperty(Bun.env)) {
51
- return Bun.env[prop];
52
- }
53
- const globalValue = globalThis[prop];
54
- return typeof globalValue === "string" ? globalValue : void 0;
55
- } catch {
56
- return void 0;
57
- }
58
- }
59
- });
60
- var getEnv = (key) => {
61
- const keys = [`AURA_AUTH_${key.toUpperCase()}`, `AURA_${key.toUpperCase()}`, `AUTH_${key.toUpperCase()}`, key.toUpperCase()];
62
- return env[keys.find((k) => env[k]) ?? ""];
63
- };
64
-
65
- // src/errors.ts
66
- var AuthInternalError = class extends Error {
67
- type = "AUTH_INTERNAL_ERROR";
68
- code;
69
- constructor(code, message, options) {
70
- super(message, options);
71
- this.code = code;
72
- this.name = new.target.name;
73
- Error.captureStackTrace(this, new.target);
74
- }
75
- };
76
-
77
- // src/utils.ts
78
- var import_router = require("@aura-stack/router");
79
-
80
- // src/assert.ts
81
- var import_crypto = require("@aura-stack/jose/crypto");
82
- var unsafeChars = [
83
- "<",
84
- ">",
85
- '"',
86
- "`",
87
- " ",
88
- "\r",
89
- "\n",
90
- " ",
91
- "\\",
92
- "%2F",
93
- "%5C",
94
- "%2f",
95
- "%5c",
96
- "\r\n",
97
- "%0A",
98
- "%0D",
99
- "%0a",
100
- "%0d",
101
- "..",
102
- "//",
103
- "///",
104
- "...",
105
- "%20",
106
- "\0"
107
- ];
108
- var isValidURL = (value) => {
109
- if (!new RegExp(/^https?:\/\/[^/]/).test(value)) {
110
- return false;
111
- }
112
- const match = value.match(/^(https?:\/\/)(.*)$/);
113
- if (!match) return false;
114
- const rest = match[2];
115
- for (const char of unsafeChars) {
116
- if (rest.includes(char)) return false;
117
- }
118
- const regex = /^https?:\/\/(?:[a-zA-Z0-9._-]+|localhost|\[[0-9a-fA-F:]+\])(?::\d{1,5})?(?:\/[a-zA-Z0-9._~!$&'()?#*+,;=:@-]*)*\/?$/;
119
- return regex.test(match[0]);
120
- };
121
- var isRelativeURL = (value) => {
122
- if (value.length > 100) return false;
123
- for (const char of unsafeChars) {
124
- if (value.includes(char)) return false;
125
- }
126
- const regex = /^\/[a-zA-Z0-9\-_\/.?&=#]*\/?$/;
127
- return regex.test(value);
128
- };
129
- var isSameOrigin = (origin, expected) => {
130
- const originURL = new URL(origin);
131
- const expectedURL = new URL(expected);
132
- return equals(originURL.origin, expectedURL.origin);
133
- };
134
- var patternToRegex = (pattern) => {
135
- try {
136
- if (pattern.length > 2048) return null;
137
- pattern = pattern.replace(/\\/g, "");
138
- const match = pattern.match(/^(https?):\/\/([a-zA-Z0-9.*-]{1,253})(?::(\d{1,5}|\*))?(?:\/.*)?$/);
139
- if (!match) return null;
140
- const [, protocol, host, port] = match;
141
- const hasWildcard = host.includes("*");
142
- if (hasWildcard && !host.startsWith("*.")) return null;
143
- if (hasWildcard && host.slice(2).includes("*")) return null;
144
- const domain = hasWildcard ? host.slice(2) : host;
145
- const escapedDomain = domain.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
146
- const hostRegex = hasWildcard ? `[^.]+\\.${escapedDomain}` : escapedDomain;
147
- const portRegex = port === "*" ? ":\\d{1,5}" : port ? `:${port}` : "";
148
- return new RegExp(`^${protocol}:\\/\\/${hostRegex}${portRegex}$`);
149
- } catch {
150
- return null;
151
- }
152
- };
153
- var isTrustedOrigin = (url, trustedOrigins) => {
154
- if (!isValidURL(url) || trustedOrigins.length === 0) return false;
155
- try {
156
- const urlOrigin = new URL(url).origin;
157
- for (const pattern of trustedOrigins) {
158
- const regex = patternToRegex(pattern);
159
- if (regex?.test(urlOrigin)) return true;
160
- try {
161
- if (isValidURL(pattern) && equals(new URL(pattern).origin, urlOrigin)) return true;
162
- } catch {
163
- }
164
- }
165
- } catch {
166
- }
167
- return false;
168
- };
169
-
170
- // src/utils.ts
171
- var equals = (a, b) => {
172
- if (a === null || b === null || a === void 0 || b === void 0) return false;
173
- return a === b;
174
- };
175
- var extractPath = (url) => {
176
- const pathRegex = /^https?:\/\/[a-zA-Z0-9_\-\.]+(:\d+)?(\/.*)$/;
177
- const match = url.match(pathRegex);
178
- return match && match[2] ? match[2] : "/";
179
- };
180
-
181
- // src/actions/signIn/authorization.ts
182
- var getTrustedOrigins = async (request, trustedOrigins) => {
183
- if (!trustedOrigins) return [];
184
- const raw = typeof trustedOrigins === "function" ? await trustedOrigins(request) : trustedOrigins;
185
- return Array.isArray(raw) ? raw : typeof raw === "string" ? [raw] : [];
186
- };
187
- var getBaseURL = async ({
188
- ctx,
189
- request,
190
- headers: headersInit
191
- }) => {
192
- const origin = getEnv("BASE_URL") || ctx?.baseURL;
193
- if (origin && origin !== "/") return origin;
194
- if (ctx?.trustedProxyHeaders) {
195
- const headers = headersInit && new Headers(headersInit) || request?.headers;
196
- const protocol = headers?.get("Forwarded")?.match(/proto=([^;]+)/i)?.[1] ?? headers?.get("X-Forwarded-Proto") ?? "http";
197
- const host = headers?.get("Host") ?? headers?.get("Forwarded")?.match(/host=([^;]+)/i)?.[1] ?? headers?.get("X-Forwarded-Host") ?? null;
198
- if (host) return `${protocol}://${host}`;
199
- throw new AuthInternalError(
200
- "INVALID_OAUTH_CONFIGURATION",
201
- "The URL cannot be constructed. Please set the BASE_URL environment variable or provide trusted proxy host headers."
202
- );
203
- }
204
- try {
205
- return new URL(request?.url ?? "not-found").origin;
206
- } catch (error) {
207
- throw new AuthInternalError(
208
- "INVALID_OAUTH_CONFIGURATION",
209
- "The URL cannot be constructed. Please set the BASE_URL environment variable or enable trustedProxyHeaders.",
210
- { cause: error }
211
- );
212
- }
213
- };
214
- var getOriginURL = async (request, context) => {
215
- const trustedOrigins = await getTrustedOrigins(request, context?.trustedOrigins);
216
- trustedOrigins.push(new URL(request.url).origin);
217
- const origin = await getBaseURL({ request, ctx: context });
218
- if (!isTrustedOrigin(origin, trustedOrigins)) {
219
- context?.logger?.log("UNTRUSTED_ORIGIN", { structuredData: { origin } });
220
- throw new AuthInternalError("UNTRUSTED_ORIGIN", "The constructed origin URL is not trusted.");
221
- }
222
- return origin;
223
- };
224
- var createRedirectURI = async (request, oauth, context) => {
225
- const origin = await getOriginURL(request, context);
226
- return `${origin}${context.basePath}/callback/${oauth}`;
227
- };
228
- var createSignInURL = async ({
229
- request,
230
- oauth,
231
- ctx,
232
- redirectTo
233
- }) => {
234
- const origin = await getOriginURL(request, ctx);
235
- const searchParams = new URLSearchParams();
236
- if (redirectTo !== void 0) searchParams.set("redirectTo", String(redirectTo));
237
- return `${origin}${ctx.basePath}/signIn/${oauth}?${searchParams.toString()}`;
238
- };
239
- var createRedirectTo = async (request, redirectTo, context) => {
240
- try {
241
- const headers = request.headers;
242
- const requestOrigin = await getOriginURL(request, context);
243
- const origins = await getTrustedOrigins(request, context?.trustedOrigins);
244
- const validateURL = (url) => {
245
- if (!isRelativeURL(url) && !isValidURL(url)) return "/";
246
- if (isRelativeURL(url)) return url;
247
- if (origins.length > 0) {
248
- if (isTrustedOrigin(url, origins)) {
249
- const urlOrigin = new URL(url).origin;
250
- for (const pattern of origins) {
251
- const regex = patternToRegex(pattern);
252
- if (regex?.test(urlOrigin)) {
253
- return isSameOrigin(url, request.url) ? extractPath(url) : url;
254
- }
255
- if (isValidURL(pattern) && equals(new URL(pattern).origin, urlOrigin)) return url;
256
- }
257
- }
258
- context?.logger?.log("OPEN_REDIRECT_ATTACK");
259
- return "/";
260
- }
261
- if (isSameOrigin(url, requestOrigin)) {
262
- return extractPath(url);
263
- }
264
- context?.logger?.log("OPEN_REDIRECT_ATTACK");
265
- return "/";
266
- };
267
- return validateURL(redirectTo ?? headers.get("Referer") ?? headers.get("Origin") ?? "/");
268
- } catch (error) {
269
- context?.logger?.log("POTENTIAL_OPEN_REDIRECT_ATTACK_DETECTED");
270
- return "/";
271
- }
272
- };
273
- // Annotate the CommonJS export names for ESM import in node:
274
- 0 && (module.exports = {
275
- createRedirectTo,
276
- createRedirectURI,
277
- createSignInURL,
278
- getBaseURL,
279
- getOriginURL,
280
- getTrustedOrigins
281
- });
@@ -1,54 +0,0 @@
1
- import { A as AuthConfig } from '../../index-_aXtxb_s.js';
2
- import { GlobalContext } from '@aura-stack/router';
3
- import 'zod';
4
- import '../../schemas.js';
5
- import 'zod/v4';
6
- import '@aura-stack/jose';
7
- import '@aura-stack/jose/jose';
8
- import '@aura-stack/jose/crypto';
9
- import '@aura-stack/router/cookie';
10
- import '../../@types/utility.js';
11
- import 'jose';
12
- import 'zod/v4/core';
13
-
14
- /**
15
- * Resolves trusted origins from config (array or function).
16
- */
17
- declare const getTrustedOrigins: (request: Request, trustedOrigins: AuthConfig["trustedOrigins"]) => Promise<string[]>;
18
- declare const getBaseURL: ({ ctx, request, headers: headersInit, }: {
19
- ctx?: GlobalContext;
20
- request?: Request;
21
- headers?: HeadersInit;
22
- }) => Promise<string>;
23
- declare const getOriginURL: (request: Request, context?: GlobalContext) => Promise<string>;
24
- /**
25
- * Creates the redirect URI for the OAuth callback based on the original request URL and the OAuth provider.
26
- *
27
- * @param requestURL - the original request URL
28
- * @param oauth - OAuth provider name
29
- * @param context - Global context containing configuration and utilities
30
- * @returns The redirect URI for the OAuth callback.
31
- */
32
- declare const createRedirectURI: (request: Request, oauth: string, context: GlobalContext) => Promise<string>;
33
- declare const createSignInURL: ({ request, oauth, ctx, redirectTo, }: {
34
- request: Request;
35
- oauth: string;
36
- ctx: GlobalContext;
37
- redirectTo?: string;
38
- }) => Promise<string>;
39
- /**
40
- * Verifies if the request's origin matches the expected origin. It accepts the redirectTo search
41
- * parameter for redirection. It checks the Referer and Origin headers and the request URL against
42
- * the trusted origins list. If they do not match, it returns "/" to avoid potential open redirect attacks.
43
- *
44
- * When `trustedOrigins` is provided, URLs are validated against that list. When not provided,
45
- * the request's derived origin (from request.url or proxy headers) is used as the only trusted origin.
46
- *
47
- * @param request The incoming request object
48
- * @param redirectTo Optional redirectTo parameter to override the referer
49
- * @param context Global context containing configuration and utilities
50
- * @returns A safe URL to redirect to after authentication, or "/" if the URL is not considered safe.
51
- */
52
- declare const createRedirectTo: (request: Request, redirectTo?: string, context?: GlobalContext) => Promise<string>;
53
-
54
- export { createRedirectTo, createRedirectURI, createSignInURL, getBaseURL, getOriginURL, getTrustedOrigins };
@@ -1,19 +0,0 @@
1
- import {
2
- createRedirectTo,
3
- createRedirectURI,
4
- createSignInURL,
5
- getBaseURL,
6
- getOriginURL,
7
- getTrustedOrigins
8
- } from "../../chunk-LATR3NIV.js";
9
- import "../../chunk-LX3TJ2TJ.js";
10
- import "../../chunk-WHNDRO3N.js";
11
- import "../../chunk-U5663F2U.js";
12
- export {
13
- createRedirectTo,
14
- createRedirectURI,
15
- createSignInURL,
16
- getBaseURL,
17
- getOriginURL,
18
- getTrustedOrigins
19
- };