mp-front-cli 0.0.34 → 0.0.36
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/core/errors/error-catalog.d.ts +4 -4
- package/dist/core/errors/error-catalog.d.ts.map +1 -1
- package/dist/core/errors/index.d.ts +0 -1
- package/dist/core/errors/index.d.ts.map +1 -1
- package/dist/core/errors/message-error.d.ts +6 -11
- package/dist/core/errors/message-error.d.ts.map +1 -1
- package/dist/core/interfaces/message.d.ts +4 -2
- package/dist/core/interfaces/message.d.ts.map +1 -1
- package/dist/core/middleware/index.d.ts +3 -1
- package/dist/core/middleware/index.d.ts.map +1 -1
- package/dist/core/utils/api-request/fetch-service-be.d.ts +1 -1
- package/dist/core/utils/api-request/fetch-service-be.d.ts.map +1 -1
- package/dist/core/utils/api-request/fetch-service-fe.d.ts.map +1 -1
- package/dist/core/utils/custom-catch-error.d.ts +1 -1
- package/dist/core/utils/custom-catch-error.d.ts.map +1 -1
- package/dist/core/utils/custom-encoder.d.ts +1 -1
- package/dist/core/utils/custom-encoder.d.ts.map +1 -1
- package/dist/core/utils/custom-header.d.ts +3 -123
- package/dist/core/utils/custom-header.d.ts.map +1 -1
- package/dist/{custom-encoder-b2078b5c.js → custom-encoder-6737c6cb.js} +244 -245
- package/dist/custom-header-4aec1dac.js +888 -0
- package/dist/{custom-validator-d4c8885a.js → custom-validator-ae5da0a7.js} +718 -735
- package/dist/{index-6f6eb615.js → index-df4e0539.js} +4 -0
- package/dist/lang/common/errors/es_MX/index.d.ts +4 -0
- package/dist/lang/common/errors/es_MX/index.d.ts.map +1 -1
- package/dist/mp-front-cli-all.es.js +15 -17
- package/dist/mp-front-cli-core.es.js +193 -89
- package/dist/mp-front-cli-encoder.es.js +1 -1
- package/dist/mp-front-cli-header.es.js +5 -6
- package/dist/mp-front-cli-locale.es.js +1 -1
- package/dist/mp-front-cli-validator.es.js +3 -3
- package/package.json +5 -7
- package/dist/custom-header-bb082c8e.js +0 -878
- package/dist/mp-front-cli-catch-error.es.js +0 -14
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { t as Qr } from "./index-6f6eb615.js";
|
|
6
|
-
import { CustomLogger as jr } from "./mp-front-cli-logger.es.js";
|
|
7
|
-
const en = {
|
|
1
|
+
import { g as ft, C as zr } from "./custom-encoder-6737c6cb.js";
|
|
2
|
+
import { t as qr } from "./index-df4e0539.js";
|
|
3
|
+
import { CustomLogger as Xr } from "./mp-front-cli-logger.es.js";
|
|
4
|
+
const Yr = {
|
|
8
5
|
type: "logger",
|
|
9
6
|
log(t) {
|
|
10
7
|
this.output("log", t);
|
|
@@ -19,14 +16,14 @@ const en = {
|
|
|
19
16
|
console && console[t] && console[t].apply(console, e);
|
|
20
17
|
}
|
|
21
18
|
};
|
|
22
|
-
class
|
|
19
|
+
class xe {
|
|
23
20
|
constructor(e) {
|
|
24
21
|
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
25
22
|
this.init(e, r);
|
|
26
23
|
}
|
|
27
24
|
init(e) {
|
|
28
25
|
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
29
|
-
this.prefix = r.prefix || "i18next:", this.logger = e ||
|
|
26
|
+
this.prefix = r.prefix || "i18next:", this.logger = e || Yr, this.options = r, this.debug = r.debug;
|
|
30
27
|
}
|
|
31
28
|
log() {
|
|
32
29
|
for (var e = arguments.length, r = new Array(e), n = 0; n < e; n++)
|
|
@@ -52,17 +49,17 @@ class Ce {
|
|
|
52
49
|
return a && !this.debug ? null : (typeof e[0] == "string" && (e[0] = `${n}${this.prefix} ${e[0]}`), this.logger[r](e));
|
|
53
50
|
}
|
|
54
51
|
create(e) {
|
|
55
|
-
return new
|
|
52
|
+
return new xe(this.logger, {
|
|
56
53
|
prefix: `${this.prefix}:${e}:`,
|
|
57
54
|
...this.options
|
|
58
55
|
});
|
|
59
56
|
}
|
|
60
57
|
clone(e) {
|
|
61
|
-
return e = e || this.options, e.prefix = e.prefix || this.prefix, new
|
|
58
|
+
return e = e || this.options, e.prefix = e.prefix || this.prefix, new xe(this.logger, e);
|
|
62
59
|
}
|
|
63
60
|
}
|
|
64
|
-
var Z = new
|
|
65
|
-
class
|
|
61
|
+
var Z = new xe();
|
|
62
|
+
class Ue {
|
|
66
63
|
constructor() {
|
|
67
64
|
this.observers = {};
|
|
68
65
|
}
|
|
@@ -90,22 +87,22 @@ class Le {
|
|
|
90
87
|
});
|
|
91
88
|
}
|
|
92
89
|
}
|
|
93
|
-
function
|
|
90
|
+
function he() {
|
|
94
91
|
let t, e;
|
|
95
92
|
const r = new Promise((n, a) => {
|
|
96
93
|
t = n, e = a;
|
|
97
94
|
});
|
|
98
95
|
return r.resolve = t, r.reject = e, r;
|
|
99
96
|
}
|
|
100
|
-
function
|
|
97
|
+
function Kt(t) {
|
|
101
98
|
return t == null ? "" : "" + t;
|
|
102
99
|
}
|
|
103
|
-
function
|
|
100
|
+
function Zr(t, e, r) {
|
|
104
101
|
t.forEach((n) => {
|
|
105
102
|
e[n] && (r[n] = e[n]);
|
|
106
103
|
});
|
|
107
104
|
}
|
|
108
|
-
function
|
|
105
|
+
function ht(t, e, r) {
|
|
109
106
|
function n(i) {
|
|
110
107
|
return i && i.indexOf("###") > -1 ? i.replace(/###/g, ".") : i;
|
|
111
108
|
}
|
|
@@ -124,41 +121,41 @@ function pt(t, e, r) {
|
|
|
124
121
|
k: n(s.shift())
|
|
125
122
|
};
|
|
126
123
|
}
|
|
127
|
-
function
|
|
124
|
+
function Rt(t, e, r) {
|
|
128
125
|
const {
|
|
129
126
|
obj: n,
|
|
130
127
|
k: a
|
|
131
|
-
} =
|
|
128
|
+
} = ht(t, e, Object);
|
|
132
129
|
n[a] = r;
|
|
133
130
|
}
|
|
134
|
-
function
|
|
131
|
+
function Qr(t, e, r, n) {
|
|
135
132
|
const {
|
|
136
133
|
obj: a,
|
|
137
134
|
k: s
|
|
138
|
-
} =
|
|
135
|
+
} = ht(t, e, Object);
|
|
139
136
|
a[s] = a[s] || [], n && (a[s] = a[s].concat(r)), n || a[s].push(r);
|
|
140
137
|
}
|
|
141
|
-
function
|
|
138
|
+
function Ce(t, e) {
|
|
142
139
|
const {
|
|
143
140
|
obj: r,
|
|
144
141
|
k: n
|
|
145
|
-
} =
|
|
142
|
+
} = ht(t, e);
|
|
146
143
|
if (r)
|
|
147
144
|
return r[n];
|
|
148
145
|
}
|
|
149
|
-
function
|
|
150
|
-
const n =
|
|
151
|
-
return n !== void 0 ? n :
|
|
146
|
+
function jr(t, e, r) {
|
|
147
|
+
const n = Ce(t, r);
|
|
148
|
+
return n !== void 0 ? n : Ce(e, r);
|
|
152
149
|
}
|
|
153
|
-
function
|
|
150
|
+
function Qt(t, e, r) {
|
|
154
151
|
for (const n in e)
|
|
155
|
-
n !== "__proto__" && n !== "constructor" && (n in t ? typeof t[n] == "string" || t[n] instanceof String || typeof e[n] == "string" || e[n] instanceof String ? r && (t[n] = e[n]) :
|
|
152
|
+
n !== "__proto__" && n !== "constructor" && (n in t ? typeof t[n] == "string" || t[n] instanceof String || typeof e[n] == "string" || e[n] instanceof String ? r && (t[n] = e[n]) : Qt(t[n], e[n], r) : t[n] = e[n]);
|
|
156
153
|
return t;
|
|
157
154
|
}
|
|
158
|
-
function
|
|
155
|
+
function oe(t) {
|
|
159
156
|
return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
|
160
157
|
}
|
|
161
|
-
var
|
|
158
|
+
var en = {
|
|
162
159
|
"&": "&",
|
|
163
160
|
"<": "<",
|
|
164
161
|
">": ">",
|
|
@@ -166,13 +163,13 @@ var an = {
|
|
|
166
163
|
"'": "'",
|
|
167
164
|
"/": "/"
|
|
168
165
|
};
|
|
169
|
-
function
|
|
170
|
-
return typeof t == "string" ? t.replace(/[&<>"'\/]/g, (e) =>
|
|
166
|
+
function tn(t) {
|
|
167
|
+
return typeof t == "string" ? t.replace(/[&<>"'\/]/g, (e) => en[e]) : t;
|
|
171
168
|
}
|
|
172
|
-
const
|
|
173
|
-
function
|
|
169
|
+
const rn = [" ", ",", "?", "!", ";"];
|
|
170
|
+
function nn(t, e, r) {
|
|
174
171
|
e = e || "", r = r || "";
|
|
175
|
-
const n =
|
|
172
|
+
const n = rn.filter((i) => e.indexOf(i) < 0 && r.indexOf(i) < 0);
|
|
176
173
|
if (n.length === 0)
|
|
177
174
|
return !0;
|
|
178
175
|
const a = new RegExp(`(${n.map((i) => i === "?" ? "\\?" : i).join("|")})`);
|
|
@@ -183,7 +180,7 @@ function cn(t, e, r) {
|
|
|
183
180
|
}
|
|
184
181
|
return s;
|
|
185
182
|
}
|
|
186
|
-
function
|
|
183
|
+
function _e(t, e) {
|
|
187
184
|
let r = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ".";
|
|
188
185
|
if (!t)
|
|
189
186
|
return;
|
|
@@ -209,16 +206,16 @@ function Pe(t, e) {
|
|
|
209
206
|
return c[o];
|
|
210
207
|
}
|
|
211
208
|
const u = n.slice(s + i).join(r);
|
|
212
|
-
return u ?
|
|
209
|
+
return u ? _e(c, u, r) : void 0;
|
|
213
210
|
}
|
|
214
211
|
a = a[n[s]];
|
|
215
212
|
}
|
|
216
213
|
return a;
|
|
217
214
|
}
|
|
218
|
-
function
|
|
215
|
+
function Pe(t) {
|
|
219
216
|
return t && t.indexOf("_") > 0 ? t.replace("_", "-") : t;
|
|
220
217
|
}
|
|
221
|
-
class
|
|
218
|
+
class Ot extends Ue {
|
|
222
219
|
constructor(e) {
|
|
223
220
|
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
224
221
|
ns: ["translation"],
|
|
@@ -238,8 +235,8 @@ class Tt extends Le {
|
|
|
238
235
|
const s = a.keySeparator !== void 0 ? a.keySeparator : this.options.keySeparator, i = a.ignoreJSONStructure !== void 0 ? a.ignoreJSONStructure : this.options.ignoreJSONStructure;
|
|
239
236
|
let o = [e, r];
|
|
240
237
|
n && typeof n != "string" && (o = o.concat(n)), n && typeof n == "string" && (o = o.concat(s ? n.split(s) : n)), e.indexOf(".") > -1 && (o = e.split("."));
|
|
241
|
-
const c =
|
|
242
|
-
return c || !i || typeof n != "string" ? c :
|
|
238
|
+
const c = Ce(this.data, o);
|
|
239
|
+
return c || !i || typeof n != "string" ? c : _e(this.data && this.data[e] && this.data[e][r], n, s);
|
|
243
240
|
}
|
|
244
241
|
addResource(e, r, n, a) {
|
|
245
242
|
let s = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : {
|
|
@@ -247,7 +244,7 @@ class Tt extends Le {
|
|
|
247
244
|
};
|
|
248
245
|
const i = s.keySeparator !== void 0 ? s.keySeparator : this.options.keySeparator;
|
|
249
246
|
let o = [e, r];
|
|
250
|
-
n && (o = o.concat(i ? n.split(i) : n)), e.indexOf(".") > -1 && (o = e.split("."), a = r, r = o[1]), this.addNamespaces(r),
|
|
247
|
+
n && (o = o.concat(i ? n.split(i) : n)), e.indexOf(".") > -1 && (o = e.split("."), a = r, r = o[1]), this.addNamespaces(r), Rt(this.data, o, a), s.silent || this.emit("added", e, r, n, a);
|
|
251
248
|
}
|
|
252
249
|
addResources(e, r, n) {
|
|
253
250
|
let a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
|
|
@@ -264,11 +261,11 @@ class Tt extends Le {
|
|
|
264
261
|
silent: !1
|
|
265
262
|
}, o = [e, r];
|
|
266
263
|
e.indexOf(".") > -1 && (o = e.split("."), a = n, n = r, r = o[1]), this.addNamespaces(r);
|
|
267
|
-
let c =
|
|
268
|
-
a ?
|
|
264
|
+
let c = Ce(this.data, o) || {};
|
|
265
|
+
a ? Qt(c, n, s) : c = {
|
|
269
266
|
...c,
|
|
270
267
|
...n
|
|
271
|
-
},
|
|
268
|
+
}, Rt(this.data, o, c), i.silent || this.emit("added", e, r, n);
|
|
272
269
|
}
|
|
273
270
|
removeResourceBundle(e, r) {
|
|
274
271
|
this.hasResourceBundle(e, r) && delete this.data[e][r], this.removeNamespaces(r), this.emit("removed", e, r);
|
|
@@ -292,7 +289,7 @@ class Tt extends Le {
|
|
|
292
289
|
return this.data;
|
|
293
290
|
}
|
|
294
291
|
}
|
|
295
|
-
var
|
|
292
|
+
var jt = {
|
|
296
293
|
processors: {},
|
|
297
294
|
addPostProcessor(t) {
|
|
298
295
|
this.processors[t.name] = t;
|
|
@@ -303,11 +300,11 @@ var er = {
|
|
|
303
300
|
}), e;
|
|
304
301
|
}
|
|
305
302
|
};
|
|
306
|
-
const
|
|
307
|
-
class
|
|
303
|
+
const Tt = {};
|
|
304
|
+
class He extends Ue {
|
|
308
305
|
constructor(e) {
|
|
309
306
|
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
310
|
-
super(),
|
|
307
|
+
super(), Zr(["resourceStore", "languageUtils", "pluralResolver", "interpolator", "backendConnector", "i18nFormat", "utils"], e, this), this.options = r, this.options.keySeparator === void 0 && (this.options.keySeparator = "."), this.logger = Z.create("translator");
|
|
311
308
|
}
|
|
312
309
|
changeLanguage(e) {
|
|
313
310
|
e && (this.language = e);
|
|
@@ -326,7 +323,7 @@ class Ke extends Le {
|
|
|
326
323
|
n === void 0 && (n = ":");
|
|
327
324
|
const a = r.keySeparator !== void 0 ? r.keySeparator : this.options.keySeparator;
|
|
328
325
|
let s = r.ns || this.options.defaultNS || [];
|
|
329
|
-
const i = n && e.indexOf(n) > -1, o = !this.options.userDefinedKeySeparator && !r.keySeparator && !this.options.userDefinedNsSeparator && !r.nsSeparator && !
|
|
326
|
+
const i = n && e.indexOf(n) > -1, o = !this.options.userDefinedKeySeparator && !r.keySeparator && !this.options.userDefinedNsSeparator && !r.nsSeparator && !nn(e, n, a);
|
|
330
327
|
if (i && !o) {
|
|
331
328
|
const c = e.match(this.interpolator.nestingRegexp);
|
|
332
329
|
if (c && c.length > 0)
|
|
@@ -402,36 +399,36 @@ class Ke extends Le {
|
|
|
402
399
|
d = d.join(C), d && (d = this.extendTranslation(d, e, r, n));
|
|
403
400
|
else {
|
|
404
401
|
let m = !1, E = !1;
|
|
405
|
-
const _ = r.count !== void 0 && typeof r.count != "string", A =
|
|
402
|
+
const _ = r.count !== void 0 && typeof r.count != "string", A = He.hasDefaultValue(r), R = _ ? this.pluralResolver.getSuffix(u, r.count, r) : "", F = r.ordinal && _ ? this.pluralResolver.getSuffix(u, r.count, {
|
|
406
403
|
ordinal: !1
|
|
407
404
|
}) : "", q = _ && !r.ordinal && r.count === 0 && this.pluralResolver.shouldUseIntlApi(), Y = q && r[`defaultValue${this.options.pluralSeparator}zero`] || r[`defaultValue${R}`] || r[`defaultValue${F}`] || r.defaultValue;
|
|
408
405
|
!this.isValidLookup(d) && A && (m = !0, d = Y), this.isValidLookup(d) || (E = !0, d = i);
|
|
409
|
-
const
|
|
410
|
-
if (E || m ||
|
|
411
|
-
if (this.logger.log(
|
|
406
|
+
const Gr = (r.missingKeyNoValueFallbackToKey || this.options.missingKeyNoValueFallbackToKey) && E ? void 0 : d, le = A && Y !== d && this.options.updateMissing;
|
|
407
|
+
if (E || m || le) {
|
|
408
|
+
if (this.logger.log(le ? "updateKey" : "missingKey", u, c, i, le ? Y : d), s) {
|
|
412
409
|
const z = this.resolve(i, {
|
|
413
410
|
...r,
|
|
414
411
|
keySeparator: !1
|
|
415
412
|
});
|
|
416
413
|
z && z.res && this.logger.warn("Seems the loaded translations were in flat JSON format instead of nested. Either set keySeparator: false on init or make sure your translations are published in nested format.");
|
|
417
414
|
}
|
|
418
|
-
let
|
|
419
|
-
const
|
|
420
|
-
if (this.options.saveMissingTo === "fallback" &&
|
|
421
|
-
for (let z = 0; z <
|
|
422
|
-
|
|
415
|
+
let de = [];
|
|
416
|
+
const we = this.languageUtils.getFallbackCodes(this.options.fallbackLng, r.lng || this.language);
|
|
417
|
+
if (this.options.saveMissingTo === "fallback" && we && we[0])
|
|
418
|
+
for (let z = 0; z < we.length; z++)
|
|
419
|
+
de.push(we[z]);
|
|
423
420
|
else
|
|
424
|
-
this.options.saveMissingTo === "all" ?
|
|
425
|
-
const
|
|
426
|
-
const
|
|
427
|
-
this.options.missingKeyHandler ? this.options.missingKeyHandler(z, c,
|
|
421
|
+
this.options.saveMissingTo === "all" ? de = this.languageUtils.toResolveHierarchy(r.lng || this.language) : de.push(r.lng || this.language);
|
|
422
|
+
const Pt = (z, se, fe) => {
|
|
423
|
+
const Ht = A && fe !== d ? fe : Gr;
|
|
424
|
+
this.options.missingKeyHandler ? this.options.missingKeyHandler(z, c, se, Ht, le, r) : this.backendConnector && this.backendConnector.saveMissing && this.backendConnector.saveMissing(z, c, se, Ht, le, r), this.emit("missingKey", z, c, se, d);
|
|
428
425
|
};
|
|
429
|
-
this.options.saveMissing && (this.options.saveMissingPlurals && _ ?
|
|
430
|
-
const
|
|
431
|
-
q && r[`defaultValue${this.options.pluralSeparator}zero`] &&
|
|
432
|
-
|
|
426
|
+
this.options.saveMissing && (this.options.saveMissingPlurals && _ ? de.forEach((z) => {
|
|
427
|
+
const se = this.pluralResolver.getSuffixes(z, r);
|
|
428
|
+
q && r[`defaultValue${this.options.pluralSeparator}zero`] && se.indexOf(`${this.options.pluralSeparator}zero`) < 0 && se.push(`${this.options.pluralSeparator}zero`), se.forEach((fe) => {
|
|
429
|
+
Pt([z], i + fe, r[`defaultValue${fe}`] || Y);
|
|
433
430
|
});
|
|
434
|
-
}) :
|
|
431
|
+
}) : Pt(de, i, Y));
|
|
435
432
|
}
|
|
436
433
|
d = this.extendTranslation(d, e, r, f, n), E && d === i && this.options.appendNamespaceToMissingKey && (d = `${c}:${i}`), (E || m) && this.options.parseMissingKeyHandler && (this.options.compatibilityAPI !== "v1" ? d = this.options.parseMissingKeyHandler(this.options.appendNamespaceToMissingKey ? `${c}:${i}` : i, m ? d : void 0) : d = this.options.parseMissingKeyHandler(d));
|
|
437
434
|
}
|
|
@@ -475,7 +472,7 @@ class Ke extends Le {
|
|
|
475
472
|
}, n)), n.interpolation && this.interpolator.reset();
|
|
476
473
|
}
|
|
477
474
|
const o = n.postProcess || this.options.postProcess, c = typeof o == "string" ? [o] : o;
|
|
478
|
-
return e != null && c && c.length && n.applyPostProcessor !== !1 && (e =
|
|
475
|
+
return e != null && c && c.length && n.applyPostProcessor !== !1 && (e = jt.handle(c, e, r, this.options && this.options.postProcessPassResolved ? {
|
|
479
476
|
i18nResolved: {
|
|
480
477
|
...a,
|
|
481
478
|
usedParams: this.getUsedParamsDetails(n)
|
|
@@ -494,7 +491,7 @@ class Ke extends Le {
|
|
|
494
491
|
this.options.fallbackNS && (f = f.concat(this.options.fallbackNS));
|
|
495
492
|
const d = r.count !== void 0 && typeof r.count != "string", p = d && !r.ordinal && r.count === 0 && this.pluralResolver.shouldUseIntlApi(), h = r.context !== void 0 && (typeof r.context == "string" || typeof r.context == "number") && r.context !== "", g = r.lngs ? r.lngs : this.languageUtils.toResolveHierarchy(r.lng || this.language, r.fallbackLng);
|
|
496
493
|
f.forEach((S) => {
|
|
497
|
-
this.isValidLookup(n) || (o = S, !
|
|
494
|
+
this.isValidLookup(n) || (o = S, !Tt[`${g[0]}-${S}`] && this.utils && this.utils.hasLoadedNamespace && !this.utils.hasLoadedNamespace(o) && (Tt[`${g[0]}-${S}`] = !0, this.logger.warn(`key "${a}" for languages "${g.join(", ")}" won't get resolved as namespace "${o}" was not yet loaded`, "This means something IS WRONG in your setup. You access the t function before i18next.init / i18next.loadNamespace / i18next.changeLanguage was done. Wait for the callback or Promise to resolve before accessing it!!!")), g.forEach((C) => {
|
|
498
495
|
if (this.isValidLookup(n))
|
|
499
496
|
return;
|
|
500
497
|
i = C;
|
|
@@ -554,21 +551,21 @@ class Ke extends Le {
|
|
|
554
551
|
return !1;
|
|
555
552
|
}
|
|
556
553
|
}
|
|
557
|
-
function
|
|
554
|
+
function Ge(t) {
|
|
558
555
|
return t.charAt(0).toUpperCase() + t.slice(1);
|
|
559
556
|
}
|
|
560
|
-
class
|
|
557
|
+
class It {
|
|
561
558
|
constructor(e) {
|
|
562
559
|
this.options = e, this.supportedLngs = this.options.supportedLngs || !1, this.logger = Z.create("languageUtils");
|
|
563
560
|
}
|
|
564
561
|
getScriptPartFromCode(e) {
|
|
565
|
-
if (e =
|
|
562
|
+
if (e = Pe(e), !e || e.indexOf("-") < 0)
|
|
566
563
|
return null;
|
|
567
564
|
const r = e.split("-");
|
|
568
565
|
return r.length === 2 || (r.pop(), r[r.length - 1].toLowerCase() === "x") ? null : this.formatLanguageCode(r.join("-"));
|
|
569
566
|
}
|
|
570
567
|
getLanguagePartFromCode(e) {
|
|
571
|
-
if (e =
|
|
568
|
+
if (e = Pe(e), !e || e.indexOf("-") < 0)
|
|
572
569
|
return e;
|
|
573
570
|
const r = e.split("-");
|
|
574
571
|
return this.formatLanguageCode(r[0]);
|
|
@@ -577,7 +574,7 @@ class Wt {
|
|
|
577
574
|
if (typeof e == "string" && e.indexOf("-") > -1) {
|
|
578
575
|
const r = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"];
|
|
579
576
|
let n = e.split("-");
|
|
580
|
-
return this.options.lowerCaseLng ? n = n.map((a) => a.toLowerCase()) : n.length === 2 ? (n[0] = n[0].toLowerCase(), n[1] = n[1].toUpperCase(), r.indexOf(n[1].toLowerCase()) > -1 && (n[1] =
|
|
577
|
+
return this.options.lowerCaseLng ? n = n.map((a) => a.toLowerCase()) : n.length === 2 ? (n[0] = n[0].toLowerCase(), n[1] = n[1].toUpperCase(), r.indexOf(n[1].toLowerCase()) > -1 && (n[1] = Ge(n[1].toLowerCase()))) : n.length === 3 && (n[0] = n[0].toLowerCase(), n[1].length === 2 && (n[1] = n[1].toUpperCase()), n[0] !== "sgn" && n[2].length === 2 && (n[2] = n[2].toUpperCase()), r.indexOf(n[1].toLowerCase()) > -1 && (n[1] = Ge(n[1].toLowerCase())), r.indexOf(n[2].toLowerCase()) > -1 && (n[2] = Ge(n[2].toLowerCase()))), n.join("-");
|
|
581
578
|
}
|
|
582
579
|
return this.options.cleanCode || this.options.lowerCaseLng ? e.toLowerCase() : e;
|
|
583
580
|
}
|
|
@@ -626,7 +623,7 @@ class Wt {
|
|
|
626
623
|
}), a;
|
|
627
624
|
}
|
|
628
625
|
}
|
|
629
|
-
let
|
|
626
|
+
let an = [{
|
|
630
627
|
lngs: ["ach", "ak", "am", "arn", "br", "fil", "gun", "ln", "mfe", "mg", "mi", "oc", "pt", "pt-BR", "tg", "tl", "ti", "tr", "uz", "wa"],
|
|
631
628
|
nr: [1, 2],
|
|
632
629
|
fc: 1
|
|
@@ -718,7 +715,7 @@ let un = [{
|
|
|
718
715
|
lngs: ["he", "iw"],
|
|
719
716
|
nr: [1, 2, 20, 21],
|
|
720
717
|
fc: 22
|
|
721
|
-
}],
|
|
718
|
+
}], sn = {
|
|
722
719
|
1: function(t) {
|
|
723
720
|
return +(t > 1);
|
|
724
721
|
},
|
|
@@ -786,7 +783,7 @@ let un = [{
|
|
|
786
783
|
return t == 1 ? 0 : t == 2 ? 1 : (t < 0 || t > 10) && t % 10 == 0 ? 2 : 3;
|
|
787
784
|
}
|
|
788
785
|
};
|
|
789
|
-
const
|
|
786
|
+
const on = ["v1", "v2", "v3"], cn = ["v4"], Wt = {
|
|
790
787
|
zero: 0,
|
|
791
788
|
one: 1,
|
|
792
789
|
two: 2,
|
|
@@ -794,21 +791,21 @@ const dn = ["v1", "v2", "v3"], fn = ["v4"], Ut = {
|
|
|
794
791
|
many: 4,
|
|
795
792
|
other: 5
|
|
796
793
|
};
|
|
797
|
-
function
|
|
794
|
+
function un() {
|
|
798
795
|
const t = {};
|
|
799
|
-
return
|
|
796
|
+
return an.forEach((e) => {
|
|
800
797
|
e.lngs.forEach((r) => {
|
|
801
798
|
t[r] = {
|
|
802
799
|
numbers: e.nr,
|
|
803
|
-
plurals:
|
|
800
|
+
plurals: sn[e.fc]
|
|
804
801
|
};
|
|
805
802
|
});
|
|
806
803
|
}), t;
|
|
807
804
|
}
|
|
808
|
-
class
|
|
805
|
+
class ln {
|
|
809
806
|
constructor(e) {
|
|
810
807
|
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
811
|
-
this.languageUtils = e, this.options = r, this.logger = Z.create("pluralResolver"), (!this.options.compatibilityJSON ||
|
|
808
|
+
this.languageUtils = e, this.options = r, this.logger = Z.create("pluralResolver"), (!this.options.compatibilityJSON || cn.includes(this.options.compatibilityJSON)) && (typeof Intl > "u" || !Intl.PluralRules) && (this.options.compatibilityJSON = "v3", this.logger.error("Your environment seems not to be Intl API compatible, use an Intl.PluralRules polyfill. Will fallback to the compatibilityJSON v3 format handling.")), this.rules = un();
|
|
812
809
|
}
|
|
813
810
|
addRule(e, r) {
|
|
814
811
|
this.rules[e] = r;
|
|
@@ -817,7 +814,7 @@ class pn {
|
|
|
817
814
|
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
818
815
|
if (this.shouldUseIntlApi())
|
|
819
816
|
try {
|
|
820
|
-
return new Intl.PluralRules(
|
|
817
|
+
return new Intl.PluralRules(Pe(e === "dev" ? "en" : e), {
|
|
821
818
|
type: r.ordinal ? "ordinal" : "cardinal"
|
|
822
819
|
});
|
|
823
820
|
} catch {
|
|
@@ -837,7 +834,7 @@ class pn {
|
|
|
837
834
|
getSuffixes(e) {
|
|
838
835
|
let r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
839
836
|
const n = this.getRule(e, r);
|
|
840
|
-
return n ? this.shouldUseIntlApi() ? n.resolvedOptions().pluralCategories.sort((a, s) =>
|
|
837
|
+
return n ? this.shouldUseIntlApi() ? n.resolvedOptions().pluralCategories.sort((a, s) => Wt[a] - Wt[s]).map((a) => `${this.options.prepend}${r.ordinal ? `ordinal${this.options.prepend}` : ""}${a}`) : n.numbers.map((a) => this.getSuffix(e, a, r)) : [];
|
|
841
838
|
}
|
|
842
839
|
getSuffix(e, r) {
|
|
843
840
|
let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
@@ -852,14 +849,14 @@ class pn {
|
|
|
852
849
|
return this.options.compatibilityJSON === "v1" ? a === 1 ? "" : typeof a == "number" ? `_plural_${a.toString()}` : s() : this.options.compatibilityJSON === "v2" || this.options.simplifyPluralSuffix && e.numbers.length === 2 && e.numbers[0] === 1 ? s() : this.options.prepend && n.toString() ? this.options.prepend + n.toString() : n.toString();
|
|
853
850
|
}
|
|
854
851
|
shouldUseIntlApi() {
|
|
855
|
-
return !
|
|
852
|
+
return !on.includes(this.options.compatibilityJSON);
|
|
856
853
|
}
|
|
857
854
|
}
|
|
858
|
-
function
|
|
859
|
-
let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, s =
|
|
860
|
-
return !s && a && typeof r == "string" && (s =
|
|
855
|
+
function Ut(t, e, r) {
|
|
856
|
+
let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ".", a = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : !0, s = jr(t, e, r);
|
|
857
|
+
return !s && a && typeof r == "string" && (s = _e(t, r, n), s === void 0 && (s = _e(e, r, n))), s;
|
|
861
858
|
}
|
|
862
|
-
class
|
|
859
|
+
class dn {
|
|
863
860
|
constructor() {
|
|
864
861
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
865
862
|
this.logger = Z.create("interpolator"), this.options = e, this.format = e.interpolation && e.interpolation.format || ((r) => r), this.init(e);
|
|
@@ -870,7 +867,7 @@ class gn {
|
|
|
870
867
|
escapeValue: !0
|
|
871
868
|
});
|
|
872
869
|
const r = e.interpolation;
|
|
873
|
-
this.escape = r.escape !== void 0 ? r.escape :
|
|
870
|
+
this.escape = r.escape !== void 0 ? r.escape : tn, this.escapeValue = r.escapeValue !== void 0 ? r.escapeValue : !0, this.useRawValueToEscape = r.useRawValueToEscape !== void 0 ? r.useRawValueToEscape : !1, this.prefix = r.prefix ? oe(r.prefix) : r.prefixEscaped || "{{", this.suffix = r.suffix ? oe(r.suffix) : r.suffixEscaped || "}}", this.formatSeparator = r.formatSeparator ? r.formatSeparator : r.formatSeparator || ",", this.unescapePrefix = r.unescapeSuffix ? "" : r.unescapePrefix || "-", this.unescapeSuffix = this.unescapePrefix ? "" : r.unescapeSuffix || "", this.nestingPrefix = r.nestingPrefix ? oe(r.nestingPrefix) : r.nestingPrefixEscaped || oe("$t("), this.nestingSuffix = r.nestingSuffix ? oe(r.nestingSuffix) : r.nestingSuffixEscaped || oe(")"), this.nestingOptionsSeparator = r.nestingOptionsSeparator ? r.nestingOptionsSeparator : r.nestingOptionsSeparator || ",", this.maxReplaces = r.maxReplaces ? r.maxReplaces : 1e3, this.alwaysFormat = r.alwaysFormat !== void 0 ? r.alwaysFormat : !1, this.resetRegExp();
|
|
874
871
|
}
|
|
875
872
|
reset() {
|
|
876
873
|
this.options && this.init(this.options);
|
|
@@ -891,7 +888,7 @@ class gn {
|
|
|
891
888
|
}
|
|
892
889
|
const l = (h) => {
|
|
893
890
|
if (h.indexOf(this.formatSeparator) < 0) {
|
|
894
|
-
const v =
|
|
891
|
+
const v = Ut(r, c, h, this.options.keySeparator, this.options.ignoreJSONStructure);
|
|
895
892
|
return this.alwaysFormat ? this.format(v, void 0, n, {
|
|
896
893
|
...a,
|
|
897
894
|
...r,
|
|
@@ -899,7 +896,7 @@ class gn {
|
|
|
899
896
|
}) : v;
|
|
900
897
|
}
|
|
901
898
|
const g = h.split(this.formatSeparator), S = g.shift().trim(), C = g.join(this.formatSeparator).trim();
|
|
902
|
-
return this.format(
|
|
899
|
+
return this.format(Ut(r, c, S, this.options.keySeparator, this.options.ignoreJSONStructure), C, n, {
|
|
903
900
|
...a,
|
|
904
901
|
...r,
|
|
905
902
|
interpolationkey: S
|
|
@@ -928,7 +925,7 @@ class gn {
|
|
|
928
925
|
} else
|
|
929
926
|
this.logger.warn(`missed to pass in variable ${g} for interpolating ${e}`), i = "";
|
|
930
927
|
else
|
|
931
|
-
typeof i != "string" && !this.useRawValueToEscape && (i =
|
|
928
|
+
typeof i != "string" && !this.useRawValueToEscape && (i = Kt(i));
|
|
932
929
|
const S = h.safeValue(i);
|
|
933
930
|
if (e = e.replace(s[0], S), d ? (h.regex.lastIndex += i.length, h.regex.lastIndex -= s[0].length) : h.regex.lastIndex = 0, o++, o >= this.maxReplaces)
|
|
934
931
|
break;
|
|
@@ -968,7 +965,7 @@ class gn {
|
|
|
968
965
|
}
|
|
969
966
|
if (s = r(o.call(this, a[1].trim(), i), i), s && a[0] === e && typeof s != "string")
|
|
970
967
|
return s;
|
|
971
|
-
typeof s != "string" && (s =
|
|
968
|
+
typeof s != "string" && (s = Kt(s)), s || (this.logger.warn(`missed to resolve ${a[1]} for nesting ${e}`), s = ""), u && (s = c.reduce((l, f) => this.format(l, f, n.lng, {
|
|
972
969
|
...n,
|
|
973
970
|
interpolationkey: a[1].trim()
|
|
974
971
|
}), s.trim())), e = e.replace(a[0], s), this.regexp.lastIndex = 0;
|
|
@@ -976,7 +973,7 @@ class gn {
|
|
|
976
973
|
return e;
|
|
977
974
|
}
|
|
978
975
|
}
|
|
979
|
-
function
|
|
976
|
+
function fn(t) {
|
|
980
977
|
let e = t.toLowerCase().trim();
|
|
981
978
|
const r = {};
|
|
982
979
|
if (t.indexOf("(") > -1) {
|
|
@@ -995,44 +992,44 @@ function mn(t) {
|
|
|
995
992
|
formatOptions: r
|
|
996
993
|
};
|
|
997
994
|
}
|
|
998
|
-
function
|
|
995
|
+
function ce(t) {
|
|
999
996
|
const e = {};
|
|
1000
997
|
return function(n, a, s) {
|
|
1001
998
|
const i = a + JSON.stringify(s);
|
|
1002
999
|
let o = e[i];
|
|
1003
|
-
return o || (o = t(
|
|
1000
|
+
return o || (o = t(Pe(a), s), e[i] = o), o(n);
|
|
1004
1001
|
};
|
|
1005
1002
|
}
|
|
1006
|
-
class
|
|
1003
|
+
class hn {
|
|
1007
1004
|
constructor() {
|
|
1008
1005
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
1009
1006
|
this.logger = Z.create("formatter"), this.options = e, this.formats = {
|
|
1010
|
-
number:
|
|
1007
|
+
number: ce((r, n) => {
|
|
1011
1008
|
const a = new Intl.NumberFormat(r, {
|
|
1012
1009
|
...n
|
|
1013
1010
|
});
|
|
1014
1011
|
return (s) => a.format(s);
|
|
1015
1012
|
}),
|
|
1016
|
-
currency:
|
|
1013
|
+
currency: ce((r, n) => {
|
|
1017
1014
|
const a = new Intl.NumberFormat(r, {
|
|
1018
1015
|
...n,
|
|
1019
1016
|
style: "currency"
|
|
1020
1017
|
});
|
|
1021
1018
|
return (s) => a.format(s);
|
|
1022
1019
|
}),
|
|
1023
|
-
datetime:
|
|
1020
|
+
datetime: ce((r, n) => {
|
|
1024
1021
|
const a = new Intl.DateTimeFormat(r, {
|
|
1025
1022
|
...n
|
|
1026
1023
|
});
|
|
1027
1024
|
return (s) => a.format(s);
|
|
1028
1025
|
}),
|
|
1029
|
-
relativetime:
|
|
1026
|
+
relativetime: ce((r, n) => {
|
|
1030
1027
|
const a = new Intl.RelativeTimeFormat(r, {
|
|
1031
1028
|
...n
|
|
1032
1029
|
});
|
|
1033
1030
|
return (s) => a.format(s, n.range || "day");
|
|
1034
1031
|
}),
|
|
1035
|
-
list:
|
|
1032
|
+
list: ce((r, n) => {
|
|
1036
1033
|
const a = new Intl.ListFormat(r, {
|
|
1037
1034
|
...n
|
|
1038
1035
|
});
|
|
@@ -1050,7 +1047,7 @@ class yn {
|
|
|
1050
1047
|
this.formats[e.toLowerCase().trim()] = r;
|
|
1051
1048
|
}
|
|
1052
1049
|
addCached(e, r) {
|
|
1053
|
-
this.formats[e.toLowerCase().trim()] =
|
|
1050
|
+
this.formats[e.toLowerCase().trim()] = ce(r);
|
|
1054
1051
|
}
|
|
1055
1052
|
format(e, r, n) {
|
|
1056
1053
|
let a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
@@ -1058,7 +1055,7 @@ class yn {
|
|
|
1058
1055
|
const {
|
|
1059
1056
|
formatName: u,
|
|
1060
1057
|
formatOptions: l
|
|
1061
|
-
} =
|
|
1058
|
+
} = fn(c);
|
|
1062
1059
|
if (this.formats[u]) {
|
|
1063
1060
|
let f = o;
|
|
1064
1061
|
try {
|
|
@@ -1078,10 +1075,10 @@ class yn {
|
|
|
1078
1075
|
}, e);
|
|
1079
1076
|
}
|
|
1080
1077
|
}
|
|
1081
|
-
function
|
|
1078
|
+
function pn(t, e) {
|
|
1082
1079
|
t.pending[e] !== void 0 && (delete t.pending[e], t.pendingCount--);
|
|
1083
1080
|
}
|
|
1084
|
-
class
|
|
1081
|
+
class gn extends Ue {
|
|
1085
1082
|
constructor(e, r, n) {
|
|
1086
1083
|
let a = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
|
|
1087
1084
|
super(), this.backend = e, this.store = r, this.services = n, this.languageUtils = n.languageUtils, this.options = a, this.logger = Z.create("backendConnector"), this.waitingReads = [], this.maxParallelReads = a.maxParallelReads || 10, this.readingCalls = 0, this.maxRetries = a.maxRetries >= 0 ? a.maxRetries : 5, this.retryTimeout = a.retryTimeout >= 1 ? a.retryTimeout : 350, this.state = {}, this.queue = [], this.backend && this.backend.init && this.backend.init(n, a.backend, a);
|
|
@@ -1112,7 +1109,7 @@ class Sn extends Le {
|
|
|
1112
1109
|
r && this.emit("failedLoading", s, i, r), n && this.store.addResourceBundle(s, i, n), this.state[e] = r ? -1 : 2;
|
|
1113
1110
|
const o = {};
|
|
1114
1111
|
this.queue.forEach((c) => {
|
|
1115
|
-
|
|
1112
|
+
Qr(c.loaded, [s], i), pn(c, e), r && c.errors.push(r), c.pendingCount === 0 && !c.done && (Object.keys(c.loaded).forEach((u) => {
|
|
1116
1113
|
o[u] || (o[u] = {});
|
|
1117
1114
|
const l = c.loaded[u];
|
|
1118
1115
|
l.length && l.forEach((f) => {
|
|
@@ -1215,7 +1212,7 @@ class Sn extends Le {
|
|
|
1215
1212
|
}
|
|
1216
1213
|
}
|
|
1217
1214
|
}
|
|
1218
|
-
function
|
|
1215
|
+
function Lt() {
|
|
1219
1216
|
return {
|
|
1220
1217
|
debug: !1,
|
|
1221
1218
|
initImmediate: !0,
|
|
@@ -1274,22 +1271,22 @@ function Dt() {
|
|
|
1274
1271
|
}
|
|
1275
1272
|
};
|
|
1276
1273
|
}
|
|
1277
|
-
function
|
|
1274
|
+
function Dt(t) {
|
|
1278
1275
|
return typeof t.ns == "string" && (t.ns = [t.ns]), typeof t.fallbackLng == "string" && (t.fallbackLng = [t.fallbackLng]), typeof t.fallbackNS == "string" && (t.fallbackNS = [t.fallbackNS]), t.supportedLngs && t.supportedLngs.indexOf("cimode") < 0 && (t.supportedLngs = t.supportedLngs.concat(["cimode"])), t;
|
|
1279
1276
|
}
|
|
1280
|
-
function
|
|
1277
|
+
function Se() {
|
|
1281
1278
|
}
|
|
1282
|
-
function
|
|
1279
|
+
function mn(t) {
|
|
1283
1280
|
Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach((r) => {
|
|
1284
1281
|
typeof t[r] == "function" && (t[r] = t[r].bind(t));
|
|
1285
1282
|
});
|
|
1286
1283
|
}
|
|
1287
|
-
class
|
|
1284
|
+
class pe extends Ue {
|
|
1288
1285
|
constructor() {
|
|
1289
1286
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, r = arguments.length > 1 ? arguments[1] : void 0;
|
|
1290
|
-
if (super(), this.options =
|
|
1287
|
+
if (super(), this.options = Dt(e), this.services = {}, this.logger = Z, this.modules = {
|
|
1291
1288
|
external: []
|
|
1292
|
-
},
|
|
1289
|
+
}, mn(this), r && !this.isInitialized && !e.isClone) {
|
|
1293
1290
|
if (!this.options.initImmediate)
|
|
1294
1291
|
return this.init(e, r), this;
|
|
1295
1292
|
setTimeout(() => {
|
|
@@ -1301,11 +1298,11 @@ class ge extends Le {
|
|
|
1301
1298
|
var e = this;
|
|
1302
1299
|
let r = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, n = arguments.length > 1 ? arguments[1] : void 0;
|
|
1303
1300
|
typeof r == "function" && (n = r, r = {}), !r.defaultNS && r.defaultNS !== !1 && r.ns && (typeof r.ns == "string" ? r.defaultNS = r.ns : r.ns.indexOf("translation") < 0 && (r.defaultNS = r.ns[0]));
|
|
1304
|
-
const a =
|
|
1301
|
+
const a = Lt();
|
|
1305
1302
|
this.options = {
|
|
1306
1303
|
...a,
|
|
1307
1304
|
...this.options,
|
|
1308
|
-
...
|
|
1305
|
+
...Dt(r)
|
|
1309
1306
|
}, this.options.compatibilityAPI !== "v1" && (this.options.interpolation = {
|
|
1310
1307
|
...a.interpolation,
|
|
1311
1308
|
...this.options.interpolation
|
|
@@ -1316,21 +1313,21 @@ class ge extends Le {
|
|
|
1316
1313
|
if (!this.options.isClone) {
|
|
1317
1314
|
this.modules.logger ? Z.init(s(this.modules.logger), this.options) : Z.init(null, this.options);
|
|
1318
1315
|
let l;
|
|
1319
|
-
this.modules.formatter ? l = this.modules.formatter : typeof Intl < "u" && (l =
|
|
1320
|
-
const f = new
|
|
1321
|
-
this.store = new
|
|
1316
|
+
this.modules.formatter ? l = this.modules.formatter : typeof Intl < "u" && (l = hn);
|
|
1317
|
+
const f = new It(this.options);
|
|
1318
|
+
this.store = new Ot(this.options.resources, this.options);
|
|
1322
1319
|
const d = this.services;
|
|
1323
|
-
d.logger = Z, d.resourceStore = this.store, d.languageUtils = f, d.pluralResolver = new
|
|
1320
|
+
d.logger = Z, d.resourceStore = this.store, d.languageUtils = f, d.pluralResolver = new ln(f, {
|
|
1324
1321
|
prepend: this.options.pluralSeparator,
|
|
1325
1322
|
compatibilityJSON: this.options.compatibilityJSON,
|
|
1326
1323
|
simplifyPluralSuffix: this.options.simplifyPluralSuffix
|
|
1327
|
-
}), l && (!this.options.interpolation.format || this.options.interpolation.format === a.interpolation.format) && (d.formatter = s(l), d.formatter.init(d, this.options), this.options.interpolation.format = d.formatter.format.bind(d.formatter)), d.interpolator = new
|
|
1324
|
+
}), l && (!this.options.interpolation.format || this.options.interpolation.format === a.interpolation.format) && (d.formatter = s(l), d.formatter.init(d, this.options), this.options.interpolation.format = d.formatter.format.bind(d.formatter)), d.interpolator = new dn(this.options), d.utils = {
|
|
1328
1325
|
hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
|
|
1329
|
-
}, d.backendConnector = new
|
|
1326
|
+
}, d.backendConnector = new gn(s(this.modules.backend), d.resourceStore, d, this.options), d.backendConnector.on("*", function(p) {
|
|
1330
1327
|
for (var h = arguments.length, g = new Array(h > 1 ? h - 1 : 0), S = 1; S < h; S++)
|
|
1331
1328
|
g[S - 1] = arguments[S];
|
|
1332
1329
|
e.emit(p, ...g);
|
|
1333
|
-
}), this.modules.languageDetector && (d.languageDetector = s(this.modules.languageDetector), d.languageDetector.init && d.languageDetector.init(d, this.options.detection, this.options)), this.modules.i18nFormat && (d.i18nFormat = s(this.modules.i18nFormat), d.i18nFormat.init && d.i18nFormat.init(this)), this.translator = new
|
|
1330
|
+
}), this.modules.languageDetector && (d.languageDetector = s(this.modules.languageDetector), d.languageDetector.init && d.languageDetector.init(d, this.options.detection, this.options)), this.modules.i18nFormat && (d.i18nFormat = s(this.modules.i18nFormat), d.i18nFormat.init && d.i18nFormat.init(this)), this.translator = new He(this.services, this.options), this.translator.on("*", function(p) {
|
|
1334
1331
|
for (var h = arguments.length, g = new Array(h > 1 ? h - 1 : 0), S = 1; S < h; S++)
|
|
1335
1332
|
g[S - 1] = arguments[S];
|
|
1336
1333
|
e.emit(p, ...g);
|
|
@@ -1338,7 +1335,7 @@ class ge extends Le {
|
|
|
1338
1335
|
p.init && p.init(this);
|
|
1339
1336
|
});
|
|
1340
1337
|
}
|
|
1341
|
-
if (this.format = this.options.interpolation.format, n || (n =
|
|
1338
|
+
if (this.format = this.options.interpolation.format, n || (n = Se), this.options.fallbackLng && !this.services.languageDetector && !this.options.lng) {
|
|
1342
1339
|
const l = this.services.languageUtils.getFallbackCodes(this.options.fallbackLng);
|
|
1343
1340
|
l.length > 0 && l[0] !== "dev" && (this.options.lng = l[0]);
|
|
1344
1341
|
}
|
|
@@ -1351,7 +1348,7 @@ class ge extends Le {
|
|
|
1351
1348
|
return e.store[l](...arguments), e;
|
|
1352
1349
|
};
|
|
1353
1350
|
});
|
|
1354
|
-
const c =
|
|
1351
|
+
const c = he(), u = () => {
|
|
1355
1352
|
const l = (f, d) => {
|
|
1356
1353
|
this.isInitialized && !this.initializedStoreOnce && this.logger.warn("init: i18next is already initialized. You should call init just once!"), this.isInitialized = !0, this.options.isClone || this.logger.log("initialized", this.options), this.emit("initialized", this.options), c.resolve(d), n(f, d);
|
|
1357
1354
|
};
|
|
@@ -1362,7 +1359,7 @@ class ge extends Le {
|
|
|
1362
1359
|
return this.options.resources || !this.options.initImmediate ? u() : setTimeout(u, 0), c;
|
|
1363
1360
|
}
|
|
1364
1361
|
loadResources(e) {
|
|
1365
|
-
let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] :
|
|
1362
|
+
let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Se;
|
|
1366
1363
|
const a = typeof e == "string" ? e : this.language;
|
|
1367
1364
|
if (typeof e == "function" && (n = e), !this.options.resources || this.options.partialBundledLanguages) {
|
|
1368
1365
|
if (a && a.toLowerCase() === "cimode" && (!this.options.preload || this.options.preload.length === 0))
|
|
@@ -1381,8 +1378,8 @@ class ge extends Le {
|
|
|
1381
1378
|
n(null);
|
|
1382
1379
|
}
|
|
1383
1380
|
reloadResources(e, r, n) {
|
|
1384
|
-
const a =
|
|
1385
|
-
return e || (e = this.languages), r || (r = this.options.ns), n || (n =
|
|
1381
|
+
const a = he();
|
|
1382
|
+
return e || (e = this.languages), r || (r = this.options.ns), n || (n = Se), this.services.backendConnector.reload(e, r, (s) => {
|
|
1386
1383
|
a.resolve(), n(s);
|
|
1387
1384
|
}), a;
|
|
1388
1385
|
}
|
|
@@ -1391,7 +1388,7 @@ class ge extends Le {
|
|
|
1391
1388
|
throw new Error("You are passing an undefined module! Please check the object you are passing to i18next.use()");
|
|
1392
1389
|
if (!e.type)
|
|
1393
1390
|
throw new Error("You are passing a wrong module! Please check the object you are passing to i18next.use()");
|
|
1394
|
-
return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" &&
|
|
1391
|
+
return e.type === "backend" && (this.modules.backend = e), (e.type === "logger" || e.log && e.warn && e.error) && (this.modules.logger = e), e.type === "languageDetector" && (this.modules.languageDetector = e), e.type === "i18nFormat" && (this.modules.i18nFormat = e), e.type === "postProcessor" && jt.addPostProcessor(e), e.type === "formatter" && (this.modules.formatter = e), e.type === "3rdParty" && this.modules.external.push(e), this;
|
|
1395
1392
|
}
|
|
1396
1393
|
setResolvedLanguage(e) {
|
|
1397
1394
|
if (!(!e || !this.languages) && !(["cimode", "dev"].indexOf(e) > -1))
|
|
@@ -1406,7 +1403,7 @@ class ge extends Le {
|
|
|
1406
1403
|
changeLanguage(e, r) {
|
|
1407
1404
|
var n = this;
|
|
1408
1405
|
this.isLanguageChangingTo = e;
|
|
1409
|
-
const a =
|
|
1406
|
+
const a = he();
|
|
1410
1407
|
this.emit("languageChanging", e);
|
|
1411
1408
|
const s = (c) => {
|
|
1412
1409
|
this.language = c, this.languages = this.services.languageUtils.toResolveHierarchy(c), this.resolvedLanguage = void 0, this.setResolvedLanguage(c);
|
|
@@ -1474,7 +1471,7 @@ class ge extends Le {
|
|
|
1474
1471
|
return !!(this.hasResourceBundle(n, e) || !this.services.backendConnector.backend || this.options.resources && !this.options.partialBundledLanguages || i(n, e) && (!a || i(s, e)));
|
|
1475
1472
|
}
|
|
1476
1473
|
loadNamespaces(e, r) {
|
|
1477
|
-
const n =
|
|
1474
|
+
const n = he();
|
|
1478
1475
|
return this.options.ns ? (typeof e == "string" && (e = [e]), e.forEach((a) => {
|
|
1479
1476
|
this.options.ns.indexOf(a) < 0 && this.options.ns.push(a);
|
|
1480
1477
|
}), this.loadResources((a) => {
|
|
@@ -1482,7 +1479,7 @@ class ge extends Le {
|
|
|
1482
1479
|
}), n) : (r && r(), Promise.resolve());
|
|
1483
1480
|
}
|
|
1484
1481
|
loadLanguages(e, r) {
|
|
1485
|
-
const n =
|
|
1482
|
+
const n = he();
|
|
1486
1483
|
typeof e == "string" && (e = [e]);
|
|
1487
1484
|
const a = this.options.preload || [], s = e.filter((i) => a.indexOf(i) < 0);
|
|
1488
1485
|
return s.length ? (this.options.preload = a.concat(s), this.loadResources((i) => {
|
|
@@ -1492,29 +1489,29 @@ class ge extends Le {
|
|
|
1492
1489
|
dir(e) {
|
|
1493
1490
|
if (e || (e = this.resolvedLanguage || (this.languages && this.languages.length > 0 ? this.languages[0] : this.language)), !e)
|
|
1494
1491
|
return "rtl";
|
|
1495
|
-
const r = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], n = this.services && this.services.languageUtils || new
|
|
1492
|
+
const r = ["ar", "shu", "sqr", "ssh", "xaa", "yhd", "yud", "aao", "abh", "abv", "acm", "acq", "acw", "acx", "acy", "adf", "ads", "aeb", "aec", "afb", "ajp", "apc", "apd", "arb", "arq", "ars", "ary", "arz", "auz", "avl", "ayh", "ayl", "ayn", "ayp", "bbz", "pga", "he", "iw", "ps", "pbt", "pbu", "pst", "prp", "prd", "ug", "ur", "ydd", "yds", "yih", "ji", "yi", "hbo", "men", "xmn", "fa", "jpr", "peo", "pes", "prs", "dv", "sam", "ckb"], n = this.services && this.services.languageUtils || new It(Lt());
|
|
1496
1493
|
return r.indexOf(n.getLanguagePartFromCode(e)) > -1 || e.toLowerCase().indexOf("-arab") > 1 ? "rtl" : "ltr";
|
|
1497
1494
|
}
|
|
1498
1495
|
static createInstance() {
|
|
1499
1496
|
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, r = arguments.length > 1 ? arguments[1] : void 0;
|
|
1500
|
-
return new
|
|
1497
|
+
return new pe(e, r);
|
|
1501
1498
|
}
|
|
1502
1499
|
cloneInstance() {
|
|
1503
|
-
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] :
|
|
1500
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, r = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Se;
|
|
1504
1501
|
const n = e.forkResourceStore;
|
|
1505
1502
|
n && delete e.forkResourceStore;
|
|
1506
1503
|
const a = {
|
|
1507
1504
|
...this.options,
|
|
1508
1505
|
...e,
|
|
1509
1506
|
isClone: !0
|
|
1510
|
-
}, s = new
|
|
1507
|
+
}, s = new pe(a);
|
|
1511
1508
|
return (e.debug !== void 0 || e.prefix !== void 0) && (s.logger = s.logger.clone(e)), ["store", "services", "language"].forEach((o) => {
|
|
1512
1509
|
s[o] = this[o];
|
|
1513
1510
|
}), s.services = {
|
|
1514
1511
|
...this.services
|
|
1515
1512
|
}, s.services.utils = {
|
|
1516
1513
|
hasLoadedNamespace: s.hasLoadedNamespace.bind(s)
|
|
1517
|
-
}, n && (s.store = new
|
|
1514
|
+
}, n && (s.store = new Ot(this.store.data, a), s.services.resourceStore = s.store), s.translator = new He(s.services, a), s.translator.on("*", function(o) {
|
|
1518
1515
|
for (var c = arguments.length, u = new Array(c > 1 ? c - 1 : 0), l = 1; l < c; l++)
|
|
1519
1516
|
u[l - 1] = arguments[l];
|
|
1520
1517
|
s.emit(o, ...u);
|
|
@@ -1532,8 +1529,8 @@ class ge extends Le {
|
|
|
1532
1529
|
};
|
|
1533
1530
|
}
|
|
1534
1531
|
}
|
|
1535
|
-
const k =
|
|
1536
|
-
k.createInstance =
|
|
1532
|
+
const k = pe.createInstance();
|
|
1533
|
+
k.createInstance = pe.createInstance;
|
|
1537
1534
|
k.createInstance;
|
|
1538
1535
|
k.dir;
|
|
1539
1536
|
k.init;
|
|
@@ -1542,21 +1539,21 @@ k.reloadResources;
|
|
|
1542
1539
|
k.use;
|
|
1543
1540
|
k.changeLanguage;
|
|
1544
1541
|
k.getFixedT;
|
|
1545
|
-
const
|
|
1542
|
+
const be = k.t;
|
|
1546
1543
|
k.exists;
|
|
1547
1544
|
k.setDefaultNamespace;
|
|
1548
1545
|
k.hasLoadedNamespace;
|
|
1549
1546
|
k.loadNamespaces;
|
|
1550
1547
|
k.loadLanguages;
|
|
1551
|
-
const
|
|
1548
|
+
const yn = {
|
|
1552
1549
|
es: {
|
|
1553
1550
|
translation: {
|
|
1554
|
-
...
|
|
1551
|
+
...qr
|
|
1555
1552
|
}
|
|
1556
1553
|
}
|
|
1557
1554
|
};
|
|
1558
1555
|
k.init({
|
|
1559
|
-
resources:
|
|
1556
|
+
resources: yn,
|
|
1560
1557
|
lng: "es",
|
|
1561
1558
|
// language to use, more information here: https://www.i18next.com/overview/configuration-options#languages-namespaces-resources
|
|
1562
1559
|
// you can use the i18n.changeLanguage function to change the language manually: https://www.i18next.com/overview/api#changelanguage
|
|
@@ -1568,19 +1565,6 @@ k.init({
|
|
|
1568
1565
|
},
|
|
1569
1566
|
debug: !1
|
|
1570
1567
|
});
|
|
1571
|
-
class tr extends En {
|
|
1572
|
-
constructor(r) {
|
|
1573
|
-
super();
|
|
1574
|
-
ee(this, "message", "Internal Error");
|
|
1575
|
-
ee(this, "type", "modal");
|
|
1576
|
-
ee(this, "level", "error");
|
|
1577
|
-
ee(this, "title", "Error");
|
|
1578
|
-
ee(this, "code");
|
|
1579
|
-
ee(this, "payload");
|
|
1580
|
-
ee(this, "clearCookieSession");
|
|
1581
|
-
Object.assign(this, this.get(r)), this.logError("MessageErrorBFF", JSON.stringify(this));
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
1568
|
const j = {
|
|
1585
1569
|
// EXAMPLE ERROR
|
|
1586
1570
|
"MP-001": {
|
|
@@ -1619,32 +1603,32 @@ const j = {
|
|
|
1619
1603
|
level: "warning"
|
|
1620
1604
|
}
|
|
1621
1605
|
};
|
|
1622
|
-
class
|
|
1623
|
-
get(e = "default") {
|
|
1624
|
-
var
|
|
1625
|
-
if (e instanceof tr)
|
|
1626
|
-
return e;
|
|
1606
|
+
class wn extends Xr {
|
|
1607
|
+
get(e = "default", r) {
|
|
1608
|
+
var s, i;
|
|
1627
1609
|
if (e instanceof Error)
|
|
1628
1610
|
return this.logError(e.message), {
|
|
1629
1611
|
...j.internalError,
|
|
1630
|
-
title:
|
|
1631
|
-
message:
|
|
1612
|
+
title: be(j.internalError.title),
|
|
1613
|
+
message: be(j.internalError.message),
|
|
1614
|
+
uuid: r
|
|
1632
1615
|
};
|
|
1633
|
-
const
|
|
1616
|
+
const n = typeof e == "string" ? e : e.code ?? e.errorType, a = typeof e == "string" ? {} : { ...e };
|
|
1634
1617
|
return {
|
|
1635
|
-
...j[
|
|
1636
|
-
title:
|
|
1637
|
-
((
|
|
1638
|
-
|
|
1618
|
+
...j[n] ?? j.default,
|
|
1619
|
+
title: be(
|
|
1620
|
+
((s = j[n]) == null ? void 0 : s.title) ?? j.default.title,
|
|
1621
|
+
a
|
|
1639
1622
|
),
|
|
1640
|
-
message:
|
|
1641
|
-
((
|
|
1642
|
-
|
|
1643
|
-
)
|
|
1623
|
+
message: be(
|
|
1624
|
+
((i = j[n]) == null ? void 0 : i.message) ?? j.default.message,
|
|
1625
|
+
a
|
|
1626
|
+
),
|
|
1627
|
+
uuid: r
|
|
1644
1628
|
};
|
|
1645
1629
|
}
|
|
1646
1630
|
}
|
|
1647
|
-
var
|
|
1631
|
+
var er = {}, tr = { exports: {} };
|
|
1648
1632
|
(function(t) {
|
|
1649
1633
|
function e(r) {
|
|
1650
1634
|
return r && r.__esModule ? r : {
|
|
@@ -1652,12 +1636,12 @@ var rr = {}, nr = { exports: {} };
|
|
|
1652
1636
|
};
|
|
1653
1637
|
}
|
|
1654
1638
|
t.exports = e, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
1655
|
-
})(
|
|
1656
|
-
var
|
|
1657
|
-
const b = crypto, G = (t) => t instanceof CryptoKey,
|
|
1639
|
+
})(tr);
|
|
1640
|
+
var rr = tr.exports;
|
|
1641
|
+
const b = crypto, G = (t) => t instanceof CryptoKey, nr = async (t, e) => {
|
|
1658
1642
|
const r = `SHA-${t.slice(-3)}`;
|
|
1659
1643
|
return new Uint8Array(await b.subtle.digest(r, e));
|
|
1660
|
-
}, K = new TextEncoder(), X = new TextDecoder(),
|
|
1644
|
+
}, K = new TextEncoder(), X = new TextDecoder(), Ke = 2 ** 32;
|
|
1661
1645
|
function Q(...t) {
|
|
1662
1646
|
const e = t.reduce((a, { length: s }) => a + s, 0), r = new Uint8Array(e);
|
|
1663
1647
|
let n = 0;
|
|
@@ -1665,41 +1649,41 @@ function Q(...t) {
|
|
|
1665
1649
|
r.set(a, n), n += a.length;
|
|
1666
1650
|
}), r;
|
|
1667
1651
|
}
|
|
1668
|
-
function
|
|
1652
|
+
function Sn(t, e) {
|
|
1669
1653
|
return Q(K.encode(t), new Uint8Array([0]), e);
|
|
1670
1654
|
}
|
|
1671
|
-
function
|
|
1672
|
-
if (e < 0 || e >=
|
|
1673
|
-
throw new RangeError(`value must be >= 0 and <= ${
|
|
1655
|
+
function it(t, e, r) {
|
|
1656
|
+
if (e < 0 || e >= Ke)
|
|
1657
|
+
throw new RangeError(`value must be >= 0 and <= ${Ke - 1}. Received ${e}`);
|
|
1674
1658
|
t.set([e >>> 24, e >>> 16, e >>> 8, e & 255], r);
|
|
1675
1659
|
}
|
|
1676
|
-
function
|
|
1677
|
-
const e = Math.floor(t /
|
|
1678
|
-
return
|
|
1660
|
+
function ar(t) {
|
|
1661
|
+
const e = Math.floor(t / Ke), r = t % Ke, n = new Uint8Array(8);
|
|
1662
|
+
return it(n, e, 0), it(n, r, 4), n;
|
|
1679
1663
|
}
|
|
1680
|
-
function
|
|
1664
|
+
function pt(t) {
|
|
1681
1665
|
const e = new Uint8Array(4);
|
|
1682
|
-
return
|
|
1666
|
+
return it(e, t), e;
|
|
1683
1667
|
}
|
|
1684
|
-
function
|
|
1685
|
-
return Q(
|
|
1668
|
+
function ze(t) {
|
|
1669
|
+
return Q(pt(t.length), t);
|
|
1686
1670
|
}
|
|
1687
|
-
async function
|
|
1671
|
+
async function bn(t, e, r) {
|
|
1688
1672
|
const n = Math.ceil((e >> 3) / 32), a = new Uint8Array(n * 32);
|
|
1689
1673
|
for (let s = 0; s < n; s++) {
|
|
1690
1674
|
const i = new Uint8Array(4 + t.length + r.length);
|
|
1691
|
-
i.set(
|
|
1675
|
+
i.set(pt(s + 1)), i.set(t, 4), i.set(r, 4 + t.length), a.set(await nr("sha256", i), s * 32);
|
|
1692
1676
|
}
|
|
1693
1677
|
return a.slice(0, e >> 3);
|
|
1694
1678
|
}
|
|
1695
|
-
const
|
|
1679
|
+
const gt = (t) => {
|
|
1696
1680
|
let e = t;
|
|
1697
1681
|
typeof e == "string" && (e = K.encode(e));
|
|
1698
1682
|
const r = 32768, n = [];
|
|
1699
1683
|
for (let a = 0; a < e.length; a += r)
|
|
1700
1684
|
n.push(String.fromCharCode.apply(null, e.subarray(a, a + r)));
|
|
1701
1685
|
return btoa(n.join(""));
|
|
1702
|
-
}, O = (t) =>
|
|
1686
|
+
}, O = (t) => gt(t).replace(/=/g, "").replace(/\+/g, "-").replace(/\//g, "_"), sr = (t) => {
|
|
1703
1687
|
const e = atob(t), r = new Uint8Array(e.length);
|
|
1704
1688
|
for (let n = 0; n < e.length; n++)
|
|
1705
1689
|
r[n] = e.charCodeAt(n);
|
|
@@ -1708,7 +1692,7 @@ const mt = (t) => {
|
|
|
1708
1692
|
let e = t;
|
|
1709
1693
|
e instanceof Uint8Array && (e = X.decode(e)), e = e.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
1710
1694
|
try {
|
|
1711
|
-
return
|
|
1695
|
+
return sr(e);
|
|
1712
1696
|
} catch {
|
|
1713
1697
|
throw new TypeError("The input to be decoded is not correctly encoded.");
|
|
1714
1698
|
}
|
|
@@ -1730,7 +1714,7 @@ class V extends L {
|
|
|
1730
1714
|
super(e), this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED", this.claim = r, this.reason = n;
|
|
1731
1715
|
}
|
|
1732
1716
|
}
|
|
1733
|
-
class
|
|
1717
|
+
class ot extends L {
|
|
1734
1718
|
static get code() {
|
|
1735
1719
|
return "ERR_JWT_EXPIRED";
|
|
1736
1720
|
}
|
|
@@ -1738,7 +1722,7 @@ class ct extends L {
|
|
|
1738
1722
|
super(e), this.code = "ERR_JWT_EXPIRED", this.claim = r, this.reason = n;
|
|
1739
1723
|
}
|
|
1740
1724
|
}
|
|
1741
|
-
class
|
|
1725
|
+
class Re extends L {
|
|
1742
1726
|
constructor() {
|
|
1743
1727
|
super(...arguments), this.code = "ERR_JOSE_ALG_NOT_ALLOWED";
|
|
1744
1728
|
}
|
|
@@ -1754,7 +1738,7 @@ class x extends L {
|
|
|
1754
1738
|
return "ERR_JOSE_NOT_SUPPORTED";
|
|
1755
1739
|
}
|
|
1756
1740
|
}
|
|
1757
|
-
class
|
|
1741
|
+
class ge extends L {
|
|
1758
1742
|
constructor() {
|
|
1759
1743
|
super(...arguments), this.code = "ERR_JWE_DECRYPTION_FAILED", this.message = "decryption operation failed";
|
|
1760
1744
|
}
|
|
@@ -1786,7 +1770,7 @@ class B extends L {
|
|
|
1786
1770
|
return "ERR_JWT_INVALID";
|
|
1787
1771
|
}
|
|
1788
1772
|
}
|
|
1789
|
-
class
|
|
1773
|
+
class ir extends L {
|
|
1790
1774
|
constructor() {
|
|
1791
1775
|
super(...arguments), this.code = "ERR_JWK_INVALID";
|
|
1792
1776
|
}
|
|
@@ -1794,7 +1778,7 @@ class cr extends L {
|
|
|
1794
1778
|
return "ERR_JWK_INVALID";
|
|
1795
1779
|
}
|
|
1796
1780
|
}
|
|
1797
|
-
class
|
|
1781
|
+
class Le extends L {
|
|
1798
1782
|
constructor() {
|
|
1799
1783
|
super(...arguments), this.code = "ERR_JWKS_INVALID";
|
|
1800
1784
|
}
|
|
@@ -1802,7 +1786,7 @@ class De extends L {
|
|
|
1802
1786
|
return "ERR_JWKS_INVALID";
|
|
1803
1787
|
}
|
|
1804
1788
|
}
|
|
1805
|
-
class
|
|
1789
|
+
class mt extends L {
|
|
1806
1790
|
constructor() {
|
|
1807
1791
|
super(...arguments), this.code = "ERR_JWKS_NO_MATCHING_KEY", this.message = "no applicable key found in the JSON Web Key Set";
|
|
1808
1792
|
}
|
|
@@ -1810,7 +1794,7 @@ class yt extends L {
|
|
|
1810
1794
|
return "ERR_JWKS_NO_MATCHING_KEY";
|
|
1811
1795
|
}
|
|
1812
1796
|
}
|
|
1813
|
-
class
|
|
1797
|
+
class or extends L {
|
|
1814
1798
|
constructor() {
|
|
1815
1799
|
super(...arguments), this.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS", this.message = "multiple matching keys found in the JSON Web Key Set";
|
|
1816
1800
|
}
|
|
@@ -1818,7 +1802,7 @@ class ur extends L {
|
|
|
1818
1802
|
return "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
1819
1803
|
}
|
|
1820
1804
|
}
|
|
1821
|
-
class
|
|
1805
|
+
class cr extends L {
|
|
1822
1806
|
constructor() {
|
|
1823
1807
|
super(...arguments), this.code = "ERR_JWKS_TIMEOUT", this.message = "request timed out";
|
|
1824
1808
|
}
|
|
@@ -1826,7 +1810,7 @@ class lr extends L {
|
|
|
1826
1810
|
return "ERR_JWKS_TIMEOUT";
|
|
1827
1811
|
}
|
|
1828
1812
|
}
|
|
1829
|
-
class
|
|
1813
|
+
class yt extends L {
|
|
1830
1814
|
constructor() {
|
|
1831
1815
|
super(...arguments), this.code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED", this.message = "signature verification failed";
|
|
1832
1816
|
}
|
|
@@ -1834,25 +1818,25 @@ class wt extends L {
|
|
|
1834
1818
|
return "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
|
|
1835
1819
|
}
|
|
1836
1820
|
}
|
|
1837
|
-
const
|
|
1821
|
+
const vn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1838
1822
|
__proto__: null,
|
|
1839
|
-
JOSEAlgNotAllowed:
|
|
1823
|
+
JOSEAlgNotAllowed: Re,
|
|
1840
1824
|
JOSEError: L,
|
|
1841
1825
|
JOSENotSupported: x,
|
|
1842
|
-
JWEDecryptionFailed:
|
|
1826
|
+
JWEDecryptionFailed: ge,
|
|
1843
1827
|
JWEInvalid: y,
|
|
1844
|
-
JWKInvalid:
|
|
1845
|
-
JWKSInvalid:
|
|
1846
|
-
JWKSMultipleMatchingKeys:
|
|
1847
|
-
JWKSNoMatchingKey:
|
|
1848
|
-
JWKSTimeout:
|
|
1828
|
+
JWKInvalid: ir,
|
|
1829
|
+
JWKSInvalid: Le,
|
|
1830
|
+
JWKSMultipleMatchingKeys: or,
|
|
1831
|
+
JWKSNoMatchingKey: mt,
|
|
1832
|
+
JWKSTimeout: cr,
|
|
1849
1833
|
JWSInvalid: P,
|
|
1850
|
-
JWSSignatureVerificationFailed:
|
|
1834
|
+
JWSSignatureVerificationFailed: yt,
|
|
1851
1835
|
JWTClaimValidationFailed: V,
|
|
1852
|
-
JWTExpired:
|
|
1836
|
+
JWTExpired: ot,
|
|
1853
1837
|
JWTInvalid: B
|
|
1854
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
1855
|
-
function
|
|
1838
|
+
}, Symbol.toStringTag, { value: "Module" })), De = b.getRandomValues.bind(b);
|
|
1839
|
+
function ur(t) {
|
|
1856
1840
|
switch (t) {
|
|
1857
1841
|
case "A128GCM":
|
|
1858
1842
|
case "A128GCMKW":
|
|
@@ -1869,14 +1853,14 @@ function dr(t) {
|
|
|
1869
1853
|
throw new x(`Unsupported JWE Algorithm: ${t}`);
|
|
1870
1854
|
}
|
|
1871
1855
|
}
|
|
1872
|
-
const
|
|
1873
|
-
if (e.length << 3 !==
|
|
1856
|
+
const lr = (t) => De(new Uint8Array(ur(t) >> 3)), dr = (t, e) => {
|
|
1857
|
+
if (e.length << 3 !== ur(t))
|
|
1874
1858
|
throw new y("Invalid Initialization Vector length");
|
|
1875
|
-
},
|
|
1859
|
+
}, Oe = (t, e) => {
|
|
1876
1860
|
const r = t.byteLength << 3;
|
|
1877
1861
|
if (r !== e)
|
|
1878
1862
|
throw new y(`Invalid Content Encryption Key length. Expected ${e} bits, got ${r} bits`);
|
|
1879
|
-
},
|
|
1863
|
+
}, En = (t, e) => {
|
|
1880
1864
|
if (!(t instanceof Uint8Array))
|
|
1881
1865
|
throw new TypeError("First argument must be a buffer");
|
|
1882
1866
|
if (!(e instanceof Uint8Array))
|
|
@@ -1892,13 +1876,13 @@ const fr = (t) => Je(new Uint8Array(dr(t) >> 3)), hr = (t, e) => {
|
|
|
1892
1876
|
function U(t, e = "algorithm.name") {
|
|
1893
1877
|
return new TypeError(`CryptoKey does not support this operation, its ${e} must be ${t}`);
|
|
1894
1878
|
}
|
|
1895
|
-
function
|
|
1879
|
+
function re(t, e) {
|
|
1896
1880
|
return t.name === e;
|
|
1897
1881
|
}
|
|
1898
|
-
function
|
|
1882
|
+
function Ee(t) {
|
|
1899
1883
|
return parseInt(t.name.slice(4), 10);
|
|
1900
1884
|
}
|
|
1901
|
-
function
|
|
1885
|
+
function An(t) {
|
|
1902
1886
|
switch (t) {
|
|
1903
1887
|
case "ES256":
|
|
1904
1888
|
return "P-256";
|
|
@@ -1910,7 +1894,7 @@ function Pn(t) {
|
|
|
1910
1894
|
throw new Error("unreachable");
|
|
1911
1895
|
}
|
|
1912
1896
|
}
|
|
1913
|
-
function
|
|
1897
|
+
function fr(t, e) {
|
|
1914
1898
|
if (e.length && !e.some((r) => t.usages.includes(r))) {
|
|
1915
1899
|
let r = "CryptoKey does not support this operation, its usages must include ";
|
|
1916
1900
|
if (e.length > 2) {
|
|
@@ -1921,35 +1905,35 @@ function pr(t, e) {
|
|
|
1921
1905
|
throw new TypeError(r);
|
|
1922
1906
|
}
|
|
1923
1907
|
}
|
|
1924
|
-
function
|
|
1908
|
+
function xn(t, e, ...r) {
|
|
1925
1909
|
switch (e) {
|
|
1926
1910
|
case "HS256":
|
|
1927
1911
|
case "HS384":
|
|
1928
1912
|
case "HS512": {
|
|
1929
|
-
if (!
|
|
1913
|
+
if (!re(t.algorithm, "HMAC"))
|
|
1930
1914
|
throw U("HMAC");
|
|
1931
1915
|
const n = parseInt(e.slice(2), 10);
|
|
1932
|
-
if (
|
|
1916
|
+
if (Ee(t.algorithm.hash) !== n)
|
|
1933
1917
|
throw U(`SHA-${n}`, "algorithm.hash");
|
|
1934
1918
|
break;
|
|
1935
1919
|
}
|
|
1936
1920
|
case "RS256":
|
|
1937
1921
|
case "RS384":
|
|
1938
1922
|
case "RS512": {
|
|
1939
|
-
if (!
|
|
1923
|
+
if (!re(t.algorithm, "RSASSA-PKCS1-v1_5"))
|
|
1940
1924
|
throw U("RSASSA-PKCS1-v1_5");
|
|
1941
1925
|
const n = parseInt(e.slice(2), 10);
|
|
1942
|
-
if (
|
|
1926
|
+
if (Ee(t.algorithm.hash) !== n)
|
|
1943
1927
|
throw U(`SHA-${n}`, "algorithm.hash");
|
|
1944
1928
|
break;
|
|
1945
1929
|
}
|
|
1946
1930
|
case "PS256":
|
|
1947
1931
|
case "PS384":
|
|
1948
1932
|
case "PS512": {
|
|
1949
|
-
if (!
|
|
1933
|
+
if (!re(t.algorithm, "RSA-PSS"))
|
|
1950
1934
|
throw U("RSA-PSS");
|
|
1951
1935
|
const n = parseInt(e.slice(2), 10);
|
|
1952
|
-
if (
|
|
1936
|
+
if (Ee(t.algorithm.hash) !== n)
|
|
1953
1937
|
throw U(`SHA-${n}`, "algorithm.hash");
|
|
1954
1938
|
break;
|
|
1955
1939
|
}
|
|
@@ -1961,9 +1945,9 @@ function Hn(t, e, ...r) {
|
|
|
1961
1945
|
case "ES256":
|
|
1962
1946
|
case "ES384":
|
|
1963
1947
|
case "ES512": {
|
|
1964
|
-
if (!
|
|
1948
|
+
if (!re(t.algorithm, "ECDSA"))
|
|
1965
1949
|
throw U("ECDSA");
|
|
1966
|
-
const n =
|
|
1950
|
+
const n = An(e);
|
|
1967
1951
|
if (t.algorithm.namedCurve !== n)
|
|
1968
1952
|
throw U(n, "algorithm.namedCurve");
|
|
1969
1953
|
break;
|
|
@@ -1971,14 +1955,14 @@ function Hn(t, e, ...r) {
|
|
|
1971
1955
|
default:
|
|
1972
1956
|
throw new TypeError("CryptoKey does not support this operation");
|
|
1973
1957
|
}
|
|
1974
|
-
|
|
1958
|
+
fr(t, r);
|
|
1975
1959
|
}
|
|
1976
|
-
function
|
|
1960
|
+
function ae(t, e, ...r) {
|
|
1977
1961
|
switch (e) {
|
|
1978
1962
|
case "A128GCM":
|
|
1979
1963
|
case "A192GCM":
|
|
1980
1964
|
case "A256GCM": {
|
|
1981
|
-
if (!
|
|
1965
|
+
if (!re(t.algorithm, "AES-GCM"))
|
|
1982
1966
|
throw U("AES-GCM");
|
|
1983
1967
|
const n = parseInt(e.slice(1, 4), 10);
|
|
1984
1968
|
if (t.algorithm.length !== n)
|
|
@@ -1988,7 +1972,7 @@ function se(t, e, ...r) {
|
|
|
1988
1972
|
case "A128KW":
|
|
1989
1973
|
case "A192KW":
|
|
1990
1974
|
case "A256KW": {
|
|
1991
|
-
if (!
|
|
1975
|
+
if (!re(t.algorithm, "AES-KW"))
|
|
1992
1976
|
throw U("AES-KW");
|
|
1993
1977
|
const n = parseInt(e.slice(1, 4), 10);
|
|
1994
1978
|
if (t.algorithm.length !== n)
|
|
@@ -2009,26 +1993,26 @@ function se(t, e, ...r) {
|
|
|
2009
1993
|
case "PBES2-HS256+A128KW":
|
|
2010
1994
|
case "PBES2-HS384+A192KW":
|
|
2011
1995
|
case "PBES2-HS512+A256KW":
|
|
2012
|
-
if (!
|
|
1996
|
+
if (!re(t.algorithm, "PBKDF2"))
|
|
2013
1997
|
throw U("PBKDF2");
|
|
2014
1998
|
break;
|
|
2015
1999
|
case "RSA-OAEP":
|
|
2016
2000
|
case "RSA-OAEP-256":
|
|
2017
2001
|
case "RSA-OAEP-384":
|
|
2018
2002
|
case "RSA-OAEP-512": {
|
|
2019
|
-
if (!
|
|
2003
|
+
if (!re(t.algorithm, "RSA-OAEP"))
|
|
2020
2004
|
throw U("RSA-OAEP");
|
|
2021
2005
|
const n = parseInt(e.slice(9), 10) || 1;
|
|
2022
|
-
if (
|
|
2006
|
+
if (Ee(t.algorithm.hash) !== n)
|
|
2023
2007
|
throw U(`SHA-${n}`, "algorithm.hash");
|
|
2024
2008
|
break;
|
|
2025
2009
|
}
|
|
2026
2010
|
default:
|
|
2027
2011
|
throw new TypeError("CryptoKey does not support this operation");
|
|
2028
2012
|
}
|
|
2029
|
-
|
|
2013
|
+
fr(t, r);
|
|
2030
2014
|
}
|
|
2031
|
-
function
|
|
2015
|
+
function hr(t, e, ...r) {
|
|
2032
2016
|
if (r.length > 2) {
|
|
2033
2017
|
const n = r.pop();
|
|
2034
2018
|
t += `one of type ${r.join(", ")}, or ${n}.`;
|
|
@@ -2036,37 +2020,37 @@ function gr(t, e, ...r) {
|
|
|
2036
2020
|
r.length === 2 ? t += `one of type ${r[0]} or ${r[1]}.` : t += `of type ${r[0]}.`;
|
|
2037
2021
|
return e == null ? t += ` Received ${e}` : typeof e == "function" && e.name ? t += ` Received function ${e.name}` : typeof e == "object" && e != null && e.constructor && e.constructor.name && (t += ` Received an instance of ${e.constructor.name}`), t;
|
|
2038
2022
|
}
|
|
2039
|
-
const M = (t, ...e) =>
|
|
2040
|
-
function
|
|
2041
|
-
return
|
|
2023
|
+
const M = (t, ...e) => hr("Key must be ", t, ...e);
|
|
2024
|
+
function pr(t, e, ...r) {
|
|
2025
|
+
return hr(`Key for the ${t} algorithm must be `, e, ...r);
|
|
2042
2026
|
}
|
|
2043
|
-
const
|
|
2044
|
-
async function
|
|
2027
|
+
const gr = (t) => G(t), H = ["CryptoKey"];
|
|
2028
|
+
async function Cn(t, e, r, n, a, s) {
|
|
2045
2029
|
if (!(e instanceof Uint8Array))
|
|
2046
2030
|
throw new TypeError(M(e, "Uint8Array"));
|
|
2047
2031
|
const i = parseInt(t.slice(1, 4), 10), o = await b.subtle.importKey("raw", e.subarray(i >> 3), "AES-CBC", !1, ["decrypt"]), c = await b.subtle.importKey("raw", e.subarray(0, i >> 3), {
|
|
2048
2032
|
hash: `SHA-${i << 1}`,
|
|
2049
2033
|
name: "HMAC"
|
|
2050
|
-
}, !1, ["sign"]), u = Q(s, n, r,
|
|
2034
|
+
}, !1, ["sign"]), u = Q(s, n, r, ar(s.length << 3)), l = new Uint8Array((await b.subtle.sign("HMAC", c, u)).slice(0, i >> 3));
|
|
2051
2035
|
let f;
|
|
2052
2036
|
try {
|
|
2053
|
-
f =
|
|
2037
|
+
f = En(a, l);
|
|
2054
2038
|
} catch {
|
|
2055
2039
|
}
|
|
2056
2040
|
if (!f)
|
|
2057
|
-
throw new
|
|
2041
|
+
throw new ge();
|
|
2058
2042
|
let d;
|
|
2059
2043
|
try {
|
|
2060
2044
|
d = new Uint8Array(await b.subtle.decrypt({ iv: n, name: "AES-CBC" }, o, r));
|
|
2061
2045
|
} catch {
|
|
2062
2046
|
}
|
|
2063
2047
|
if (!d)
|
|
2064
|
-
throw new
|
|
2048
|
+
throw new ge();
|
|
2065
2049
|
return d;
|
|
2066
2050
|
}
|
|
2067
|
-
async function
|
|
2051
|
+
async function _n(t, e, r, n, a, s) {
|
|
2068
2052
|
let i;
|
|
2069
|
-
e instanceof Uint8Array ? i = await b.subtle.importKey("raw", e, "AES-GCM", !1, ["decrypt"]) : (
|
|
2053
|
+
e instanceof Uint8Array ? i = await b.subtle.importKey("raw", e, "AES-GCM", !1, ["decrypt"]) : (ae(e, t, "decrypt"), i = e);
|
|
2070
2054
|
try {
|
|
2071
2055
|
return new Uint8Array(await b.subtle.decrypt({
|
|
2072
2056
|
additionalData: s,
|
|
@@ -2075,29 +2059,29 @@ async function Rn(t, e, r, n, a, s) {
|
|
|
2075
2059
|
tagLength: 128
|
|
2076
2060
|
}, i, Q(r, a)));
|
|
2077
2061
|
} catch {
|
|
2078
|
-
throw new
|
|
2062
|
+
throw new ge();
|
|
2079
2063
|
}
|
|
2080
2064
|
}
|
|
2081
|
-
const
|
|
2065
|
+
const mr = async (t, e, r, n, a, s) => {
|
|
2082
2066
|
if (!G(e) && !(e instanceof Uint8Array))
|
|
2083
2067
|
throw new TypeError(M(e, ...H, "Uint8Array"));
|
|
2084
|
-
switch (
|
|
2068
|
+
switch (dr(t, n), t) {
|
|
2085
2069
|
case "A128CBC-HS256":
|
|
2086
2070
|
case "A192CBC-HS384":
|
|
2087
2071
|
case "A256CBC-HS512":
|
|
2088
|
-
return e instanceof Uint8Array &&
|
|
2072
|
+
return e instanceof Uint8Array && Oe(e, parseInt(t.slice(-3), 10)), Cn(t, e, r, n, a, s);
|
|
2089
2073
|
case "A128GCM":
|
|
2090
2074
|
case "A192GCM":
|
|
2091
2075
|
case "A256GCM":
|
|
2092
|
-
return e instanceof Uint8Array &&
|
|
2076
|
+
return e instanceof Uint8Array && Oe(e, parseInt(t.slice(1, 4), 10)), _n(t, e, r, n, a, s);
|
|
2093
2077
|
default:
|
|
2094
2078
|
throw new x("Unsupported JWE Content Encryption Algorithm");
|
|
2095
2079
|
}
|
|
2096
|
-
},
|
|
2080
|
+
}, Pn = async () => {
|
|
2097
2081
|
throw new x('JWE "zip" (Compression Algorithm) Header Parameter is not supported by your javascript runtime. You need to use the `inflateRaw` decrypt option to provide Inflate Raw implementation.');
|
|
2098
|
-
},
|
|
2082
|
+
}, Hn = async () => {
|
|
2099
2083
|
throw new x('JWE "zip" (Compression Algorithm) Header Parameter is not supported by your javascript runtime. You need to use the `deflateRaw` encrypt option to provide Deflate Raw implementation.');
|
|
2100
|
-
},
|
|
2084
|
+
}, me = (...t) => {
|
|
2101
2085
|
const e = t.filter(Boolean);
|
|
2102
2086
|
if (e.length === 0 || e.length === 1)
|
|
2103
2087
|
return !0;
|
|
@@ -2116,11 +2100,11 @@ const wr = async (t, e, r, n, a, s) => {
|
|
|
2116
2100
|
}
|
|
2117
2101
|
return !0;
|
|
2118
2102
|
};
|
|
2119
|
-
function
|
|
2103
|
+
function Kn(t) {
|
|
2120
2104
|
return typeof t == "object" && t !== null;
|
|
2121
2105
|
}
|
|
2122
2106
|
function I(t) {
|
|
2123
|
-
if (!
|
|
2107
|
+
if (!Kn(t) || Object.prototype.toString.call(t) !== "[object Object]")
|
|
2124
2108
|
return !1;
|
|
2125
2109
|
if (Object.getPrototypeOf(t) === null)
|
|
2126
2110
|
return !0;
|
|
@@ -2129,72 +2113,72 @@ function I(t) {
|
|
|
2129
2113
|
e = Object.getPrototypeOf(e);
|
|
2130
2114
|
return Object.getPrototypeOf(t) === e;
|
|
2131
2115
|
}
|
|
2132
|
-
const
|
|
2116
|
+
const Je = [
|
|
2133
2117
|
{ hash: "SHA-256", name: "HMAC" },
|
|
2134
2118
|
!0,
|
|
2135
2119
|
["sign"]
|
|
2136
2120
|
];
|
|
2137
|
-
function
|
|
2121
|
+
function yr(t, e) {
|
|
2138
2122
|
if (t.algorithm.length !== parseInt(e.slice(1, 4), 10))
|
|
2139
2123
|
throw new TypeError(`Invalid key size for alg: ${e}`);
|
|
2140
2124
|
}
|
|
2141
|
-
function
|
|
2125
|
+
function wr(t, e, r) {
|
|
2142
2126
|
if (G(t))
|
|
2143
|
-
return
|
|
2127
|
+
return ae(t, e, r), t;
|
|
2144
2128
|
if (t instanceof Uint8Array)
|
|
2145
2129
|
return b.subtle.importKey("raw", t, "AES-KW", !0, [r]);
|
|
2146
2130
|
throw new TypeError(M(t, ...H, "Uint8Array"));
|
|
2147
2131
|
}
|
|
2148
|
-
const
|
|
2149
|
-
const n = await
|
|
2150
|
-
|
|
2151
|
-
const a = await b.subtle.importKey("raw", r, ...
|
|
2132
|
+
const ct = async (t, e, r) => {
|
|
2133
|
+
const n = await wr(e, t, "wrapKey");
|
|
2134
|
+
yr(n, t);
|
|
2135
|
+
const a = await b.subtle.importKey("raw", r, ...Je);
|
|
2152
2136
|
return new Uint8Array(await b.subtle.wrapKey("raw", a, n, "AES-KW"));
|
|
2153
|
-
},
|
|
2154
|
-
const n = await
|
|
2155
|
-
|
|
2156
|
-
const a = await b.subtle.unwrapKey("raw", r, n, "AES-KW", ...
|
|
2137
|
+
}, ut = async (t, e, r) => {
|
|
2138
|
+
const n = await wr(e, t, "unwrapKey");
|
|
2139
|
+
yr(n, t);
|
|
2140
|
+
const a = await b.subtle.unwrapKey("raw", r, n, "AES-KW", ...Je);
|
|
2157
2141
|
return new Uint8Array(await b.subtle.exportKey("raw", a));
|
|
2158
2142
|
};
|
|
2159
|
-
async function
|
|
2143
|
+
async function Sr(t, e, r, n, a = new Uint8Array(0), s = new Uint8Array(0)) {
|
|
2160
2144
|
if (!G(t))
|
|
2161
2145
|
throw new TypeError(M(t, ...H));
|
|
2162
|
-
if (
|
|
2146
|
+
if (ae(t, "ECDH"), !G(e))
|
|
2163
2147
|
throw new TypeError(M(e, ...H));
|
|
2164
|
-
|
|
2165
|
-
const i = Q(
|
|
2148
|
+
ae(e, "ECDH", "deriveBits");
|
|
2149
|
+
const i = Q(ze(K.encode(r)), ze(a), ze(s), pt(n));
|
|
2166
2150
|
let o;
|
|
2167
2151
|
t.algorithm.name === "X25519" ? o = 256 : t.algorithm.name === "X448" ? o = 448 : o = Math.ceil(parseInt(t.algorithm.namedCurve.substr(-3), 10) / 8) << 3;
|
|
2168
2152
|
const c = new Uint8Array(await b.subtle.deriveBits({
|
|
2169
2153
|
name: t.algorithm.name,
|
|
2170
2154
|
public: t
|
|
2171
2155
|
}, e, o));
|
|
2172
|
-
return
|
|
2156
|
+
return bn(c, n, i);
|
|
2173
2157
|
}
|
|
2174
|
-
async function
|
|
2158
|
+
async function Rn(t) {
|
|
2175
2159
|
if (!G(t))
|
|
2176
2160
|
throw new TypeError(M(t, ...H));
|
|
2177
2161
|
return b.subtle.generateKey(t.algorithm, !0, ["deriveBits"]);
|
|
2178
2162
|
}
|
|
2179
|
-
function
|
|
2163
|
+
function br(t) {
|
|
2180
2164
|
if (!G(t))
|
|
2181
2165
|
throw new TypeError(M(t, ...H));
|
|
2182
2166
|
return ["P-256", "P-384", "P-521"].includes(t.algorithm.namedCurve) || t.algorithm.name === "X25519" || t.algorithm.name === "X448";
|
|
2183
2167
|
}
|
|
2184
|
-
function
|
|
2168
|
+
function On(t) {
|
|
2185
2169
|
if (!(t instanceof Uint8Array) || t.length < 8)
|
|
2186
2170
|
throw new y("PBES2 Salt Input must be 8 or more octets");
|
|
2187
2171
|
}
|
|
2188
|
-
function
|
|
2172
|
+
function Tn(t, e) {
|
|
2189
2173
|
if (t instanceof Uint8Array)
|
|
2190
2174
|
return b.subtle.importKey("raw", t, "PBKDF2", !1, ["deriveBits"]);
|
|
2191
2175
|
if (G(t))
|
|
2192
|
-
return
|
|
2176
|
+
return ae(t, e, "deriveBits", "deriveKey"), t;
|
|
2193
2177
|
throw new TypeError(M(t, ...H, "Uint8Array"));
|
|
2194
2178
|
}
|
|
2195
|
-
async function
|
|
2196
|
-
|
|
2197
|
-
const a =
|
|
2179
|
+
async function vr(t, e, r, n) {
|
|
2180
|
+
On(t);
|
|
2181
|
+
const a = Sn(e, t), s = parseInt(e.slice(13, 16), 10), i = {
|
|
2198
2182
|
hash: `SHA-${e.slice(8, 11)}`,
|
|
2199
2183
|
iterations: r,
|
|
2200
2184
|
name: "PBKDF2",
|
|
@@ -2202,21 +2186,21 @@ async function Ar(t, e, r, n) {
|
|
|
2202
2186
|
}, o = {
|
|
2203
2187
|
length: s,
|
|
2204
2188
|
name: "AES-KW"
|
|
2205
|
-
}, c = await
|
|
2189
|
+
}, c = await Tn(n, e);
|
|
2206
2190
|
if (c.usages.includes("deriveBits"))
|
|
2207
2191
|
return new Uint8Array(await b.subtle.deriveBits(i, c, s));
|
|
2208
2192
|
if (c.usages.includes("deriveKey"))
|
|
2209
2193
|
return b.subtle.deriveKey(i, c, o, !1, ["wrapKey", "unwrapKey"]);
|
|
2210
2194
|
throw new TypeError('PBKDF2 key "usages" must include "deriveBits" or "deriveKey"');
|
|
2211
2195
|
}
|
|
2212
|
-
const
|
|
2213
|
-
const s = await
|
|
2214
|
-
return { encryptedKey: await
|
|
2215
|
-
},
|
|
2216
|
-
const s = await
|
|
2217
|
-
return
|
|
2196
|
+
const In = async (t, e, r, n = 2048, a = De(new Uint8Array(16))) => {
|
|
2197
|
+
const s = await vr(a, t, n, e);
|
|
2198
|
+
return { encryptedKey: await ct(t.slice(-6), s, r), p2c: n, p2s: O(a) };
|
|
2199
|
+
}, Wn = async (t, e, r, n, a) => {
|
|
2200
|
+
const s = await vr(a, t, n, e);
|
|
2201
|
+
return ut(t.slice(-6), s, r);
|
|
2218
2202
|
};
|
|
2219
|
-
function
|
|
2203
|
+
function Te(t) {
|
|
2220
2204
|
switch (t) {
|
|
2221
2205
|
case "RSA-OAEP":
|
|
2222
2206
|
case "RSA-OAEP-256":
|
|
@@ -2227,34 +2211,34 @@ function Ie(t) {
|
|
|
2227
2211
|
throw new x(`alg ${t} is not supported either by JOSE or your javascript runtime`);
|
|
2228
2212
|
}
|
|
2229
2213
|
}
|
|
2230
|
-
const
|
|
2214
|
+
const Ne = (t, e) => {
|
|
2231
2215
|
if (t.startsWith("RS") || t.startsWith("PS")) {
|
|
2232
2216
|
const { modulusLength: r } = e.algorithm;
|
|
2233
2217
|
if (typeof r != "number" || r < 2048)
|
|
2234
2218
|
throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`);
|
|
2235
2219
|
}
|
|
2236
|
-
},
|
|
2220
|
+
}, Un = async (t, e, r) => {
|
|
2237
2221
|
if (!G(e))
|
|
2238
2222
|
throw new TypeError(M(e, ...H));
|
|
2239
|
-
if (
|
|
2240
|
-
return new Uint8Array(await b.subtle.encrypt(
|
|
2223
|
+
if (ae(e, t, "encrypt", "wrapKey"), Ne(t, e), e.usages.includes("encrypt"))
|
|
2224
|
+
return new Uint8Array(await b.subtle.encrypt(Te(t), e, r));
|
|
2241
2225
|
if (e.usages.includes("wrapKey")) {
|
|
2242
|
-
const n = await b.subtle.importKey("raw", r, ...
|
|
2243
|
-
return new Uint8Array(await b.subtle.wrapKey("raw", n, e,
|
|
2226
|
+
const n = await b.subtle.importKey("raw", r, ...Je);
|
|
2227
|
+
return new Uint8Array(await b.subtle.wrapKey("raw", n, e, Te(t)));
|
|
2244
2228
|
}
|
|
2245
2229
|
throw new TypeError('RSA-OAEP key "usages" must include "encrypt" or "wrapKey" for this operation');
|
|
2246
|
-
},
|
|
2230
|
+
}, Ln = async (t, e, r) => {
|
|
2247
2231
|
if (!G(e))
|
|
2248
2232
|
throw new TypeError(M(e, ...H));
|
|
2249
|
-
if (
|
|
2250
|
-
return new Uint8Array(await b.subtle.decrypt(
|
|
2233
|
+
if (ae(e, t, "decrypt", "unwrapKey"), Ne(t, e), e.usages.includes("decrypt"))
|
|
2234
|
+
return new Uint8Array(await b.subtle.decrypt(Te(t), e, r));
|
|
2251
2235
|
if (e.usages.includes("unwrapKey")) {
|
|
2252
|
-
const n = await b.subtle.unwrapKey("raw", r, e,
|
|
2236
|
+
const n = await b.subtle.unwrapKey("raw", r, e, Te(t), ...Je);
|
|
2253
2237
|
return new Uint8Array(await b.subtle.exportKey("raw", n));
|
|
2254
2238
|
}
|
|
2255
2239
|
throw new TypeError('RSA-OAEP key "usages" must include "decrypt" or "unwrapKey" for this operation');
|
|
2256
2240
|
};
|
|
2257
|
-
function
|
|
2241
|
+
function wt(t) {
|
|
2258
2242
|
switch (t) {
|
|
2259
2243
|
case "A128GCM":
|
|
2260
2244
|
return 128;
|
|
@@ -2271,47 +2255,47 @@ function St(t) {
|
|
|
2271
2255
|
throw new x(`Unsupported JWE Algorithm: ${t}`);
|
|
2272
2256
|
}
|
|
2273
2257
|
}
|
|
2274
|
-
const
|
|
2258
|
+
const ie = (t) => De(new Uint8Array(wt(t) >> 3)), Er = (t, e) => {
|
|
2275
2259
|
const r = (t.match(/.{1,64}/g) || []).join(`
|
|
2276
2260
|
`);
|
|
2277
2261
|
return `-----BEGIN ${e}-----
|
|
2278
2262
|
${r}
|
|
2279
2263
|
-----END ${e}-----`;
|
|
2280
|
-
},
|
|
2264
|
+
}, Ar = async (t, e, r) => {
|
|
2281
2265
|
if (!G(r))
|
|
2282
2266
|
throw new TypeError(M(r, ...H));
|
|
2283
2267
|
if (!r.extractable)
|
|
2284
2268
|
throw new TypeError("CryptoKey is not extractable");
|
|
2285
2269
|
if (r.type !== t)
|
|
2286
2270
|
throw new TypeError(`key is not a ${t} key`);
|
|
2287
|
-
return
|
|
2288
|
-
},
|
|
2271
|
+
return Er(gt(new Uint8Array(await b.subtle.exportKey(e, r))), `${t.toUpperCase()} KEY`);
|
|
2272
|
+
}, Dn = (t) => Ar("public", "spki", t), Jn = (t) => Ar("private", "pkcs8", t), te = (t, e, r = 0) => {
|
|
2289
2273
|
r === 0 && (e.unshift(e.length), e.unshift(6));
|
|
2290
2274
|
let n = t.indexOf(e[0], r);
|
|
2291
2275
|
if (n === -1)
|
|
2292
2276
|
return !1;
|
|
2293
2277
|
const a = t.subarray(n, n + e.length);
|
|
2294
|
-
return a.length !== e.length ? !1 : a.every((s, i) => s === e[i]) ||
|
|
2295
|
-
},
|
|
2278
|
+
return a.length !== e.length ? !1 : a.every((s, i) => s === e[i]) || te(t, e, n + 1);
|
|
2279
|
+
}, Jt = (t) => {
|
|
2296
2280
|
switch (!0) {
|
|
2297
|
-
case
|
|
2281
|
+
case te(t, [42, 134, 72, 206, 61, 3, 1, 7]):
|
|
2298
2282
|
return "P-256";
|
|
2299
|
-
case
|
|
2283
|
+
case te(t, [43, 129, 4, 0, 34]):
|
|
2300
2284
|
return "P-384";
|
|
2301
|
-
case
|
|
2285
|
+
case te(t, [43, 129, 4, 0, 35]):
|
|
2302
2286
|
return "P-521";
|
|
2303
|
-
case
|
|
2287
|
+
case te(t, [43, 101, 110]):
|
|
2304
2288
|
return "X25519";
|
|
2305
|
-
case
|
|
2289
|
+
case te(t, [43, 101, 111]):
|
|
2306
2290
|
return "X448";
|
|
2307
|
-
case
|
|
2291
|
+
case te(t, [43, 101, 112]):
|
|
2308
2292
|
return "Ed25519";
|
|
2309
|
-
case
|
|
2293
|
+
case te(t, [43, 101, 113]):
|
|
2310
2294
|
return "Ed448";
|
|
2311
2295
|
default:
|
|
2312
2296
|
throw new x("Invalid or unsupported EC Key Curve or OKP Key Sub Type");
|
|
2313
2297
|
}
|
|
2314
|
-
},
|
|
2298
|
+
}, xr = async (t, e, r, n, a) => {
|
|
2315
2299
|
var s;
|
|
2316
2300
|
let i, o;
|
|
2317
2301
|
const c = new Uint8Array(atob(r.replace(t, "")).split("").map((l) => l.charCodeAt(0))), u = e === "spki";
|
|
@@ -2348,27 +2332,27 @@ ${r}
|
|
|
2348
2332
|
case "ECDH-ES+A128KW":
|
|
2349
2333
|
case "ECDH-ES+A192KW":
|
|
2350
2334
|
case "ECDH-ES+A256KW": {
|
|
2351
|
-
const l =
|
|
2335
|
+
const l = Jt(c);
|
|
2352
2336
|
i = l.startsWith("P-") ? { name: "ECDH", namedCurve: l } : { name: l }, o = u ? [] : ["deriveBits"];
|
|
2353
2337
|
break;
|
|
2354
2338
|
}
|
|
2355
2339
|
case "EdDSA":
|
|
2356
|
-
i = { name:
|
|
2340
|
+
i = { name: Jt(c) }, o = u ? ["verify"] : ["sign"];
|
|
2357
2341
|
break;
|
|
2358
2342
|
default:
|
|
2359
2343
|
throw new x('Invalid or unsupported "alg" (Algorithm) value');
|
|
2360
2344
|
}
|
|
2361
2345
|
return b.subtle.importKey(e, c, i, (s = a == null ? void 0 : a.extractable) !== null && s !== void 0 ? s : !1, o);
|
|
2362
|
-
},
|
|
2363
|
-
function
|
|
2346
|
+
}, Nn = (t, e, r) => xr(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g, "pkcs8", t, e, r), Cr = (t, e, r) => xr(/(?:-----(?:BEGIN|END) PUBLIC KEY-----|\s)/g, "spki", t, e, r);
|
|
2347
|
+
function Nt(t) {
|
|
2364
2348
|
let e = [], r = 0;
|
|
2365
2349
|
for (; r < t.length; ) {
|
|
2366
|
-
let n =
|
|
2350
|
+
let n = _r(t.subarray(r));
|
|
2367
2351
|
e.push(n), r += n.byteLength;
|
|
2368
2352
|
}
|
|
2369
2353
|
return e;
|
|
2370
2354
|
}
|
|
2371
|
-
function
|
|
2355
|
+
function _r(t) {
|
|
2372
2356
|
let e = 0, r = t[0] & 31;
|
|
2373
2357
|
if (e++, r === 31) {
|
|
2374
2358
|
for (r = 0; t[e] >= 128; )
|
|
@@ -2403,24 +2387,24 @@ function Hr(t) {
|
|
|
2403
2387
|
raw: t.subarray(0, a)
|
|
2404
2388
|
};
|
|
2405
2389
|
}
|
|
2406
|
-
function
|
|
2407
|
-
const e =
|
|
2408
|
-
return
|
|
2390
|
+
function $n(t) {
|
|
2391
|
+
const e = Nt(Nt(_r(t).contents)[0].contents);
|
|
2392
|
+
return gt(e[e[0].raw[0] === 160 ? 6 : 5].raw);
|
|
2409
2393
|
}
|
|
2410
|
-
function
|
|
2411
|
-
const e = t.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g, ""), r =
|
|
2412
|
-
return
|
|
2394
|
+
function Mn(t) {
|
|
2395
|
+
const e = t.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g, ""), r = sr(e);
|
|
2396
|
+
return Er($n(r), "PUBLIC KEY");
|
|
2413
2397
|
}
|
|
2414
|
-
const
|
|
2398
|
+
const kn = (t, e, r) => {
|
|
2415
2399
|
let n;
|
|
2416
2400
|
try {
|
|
2417
|
-
n =
|
|
2401
|
+
n = Mn(t);
|
|
2418
2402
|
} catch (a) {
|
|
2419
2403
|
throw new TypeError("Failed to parse the X.509 certificate", { cause: a });
|
|
2420
2404
|
}
|
|
2421
|
-
return
|
|
2405
|
+
return Cr(n, e, r);
|
|
2422
2406
|
};
|
|
2423
|
-
function
|
|
2407
|
+
function Fn(t) {
|
|
2424
2408
|
let e, r;
|
|
2425
2409
|
switch (t.kty) {
|
|
2426
2410
|
case "oct": {
|
|
@@ -2526,11 +2510,11 @@ function zn(t) {
|
|
|
2526
2510
|
}
|
|
2527
2511
|
return { algorithm: e, keyUsages: r };
|
|
2528
2512
|
}
|
|
2529
|
-
const
|
|
2513
|
+
const Vn = async (t) => {
|
|
2530
2514
|
var e, r;
|
|
2531
2515
|
if (!t.alg)
|
|
2532
2516
|
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
2533
|
-
const { algorithm: n, keyUsages: a } =
|
|
2517
|
+
const { algorithm: n, keyUsages: a } = Fn(t), s = [
|
|
2534
2518
|
n,
|
|
2535
2519
|
(e = t.ext) !== null && e !== void 0 ? e : !1,
|
|
2536
2520
|
(r = t.key_ops) !== null && r !== void 0 ? r : a
|
|
@@ -2539,23 +2523,23 @@ const qn = async (t) => {
|
|
|
2539
2523
|
return b.subtle.importKey("raw", T(t.k), ...s);
|
|
2540
2524
|
const i = { ...t };
|
|
2541
2525
|
return delete i.alg, delete i.use, b.subtle.importKey("jwk", i, ...s);
|
|
2542
|
-
},
|
|
2543
|
-
async function
|
|
2526
|
+
}, $t = Vn;
|
|
2527
|
+
async function Bn(t, e, r) {
|
|
2544
2528
|
if (typeof t != "string" || t.indexOf("-----BEGIN PUBLIC KEY-----") !== 0)
|
|
2545
2529
|
throw new TypeError('"spki" must be SPKI formatted string');
|
|
2546
|
-
return
|
|
2530
|
+
return Cr(t, e, r);
|
|
2547
2531
|
}
|
|
2548
|
-
async function
|
|
2532
|
+
async function Gn(t, e, r) {
|
|
2549
2533
|
if (typeof t != "string" || t.indexOf("-----BEGIN CERTIFICATE-----") !== 0)
|
|
2550
2534
|
throw new TypeError('"x509" must be X.509 formatted string');
|
|
2551
|
-
return
|
|
2535
|
+
return kn(t, e, r);
|
|
2552
2536
|
}
|
|
2553
|
-
async function
|
|
2537
|
+
async function zn(t, e, r) {
|
|
2554
2538
|
if (typeof t != "string" || t.indexOf("-----BEGIN PRIVATE KEY-----") !== 0)
|
|
2555
2539
|
throw new TypeError('"pkcs8" must be PKCS#8 formatted string');
|
|
2556
|
-
return
|
|
2540
|
+
return Nn(t, e, r);
|
|
2557
2541
|
}
|
|
2558
|
-
async function
|
|
2542
|
+
async function $e(t, e, r) {
|
|
2559
2543
|
var n;
|
|
2560
2544
|
if (!I(t))
|
|
2561
2545
|
throw new TypeError("JWK must be an object");
|
|
@@ -2563,27 +2547,27 @@ async function Me(t, e, r) {
|
|
|
2563
2547
|
case "oct":
|
|
2564
2548
|
if (typeof t.k != "string" || !t.k)
|
|
2565
2549
|
throw new TypeError('missing "k" (Key Value) Parameter value');
|
|
2566
|
-
return r ?? (r = t.ext !== !0), r ?
|
|
2550
|
+
return r ?? (r = t.ext !== !0), r ? $t({ ...t, alg: e, ext: (n = t.ext) !== null && n !== void 0 ? n : !1 }) : T(t.k);
|
|
2567
2551
|
case "RSA":
|
|
2568
2552
|
if (t.oth !== void 0)
|
|
2569
2553
|
throw new x('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
|
|
2570
2554
|
case "EC":
|
|
2571
2555
|
case "OKP":
|
|
2572
|
-
return
|
|
2556
|
+
return $t({ ...t, alg: e });
|
|
2573
2557
|
default:
|
|
2574
2558
|
throw new x('Unsupported "kty" (Key Type) Parameter value');
|
|
2575
2559
|
}
|
|
2576
2560
|
}
|
|
2577
|
-
const
|
|
2561
|
+
const qn = (t, e) => {
|
|
2578
2562
|
if (!(e instanceof Uint8Array)) {
|
|
2579
|
-
if (!
|
|
2580
|
-
throw new TypeError(
|
|
2563
|
+
if (!gr(e))
|
|
2564
|
+
throw new TypeError(pr(t, e, ...H, "Uint8Array"));
|
|
2581
2565
|
if (e.type !== "secret")
|
|
2582
2566
|
throw new TypeError(`${H.join(" or ")} instances for symmetric algorithms must be of type "secret"`);
|
|
2583
2567
|
}
|
|
2584
|
-
},
|
|
2585
|
-
if (!
|
|
2586
|
-
throw new TypeError(
|
|
2568
|
+
}, Xn = (t, e, r) => {
|
|
2569
|
+
if (!gr(e))
|
|
2570
|
+
throw new TypeError(pr(t, e, ...H));
|
|
2587
2571
|
if (e.type === "secret")
|
|
2588
2572
|
throw new TypeError(`${H.join(" or ")} instances for asymmetric algorithms must not be of type "secret"`);
|
|
2589
2573
|
if (r === "sign" && e.type === "public")
|
|
@@ -2594,10 +2578,10 @@ const Qn = (t, e) => {
|
|
|
2594
2578
|
throw new TypeError(`${H.join(" or ")} instances for asymmetric algorithm verifying must be of type "public"`);
|
|
2595
2579
|
if (e.algorithm && r === "encrypt" && e.type === "private")
|
|
2596
2580
|
throw new TypeError(`${H.join(" or ")} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
2597
|
-
},
|
|
2598
|
-
t.startsWith("HS") || t === "dir" || t.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(t) ?
|
|
2581
|
+
}, Me = (t, e, r) => {
|
|
2582
|
+
t.startsWith("HS") || t === "dir" || t.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(t) ? qn(t, e) : Xn(t, e, r);
|
|
2599
2583
|
};
|
|
2600
|
-
async function
|
|
2584
|
+
async function Yn(t, e, r, n, a) {
|
|
2601
2585
|
if (!(r instanceof Uint8Array))
|
|
2602
2586
|
throw new TypeError(M(r, "Uint8Array"));
|
|
2603
2587
|
const s = parseInt(t.slice(1, 4), 10), i = await b.subtle.importKey("raw", r.subarray(s >> 3), "AES-CBC", !1, ["encrypt"]), o = await b.subtle.importKey("raw", r.subarray(0, s >> 3), {
|
|
@@ -2606,12 +2590,12 @@ async function ea(t, e, r, n, a) {
|
|
|
2606
2590
|
}, !1, ["sign"]), c = new Uint8Array(await b.subtle.encrypt({
|
|
2607
2591
|
iv: n,
|
|
2608
2592
|
name: "AES-CBC"
|
|
2609
|
-
}, i, e)), u = Q(a, n, c,
|
|
2593
|
+
}, i, e)), u = Q(a, n, c, ar(a.length << 3)), l = new Uint8Array((await b.subtle.sign("HMAC", o, u)).slice(0, s >> 3));
|
|
2610
2594
|
return { ciphertext: c, tag: l };
|
|
2611
2595
|
}
|
|
2612
|
-
async function
|
|
2596
|
+
async function Zn(t, e, r, n, a) {
|
|
2613
2597
|
let s;
|
|
2614
|
-
r instanceof Uint8Array ? s = await b.subtle.importKey("raw", r, "AES-GCM", !1, ["encrypt"]) : (
|
|
2598
|
+
r instanceof Uint8Array ? s = await b.subtle.importKey("raw", r, "AES-GCM", !1, ["encrypt"]) : (ae(r, t, "encrypt"), s = r);
|
|
2615
2599
|
const i = new Uint8Array(await b.subtle.encrypt({
|
|
2616
2600
|
additionalData: a,
|
|
2617
2601
|
iv: n,
|
|
@@ -2620,34 +2604,34 @@ async function ta(t, e, r, n, a) {
|
|
|
2620
2604
|
}, s, e)), o = i.slice(-16);
|
|
2621
2605
|
return { ciphertext: i.slice(0, -16), tag: o };
|
|
2622
2606
|
}
|
|
2623
|
-
const
|
|
2607
|
+
const lt = async (t, e, r, n, a) => {
|
|
2624
2608
|
if (!G(r) && !(r instanceof Uint8Array))
|
|
2625
2609
|
throw new TypeError(M(r, ...H, "Uint8Array"));
|
|
2626
|
-
switch (
|
|
2610
|
+
switch (dr(t, n), t) {
|
|
2627
2611
|
case "A128CBC-HS256":
|
|
2628
2612
|
case "A192CBC-HS384":
|
|
2629
2613
|
case "A256CBC-HS512":
|
|
2630
|
-
return r instanceof Uint8Array &&
|
|
2614
|
+
return r instanceof Uint8Array && Oe(r, parseInt(t.slice(-3), 10)), Yn(t, e, r, n, a);
|
|
2631
2615
|
case "A128GCM":
|
|
2632
2616
|
case "A192GCM":
|
|
2633
2617
|
case "A256GCM":
|
|
2634
|
-
return r instanceof Uint8Array &&
|
|
2618
|
+
return r instanceof Uint8Array && Oe(r, parseInt(t.slice(1, 4), 10)), Zn(t, e, r, n, a);
|
|
2635
2619
|
default:
|
|
2636
2620
|
throw new x("Unsupported JWE Content Encryption Algorithm");
|
|
2637
2621
|
}
|
|
2638
2622
|
};
|
|
2639
|
-
async function
|
|
2623
|
+
async function Qn(t, e, r, n) {
|
|
2640
2624
|
const a = t.slice(0, 7);
|
|
2641
|
-
n || (n =
|
|
2642
|
-
const { ciphertext: s, tag: i } = await
|
|
2625
|
+
n || (n = lr(a));
|
|
2626
|
+
const { ciphertext: s, tag: i } = await lt(a, r, e, n, new Uint8Array(0));
|
|
2643
2627
|
return { encryptedKey: s, iv: O(n), tag: O(i) };
|
|
2644
2628
|
}
|
|
2645
|
-
async function
|
|
2629
|
+
async function jn(t, e, r, n, a) {
|
|
2646
2630
|
const s = t.slice(0, 7);
|
|
2647
|
-
return
|
|
2631
|
+
return mr(s, e, r, n, a, new Uint8Array(0));
|
|
2648
2632
|
}
|
|
2649
|
-
async function
|
|
2650
|
-
switch (
|
|
2633
|
+
async function ea(t, e, r, n, a) {
|
|
2634
|
+
switch (Me(t, e, "decrypt"), t) {
|
|
2651
2635
|
case "dir": {
|
|
2652
2636
|
if (r !== void 0)
|
|
2653
2637
|
throw new y("Encountered unexpected JWE Encrypted Key");
|
|
@@ -2661,9 +2645,9 @@ async function aa(t, e, r, n, a) {
|
|
|
2661
2645
|
case "ECDH-ES+A256KW": {
|
|
2662
2646
|
if (!I(n.epk))
|
|
2663
2647
|
throw new y('JOSE Header "epk" (Ephemeral Public Key) missing or invalid');
|
|
2664
|
-
if (!
|
|
2648
|
+
if (!br(e))
|
|
2665
2649
|
throw new x("ECDH with the provided key is not allowed or not supported by your javascript runtime");
|
|
2666
|
-
const s = await
|
|
2650
|
+
const s = await $e(n.epk, t);
|
|
2667
2651
|
let i, o;
|
|
2668
2652
|
if (n.apu !== void 0) {
|
|
2669
2653
|
if (typeof n.apu != "string")
|
|
@@ -2683,12 +2667,12 @@ async function aa(t, e, r, n, a) {
|
|
|
2683
2667
|
throw new y("Failed to base64url decode the apv");
|
|
2684
2668
|
}
|
|
2685
2669
|
}
|
|
2686
|
-
const c = await
|
|
2670
|
+
const c = await Sr(s, e, t === "ECDH-ES" ? n.enc : t, t === "ECDH-ES" ? wt(n.enc) : parseInt(t.slice(-5, -2), 10), i, o);
|
|
2687
2671
|
if (t === "ECDH-ES")
|
|
2688
2672
|
return c;
|
|
2689
2673
|
if (r === void 0)
|
|
2690
2674
|
throw new y("JWE Encrypted Key missing");
|
|
2691
|
-
return
|
|
2675
|
+
return ut(t.slice(-6), c, r);
|
|
2692
2676
|
}
|
|
2693
2677
|
case "RSA1_5":
|
|
2694
2678
|
case "RSA-OAEP":
|
|
@@ -2697,7 +2681,7 @@ async function aa(t, e, r, n, a) {
|
|
|
2697
2681
|
case "RSA-OAEP-512": {
|
|
2698
2682
|
if (r === void 0)
|
|
2699
2683
|
throw new y("JWE Encrypted Key missing");
|
|
2700
|
-
return
|
|
2684
|
+
return Ln(t, e, r);
|
|
2701
2685
|
}
|
|
2702
2686
|
case "PBES2-HS256+A128KW":
|
|
2703
2687
|
case "PBES2-HS384+A192KW":
|
|
@@ -2717,14 +2701,14 @@ async function aa(t, e, r, n, a) {
|
|
|
2717
2701
|
} catch {
|
|
2718
2702
|
throw new y("Failed to base64url decode the p2s");
|
|
2719
2703
|
}
|
|
2720
|
-
return
|
|
2704
|
+
return Wn(t, e, r, n.p2c, i);
|
|
2721
2705
|
}
|
|
2722
2706
|
case "A128KW":
|
|
2723
2707
|
case "A192KW":
|
|
2724
2708
|
case "A256KW": {
|
|
2725
2709
|
if (r === void 0)
|
|
2726
2710
|
throw new y("JWE Encrypted Key missing");
|
|
2727
|
-
return
|
|
2711
|
+
return ut(t, e, r);
|
|
2728
2712
|
}
|
|
2729
2713
|
case "A128GCMKW":
|
|
2730
2714
|
case "A192GCMKW":
|
|
@@ -2747,13 +2731,13 @@ async function aa(t, e, r, n, a) {
|
|
|
2747
2731
|
} catch {
|
|
2748
2732
|
throw new y("Failed to base64url decode the tag");
|
|
2749
2733
|
}
|
|
2750
|
-
return
|
|
2734
|
+
return jn(t, e, r, s, i);
|
|
2751
2735
|
}
|
|
2752
2736
|
default:
|
|
2753
2737
|
throw new x('Invalid or unsupported "alg" (JWE Algorithm) header value');
|
|
2754
2738
|
}
|
|
2755
2739
|
}
|
|
2756
|
-
function
|
|
2740
|
+
function ye(t, e, r, n, a) {
|
|
2757
2741
|
if (a.crit !== void 0 && n.crit === void 0)
|
|
2758
2742
|
throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
2759
2743
|
if (!n || n.crit === void 0)
|
|
@@ -2772,13 +2756,13 @@ function we(t, e, r, n, a) {
|
|
|
2772
2756
|
}
|
|
2773
2757
|
return new Set(n.crit);
|
|
2774
2758
|
}
|
|
2775
|
-
const
|
|
2759
|
+
const dt = (t, e) => {
|
|
2776
2760
|
if (e !== void 0 && (!Array.isArray(e) || e.some((r) => typeof r != "string")))
|
|
2777
2761
|
throw new TypeError(`"${t}" option must be an array of strings`);
|
|
2778
2762
|
if (e)
|
|
2779
2763
|
return new Set(e);
|
|
2780
2764
|
};
|
|
2781
|
-
async function
|
|
2765
|
+
async function St(t, e, r) {
|
|
2782
2766
|
var n;
|
|
2783
2767
|
if (!I(t))
|
|
2784
2768
|
throw new y("Flattened JWE must be an object");
|
|
@@ -2808,14 +2792,14 @@ async function bt(t, e, r) {
|
|
|
2808
2792
|
} catch {
|
|
2809
2793
|
throw new y("JWE Protected Header is invalid");
|
|
2810
2794
|
}
|
|
2811
|
-
if (!
|
|
2795
|
+
if (!me(a, t.header, t.unprotected))
|
|
2812
2796
|
throw new y("JWE Protected, JWE Unprotected Header, and JWE Per-Recipient Unprotected Header Parameter names must be disjoint");
|
|
2813
2797
|
const s = {
|
|
2814
2798
|
...a,
|
|
2815
2799
|
...t.header,
|
|
2816
2800
|
...t.unprotected
|
|
2817
2801
|
};
|
|
2818
|
-
if (
|
|
2802
|
+
if (ye(y, /* @__PURE__ */ new Map(), r == null ? void 0 : r.crit, a, s), s.zip !== void 0) {
|
|
2819
2803
|
if (!a || !a.zip)
|
|
2820
2804
|
throw new y('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');
|
|
2821
2805
|
if (s.zip !== "DEF")
|
|
@@ -2826,11 +2810,11 @@ async function bt(t, e, r) {
|
|
|
2826
2810
|
throw new y("missing JWE Algorithm (alg) in JWE Header");
|
|
2827
2811
|
if (typeof o != "string" || !o)
|
|
2828
2812
|
throw new y("missing JWE Encryption Algorithm (enc) in JWE Header");
|
|
2829
|
-
const c = r &&
|
|
2813
|
+
const c = r && dt("keyManagementAlgorithms", r.keyManagementAlgorithms), u = r && dt("contentEncryptionAlgorithms", r.contentEncryptionAlgorithms);
|
|
2830
2814
|
if (c && !c.has(i))
|
|
2831
|
-
throw new
|
|
2815
|
+
throw new Re('"alg" (Algorithm) Header Parameter not allowed');
|
|
2832
2816
|
if (u && !u.has(o))
|
|
2833
|
-
throw new
|
|
2817
|
+
throw new Re('"enc" (Encryption Algorithm) Header Parameter not allowed');
|
|
2834
2818
|
let l;
|
|
2835
2819
|
if (t.encrypted_key !== void 0)
|
|
2836
2820
|
try {
|
|
@@ -2842,11 +2826,11 @@ async function bt(t, e, r) {
|
|
|
2842
2826
|
typeof e == "function" && (e = await e(a, t), f = !0);
|
|
2843
2827
|
let d;
|
|
2844
2828
|
try {
|
|
2845
|
-
d = await
|
|
2829
|
+
d = await ea(i, e, l, s, r);
|
|
2846
2830
|
} catch (m) {
|
|
2847
2831
|
if (m instanceof TypeError || m instanceof y || m instanceof x)
|
|
2848
2832
|
throw m;
|
|
2849
|
-
d =
|
|
2833
|
+
d = ie(o);
|
|
2850
2834
|
}
|
|
2851
2835
|
let p, h;
|
|
2852
2836
|
try {
|
|
@@ -2868,8 +2852,8 @@ async function bt(t, e, r) {
|
|
|
2868
2852
|
} catch {
|
|
2869
2853
|
throw new y("Failed to base64url decode the ciphertext");
|
|
2870
2854
|
}
|
|
2871
|
-
let v = await
|
|
2872
|
-
s.zip === "DEF" && (v = await ((r == null ? void 0 : r.inflateRaw) ||
|
|
2855
|
+
let v = await mr(o, d, C, p, h, S);
|
|
2856
|
+
s.zip === "DEF" && (v = await ((r == null ? void 0 : r.inflateRaw) || Pn)(v));
|
|
2873
2857
|
const w = { plaintext: v };
|
|
2874
2858
|
if (t.protected !== void 0 && (w.protectedHeader = a), t.aad !== void 0)
|
|
2875
2859
|
try {
|
|
@@ -2879,13 +2863,13 @@ async function bt(t, e, r) {
|
|
|
2879
2863
|
}
|
|
2880
2864
|
return t.unprotected !== void 0 && (w.sharedUnprotectedHeader = t.unprotected), t.header !== void 0 && (w.unprotectedHeader = t.header), f ? { ...w, key: e } : w;
|
|
2881
2865
|
}
|
|
2882
|
-
async function
|
|
2866
|
+
async function Pr(t, e, r) {
|
|
2883
2867
|
if (t instanceof Uint8Array && (t = X.decode(t)), typeof t != "string")
|
|
2884
2868
|
throw new y("Compact JWE must be a string or Uint8Array");
|
|
2885
2869
|
const { 0: n, 1: a, 2: s, 3: i, 4: o, length: c } = t.split(".");
|
|
2886
2870
|
if (c !== 5)
|
|
2887
2871
|
throw new y("Invalid Compact JWE");
|
|
2888
|
-
const u = await
|
|
2872
|
+
const u = await St({
|
|
2889
2873
|
ciphertext: i,
|
|
2890
2874
|
iv: s || void 0,
|
|
2891
2875
|
protected: n || void 0,
|
|
@@ -2894,7 +2878,7 @@ async function Kr(t, e, r) {
|
|
|
2894
2878
|
}, e, r), l = { plaintext: u.plaintext, protectedHeader: u.protectedHeader };
|
|
2895
2879
|
return typeof e == "function" ? { ...l, key: u.key } : l;
|
|
2896
2880
|
}
|
|
2897
|
-
async function
|
|
2881
|
+
async function ta(t, e, r) {
|
|
2898
2882
|
if (!I(t))
|
|
2899
2883
|
throw new y("General JWE must be an object");
|
|
2900
2884
|
if (!Array.isArray(t.recipients) || !t.recipients.every(I))
|
|
@@ -2903,7 +2887,7 @@ async function sa(t, e, r) {
|
|
|
2903
2887
|
throw new y("JWE Recipients has no members");
|
|
2904
2888
|
for (const n of t.recipients)
|
|
2905
2889
|
try {
|
|
2906
|
-
return await
|
|
2890
|
+
return await St({
|
|
2907
2891
|
aad: t.aad,
|
|
2908
2892
|
ciphertext: t.ciphertext,
|
|
2909
2893
|
encrypted_key: n.encrypted_key,
|
|
@@ -2915,9 +2899,9 @@ async function sa(t, e, r) {
|
|
|
2915
2899
|
}, e, r);
|
|
2916
2900
|
} catch {
|
|
2917
2901
|
}
|
|
2918
|
-
throw new
|
|
2902
|
+
throw new ge();
|
|
2919
2903
|
}
|
|
2920
|
-
const
|
|
2904
|
+
const ra = async (t) => {
|
|
2921
2905
|
if (t instanceof Uint8Array)
|
|
2922
2906
|
return {
|
|
2923
2907
|
kty: "oct",
|
|
@@ -2929,19 +2913,19 @@ const ia = async (t) => {
|
|
|
2929
2913
|
throw new TypeError("non-extractable CryptoKey cannot be exported as a JWK");
|
|
2930
2914
|
const { ext: e, key_ops: r, alg: n, use: a, ...s } = await b.subtle.exportKey("jwk", t);
|
|
2931
2915
|
return s;
|
|
2932
|
-
},
|
|
2933
|
-
async function
|
|
2934
|
-
return
|
|
2916
|
+
}, na = ra;
|
|
2917
|
+
async function aa(t) {
|
|
2918
|
+
return Dn(t);
|
|
2935
2919
|
}
|
|
2936
|
-
async function
|
|
2937
|
-
return
|
|
2920
|
+
async function sa(t) {
|
|
2921
|
+
return Jn(t);
|
|
2938
2922
|
}
|
|
2939
|
-
async function
|
|
2940
|
-
return
|
|
2923
|
+
async function Hr(t) {
|
|
2924
|
+
return na(t);
|
|
2941
2925
|
}
|
|
2942
|
-
async function
|
|
2926
|
+
async function Kr(t, e, r, n, a = {}) {
|
|
2943
2927
|
let s, i, o;
|
|
2944
|
-
switch (
|
|
2928
|
+
switch (Me(t, r, "encrypt"), t) {
|
|
2945
2929
|
case "dir": {
|
|
2946
2930
|
o = r;
|
|
2947
2931
|
break;
|
|
@@ -2950,19 +2934,19 @@ async function Or(t, e, r, n, a = {}) {
|
|
|
2950
2934
|
case "ECDH-ES+A128KW":
|
|
2951
2935
|
case "ECDH-ES+A192KW":
|
|
2952
2936
|
case "ECDH-ES+A256KW": {
|
|
2953
|
-
if (!
|
|
2937
|
+
if (!br(r))
|
|
2954
2938
|
throw new x("ECDH with the provided key is not allowed or not supported by your javascript runtime");
|
|
2955
2939
|
const { apu: c, apv: u } = a;
|
|
2956
2940
|
let { epk: l } = a;
|
|
2957
|
-
l || (l = (await
|
|
2958
|
-
const { x: f, y: d, crv: p, kty: h } = await
|
|
2941
|
+
l || (l = (await Rn(r)).privateKey);
|
|
2942
|
+
const { x: f, y: d, crv: p, kty: h } = await Hr(l), g = await Sr(r, l, t === "ECDH-ES" ? e : t, t === "ECDH-ES" ? wt(e) : parseInt(t.slice(-5, -2), 10), c, u);
|
|
2959
2943
|
if (i = { epk: { x: f, crv: p, kty: h } }, h === "EC" && (i.epk.y = d), c && (i.apu = O(c)), u && (i.apv = O(u)), t === "ECDH-ES") {
|
|
2960
2944
|
o = g;
|
|
2961
2945
|
break;
|
|
2962
2946
|
}
|
|
2963
|
-
o = n ||
|
|
2947
|
+
o = n || ie(e);
|
|
2964
2948
|
const S = t.slice(-6);
|
|
2965
|
-
s = await
|
|
2949
|
+
s = await ct(S, g, o);
|
|
2966
2950
|
break;
|
|
2967
2951
|
}
|
|
2968
2952
|
case "RSA1_5":
|
|
@@ -2970,29 +2954,29 @@ async function Or(t, e, r, n, a = {}) {
|
|
|
2970
2954
|
case "RSA-OAEP-256":
|
|
2971
2955
|
case "RSA-OAEP-384":
|
|
2972
2956
|
case "RSA-OAEP-512": {
|
|
2973
|
-
o = n ||
|
|
2957
|
+
o = n || ie(e), s = await Un(t, r, o);
|
|
2974
2958
|
break;
|
|
2975
2959
|
}
|
|
2976
2960
|
case "PBES2-HS256+A128KW":
|
|
2977
2961
|
case "PBES2-HS384+A192KW":
|
|
2978
2962
|
case "PBES2-HS512+A256KW": {
|
|
2979
|
-
o = n ||
|
|
2963
|
+
o = n || ie(e);
|
|
2980
2964
|
const { p2c: c, p2s: u } = a;
|
|
2981
|
-
({ encryptedKey: s, ...i } = await
|
|
2965
|
+
({ encryptedKey: s, ...i } = await In(t, r, o, c, u));
|
|
2982
2966
|
break;
|
|
2983
2967
|
}
|
|
2984
2968
|
case "A128KW":
|
|
2985
2969
|
case "A192KW":
|
|
2986
2970
|
case "A256KW": {
|
|
2987
|
-
o = n ||
|
|
2971
|
+
o = n || ie(e), s = await ct(t, r, o);
|
|
2988
2972
|
break;
|
|
2989
2973
|
}
|
|
2990
2974
|
case "A128GCMKW":
|
|
2991
2975
|
case "A192GCMKW":
|
|
2992
2976
|
case "A256GCMKW": {
|
|
2993
|
-
o = n ||
|
|
2977
|
+
o = n || ie(e);
|
|
2994
2978
|
const { iv: c } = a;
|
|
2995
|
-
({ encryptedKey: s, ...i } = await
|
|
2979
|
+
({ encryptedKey: s, ...i } = await Qn(t, r, o, c));
|
|
2996
2980
|
break;
|
|
2997
2981
|
}
|
|
2998
2982
|
default:
|
|
@@ -3000,8 +2984,8 @@ async function Or(t, e, r, n, a = {}) {
|
|
|
3000
2984
|
}
|
|
3001
2985
|
return { cek: o, encryptedKey: s, parameters: i };
|
|
3002
2986
|
}
|
|
3003
|
-
const
|
|
3004
|
-
class
|
|
2987
|
+
const Rr = Symbol();
|
|
2988
|
+
class Ie {
|
|
3005
2989
|
constructor(e) {
|
|
3006
2990
|
if (!(e instanceof Uint8Array))
|
|
3007
2991
|
throw new TypeError("plaintext must be an instance of Uint8Array");
|
|
@@ -3043,14 +3027,14 @@ class We {
|
|
|
3043
3027
|
async encrypt(e, r) {
|
|
3044
3028
|
if (!this._protectedHeader && !this._unprotectedHeader && !this._sharedUnprotectedHeader)
|
|
3045
3029
|
throw new y("either setProtectedHeader, setUnprotectedHeader, or sharedUnprotectedHeader must be called before #encrypt()");
|
|
3046
|
-
if (!
|
|
3030
|
+
if (!me(this._protectedHeader, this._unprotectedHeader, this._sharedUnprotectedHeader))
|
|
3047
3031
|
throw new y("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");
|
|
3048
3032
|
const n = {
|
|
3049
3033
|
...this._protectedHeader,
|
|
3050
3034
|
...this._unprotectedHeader,
|
|
3051
3035
|
...this._sharedUnprotectedHeader
|
|
3052
3036
|
};
|
|
3053
|
-
if (
|
|
3037
|
+
if (ye(y, /* @__PURE__ */ new Map(), r == null ? void 0 : r.crit, this._protectedHeader, n), n.zip !== void 0) {
|
|
3054
3038
|
if (!this._protectedHeader || !this._protectedHeader.zip)
|
|
3055
3039
|
throw new y('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');
|
|
3056
3040
|
if (n.zip !== "DEF")
|
|
@@ -3070,17 +3054,17 @@ class We {
|
|
|
3070
3054
|
let o;
|
|
3071
3055
|
{
|
|
3072
3056
|
let h;
|
|
3073
|
-
({ cek: o, encryptedKey: i, parameters: h } = await
|
|
3057
|
+
({ cek: o, encryptedKey: i, parameters: h } = await Kr(a, s, e, this._cek, this._keyManagementParameters)), h && (r && Rr in r ? this._unprotectedHeader ? this._unprotectedHeader = { ...this._unprotectedHeader, ...h } : this.setUnprotectedHeader(h) : this._protectedHeader ? this._protectedHeader = { ...this._protectedHeader, ...h } : this.setProtectedHeader(h));
|
|
3074
3058
|
}
|
|
3075
|
-
this._iv || (this._iv =
|
|
3059
|
+
this._iv || (this._iv = lr(s));
|
|
3076
3060
|
let c, u, l;
|
|
3077
3061
|
this._protectedHeader ? u = K.encode(O(JSON.stringify(this._protectedHeader))) : u = K.encode(""), this._aad ? (l = O(this._aad), c = Q(u, K.encode("."), K.encode(l))) : c = u;
|
|
3078
3062
|
let f, d;
|
|
3079
3063
|
if (n.zip === "DEF") {
|
|
3080
|
-
const h = await ((r == null ? void 0 : r.deflateRaw) ||
|
|
3081
|
-
({ ciphertext: f, tag: d } = await
|
|
3064
|
+
const h = await ((r == null ? void 0 : r.deflateRaw) || Hn)(this._plaintext);
|
|
3065
|
+
({ ciphertext: f, tag: d } = await lt(s, h, o, this._iv, c));
|
|
3082
3066
|
} else
|
|
3083
|
-
({ ciphertext: f, tag: d } = await
|
|
3067
|
+
({ ciphertext: f, tag: d } = await lt(s, this._plaintext, o, this._iv, c));
|
|
3084
3068
|
const p = {
|
|
3085
3069
|
ciphertext: O(f),
|
|
3086
3070
|
iv: O(this._iv),
|
|
@@ -3089,7 +3073,7 @@ class We {
|
|
|
3089
3073
|
return i && (p.encrypted_key = O(i)), l && (p.aad = l), this._protectedHeader && (p.protected = X.decode(u)), this._sharedUnprotectedHeader && (p.unprotected = this._sharedUnprotectedHeader), this._unprotectedHeader && (p.header = this._unprotectedHeader), p;
|
|
3090
3074
|
}
|
|
3091
3075
|
}
|
|
3092
|
-
class
|
|
3076
|
+
class ia {
|
|
3093
3077
|
constructor(e, r, n) {
|
|
3094
3078
|
this.parent = e, this.key = r, this.options = n;
|
|
3095
3079
|
}
|
|
@@ -3108,12 +3092,12 @@ class la {
|
|
|
3108
3092
|
return this.parent;
|
|
3109
3093
|
}
|
|
3110
3094
|
}
|
|
3111
|
-
class
|
|
3095
|
+
class oa {
|
|
3112
3096
|
constructor(e) {
|
|
3113
3097
|
this._recipients = [], this._plaintext = e;
|
|
3114
3098
|
}
|
|
3115
3099
|
addRecipient(e, r) {
|
|
3116
|
-
const n = new
|
|
3100
|
+
const n = new ia(this, e, { crit: r == null ? void 0 : r.crit });
|
|
3117
3101
|
return this._recipients.push(n), n;
|
|
3118
3102
|
}
|
|
3119
3103
|
setProtectedHeader(e) {
|
|
@@ -3134,7 +3118,7 @@ class da {
|
|
|
3134
3118
|
if (!this._recipients.length)
|
|
3135
3119
|
throw new y("at least one recipient must be added");
|
|
3136
3120
|
if (e = { deflateRaw: e == null ? void 0 : e.deflateRaw }, this._recipients.length === 1) {
|
|
3137
|
-
const [c] = this._recipients, u = await new
|
|
3121
|
+
const [c] = this._recipients, u = await new Ie(this._plaintext).setAdditionalAuthenticatedData(this._aad).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(c.unprotectedHeader).encrypt(c.key, { ...c.options, ...e });
|
|
3138
3122
|
let l = {
|
|
3139
3123
|
ciphertext: u.ciphertext,
|
|
3140
3124
|
iv: u.iv,
|
|
@@ -3146,7 +3130,7 @@ class da {
|
|
|
3146
3130
|
let s;
|
|
3147
3131
|
for (let c = 0; c < this._recipients.length; c++) {
|
|
3148
3132
|
const u = this._recipients[c];
|
|
3149
|
-
if (!
|
|
3133
|
+
if (!me(this._protectedHeader, this._unprotectedHeader, u.unprotectedHeader))
|
|
3150
3134
|
throw new y("JWE Protected, JWE Shared Unprotected and JWE Per-Recipient Header Parameter names must be disjoint");
|
|
3151
3135
|
const l = {
|
|
3152
3136
|
...this._protectedHeader,
|
|
@@ -3163,10 +3147,10 @@ class da {
|
|
|
3163
3147
|
s = l.enc;
|
|
3164
3148
|
else if (s !== l.enc)
|
|
3165
3149
|
throw new y('JWE "enc" (Encryption Algorithm) Header Parameter must be the same for all recipients');
|
|
3166
|
-
if (
|
|
3150
|
+
if (ye(y, /* @__PURE__ */ new Map(), u.options.crit, this._protectedHeader, l), l.zip !== void 0 && (!this._protectedHeader || !this._protectedHeader.zip))
|
|
3167
3151
|
throw new y('JWE "zip" (Compression Algorithm) Header MUST be integrity protected');
|
|
3168
3152
|
}
|
|
3169
|
-
const i =
|
|
3153
|
+
const i = ie(s);
|
|
3170
3154
|
let o = {
|
|
3171
3155
|
ciphertext: "",
|
|
3172
3156
|
iv: "",
|
|
@@ -3182,21 +3166,21 @@ class da {
|
|
|
3182
3166
|
...u.unprotectedHeader
|
|
3183
3167
|
}.alg.startsWith("PBES2") ? 2048 + c : void 0;
|
|
3184
3168
|
if (c === 0) {
|
|
3185
|
-
const g = await new
|
|
3169
|
+
const g = await new Ie(this._plaintext).setAdditionalAuthenticatedData(this._aad).setContentEncryptionKey(i).setProtectedHeader(this._protectedHeader).setSharedUnprotectedHeader(this._unprotectedHeader).setUnprotectedHeader(u.unprotectedHeader).setKeyManagementParameters({ p2c: d }).encrypt(u.key, {
|
|
3186
3170
|
...u.options,
|
|
3187
3171
|
...e,
|
|
3188
|
-
[
|
|
3172
|
+
[Rr]: !0
|
|
3189
3173
|
});
|
|
3190
3174
|
o.ciphertext = g.ciphertext, o.iv = g.iv, o.tag = g.tag, g.aad && (o.aad = g.aad), g.protected && (o.protected = g.protected), g.unprotected && (o.unprotected = g.unprotected), l.encrypted_key = g.encrypted_key, g.header && (l.header = g.header);
|
|
3191
3175
|
continue;
|
|
3192
3176
|
}
|
|
3193
|
-
const { encryptedKey: p, parameters: h } = await
|
|
3177
|
+
const { encryptedKey: p, parameters: h } = await Kr(((r = u.unprotectedHeader) === null || r === void 0 ? void 0 : r.alg) || ((n = this._protectedHeader) === null || n === void 0 ? void 0 : n.alg) || ((a = this._unprotectedHeader) === null || a === void 0 ? void 0 : a.alg), s, u.key, i, { p2c: d });
|
|
3194
3178
|
l.encrypted_key = O(p), (u.unprotectedHeader || h) && (l.header = { ...u.unprotectedHeader, ...h });
|
|
3195
3179
|
}
|
|
3196
3180
|
return o;
|
|
3197
3181
|
}
|
|
3198
3182
|
}
|
|
3199
|
-
function
|
|
3183
|
+
function Or(t, e) {
|
|
3200
3184
|
const r = `SHA-${t.slice(-3)}`;
|
|
3201
3185
|
switch (t) {
|
|
3202
3186
|
case "HS256":
|
|
@@ -3221,9 +3205,9 @@ function Ir(t, e) {
|
|
|
3221
3205
|
throw new x(`alg ${t} is not supported either by JOSE or your javascript runtime`);
|
|
3222
3206
|
}
|
|
3223
3207
|
}
|
|
3224
|
-
function
|
|
3208
|
+
function Tr(t, e, r) {
|
|
3225
3209
|
if (G(e))
|
|
3226
|
-
return
|
|
3210
|
+
return xn(e, t, r), e;
|
|
3227
3211
|
if (e instanceof Uint8Array) {
|
|
3228
3212
|
if (!t.startsWith("HS"))
|
|
3229
3213
|
throw new TypeError(M(e, ...H));
|
|
@@ -3231,17 +3215,17 @@ function Wr(t, e, r) {
|
|
|
3231
3215
|
}
|
|
3232
3216
|
throw new TypeError(M(e, ...H, "Uint8Array"));
|
|
3233
3217
|
}
|
|
3234
|
-
const
|
|
3235
|
-
const a = await
|
|
3236
|
-
|
|
3237
|
-
const s =
|
|
3218
|
+
const ca = async (t, e, r, n) => {
|
|
3219
|
+
const a = await Tr(t, e, "verify");
|
|
3220
|
+
Ne(t, a);
|
|
3221
|
+
const s = Or(t, a.algorithm);
|
|
3238
3222
|
try {
|
|
3239
3223
|
return await b.subtle.verify(s, a, r, n);
|
|
3240
3224
|
} catch {
|
|
3241
3225
|
return !1;
|
|
3242
3226
|
}
|
|
3243
3227
|
};
|
|
3244
|
-
async function
|
|
3228
|
+
async function bt(t, e, r) {
|
|
3245
3229
|
var n;
|
|
3246
3230
|
if (!I(t))
|
|
3247
3231
|
throw new P("Flattened JWS must be an object");
|
|
@@ -3263,28 +3247,28 @@ async function vt(t, e, r) {
|
|
|
3263
3247
|
} catch {
|
|
3264
3248
|
throw new P("JWS Protected Header is invalid");
|
|
3265
3249
|
}
|
|
3266
|
-
if (!
|
|
3250
|
+
if (!me(a, t.header))
|
|
3267
3251
|
throw new P("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
3268
3252
|
const s = {
|
|
3269
3253
|
...a,
|
|
3270
3254
|
...t.header
|
|
3271
|
-
}, i =
|
|
3255
|
+
}, i = ye(P, /* @__PURE__ */ new Map([["b64", !0]]), r == null ? void 0 : r.crit, a, s);
|
|
3272
3256
|
let o = !0;
|
|
3273
3257
|
if (i.has("b64") && (o = a.b64, typeof o != "boolean"))
|
|
3274
3258
|
throw new P('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
3275
3259
|
const { alg: c } = s;
|
|
3276
3260
|
if (typeof c != "string" || !c)
|
|
3277
3261
|
throw new P('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
3278
|
-
const u = r &&
|
|
3262
|
+
const u = r && dt("algorithms", r.algorithms);
|
|
3279
3263
|
if (u && !u.has(c))
|
|
3280
|
-
throw new
|
|
3264
|
+
throw new Re('"alg" (Algorithm) Header Parameter not allowed');
|
|
3281
3265
|
if (o) {
|
|
3282
3266
|
if (typeof t.payload != "string")
|
|
3283
3267
|
throw new P("JWS Payload must be a string");
|
|
3284
3268
|
} else if (typeof t.payload != "string" && !(t.payload instanceof Uint8Array))
|
|
3285
3269
|
throw new P("JWS Payload must be a string or an Uint8Array instance");
|
|
3286
3270
|
let l = !1;
|
|
3287
|
-
typeof e == "function" && (e = await e(a, t), l = !0),
|
|
3271
|
+
typeof e == "function" && (e = await e(a, t), l = !0), Me(c, e, "verify");
|
|
3288
3272
|
const f = Q(K.encode((n = t.protected) !== null && n !== void 0 ? n : ""), K.encode("."), typeof t.payload == "string" ? K.encode(t.payload) : t.payload);
|
|
3289
3273
|
let d;
|
|
3290
3274
|
try {
|
|
@@ -3292,8 +3276,8 @@ async function vt(t, e, r) {
|
|
|
3292
3276
|
} catch {
|
|
3293
3277
|
throw new P("Failed to base64url decode the signature");
|
|
3294
3278
|
}
|
|
3295
|
-
if (!await
|
|
3296
|
-
throw new
|
|
3279
|
+
if (!await ca(c, e, d, f))
|
|
3280
|
+
throw new yt();
|
|
3297
3281
|
let h;
|
|
3298
3282
|
if (o)
|
|
3299
3283
|
try {
|
|
@@ -3306,23 +3290,23 @@ async function vt(t, e, r) {
|
|
|
3306
3290
|
const g = { payload: h };
|
|
3307
3291
|
return t.protected !== void 0 && (g.protectedHeader = a), t.header !== void 0 && (g.unprotectedHeader = t.header), l ? { ...g, key: e } : g;
|
|
3308
3292
|
}
|
|
3309
|
-
async function
|
|
3293
|
+
async function Ir(t, e, r) {
|
|
3310
3294
|
if (t instanceof Uint8Array && (t = X.decode(t)), typeof t != "string")
|
|
3311
3295
|
throw new P("Compact JWS must be a string or Uint8Array");
|
|
3312
3296
|
const { 0: n, 1: a, 2: s, length: i } = t.split(".");
|
|
3313
3297
|
if (i !== 3)
|
|
3314
3298
|
throw new P("Invalid Compact JWS");
|
|
3315
|
-
const o = await
|
|
3299
|
+
const o = await bt({ payload: a, protected: n, signature: s }, e, r), c = { payload: o.payload, protectedHeader: o.protectedHeader };
|
|
3316
3300
|
return typeof e == "function" ? { ...c, key: o.key } : c;
|
|
3317
3301
|
}
|
|
3318
|
-
async function
|
|
3302
|
+
async function ua(t, e, r) {
|
|
3319
3303
|
if (!I(t))
|
|
3320
3304
|
throw new P("General JWS must be an object");
|
|
3321
3305
|
if (!Array.isArray(t.signatures) || !t.signatures.every(I))
|
|
3322
3306
|
throw new P("JWS Signatures missing or incorrect type");
|
|
3323
3307
|
for (const n of t.signatures)
|
|
3324
3308
|
try {
|
|
3325
|
-
return await
|
|
3309
|
+
return await bt({
|
|
3326
3310
|
header: n.header,
|
|
3327
3311
|
payload: t.payload,
|
|
3328
3312
|
protected: n.protected,
|
|
@@ -3330,10 +3314,10 @@ async function ha(t, e, r) {
|
|
|
3330
3314
|
}, e, r);
|
|
3331
3315
|
} catch {
|
|
3332
3316
|
}
|
|
3333
|
-
throw new
|
|
3317
|
+
throw new yt();
|
|
3334
3318
|
}
|
|
3335
|
-
const
|
|
3336
|
-
const e =
|
|
3319
|
+
const Ae = (t) => Math.floor(t.getTime() / 1e3), Wr = 60, Ur = Wr * 60, vt = Ur * 24, la = vt * 7, da = vt * 365.25, fa = /^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)$/i, We = (t) => {
|
|
3320
|
+
const e = fa.exec(t);
|
|
3337
3321
|
if (!e)
|
|
3338
3322
|
throw new TypeError("Invalid time period format");
|
|
3339
3323
|
const r = parseFloat(e[1]);
|
|
@@ -3349,27 +3333,27 @@ const xe = (t) => Math.floor(t.getTime() / 1e3), Lr = 60, Dr = Lr * 60, Et = Dr
|
|
|
3349
3333
|
case "min":
|
|
3350
3334
|
case "mins":
|
|
3351
3335
|
case "m":
|
|
3352
|
-
return Math.round(r *
|
|
3336
|
+
return Math.round(r * Wr);
|
|
3353
3337
|
case "hour":
|
|
3354
3338
|
case "hours":
|
|
3355
3339
|
case "hr":
|
|
3356
3340
|
case "hrs":
|
|
3357
3341
|
case "h":
|
|
3358
|
-
return Math.round(r *
|
|
3342
|
+
return Math.round(r * Ur);
|
|
3359
3343
|
case "day":
|
|
3360
3344
|
case "days":
|
|
3361
3345
|
case "d":
|
|
3362
|
-
return Math.round(r *
|
|
3346
|
+
return Math.round(r * vt);
|
|
3363
3347
|
case "week":
|
|
3364
3348
|
case "weeks":
|
|
3365
3349
|
case "w":
|
|
3366
|
-
return Math.round(r *
|
|
3350
|
+
return Math.round(r * la);
|
|
3367
3351
|
default:
|
|
3368
|
-
return Math.round(r *
|
|
3352
|
+
return Math.round(r * da);
|
|
3369
3353
|
}
|
|
3370
|
-
},
|
|
3354
|
+
}, Mt = (t) => t.toLowerCase().replace(/^application\//, ""), ha = (t, e) => typeof t == "string" ? e.includes(t) : Array.isArray(t) ? e.some(Set.prototype.has.bind(new Set(t))) : !1, Et = (t, e, r = {}) => {
|
|
3371
3355
|
const { typ: n } = r;
|
|
3372
|
-
if (n && (typeof t.typ != "string" ||
|
|
3356
|
+
if (n && (typeof t.typ != "string" || Mt(t.typ) !== Mt(n)))
|
|
3373
3357
|
throw new V('unexpected "typ" JWT header value', "typ", "check_failed");
|
|
3374
3358
|
let a;
|
|
3375
3359
|
try {
|
|
@@ -3387,12 +3371,12 @@ const xe = (t) => Math.floor(t.getTime() / 1e3), Lr = 60, Dr = Lr * 60, Et = Dr
|
|
|
3387
3371
|
throw new V('unexpected "iss" claim value', "iss", "check_failed");
|
|
3388
3372
|
if (o && a.sub !== o)
|
|
3389
3373
|
throw new V('unexpected "sub" claim value', "sub", "check_failed");
|
|
3390
|
-
if (c && !
|
|
3374
|
+
if (c && !ha(a.aud, typeof c == "string" ? [c] : c))
|
|
3391
3375
|
throw new V('unexpected "aud" claim value', "aud", "check_failed");
|
|
3392
3376
|
let l;
|
|
3393
3377
|
switch (typeof r.clockTolerance) {
|
|
3394
3378
|
case "string":
|
|
3395
|
-
l =
|
|
3379
|
+
l = We(r.clockTolerance);
|
|
3396
3380
|
break;
|
|
3397
3381
|
case "number":
|
|
3398
3382
|
l = r.clockTolerance;
|
|
@@ -3403,7 +3387,7 @@ const xe = (t) => Math.floor(t.getTime() / 1e3), Lr = 60, Dr = Lr * 60, Et = Dr
|
|
|
3403
3387
|
default:
|
|
3404
3388
|
throw new TypeError("Invalid clockTolerance option type");
|
|
3405
3389
|
}
|
|
3406
|
-
const { currentDate: f } = r, d =
|
|
3390
|
+
const { currentDate: f } = r, d = Ae(f || /* @__PURE__ */ new Date());
|
|
3407
3391
|
if ((a.iat !== void 0 || u) && typeof a.iat != "number")
|
|
3408
3392
|
throw new V('"iat" claim must be a number', "iat", "invalid");
|
|
3409
3393
|
if (a.nbf !== void 0) {
|
|
@@ -3416,27 +3400,27 @@ const xe = (t) => Math.floor(t.getTime() / 1e3), Lr = 60, Dr = Lr * 60, Et = Dr
|
|
|
3416
3400
|
if (typeof a.exp != "number")
|
|
3417
3401
|
throw new V('"exp" claim must be a number', "exp", "invalid");
|
|
3418
3402
|
if (a.exp <= d - l)
|
|
3419
|
-
throw new
|
|
3403
|
+
throw new ot('"exp" claim timestamp check failed', "exp", "check_failed");
|
|
3420
3404
|
}
|
|
3421
3405
|
if (u) {
|
|
3422
|
-
const p = d - a.iat, h = typeof u == "number" ? u :
|
|
3406
|
+
const p = d - a.iat, h = typeof u == "number" ? u : We(u);
|
|
3423
3407
|
if (p - l > h)
|
|
3424
|
-
throw new
|
|
3408
|
+
throw new ot('"iat" claim timestamp check failed (too far in the past)', "iat", "check_failed");
|
|
3425
3409
|
if (p < 0 - l)
|
|
3426
3410
|
throw new V('"iat" claim timestamp check failed (it should be in the past)', "iat", "check_failed");
|
|
3427
3411
|
}
|
|
3428
3412
|
return a;
|
|
3429
3413
|
};
|
|
3430
|
-
async function
|
|
3414
|
+
async function pa(t, e, r) {
|
|
3431
3415
|
var n;
|
|
3432
|
-
const a = await
|
|
3416
|
+
const a = await Ir(t, e, r);
|
|
3433
3417
|
if (!((n = a.protectedHeader.crit) === null || n === void 0) && n.includes("b64") && a.protectedHeader.b64 === !1)
|
|
3434
3418
|
throw new B("JWTs MUST NOT use unencoded payload");
|
|
3435
|
-
const i = { payload:
|
|
3419
|
+
const i = { payload: Et(a.protectedHeader, a.payload, r), protectedHeader: a.protectedHeader };
|
|
3436
3420
|
return typeof e == "function" ? { ...i, key: a.key } : i;
|
|
3437
3421
|
}
|
|
3438
|
-
async function
|
|
3439
|
-
const n = await
|
|
3422
|
+
async function ga(t, e, r) {
|
|
3423
|
+
const n = await Pr(t, e, r), a = Et(n.protectedHeader, n.plaintext, r), { protectedHeader: s } = n;
|
|
3440
3424
|
if (s.iss !== void 0 && s.iss !== a.iss)
|
|
3441
3425
|
throw new V('replicated "iss" claim header parameter mismatch', "iss", "mismatch");
|
|
3442
3426
|
if (s.sub !== void 0 && s.sub !== a.sub)
|
|
@@ -3446,9 +3430,9 @@ async function Sa(t, e, r) {
|
|
|
3446
3430
|
const i = { payload: a, protectedHeader: s };
|
|
3447
3431
|
return typeof e == "function" ? { ...i, key: n.key } : i;
|
|
3448
3432
|
}
|
|
3449
|
-
class
|
|
3433
|
+
class Lr {
|
|
3450
3434
|
constructor(e) {
|
|
3451
|
-
this._flattened = new
|
|
3435
|
+
this._flattened = new Ie(e);
|
|
3452
3436
|
}
|
|
3453
3437
|
setContentEncryptionKey(e) {
|
|
3454
3438
|
return this._flattened.setContentEncryptionKey(e), this;
|
|
@@ -3467,13 +3451,13 @@ class Jr {
|
|
|
3467
3451
|
return [n.protected, n.encrypted_key, n.iv, n.ciphertext, n.tag].join(".");
|
|
3468
3452
|
}
|
|
3469
3453
|
}
|
|
3470
|
-
const
|
|
3471
|
-
const n = await
|
|
3472
|
-
|
|
3473
|
-
const a = await b.subtle.sign(
|
|
3454
|
+
const ma = async (t, e, r) => {
|
|
3455
|
+
const n = await Tr(t, e, "sign");
|
|
3456
|
+
Ne(t, n);
|
|
3457
|
+
const a = await b.subtle.sign(Or(t, n.algorithm), n, r);
|
|
3474
3458
|
return new Uint8Array(a);
|
|
3475
3459
|
};
|
|
3476
|
-
class
|
|
3460
|
+
class At {
|
|
3477
3461
|
constructor(e) {
|
|
3478
3462
|
if (!(e instanceof Uint8Array))
|
|
3479
3463
|
throw new TypeError("payload must be an instance of Uint8Array");
|
|
@@ -3492,33 +3476,33 @@ class xt {
|
|
|
3492
3476
|
async sign(e, r) {
|
|
3493
3477
|
if (!this._protectedHeader && !this._unprotectedHeader)
|
|
3494
3478
|
throw new P("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");
|
|
3495
|
-
if (!
|
|
3479
|
+
if (!me(this._protectedHeader, this._unprotectedHeader))
|
|
3496
3480
|
throw new P("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");
|
|
3497
3481
|
const n = {
|
|
3498
3482
|
...this._protectedHeader,
|
|
3499
3483
|
...this._unprotectedHeader
|
|
3500
|
-
}, a =
|
|
3484
|
+
}, a = ye(P, /* @__PURE__ */ new Map([["b64", !0]]), r == null ? void 0 : r.crit, this._protectedHeader, n);
|
|
3501
3485
|
let s = !0;
|
|
3502
3486
|
if (a.has("b64") && (s = this._protectedHeader.b64, typeof s != "boolean"))
|
|
3503
3487
|
throw new P('The "b64" (base64url-encode payload) Header Parameter must be a boolean');
|
|
3504
3488
|
const { alg: i } = n;
|
|
3505
3489
|
if (typeof i != "string" || !i)
|
|
3506
3490
|
throw new P('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
3507
|
-
|
|
3491
|
+
Me(i, e, "sign");
|
|
3508
3492
|
let o = this._payload;
|
|
3509
3493
|
s && (o = K.encode(O(o)));
|
|
3510
3494
|
let c;
|
|
3511
3495
|
this._protectedHeader ? c = K.encode(O(JSON.stringify(this._protectedHeader))) : c = K.encode("");
|
|
3512
|
-
const u = Q(c, K.encode("."), o), l = await
|
|
3496
|
+
const u = Q(c, K.encode("."), o), l = await ma(i, e, u), f = {
|
|
3513
3497
|
signature: O(l),
|
|
3514
3498
|
payload: ""
|
|
3515
3499
|
};
|
|
3516
3500
|
return s && (f.payload = X.decode(o)), this._unprotectedHeader && (f.header = this._unprotectedHeader), this._protectedHeader && (f.protected = X.decode(c)), f;
|
|
3517
3501
|
}
|
|
3518
3502
|
}
|
|
3519
|
-
class
|
|
3503
|
+
class Dr {
|
|
3520
3504
|
constructor(e) {
|
|
3521
|
-
this._flattened = new
|
|
3505
|
+
this._flattened = new At(e);
|
|
3522
3506
|
}
|
|
3523
3507
|
setProtectedHeader(e) {
|
|
3524
3508
|
return this._flattened.setProtectedHeader(e), this;
|
|
@@ -3530,7 +3514,7 @@ class Nr {
|
|
|
3530
3514
|
return `${n.protected}.${n.payload}.${n.signature}`;
|
|
3531
3515
|
}
|
|
3532
3516
|
}
|
|
3533
|
-
class
|
|
3517
|
+
class ya {
|
|
3534
3518
|
constructor(e, r, n) {
|
|
3535
3519
|
this.parent = e, this.key = r, this.options = n;
|
|
3536
3520
|
}
|
|
@@ -3554,12 +3538,12 @@ class va {
|
|
|
3554
3538
|
return this.parent;
|
|
3555
3539
|
}
|
|
3556
3540
|
}
|
|
3557
|
-
class
|
|
3541
|
+
class wa {
|
|
3558
3542
|
constructor(e) {
|
|
3559
3543
|
this._signatures = [], this._payload = e;
|
|
3560
3544
|
}
|
|
3561
3545
|
addSignature(e, r) {
|
|
3562
|
-
const n = new
|
|
3546
|
+
const n = new ya(this, e, r);
|
|
3563
3547
|
return this._signatures.push(n), n;
|
|
3564
3548
|
}
|
|
3565
3549
|
async sign() {
|
|
@@ -3570,7 +3554,7 @@ class Ea {
|
|
|
3570
3554
|
payload: ""
|
|
3571
3555
|
};
|
|
3572
3556
|
for (let r = 0; r < this._signatures.length; r++) {
|
|
3573
|
-
const n = this._signatures[r], a = new
|
|
3557
|
+
const n = this._signatures[r], a = new At(this._payload);
|
|
3574
3558
|
a.setProtectedHeader(n.protectedHeader), a.setUnprotectedHeader(n.unprotectedHeader);
|
|
3575
3559
|
const { payload: s, ...i } = await a.sign(n.key, n.options);
|
|
3576
3560
|
if (r === 0)
|
|
@@ -3582,7 +3566,7 @@ class Ea {
|
|
|
3582
3566
|
return e;
|
|
3583
3567
|
}
|
|
3584
3568
|
}
|
|
3585
|
-
class
|
|
3569
|
+
class xt {
|
|
3586
3570
|
constructor(e) {
|
|
3587
3571
|
if (!I(e))
|
|
3588
3572
|
throw new TypeError("JWT Claims Set MUST be an object");
|
|
@@ -3601,28 +3585,28 @@ class Ct {
|
|
|
3601
3585
|
return this._payload = { ...this._payload, jti: e }, this;
|
|
3602
3586
|
}
|
|
3603
3587
|
setNotBefore(e) {
|
|
3604
|
-
return typeof e == "number" ? this._payload = { ...this._payload, nbf: e } : this._payload = { ...this._payload, nbf:
|
|
3588
|
+
return typeof e == "number" ? this._payload = { ...this._payload, nbf: e } : this._payload = { ...this._payload, nbf: Ae(/* @__PURE__ */ new Date()) + We(e) }, this;
|
|
3605
3589
|
}
|
|
3606
3590
|
setExpirationTime(e) {
|
|
3607
|
-
return typeof e == "number" ? this._payload = { ...this._payload, exp: e } : this._payload = { ...this._payload, exp:
|
|
3591
|
+
return typeof e == "number" ? this._payload = { ...this._payload, exp: e } : this._payload = { ...this._payload, exp: Ae(/* @__PURE__ */ new Date()) + We(e) }, this;
|
|
3608
3592
|
}
|
|
3609
3593
|
setIssuedAt(e) {
|
|
3610
|
-
return typeof e > "u" ? this._payload = { ...this._payload, iat:
|
|
3594
|
+
return typeof e > "u" ? this._payload = { ...this._payload, iat: Ae(/* @__PURE__ */ new Date()) } : this._payload = { ...this._payload, iat: e }, this;
|
|
3611
3595
|
}
|
|
3612
3596
|
}
|
|
3613
|
-
class
|
|
3597
|
+
class Sa extends xt {
|
|
3614
3598
|
setProtectedHeader(e) {
|
|
3615
3599
|
return this._protectedHeader = e, this;
|
|
3616
3600
|
}
|
|
3617
3601
|
async sign(e, r) {
|
|
3618
3602
|
var n;
|
|
3619
|
-
const a = new
|
|
3603
|
+
const a = new Dr(K.encode(JSON.stringify(this._payload)));
|
|
3620
3604
|
if (a.setProtectedHeader(this._protectedHeader), Array.isArray((n = this._protectedHeader) === null || n === void 0 ? void 0 : n.crit) && this._protectedHeader.crit.includes("b64") && this._protectedHeader.b64 === !1)
|
|
3621
3605
|
throw new B("JWTs MUST NOT use unencoded payload");
|
|
3622
3606
|
return a.sign(e, r);
|
|
3623
3607
|
}
|
|
3624
3608
|
}
|
|
3625
|
-
class
|
|
3609
|
+
class ba extends xt {
|
|
3626
3610
|
setProtectedHeader(e) {
|
|
3627
3611
|
if (this._protectedHeader)
|
|
3628
3612
|
throw new TypeError("setProtectedHeader can only be called once");
|
|
@@ -3653,15 +3637,15 @@ class xa extends Ct {
|
|
|
3653
3637
|
return this._replicateAudienceAsHeader = !0, this;
|
|
3654
3638
|
}
|
|
3655
3639
|
async encrypt(e, r) {
|
|
3656
|
-
const n = new
|
|
3640
|
+
const n = new Lr(K.encode(JSON.stringify(this._payload)));
|
|
3657
3641
|
return this._replicateIssuerAsHeader && (this._protectedHeader = { ...this._protectedHeader, iss: this._payload.iss }), this._replicateSubjectAsHeader && (this._protectedHeader = { ...this._protectedHeader, sub: this._payload.sub }), this._replicateAudienceAsHeader && (this._protectedHeader = { ...this._protectedHeader, aud: this._payload.aud }), n.setProtectedHeader(this._protectedHeader), this._iv && n.setInitializationVector(this._iv), this._cek && n.setContentEncryptionKey(this._cek), this._keyManagementParameters && n.setKeyManagementParameters(this._keyManagementParameters), n.encrypt(e, r);
|
|
3658
3642
|
}
|
|
3659
3643
|
}
|
|
3660
|
-
const
|
|
3644
|
+
const ee = (t, e) => {
|
|
3661
3645
|
if (typeof t != "string" || !t)
|
|
3662
|
-
throw new
|
|
3646
|
+
throw new ir(`${e} missing or invalid`);
|
|
3663
3647
|
};
|
|
3664
|
-
async function
|
|
3648
|
+
async function Jr(t, e) {
|
|
3665
3649
|
if (!I(t))
|
|
3666
3650
|
throw new TypeError("JWK must be an object");
|
|
3667
3651
|
if (e ?? (e = "sha256"), e !== "sha256" && e !== "sha384" && e !== "sha512")
|
|
@@ -3669,41 +3653,41 @@ async function $r(t, e) {
|
|
|
3669
3653
|
let r;
|
|
3670
3654
|
switch (t.kty) {
|
|
3671
3655
|
case "EC":
|
|
3672
|
-
|
|
3656
|
+
ee(t.crv, '"crv" (Curve) Parameter'), ee(t.x, '"x" (X Coordinate) Parameter'), ee(t.y, '"y" (Y Coordinate) Parameter'), r = { crv: t.crv, kty: t.kty, x: t.x, y: t.y };
|
|
3673
3657
|
break;
|
|
3674
3658
|
case "OKP":
|
|
3675
|
-
|
|
3659
|
+
ee(t.crv, '"crv" (Subtype of Key Pair) Parameter'), ee(t.x, '"x" (Public Key) Parameter'), r = { crv: t.crv, kty: t.kty, x: t.x };
|
|
3676
3660
|
break;
|
|
3677
3661
|
case "RSA":
|
|
3678
|
-
|
|
3662
|
+
ee(t.e, '"e" (Exponent) Parameter'), ee(t.n, '"n" (Modulus) Parameter'), r = { e: t.e, kty: t.kty, n: t.n };
|
|
3679
3663
|
break;
|
|
3680
3664
|
case "oct":
|
|
3681
|
-
|
|
3665
|
+
ee(t.k, '"k" (Key Value) Parameter'), r = { k: t.k, kty: t.kty };
|
|
3682
3666
|
break;
|
|
3683
3667
|
default:
|
|
3684
3668
|
throw new x('"kty" (Key Type) Parameter missing or unsupported');
|
|
3685
3669
|
}
|
|
3686
3670
|
const n = K.encode(JSON.stringify(r));
|
|
3687
|
-
return O(await
|
|
3671
|
+
return O(await nr(e, n));
|
|
3688
3672
|
}
|
|
3689
|
-
async function
|
|
3673
|
+
async function va(t, e) {
|
|
3690
3674
|
e ?? (e = "sha256");
|
|
3691
|
-
const r = await
|
|
3675
|
+
const r = await Jr(t, e);
|
|
3692
3676
|
return `urn:ietf:params:oauth:jwk-thumbprint:sha-${e.slice(-3)}:${r}`;
|
|
3693
3677
|
}
|
|
3694
|
-
async function
|
|
3678
|
+
async function Ea(t, e) {
|
|
3695
3679
|
const r = {
|
|
3696
3680
|
...t,
|
|
3697
3681
|
...e == null ? void 0 : e.header
|
|
3698
3682
|
};
|
|
3699
3683
|
if (!I(r.jwk))
|
|
3700
3684
|
throw new P('"jwk" (JSON Web Key) Header Parameter must be a JSON object');
|
|
3701
|
-
const n = await
|
|
3685
|
+
const n = await $e({ ...r.jwk, ext: !0 }, r.alg, !0);
|
|
3702
3686
|
if (n instanceof Uint8Array || n.type !== "public")
|
|
3703
3687
|
throw new P('"jwk" (JSON Web Key) Header Parameter must be a public key');
|
|
3704
3688
|
return n;
|
|
3705
3689
|
}
|
|
3706
|
-
function
|
|
3690
|
+
function Aa(t) {
|
|
3707
3691
|
switch (typeof t == "string" && t.slice(0, 2)) {
|
|
3708
3692
|
case "RS":
|
|
3709
3693
|
case "PS":
|
|
@@ -3716,23 +3700,23 @@ function Pa(t) {
|
|
|
3716
3700
|
throw new x('Unsupported "alg" value for a JSON Web Key Set');
|
|
3717
3701
|
}
|
|
3718
3702
|
}
|
|
3719
|
-
function
|
|
3720
|
-
return t && typeof t == "object" && Array.isArray(t.keys) && t.keys.every(
|
|
3703
|
+
function Nr(t) {
|
|
3704
|
+
return t && typeof t == "object" && Array.isArray(t.keys) && t.keys.every(xa);
|
|
3721
3705
|
}
|
|
3722
|
-
function
|
|
3706
|
+
function xa(t) {
|
|
3723
3707
|
return I(t);
|
|
3724
3708
|
}
|
|
3725
|
-
function
|
|
3709
|
+
function Ca(t) {
|
|
3726
3710
|
return typeof structuredClone == "function" ? structuredClone(t) : JSON.parse(JSON.stringify(t));
|
|
3727
3711
|
}
|
|
3728
|
-
class
|
|
3712
|
+
class $r {
|
|
3729
3713
|
constructor(e) {
|
|
3730
|
-
if (this._cached = /* @__PURE__ */ new WeakMap(), !
|
|
3731
|
-
throw new
|
|
3732
|
-
this._jwks =
|
|
3714
|
+
if (this._cached = /* @__PURE__ */ new WeakMap(), !Nr(e))
|
|
3715
|
+
throw new Le("JSON Web Key Set malformed");
|
|
3716
|
+
this._jwks = Ca(e);
|
|
3733
3717
|
}
|
|
3734
3718
|
async getKey(e, r) {
|
|
3735
|
-
const { alg: n, kid: a } = { ...e, ...r == null ? void 0 : r.header }, s =
|
|
3719
|
+
const { alg: n, kid: a } = { ...e, ...r == null ? void 0 : r.header }, s = Aa(n), i = this._jwks.keys.filter((u) => {
|
|
3736
3720
|
let l = s === u.kty;
|
|
3737
3721
|
if (l && typeof a == "string" && (l = a === u.kid), l && typeof u.alg == "string" && (l = n === u.alg), l && typeof u.use == "string" && (l = u.use === "sig"), l && Array.isArray(u.key_ops) && (l = u.key_ops.includes("verify")), l && n === "EdDSA" && (l = u.crv === "Ed25519" || u.crv === "Ed448"), l)
|
|
3738
3722
|
switch (n) {
|
|
@@ -3752,38 +3736,38 @@ class kr {
|
|
|
3752
3736
|
return l;
|
|
3753
3737
|
}), { 0: o, length: c } = i;
|
|
3754
3738
|
if (c === 0)
|
|
3755
|
-
throw new
|
|
3739
|
+
throw new mt();
|
|
3756
3740
|
if (c !== 1) {
|
|
3757
|
-
const u = new
|
|
3741
|
+
const u = new or(), { _cached: l } = this;
|
|
3758
3742
|
throw u[Symbol.asyncIterator] = async function* () {
|
|
3759
3743
|
for (const f of i)
|
|
3760
3744
|
try {
|
|
3761
|
-
yield await
|
|
3745
|
+
yield await kt(l, f, n);
|
|
3762
3746
|
} catch {
|
|
3763
3747
|
continue;
|
|
3764
3748
|
}
|
|
3765
3749
|
}, u;
|
|
3766
3750
|
}
|
|
3767
|
-
return
|
|
3751
|
+
return kt(this._cached, o, n);
|
|
3768
3752
|
}
|
|
3769
3753
|
}
|
|
3770
|
-
async function
|
|
3754
|
+
async function kt(t, e, r) {
|
|
3771
3755
|
const n = t.get(e) || t.set(e, {}).get(e);
|
|
3772
3756
|
if (n[r] === void 0) {
|
|
3773
|
-
const a = await
|
|
3757
|
+
const a = await $e({ ...e, ext: !0 }, r);
|
|
3774
3758
|
if (a instanceof Uint8Array || a.type !== "public")
|
|
3775
|
-
throw new
|
|
3759
|
+
throw new Le("JSON Web Key Set members must be public keys");
|
|
3776
3760
|
n[r] = a;
|
|
3777
3761
|
}
|
|
3778
3762
|
return n[r];
|
|
3779
3763
|
}
|
|
3780
|
-
function
|
|
3781
|
-
const e = new
|
|
3764
|
+
function _a(t) {
|
|
3765
|
+
const e = new $r(t);
|
|
3782
3766
|
return async function(r, n) {
|
|
3783
3767
|
return e.getKey(r, n);
|
|
3784
3768
|
};
|
|
3785
3769
|
}
|
|
3786
|
-
const
|
|
3770
|
+
const Pa = async (t, e, r) => {
|
|
3787
3771
|
let n, a, s = !1;
|
|
3788
3772
|
typeof AbortController == "function" && (n = new AbortController(), a = setTimeout(() => {
|
|
3789
3773
|
s = !0, n.abort();
|
|
@@ -3793,7 +3777,7 @@ const Oa = async (t, e, r) => {
|
|
|
3793
3777
|
redirect: "manual",
|
|
3794
3778
|
headers: r.headers
|
|
3795
3779
|
}).catch((o) => {
|
|
3796
|
-
throw s ? new
|
|
3780
|
+
throw s ? new cr() : o;
|
|
3797
3781
|
});
|
|
3798
3782
|
if (a !== void 0 && clearTimeout(a), i.status !== 200)
|
|
3799
3783
|
throw new L("Expected 200 OK from the JSON Web Key Set HTTP response");
|
|
@@ -3803,10 +3787,10 @@ const Oa = async (t, e, r) => {
|
|
|
3803
3787
|
throw new L("Failed to parse the JSON Web Key Set HTTP response as JSON");
|
|
3804
3788
|
}
|
|
3805
3789
|
};
|
|
3806
|
-
function
|
|
3790
|
+
function Ha() {
|
|
3807
3791
|
return typeof WebSocketPair < "u" || typeof navigator < "u" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime < "u" && EdgeRuntime === "vercel";
|
|
3808
3792
|
}
|
|
3809
|
-
class
|
|
3793
|
+
class Ka extends $r {
|
|
3810
3794
|
constructor(e, r) {
|
|
3811
3795
|
if (super({ keys: [] }), this._jwks = void 0, !(e instanceof URL))
|
|
3812
3796
|
throw new TypeError("url must be an instance of URL");
|
|
@@ -3823,28 +3807,28 @@ class Ia extends kr {
|
|
|
3823
3807
|
try {
|
|
3824
3808
|
return await super.getKey(e, r);
|
|
3825
3809
|
} catch (n) {
|
|
3826
|
-
if (n instanceof
|
|
3810
|
+
if (n instanceof mt && this.coolingDown() === !1)
|
|
3827
3811
|
return await this.reload(), super.getKey(e, r);
|
|
3828
3812
|
throw n;
|
|
3829
3813
|
}
|
|
3830
3814
|
}
|
|
3831
3815
|
async reload() {
|
|
3832
|
-
this._pendingFetch &&
|
|
3833
|
-
if (!
|
|
3834
|
-
throw new
|
|
3816
|
+
this._pendingFetch && Ha() && (this._pendingFetch = void 0), this._pendingFetch || (this._pendingFetch = Pa(this._url, this._timeoutDuration, this._options).then((e) => {
|
|
3817
|
+
if (!Nr(e))
|
|
3818
|
+
throw new Le("JSON Web Key Set malformed");
|
|
3835
3819
|
this._jwks = { keys: e.keys }, this._jwksTimestamp = Date.now(), this._pendingFetch = void 0;
|
|
3836
3820
|
}).catch((e) => {
|
|
3837
3821
|
throw this._pendingFetch = void 0, e;
|
|
3838
3822
|
})), await this._pendingFetch;
|
|
3839
3823
|
}
|
|
3840
3824
|
}
|
|
3841
|
-
function
|
|
3842
|
-
const r = new
|
|
3825
|
+
function Ra(t, e) {
|
|
3826
|
+
const r = new Ka(t, e);
|
|
3843
3827
|
return async function(n, a) {
|
|
3844
3828
|
return r.getKey(n, a);
|
|
3845
3829
|
};
|
|
3846
3830
|
}
|
|
3847
|
-
class
|
|
3831
|
+
class Oa extends xt {
|
|
3848
3832
|
encode() {
|
|
3849
3833
|
const e = O(JSON.stringify({ alg: "none" })), r = O(JSON.stringify(this._payload));
|
|
3850
3834
|
return `${e}.${r}.`;
|
|
@@ -3862,15 +3846,15 @@ class Ua extends Ct {
|
|
|
3862
3846
|
} catch {
|
|
3863
3847
|
throw new B("Invalid Unsecured JWT");
|
|
3864
3848
|
}
|
|
3865
|
-
return { payload:
|
|
3849
|
+
return { payload: Et(o, T(a), r), header: o };
|
|
3866
3850
|
}
|
|
3867
3851
|
}
|
|
3868
|
-
const
|
|
3852
|
+
const Ta = O, Ct = T, Ia = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
3869
3853
|
__proto__: null,
|
|
3870
|
-
decode:
|
|
3871
|
-
encode:
|
|
3854
|
+
decode: Ct,
|
|
3855
|
+
encode: Ta
|
|
3872
3856
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
3873
|
-
function
|
|
3857
|
+
function Wa(t) {
|
|
3874
3858
|
let e;
|
|
3875
3859
|
if (typeof t == "string") {
|
|
3876
3860
|
const r = t.split(".");
|
|
@@ -3883,7 +3867,7 @@ function Ja(t) {
|
|
|
3883
3867
|
try {
|
|
3884
3868
|
if (typeof e != "string" || !e)
|
|
3885
3869
|
throw new Error();
|
|
3886
|
-
const r = JSON.parse(X.decode(
|
|
3870
|
+
const r = JSON.parse(X.decode(Ct(e)));
|
|
3887
3871
|
if (!I(r))
|
|
3888
3872
|
throw new Error();
|
|
3889
3873
|
return r;
|
|
@@ -3891,7 +3875,7 @@ function Ja(t) {
|
|
|
3891
3875
|
throw new TypeError("Invalid Token or Protected Header formatting");
|
|
3892
3876
|
}
|
|
3893
3877
|
}
|
|
3894
|
-
function
|
|
3878
|
+
function Ua(t) {
|
|
3895
3879
|
if (typeof t != "string")
|
|
3896
3880
|
throw new B("JWTs must use Compact JWS serialization, JWT must be a string");
|
|
3897
3881
|
const { 1: e, length: r } = t.split(".");
|
|
@@ -3903,7 +3887,7 @@ function Na(t) {
|
|
|
3903
3887
|
throw new B("JWTs must contain a payload");
|
|
3904
3888
|
let n;
|
|
3905
3889
|
try {
|
|
3906
|
-
n =
|
|
3890
|
+
n = Ct(e);
|
|
3907
3891
|
} catch {
|
|
3908
3892
|
throw new B("Failed to base64url decode the payload");
|
|
3909
3893
|
}
|
|
@@ -3917,7 +3901,7 @@ function Na(t) {
|
|
|
3917
3901
|
throw new B("Invalid JWT Claims Set");
|
|
3918
3902
|
return a;
|
|
3919
3903
|
}
|
|
3920
|
-
async function
|
|
3904
|
+
async function La(t, e) {
|
|
3921
3905
|
var r;
|
|
3922
3906
|
let n, a, s;
|
|
3923
3907
|
switch (t) {
|
|
@@ -3929,7 +3913,7 @@ async function $a(t, e) {
|
|
|
3929
3913
|
case "A128CBC-HS256":
|
|
3930
3914
|
case "A192CBC-HS384":
|
|
3931
3915
|
case "A256CBC-HS512":
|
|
3932
|
-
return n = parseInt(t.slice(-3), 10),
|
|
3916
|
+
return n = parseInt(t.slice(-3), 10), De(new Uint8Array(n >> 3));
|
|
3933
3917
|
case "A128KW":
|
|
3934
3918
|
case "A192KW":
|
|
3935
3919
|
case "A256KW":
|
|
@@ -3948,14 +3932,14 @@ async function $a(t, e) {
|
|
|
3948
3932
|
}
|
|
3949
3933
|
return b.subtle.generateKey(a, (r = e == null ? void 0 : e.extractable) !== null && r !== void 0 ? r : !1, s);
|
|
3950
3934
|
}
|
|
3951
|
-
function
|
|
3935
|
+
function qe(t) {
|
|
3952
3936
|
var e;
|
|
3953
3937
|
const r = (e = t == null ? void 0 : t.modulusLength) !== null && e !== void 0 ? e : 2048;
|
|
3954
3938
|
if (typeof r != "number" || r < 2048)
|
|
3955
3939
|
throw new x("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");
|
|
3956
3940
|
return r;
|
|
3957
3941
|
}
|
|
3958
|
-
async function
|
|
3942
|
+
async function Da(t, e) {
|
|
3959
3943
|
var r, n, a;
|
|
3960
3944
|
let s, i;
|
|
3961
3945
|
switch (t) {
|
|
@@ -3966,7 +3950,7 @@ async function Ma(t, e) {
|
|
|
3966
3950
|
name: "RSA-PSS",
|
|
3967
3951
|
hash: `SHA-${t.slice(-3)}`,
|
|
3968
3952
|
publicExponent: new Uint8Array([1, 0, 1]),
|
|
3969
|
-
modulusLength:
|
|
3953
|
+
modulusLength: qe(e)
|
|
3970
3954
|
}, i = ["sign", "verify"];
|
|
3971
3955
|
break;
|
|
3972
3956
|
case "RS256":
|
|
@@ -3976,7 +3960,7 @@ async function Ma(t, e) {
|
|
|
3976
3960
|
name: "RSASSA-PKCS1-v1_5",
|
|
3977
3961
|
hash: `SHA-${t.slice(-3)}`,
|
|
3978
3962
|
publicExponent: new Uint8Array([1, 0, 1]),
|
|
3979
|
-
modulusLength:
|
|
3963
|
+
modulusLength: qe(e)
|
|
3980
3964
|
}, i = ["sign", "verify"];
|
|
3981
3965
|
break;
|
|
3982
3966
|
case "RSA-OAEP":
|
|
@@ -3987,7 +3971,7 @@ async function Ma(t, e) {
|
|
|
3987
3971
|
name: "RSA-OAEP",
|
|
3988
3972
|
hash: `SHA-${parseInt(t.slice(-3), 10) || 1}`,
|
|
3989
3973
|
publicExponent: new Uint8Array([1, 0, 1]),
|
|
3990
|
-
modulusLength:
|
|
3974
|
+
modulusLength: qe(e)
|
|
3991
3975
|
}, i = ["decrypt", "unwrapKey", "encrypt", "wrapKey"];
|
|
3992
3976
|
break;
|
|
3993
3977
|
case "ES256":
|
|
@@ -4038,51 +4022,51 @@ async function Ma(t, e) {
|
|
|
4038
4022
|
}
|
|
4039
4023
|
return b.subtle.generateKey(s, (a = e == null ? void 0 : e.extractable) !== null && a !== void 0 ? a : !1, i);
|
|
4040
4024
|
}
|
|
4041
|
-
async function
|
|
4042
|
-
return
|
|
4025
|
+
async function Ja(t, e) {
|
|
4026
|
+
return Da(t, e);
|
|
4043
4027
|
}
|
|
4044
|
-
async function
|
|
4045
|
-
return
|
|
4028
|
+
async function Na(t, e) {
|
|
4029
|
+
return La(t, e);
|
|
4046
4030
|
}
|
|
4047
|
-
const
|
|
4031
|
+
const $a = "WebCryptoAPI", Ma = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4048
4032
|
__proto__: null,
|
|
4049
|
-
CompactEncrypt:
|
|
4050
|
-
CompactSign:
|
|
4051
|
-
EmbeddedJWK:
|
|
4052
|
-
EncryptJWT:
|
|
4053
|
-
FlattenedEncrypt:
|
|
4054
|
-
FlattenedSign:
|
|
4055
|
-
GeneralEncrypt:
|
|
4056
|
-
GeneralSign:
|
|
4057
|
-
SignJWT:
|
|
4058
|
-
UnsecuredJWT:
|
|
4059
|
-
base64url:
|
|
4060
|
-
calculateJwkThumbprint:
|
|
4061
|
-
calculateJwkThumbprintUri:
|
|
4062
|
-
compactDecrypt:
|
|
4063
|
-
compactVerify:
|
|
4064
|
-
createLocalJWKSet:
|
|
4065
|
-
createRemoteJWKSet:
|
|
4066
|
-
cryptoRuntime:
|
|
4067
|
-
decodeJwt:
|
|
4068
|
-
decodeProtectedHeader:
|
|
4069
|
-
errors:
|
|
4070
|
-
exportJWK:
|
|
4071
|
-
exportPKCS8:
|
|
4072
|
-
exportSPKI:
|
|
4073
|
-
flattenedDecrypt:
|
|
4074
|
-
flattenedVerify:
|
|
4075
|
-
generalDecrypt:
|
|
4076
|
-
generalVerify:
|
|
4077
|
-
generateKeyPair:
|
|
4078
|
-
generateSecret:
|
|
4079
|
-
importJWK:
|
|
4080
|
-
importPKCS8:
|
|
4081
|
-
importSPKI:
|
|
4082
|
-
importX509:
|
|
4083
|
-
jwtDecrypt:
|
|
4084
|
-
jwtVerify:
|
|
4085
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4033
|
+
CompactEncrypt: Lr,
|
|
4034
|
+
CompactSign: Dr,
|
|
4035
|
+
EmbeddedJWK: Ea,
|
|
4036
|
+
EncryptJWT: ba,
|
|
4037
|
+
FlattenedEncrypt: Ie,
|
|
4038
|
+
FlattenedSign: At,
|
|
4039
|
+
GeneralEncrypt: oa,
|
|
4040
|
+
GeneralSign: wa,
|
|
4041
|
+
SignJWT: Sa,
|
|
4042
|
+
UnsecuredJWT: Oa,
|
|
4043
|
+
base64url: Ia,
|
|
4044
|
+
calculateJwkThumbprint: Jr,
|
|
4045
|
+
calculateJwkThumbprintUri: va,
|
|
4046
|
+
compactDecrypt: Pr,
|
|
4047
|
+
compactVerify: Ir,
|
|
4048
|
+
createLocalJWKSet: _a,
|
|
4049
|
+
createRemoteJWKSet: Ra,
|
|
4050
|
+
cryptoRuntime: $a,
|
|
4051
|
+
decodeJwt: Ua,
|
|
4052
|
+
decodeProtectedHeader: Wa,
|
|
4053
|
+
errors: vn,
|
|
4054
|
+
exportJWK: Hr,
|
|
4055
|
+
exportPKCS8: sa,
|
|
4056
|
+
exportSPKI: aa,
|
|
4057
|
+
flattenedDecrypt: St,
|
|
4058
|
+
flattenedVerify: bt,
|
|
4059
|
+
generalDecrypt: ta,
|
|
4060
|
+
generalVerify: ua,
|
|
4061
|
+
generateKeyPair: Ja,
|
|
4062
|
+
generateSecret: Na,
|
|
4063
|
+
importJWK: $e,
|
|
4064
|
+
importPKCS8: zn,
|
|
4065
|
+
importSPKI: Bn,
|
|
4066
|
+
importX509: Gn,
|
|
4067
|
+
jwtDecrypt: ga,
|
|
4068
|
+
jwtVerify: pa
|
|
4069
|
+
}, Symbol.toStringTag, { value: "Module" })), ka = /* @__PURE__ */ ft(Ma), Fa = () => {
|
|
4086
4070
|
if (typeof globalThis < "u")
|
|
4087
4071
|
return globalThis;
|
|
4088
4072
|
if (typeof self < "u")
|
|
@@ -4090,8 +4074,8 @@ const Va = "WebCryptoAPI", Ba = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Ob
|
|
|
4090
4074
|
if (typeof window < "u")
|
|
4091
4075
|
return window;
|
|
4092
4076
|
throw new Error("unable to locate global object");
|
|
4093
|
-
},
|
|
4094
|
-
const { crypto: { subtle: s } } =
|
|
4077
|
+
}, Va = async (t, e, r, n, a) => {
|
|
4078
|
+
const { crypto: { subtle: s } } = Fa();
|
|
4095
4079
|
return new Uint8Array(await s.deriveBits({
|
|
4096
4080
|
name: "HKDF",
|
|
4097
4081
|
hash: `SHA-${t.substr(3)}`,
|
|
@@ -4099,7 +4083,7 @@ const Va = "WebCryptoAPI", Ba = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Ob
|
|
|
4099
4083
|
info: n
|
|
4100
4084
|
}, await s.importKey("raw", e, "HKDF", !1, ["deriveBits"]), a << 3));
|
|
4101
4085
|
};
|
|
4102
|
-
function
|
|
4086
|
+
function Ba(t) {
|
|
4103
4087
|
switch (t) {
|
|
4104
4088
|
case "sha256":
|
|
4105
4089
|
case "sha384":
|
|
@@ -4110,26 +4094,26 @@ function Xa(t) {
|
|
|
4110
4094
|
throw new TypeError('unsupported "digest" value');
|
|
4111
4095
|
}
|
|
4112
4096
|
}
|
|
4113
|
-
function
|
|
4097
|
+
function _t(t, e) {
|
|
4114
4098
|
if (typeof t == "string")
|
|
4115
4099
|
return new TextEncoder().encode(t);
|
|
4116
4100
|
if (!(t instanceof Uint8Array))
|
|
4117
4101
|
throw new TypeError(`"${e}"" must be an instance of Uint8Array or a string`);
|
|
4118
4102
|
return t;
|
|
4119
4103
|
}
|
|
4120
|
-
function
|
|
4121
|
-
const e =
|
|
4104
|
+
function Ga(t) {
|
|
4105
|
+
const e = _t(t, "ikm");
|
|
4122
4106
|
if (!e.byteLength)
|
|
4123
4107
|
throw new TypeError('"ikm" must be at least one byte in length');
|
|
4124
4108
|
return e;
|
|
4125
4109
|
}
|
|
4126
|
-
function
|
|
4127
|
-
const e =
|
|
4110
|
+
function za(t) {
|
|
4111
|
+
const e = _t(t, "info");
|
|
4128
4112
|
if (e.byteLength > 1024)
|
|
4129
4113
|
throw TypeError('"info" must not contain more than 1024 bytes');
|
|
4130
4114
|
return e;
|
|
4131
4115
|
}
|
|
4132
|
-
function
|
|
4116
|
+
function qa(t, e) {
|
|
4133
4117
|
if (typeof t != "number" || !Number.isInteger(t) || t < 1)
|
|
4134
4118
|
throw new TypeError('"keylen" must be a positive integer');
|
|
4135
4119
|
const r = parseInt(e.substr(3), 10) >> 3 || 20;
|
|
@@ -4137,70 +4121,70 @@ function Qa(t, e) {
|
|
|
4137
4121
|
throw new TypeError('"keylen" too large');
|
|
4138
4122
|
return t;
|
|
4139
4123
|
}
|
|
4140
|
-
async function
|
|
4141
|
-
return
|
|
4124
|
+
async function Ft(t, e, r, n, a) {
|
|
4125
|
+
return Va(Ba(t), Ga(e), _t(r, "salt"), za(n), qa(a, t));
|
|
4142
4126
|
}
|
|
4143
|
-
const
|
|
4127
|
+
const Xa = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4144
4128
|
__proto__: null,
|
|
4145
|
-
default:
|
|
4146
|
-
hkdf:
|
|
4147
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4148
|
-
var
|
|
4149
|
-
function
|
|
4150
|
-
if (!
|
|
4129
|
+
default: Ft,
|
|
4130
|
+
hkdf: Ft
|
|
4131
|
+
}, Symbol.toStringTag, { value: "Module" })), Ya = /* @__PURE__ */ ft(Xa);
|
|
4132
|
+
var ve, Za = new Uint8Array(16);
|
|
4133
|
+
function Mr() {
|
|
4134
|
+
if (!ve && (ve = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto < "u" && typeof msCrypto.getRandomValues == "function" && msCrypto.getRandomValues.bind(msCrypto), !ve))
|
|
4151
4135
|
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
4152
|
-
return
|
|
4136
|
+
return ve(Za);
|
|
4153
4137
|
}
|
|
4154
|
-
const
|
|
4155
|
-
function
|
|
4156
|
-
return typeof t == "string" &&
|
|
4138
|
+
const Qa = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
4139
|
+
function ke(t) {
|
|
4140
|
+
return typeof t == "string" && Qa.test(t);
|
|
4157
4141
|
}
|
|
4158
4142
|
var W = [];
|
|
4159
|
-
for (var
|
|
4160
|
-
W.push((
|
|
4161
|
-
function
|
|
4143
|
+
for (var Xe = 0; Xe < 256; ++Xe)
|
|
4144
|
+
W.push((Xe + 256).toString(16).substr(1));
|
|
4145
|
+
function Fe(t) {
|
|
4162
4146
|
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0, r = (W[t[e + 0]] + W[t[e + 1]] + W[t[e + 2]] + W[t[e + 3]] + "-" + W[t[e + 4]] + W[t[e + 5]] + "-" + W[t[e + 6]] + W[t[e + 7]] + "-" + W[t[e + 8]] + W[t[e + 9]] + "-" + W[t[e + 10]] + W[t[e + 11]] + W[t[e + 12]] + W[t[e + 13]] + W[t[e + 14]] + W[t[e + 15]]).toLowerCase();
|
|
4163
|
-
if (!
|
|
4147
|
+
if (!ke(r))
|
|
4164
4148
|
throw TypeError("Stringified UUID is invalid");
|
|
4165
4149
|
return r;
|
|
4166
4150
|
}
|
|
4167
|
-
var
|
|
4168
|
-
function
|
|
4151
|
+
var Vt, Ye, Ze = 0, Qe = 0;
|
|
4152
|
+
function ja(t, e, r) {
|
|
4169
4153
|
var n = e && r || 0, a = e || new Array(16);
|
|
4170
4154
|
t = t || {};
|
|
4171
|
-
var s = t.node ||
|
|
4155
|
+
var s = t.node || Vt, i = t.clockseq !== void 0 ? t.clockseq : Ye;
|
|
4172
4156
|
if (s == null || i == null) {
|
|
4173
|
-
var o = t.random || (t.rng ||
|
|
4174
|
-
s == null && (s =
|
|
4157
|
+
var o = t.random || (t.rng || Mr)();
|
|
4158
|
+
s == null && (s = Vt = [o[0] | 1, o[1], o[2], o[3], o[4], o[5]]), i == null && (i = Ye = (o[6] << 8 | o[7]) & 16383);
|
|
4175
4159
|
}
|
|
4176
|
-
var c = t.msecs !== void 0 ? t.msecs : Date.now(), u = t.nsecs !== void 0 ? t.nsecs :
|
|
4177
|
-
if (l < 0 && t.clockseq === void 0 && (i = i + 1 & 16383), (l < 0 || c >
|
|
4160
|
+
var c = t.msecs !== void 0 ? t.msecs : Date.now(), u = t.nsecs !== void 0 ? t.nsecs : Qe + 1, l = c - Ze + (u - Qe) / 1e4;
|
|
4161
|
+
if (l < 0 && t.clockseq === void 0 && (i = i + 1 & 16383), (l < 0 || c > Ze) && t.nsecs === void 0 && (u = 0), u >= 1e4)
|
|
4178
4162
|
throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");
|
|
4179
|
-
|
|
4163
|
+
Ze = c, Qe = u, Ye = i, c += 122192928e5;
|
|
4180
4164
|
var f = ((c & 268435455) * 1e4 + u) % 4294967296;
|
|
4181
4165
|
a[n++] = f >>> 24 & 255, a[n++] = f >>> 16 & 255, a[n++] = f >>> 8 & 255, a[n++] = f & 255;
|
|
4182
4166
|
var d = c / 4294967296 * 1e4 & 268435455;
|
|
4183
4167
|
a[n++] = d >>> 8 & 255, a[n++] = d & 255, a[n++] = d >>> 24 & 15 | 16, a[n++] = d >>> 16 & 255, a[n++] = i >>> 8 | 128, a[n++] = i & 255;
|
|
4184
4168
|
for (var p = 0; p < 6; ++p)
|
|
4185
4169
|
a[n + p] = s[p];
|
|
4186
|
-
return e ||
|
|
4170
|
+
return e || Fe(a);
|
|
4187
4171
|
}
|
|
4188
|
-
function
|
|
4189
|
-
if (!
|
|
4172
|
+
function kr(t) {
|
|
4173
|
+
if (!ke(t))
|
|
4190
4174
|
throw TypeError("Invalid UUID");
|
|
4191
4175
|
var e, r = new Uint8Array(16);
|
|
4192
4176
|
return r[0] = (e = parseInt(t.slice(0, 8), 16)) >>> 24, r[1] = e >>> 16 & 255, r[2] = e >>> 8 & 255, r[3] = e & 255, r[4] = (e = parseInt(t.slice(9, 13), 16)) >>> 8, r[5] = e & 255, r[6] = (e = parseInt(t.slice(14, 18), 16)) >>> 8, r[7] = e & 255, r[8] = (e = parseInt(t.slice(19, 23), 16)) >>> 8, r[9] = e & 255, r[10] = (e = parseInt(t.slice(24, 36), 16)) / 1099511627776 & 255, r[11] = e / 4294967296 & 255, r[12] = e >>> 24 & 255, r[13] = e >>> 16 & 255, r[14] = e >>> 8 & 255, r[15] = e & 255, r;
|
|
4193
4177
|
}
|
|
4194
|
-
function
|
|
4178
|
+
function es(t) {
|
|
4195
4179
|
t = unescape(encodeURIComponent(t));
|
|
4196
4180
|
for (var e = [], r = 0; r < t.length; ++r)
|
|
4197
4181
|
e.push(t.charCodeAt(r));
|
|
4198
4182
|
return e;
|
|
4199
4183
|
}
|
|
4200
|
-
var
|
|
4201
|
-
function
|
|
4184
|
+
var ts = "6ba7b810-9dad-11d1-80b4-00c04fd430c8", rs = "6ba7b811-9dad-11d1-80b4-00c04fd430c8";
|
|
4185
|
+
function Fr(t, e, r) {
|
|
4202
4186
|
function n(a, s, i, o) {
|
|
4203
|
-
if (typeof a == "string" && (a =
|
|
4187
|
+
if (typeof a == "string" && (a = es(a)), typeof s == "string" && (s = kr(s)), s.length !== 16)
|
|
4204
4188
|
throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
|
|
4205
4189
|
var c = new Uint8Array(16 + a.length);
|
|
4206
4190
|
if (c.set(s), c.set(a, s.length), c = r(c), c[6] = c[6] & 15 | e, c[8] = c[8] & 63 | 128, i) {
|
|
@@ -4209,84 +4193,84 @@ function Br(t, e, r) {
|
|
|
4209
4193
|
i[o + u] = c[u];
|
|
4210
4194
|
return i;
|
|
4211
4195
|
}
|
|
4212
|
-
return
|
|
4196
|
+
return Fe(c);
|
|
4213
4197
|
}
|
|
4214
4198
|
try {
|
|
4215
4199
|
n.name = t;
|
|
4216
4200
|
} catch {
|
|
4217
4201
|
}
|
|
4218
|
-
return n.DNS =
|
|
4202
|
+
return n.DNS = ts, n.URL = rs, n;
|
|
4219
4203
|
}
|
|
4220
|
-
function
|
|
4204
|
+
function ns(t) {
|
|
4221
4205
|
if (typeof t == "string") {
|
|
4222
4206
|
var e = unescape(encodeURIComponent(t));
|
|
4223
4207
|
t = new Uint8Array(e.length);
|
|
4224
4208
|
for (var r = 0; r < e.length; ++r)
|
|
4225
4209
|
t[r] = e.charCodeAt(r);
|
|
4226
4210
|
}
|
|
4227
|
-
return
|
|
4211
|
+
return as(ss(is(t), t.length * 8));
|
|
4228
4212
|
}
|
|
4229
|
-
function
|
|
4213
|
+
function as(t) {
|
|
4230
4214
|
for (var e = [], r = t.length * 32, n = "0123456789abcdef", a = 0; a < r; a += 8) {
|
|
4231
4215
|
var s = t[a >> 5] >>> a % 32 & 255, i = parseInt(n.charAt(s >>> 4 & 15) + n.charAt(s & 15), 16);
|
|
4232
4216
|
e.push(i);
|
|
4233
4217
|
}
|
|
4234
4218
|
return e;
|
|
4235
4219
|
}
|
|
4236
|
-
function
|
|
4220
|
+
function Vr(t) {
|
|
4237
4221
|
return (t + 64 >>> 9 << 4) + 14 + 1;
|
|
4238
4222
|
}
|
|
4239
|
-
function
|
|
4240
|
-
t[e >> 5] |= 128 << e % 32, t[
|
|
4223
|
+
function ss(t, e) {
|
|
4224
|
+
t[e >> 5] |= 128 << e % 32, t[Vr(e) - 1] = e;
|
|
4241
4225
|
for (var r = 1732584193, n = -271733879, a = -1732584194, s = 271733878, i = 0; i < t.length; i += 16) {
|
|
4242
4226
|
var o = r, c = n, u = a, l = s;
|
|
4243
|
-
r = D(r, n, a, s, t[i], 7, -680876936), s = D(s, r, n, a, t[i + 1], 12, -389564586), a = D(a, s, r, n, t[i + 2], 17, 606105819), n = D(n, a, s, r, t[i + 3], 22, -1044525330), r = D(r, n, a, s, t[i + 4], 7, -176418897), s = D(s, r, n, a, t[i + 5], 12, 1200080426), a = D(a, s, r, n, t[i + 6], 17, -1473231341), n = D(n, a, s, r, t[i + 7], 22, -45705983), r = D(r, n, a, s, t[i + 8], 7, 1770035416), s = D(s, r, n, a, t[i + 9], 12, -1958414417), a = D(a, s, r, n, t[i + 10], 17, -42063), n = D(n, a, s, r, t[i + 11], 22, -1990404162), r = D(r, n, a, s, t[i + 12], 7, 1804603682), s = D(s, r, n, a, t[i + 13], 12, -40341101), a = D(a, s, r, n, t[i + 14], 17, -1502002290), n = D(n, a, s, r, t[i + 15], 22, 1236535329), r = J(r, n, a, s, t[i + 1], 5, -165796510), s = J(s, r, n, a, t[i + 6], 9, -1069501632), a = J(a, s, r, n, t[i + 11], 14, 643717713), n = J(n, a, s, r, t[i], 20, -373897302), r = J(r, n, a, s, t[i + 5], 5, -701558691), s = J(s, r, n, a, t[i + 10], 9, 38016083), a = J(a, s, r, n, t[i + 15], 14, -660478335), n = J(n, a, s, r, t[i + 4], 20, -405537848), r = J(r, n, a, s, t[i + 9], 5, 568446438), s = J(s, r, n, a, t[i + 14], 9, -1019803690), a = J(a, s, r, n, t[i + 3], 14, -187363961), n = J(n, a, s, r, t[i + 8], 20, 1163531501), r = J(r, n, a, s, t[i + 13], 5, -1444681467), s = J(s, r, n, a, t[i + 2], 9, -51403784), a = J(a, s, r, n, t[i + 7], 14, 1735328473), n = J(n, a, s, r, t[i + 12], 20, -1926607734), r = N(r, n, a, s, t[i + 5], 4, -378558), s = N(s, r, n, a, t[i + 8], 11, -2022574463), a = N(a, s, r, n, t[i + 11], 16, 1839030562), n = N(n, a, s, r, t[i + 14], 23, -35309556), r = N(r, n, a, s, t[i + 1], 4, -1530992060), s = N(s, r, n, a, t[i + 4], 11, 1272893353), a = N(a, s, r, n, t[i + 7], 16, -155497632), n = N(n, a, s, r, t[i + 10], 23, -1094730640), r = N(r, n, a, s, t[i + 13], 4, 681279174), s = N(s, r, n, a, t[i], 11, -358537222), a = N(a, s, r, n, t[i + 3], 16, -722521979), n = N(n, a, s, r, t[i + 6], 23, 76029189), r = N(r, n, a, s, t[i + 9], 4, -640364487), s = N(s, r, n, a, t[i + 12], 11, -421815835), a = N(a, s, r, n, t[i + 15], 16, 530742520), n = N(n, a, s, r, t[i + 2], 23, -995338651), r = $(r, n, a, s, t[i], 6, -198630844), s = $(s, r, n, a, t[i + 7], 10, 1126891415), a = $(a, s, r, n, t[i + 14], 15, -1416354905), n = $(n, a, s, r, t[i + 5], 21, -57434055), r = $(r, n, a, s, t[i + 12], 6, 1700485571), s = $(s, r, n, a, t[i + 3], 10, -1894986606), a = $(a, s, r, n, t[i + 10], 15, -1051523), n = $(n, a, s, r, t[i + 1], 21, -2054922799), r = $(r, n, a, s, t[i + 8], 6, 1873313359), s = $(s, r, n, a, t[i + 15], 10, -30611744), a = $(a, s, r, n, t[i + 6], 15, -1560198380), n = $(n, a, s, r, t[i + 13], 21, 1309151649), r = $(r, n, a, s, t[i + 4], 6, -145523070), s = $(s, r, n, a, t[i + 11], 10, -1120210379), a = $(a, s, r, n, t[i + 2], 15, 718787259), n = $(n, a, s, r, t[i + 9], 21, -343485551), r =
|
|
4227
|
+
r = D(r, n, a, s, t[i], 7, -680876936), s = D(s, r, n, a, t[i + 1], 12, -389564586), a = D(a, s, r, n, t[i + 2], 17, 606105819), n = D(n, a, s, r, t[i + 3], 22, -1044525330), r = D(r, n, a, s, t[i + 4], 7, -176418897), s = D(s, r, n, a, t[i + 5], 12, 1200080426), a = D(a, s, r, n, t[i + 6], 17, -1473231341), n = D(n, a, s, r, t[i + 7], 22, -45705983), r = D(r, n, a, s, t[i + 8], 7, 1770035416), s = D(s, r, n, a, t[i + 9], 12, -1958414417), a = D(a, s, r, n, t[i + 10], 17, -42063), n = D(n, a, s, r, t[i + 11], 22, -1990404162), r = D(r, n, a, s, t[i + 12], 7, 1804603682), s = D(s, r, n, a, t[i + 13], 12, -40341101), a = D(a, s, r, n, t[i + 14], 17, -1502002290), n = D(n, a, s, r, t[i + 15], 22, 1236535329), r = J(r, n, a, s, t[i + 1], 5, -165796510), s = J(s, r, n, a, t[i + 6], 9, -1069501632), a = J(a, s, r, n, t[i + 11], 14, 643717713), n = J(n, a, s, r, t[i], 20, -373897302), r = J(r, n, a, s, t[i + 5], 5, -701558691), s = J(s, r, n, a, t[i + 10], 9, 38016083), a = J(a, s, r, n, t[i + 15], 14, -660478335), n = J(n, a, s, r, t[i + 4], 20, -405537848), r = J(r, n, a, s, t[i + 9], 5, 568446438), s = J(s, r, n, a, t[i + 14], 9, -1019803690), a = J(a, s, r, n, t[i + 3], 14, -187363961), n = J(n, a, s, r, t[i + 8], 20, 1163531501), r = J(r, n, a, s, t[i + 13], 5, -1444681467), s = J(s, r, n, a, t[i + 2], 9, -51403784), a = J(a, s, r, n, t[i + 7], 14, 1735328473), n = J(n, a, s, r, t[i + 12], 20, -1926607734), r = N(r, n, a, s, t[i + 5], 4, -378558), s = N(s, r, n, a, t[i + 8], 11, -2022574463), a = N(a, s, r, n, t[i + 11], 16, 1839030562), n = N(n, a, s, r, t[i + 14], 23, -35309556), r = N(r, n, a, s, t[i + 1], 4, -1530992060), s = N(s, r, n, a, t[i + 4], 11, 1272893353), a = N(a, s, r, n, t[i + 7], 16, -155497632), n = N(n, a, s, r, t[i + 10], 23, -1094730640), r = N(r, n, a, s, t[i + 13], 4, 681279174), s = N(s, r, n, a, t[i], 11, -358537222), a = N(a, s, r, n, t[i + 3], 16, -722521979), n = N(n, a, s, r, t[i + 6], 23, 76029189), r = N(r, n, a, s, t[i + 9], 4, -640364487), s = N(s, r, n, a, t[i + 12], 11, -421815835), a = N(a, s, r, n, t[i + 15], 16, 530742520), n = N(n, a, s, r, t[i + 2], 23, -995338651), r = $(r, n, a, s, t[i], 6, -198630844), s = $(s, r, n, a, t[i + 7], 10, 1126891415), a = $(a, s, r, n, t[i + 14], 15, -1416354905), n = $(n, a, s, r, t[i + 5], 21, -57434055), r = $(r, n, a, s, t[i + 12], 6, 1700485571), s = $(s, r, n, a, t[i + 3], 10, -1894986606), a = $(a, s, r, n, t[i + 10], 15, -1051523), n = $(n, a, s, r, t[i + 1], 21, -2054922799), r = $(r, n, a, s, t[i + 8], 6, 1873313359), s = $(s, r, n, a, t[i + 15], 10, -30611744), a = $(a, s, r, n, t[i + 6], 15, -1560198380), n = $(n, a, s, r, t[i + 13], 21, 1309151649), r = $(r, n, a, s, t[i + 4], 6, -145523070), s = $(s, r, n, a, t[i + 11], 10, -1120210379), a = $(a, s, r, n, t[i + 2], 15, 718787259), n = $(n, a, s, r, t[i + 9], 21, -343485551), r = ne(r, o), n = ne(n, c), a = ne(a, u), s = ne(s, l);
|
|
4244
4228
|
}
|
|
4245
4229
|
return [r, n, a, s];
|
|
4246
4230
|
}
|
|
4247
|
-
function
|
|
4231
|
+
function is(t) {
|
|
4248
4232
|
if (t.length === 0)
|
|
4249
4233
|
return [];
|
|
4250
|
-
for (var e = t.length * 8, r = new Uint32Array(
|
|
4234
|
+
for (var e = t.length * 8, r = new Uint32Array(Vr(e)), n = 0; n < e; n += 8)
|
|
4251
4235
|
r[n >> 5] |= (t[n / 8] & 255) << n % 32;
|
|
4252
4236
|
return r;
|
|
4253
4237
|
}
|
|
4254
|
-
function
|
|
4238
|
+
function ne(t, e) {
|
|
4255
4239
|
var r = (t & 65535) + (e & 65535), n = (t >> 16) + (e >> 16) + (r >> 16);
|
|
4256
4240
|
return n << 16 | r & 65535;
|
|
4257
4241
|
}
|
|
4258
|
-
function
|
|
4242
|
+
function os(t, e) {
|
|
4259
4243
|
return t << e | t >>> 32 - e;
|
|
4260
4244
|
}
|
|
4261
|
-
function
|
|
4262
|
-
return
|
|
4245
|
+
function Ve(t, e, r, n, a, s) {
|
|
4246
|
+
return ne(os(ne(ne(e, t), ne(n, s)), a), r);
|
|
4263
4247
|
}
|
|
4264
4248
|
function D(t, e, r, n, a, s, i) {
|
|
4265
|
-
return
|
|
4249
|
+
return Ve(e & r | ~e & n, t, e, a, s, i);
|
|
4266
4250
|
}
|
|
4267
4251
|
function J(t, e, r, n, a, s, i) {
|
|
4268
|
-
return
|
|
4252
|
+
return Ve(e & n | r & ~n, t, e, a, s, i);
|
|
4269
4253
|
}
|
|
4270
4254
|
function N(t, e, r, n, a, s, i) {
|
|
4271
|
-
return
|
|
4255
|
+
return Ve(e ^ r ^ n, t, e, a, s, i);
|
|
4272
4256
|
}
|
|
4273
4257
|
function $(t, e, r, n, a, s, i) {
|
|
4274
|
-
return
|
|
4258
|
+
return Ve(r ^ (e | ~n), t, e, a, s, i);
|
|
4275
4259
|
}
|
|
4276
|
-
var
|
|
4277
|
-
const
|
|
4278
|
-
function
|
|
4260
|
+
var cs = Fr("v3", 48, ns);
|
|
4261
|
+
const us = cs;
|
|
4262
|
+
function ls(t, e, r) {
|
|
4279
4263
|
t = t || {};
|
|
4280
|
-
var n = t.random || (t.rng ||
|
|
4264
|
+
var n = t.random || (t.rng || Mr)();
|
|
4281
4265
|
if (n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, e) {
|
|
4282
4266
|
r = r || 0;
|
|
4283
4267
|
for (var a = 0; a < 16; ++a)
|
|
4284
4268
|
e[r + a] = n[a];
|
|
4285
4269
|
return e;
|
|
4286
4270
|
}
|
|
4287
|
-
return
|
|
4271
|
+
return Fe(n);
|
|
4288
4272
|
}
|
|
4289
|
-
function
|
|
4273
|
+
function ds(t, e, r, n) {
|
|
4290
4274
|
switch (t) {
|
|
4291
4275
|
case 0:
|
|
4292
4276
|
return e & r ^ ~e & n;
|
|
@@ -4298,10 +4282,10 @@ function gs(t, e, r, n) {
|
|
|
4298
4282
|
return e ^ r ^ n;
|
|
4299
4283
|
}
|
|
4300
4284
|
}
|
|
4301
|
-
function
|
|
4285
|
+
function je(t, e) {
|
|
4302
4286
|
return t << e | t >>> 32 - e;
|
|
4303
4287
|
}
|
|
4304
|
-
function
|
|
4288
|
+
function fs(t) {
|
|
4305
4289
|
var e = [1518500249, 1859775393, 2400959708, 3395469782], r = [1732584193, 4023233417, 2562383102, 271733878, 3285377520];
|
|
4306
4290
|
if (typeof t == "string") {
|
|
4307
4291
|
var n = unescape(encodeURIComponent(t));
|
|
@@ -4321,68 +4305,68 @@ function ms(t) {
|
|
|
4321
4305
|
for (var d = new Uint32Array(80), p = 0; p < 16; ++p)
|
|
4322
4306
|
d[p] = o[f][p];
|
|
4323
4307
|
for (var h = 16; h < 80; ++h)
|
|
4324
|
-
d[h] =
|
|
4308
|
+
d[h] = je(d[h - 3] ^ d[h - 8] ^ d[h - 14] ^ d[h - 16], 1);
|
|
4325
4309
|
for (var g = r[0], S = r[1], C = r[2], v = r[3], w = r[4], m = 0; m < 80; ++m) {
|
|
4326
|
-
var E = Math.floor(m / 20), _ =
|
|
4327
|
-
w = v, v = C, C =
|
|
4310
|
+
var E = Math.floor(m / 20), _ = je(g, 5) + ds(E, S, C, v) + w + e[E] + d[m] >>> 0;
|
|
4311
|
+
w = v, v = C, C = je(S, 30) >>> 0, S = g, g = _;
|
|
4328
4312
|
}
|
|
4329
4313
|
r[0] = r[0] + g >>> 0, r[1] = r[1] + S >>> 0, r[2] = r[2] + C >>> 0, r[3] = r[3] + v >>> 0, r[4] = r[4] + w >>> 0;
|
|
4330
4314
|
}
|
|
4331
4315
|
return [r[0] >> 24 & 255, r[0] >> 16 & 255, r[0] >> 8 & 255, r[0] & 255, r[1] >> 24 & 255, r[1] >> 16 & 255, r[1] >> 8 & 255, r[1] & 255, r[2] >> 24 & 255, r[2] >> 16 & 255, r[2] >> 8 & 255, r[2] & 255, r[3] >> 24 & 255, r[3] >> 16 & 255, r[3] >> 8 & 255, r[3] & 255, r[4] >> 24 & 255, r[4] >> 16 & 255, r[4] >> 8 & 255, r[4] & 255];
|
|
4332
4316
|
}
|
|
4333
|
-
var
|
|
4334
|
-
const
|
|
4335
|
-
function
|
|
4336
|
-
if (!
|
|
4317
|
+
var hs = Fr("v5", 80, fs);
|
|
4318
|
+
const ps = hs, gs = "00000000-0000-0000-0000-000000000000";
|
|
4319
|
+
function ms(t) {
|
|
4320
|
+
if (!ke(t))
|
|
4337
4321
|
throw TypeError("Invalid UUID");
|
|
4338
4322
|
return parseInt(t.substr(14, 1), 16);
|
|
4339
4323
|
}
|
|
4340
|
-
const
|
|
4324
|
+
const ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4341
4325
|
__proto__: null,
|
|
4342
|
-
NIL:
|
|
4343
|
-
parse:
|
|
4344
|
-
stringify:
|
|
4345
|
-
v1:
|
|
4346
|
-
v3:
|
|
4347
|
-
v4:
|
|
4348
|
-
v5:
|
|
4349
|
-
validate:
|
|
4350
|
-
version:
|
|
4351
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4352
|
-
var
|
|
4353
|
-
function
|
|
4354
|
-
return
|
|
4326
|
+
NIL: gs,
|
|
4327
|
+
parse: kr,
|
|
4328
|
+
stringify: Fe,
|
|
4329
|
+
v1: ja,
|
|
4330
|
+
v3: us,
|
|
4331
|
+
v4: ls,
|
|
4332
|
+
v5: ps,
|
|
4333
|
+
validate: ke,
|
|
4334
|
+
version: ms
|
|
4335
|
+
}, Symbol.toStringTag, { value: "Module" })), ws = /* @__PURE__ */ ft(ys);
|
|
4336
|
+
var ue = {}, et = { exports: {} }, tt = { exports: {} }, Bt;
|
|
4337
|
+
function Ss() {
|
|
4338
|
+
return Bt || (Bt = 1, function(t) {
|
|
4355
4339
|
function e(r, n) {
|
|
4356
4340
|
return n.get ? n.get.call(r) : n.value;
|
|
4357
4341
|
}
|
|
4358
4342
|
t.exports = e, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
4359
|
-
}(
|
|
4343
|
+
}(tt)), tt.exports;
|
|
4360
4344
|
}
|
|
4361
|
-
var
|
|
4362
|
-
function
|
|
4363
|
-
return
|
|
4345
|
+
var rt = { exports: {} }, Gt;
|
|
4346
|
+
function Br() {
|
|
4347
|
+
return Gt || (Gt = 1, function(t) {
|
|
4364
4348
|
function e(r, n, a) {
|
|
4365
4349
|
if (!n.has(r))
|
|
4366
4350
|
throw new TypeError("attempted to " + a + " private field on non-instance");
|
|
4367
4351
|
return n.get(r);
|
|
4368
4352
|
}
|
|
4369
4353
|
t.exports = e, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
4370
|
-
}(
|
|
4354
|
+
}(rt)), rt.exports;
|
|
4371
4355
|
}
|
|
4372
|
-
var
|
|
4373
|
-
function
|
|
4374
|
-
return
|
|
4375
|
-
var e =
|
|
4356
|
+
var zt;
|
|
4357
|
+
function bs() {
|
|
4358
|
+
return zt || (zt = 1, function(t) {
|
|
4359
|
+
var e = Ss(), r = Br();
|
|
4376
4360
|
function n(a, s) {
|
|
4377
4361
|
var i = r(a, s, "get");
|
|
4378
4362
|
return e(a, i);
|
|
4379
4363
|
}
|
|
4380
4364
|
t.exports = n, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
4381
|
-
}(
|
|
4365
|
+
}(et)), et.exports;
|
|
4382
4366
|
}
|
|
4383
|
-
var
|
|
4384
|
-
function
|
|
4385
|
-
return
|
|
4367
|
+
var nt = { exports: {} }, at = { exports: {} }, qt;
|
|
4368
|
+
function vs() {
|
|
4369
|
+
return qt || (qt = 1, function(t) {
|
|
4386
4370
|
function e(r, n, a) {
|
|
4387
4371
|
if (n.set)
|
|
4388
4372
|
n.set.call(r, a);
|
|
@@ -4393,29 +4377,29 @@ function Cs() {
|
|
|
4393
4377
|
}
|
|
4394
4378
|
}
|
|
4395
4379
|
t.exports = e, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
4396
|
-
}(
|
|
4380
|
+
}(at)), at.exports;
|
|
4397
4381
|
}
|
|
4398
|
-
var
|
|
4399
|
-
function
|
|
4400
|
-
return
|
|
4401
|
-
var e =
|
|
4382
|
+
var Xt;
|
|
4383
|
+
function Es() {
|
|
4384
|
+
return Xt || (Xt = 1, function(t) {
|
|
4385
|
+
var e = vs(), r = Br();
|
|
4402
4386
|
function n(a, s, i) {
|
|
4403
4387
|
var o = r(a, s, "set");
|
|
4404
4388
|
return e(a, o, i), i;
|
|
4405
4389
|
}
|
|
4406
4390
|
t.exports = n, t.exports.__esModule = !0, t.exports.default = t.exports;
|
|
4407
|
-
}(
|
|
4391
|
+
}(nt)), nt.exports;
|
|
4408
4392
|
}
|
|
4409
|
-
var
|
|
4410
|
-
function
|
|
4411
|
-
if (
|
|
4412
|
-
return
|
|
4413
|
-
|
|
4414
|
-
var t =
|
|
4415
|
-
Object.defineProperty(
|
|
4393
|
+
var Yt;
|
|
4394
|
+
function As() {
|
|
4395
|
+
if (Yt)
|
|
4396
|
+
return ue;
|
|
4397
|
+
Yt = 1;
|
|
4398
|
+
var t = rr;
|
|
4399
|
+
Object.defineProperty(ue, "__esModule", {
|
|
4416
4400
|
value: !0
|
|
4417
|
-
}),
|
|
4418
|
-
var e = t(
|
|
4401
|
+
}), ue.SessionStore = void 0, ue.defaultCookies = l;
|
|
4402
|
+
var e = t(bs()), r = t(Es());
|
|
4419
4403
|
function n(w, m) {
|
|
4420
4404
|
s(w, m), m.add(w);
|
|
4421
4405
|
}
|
|
@@ -4548,7 +4532,7 @@ function Ps() {
|
|
|
4548
4532
|
return Object.values(i(this, g, v).call(this));
|
|
4549
4533
|
}
|
|
4550
4534
|
}
|
|
4551
|
-
|
|
4535
|
+
ue.SessionStore = S;
|
|
4552
4536
|
function C(w) {
|
|
4553
4537
|
const m = Math.ceil(w.value.length / u);
|
|
4554
4538
|
if (m === 1)
|
|
@@ -4584,16 +4568,16 @@ function Ps() {
|
|
|
4584
4568
|
}
|
|
4585
4569
|
return w;
|
|
4586
4570
|
}
|
|
4587
|
-
return
|
|
4571
|
+
return ue;
|
|
4588
4572
|
}
|
|
4589
|
-
var
|
|
4590
|
-
function
|
|
4591
|
-
return
|
|
4573
|
+
var st = {}, Zt;
|
|
4574
|
+
function xs() {
|
|
4575
|
+
return Zt || (Zt = 1, Object.defineProperty(st, "__esModule", {
|
|
4592
4576
|
value: !0
|
|
4593
|
-
})),
|
|
4577
|
+
})), st;
|
|
4594
4578
|
}
|
|
4595
4579
|
(function(t) {
|
|
4596
|
-
var e =
|
|
4580
|
+
var e = rr;
|
|
4597
4581
|
Object.defineProperty(t, "__esModule", {
|
|
4598
4582
|
value: !0
|
|
4599
4583
|
});
|
|
@@ -4603,7 +4587,7 @@ function Hs() {
|
|
|
4603
4587
|
getToken: !0
|
|
4604
4588
|
};
|
|
4605
4589
|
t.decode = f, t.encode = l, t.getToken = d;
|
|
4606
|
-
var n =
|
|
4590
|
+
var n = ka, a = e(Ya), s = ws, i = As(), o = xs();
|
|
4607
4591
|
Object.keys(o).forEach(function(h) {
|
|
4608
4592
|
h === "default" || h === "__esModule" || Object.prototype.hasOwnProperty.call(r, h) || h in t && t[h] === o[h] || Object.defineProperty(t, h, {
|
|
4609
4593
|
enumerable: !0,
|
|
@@ -4664,8 +4648,8 @@ function Hs() {
|
|
|
4664
4648
|
}, A).value;
|
|
4665
4649
|
const Y = v.headers instanceof Headers ? v.headers.get("authorization") : (C = v.headers) === null || C === void 0 ? void 0 : C.authorization;
|
|
4666
4650
|
if (!q && (Y == null ? void 0 : Y.split(" ")[0]) === "Bearer") {
|
|
4667
|
-
const
|
|
4668
|
-
q = decodeURIComponent(
|
|
4651
|
+
const Be = Y.split(" ")[1];
|
|
4652
|
+
q = decodeURIComponent(Be);
|
|
4669
4653
|
}
|
|
4670
4654
|
if (!q)
|
|
4671
4655
|
return null;
|
|
@@ -4683,18 +4667,17 @@ function Hs() {
|
|
|
4683
4667
|
async function p(h, g) {
|
|
4684
4668
|
return await (0, a.default)("sha256", h, g, `NextAuth.js Generated Encryption Key${g ? ` (${g})` : ""}`, 32);
|
|
4685
4669
|
}
|
|
4686
|
-
})(
|
|
4687
|
-
class
|
|
4670
|
+
})(er);
|
|
4671
|
+
class Hs extends zr {
|
|
4688
4672
|
async validateTokenFront(e) {
|
|
4689
4673
|
this.logDebug("entra validate Token Front");
|
|
4690
|
-
const r = await
|
|
4674
|
+
const r = await er.getToken({ req: e });
|
|
4691
4675
|
if (this.logDebug("Token Front", JSON.stringify(r)), !r)
|
|
4692
|
-
throw new
|
|
4676
|
+
throw new wn().get("UNAUTHORIZED");
|
|
4693
4677
|
return e;
|
|
4694
4678
|
}
|
|
4695
4679
|
}
|
|
4696
4680
|
export {
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
tr as M
|
|
4681
|
+
Hs as C,
|
|
4682
|
+
wn as E
|
|
4700
4683
|
};
|