unjwt 0.5.20 → 0.5.22

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/dist/h3.mjs ADDED
@@ -0,0 +1,510 @@
1
+ export { k as deriveJWKFromPassword, h as exportJWKToPEM, c as generateJWK, f as importJWKFromPEM } from './shared/unjwt.Vg02PZWw.mjs';
2
+ import { isEvent, setCookie } from 'h3';
3
+ import { parse } from 'cookie-es';
4
+ import { e as encrypt, d as decrypt } from './shared/unjwt.CXl9FD-V.mjs';
5
+ import { p as isSymmetricJWK, q as isPrivateJWK, u as isAsymmetricJWK } from './shared/unjwt.DCiTNyCM.mjs';
6
+ import { s as sign, v as verify } from './shared/unjwt.DmRAjMp8.mjs';
7
+
8
+ /**
9
+ * This is a fork of h3 library's session utility functions.
10
+ * @source https://github.com/h3js/h3/blob/b4dce71c256911335f3402d09f30ffad120ad61a/test/session.test.ts
11
+ * @license MIT https://github.com/h3js/h3/blob/b4dce71c256911335f3402d09f30ffad120ad61a/LICENSE
12
+ */
13
+ const kGetSessionPromise$1 = Symbol("h3_jwe_getSession");
14
+ const DEFAULT_NAME$1 = "h3-jwe";
15
+ const DEFAULT_COOKIE$1 = {
16
+ path: "/",
17
+ secure: true,
18
+ httpOnly: true
19
+ };
20
+ async function useJWESession(event, config) {
21
+ const sessionName = config.name || DEFAULT_NAME$1;
22
+ await getJWESession(event, config);
23
+ const sessionManager = {
24
+ get id() {
25
+ return event.context.sessions?.[sessionName]?.id;
26
+ },
27
+ get createdAt() {
28
+ return event.context.sessions?.[sessionName]?.createdAt || Date.now();
29
+ },
30
+ get expiresAt() {
31
+ return event.context.sessions?.[sessionName]?.expiresAt;
32
+ },
33
+ get data() {
34
+ return event.context.sessions?.[sessionName]?.data || {};
35
+ },
36
+ update: async (update) => {
37
+ if (!isEvent(event)) {
38
+ throw new Error("[h3] Cannot update read-only session.");
39
+ }
40
+ await updateJWESession(event, config, update);
41
+ return sessionManager;
42
+ },
43
+ clear: () => {
44
+ if (!isEvent(event)) {
45
+ throw new Error("[h3] Cannot clear read-only session.");
46
+ }
47
+ clearJWESession(event, config);
48
+ return Promise.resolve(sessionManager);
49
+ }
50
+ };
51
+ return sessionManager;
52
+ }
53
+ async function getJWESession(event, config) {
54
+ const sessionName = config.name || DEFAULT_NAME$1;
55
+ if (!event.context.sessions) {
56
+ event.context.sessions = /* @__PURE__ */ Object.create(null);
57
+ }
58
+ const existingSession = event.context.sessions[sessionName];
59
+ if (existingSession) {
60
+ if (existingSession.expiresAt === void 0) {
61
+ const session2 = existingSession[kGetSessionPromise$1] || existingSession;
62
+ await config.hooks?.onRead?.(await session2, event);
63
+ return session2;
64
+ } else {
65
+ if (existingSession.expiresAt < Date.now() && isEvent(event)) {
66
+ await config.hooks?.onExpire?.(event, void 0);
67
+ return clearJWESession(event, config).then(
68
+ () => getJWESession(event, config)
69
+ );
70
+ } else {
71
+ const session2 = existingSession[kGetSessionPromise$1] || existingSession;
72
+ await config.hooks?.onRead?.(await session2, event);
73
+ return session2;
74
+ }
75
+ }
76
+ }
77
+ const session = {
78
+ id: "",
79
+ createdAt: 0,
80
+ expiresAt: void 0,
81
+ data: /* @__PURE__ */ Object.create(null)
82
+ };
83
+ event.context.sessions[sessionName] = session;
84
+ let jweToken;
85
+ if (config.sessionHeader !== false) {
86
+ const headerName = typeof config.sessionHeader === "string" ? config.sessionHeader.toLowerCase() : `x-${sessionName.toLowerCase()}-session`;
87
+ const headerValue = _getReqHeader$1(event, headerName);
88
+ if (typeof headerValue === "string") {
89
+ jweToken = headerValue;
90
+ }
91
+ }
92
+ if (!jweToken) {
93
+ const cookieHeader = _getReqHeader$1(event, "cookie");
94
+ if (cookieHeader) {
95
+ jweToken = parse(String(cookieHeader))[sessionName];
96
+ }
97
+ }
98
+ if (jweToken) {
99
+ const promise = unsealJWESession(event, config, jweToken).catch(async (error_) => {
100
+ if (error_ instanceof Error) {
101
+ const message = error_.message;
102
+ if (message.includes("Token has expired") || message.includes("Token is too old")) {
103
+ await config.hooks?.onExpire?.(event, error_);
104
+ return void 0;
105
+ }
106
+ }
107
+ await config.hooks?.onError?.(event, error_);
108
+ return void 0;
109
+ }).then((unsealed) => {
110
+ if (unsealed) {
111
+ Object.assign(session, unsealed);
112
+ }
113
+ delete event.context.sessions[sessionName][kGetSessionPromise$1];
114
+ return session;
115
+ });
116
+ event.context.sessions[sessionName][kGetSessionPromise$1] = promise;
117
+ await promise;
118
+ }
119
+ if (!session.id) {
120
+ if (!isEvent(event)) {
121
+ throw new Error(
122
+ "Cannot initialize a new session. Use `useSession(event)` within the main handler."
123
+ );
124
+ }
125
+ session.id = config.generateId?.() ?? (config.crypto || crypto).randomUUID();
126
+ session.createdAt = config.jwe?.encryptOptions?.currentDate === void 0 ? Date.now() : config.jwe.encryptOptions.currentDate.getTime();
127
+ session.expiresAt = config.maxAge ? session.createdAt + config.maxAge * 1e3 : void 0;
128
+ session.data = /* @__PURE__ */ Object.create(null);
129
+ await updateJWESession(event, config);
130
+ }
131
+ await config.hooks?.onRead?.(session, event);
132
+ return session;
133
+ }
134
+ function _getReqHeader$1(event, name) {
135
+ if (event.node) {
136
+ return event.node?.req.headers[name];
137
+ }
138
+ if (event.request) {
139
+ return event.request.headers?.get(name);
140
+ }
141
+ if (event.headers) {
142
+ return event.headers.get(name);
143
+ }
144
+ }
145
+ async function updateJWESession(event, config, update) {
146
+ const sessionName = config.name || DEFAULT_NAME$1;
147
+ const session = event.context.sessions?.[sessionName] || await getJWESession(event, config);
148
+ if (typeof update === "function") {
149
+ update = update(session.data);
150
+ }
151
+ if (update) {
152
+ Object.assign(session.data, update);
153
+ await config.hooks?.onUpdate?.(session, event);
154
+ }
155
+ if (config.cookie !== false) {
156
+ const sealed = await sealJWESession(event, config);
157
+ setCookie(event, sessionName, sealed, {
158
+ ...DEFAULT_COOKIE$1,
159
+ ...config.cookie,
160
+ expires: config.maxAge ? new Date(
161
+ // createdAt is ms, maxAge is seconds
162
+ session.createdAt + config.maxAge * 1e3
163
+ ) : void 0
164
+ });
165
+ }
166
+ return session;
167
+ }
168
+ async function sealJWESession(event, config) {
169
+ const key = getEncryptKey(config.secret);
170
+ if (typeof key !== "string" && !isSymmetricJWK(key) && !isPrivateJWK(key)) {
171
+ throw new Error(
172
+ "Session: JWE secret must be a password string or a private JWK."
173
+ );
174
+ }
175
+ const sessionName = config.name || DEFAULT_NAME$1;
176
+ const session = event.context.sessions?.[sessionName] || await getJWESession(event, config);
177
+ const iatSeconds = Math.floor(session.createdAt / 1e3);
178
+ const expSeconds = config.maxAge == null ? void 0 : iatSeconds + config.maxAge;
179
+ const payload = {
180
+ ...session.data,
181
+ jti: session.id,
182
+ iat: iatSeconds
183
+ };
184
+ if (expSeconds) {
185
+ payload.exp = expSeconds;
186
+ }
187
+ const token = await encrypt(payload, key, {
188
+ ...config.jwe?.encryptOptions,
189
+ protectedHeader: {
190
+ ...config.jwe?.encryptOptions?.protectedHeader,
191
+ typ: "JWT",
192
+ cty: "application/json"
193
+ }
194
+ });
195
+ return token;
196
+ }
197
+ async function unsealJWESession(_event, config, sealed) {
198
+ const key = getDecryptKey(config.secret);
199
+ if (typeof key !== "string" && !isSymmetricJWK(key) && !isPrivateJWK(key)) {
200
+ throw new Error(
201
+ "Session: JWE secret must be a password string or a private JWK."
202
+ );
203
+ }
204
+ const alg = config.jwe?.encryptOptions?.alg;
205
+ const enc = config.jwe?.encryptOptions?.enc;
206
+ const { payload } = await decrypt(sealed, key, {
207
+ ...config.jwe?.decryptOptions,
208
+ requiredClaims: [
209
+ ...config.jwe?.decryptOptions?.requiredClaims?.filter(
210
+ (claim) => claim !== "jti" && claim !== "iat"
211
+ ) || [],
212
+ "jti",
213
+ "iat"
214
+ ],
215
+ maxTokenAge: config.maxAge,
216
+ algorithms: alg ? [alg] : void 0,
217
+ encryptionAlgorithms: enc ? [enc] : void 0,
218
+ unwrappedKeyAlgorithm: void 0,
219
+ keyUsage: void 0,
220
+ forceUint8Array: false,
221
+ validateJWT: true
222
+ }).catch((error_) => {
223
+ if (error_ instanceof Error) {
224
+ const message = error_.message;
225
+ throw new Error(`Invalid session token: ${message}`);
226
+ }
227
+ throw new Error(error_);
228
+ });
229
+ const { jti, iat, ...data } = payload;
230
+ return {
231
+ id: jti,
232
+ createdAt: iat * 1e3,
233
+ // Convert back to ms
234
+ expiresAt: payload.exp ? payload.exp * 1e3 : void 0,
235
+ data: data && typeof data === "object" ? data : /* @__PURE__ */ Object.create(null)
236
+ };
237
+ }
238
+ async function clearJWESession(event, config) {
239
+ const sessionName = config.name || DEFAULT_NAME$1;
240
+ if (event.context.sessions?.[sessionName]) {
241
+ delete event.context.sessions[sessionName];
242
+ }
243
+ setCookie(event, sessionName, "", {
244
+ ...DEFAULT_COOKIE$1,
245
+ ...config.cookie,
246
+ // Optionally set expires in the past
247
+ expires: /* @__PURE__ */ new Date(0),
248
+ maxAge: void 0
249
+ });
250
+ await config.hooks?.onClear?.(event);
251
+ }
252
+ function getEncryptKey(secret) {
253
+ if (typeof secret === "string") {
254
+ return secret;
255
+ } else if (isSymmetricJWK(secret)) {
256
+ return secret;
257
+ }
258
+ return secret.publicKey || secret.privateKey;
259
+ }
260
+ function getDecryptKey(secret) {
261
+ if (typeof secret === "string") {
262
+ return secret;
263
+ } else if ("privateKey" in secret) {
264
+ return secret.privateKey;
265
+ }
266
+ return secret;
267
+ }
268
+
269
+ /**
270
+ * This is a fork of h3 library's session utility functions.
271
+ * @source https://github.com/h3js/h3/blob/b4dce71c256911335f3402d09f30ffad120ad61a/test/session.test.ts
272
+ * @license MIT https://github.com/h3js/h3/blob/b4dce71c256911335f3402d09f30ffad120ad61a/LICENSE
273
+ */
274
+ const kGetSessionPromise = Symbol("h3_jws_getSession");
275
+ const DEFAULT_NAME = "h3-jws";
276
+ const DEFAULT_COOKIE = {
277
+ path: "/",
278
+ secure: true,
279
+ httpOnly: false
280
+ };
281
+ async function useJWSSession(event, config) {
282
+ const sessionName = config.name || DEFAULT_NAME;
283
+ await getJWSSession(event, config);
284
+ const sessionManager = {
285
+ get id() {
286
+ return event.context.sessions?.[sessionName]?.id;
287
+ },
288
+ get createdAt() {
289
+ return event.context.sessions?.[sessionName]?.createdAt || Date.now();
290
+ },
291
+ get expiresAt() {
292
+ return event.context.sessions?.[sessionName]?.expiresAt;
293
+ },
294
+ get data() {
295
+ return event.context.sessions?.[sessionName]?.data || {};
296
+ },
297
+ update: async (update) => {
298
+ if (!isEvent(event)) {
299
+ throw new Error("[h3] Cannot update read-only session.");
300
+ }
301
+ await updateJWSSession(event, config, update);
302
+ return sessionManager;
303
+ },
304
+ clear: () => {
305
+ if (!isEvent(event)) {
306
+ throw new Error("[h3] Cannot clear read-only session.");
307
+ }
308
+ clearJWSSession(event, config);
309
+ return Promise.resolve(sessionManager);
310
+ }
311
+ };
312
+ return sessionManager;
313
+ }
314
+ async function getJWSSession(event, config) {
315
+ const sessionName = config.name || DEFAULT_NAME;
316
+ if (!event.context.sessions) {
317
+ event.context.sessions = /* @__PURE__ */ Object.create(null);
318
+ }
319
+ const existingSession = event.context.sessions[sessionName];
320
+ if (existingSession) {
321
+ if (existingSession.expiresAt === void 0) {
322
+ const session2 = existingSession[kGetSessionPromise] || existingSession;
323
+ await config.hooks?.onRead?.(await session2, event);
324
+ return session2;
325
+ } else {
326
+ if (existingSession.expiresAt < Date.now() && isEvent(event)) {
327
+ await config.hooks?.onExpire?.(event, void 0);
328
+ return clearJWSSession(event, config).then(
329
+ () => getJWSSession(event, config)
330
+ );
331
+ } else {
332
+ const session2 = existingSession[kGetSessionPromise] || existingSession;
333
+ await config.hooks?.onRead?.(await session2, event);
334
+ return session2;
335
+ }
336
+ }
337
+ }
338
+ const session = {
339
+ id: "",
340
+ createdAt: 0,
341
+ expiresAt: void 0,
342
+ data: /* @__PURE__ */ Object.create(null)
343
+ };
344
+ event.context.sessions[sessionName] = session;
345
+ let token;
346
+ if (config.sessionHeader !== false) {
347
+ const headerName = typeof config.sessionHeader === "string" ? config.sessionHeader.toLowerCase() : `x-${sessionName.toLowerCase()}-session`;
348
+ const headerValue = _getReqHeader(event, headerName);
349
+ if (typeof headerValue === "string") {
350
+ token = headerValue;
351
+ }
352
+ }
353
+ if (!token) {
354
+ const cookieHeader = _getReqHeader(event, "cookie");
355
+ if (cookieHeader) {
356
+ token = parse(String(cookieHeader))[sessionName];
357
+ }
358
+ }
359
+ if (token) {
360
+ const promise = verifyJWSSession(event, config, token).catch(async (error_) => {
361
+ if (error_ instanceof Error) {
362
+ const message = error_.message;
363
+ if (message.includes("Token has expired") || message.includes("Token is too old")) {
364
+ await config.hooks?.onExpire?.(event, error_);
365
+ return void 0;
366
+ }
367
+ }
368
+ await config.hooks?.onError?.(event, error_);
369
+ return void 0;
370
+ }).then((unsealed) => {
371
+ if (unsealed) {
372
+ Object.assign(session, unsealed);
373
+ }
374
+ delete event.context.sessions[sessionName][kGetSessionPromise];
375
+ return session;
376
+ });
377
+ session[kGetSessionPromise] = promise;
378
+ await promise;
379
+ }
380
+ if (!session.id) {
381
+ if (!isEvent(event)) {
382
+ throw new Error(
383
+ "Cannot initialize a new session outside main handler. Use `useJWSSession(event)` properly."
384
+ );
385
+ }
386
+ session.id = config.generateId?.() ?? (config.crypto || globalThis.crypto).randomUUID();
387
+ session.createdAt = config.jws?.signOptions?.currentDate === void 0 ? Date.now() : config.jws.signOptions.currentDate.getTime();
388
+ session.expiresAt = config.maxAge ? session.createdAt + config.maxAge * 1e3 : void 0;
389
+ session.data = /* @__PURE__ */ Object.create(null);
390
+ await updateJWSSession(event, config);
391
+ }
392
+ await config.hooks?.onRead?.(session, event);
393
+ return session;
394
+ }
395
+ function _getReqHeader(event, name) {
396
+ if (event.node) {
397
+ return event.node.req.headers[name];
398
+ }
399
+ if (event.request) {
400
+ return event.request.headers.get(name);
401
+ }
402
+ if (event.headers) {
403
+ return event.headers.get(name);
404
+ }
405
+ }
406
+ async function updateJWSSession(event, config, update) {
407
+ const sessionName = config.name || DEFAULT_NAME;
408
+ const session = event.context.sessions?.[sessionName] || await getJWSSession(event, config);
409
+ if (typeof update === "function") {
410
+ update = update(session.data);
411
+ }
412
+ if (update) {
413
+ Object.assign(session.data, update);
414
+ await config.hooks?.onUpdate?.(session, event);
415
+ }
416
+ if (config.cookie !== false) {
417
+ const token = await signJWSSession(event, config);
418
+ setCookie(event, sessionName, token, {
419
+ ...DEFAULT_COOKIE,
420
+ ...config.cookie,
421
+ expires: config.maxAge ? new Date(session.createdAt + config.maxAge * 1e3) : void 0
422
+ });
423
+ }
424
+ return session;
425
+ }
426
+ async function signJWSSession(event, config) {
427
+ const key = getSignKey(config.key);
428
+ if (isAsymmetricJWK(key) && !isPrivateJWK(key)) {
429
+ throw new Error("Session: JWS key cannot be a public asymmetric JWK.");
430
+ }
431
+ const sessionName = config.name || DEFAULT_NAME;
432
+ const session = event.context.sessions?.[sessionName] || await getJWSSession(event, config);
433
+ const iatSeconds = Math.floor(session.createdAt / 1e3);
434
+ const expSeconds = config.maxAge == null ? void 0 : iatSeconds + config.maxAge;
435
+ const payload = {
436
+ ...session.data,
437
+ jti: session.id,
438
+ iat: iatSeconds
439
+ };
440
+ if (expSeconds) {
441
+ payload.exp = expSeconds;
442
+ }
443
+ const token = await sign(payload, key, {
444
+ ...config.jws?.signOptions,
445
+ protectedHeader: {
446
+ ...config.jws?.signOptions?.protectedHeader,
447
+ typ: "JWT"
448
+ }
449
+ });
450
+ return token;
451
+ }
452
+ async function verifyJWSSession(_event, config, token) {
453
+ const alg = config.jws?.signOptions?.alg;
454
+ const jwk = getVerifyKey(config.key);
455
+ if (isAsymmetricJWK(jwk) && isPrivateJWK(jwk)) {
456
+ throw new Error("Session: JWS key cannot be a private asymmetric JWK.");
457
+ }
458
+ const { payload } = await verify(token, jwk, {
459
+ ...config.jws?.verifyOptions,
460
+ requiredClaims: [
461
+ ...config.jws?.verifyOptions?.requiredClaims?.filter(
462
+ (claim) => claim !== "jti" && claim !== "iat"
463
+ ) || [],
464
+ "jti",
465
+ "iat"
466
+ ],
467
+ typ: "JWT",
468
+ algorithms: alg ? [alg] : void 0,
469
+ forceUint8Array: false,
470
+ validateJWT: true
471
+ }).catch((error_) => {
472
+ const message = error_ instanceof Error ? error_.message : String(error_);
473
+ throw new Error(`Invalid session token: ${message}`);
474
+ });
475
+ const { jti, iat, ...data } = payload;
476
+ return {
477
+ id: jti,
478
+ createdAt: iat * 1e3,
479
+ // Convert back to ms
480
+ expiresAt: payload.exp ? payload.exp * 1e3 : void 0,
481
+ data: data && typeof data === "object" ? data : /* @__PURE__ */ Object.create(null)
482
+ };
483
+ }
484
+ async function clearJWSSession(event, config) {
485
+ const sessionName = config.name || DEFAULT_NAME;
486
+ if (event.context.sessions?.[sessionName]) {
487
+ delete event.context.sessions[sessionName];
488
+ }
489
+ setCookie(event, sessionName, "", {
490
+ ...DEFAULT_COOKIE,
491
+ ...config.cookie,
492
+ expires: /* @__PURE__ */ new Date(0),
493
+ maxAge: void 0
494
+ });
495
+ await config.hooks?.onClear?.(event);
496
+ }
497
+ function getSignKey(key) {
498
+ if ("privateKey" in key) {
499
+ return key.privateKey;
500
+ }
501
+ return key;
502
+ }
503
+ function getVerifyKey(key) {
504
+ if ("publicKey" in key) {
505
+ return Array.isArray(key.publicKey) ? { keys: key.publicKey } : key.publicKey;
506
+ }
507
+ return key;
508
+ }
509
+
510
+ export { clearJWESession, clearJWSSession, getJWESession, getJWSSession, sealJWESession, signJWSSession, unsealJWESession, updateJWESession, updateJWSSession, useJWESession, useJWSSession, verifyJWSSession };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,7 @@
1
- export { C as CompositeKey, f as ContentEncryptionAlgorithm, D as DeriveKeyOptions, e as DeriveKeyReturn, E as ExpiresIn, c as GenerateJWKOptions, d as GenerateJWKReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, t as JWK, Q as JWKAlgorithm, R as JWKPEMAlgorithm, J as JWKParameters, u as JWKSet, F as JWK_AES_CBC_HMAC, H as JWK_AES_GCM, B as JWK_AES_GCM_KW, A as JWK_AES_KW, P as JWK_Asymmetric_Algorithm, j as JWK_EC, L as JWK_ECDH_ES, y as JWK_ECDSA, i as JWK_EC_Private, h as JWK_EC_Public, v as JWK_HMAC, p as JWK_OKP, o as JWK_OKP_Private, n as JWK_OKP_Public, N as JWK_OKP_SIGN, I as JWK_PBES2, s as JWK_Private, r as JWK_Public, m as JWK_RSA, z as JWK_RSA_ENC, x as JWK_RSA_PSS, l as JWK_RSA_Private, k as JWK_RSA_Public, w as JWK_RSA_SIGN, O as JWK_Symmetric_Algorithm, q as JWK_oct, V as JWT, X as JWTClaimValidationOptions, T as JWTClaims, S as JoseHeaderParameters, K as KeyManagementAlgorithm, M as MaxTokenAge, U as UnwrapKeyOptions, W as WrapKeyOptions, g as WrapKeyResult } from './shared/unjwt.Dy68jE0N.mjs';
2
- export { i as utils } from './shared/unjwt.BuQdWrN5.mjs';
3
- export { d as JWEDecryptOptions, e as JWEDecryptResult, b as JWEEncryptOptions, J as JWEHeaderParameters, c as JWEKeyLookupFunction, a as JWEKeyManagementHeaderParameters, j as jwe } from './shared/unjwt.BFtNZVqt.mjs';
4
- export { j as jwk } from './shared/unjwt.ChCsF4q6.mjs';
5
- export { J as JWSAlgorithm, a as JWSHeaderParameters, f as JWSKeyLookupFunction, b as JWSProtectedHeader, c as JWSSignOptions, e as JWSVerifyOptions, d as JWSVerifyResult, j as jws } from './shared/unjwt.DANsaNYC.mjs';
1
+ export { C as CompositeKey, f as ContentEncryptionAlgorithm, D as DeriveKeyOptions, e as DeriveKeyReturn, E as ExpiresIn, c as GenerateJWKOptions, d as GenerateJWKReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, v as JWK, S as JWKAlgorithm, T as JWKPEMAlgorithm, J as JWKParameters, w as JWKSet, I as JWK_AES_CBC_HMAC, L as JWK_AES_GCM, H as JWK_AES_GCM_KW, F as JWK_AES_KW, s as JWK_Asymmetric, R as JWK_Asymmetric_Algorithm, j as JWK_EC, O as JWK_ECDH_ES, A as JWK_ECDSA, i as JWK_EC_Private, h as JWK_EC_Public, x as JWK_HMAC, p as JWK_OKP, o as JWK_OKP_Private, n as JWK_OKP_Public, P as JWK_OKP_SIGN, N as JWK_PBES2, u as JWK_Private, t as JWK_Public, m as JWK_RSA, B as JWK_RSA_ENC, z as JWK_RSA_PSS, l as JWK_RSA_Private, k as JWK_RSA_Public, y as JWK_RSA_SIGN, r as JWK_Symmetric, Q as JWK_Symmetric_Algorithm, q as JWK_oct, Y as JWT, Z as JWTClaimValidationOptions, X as JWTClaims, V as JoseHeaderParameters, K as KeyManagementAlgorithm, M as MaxTokenAge, U as UnwrapKeyOptions, W as WrapKeyOptions, g as WrapKeyResult } from './shared/unjwt.CtHrClHc.mjs';
2
+ export { i as utils } from './shared/unjwt.BrNGm4On.mjs';
3
+ export { j as jwe } from './shared/unjwt.VUfJDcCJ.mjs';
4
+ export { j as jwk } from './shared/unjwt.BjP_dGnX.mjs';
5
+ export { j as jws } from './shared/unjwt.C5jNR_1K.mjs';
6
+ export { J as JWSAlgorithm, a as JWSHeaderParameters, f as JWSKeyLookupFunction, b as JWSProtectedHeader, c as JWSSignOptions, e as JWSVerifyOptions, d as JWSVerifyResult } from './shared/unjwt.BsLgL0DQ.mjs';
7
+ export { d as JWEDecryptOptions, e as JWEDecryptResult, b as JWEEncryptOptions, J as JWEHeaderParameters, c as JWEKeyLookupFunction, a as JWEKeyManagementHeaderParameters } from './shared/unjwt.9mL1vSFP.mjs';
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { i as utils } from './shared/unjwt.K_6rgVTy.mjs';
2
- export { j as jwe } from './shared/unjwt.CaZJRuRa.mjs';
3
- export { j as jwk } from './shared/unjwt.D7ya3PwS.mjs';
4
- export { j as jws } from './shared/unjwt.Dc_YDjvO.mjs';
1
+ export { i as utils } from './shared/unjwt.DCiTNyCM.mjs';
2
+ export { j as jwe } from './shared/unjwt.CXl9FD-V.mjs';
3
+ export { j as jwk } from './shared/unjwt.Vg02PZWw.mjs';
4
+ export { j as jws } from './shared/unjwt.DmRAjMp8.mjs';
package/dist/jwe.d.mts CHANGED
@@ -1,2 +1,3 @@
1
- export { C as CompositeKey, f as ContentEncryptionAlgorithm, D as DeriveKeyOptions, e as DeriveKeyReturn, c as GenerateJWKOptions, d as GenerateJWKReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, t as JWK, Q as JWKAlgorithm, R as JWKPEMAlgorithm, J as JWKParameters, u as JWKSet, F as JWK_AES_CBC_HMAC, H as JWK_AES_GCM, B as JWK_AES_GCM_KW, A as JWK_AES_KW, P as JWK_Asymmetric_Algorithm, j as JWK_EC, L as JWK_ECDH_ES, y as JWK_ECDSA, i as JWK_EC_Private, h as JWK_EC_Public, v as JWK_HMAC, p as JWK_OKP, o as JWK_OKP_Private, n as JWK_OKP_Public, N as JWK_OKP_SIGN, I as JWK_PBES2, s as JWK_Private, r as JWK_Public, m as JWK_RSA, z as JWK_RSA_ENC, x as JWK_RSA_PSS, l as JWK_RSA_Private, k as JWK_RSA_Public, w as JWK_RSA_SIGN, O as JWK_Symmetric_Algorithm, q as JWK_oct, V as JWT, X as JWTClaimValidationOptions, T as JWTClaims, S as JoseHeaderParameters, K as KeyManagementAlgorithm, U as UnwrapKeyOptions, W as WrapKeyOptions, g as WrapKeyResult } from './shared/unjwt.Dy68jE0N.mjs';
2
- export { d as JWEDecryptOptions, e as JWEDecryptResult, b as JWEEncryptOptions, J as JWEHeaderParameters, c as JWEKeyLookupFunction, a as JWEKeyManagementHeaderParameters, g as decrypt, f as encrypt } from './shared/unjwt.BFtNZVqt.mjs';
1
+ export { C as CompositeKey, f as ContentEncryptionAlgorithm, D as DeriveKeyOptions, e as DeriveKeyReturn, c as GenerateJWKOptions, d as GenerateJWKReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, v as JWK, S as JWKAlgorithm, T as JWKPEMAlgorithm, J as JWKParameters, w as JWKSet, I as JWK_AES_CBC_HMAC, L as JWK_AES_GCM, H as JWK_AES_GCM_KW, F as JWK_AES_KW, s as JWK_Asymmetric, R as JWK_Asymmetric_Algorithm, j as JWK_EC, O as JWK_ECDH_ES, A as JWK_ECDSA, i as JWK_EC_Private, h as JWK_EC_Public, x as JWK_HMAC, p as JWK_OKP, o as JWK_OKP_Private, n as JWK_OKP_Public, P as JWK_OKP_SIGN, N as JWK_PBES2, u as JWK_Private, t as JWK_Public, m as JWK_RSA, B as JWK_RSA_ENC, z as JWK_RSA_PSS, l as JWK_RSA_Private, k as JWK_RSA_Public, y as JWK_RSA_SIGN, r as JWK_Symmetric, Q as JWK_Symmetric_Algorithm, q as JWK_oct, Y as JWT, Z as JWTClaimValidationOptions, X as JWTClaims, V as JoseHeaderParameters, K as KeyManagementAlgorithm, U as UnwrapKeyOptions, W as WrapKeyOptions, g as WrapKeyResult } from './shared/unjwt.CtHrClHc.mjs';
2
+ export { d as JWEDecryptOptions, e as JWEDecryptResult, b as JWEEncryptOptions, J as JWEHeaderParameters, c as JWEKeyLookupFunction, a as JWEKeyManagementHeaderParameters } from './shared/unjwt.9mL1vSFP.mjs';
3
+ export { d as decrypt, e as encrypt } from './shared/unjwt.VUfJDcCJ.mjs';
package/dist/jwe.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import './shared/unjwt.D7ya3PwS.mjs';
2
- import './shared/unjwt.K_6rgVTy.mjs';
3
- export { d as decrypt, e as encrypt } from './shared/unjwt.CaZJRuRa.mjs';
1
+ import './shared/unjwt.Vg02PZWw.mjs';
2
+ import './shared/unjwt.DCiTNyCM.mjs';
3
+ export { d as decrypt, e as encrypt } from './shared/unjwt.CXl9FD-V.mjs';
package/dist/jwk.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export { C as CompositeKey, f as ContentEncryptionAlgorithm, D as DeriveKeyOptions, e as DeriveKeyReturn, c as GenerateJWKOptions, d as GenerateJWKReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, t as JWK, Q as JWKAlgorithm, R as JWKPEMAlgorithm, J as JWKParameters, u as JWKSet, F as JWK_AES_CBC_HMAC, H as JWK_AES_GCM, B as JWK_AES_GCM_KW, A as JWK_AES_KW, P as JWK_Asymmetric_Algorithm, j as JWK_EC, L as JWK_ECDH_ES, y as JWK_ECDSA, i as JWK_EC_Private, h as JWK_EC_Public, v as JWK_HMAC, p as JWK_OKP, o as JWK_OKP_Private, n as JWK_OKP_Public, N as JWK_OKP_SIGN, I as JWK_PBES2, s as JWK_Private, r as JWK_Public, m as JWK_RSA, z as JWK_RSA_ENC, x as JWK_RSA_PSS, l as JWK_RSA_Private, k as JWK_RSA_Public, w as JWK_RSA_SIGN, O as JWK_Symmetric_Algorithm, q as JWK_oct, V as JWT, X as JWTClaimValidationOptions, T as JWTClaims, S as JoseHeaderParameters, K as KeyManagementAlgorithm, U as UnwrapKeyOptions, W as WrapKeyOptions, g as WrapKeyResult } from './shared/unjwt.Dy68jE0N.mjs';
2
- export { b as deriveJWKFromPassword, d as deriveKeyFromPassword, f as exportJWKToPEM, e as exportKey, a as generateJWK, g as generateKey, h as getJWKFromSet, c as importJWKFromPEM, i as importKey, u as unwrapKey, w as wrapKey } from './shared/unjwt.ChCsF4q6.mjs';
1
+ export { C as CompositeKey, f as ContentEncryptionAlgorithm, D as DeriveKeyOptions, e as DeriveKeyReturn, c as GenerateJWKOptions, d as GenerateJWKReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, v as JWK, S as JWKAlgorithm, T as JWKPEMAlgorithm, J as JWKParameters, w as JWKSet, I as JWK_AES_CBC_HMAC, L as JWK_AES_GCM, H as JWK_AES_GCM_KW, F as JWK_AES_KW, s as JWK_Asymmetric, R as JWK_Asymmetric_Algorithm, j as JWK_EC, O as JWK_ECDH_ES, A as JWK_ECDSA, i as JWK_EC_Private, h as JWK_EC_Public, x as JWK_HMAC, p as JWK_OKP, o as JWK_OKP_Private, n as JWK_OKP_Public, P as JWK_OKP_SIGN, N as JWK_PBES2, u as JWK_Private, t as JWK_Public, m as JWK_RSA, B as JWK_RSA_ENC, z as JWK_RSA_PSS, l as JWK_RSA_Private, k as JWK_RSA_Public, y as JWK_RSA_SIGN, r as JWK_Symmetric, Q as JWK_Symmetric_Algorithm, q as JWK_oct, Y as JWT, Z as JWTClaimValidationOptions, X as JWTClaims, V as JoseHeaderParameters, K as KeyManagementAlgorithm, U as UnwrapKeyOptions, W as WrapKeyOptions, g as WrapKeyResult } from './shared/unjwt.CtHrClHc.mjs';
2
+ export { d as deriveJWKFromPassword, b as deriveKeyFromPassword, e as exportJWKToPEM, f as exportKey, g as generateJWK, a as generateKey, h as getJWKFromSet, i as importJWKFromPEM, c as importKey, u as unwrapKey, w as wrapKey } from './shared/unjwt.BjP_dGnX.mjs';
package/dist/jwk.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import './shared/unjwt.K_6rgVTy.mjs';
2
- export { k as deriveJWKFromPassword, h as deriveKeyFromPassword, n as exportJWKToPEM, l as exportKey, f as generateJWK, c as generateKey, b as getJWKFromSet, m as importJWKFromPEM, i as importKey, u as unwrapKey, w as wrapKey } from './shared/unjwt.D7ya3PwS.mjs';
1
+ import './shared/unjwt.DCiTNyCM.mjs';
2
+ export { k as deriveJWKFromPassword, m as deriveKeyFromPassword, h as exportJWKToPEM, n as exportKey, c as generateJWK, l as generateKey, b as getJWKFromSet, f as importJWKFromPEM, i as importKey, u as unwrapKey, w as wrapKey } from './shared/unjwt.Vg02PZWw.mjs';
package/dist/jws.d.mts CHANGED
@@ -1,2 +1,3 @@
1
- export { C as CompositeKey, f as ContentEncryptionAlgorithm, D as DeriveKeyOptions, e as DeriveKeyReturn, c as GenerateJWKOptions, d as GenerateJWKReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, t as JWK, Q as JWKAlgorithm, R as JWKPEMAlgorithm, J as JWKParameters, u as JWKSet, F as JWK_AES_CBC_HMAC, H as JWK_AES_GCM, B as JWK_AES_GCM_KW, A as JWK_AES_KW, P as JWK_Asymmetric_Algorithm, j as JWK_EC, L as JWK_ECDH_ES, y as JWK_ECDSA, i as JWK_EC_Private, h as JWK_EC_Public, v as JWK_HMAC, p as JWK_OKP, o as JWK_OKP_Private, n as JWK_OKP_Public, N as JWK_OKP_SIGN, I as JWK_PBES2, s as JWK_Private, r as JWK_Public, m as JWK_RSA, z as JWK_RSA_ENC, x as JWK_RSA_PSS, l as JWK_RSA_Private, k as JWK_RSA_Public, w as JWK_RSA_SIGN, O as JWK_Symmetric_Algorithm, q as JWK_oct, V as JWT, X as JWTClaimValidationOptions, T as JWTClaims, S as JoseHeaderParameters, K as KeyManagementAlgorithm, U as UnwrapKeyOptions, W as WrapKeyOptions, g as WrapKeyResult } from './shared/unjwt.Dy68jE0N.mjs';
2
- export { J as JWSAlgorithm, a as JWSHeaderParameters, f as JWSKeyLookupFunction, b as JWSProtectedHeader, c as JWSSignOptions, e as JWSVerifyOptions, d as JWSVerifyResult, s as sign, v as verify } from './shared/unjwt.DANsaNYC.mjs';
1
+ export { C as CompositeKey, f as ContentEncryptionAlgorithm, D as DeriveKeyOptions, e as DeriveKeyReturn, c as GenerateJWKOptions, d as GenerateJWKReturn, G as GenerateKeyAlgorithm, a as GenerateKeyOptions, b as GenerateKeyReturn, v as JWK, S as JWKAlgorithm, T as JWKPEMAlgorithm, J as JWKParameters, w as JWKSet, I as JWK_AES_CBC_HMAC, L as JWK_AES_GCM, H as JWK_AES_GCM_KW, F as JWK_AES_KW, s as JWK_Asymmetric, R as JWK_Asymmetric_Algorithm, j as JWK_EC, O as JWK_ECDH_ES, A as JWK_ECDSA, i as JWK_EC_Private, h as JWK_EC_Public, x as JWK_HMAC, p as JWK_OKP, o as JWK_OKP_Private, n as JWK_OKP_Public, P as JWK_OKP_SIGN, N as JWK_PBES2, u as JWK_Private, t as JWK_Public, m as JWK_RSA, B as JWK_RSA_ENC, z as JWK_RSA_PSS, l as JWK_RSA_Private, k as JWK_RSA_Public, y as JWK_RSA_SIGN, r as JWK_Symmetric, Q as JWK_Symmetric_Algorithm, q as JWK_oct, Y as JWT, Z as JWTClaimValidationOptions, X as JWTClaims, V as JoseHeaderParameters, K as KeyManagementAlgorithm, U as UnwrapKeyOptions, W as WrapKeyOptions, g as WrapKeyResult } from './shared/unjwt.CtHrClHc.mjs';
2
+ export { J as JWSAlgorithm, a as JWSHeaderParameters, f as JWSKeyLookupFunction, b as JWSProtectedHeader, c as JWSSignOptions, e as JWSVerifyOptions, d as JWSVerifyResult } from './shared/unjwt.BsLgL0DQ.mjs';
3
+ export { s as sign, v as verify } from './shared/unjwt.C5jNR_1K.mjs';
package/dist/jws.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import './shared/unjwt.D7ya3PwS.mjs';
2
- import './shared/unjwt.K_6rgVTy.mjs';
3
- export { s as sign, v as verify } from './shared/unjwt.Dc_YDjvO.mjs';
1
+ import './shared/unjwt.Vg02PZWw.mjs';
2
+ import './shared/unjwt.DCiTNyCM.mjs';
3
+ export { s as sign, v as verify } from './shared/unjwt.DmRAjMp8.mjs';