@azlib/identity 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +119 -54
- package/dist/cookie-header-DptIxRmW.mjs +76 -0
- package/dist/cookie-header-DptIxRmW.mjs.map +1 -0
- package/dist/cookie-header-Dqd5k5BU.cjs +115 -0
- package/dist/cookie-header-LFWHKQ04.d.cts +86 -0
- package/dist/cookie-header-LFWHKQ04.d.cts.map +1 -0
- package/dist/cookie-header-LFWHKQ04.d.mts +86 -0
- package/dist/cookie-header-LFWHKQ04.d.mts.map +1 -0
- package/dist/{errors-CBbiRO2n.d.cts → errors-0Zh7EG06.d.cts} +4 -2
- package/dist/errors-0Zh7EG06.d.cts.map +1 -0
- package/dist/{errors-_OcodtdV.d.mts → errors-DVDEUk9-.d.mts} +4 -2
- package/dist/errors-DVDEUk9-.d.mts.map +1 -0
- package/dist/express.d.cts +3 -3
- package/dist/express.d.cts.map +1 -1
- package/dist/express.d.mts +3 -3
- package/dist/express.d.mts.map +1 -1
- package/dist/express.mjs.map +1 -1
- package/dist/{identity-Bz9RDOvT.mjs → identity-D0qyca_c.mjs} +37 -3
- package/dist/identity-D0qyca_c.mjs.map +1 -0
- package/dist/{identity-4eP45YIP.cjs → identity-Yz1BVkrM.cjs} +46 -0
- package/dist/{identity-router-D1xJ5H7y.d.cts → identity-router-BiratpJR.d.mts} +3 -3
- package/dist/identity-router-BiratpJR.d.mts.map +1 -0
- package/dist/{identity-router-tj3-teBI.d.mts → identity-router-D4oqYI60.d.cts} +3 -3
- package/dist/identity-router-D4oqYI60.d.cts.map +1 -0
- package/dist/{identity-service---OTann1.d.cts → identity-service-DE0Ffguz.d.cts} +3 -3
- package/dist/{identity-service---OTann1.d.cts.map → identity-service-DE0Ffguz.d.cts.map} +1 -1
- package/dist/{identity-service-WpOKb0MK.d.mts → identity-service-JtsoA6lv.d.mts} +3 -3
- package/dist/{identity-service-WpOKb0MK.d.mts.map → identity-service-JtsoA6lv.d.mts.map} +1 -1
- package/dist/identity-store-BRRahxcS.d.cts.map +1 -1
- package/dist/identity-store-BRRahxcS.d.mts.map +1 -1
- package/dist/index-CsYqHPvK.d.cts +54 -0
- package/dist/index-CsYqHPvK.d.cts.map +1 -0
- package/dist/index-LhSdoWEP.d.mts +54 -0
- package/dist/index-LhSdoWEP.d.mts.map +1 -0
- package/dist/index.cjs +11 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +3 -2
- package/dist/logger-CcCHJVVe.mjs.map +1 -1
- package/dist/nestjs.d.cts +3 -3
- package/dist/nestjs.d.cts.map +1 -1
- package/dist/nestjs.d.mts +3 -3
- package/dist/nestjs.d.mts.map +1 -1
- package/dist/nestjs.mjs.map +1 -1
- package/dist/next.cjs +285 -0
- package/dist/next.d.cts +58 -0
- package/dist/next.d.cts.map +1 -0
- package/dist/next.d.mts +58 -0
- package/dist/next.d.mts.map +1 -0
- package/dist/next.mjs +274 -0
- package/dist/next.mjs.map +1 -0
- package/dist/node.cjs +18 -19
- package/dist/node.d.cts +5 -4
- package/dist/node.d.cts.map +1 -1
- package/dist/node.d.mts +5 -4
- package/dist/node.d.mts.map +1 -1
- package/dist/node.mjs +10 -20
- package/dist/node.mjs.map +1 -1
- package/dist/test-utils.mjs.map +1 -1
- package/package.json +7 -7
- package/schema/model.ts +110 -22
- package/dist/errors-CBbiRO2n.d.cts.map +0 -1
- package/dist/errors-_OcodtdV.d.mts.map +0 -1
- package/dist/identity-Bz9RDOvT.mjs.map +0 -1
- package/dist/identity-router-D1xJ5H7y.d.cts.map +0 -1
- package/dist/identity-router-tj3-teBI.d.mts.map +0 -1
- package/dist/index-CpufYgyn.d.cts +0 -30
- package/dist/index-CpufYgyn.d.cts.map +0 -1
- package/dist/index-CpufYgyn.d.mts +0 -30
- package/dist/index-CpufYgyn.d.mts.map +0 -1
package/dist/next.cjs
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_errors = require("./errors-Bcjx9o6g.cjs");
|
|
3
|
+
const require_cookie_header = require("./cookie-header-Dqd5k5BU.cjs");
|
|
4
|
+
//#region core/next/cookies.ts
|
|
5
|
+
function maxAgeSeconds(expiresAt, now) {
|
|
6
|
+
return Math.max(0, Math.floor((expiresAt.getTime() - now.getTime()) / 1e3));
|
|
7
|
+
}
|
|
8
|
+
function writeAttributes(options, expiresAt, now) {
|
|
9
|
+
const attrs = require_cookie_header.resolveCookieAttributes(options);
|
|
10
|
+
return {
|
|
11
|
+
httpOnly: attrs.httpOnly,
|
|
12
|
+
secure: attrs.secure,
|
|
13
|
+
sameSite: attrs.sameSite,
|
|
14
|
+
path: attrs.path,
|
|
15
|
+
domain: attrs.domain,
|
|
16
|
+
maxAge: maxAgeSeconds(expiresAt, now),
|
|
17
|
+
expires: expiresAt
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Writes the access and refresh tokens as HttpOnly cookies.
|
|
22
|
+
* `maxAge` is in seconds (Next.js / `Set-Cookie` convention).
|
|
23
|
+
*/
|
|
24
|
+
function applyAuthCookies(cookies, tokens, options = {}, now = /* @__PURE__ */ new Date()) {
|
|
25
|
+
const names = require_cookie_header.resolveCookieNames(options);
|
|
26
|
+
cookies.set(names.access, tokens.accessToken, writeAttributes(options, tokens.accessTokenExpiresAt, now));
|
|
27
|
+
cookies.set(names.refresh, tokens.refreshToken, writeAttributes(options, tokens.refreshTokenExpiresAt, now));
|
|
28
|
+
}
|
|
29
|
+
/** Clears both identity cookies (logout or failed session). */
|
|
30
|
+
function clearAuthCookies(cookies, options = {}) {
|
|
31
|
+
const names = require_cookie_header.resolveCookieNames(options);
|
|
32
|
+
const attrs = require_cookie_header.resolveCookieAttributes(options);
|
|
33
|
+
const deleteOpts = {
|
|
34
|
+
path: attrs.path,
|
|
35
|
+
domain: attrs.domain
|
|
36
|
+
};
|
|
37
|
+
cookies.delete(names.access, deleteOpts);
|
|
38
|
+
cookies.delete(names.refresh, deleteOpts);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* In-memory {@link CookieStore} for tests and Fetch-based Route Handlers.
|
|
42
|
+
* Not for production browser storage.
|
|
43
|
+
*/
|
|
44
|
+
function createMemoryCookieStore(initial = {}) {
|
|
45
|
+
const values = new Map(Object.entries(initial).filter(([, value]) => value.length > 0));
|
|
46
|
+
return {
|
|
47
|
+
get(name) {
|
|
48
|
+
const value = values.get(name);
|
|
49
|
+
return value === void 0 ? void 0 : { value };
|
|
50
|
+
},
|
|
51
|
+
set(name, value) {
|
|
52
|
+
if (value.length === 0) {
|
|
53
|
+
values.delete(name);
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
values.set(name, value);
|
|
57
|
+
},
|
|
58
|
+
delete(name) {
|
|
59
|
+
values.delete(name);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** Builds a cookie store seeded from an incoming `Cookie` header. */
|
|
64
|
+
function cookieStoreFromHeader(header) {
|
|
65
|
+
return createMemoryCookieStore(Object.fromEntries(require_cookie_header.parseCookieHeader(header)));
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region core/next/session.ts
|
|
69
|
+
/**
|
|
70
|
+
* Resolves the current principal from identity cookies.
|
|
71
|
+
*
|
|
72
|
+
* - Valid access cookie → `service.authenticate`.
|
|
73
|
+
* - Expired/missing access + refresh cookie → `service.refresh` and rotate cookies.
|
|
74
|
+
* - Failure → clear cookies and return `null` (degrade to logged out).
|
|
75
|
+
*
|
|
76
|
+
* Call this where cookies can be written (Server Actions, Route Handlers). Refresh
|
|
77
|
+
* rotates the refresh token; skipping the write would invalidate the browser session.
|
|
78
|
+
*/
|
|
79
|
+
async function getIdentity(service, cookies, options = {}) {
|
|
80
|
+
const names = require_cookie_header.resolveCookieNames(options);
|
|
81
|
+
const access = require_cookie_header.readCookieValue(cookies, names.access);
|
|
82
|
+
const refresh = require_cookie_header.readCookieValue(cookies, names.refresh);
|
|
83
|
+
if (access) try {
|
|
84
|
+
return await service.authenticate(access);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
if (error instanceof require_errors.AccountUnavailableError) {
|
|
87
|
+
clearAuthCookies(cookies, options);
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
if (!(error instanceof require_errors.InvalidTokenError)) throw error;
|
|
91
|
+
}
|
|
92
|
+
if (!refresh) {
|
|
93
|
+
if (access) clearAuthCookies(cookies, options);
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
try {
|
|
97
|
+
const result = await service.refresh(refresh);
|
|
98
|
+
applyAuthCookies(cookies, result.tokens, options);
|
|
99
|
+
return result.user;
|
|
100
|
+
} catch (error) {
|
|
101
|
+
clearAuthCookies(cookies, options);
|
|
102
|
+
if (error instanceof require_errors.InvalidTokenError || error instanceof require_errors.AccountUnavailableError) return null;
|
|
103
|
+
throw error;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region core/next/handlers.ts
|
|
108
|
+
function json(body, status, cookies) {
|
|
109
|
+
const headers = new Headers({ "content-type": "application/json" });
|
|
110
|
+
if (cookies) for (const header of cookies.headers) headers.append("set-cookie", header);
|
|
111
|
+
return new Response(JSON.stringify(body), {
|
|
112
|
+
status,
|
|
113
|
+
headers
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
function errorResponse(error) {
|
|
117
|
+
if (error instanceof require_errors.IdentityError) return json({
|
|
118
|
+
code: error.code,
|
|
119
|
+
message: error.message
|
|
120
|
+
}, error.statusCode);
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
function serializeSetCookie(cookie) {
|
|
124
|
+
const parts = [`${cookie.name}=${encodeURIComponent(cookie.value)}`];
|
|
125
|
+
const opts = cookie.options ?? {};
|
|
126
|
+
if (opts.maxAge !== void 0) parts.push(`Max-Age=${Math.max(0, Math.floor(opts.maxAge))}`);
|
|
127
|
+
if (opts.expires) parts.push(`Expires=${opts.expires.toUTCString()}`);
|
|
128
|
+
parts.push(`Path=${opts.path ?? "/"}`);
|
|
129
|
+
if (opts.domain) parts.push(`Domain=${opts.domain}`);
|
|
130
|
+
if (opts.httpOnly !== false) parts.push("HttpOnly");
|
|
131
|
+
if (opts.secure) parts.push("Secure");
|
|
132
|
+
const sameSite = opts.sameSite ?? "lax";
|
|
133
|
+
parts.push(`SameSite=${sameSite.charAt(0).toUpperCase()}${sameSite.slice(1)}`);
|
|
134
|
+
return parts.join("; ");
|
|
135
|
+
}
|
|
136
|
+
function recordingStore(header) {
|
|
137
|
+
const inner = cookieStoreFromHeader(header);
|
|
138
|
+
const writes = [];
|
|
139
|
+
const deleted = [];
|
|
140
|
+
const expired = /* @__PURE__ */ new Date(0);
|
|
141
|
+
return {
|
|
142
|
+
store: {
|
|
143
|
+
get: inner.get.bind(inner),
|
|
144
|
+
set(name, value, options) {
|
|
145
|
+
inner.set(name, value, options);
|
|
146
|
+
writes.push({
|
|
147
|
+
name,
|
|
148
|
+
value,
|
|
149
|
+
options
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
delete(name, options) {
|
|
153
|
+
inner.delete(name, options);
|
|
154
|
+
deleted.push({
|
|
155
|
+
name,
|
|
156
|
+
value: "",
|
|
157
|
+
options: {
|
|
158
|
+
...options,
|
|
159
|
+
maxAge: 0,
|
|
160
|
+
expires: expired
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
headers() {
|
|
166
|
+
return [...writes.map(serializeSetCookie), ...deleted.map(serializeSetCookie)];
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
async function readJsonBody(request) {
|
|
171
|
+
try {
|
|
172
|
+
const body = await request.json();
|
|
173
|
+
if (typeof body === "object" && body !== null && !Array.isArray(body)) return body;
|
|
174
|
+
return {};
|
|
175
|
+
} catch {
|
|
176
|
+
return {};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function actionFromUrl(url, prefix) {
|
|
180
|
+
const pathname = new URL(url).pathname.replace(/\/+$/, "");
|
|
181
|
+
const normalizedPrefix = prefix.replace(/^\/+|\/+$/g, "");
|
|
182
|
+
if (normalizedPrefix) {
|
|
183
|
+
const marker = `/${normalizedPrefix}/`;
|
|
184
|
+
const idx = pathname.lastIndexOf(marker);
|
|
185
|
+
if (idx >= 0) return pathname.slice(idx + marker.length);
|
|
186
|
+
}
|
|
187
|
+
const slash = pathname.lastIndexOf("/");
|
|
188
|
+
return slash >= 0 ? pathname.slice(slash + 1) : pathname;
|
|
189
|
+
}
|
|
190
|
+
function createIdentityHandlers(service, options = {}) {
|
|
191
|
+
const prefix = options.prefix ?? "";
|
|
192
|
+
const names = require_cookie_header.resolveCookieNames(options);
|
|
193
|
+
const login = async (request) => {
|
|
194
|
+
try {
|
|
195
|
+
const body = await readJsonBody(request);
|
|
196
|
+
const email = typeof body.email === "string" ? body.email : "";
|
|
197
|
+
const password = typeof body.password === "string" ? body.password : "";
|
|
198
|
+
const result = await service.login({
|
|
199
|
+
email,
|
|
200
|
+
password
|
|
201
|
+
});
|
|
202
|
+
if ("kind" in result) return json(result, 200);
|
|
203
|
+
const recorded = recordingStore(request.headers.get("cookie"));
|
|
204
|
+
applyAuthCookies(recorded.store, result.tokens, options);
|
|
205
|
+
return json({ user: result.user }, 200, { headers: recorded.headers() });
|
|
206
|
+
} catch (error) {
|
|
207
|
+
return errorResponse(error);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
const logout = async (request) => {
|
|
211
|
+
try {
|
|
212
|
+
const recorded = recordingStore(request.headers.get("cookie"));
|
|
213
|
+
const refresh = require_cookie_header.readCookieValue(recorded.store, names.refresh);
|
|
214
|
+
if (refresh) await service.logout(refresh);
|
|
215
|
+
clearAuthCookies(recorded.store, options);
|
|
216
|
+
return json({ ok: true }, 200, { headers: recorded.headers() });
|
|
217
|
+
} catch (error) {
|
|
218
|
+
return errorResponse(error);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
const refresh = async (request) => {
|
|
222
|
+
try {
|
|
223
|
+
const recorded = recordingStore(request.headers.get("cookie"));
|
|
224
|
+
const token = require_cookie_header.readCookieValue(recorded.store, names.refresh);
|
|
225
|
+
if (!token) throw new require_errors.InvalidTokenError();
|
|
226
|
+
const result = await service.refresh(token);
|
|
227
|
+
applyAuthCookies(recorded.store, result.tokens, options);
|
|
228
|
+
return json({ user: result.user }, 200, { headers: recorded.headers() });
|
|
229
|
+
} catch (error) {
|
|
230
|
+
const recorded = recordingStore(request.headers.get("cookie"));
|
|
231
|
+
clearAuthCookies(recorded.store, options);
|
|
232
|
+
if (error instanceof require_errors.IdentityError) return json({
|
|
233
|
+
code: error.code,
|
|
234
|
+
message: error.message
|
|
235
|
+
}, error.statusCode, { headers: recorded.headers() });
|
|
236
|
+
throw error;
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
const me = async (request) => {
|
|
240
|
+
try {
|
|
241
|
+
const recorded = recordingStore(request.headers.get("cookie"));
|
|
242
|
+
const identity = await getIdentity(service, recorded.store, options);
|
|
243
|
+
if (!identity) return json({
|
|
244
|
+
code: "identity/unauthenticated",
|
|
245
|
+
message: "Authentication is required."
|
|
246
|
+
}, 401, { headers: recorded.headers() });
|
|
247
|
+
return json({ user: identity }, 200, { headers: recorded.headers() });
|
|
248
|
+
} catch (error) {
|
|
249
|
+
return errorResponse(error);
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
const dispatch = async (request) => {
|
|
253
|
+
const action = actionFromUrl(request.url, prefix);
|
|
254
|
+
const method = request.method.toUpperCase();
|
|
255
|
+
if (method === "POST" && action === "login") return login(request);
|
|
256
|
+
if (method === "POST" && action === "logout") return logout(request);
|
|
257
|
+
if (method === "POST" && action === "refresh") return refresh(request);
|
|
258
|
+
if (method === "GET" && action === "me") return me(request);
|
|
259
|
+
return json({
|
|
260
|
+
code: "identity/not-found",
|
|
261
|
+
message: "Not found."
|
|
262
|
+
}, 404);
|
|
263
|
+
};
|
|
264
|
+
return {
|
|
265
|
+
login,
|
|
266
|
+
logout,
|
|
267
|
+
refresh,
|
|
268
|
+
me,
|
|
269
|
+
dispatch
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
//#endregion
|
|
273
|
+
exports.DEFAULT_ACCESS_COOKIE = require_cookie_header.DEFAULT_ACCESS_COOKIE;
|
|
274
|
+
exports.DEFAULT_REFRESH_COOKIE = require_cookie_header.DEFAULT_REFRESH_COOKIE;
|
|
275
|
+
exports.applyAuthCookies = applyAuthCookies;
|
|
276
|
+
exports.clearAuthCookies = clearAuthCookies;
|
|
277
|
+
exports.cookieStoreFromHeader = cookieStoreFromHeader;
|
|
278
|
+
exports.createIdentityHandlers = createIdentityHandlers;
|
|
279
|
+
exports.createMemoryCookieStore = createMemoryCookieStore;
|
|
280
|
+
exports.getIdentity = getIdentity;
|
|
281
|
+
exports.hasIdentityCookies = require_cookie_header.hasIdentityCookies;
|
|
282
|
+
exports.parseCookieHeader = require_cookie_header.parseCookieHeader;
|
|
283
|
+
exports.readCookieValue = require_cookie_header.readCookieValue;
|
|
284
|
+
exports.resolveCookieAttributes = require_cookie_header.resolveCookieAttributes;
|
|
285
|
+
exports.resolveCookieNames = require_cookie_header.resolveCookieNames;
|
package/dist/next.d.cts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { d as AuthenticatedIdentity, u as AuthTokens } from "./identity-store-BRRahxcS.cjs";
|
|
2
|
+
import { t as IdentityService } from "./identity-service-DE0Ffguz.cjs";
|
|
3
|
+
import { a as DEFAULT_ACCESS_COOKIE, c as IdentityCookieNames, d as parseCookieHeader, f as readCookieValue, i as CookieWriter, l as IdentityCookieOptions, m as resolveCookieNames, n as CookieSource, o as DEFAULT_REFRESH_COOKIE, p as resolveCookieAttributes, r as CookieStore, s as IdentityCookieAttributes, t as CookieReader, u as hasIdentityCookies } from "./cookie-header-LFWHKQ04.cjs";
|
|
4
|
+
//#region core/next/cookies.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Writes the access and refresh tokens as HttpOnly cookies.
|
|
7
|
+
* `maxAge` is in seconds (Next.js / `Set-Cookie` convention).
|
|
8
|
+
*/
|
|
9
|
+
declare function applyAuthCookies(cookies: CookieWriter, tokens: AuthTokens, options?: IdentityCookieOptions, now?: Date): void;
|
|
10
|
+
/** Clears both identity cookies (logout or failed session). */
|
|
11
|
+
declare function clearAuthCookies(cookies: CookieWriter, options?: IdentityCookieOptions): void;
|
|
12
|
+
/**
|
|
13
|
+
* In-memory {@link CookieStore} for tests and Fetch-based Route Handlers.
|
|
14
|
+
* Not for production browser storage.
|
|
15
|
+
*/
|
|
16
|
+
declare function createMemoryCookieStore(initial?: Record<string, string>): CookieStore;
|
|
17
|
+
/** Builds a cookie store seeded from an incoming `Cookie` header. */
|
|
18
|
+
declare function cookieStoreFromHeader(header: string | null | undefined): CookieStore;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region core/next/session.d.ts
|
|
21
|
+
/** Subset of {@link IdentityService} used to read and rotate a cookie session. */
|
|
22
|
+
type IdentitySessionService = Pick<IdentityService, "authenticate" | "refresh">;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves the current principal from identity cookies.
|
|
25
|
+
*
|
|
26
|
+
* - Valid access cookie → `service.authenticate`.
|
|
27
|
+
* - Expired/missing access + refresh cookie → `service.refresh` and rotate cookies.
|
|
28
|
+
* - Failure → clear cookies and return `null` (degrade to logged out).
|
|
29
|
+
*
|
|
30
|
+
* Call this where cookies can be written (Server Actions, Route Handlers). Refresh
|
|
31
|
+
* rotates the refresh token; skipping the write would invalidate the browser session.
|
|
32
|
+
*/
|
|
33
|
+
declare function getIdentity(service: IdentitySessionService, cookies: CookieStore, options?: IdentityCookieOptions): Promise<AuthenticatedIdentity | null>;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region core/next/handlers.d.ts
|
|
36
|
+
interface IdentityHandlerOptions extends IdentityCookieOptions {
|
|
37
|
+
/**
|
|
38
|
+
* Path prefix used by {@link createIdentityHandlers.dispatch} to match routes.
|
|
39
|
+
* Default: `""` (last path segment is the action: `login`, `logout`, …).
|
|
40
|
+
*/
|
|
41
|
+
prefix?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Fetch API Route Handlers for cookie-based identity sessions (Next.js App Router).
|
|
45
|
+
*
|
|
46
|
+
* Mount individually or use {@link IdentityHandlers.dispatch} from a catch-all route.
|
|
47
|
+
*/
|
|
48
|
+
interface IdentityHandlers {
|
|
49
|
+
login(request: Request): Promise<Response>;
|
|
50
|
+
logout(request: Request): Promise<Response>;
|
|
51
|
+
refresh(request: Request): Promise<Response>;
|
|
52
|
+
me(request: Request): Promise<Response>;
|
|
53
|
+
dispatch(request: Request): Promise<Response>;
|
|
54
|
+
}
|
|
55
|
+
declare function createIdentityHandlers(service: IdentityService, options?: IdentityHandlerOptions): IdentityHandlers;
|
|
56
|
+
//#endregion
|
|
57
|
+
export { type CookieReader, type CookieSource, type CookieStore, type CookieWriter, DEFAULT_ACCESS_COOKIE, DEFAULT_REFRESH_COOKIE, type IdentityCookieAttributes, type IdentityCookieNames, type IdentityCookieOptions, type IdentityHandlerOptions, type IdentityHandlers, type IdentitySessionService, applyAuthCookies, clearAuthCookies, cookieStoreFromHeader, createIdentityHandlers, createMemoryCookieStore, getIdentity, hasIdentityCookies, parseCookieHeader, readCookieValue, resolveCookieAttributes, resolveCookieNames };
|
|
58
|
+
//# sourceMappingURL=next.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.d.cts","names":[],"sources":["../core/next/cookies.ts","../core/next/session.ts","../core/next/handlers.ts"],"mappings":";;;;;;;;iBAqCgB,iBACd,SAAS,cACT,QAAQ,YACR,UAAS,uBACT,MAAK;;iBAgBS,iBACd,SAAS,cACT,UAAS;;;;;iBAaK,wBACd,UAAS,yBACR;;iBAuBa,sBACd,oCACC;;;;KCvFS,yBAAyB,KACnC;;;;;;;;;;;iBAcoB,YACpB,SAAS,wBACT,SAAS,aACT,UAAS,wBACR,QAAQ;;;UCrBM,+BAA+B;;;;;EAK9C;;;;;;;UAwHe;EACf,MAAM,SAAS,UAAU,QAAQ;EACjC,OAAO,SAAS,UAAU,QAAQ;EAClC,QAAQ,SAAS,UAAU,QAAQ;EACnC,GAAG,SAAS,UAAU,QAAQ;EAC9B,SAAS,SAAS,UAAU,QAAQ;;iBAGtB,uBACd,SAAS,iBACT,UAAS,yBACR"}
|
package/dist/next.d.mts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { d as AuthenticatedIdentity, u as AuthTokens } from "./identity-store-BRRahxcS.mjs";
|
|
2
|
+
import { t as IdentityService } from "./identity-service-JtsoA6lv.mjs";
|
|
3
|
+
import { a as DEFAULT_ACCESS_COOKIE, c as IdentityCookieNames, d as parseCookieHeader, f as readCookieValue, i as CookieWriter, l as IdentityCookieOptions, m as resolveCookieNames, n as CookieSource, o as DEFAULT_REFRESH_COOKIE, p as resolveCookieAttributes, r as CookieStore, s as IdentityCookieAttributes, t as CookieReader, u as hasIdentityCookies } from "./cookie-header-LFWHKQ04.mjs";
|
|
4
|
+
//#region core/next/cookies.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Writes the access and refresh tokens as HttpOnly cookies.
|
|
7
|
+
* `maxAge` is in seconds (Next.js / `Set-Cookie` convention).
|
|
8
|
+
*/
|
|
9
|
+
declare function applyAuthCookies(cookies: CookieWriter, tokens: AuthTokens, options?: IdentityCookieOptions, now?: Date): void;
|
|
10
|
+
/** Clears both identity cookies (logout or failed session). */
|
|
11
|
+
declare function clearAuthCookies(cookies: CookieWriter, options?: IdentityCookieOptions): void;
|
|
12
|
+
/**
|
|
13
|
+
* In-memory {@link CookieStore} for tests and Fetch-based Route Handlers.
|
|
14
|
+
* Not for production browser storage.
|
|
15
|
+
*/
|
|
16
|
+
declare function createMemoryCookieStore(initial?: Record<string, string>): CookieStore;
|
|
17
|
+
/** Builds a cookie store seeded from an incoming `Cookie` header. */
|
|
18
|
+
declare function cookieStoreFromHeader(header: string | null | undefined): CookieStore;
|
|
19
|
+
//#endregion
|
|
20
|
+
//#region core/next/session.d.ts
|
|
21
|
+
/** Subset of {@link IdentityService} used to read and rotate a cookie session. */
|
|
22
|
+
type IdentitySessionService = Pick<IdentityService, "authenticate" | "refresh">;
|
|
23
|
+
/**
|
|
24
|
+
* Resolves the current principal from identity cookies.
|
|
25
|
+
*
|
|
26
|
+
* - Valid access cookie → `service.authenticate`.
|
|
27
|
+
* - Expired/missing access + refresh cookie → `service.refresh` and rotate cookies.
|
|
28
|
+
* - Failure → clear cookies and return `null` (degrade to logged out).
|
|
29
|
+
*
|
|
30
|
+
* Call this where cookies can be written (Server Actions, Route Handlers). Refresh
|
|
31
|
+
* rotates the refresh token; skipping the write would invalidate the browser session.
|
|
32
|
+
*/
|
|
33
|
+
declare function getIdentity(service: IdentitySessionService, cookies: CookieStore, options?: IdentityCookieOptions): Promise<AuthenticatedIdentity | null>;
|
|
34
|
+
//#endregion
|
|
35
|
+
//#region core/next/handlers.d.ts
|
|
36
|
+
interface IdentityHandlerOptions extends IdentityCookieOptions {
|
|
37
|
+
/**
|
|
38
|
+
* Path prefix used by {@link createIdentityHandlers.dispatch} to match routes.
|
|
39
|
+
* Default: `""` (last path segment is the action: `login`, `logout`, …).
|
|
40
|
+
*/
|
|
41
|
+
prefix?: string;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Fetch API Route Handlers for cookie-based identity sessions (Next.js App Router).
|
|
45
|
+
*
|
|
46
|
+
* Mount individually or use {@link IdentityHandlers.dispatch} from a catch-all route.
|
|
47
|
+
*/
|
|
48
|
+
interface IdentityHandlers {
|
|
49
|
+
login(request: Request): Promise<Response>;
|
|
50
|
+
logout(request: Request): Promise<Response>;
|
|
51
|
+
refresh(request: Request): Promise<Response>;
|
|
52
|
+
me(request: Request): Promise<Response>;
|
|
53
|
+
dispatch(request: Request): Promise<Response>;
|
|
54
|
+
}
|
|
55
|
+
declare function createIdentityHandlers(service: IdentityService, options?: IdentityHandlerOptions): IdentityHandlers;
|
|
56
|
+
//#endregion
|
|
57
|
+
export { type CookieReader, type CookieSource, type CookieStore, type CookieWriter, DEFAULT_ACCESS_COOKIE, DEFAULT_REFRESH_COOKIE, type IdentityCookieAttributes, type IdentityCookieNames, type IdentityCookieOptions, type IdentityHandlerOptions, type IdentityHandlers, type IdentitySessionService, applyAuthCookies, clearAuthCookies, cookieStoreFromHeader, createIdentityHandlers, createMemoryCookieStore, getIdentity, hasIdentityCookies, parseCookieHeader, readCookieValue, resolveCookieAttributes, resolveCookieNames };
|
|
58
|
+
//# sourceMappingURL=next.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"next.d.mts","names":[],"sources":["../core/next/cookies.ts","../core/next/session.ts","../core/next/handlers.ts"],"mappings":";;;;;;;;iBAqCgB,iBACd,SAAS,cACT,QAAQ,YACR,UAAS,uBACT,MAAK;;iBAgBS,iBACd,SAAS,cACT,UAAS;;;;;iBAaK,wBACd,UAAS,yBACR;;iBAuBa,sBACd,oCACC;;;;KCvFS,yBAAyB,KACnC;;;;;;;;;;;iBAcoB,YACpB,SAAS,wBACT,SAAS,aACT,UAAS,wBACR,QAAQ;;;UCrBM,+BAA+B;;;;;EAK9C;;;;;;;UAwHe;EACf,MAAM,SAAS,UAAU,QAAQ;EACjC,OAAO,SAAS,UAAU,QAAQ;EAClC,QAAQ,SAAS,UAAU,QAAQ;EACnC,GAAG,SAAS,UAAU,QAAQ;EAC9B,SAAS,SAAS,UAAU,QAAQ;;iBAGtB,uBACd,SAAS,iBACT,UAAS,yBACR"}
|
package/dist/next.mjs
ADDED
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { a as IdentityError, s as InvalidTokenError, t as AccountUnavailableError } from "./errors-CEmnZxIn.mjs";
|
|
2
|
+
import { a as readCookieValue, i as parseCookieHeader, n as DEFAULT_REFRESH_COOKIE, o as resolveCookieAttributes, r as hasIdentityCookies, s as resolveCookieNames, t as DEFAULT_ACCESS_COOKIE } from "./cookie-header-DptIxRmW.mjs";
|
|
3
|
+
//#region core/next/cookies.ts
|
|
4
|
+
function maxAgeSeconds(expiresAt, now) {
|
|
5
|
+
return Math.max(0, Math.floor((expiresAt.getTime() - now.getTime()) / 1e3));
|
|
6
|
+
}
|
|
7
|
+
function writeAttributes(options, expiresAt, now) {
|
|
8
|
+
const attrs = resolveCookieAttributes(options);
|
|
9
|
+
return {
|
|
10
|
+
httpOnly: attrs.httpOnly,
|
|
11
|
+
secure: attrs.secure,
|
|
12
|
+
sameSite: attrs.sameSite,
|
|
13
|
+
path: attrs.path,
|
|
14
|
+
domain: attrs.domain,
|
|
15
|
+
maxAge: maxAgeSeconds(expiresAt, now),
|
|
16
|
+
expires: expiresAt
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Writes the access and refresh tokens as HttpOnly cookies.
|
|
21
|
+
* `maxAge` is in seconds (Next.js / `Set-Cookie` convention).
|
|
22
|
+
*/
|
|
23
|
+
function applyAuthCookies(cookies, tokens, options = {}, now = /* @__PURE__ */ new Date()) {
|
|
24
|
+
const names = resolveCookieNames(options);
|
|
25
|
+
cookies.set(names.access, tokens.accessToken, writeAttributes(options, tokens.accessTokenExpiresAt, now));
|
|
26
|
+
cookies.set(names.refresh, tokens.refreshToken, writeAttributes(options, tokens.refreshTokenExpiresAt, now));
|
|
27
|
+
}
|
|
28
|
+
/** Clears both identity cookies (logout or failed session). */
|
|
29
|
+
function clearAuthCookies(cookies, options = {}) {
|
|
30
|
+
const names = resolveCookieNames(options);
|
|
31
|
+
const attrs = resolveCookieAttributes(options);
|
|
32
|
+
const deleteOpts = {
|
|
33
|
+
path: attrs.path,
|
|
34
|
+
domain: attrs.domain
|
|
35
|
+
};
|
|
36
|
+
cookies.delete(names.access, deleteOpts);
|
|
37
|
+
cookies.delete(names.refresh, deleteOpts);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* In-memory {@link CookieStore} for tests and Fetch-based Route Handlers.
|
|
41
|
+
* Not for production browser storage.
|
|
42
|
+
*/
|
|
43
|
+
function createMemoryCookieStore(initial = {}) {
|
|
44
|
+
const values = new Map(Object.entries(initial).filter(([, value]) => value.length > 0));
|
|
45
|
+
return {
|
|
46
|
+
get(name) {
|
|
47
|
+
const value = values.get(name);
|
|
48
|
+
return value === void 0 ? void 0 : { value };
|
|
49
|
+
},
|
|
50
|
+
set(name, value) {
|
|
51
|
+
if (value.length === 0) {
|
|
52
|
+
values.delete(name);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
values.set(name, value);
|
|
56
|
+
},
|
|
57
|
+
delete(name) {
|
|
58
|
+
values.delete(name);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/** Builds a cookie store seeded from an incoming `Cookie` header. */
|
|
63
|
+
function cookieStoreFromHeader(header) {
|
|
64
|
+
return createMemoryCookieStore(Object.fromEntries(parseCookieHeader(header)));
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
//#region core/next/session.ts
|
|
68
|
+
/**
|
|
69
|
+
* Resolves the current principal from identity cookies.
|
|
70
|
+
*
|
|
71
|
+
* - Valid access cookie → `service.authenticate`.
|
|
72
|
+
* - Expired/missing access + refresh cookie → `service.refresh` and rotate cookies.
|
|
73
|
+
* - Failure → clear cookies and return `null` (degrade to logged out).
|
|
74
|
+
*
|
|
75
|
+
* Call this where cookies can be written (Server Actions, Route Handlers). Refresh
|
|
76
|
+
* rotates the refresh token; skipping the write would invalidate the browser session.
|
|
77
|
+
*/
|
|
78
|
+
async function getIdentity(service, cookies, options = {}) {
|
|
79
|
+
const names = resolveCookieNames(options);
|
|
80
|
+
const access = readCookieValue(cookies, names.access);
|
|
81
|
+
const refresh = readCookieValue(cookies, names.refresh);
|
|
82
|
+
if (access) try {
|
|
83
|
+
return await service.authenticate(access);
|
|
84
|
+
} catch (error) {
|
|
85
|
+
if (error instanceof AccountUnavailableError) {
|
|
86
|
+
clearAuthCookies(cookies, options);
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
if (!(error instanceof InvalidTokenError)) throw error;
|
|
90
|
+
}
|
|
91
|
+
if (!refresh) {
|
|
92
|
+
if (access) clearAuthCookies(cookies, options);
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
const result = await service.refresh(refresh);
|
|
97
|
+
applyAuthCookies(cookies, result.tokens, options);
|
|
98
|
+
return result.user;
|
|
99
|
+
} catch (error) {
|
|
100
|
+
clearAuthCookies(cookies, options);
|
|
101
|
+
if (error instanceof InvalidTokenError || error instanceof AccountUnavailableError) return null;
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region core/next/handlers.ts
|
|
107
|
+
function json(body, status, cookies) {
|
|
108
|
+
const headers = new Headers({ "content-type": "application/json" });
|
|
109
|
+
if (cookies) for (const header of cookies.headers) headers.append("set-cookie", header);
|
|
110
|
+
return new Response(JSON.stringify(body), {
|
|
111
|
+
status,
|
|
112
|
+
headers
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function errorResponse(error) {
|
|
116
|
+
if (error instanceof IdentityError) return json({
|
|
117
|
+
code: error.code,
|
|
118
|
+
message: error.message
|
|
119
|
+
}, error.statusCode);
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
function serializeSetCookie(cookie) {
|
|
123
|
+
const parts = [`${cookie.name}=${encodeURIComponent(cookie.value)}`];
|
|
124
|
+
const opts = cookie.options ?? {};
|
|
125
|
+
if (opts.maxAge !== void 0) parts.push(`Max-Age=${Math.max(0, Math.floor(opts.maxAge))}`);
|
|
126
|
+
if (opts.expires) parts.push(`Expires=${opts.expires.toUTCString()}`);
|
|
127
|
+
parts.push(`Path=${opts.path ?? "/"}`);
|
|
128
|
+
if (opts.domain) parts.push(`Domain=${opts.domain}`);
|
|
129
|
+
if (opts.httpOnly !== false) parts.push("HttpOnly");
|
|
130
|
+
if (opts.secure) parts.push("Secure");
|
|
131
|
+
const sameSite = opts.sameSite ?? "lax";
|
|
132
|
+
parts.push(`SameSite=${sameSite.charAt(0).toUpperCase()}${sameSite.slice(1)}`);
|
|
133
|
+
return parts.join("; ");
|
|
134
|
+
}
|
|
135
|
+
function recordingStore(header) {
|
|
136
|
+
const inner = cookieStoreFromHeader(header);
|
|
137
|
+
const writes = [];
|
|
138
|
+
const deleted = [];
|
|
139
|
+
const expired = /* @__PURE__ */ new Date(0);
|
|
140
|
+
return {
|
|
141
|
+
store: {
|
|
142
|
+
get: inner.get.bind(inner),
|
|
143
|
+
set(name, value, options) {
|
|
144
|
+
inner.set(name, value, options);
|
|
145
|
+
writes.push({
|
|
146
|
+
name,
|
|
147
|
+
value,
|
|
148
|
+
options
|
|
149
|
+
});
|
|
150
|
+
},
|
|
151
|
+
delete(name, options) {
|
|
152
|
+
inner.delete(name, options);
|
|
153
|
+
deleted.push({
|
|
154
|
+
name,
|
|
155
|
+
value: "",
|
|
156
|
+
options: {
|
|
157
|
+
...options,
|
|
158
|
+
maxAge: 0,
|
|
159
|
+
expires: expired
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
headers() {
|
|
165
|
+
return [...writes.map(serializeSetCookie), ...deleted.map(serializeSetCookie)];
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
async function readJsonBody(request) {
|
|
170
|
+
try {
|
|
171
|
+
const body = await request.json();
|
|
172
|
+
if (typeof body === "object" && body !== null && !Array.isArray(body)) return body;
|
|
173
|
+
return {};
|
|
174
|
+
} catch {
|
|
175
|
+
return {};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
function actionFromUrl(url, prefix) {
|
|
179
|
+
const pathname = new URL(url).pathname.replace(/\/+$/, "");
|
|
180
|
+
const normalizedPrefix = prefix.replace(/^\/+|\/+$/g, "");
|
|
181
|
+
if (normalizedPrefix) {
|
|
182
|
+
const marker = `/${normalizedPrefix}/`;
|
|
183
|
+
const idx = pathname.lastIndexOf(marker);
|
|
184
|
+
if (idx >= 0) return pathname.slice(idx + marker.length);
|
|
185
|
+
}
|
|
186
|
+
const slash = pathname.lastIndexOf("/");
|
|
187
|
+
return slash >= 0 ? pathname.slice(slash + 1) : pathname;
|
|
188
|
+
}
|
|
189
|
+
function createIdentityHandlers(service, options = {}) {
|
|
190
|
+
const prefix = options.prefix ?? "";
|
|
191
|
+
const names = resolveCookieNames(options);
|
|
192
|
+
const login = async (request) => {
|
|
193
|
+
try {
|
|
194
|
+
const body = await readJsonBody(request);
|
|
195
|
+
const email = typeof body.email === "string" ? body.email : "";
|
|
196
|
+
const password = typeof body.password === "string" ? body.password : "";
|
|
197
|
+
const result = await service.login({
|
|
198
|
+
email,
|
|
199
|
+
password
|
|
200
|
+
});
|
|
201
|
+
if ("kind" in result) return json(result, 200);
|
|
202
|
+
const recorded = recordingStore(request.headers.get("cookie"));
|
|
203
|
+
applyAuthCookies(recorded.store, result.tokens, options);
|
|
204
|
+
return json({ user: result.user }, 200, { headers: recorded.headers() });
|
|
205
|
+
} catch (error) {
|
|
206
|
+
return errorResponse(error);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
const logout = async (request) => {
|
|
210
|
+
try {
|
|
211
|
+
const recorded = recordingStore(request.headers.get("cookie"));
|
|
212
|
+
const refresh = readCookieValue(recorded.store, names.refresh);
|
|
213
|
+
if (refresh) await service.logout(refresh);
|
|
214
|
+
clearAuthCookies(recorded.store, options);
|
|
215
|
+
return json({ ok: true }, 200, { headers: recorded.headers() });
|
|
216
|
+
} catch (error) {
|
|
217
|
+
return errorResponse(error);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
const refresh = async (request) => {
|
|
221
|
+
try {
|
|
222
|
+
const recorded = recordingStore(request.headers.get("cookie"));
|
|
223
|
+
const token = readCookieValue(recorded.store, names.refresh);
|
|
224
|
+
if (!token) throw new InvalidTokenError();
|
|
225
|
+
const result = await service.refresh(token);
|
|
226
|
+
applyAuthCookies(recorded.store, result.tokens, options);
|
|
227
|
+
return json({ user: result.user }, 200, { headers: recorded.headers() });
|
|
228
|
+
} catch (error) {
|
|
229
|
+
const recorded = recordingStore(request.headers.get("cookie"));
|
|
230
|
+
clearAuthCookies(recorded.store, options);
|
|
231
|
+
if (error instanceof IdentityError) return json({
|
|
232
|
+
code: error.code,
|
|
233
|
+
message: error.message
|
|
234
|
+
}, error.statusCode, { headers: recorded.headers() });
|
|
235
|
+
throw error;
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
const me = async (request) => {
|
|
239
|
+
try {
|
|
240
|
+
const recorded = recordingStore(request.headers.get("cookie"));
|
|
241
|
+
const identity = await getIdentity(service, recorded.store, options);
|
|
242
|
+
if (!identity) return json({
|
|
243
|
+
code: "identity/unauthenticated",
|
|
244
|
+
message: "Authentication is required."
|
|
245
|
+
}, 401, { headers: recorded.headers() });
|
|
246
|
+
return json({ user: identity }, 200, { headers: recorded.headers() });
|
|
247
|
+
} catch (error) {
|
|
248
|
+
return errorResponse(error);
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
const dispatch = async (request) => {
|
|
252
|
+
const action = actionFromUrl(request.url, prefix);
|
|
253
|
+
const method = request.method.toUpperCase();
|
|
254
|
+
if (method === "POST" && action === "login") return login(request);
|
|
255
|
+
if (method === "POST" && action === "logout") return logout(request);
|
|
256
|
+
if (method === "POST" && action === "refresh") return refresh(request);
|
|
257
|
+
if (method === "GET" && action === "me") return me(request);
|
|
258
|
+
return json({
|
|
259
|
+
code: "identity/not-found",
|
|
260
|
+
message: "Not found."
|
|
261
|
+
}, 404);
|
|
262
|
+
};
|
|
263
|
+
return {
|
|
264
|
+
login,
|
|
265
|
+
logout,
|
|
266
|
+
refresh,
|
|
267
|
+
me,
|
|
268
|
+
dispatch
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
//#endregion
|
|
272
|
+
export { DEFAULT_ACCESS_COOKIE, DEFAULT_REFRESH_COOKIE, applyAuthCookies, clearAuthCookies, cookieStoreFromHeader, createIdentityHandlers, createMemoryCookieStore, getIdentity, hasIdentityCookies, parseCookieHeader, readCookieValue, resolveCookieAttributes, resolveCookieNames };
|
|
273
|
+
|
|
274
|
+
//# sourceMappingURL=next.mjs.map
|