@pod-os/core 0.12.1-6af5683.0 → 0.12.1-7d2693a.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +539 -405
- package/lib/index.js +562 -428
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -41,22 +41,22 @@ var require_events = __commonJS({
|
|
|
41
41
|
var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value6) {
|
|
42
42
|
return value6 !== value6;
|
|
43
43
|
};
|
|
44
|
-
function
|
|
45
|
-
|
|
44
|
+
function EventEmitter2() {
|
|
45
|
+
EventEmitter2.init.call(this);
|
|
46
46
|
}
|
|
47
|
-
module2.exports =
|
|
47
|
+
module2.exports = EventEmitter2;
|
|
48
48
|
module2.exports.once = once;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
EventEmitter2.EventEmitter = EventEmitter2;
|
|
50
|
+
EventEmitter2.prototype._events = void 0;
|
|
51
|
+
EventEmitter2.prototype._eventsCount = 0;
|
|
52
|
+
EventEmitter2.prototype._maxListeners = void 0;
|
|
53
53
|
var defaultMaxListeners = 10;
|
|
54
54
|
function checkListener(listener) {
|
|
55
55
|
if (typeof listener !== "function") {
|
|
56
56
|
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
-
Object.defineProperty(
|
|
59
|
+
Object.defineProperty(EventEmitter2, "defaultMaxListeners", {
|
|
60
60
|
enumerable: true,
|
|
61
61
|
get: function() {
|
|
62
62
|
return defaultMaxListeners;
|
|
@@ -68,14 +68,14 @@ var require_events = __commonJS({
|
|
|
68
68
|
defaultMaxListeners = arg2;
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
|
-
|
|
71
|
+
EventEmitter2.init = function() {
|
|
72
72
|
if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) {
|
|
73
73
|
this._events = /* @__PURE__ */ Object.create(null);
|
|
74
74
|
this._eventsCount = 0;
|
|
75
75
|
}
|
|
76
76
|
this._maxListeners = this._maxListeners || void 0;
|
|
77
77
|
};
|
|
78
|
-
|
|
78
|
+
EventEmitter2.prototype.setMaxListeners = function setMaxListeners(n2) {
|
|
79
79
|
if (typeof n2 !== "number" || n2 < 0 || NumberIsNaN(n2)) {
|
|
80
80
|
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n2 + ".");
|
|
81
81
|
}
|
|
@@ -84,13 +84,13 @@ var require_events = __commonJS({
|
|
|
84
84
|
};
|
|
85
85
|
function _getMaxListeners(that) {
|
|
86
86
|
if (that._maxListeners === void 0)
|
|
87
|
-
return
|
|
87
|
+
return EventEmitter2.defaultMaxListeners;
|
|
88
88
|
return that._maxListeners;
|
|
89
89
|
}
|
|
90
|
-
|
|
90
|
+
EventEmitter2.prototype.getMaxListeners = function getMaxListeners() {
|
|
91
91
|
return _getMaxListeners(this);
|
|
92
92
|
};
|
|
93
|
-
|
|
93
|
+
EventEmitter2.prototype.emit = function emit(type5) {
|
|
94
94
|
var args = [];
|
|
95
95
|
for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
|
|
96
96
|
var doError = type5 === "error";
|
|
@@ -167,11 +167,11 @@ var require_events = __commonJS({
|
|
|
167
167
|
}
|
|
168
168
|
return target5;
|
|
169
169
|
}
|
|
170
|
-
|
|
170
|
+
EventEmitter2.prototype.addListener = function addListener(type5, listener) {
|
|
171
171
|
return _addListener(this, type5, listener, false);
|
|
172
172
|
};
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
EventEmitter2.prototype.on = EventEmitter2.prototype.addListener;
|
|
174
|
+
EventEmitter2.prototype.prependListener = function prependListener(type5, listener) {
|
|
175
175
|
return _addListener(this, type5, listener, true);
|
|
176
176
|
};
|
|
177
177
|
function onceWrapper() {
|
|
@@ -190,17 +190,17 @@ var require_events = __commonJS({
|
|
|
190
190
|
state2.wrapFn = wrapped;
|
|
191
191
|
return wrapped;
|
|
192
192
|
}
|
|
193
|
-
|
|
193
|
+
EventEmitter2.prototype.once = function once2(type5, listener) {
|
|
194
194
|
checkListener(listener);
|
|
195
195
|
this.on(type5, _onceWrap(this, type5, listener));
|
|
196
196
|
return this;
|
|
197
197
|
};
|
|
198
|
-
|
|
198
|
+
EventEmitter2.prototype.prependOnceListener = function prependOnceListener(type5, listener) {
|
|
199
199
|
checkListener(listener);
|
|
200
200
|
this.prependListener(type5, _onceWrap(this, type5, listener));
|
|
201
201
|
return this;
|
|
202
202
|
};
|
|
203
|
-
|
|
203
|
+
EventEmitter2.prototype.removeListener = function removeListener(type5, listener) {
|
|
204
204
|
var list, events3, position4, i, originalListener;
|
|
205
205
|
checkListener(listener);
|
|
206
206
|
events3 = this._events;
|
|
@@ -240,8 +240,8 @@ var require_events = __commonJS({
|
|
|
240
240
|
}
|
|
241
241
|
return this;
|
|
242
242
|
};
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
EventEmitter2.prototype.off = EventEmitter2.prototype.removeListener;
|
|
244
|
+
EventEmitter2.prototype.removeAllListeners = function removeAllListeners(type5) {
|
|
245
245
|
var listeners, events3, i;
|
|
246
246
|
events3 = this._events;
|
|
247
247
|
if (events3 === void 0)
|
|
@@ -292,20 +292,20 @@ var require_events = __commonJS({
|
|
|
292
292
|
return unwrap3 ? [evlistener.listener || evlistener] : [evlistener];
|
|
293
293
|
return unwrap3 ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
|
|
294
294
|
}
|
|
295
|
-
|
|
295
|
+
EventEmitter2.prototype.listeners = function listeners(type5) {
|
|
296
296
|
return _listeners(this, type5, true);
|
|
297
297
|
};
|
|
298
|
-
|
|
298
|
+
EventEmitter2.prototype.rawListeners = function rawListeners(type5) {
|
|
299
299
|
return _listeners(this, type5, false);
|
|
300
300
|
};
|
|
301
|
-
|
|
301
|
+
EventEmitter2.listenerCount = function(emitter, type5) {
|
|
302
302
|
if (typeof emitter.listenerCount === "function") {
|
|
303
303
|
return emitter.listenerCount(type5);
|
|
304
304
|
} else {
|
|
305
305
|
return listenerCount.call(emitter, type5);
|
|
306
306
|
}
|
|
307
307
|
};
|
|
308
|
-
|
|
308
|
+
EventEmitter2.prototype.listenerCount = listenerCount;
|
|
309
309
|
function listenerCount(type5) {
|
|
310
310
|
var events3 = this._events;
|
|
311
311
|
if (events3 !== void 0) {
|
|
@@ -318,7 +318,7 @@ var require_events = __commonJS({
|
|
|
318
318
|
}
|
|
319
319
|
return 0;
|
|
320
320
|
}
|
|
321
|
-
|
|
321
|
+
EventEmitter2.prototype.eventNames = function eventNames() {
|
|
322
322
|
return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
|
|
323
323
|
};
|
|
324
324
|
function arrayClone(arr, n2) {
|
|
@@ -6741,20 +6741,20 @@ var require_lunr = __commonJS({
|
|
|
6741
6741
|
if (obj === null || obj === void 0) {
|
|
6742
6742
|
return obj;
|
|
6743
6743
|
}
|
|
6744
|
-
var
|
|
6744
|
+
var clone2 = /* @__PURE__ */ Object.create(null), keys = Object.keys(obj);
|
|
6745
6745
|
for (var i = 0; i < keys.length; i++) {
|
|
6746
6746
|
var key3 = keys[i], val = obj[key3];
|
|
6747
6747
|
if (Array.isArray(val)) {
|
|
6748
|
-
|
|
6748
|
+
clone2[key3] = val.slice();
|
|
6749
6749
|
continue;
|
|
6750
6750
|
}
|
|
6751
6751
|
if (typeof val === "string" || typeof val === "number" || typeof val === "boolean") {
|
|
6752
|
-
|
|
6752
|
+
clone2[key3] = val;
|
|
6753
6753
|
continue;
|
|
6754
6754
|
}
|
|
6755
6755
|
throw new TypeError("clone is not deep and does not support nested objects");
|
|
6756
6756
|
}
|
|
6757
|
-
return
|
|
6757
|
+
return clone2;
|
|
6758
6758
|
};
|
|
6759
6759
|
lunr2.FieldRef = function(docRef, fieldName, stringValue) {
|
|
6760
6760
|
this.docRef = docRef;
|
|
@@ -10119,18 +10119,11 @@ function tap(observerOrNext, error4, complete2) {
|
|
|
10119
10119
|
}) : identity;
|
|
10120
10120
|
}
|
|
10121
10121
|
|
|
10122
|
-
// ../node_modules/@inrupt/solid-client-authn-core/dist/
|
|
10123
|
-
var import_events = __toESM(require_events(), 1);
|
|
10124
|
-
|
|
10125
|
-
// ../node_modules/@inrupt/universal-fetch/dist/index-browser.mjs
|
|
10126
|
-
var indexBrowser = globalThis.fetch;
|
|
10127
|
-
var { fetch: fetch2, Response, Request, Headers } = globalThis;
|
|
10128
|
-
|
|
10129
|
-
// ../node_modules/jose/dist/browser/runtime/webcrypto.js
|
|
10122
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/webcrypto.js
|
|
10130
10123
|
var webcrypto_default = crypto;
|
|
10131
10124
|
var isCryptoKey = (key3) => key3 instanceof CryptoKey;
|
|
10132
10125
|
|
|
10133
|
-
// ../node_modules/jose/dist/browser/lib/buffer_utils.js
|
|
10126
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/buffer_utils.js
|
|
10134
10127
|
var encoder = new TextEncoder();
|
|
10135
10128
|
var decoder = new TextDecoder();
|
|
10136
10129
|
var MAX_INT32 = 2 ** 32;
|
|
@@ -10138,14 +10131,14 @@ function concat(...buffers) {
|
|
|
10138
10131
|
const size4 = buffers.reduce((acc, { length: length2 }) => acc + length2, 0);
|
|
10139
10132
|
const buf = new Uint8Array(size4);
|
|
10140
10133
|
let i = 0;
|
|
10141
|
-
|
|
10134
|
+
for (const buffer of buffers) {
|
|
10142
10135
|
buf.set(buffer, i);
|
|
10143
10136
|
i += buffer.length;
|
|
10144
|
-
}
|
|
10137
|
+
}
|
|
10145
10138
|
return buf;
|
|
10146
10139
|
}
|
|
10147
10140
|
|
|
10148
|
-
// ../node_modules/jose/dist/browser/runtime/base64url.js
|
|
10141
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/base64url.js
|
|
10149
10142
|
var encodeBase64 = (input2) => {
|
|
10150
10143
|
let unencoded = input2;
|
|
10151
10144
|
if (typeof unencoded === "string") {
|
|
@@ -10177,22 +10170,21 @@ var decode = (input2) => {
|
|
|
10177
10170
|
encoded = encoded.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
10178
10171
|
try {
|
|
10179
10172
|
return decodeBase64(encoded);
|
|
10180
|
-
} catch
|
|
10173
|
+
} catch {
|
|
10181
10174
|
throw new TypeError("The input to be decoded is not correctly encoded.");
|
|
10182
10175
|
}
|
|
10183
10176
|
};
|
|
10184
10177
|
|
|
10185
|
-
// ../node_modules/jose/dist/browser/util/errors.js
|
|
10178
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/util/errors.js
|
|
10186
10179
|
var JOSEError = class extends Error {
|
|
10187
10180
|
static get code() {
|
|
10188
10181
|
return "ERR_JOSE_GENERIC";
|
|
10189
10182
|
}
|
|
10190
10183
|
constructor(message4) {
|
|
10191
|
-
var _a;
|
|
10192
10184
|
super(message4);
|
|
10193
10185
|
this.code = "ERR_JOSE_GENERIC";
|
|
10194
10186
|
this.name = this.constructor.name;
|
|
10195
|
-
|
|
10187
|
+
Error.captureStackTrace?.(this, this.constructor);
|
|
10196
10188
|
}
|
|
10197
10189
|
};
|
|
10198
10190
|
var JWTClaimValidationFailed = class extends JOSEError {
|
|
@@ -10253,6 +10245,45 @@ var JWTInvalid = class extends JOSEError {
|
|
|
10253
10245
|
return "ERR_JWT_INVALID";
|
|
10254
10246
|
}
|
|
10255
10247
|
};
|
|
10248
|
+
var JWKSInvalid = class extends JOSEError {
|
|
10249
|
+
constructor() {
|
|
10250
|
+
super(...arguments);
|
|
10251
|
+
this.code = "ERR_JWKS_INVALID";
|
|
10252
|
+
}
|
|
10253
|
+
static get code() {
|
|
10254
|
+
return "ERR_JWKS_INVALID";
|
|
10255
|
+
}
|
|
10256
|
+
};
|
|
10257
|
+
var JWKSNoMatchingKey = class extends JOSEError {
|
|
10258
|
+
constructor() {
|
|
10259
|
+
super(...arguments);
|
|
10260
|
+
this.code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
10261
|
+
this.message = "no applicable key found in the JSON Web Key Set";
|
|
10262
|
+
}
|
|
10263
|
+
static get code() {
|
|
10264
|
+
return "ERR_JWKS_NO_MATCHING_KEY";
|
|
10265
|
+
}
|
|
10266
|
+
};
|
|
10267
|
+
var JWKSMultipleMatchingKeys = class extends JOSEError {
|
|
10268
|
+
constructor() {
|
|
10269
|
+
super(...arguments);
|
|
10270
|
+
this.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
10271
|
+
this.message = "multiple matching keys found in the JSON Web Key Set";
|
|
10272
|
+
}
|
|
10273
|
+
static get code() {
|
|
10274
|
+
return "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
10275
|
+
}
|
|
10276
|
+
};
|
|
10277
|
+
var JWKSTimeout = class extends JOSEError {
|
|
10278
|
+
constructor() {
|
|
10279
|
+
super(...arguments);
|
|
10280
|
+
this.code = "ERR_JWKS_TIMEOUT";
|
|
10281
|
+
this.message = "request timed out";
|
|
10282
|
+
}
|
|
10283
|
+
static get code() {
|
|
10284
|
+
return "ERR_JWKS_TIMEOUT";
|
|
10285
|
+
}
|
|
10286
|
+
};
|
|
10256
10287
|
var JWSSignatureVerificationFailed = class extends JOSEError {
|
|
10257
10288
|
constructor() {
|
|
10258
10289
|
super(...arguments);
|
|
@@ -10264,10 +10295,10 @@ var JWSSignatureVerificationFailed = class extends JOSEError {
|
|
|
10264
10295
|
}
|
|
10265
10296
|
};
|
|
10266
10297
|
|
|
10267
|
-
// ../node_modules/jose/dist/browser/runtime/random.js
|
|
10298
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/random.js
|
|
10268
10299
|
var random_default = webcrypto_default.getRandomValues.bind(webcrypto_default);
|
|
10269
10300
|
|
|
10270
|
-
// ../node_modules/jose/dist/browser/lib/crypto_key.js
|
|
10301
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/crypto_key.js
|
|
10271
10302
|
function unusable(name7, prop = "algorithm.name") {
|
|
10272
10303
|
return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name7}`);
|
|
10273
10304
|
}
|
|
@@ -10361,7 +10392,7 @@ function checkSigCryptoKey(key3, alg, ...usages) {
|
|
|
10361
10392
|
checkUsage(key3, usages);
|
|
10362
10393
|
}
|
|
10363
10394
|
|
|
10364
|
-
// ../node_modules/jose/dist/browser/lib/invalid_key_input.js
|
|
10395
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/invalid_key_input.js
|
|
10365
10396
|
function message(msg, actual2, ...types2) {
|
|
10366
10397
|
if (types2.length > 2) {
|
|
10367
10398
|
const last3 = types2.pop();
|
|
@@ -10376,7 +10407,7 @@ function message(msg, actual2, ...types2) {
|
|
|
10376
10407
|
} else if (typeof actual2 === "function" && actual2.name) {
|
|
10377
10408
|
msg += ` Received function ${actual2.name}`;
|
|
10378
10409
|
} else if (typeof actual2 === "object" && actual2 != null) {
|
|
10379
|
-
if (actual2.constructor
|
|
10410
|
+
if (actual2.constructor?.name) {
|
|
10380
10411
|
msg += ` Received an instance of ${actual2.constructor.name}`;
|
|
10381
10412
|
}
|
|
10382
10413
|
}
|
|
@@ -10389,13 +10420,13 @@ function withAlg(alg, actual2, ...types2) {
|
|
|
10389
10420
|
return message(`Key for the ${alg} algorithm must be `, actual2, ...types2);
|
|
10390
10421
|
}
|
|
10391
10422
|
|
|
10392
|
-
// ../node_modules/jose/dist/browser/runtime/is_key_like.js
|
|
10423
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/is_key_like.js
|
|
10393
10424
|
var is_key_like_default = (key3) => {
|
|
10394
10425
|
return isCryptoKey(key3);
|
|
10395
10426
|
};
|
|
10396
10427
|
var types = ["CryptoKey"];
|
|
10397
10428
|
|
|
10398
|
-
// ../node_modules/jose/dist/browser/lib/is_disjoint.js
|
|
10429
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/is_disjoint.js
|
|
10399
10430
|
var isDisjoint = (...headers) => {
|
|
10400
10431
|
const sources = headers.filter(Boolean);
|
|
10401
10432
|
if (sources.length === 0 || sources.length === 1) {
|
|
@@ -10419,7 +10450,7 @@ var isDisjoint = (...headers) => {
|
|
|
10419
10450
|
};
|
|
10420
10451
|
var is_disjoint_default = isDisjoint;
|
|
10421
10452
|
|
|
10422
|
-
// ../node_modules/jose/dist/browser/lib/is_object.js
|
|
10453
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/is_object.js
|
|
10423
10454
|
function isObjectLike(value6) {
|
|
10424
10455
|
return typeof value6 === "object" && value6 !== null;
|
|
10425
10456
|
}
|
|
@@ -10437,7 +10468,7 @@ function isObject(input2) {
|
|
|
10437
10468
|
return Object.getPrototypeOf(input2) === proto;
|
|
10438
10469
|
}
|
|
10439
10470
|
|
|
10440
|
-
// ../node_modules/jose/dist/browser/runtime/check_key_length.js
|
|
10471
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/check_key_length.js
|
|
10441
10472
|
var check_key_length_default = (alg, key3) => {
|
|
10442
10473
|
if (alg.startsWith("RS") || alg.startsWith("PS")) {
|
|
10443
10474
|
const { modulusLength } = key3.algorithm;
|
|
@@ -10447,49 +10478,11 @@ var check_key_length_default = (alg, key3) => {
|
|
|
10447
10478
|
}
|
|
10448
10479
|
};
|
|
10449
10480
|
|
|
10450
|
-
// ../node_modules/jose/dist/browser/runtime/jwk_to_key.js
|
|
10481
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/jwk_to_key.js
|
|
10451
10482
|
function subtleMapping(jwk) {
|
|
10452
10483
|
let algorithm3;
|
|
10453
10484
|
let keyUsages;
|
|
10454
10485
|
switch (jwk.kty) {
|
|
10455
|
-
case "oct": {
|
|
10456
|
-
switch (jwk.alg) {
|
|
10457
|
-
case "HS256":
|
|
10458
|
-
case "HS384":
|
|
10459
|
-
case "HS512":
|
|
10460
|
-
algorithm3 = { name: "HMAC", hash: `SHA-${jwk.alg.slice(-3)}` };
|
|
10461
|
-
keyUsages = ["sign", "verify"];
|
|
10462
|
-
break;
|
|
10463
|
-
case "A128CBC-HS256":
|
|
10464
|
-
case "A192CBC-HS384":
|
|
10465
|
-
case "A256CBC-HS512":
|
|
10466
|
-
throw new JOSENotSupported(`${jwk.alg} keys cannot be imported as CryptoKey instances`);
|
|
10467
|
-
case "A128GCM":
|
|
10468
|
-
case "A192GCM":
|
|
10469
|
-
case "A256GCM":
|
|
10470
|
-
case "A128GCMKW":
|
|
10471
|
-
case "A192GCMKW":
|
|
10472
|
-
case "A256GCMKW":
|
|
10473
|
-
algorithm3 = { name: "AES-GCM" };
|
|
10474
|
-
keyUsages = ["encrypt", "decrypt"];
|
|
10475
|
-
break;
|
|
10476
|
-
case "A128KW":
|
|
10477
|
-
case "A192KW":
|
|
10478
|
-
case "A256KW":
|
|
10479
|
-
algorithm3 = { name: "AES-KW" };
|
|
10480
|
-
keyUsages = ["wrapKey", "unwrapKey"];
|
|
10481
|
-
break;
|
|
10482
|
-
case "PBES2-HS256+A128KW":
|
|
10483
|
-
case "PBES2-HS384+A192KW":
|
|
10484
|
-
case "PBES2-HS512+A256KW":
|
|
10485
|
-
algorithm3 = { name: "PBKDF2" };
|
|
10486
|
-
keyUsages = ["deriveBits"];
|
|
10487
|
-
break;
|
|
10488
|
-
default:
|
|
10489
|
-
throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
10490
|
-
}
|
|
10491
|
-
break;
|
|
10492
|
-
}
|
|
10493
10486
|
case "RSA": {
|
|
10494
10487
|
switch (jwk.alg) {
|
|
10495
10488
|
case "PS256":
|
|
@@ -10569,19 +10562,15 @@ function subtleMapping(jwk) {
|
|
|
10569
10562
|
return { algorithm: algorithm3, keyUsages };
|
|
10570
10563
|
}
|
|
10571
10564
|
var parse = async (jwk) => {
|
|
10572
|
-
var _a, _b;
|
|
10573
10565
|
if (!jwk.alg) {
|
|
10574
10566
|
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
10575
10567
|
}
|
|
10576
10568
|
const { algorithm: algorithm3, keyUsages } = subtleMapping(jwk);
|
|
10577
10569
|
const rest3 = [
|
|
10578
10570
|
algorithm3,
|
|
10579
|
-
|
|
10580
|
-
|
|
10571
|
+
jwk.ext ?? false,
|
|
10572
|
+
jwk.key_ops ?? keyUsages
|
|
10581
10573
|
];
|
|
10582
|
-
if (algorithm3.name === "PBKDF2") {
|
|
10583
|
-
return webcrypto_default.subtle.importKey("raw", decode(jwk.k), ...rest3);
|
|
10584
|
-
}
|
|
10585
10574
|
const keyData = { ...jwk };
|
|
10586
10575
|
delete keyData.alg;
|
|
10587
10576
|
delete keyData.use;
|
|
@@ -10589,9 +10578,8 @@ var parse = async (jwk) => {
|
|
|
10589
10578
|
};
|
|
10590
10579
|
var jwk_to_key_default = parse;
|
|
10591
10580
|
|
|
10592
|
-
// ../node_modules/jose/dist/browser/key/import.js
|
|
10593
|
-
async function importJWK(jwk, alg
|
|
10594
|
-
var _a;
|
|
10581
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/key/import.js
|
|
10582
|
+
async function importJWK(jwk, alg) {
|
|
10595
10583
|
if (!isObject(jwk)) {
|
|
10596
10584
|
throw new TypeError("JWK must be an object");
|
|
10597
10585
|
}
|
|
@@ -10601,10 +10589,6 @@ async function importJWK(jwk, alg, octAsKeyObject) {
|
|
|
10601
10589
|
if (typeof jwk.k !== "string" || !jwk.k) {
|
|
10602
10590
|
throw new TypeError('missing "k" (Key Value) Parameter value');
|
|
10603
10591
|
}
|
|
10604
|
-
octAsKeyObject !== null && octAsKeyObject !== void 0 ? octAsKeyObject : octAsKeyObject = jwk.ext !== true;
|
|
10605
|
-
if (octAsKeyObject) {
|
|
10606
|
-
return jwk_to_key_default({ ...jwk, alg, ext: (_a = jwk.ext) !== null && _a !== void 0 ? _a : false });
|
|
10607
|
-
}
|
|
10608
10592
|
return decode(jwk.k);
|
|
10609
10593
|
case "RSA":
|
|
10610
10594
|
if (jwk.oth !== void 0) {
|
|
@@ -10618,7 +10602,7 @@ async function importJWK(jwk, alg, octAsKeyObject) {
|
|
|
10618
10602
|
}
|
|
10619
10603
|
}
|
|
10620
10604
|
|
|
10621
|
-
// ../node_modules/jose/dist/browser/lib/check_key_type.js
|
|
10605
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/check_key_type.js
|
|
10622
10606
|
var symmetricTypeCheck = (alg, key3) => {
|
|
10623
10607
|
if (key3 instanceof Uint8Array)
|
|
10624
10608
|
return;
|
|
@@ -10659,9 +10643,9 @@ var checkKeyType = (alg, key3, usage2) => {
|
|
|
10659
10643
|
};
|
|
10660
10644
|
var check_key_type_default = checkKeyType;
|
|
10661
10645
|
|
|
10662
|
-
// ../node_modules/jose/dist/browser/lib/validate_crit.js
|
|
10646
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/validate_crit.js
|
|
10663
10647
|
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
10664
|
-
if (joseHeader.crit !== void 0 && protectedHeader
|
|
10648
|
+
if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) {
|
|
10665
10649
|
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
10666
10650
|
}
|
|
10667
10651
|
if (!protectedHeader || protectedHeader.crit === void 0) {
|
|
@@ -10682,7 +10666,8 @@ function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader,
|
|
|
10682
10666
|
}
|
|
10683
10667
|
if (joseHeader[parameter2] === void 0) {
|
|
10684
10668
|
throw new Err(`Extension Header Parameter "${parameter2}" is missing`);
|
|
10685
|
-
}
|
|
10669
|
+
}
|
|
10670
|
+
if (recognized.get(parameter2) && protectedHeader[parameter2] === void 0) {
|
|
10686
10671
|
throw new Err(`Extension Header Parameter "${parameter2}" MUST be integrity protected`);
|
|
10687
10672
|
}
|
|
10688
10673
|
}
|
|
@@ -10690,7 +10675,7 @@ function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader,
|
|
|
10690
10675
|
}
|
|
10691
10676
|
var validate_crit_default = validateCrit;
|
|
10692
10677
|
|
|
10693
|
-
// ../node_modules/jose/dist/browser/lib/validate_algorithms.js
|
|
10678
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/validate_algorithms.js
|
|
10694
10679
|
var validateAlgorithms = (option5, algorithms) => {
|
|
10695
10680
|
if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
10696
10681
|
throw new TypeError(`"${option5}" option must be an array of strings`);
|
|
@@ -10702,7 +10687,7 @@ var validateAlgorithms = (option5, algorithms) => {
|
|
|
10702
10687
|
};
|
|
10703
10688
|
var validate_algorithms_default = validateAlgorithms;
|
|
10704
10689
|
|
|
10705
|
-
// ../node_modules/jose/dist/browser/runtime/key_to_jwk.js
|
|
10690
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/key_to_jwk.js
|
|
10706
10691
|
var keyToJWK = async (key3) => {
|
|
10707
10692
|
if (key3 instanceof Uint8Array) {
|
|
10708
10693
|
return {
|
|
@@ -10721,15 +10706,15 @@ var keyToJWK = async (key3) => {
|
|
|
10721
10706
|
};
|
|
10722
10707
|
var key_to_jwk_default = keyToJWK;
|
|
10723
10708
|
|
|
10724
|
-
// ../node_modules/jose/dist/browser/key/export.js
|
|
10709
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/key/export.js
|
|
10725
10710
|
async function exportJWK(key3) {
|
|
10726
10711
|
return key_to_jwk_default(key3);
|
|
10727
10712
|
}
|
|
10728
10713
|
|
|
10729
|
-
// ../node_modules/jose/dist/browser/jwe/flattened/encrypt.js
|
|
10714
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwe/flattened/encrypt.js
|
|
10730
10715
|
var unprotected = Symbol();
|
|
10731
10716
|
|
|
10732
|
-
// ../node_modules/jose/dist/browser/runtime/subtle_dsa.js
|
|
10717
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/subtle_dsa.js
|
|
10733
10718
|
function subtleDsa(alg, algorithm3) {
|
|
10734
10719
|
const hash2 = `SHA-${alg.slice(-3)}`;
|
|
10735
10720
|
switch (alg) {
|
|
@@ -10756,7 +10741,7 @@ function subtleDsa(alg, algorithm3) {
|
|
|
10756
10741
|
}
|
|
10757
10742
|
}
|
|
10758
10743
|
|
|
10759
|
-
// ../node_modules/jose/dist/browser/runtime/get_sign_verify_key.js
|
|
10744
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/get_sign_verify_key.js
|
|
10760
10745
|
function getCryptoKey(alg, key3, usage2) {
|
|
10761
10746
|
if (isCryptoKey(key3)) {
|
|
10762
10747
|
checkSigCryptoKey(key3, alg, usage2);
|
|
@@ -10771,22 +10756,21 @@ function getCryptoKey(alg, key3, usage2) {
|
|
|
10771
10756
|
throw new TypeError(invalid_key_input_default(key3, ...types, "Uint8Array"));
|
|
10772
10757
|
}
|
|
10773
10758
|
|
|
10774
|
-
// ../node_modules/jose/dist/browser/runtime/verify.js
|
|
10759
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/verify.js
|
|
10775
10760
|
var verify = async (alg, key3, signature2, data2) => {
|
|
10776
10761
|
const cryptoKey = await getCryptoKey(alg, key3, "verify");
|
|
10777
10762
|
check_key_length_default(alg, cryptoKey);
|
|
10778
10763
|
const algorithm3 = subtleDsa(alg, cryptoKey.algorithm);
|
|
10779
10764
|
try {
|
|
10780
10765
|
return await webcrypto_default.subtle.verify(algorithm3, cryptoKey, signature2, data2);
|
|
10781
|
-
} catch
|
|
10766
|
+
} catch {
|
|
10782
10767
|
return false;
|
|
10783
10768
|
}
|
|
10784
10769
|
};
|
|
10785
10770
|
var verify_default = verify;
|
|
10786
10771
|
|
|
10787
|
-
// ../node_modules/jose/dist/browser/jws/flattened/verify.js
|
|
10772
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jws/flattened/verify.js
|
|
10788
10773
|
async function flattenedVerify(jws2, key3, options) {
|
|
10789
|
-
var _a;
|
|
10790
10774
|
if (!isObject(jws2)) {
|
|
10791
10775
|
throw new JWSInvalid("Flattened JWS must be an object");
|
|
10792
10776
|
}
|
|
@@ -10810,7 +10794,7 @@ async function flattenedVerify(jws2, key3, options) {
|
|
|
10810
10794
|
try {
|
|
10811
10795
|
const protectedHeader = decode(jws2.protected);
|
|
10812
10796
|
parsedProt = JSON.parse(decoder.decode(protectedHeader));
|
|
10813
|
-
} catch
|
|
10797
|
+
} catch {
|
|
10814
10798
|
throw new JWSInvalid("JWS Protected Header is invalid");
|
|
10815
10799
|
}
|
|
10816
10800
|
}
|
|
@@ -10821,7 +10805,7 @@ async function flattenedVerify(jws2, key3, options) {
|
|
|
10821
10805
|
...parsedProt,
|
|
10822
10806
|
...jws2.header
|
|
10823
10807
|
};
|
|
10824
|
-
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options
|
|
10808
|
+
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options?.crit, parsedProt, joseHeader);
|
|
10825
10809
|
let b64 = true;
|
|
10826
10810
|
if (extensions.has("b64")) {
|
|
10827
10811
|
b64 = parsedProt.b64;
|
|
@@ -10835,7 +10819,7 @@ async function flattenedVerify(jws2, key3, options) {
|
|
|
10835
10819
|
}
|
|
10836
10820
|
const algorithms = options && validate_algorithms_default("algorithms", options.algorithms);
|
|
10837
10821
|
if (algorithms && !algorithms.has(alg)) {
|
|
10838
|
-
throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');
|
|
10822
|
+
throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed');
|
|
10839
10823
|
}
|
|
10840
10824
|
if (b64) {
|
|
10841
10825
|
if (typeof jws2.payload !== "string") {
|
|
@@ -10850,11 +10834,11 @@ async function flattenedVerify(jws2, key3, options) {
|
|
|
10850
10834
|
resolvedKey = true;
|
|
10851
10835
|
}
|
|
10852
10836
|
check_key_type_default(alg, key3, "verify");
|
|
10853
|
-
const data2 = concat(encoder.encode(
|
|
10837
|
+
const data2 = concat(encoder.encode(jws2.protected ?? ""), encoder.encode("."), typeof jws2.payload === "string" ? encoder.encode(jws2.payload) : jws2.payload);
|
|
10854
10838
|
let signature2;
|
|
10855
10839
|
try {
|
|
10856
10840
|
signature2 = decode(jws2.signature);
|
|
10857
|
-
} catch
|
|
10841
|
+
} catch {
|
|
10858
10842
|
throw new JWSInvalid("Failed to base64url decode the signature");
|
|
10859
10843
|
}
|
|
10860
10844
|
const verified2 = await verify_default(alg, key3, signature2, data2);
|
|
@@ -10865,7 +10849,7 @@ async function flattenedVerify(jws2, key3, options) {
|
|
|
10865
10849
|
if (b64) {
|
|
10866
10850
|
try {
|
|
10867
10851
|
payload4 = decode(jws2.payload);
|
|
10868
|
-
} catch
|
|
10852
|
+
} catch {
|
|
10869
10853
|
throw new JWSInvalid("Failed to base64url decode the payload");
|
|
10870
10854
|
}
|
|
10871
10855
|
} else if (typeof jws2.payload === "string") {
|
|
@@ -10886,7 +10870,7 @@ async function flattenedVerify(jws2, key3, options) {
|
|
|
10886
10870
|
return result5;
|
|
10887
10871
|
}
|
|
10888
10872
|
|
|
10889
|
-
// ../node_modules/jose/dist/browser/jws/compact/verify.js
|
|
10873
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jws/compact/verify.js
|
|
10890
10874
|
async function compactVerify(jws2, key3, options) {
|
|
10891
10875
|
if (jws2 instanceof Uint8Array) {
|
|
10892
10876
|
jws2 = decoder.decode(jws2);
|
|
@@ -10906,56 +10890,67 @@ async function compactVerify(jws2, key3, options) {
|
|
|
10906
10890
|
return result5;
|
|
10907
10891
|
}
|
|
10908
10892
|
|
|
10909
|
-
// ../node_modules/jose/dist/browser/lib/epoch.js
|
|
10893
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/epoch.js
|
|
10910
10894
|
var epoch_default = (date5) => Math.floor(date5.getTime() / 1e3);
|
|
10911
10895
|
|
|
10912
|
-
// ../node_modules/jose/dist/browser/lib/secs.js
|
|
10896
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/secs.js
|
|
10913
10897
|
var minute = 60;
|
|
10914
10898
|
var hour = minute * 60;
|
|
10915
10899
|
var day = hour * 24;
|
|
10916
10900
|
var week = day * 7;
|
|
10917
10901
|
var year = day * 365.25;
|
|
10918
|
-
var REGEX = /^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)
|
|
10902
|
+
var REGEX = /^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i;
|
|
10919
10903
|
var secs_default = (str) => {
|
|
10920
10904
|
const matched = REGEX.exec(str);
|
|
10921
|
-
if (!matched) {
|
|
10905
|
+
if (!matched || matched[4] && matched[1]) {
|
|
10922
10906
|
throw new TypeError("Invalid time period format");
|
|
10923
10907
|
}
|
|
10924
|
-
const value6 = parseFloat(matched[
|
|
10925
|
-
const unit2 = matched[
|
|
10908
|
+
const value6 = parseFloat(matched[2]);
|
|
10909
|
+
const unit2 = matched[3].toLowerCase();
|
|
10910
|
+
let numericDate;
|
|
10926
10911
|
switch (unit2) {
|
|
10927
10912
|
case "sec":
|
|
10928
10913
|
case "secs":
|
|
10929
10914
|
case "second":
|
|
10930
10915
|
case "seconds":
|
|
10931
10916
|
case "s":
|
|
10932
|
-
|
|
10917
|
+
numericDate = Math.round(value6);
|
|
10918
|
+
break;
|
|
10933
10919
|
case "minute":
|
|
10934
10920
|
case "minutes":
|
|
10935
10921
|
case "min":
|
|
10936
10922
|
case "mins":
|
|
10937
10923
|
case "m":
|
|
10938
|
-
|
|
10924
|
+
numericDate = Math.round(value6 * minute);
|
|
10925
|
+
break;
|
|
10939
10926
|
case "hour":
|
|
10940
10927
|
case "hours":
|
|
10941
10928
|
case "hr":
|
|
10942
10929
|
case "hrs":
|
|
10943
10930
|
case "h":
|
|
10944
|
-
|
|
10931
|
+
numericDate = Math.round(value6 * hour);
|
|
10932
|
+
break;
|
|
10945
10933
|
case "day":
|
|
10946
10934
|
case "days":
|
|
10947
10935
|
case "d":
|
|
10948
|
-
|
|
10936
|
+
numericDate = Math.round(value6 * day);
|
|
10937
|
+
break;
|
|
10949
10938
|
case "week":
|
|
10950
10939
|
case "weeks":
|
|
10951
10940
|
case "w":
|
|
10952
|
-
|
|
10941
|
+
numericDate = Math.round(value6 * week);
|
|
10942
|
+
break;
|
|
10953
10943
|
default:
|
|
10954
|
-
|
|
10944
|
+
numericDate = Math.round(value6 * year);
|
|
10945
|
+
break;
|
|
10946
|
+
}
|
|
10947
|
+
if (matched[1] === "-" || matched[4] === "ago") {
|
|
10948
|
+
return -numericDate;
|
|
10955
10949
|
}
|
|
10950
|
+
return numericDate;
|
|
10956
10951
|
};
|
|
10957
10952
|
|
|
10958
|
-
// ../node_modules/jose/dist/browser/lib/jwt_claims_set.js
|
|
10953
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/jwt_claims_set.js
|
|
10959
10954
|
var normalizeTyp = (value6) => value6.toLowerCase().replace(/^application\//, "");
|
|
10960
10955
|
var checkAudiencePresence = (audPayload, audOption) => {
|
|
10961
10956
|
if (typeof audPayload === "string") {
|
|
@@ -10974,21 +10969,22 @@ var jwt_claims_set_default = (protectedHeader, encodedPayload, options = {}) =>
|
|
|
10974
10969
|
let payload4;
|
|
10975
10970
|
try {
|
|
10976
10971
|
payload4 = JSON.parse(decoder.decode(encodedPayload));
|
|
10977
|
-
} catch
|
|
10972
|
+
} catch {
|
|
10978
10973
|
}
|
|
10979
10974
|
if (!isObject(payload4)) {
|
|
10980
10975
|
throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");
|
|
10981
10976
|
}
|
|
10982
10977
|
const { requiredClaims = [], issuer: issuer2, subject: subject5, audience: audience5, maxTokenAge } = options;
|
|
10978
|
+
const presenceCheck = [...requiredClaims];
|
|
10983
10979
|
if (maxTokenAge !== void 0)
|
|
10984
|
-
|
|
10980
|
+
presenceCheck.push("iat");
|
|
10985
10981
|
if (audience5 !== void 0)
|
|
10986
|
-
|
|
10982
|
+
presenceCheck.push("aud");
|
|
10987
10983
|
if (subject5 !== void 0)
|
|
10988
|
-
|
|
10984
|
+
presenceCheck.push("sub");
|
|
10989
10985
|
if (issuer2 !== void 0)
|
|
10990
|
-
|
|
10991
|
-
for (const claim2 of new Set(
|
|
10986
|
+
presenceCheck.push("iss");
|
|
10987
|
+
for (const claim2 of new Set(presenceCheck.reverse())) {
|
|
10992
10988
|
if (!(claim2 in payload4)) {
|
|
10993
10989
|
throw new JWTClaimValidationFailed(`missing required "${claim2}" claim`, claim2, "missing");
|
|
10994
10990
|
}
|
|
@@ -11050,11 +11046,10 @@ var jwt_claims_set_default = (protectedHeader, encodedPayload, options = {}) =>
|
|
|
11050
11046
|
return payload4;
|
|
11051
11047
|
};
|
|
11052
11048
|
|
|
11053
|
-
// ../node_modules/jose/dist/browser/jwt/verify.js
|
|
11049
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwt/verify.js
|
|
11054
11050
|
async function jwtVerify(jwt, key3, options) {
|
|
11055
|
-
var _a;
|
|
11056
11051
|
const verified2 = await compactVerify(jwt, key3, options);
|
|
11057
|
-
if (
|
|
11052
|
+
if (verified2.protectedHeader.crit?.includes("b64") && verified2.protectedHeader.b64 === false) {
|
|
11058
11053
|
throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
|
|
11059
11054
|
}
|
|
11060
11055
|
const payload4 = jwt_claims_set_default(verified2.protectedHeader, verified2.payload, options);
|
|
@@ -11065,7 +11060,7 @@ async function jwtVerify(jwt, key3, options) {
|
|
|
11065
11060
|
return result5;
|
|
11066
11061
|
}
|
|
11067
11062
|
|
|
11068
|
-
// ../node_modules/jose/dist/browser/runtime/sign.js
|
|
11063
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/sign.js
|
|
11069
11064
|
var sign = async (alg, key3, data2) => {
|
|
11070
11065
|
const cryptoKey = await getCryptoKey(alg, key3, "sign");
|
|
11071
11066
|
check_key_length_default(alg, cryptoKey);
|
|
@@ -11074,7 +11069,7 @@ var sign = async (alg, key3, data2) => {
|
|
|
11074
11069
|
};
|
|
11075
11070
|
var sign_default = sign;
|
|
11076
11071
|
|
|
11077
|
-
// ../node_modules/jose/dist/browser/jws/flattened/sign.js
|
|
11072
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jws/flattened/sign.js
|
|
11078
11073
|
var FlattenedSign = class {
|
|
11079
11074
|
constructor(payload4) {
|
|
11080
11075
|
if (!(payload4 instanceof Uint8Array)) {
|
|
@@ -11107,7 +11102,7 @@ var FlattenedSign = class {
|
|
|
11107
11102
|
...this._protectedHeader,
|
|
11108
11103
|
...this._unprotectedHeader
|
|
11109
11104
|
};
|
|
11110
|
-
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options
|
|
11105
|
+
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options?.crit, this._protectedHeader, joseHeader);
|
|
11111
11106
|
let b64 = true;
|
|
11112
11107
|
if (extensions.has("b64")) {
|
|
11113
11108
|
b64 = this._protectedHeader.b64;
|
|
@@ -11149,7 +11144,7 @@ var FlattenedSign = class {
|
|
|
11149
11144
|
}
|
|
11150
11145
|
};
|
|
11151
11146
|
|
|
11152
|
-
// ../node_modules/jose/dist/browser/jws/compact/sign.js
|
|
11147
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jws/compact/sign.js
|
|
11153
11148
|
var CompactSign = class {
|
|
11154
11149
|
constructor(payload4) {
|
|
11155
11150
|
this._flattened = new FlattenedSign(payload4);
|
|
@@ -11167,9 +11162,15 @@ var CompactSign = class {
|
|
|
11167
11162
|
}
|
|
11168
11163
|
};
|
|
11169
11164
|
|
|
11170
|
-
// ../node_modules/jose/dist/browser/jwt/produce.js
|
|
11165
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwt/produce.js
|
|
11166
|
+
function validateInput(label4, input2) {
|
|
11167
|
+
if (!Number.isFinite(input2)) {
|
|
11168
|
+
throw new TypeError(`Invalid ${label4} input`);
|
|
11169
|
+
}
|
|
11170
|
+
return input2;
|
|
11171
|
+
}
|
|
11171
11172
|
var ProduceJWT = class {
|
|
11172
|
-
constructor(payload4) {
|
|
11173
|
+
constructor(payload4 = {}) {
|
|
11173
11174
|
if (!isObject(payload4)) {
|
|
11174
11175
|
throw new TypeError("JWT Claims Set MUST be an object");
|
|
11175
11176
|
}
|
|
@@ -11193,7 +11194,9 @@ var ProduceJWT = class {
|
|
|
11193
11194
|
}
|
|
11194
11195
|
setNotBefore(input2) {
|
|
11195
11196
|
if (typeof input2 === "number") {
|
|
11196
|
-
this._payload = { ...this._payload, nbf: input2 };
|
|
11197
|
+
this._payload = { ...this._payload, nbf: validateInput("setNotBefore", input2) };
|
|
11198
|
+
} else if (input2 instanceof Date) {
|
|
11199
|
+
this._payload = { ...this._payload, nbf: validateInput("setNotBefore", epoch_default(input2)) };
|
|
11197
11200
|
} else {
|
|
11198
11201
|
this._payload = { ...this._payload, nbf: epoch_default(/* @__PURE__ */ new Date()) + secs_default(input2) };
|
|
11199
11202
|
}
|
|
@@ -11201,7 +11204,9 @@ var ProduceJWT = class {
|
|
|
11201
11204
|
}
|
|
11202
11205
|
setExpirationTime(input2) {
|
|
11203
11206
|
if (typeof input2 === "number") {
|
|
11204
|
-
this._payload = { ...this._payload, exp: input2 };
|
|
11207
|
+
this._payload = { ...this._payload, exp: validateInput("setExpirationTime", input2) };
|
|
11208
|
+
} else if (input2 instanceof Date) {
|
|
11209
|
+
this._payload = { ...this._payload, exp: validateInput("setExpirationTime", epoch_default(input2)) };
|
|
11205
11210
|
} else {
|
|
11206
11211
|
this._payload = { ...this._payload, exp: epoch_default(/* @__PURE__ */ new Date()) + secs_default(input2) };
|
|
11207
11212
|
}
|
|
@@ -11210,41 +11215,294 @@ var ProduceJWT = class {
|
|
|
11210
11215
|
setIssuedAt(input2) {
|
|
11211
11216
|
if (typeof input2 === "undefined") {
|
|
11212
11217
|
this._payload = { ...this._payload, iat: epoch_default(/* @__PURE__ */ new Date()) };
|
|
11218
|
+
} else if (input2 instanceof Date) {
|
|
11219
|
+
this._payload = { ...this._payload, iat: validateInput("setIssuedAt", epoch_default(input2)) };
|
|
11220
|
+
} else if (typeof input2 === "string") {
|
|
11221
|
+
this._payload = {
|
|
11222
|
+
...this._payload,
|
|
11223
|
+
iat: validateInput("setIssuedAt", epoch_default(/* @__PURE__ */ new Date()) + secs_default(input2))
|
|
11224
|
+
};
|
|
11213
11225
|
} else {
|
|
11214
|
-
this._payload = { ...this._payload, iat: input2 };
|
|
11226
|
+
this._payload = { ...this._payload, iat: validateInput("setIssuedAt", input2) };
|
|
11215
11227
|
}
|
|
11216
11228
|
return this;
|
|
11217
11229
|
}
|
|
11218
11230
|
};
|
|
11219
11231
|
|
|
11220
|
-
// ../node_modules/jose/dist/browser/jwt/sign.js
|
|
11232
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwt/sign.js
|
|
11221
11233
|
var SignJWT = class extends ProduceJWT {
|
|
11222
11234
|
setProtectedHeader(protectedHeader) {
|
|
11223
11235
|
this._protectedHeader = protectedHeader;
|
|
11224
11236
|
return this;
|
|
11225
11237
|
}
|
|
11226
11238
|
async sign(key3, options) {
|
|
11227
|
-
var _a;
|
|
11228
11239
|
const sig = new CompactSign(encoder.encode(JSON.stringify(this._payload)));
|
|
11229
11240
|
sig.setProtectedHeader(this._protectedHeader);
|
|
11230
|
-
if (Array.isArray(
|
|
11241
|
+
if (Array.isArray(this._protectedHeader?.crit) && this._protectedHeader.crit.includes("b64") && this._protectedHeader.b64 === false) {
|
|
11231
11242
|
throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
|
|
11232
11243
|
}
|
|
11233
11244
|
return sig.sign(key3, options);
|
|
11234
11245
|
}
|
|
11235
11246
|
};
|
|
11236
11247
|
|
|
11237
|
-
// ../node_modules/jose/dist/browser/
|
|
11248
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwks/local.js
|
|
11249
|
+
function getKtyFromAlg(alg) {
|
|
11250
|
+
switch (typeof alg === "string" && alg.slice(0, 2)) {
|
|
11251
|
+
case "RS":
|
|
11252
|
+
case "PS":
|
|
11253
|
+
return "RSA";
|
|
11254
|
+
case "ES":
|
|
11255
|
+
return "EC";
|
|
11256
|
+
case "Ed":
|
|
11257
|
+
return "OKP";
|
|
11258
|
+
default:
|
|
11259
|
+
throw new JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set');
|
|
11260
|
+
}
|
|
11261
|
+
}
|
|
11262
|
+
function isJWKSLike(jwks) {
|
|
11263
|
+
return jwks && typeof jwks === "object" && Array.isArray(jwks.keys) && jwks.keys.every(isJWKLike);
|
|
11264
|
+
}
|
|
11265
|
+
function isJWKLike(key3) {
|
|
11266
|
+
return isObject(key3);
|
|
11267
|
+
}
|
|
11268
|
+
function clone(obj) {
|
|
11269
|
+
if (typeof structuredClone === "function") {
|
|
11270
|
+
return structuredClone(obj);
|
|
11271
|
+
}
|
|
11272
|
+
return JSON.parse(JSON.stringify(obj));
|
|
11273
|
+
}
|
|
11274
|
+
var LocalJWKSet = class {
|
|
11275
|
+
constructor(jwks) {
|
|
11276
|
+
this._cached = /* @__PURE__ */ new WeakMap();
|
|
11277
|
+
if (!isJWKSLike(jwks)) {
|
|
11278
|
+
throw new JWKSInvalid("JSON Web Key Set malformed");
|
|
11279
|
+
}
|
|
11280
|
+
this._jwks = clone(jwks);
|
|
11281
|
+
}
|
|
11282
|
+
async getKey(protectedHeader, token) {
|
|
11283
|
+
const { alg, kid } = { ...protectedHeader, ...token?.header };
|
|
11284
|
+
const kty = getKtyFromAlg(alg);
|
|
11285
|
+
const candidates = this._jwks.keys.filter((jwk2) => {
|
|
11286
|
+
let candidate4 = kty === jwk2.kty;
|
|
11287
|
+
if (candidate4 && typeof kid === "string") {
|
|
11288
|
+
candidate4 = kid === jwk2.kid;
|
|
11289
|
+
}
|
|
11290
|
+
if (candidate4 && typeof jwk2.alg === "string") {
|
|
11291
|
+
candidate4 = alg === jwk2.alg;
|
|
11292
|
+
}
|
|
11293
|
+
if (candidate4 && typeof jwk2.use === "string") {
|
|
11294
|
+
candidate4 = jwk2.use === "sig";
|
|
11295
|
+
}
|
|
11296
|
+
if (candidate4 && Array.isArray(jwk2.key_ops)) {
|
|
11297
|
+
candidate4 = jwk2.key_ops.includes("verify");
|
|
11298
|
+
}
|
|
11299
|
+
if (candidate4 && alg === "EdDSA") {
|
|
11300
|
+
candidate4 = jwk2.crv === "Ed25519" || jwk2.crv === "Ed448";
|
|
11301
|
+
}
|
|
11302
|
+
if (candidate4) {
|
|
11303
|
+
switch (alg) {
|
|
11304
|
+
case "ES256":
|
|
11305
|
+
candidate4 = jwk2.crv === "P-256";
|
|
11306
|
+
break;
|
|
11307
|
+
case "ES256K":
|
|
11308
|
+
candidate4 = jwk2.crv === "secp256k1";
|
|
11309
|
+
break;
|
|
11310
|
+
case "ES384":
|
|
11311
|
+
candidate4 = jwk2.crv === "P-384";
|
|
11312
|
+
break;
|
|
11313
|
+
case "ES512":
|
|
11314
|
+
candidate4 = jwk2.crv === "P-521";
|
|
11315
|
+
break;
|
|
11316
|
+
}
|
|
11317
|
+
}
|
|
11318
|
+
return candidate4;
|
|
11319
|
+
});
|
|
11320
|
+
const { 0: jwk, length: length2 } = candidates;
|
|
11321
|
+
if (length2 === 0) {
|
|
11322
|
+
throw new JWKSNoMatchingKey();
|
|
11323
|
+
}
|
|
11324
|
+
if (length2 !== 1) {
|
|
11325
|
+
const error4 = new JWKSMultipleMatchingKeys();
|
|
11326
|
+
const { _cached } = this;
|
|
11327
|
+
error4[Symbol.asyncIterator] = async function* () {
|
|
11328
|
+
for (const jwk2 of candidates) {
|
|
11329
|
+
try {
|
|
11330
|
+
yield await importWithAlgCache(_cached, jwk2, alg);
|
|
11331
|
+
} catch {
|
|
11332
|
+
}
|
|
11333
|
+
}
|
|
11334
|
+
};
|
|
11335
|
+
throw error4;
|
|
11336
|
+
}
|
|
11337
|
+
return importWithAlgCache(this._cached, jwk, alg);
|
|
11338
|
+
}
|
|
11339
|
+
};
|
|
11340
|
+
async function importWithAlgCache(cache, jwk, alg) {
|
|
11341
|
+
const cached = cache.get(jwk) || cache.set(jwk, {}).get(jwk);
|
|
11342
|
+
if (cached[alg] === void 0) {
|
|
11343
|
+
const key3 = await importJWK({ ...jwk, ext: true }, alg);
|
|
11344
|
+
if (key3 instanceof Uint8Array || key3.type !== "public") {
|
|
11345
|
+
throw new JWKSInvalid("JSON Web Key Set members must be public keys");
|
|
11346
|
+
}
|
|
11347
|
+
cached[alg] = key3;
|
|
11348
|
+
}
|
|
11349
|
+
return cached[alg];
|
|
11350
|
+
}
|
|
11351
|
+
function createLocalJWKSet(jwks) {
|
|
11352
|
+
const set = new LocalJWKSet(jwks);
|
|
11353
|
+
const localJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token);
|
|
11354
|
+
Object.defineProperties(localJWKSet, {
|
|
11355
|
+
jwks: {
|
|
11356
|
+
value: () => clone(set._jwks),
|
|
11357
|
+
enumerable: true,
|
|
11358
|
+
configurable: false,
|
|
11359
|
+
writable: false
|
|
11360
|
+
}
|
|
11361
|
+
});
|
|
11362
|
+
return localJWKSet;
|
|
11363
|
+
}
|
|
11364
|
+
|
|
11365
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/fetch_jwks.js
|
|
11366
|
+
var fetchJwks = async (url7, timeout2, options) => {
|
|
11367
|
+
let controller2;
|
|
11368
|
+
let id4;
|
|
11369
|
+
let timedOut = false;
|
|
11370
|
+
if (typeof AbortController === "function") {
|
|
11371
|
+
controller2 = new AbortController();
|
|
11372
|
+
id4 = setTimeout(() => {
|
|
11373
|
+
timedOut = true;
|
|
11374
|
+
controller2.abort();
|
|
11375
|
+
}, timeout2);
|
|
11376
|
+
}
|
|
11377
|
+
const response6 = await fetch(url7.href, {
|
|
11378
|
+
signal: controller2 ? controller2.signal : void 0,
|
|
11379
|
+
redirect: "manual",
|
|
11380
|
+
headers: options.headers
|
|
11381
|
+
}).catch((err) => {
|
|
11382
|
+
if (timedOut)
|
|
11383
|
+
throw new JWKSTimeout();
|
|
11384
|
+
throw err;
|
|
11385
|
+
});
|
|
11386
|
+
if (id4 !== void 0)
|
|
11387
|
+
clearTimeout(id4);
|
|
11388
|
+
if (response6.status !== 200) {
|
|
11389
|
+
throw new JOSEError("Expected 200 OK from the JSON Web Key Set HTTP response");
|
|
11390
|
+
}
|
|
11391
|
+
try {
|
|
11392
|
+
return await response6.json();
|
|
11393
|
+
} catch {
|
|
11394
|
+
throw new JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON");
|
|
11395
|
+
}
|
|
11396
|
+
};
|
|
11397
|
+
var fetch_jwks_default = fetchJwks;
|
|
11398
|
+
|
|
11399
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwks/remote.js
|
|
11400
|
+
function isCloudflareWorkers() {
|
|
11401
|
+
return typeof WebSocketPair !== "undefined" || typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime !== "undefined" && EdgeRuntime === "vercel";
|
|
11402
|
+
}
|
|
11403
|
+
var USER_AGENT;
|
|
11404
|
+
if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
|
|
11405
|
+
const NAME = "jose";
|
|
11406
|
+
const VERSION = "v5.3.0";
|
|
11407
|
+
USER_AGENT = `${NAME}/${VERSION}`;
|
|
11408
|
+
}
|
|
11409
|
+
var RemoteJWKSet = class {
|
|
11410
|
+
constructor(url7, options) {
|
|
11411
|
+
if (!(url7 instanceof URL)) {
|
|
11412
|
+
throw new TypeError("url must be an instance of URL");
|
|
11413
|
+
}
|
|
11414
|
+
this._url = new URL(url7.href);
|
|
11415
|
+
this._options = { agent: options?.agent, headers: options?.headers };
|
|
11416
|
+
this._timeoutDuration = typeof options?.timeoutDuration === "number" ? options?.timeoutDuration : 5e3;
|
|
11417
|
+
this._cooldownDuration = typeof options?.cooldownDuration === "number" ? options?.cooldownDuration : 3e4;
|
|
11418
|
+
this._cacheMaxAge = typeof options?.cacheMaxAge === "number" ? options?.cacheMaxAge : 6e5;
|
|
11419
|
+
}
|
|
11420
|
+
coolingDown() {
|
|
11421
|
+
return typeof this._jwksTimestamp === "number" ? Date.now() < this._jwksTimestamp + this._cooldownDuration : false;
|
|
11422
|
+
}
|
|
11423
|
+
fresh() {
|
|
11424
|
+
return typeof this._jwksTimestamp === "number" ? Date.now() < this._jwksTimestamp + this._cacheMaxAge : false;
|
|
11425
|
+
}
|
|
11426
|
+
async getKey(protectedHeader, token) {
|
|
11427
|
+
if (!this._local || !this.fresh()) {
|
|
11428
|
+
await this.reload();
|
|
11429
|
+
}
|
|
11430
|
+
try {
|
|
11431
|
+
return await this._local(protectedHeader, token);
|
|
11432
|
+
} catch (err) {
|
|
11433
|
+
if (err instanceof JWKSNoMatchingKey) {
|
|
11434
|
+
if (this.coolingDown() === false) {
|
|
11435
|
+
await this.reload();
|
|
11436
|
+
return this._local(protectedHeader, token);
|
|
11437
|
+
}
|
|
11438
|
+
}
|
|
11439
|
+
throw err;
|
|
11440
|
+
}
|
|
11441
|
+
}
|
|
11442
|
+
async reload() {
|
|
11443
|
+
if (this._pendingFetch && isCloudflareWorkers()) {
|
|
11444
|
+
this._pendingFetch = void 0;
|
|
11445
|
+
}
|
|
11446
|
+
const headers = new Headers(this._options.headers);
|
|
11447
|
+
if (USER_AGENT && !headers.has("User-Agent")) {
|
|
11448
|
+
headers.set("User-Agent", USER_AGENT);
|
|
11449
|
+
this._options.headers = Object.fromEntries(headers.entries());
|
|
11450
|
+
}
|
|
11451
|
+
this._pendingFetch || (this._pendingFetch = fetch_jwks_default(this._url, this._timeoutDuration, this._options).then((json) => {
|
|
11452
|
+
this._local = createLocalJWKSet(json);
|
|
11453
|
+
this._jwksTimestamp = Date.now();
|
|
11454
|
+
this._pendingFetch = void 0;
|
|
11455
|
+
}).catch((err) => {
|
|
11456
|
+
this._pendingFetch = void 0;
|
|
11457
|
+
throw err;
|
|
11458
|
+
}));
|
|
11459
|
+
await this._pendingFetch;
|
|
11460
|
+
}
|
|
11461
|
+
};
|
|
11462
|
+
function createRemoteJWKSet(url7, options) {
|
|
11463
|
+
const set = new RemoteJWKSet(url7, options);
|
|
11464
|
+
const remoteJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token);
|
|
11465
|
+
Object.defineProperties(remoteJWKSet, {
|
|
11466
|
+
coolingDown: {
|
|
11467
|
+
get: () => set.coolingDown(),
|
|
11468
|
+
enumerable: true,
|
|
11469
|
+
configurable: false
|
|
11470
|
+
},
|
|
11471
|
+
fresh: {
|
|
11472
|
+
get: () => set.fresh(),
|
|
11473
|
+
enumerable: true,
|
|
11474
|
+
configurable: false
|
|
11475
|
+
},
|
|
11476
|
+
reload: {
|
|
11477
|
+
value: () => set.reload(),
|
|
11478
|
+
enumerable: true,
|
|
11479
|
+
configurable: false,
|
|
11480
|
+
writable: false
|
|
11481
|
+
},
|
|
11482
|
+
reloading: {
|
|
11483
|
+
get: () => !!set._pendingFetch,
|
|
11484
|
+
enumerable: true,
|
|
11485
|
+
configurable: false
|
|
11486
|
+
},
|
|
11487
|
+
jwks: {
|
|
11488
|
+
value: () => set._local?.jwks(),
|
|
11489
|
+
enumerable: true,
|
|
11490
|
+
configurable: false,
|
|
11491
|
+
writable: false
|
|
11492
|
+
}
|
|
11493
|
+
});
|
|
11494
|
+
return remoteJWKSet;
|
|
11495
|
+
}
|
|
11496
|
+
|
|
11497
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/generate.js
|
|
11238
11498
|
function getModulusLengthOption(options) {
|
|
11239
|
-
|
|
11240
|
-
const modulusLength = (_a = options === null || options === void 0 ? void 0 : options.modulusLength) !== null && _a !== void 0 ? _a : 2048;
|
|
11499
|
+
const modulusLength = options?.modulusLength ?? 2048;
|
|
11241
11500
|
if (typeof modulusLength !== "number" || modulusLength < 2048) {
|
|
11242
11501
|
throw new JOSENotSupported("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");
|
|
11243
11502
|
}
|
|
11244
11503
|
return modulusLength;
|
|
11245
11504
|
}
|
|
11246
11505
|
async function generateKeyPair(alg, options) {
|
|
11247
|
-
var _a, _b, _c;
|
|
11248
11506
|
let algorithm3;
|
|
11249
11507
|
let keyUsages;
|
|
11250
11508
|
switch (alg) {
|
|
@@ -11294,9 +11552,9 @@ async function generateKeyPair(alg, options) {
|
|
|
11294
11552
|
algorithm3 = { name: "ECDSA", namedCurve: "P-521" };
|
|
11295
11553
|
keyUsages = ["sign", "verify"];
|
|
11296
11554
|
break;
|
|
11297
|
-
case "EdDSA":
|
|
11555
|
+
case "EdDSA": {
|
|
11298
11556
|
keyUsages = ["sign", "verify"];
|
|
11299
|
-
const crv =
|
|
11557
|
+
const crv = options?.crv ?? "Ed25519";
|
|
11300
11558
|
switch (crv) {
|
|
11301
11559
|
case "Ed25519":
|
|
11302
11560
|
case "Ed448":
|
|
@@ -11306,22 +11564,23 @@ async function generateKeyPair(alg, options) {
|
|
|
11306
11564
|
throw new JOSENotSupported("Invalid or unsupported crv option provided");
|
|
11307
11565
|
}
|
|
11308
11566
|
break;
|
|
11567
|
+
}
|
|
11309
11568
|
case "ECDH-ES":
|
|
11310
11569
|
case "ECDH-ES+A128KW":
|
|
11311
11570
|
case "ECDH-ES+A192KW":
|
|
11312
11571
|
case "ECDH-ES+A256KW": {
|
|
11313
11572
|
keyUsages = ["deriveKey", "deriveBits"];
|
|
11314
|
-
const
|
|
11315
|
-
switch (
|
|
11573
|
+
const crv = options?.crv ?? "P-256";
|
|
11574
|
+
switch (crv) {
|
|
11316
11575
|
case "P-256":
|
|
11317
11576
|
case "P-384":
|
|
11318
11577
|
case "P-521": {
|
|
11319
|
-
algorithm3 = { name: "ECDH", namedCurve:
|
|
11578
|
+
algorithm3 = { name: "ECDH", namedCurve: crv };
|
|
11320
11579
|
break;
|
|
11321
11580
|
}
|
|
11322
11581
|
case "X25519":
|
|
11323
11582
|
case "X448":
|
|
11324
|
-
algorithm3 = { name:
|
|
11583
|
+
algorithm3 = { name: crv };
|
|
11325
11584
|
break;
|
|
11326
11585
|
default:
|
|
11327
11586
|
throw new JOSENotSupported("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448");
|
|
@@ -11331,10 +11590,10 @@ async function generateKeyPair(alg, options) {
|
|
|
11331
11590
|
default:
|
|
11332
11591
|
throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
11333
11592
|
}
|
|
11334
|
-
return webcrypto_default.subtle.generateKey(algorithm3,
|
|
11593
|
+
return webcrypto_default.subtle.generateKey(algorithm3, options?.extractable ?? false, keyUsages);
|
|
11335
11594
|
}
|
|
11336
11595
|
|
|
11337
|
-
// ../node_modules/jose/dist/browser/key/generate_key_pair.js
|
|
11596
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/key/generate_key_pair.js
|
|
11338
11597
|
async function generateKeyPair2(alg, options) {
|
|
11339
11598
|
return generateKeyPair(alg, options);
|
|
11340
11599
|
}
|
|
@@ -11406,17 +11665,6 @@ var SCOPE_OPENID = "openid";
|
|
|
11406
11665
|
var SCOPE_OFFLINE = "offline_access";
|
|
11407
11666
|
var SCOPE_WEBID = "webid";
|
|
11408
11667
|
var DEFAULT_SCOPES = [SCOPE_OPENID, SCOPE_OFFLINE, SCOPE_WEBID].join(" ");
|
|
11409
|
-
var buildProxyHandler = (toExclude, errorMessage) => ({
|
|
11410
|
-
// This proxy is only a temporary measure until Session no longer extends
|
|
11411
|
-
// SessionEventEmitter, and the proxying is no longer necessary.
|
|
11412
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11413
|
-
get(target5, prop, receiver2) {
|
|
11414
|
-
if (!Object.getOwnPropertyNames(import_events.EventEmitter).includes(prop) && Object.getOwnPropertyNames(toExclude).includes(prop)) {
|
|
11415
|
-
throw new Error(`${errorMessage}: [${prop}] is not supported`);
|
|
11416
|
-
}
|
|
11417
|
-
return Reflect.get(target5, prop, receiver2);
|
|
11418
|
-
}
|
|
11419
|
-
});
|
|
11420
11668
|
var AggregateHandler = class {
|
|
11421
11669
|
constructor(handleables) {
|
|
11422
11670
|
this.handleables = handleables;
|
|
@@ -11453,24 +11701,10 @@ var AggregateHandler = class {
|
|
|
11453
11701
|
}).join(", ")}`);
|
|
11454
11702
|
}
|
|
11455
11703
|
};
|
|
11456
|
-
async function fetchJwks(jwksIri, issuerIri) {
|
|
11457
|
-
const jwksResponse = await fetch2.call(globalThis, jwksIri);
|
|
11458
|
-
if (jwksResponse.status !== 200) {
|
|
11459
|
-
throw new Error(`Could not fetch JWKS for [${issuerIri}] at [${jwksIri}]: ${jwksResponse.status} ${jwksResponse.statusText}`);
|
|
11460
|
-
}
|
|
11461
|
-
let jwk;
|
|
11462
|
-
try {
|
|
11463
|
-
jwk = (await jwksResponse.json()).keys[0];
|
|
11464
|
-
} catch (e) {
|
|
11465
|
-
throw new Error(`Malformed JWKS for [${issuerIri}] at [${jwksIri}]: ${e.message}`);
|
|
11466
|
-
}
|
|
11467
|
-
return jwk;
|
|
11468
|
-
}
|
|
11469
11704
|
async function getWebidFromTokenPayload(idToken, jwksIri, issuerIri, clientId) {
|
|
11470
|
-
const jwk = await fetchJwks(jwksIri, issuerIri);
|
|
11471
11705
|
let payload4;
|
|
11472
11706
|
try {
|
|
11473
|
-
const { payload: verifiedPayload } = await jwtVerify(idToken,
|
|
11707
|
+
const { payload: verifiedPayload } = await jwtVerify(idToken, createRemoteJWKSet(new URL(jwksIri)), {
|
|
11474
11708
|
issuer: issuerIri,
|
|
11475
11709
|
audience: clientId
|
|
11476
11710
|
});
|
|
@@ -11510,17 +11744,29 @@ function removeOpenIdParams(redirectUrl) {
|
|
|
11510
11744
|
cleanedUpUrl.searchParams.delete("iss");
|
|
11511
11745
|
return cleanedUpUrl;
|
|
11512
11746
|
}
|
|
11747
|
+
function booleanWithFallback(value6, fallback) {
|
|
11748
|
+
if (typeof value6 === "boolean") {
|
|
11749
|
+
return Boolean(value6);
|
|
11750
|
+
}
|
|
11751
|
+
return Boolean(fallback);
|
|
11752
|
+
}
|
|
11513
11753
|
var AuthorizationCodeWithPkceOidcHandlerBase = class {
|
|
11514
11754
|
constructor(storageUtility, redirector) {
|
|
11515
11755
|
this.storageUtility = storageUtility;
|
|
11516
11756
|
this.redirector = redirector;
|
|
11757
|
+
this.parametersGuard = (oidcLoginOptions) => {
|
|
11758
|
+
return oidcLoginOptions.issuerConfiguration.grantTypesSupported !== void 0 && oidcLoginOptions.issuerConfiguration.grantTypesSupported.indexOf("authorization_code") > -1 && oidcLoginOptions.redirectUrl !== void 0;
|
|
11759
|
+
};
|
|
11517
11760
|
this.storageUtility = storageUtility;
|
|
11518
11761
|
this.redirector = redirector;
|
|
11519
11762
|
}
|
|
11520
11763
|
async canHandle(oidcLoginOptions) {
|
|
11521
|
-
return
|
|
11764
|
+
return this.parametersGuard(oidcLoginOptions);
|
|
11522
11765
|
}
|
|
11523
11766
|
async handleRedirect({ oidcLoginOptions, state: state2, codeVerifier, targetUrl: targetUrl3 }) {
|
|
11767
|
+
if (!this.parametersGuard(oidcLoginOptions)) {
|
|
11768
|
+
throw new Error("The authorization code grant requires a redirectUrl.");
|
|
11769
|
+
}
|
|
11524
11770
|
await Promise.all([
|
|
11525
11771
|
// We use the OAuth 'state' value (which should be crypto-random) as
|
|
11526
11772
|
// the key in our storage to store our actual SessionID. We do this
|
|
@@ -11531,7 +11777,6 @@ var AuthorizationCodeWithPkceOidcHandlerBase = class {
|
|
|
11531
11777
|
// that session ID can be any developer-specified value, and therefore
|
|
11532
11778
|
// may not be appropriate (since the OAuth 'state' value should really
|
|
11533
11779
|
// be an unguessable crypto-random value).
|
|
11534
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
11535
11780
|
this.storageUtility.setForUser(state2, {
|
|
11536
11781
|
sessionId: oidcLoginOptions.sessionId
|
|
11537
11782
|
}),
|
|
@@ -11540,12 +11785,12 @@ var AuthorizationCodeWithPkceOidcHandlerBase = class {
|
|
|
11540
11785
|
// our session ID is unnecessary, but it provides a slightly cleaner
|
|
11541
11786
|
// separation of concerns.
|
|
11542
11787
|
this.storageUtility.setForUser(oidcLoginOptions.sessionId, {
|
|
11543
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
11544
11788
|
codeVerifier,
|
|
11545
11789
|
issuer: oidcLoginOptions.issuer.toString(),
|
|
11546
11790
|
// The redirect URL is read after redirect, so it must be stored now.
|
|
11547
11791
|
redirectUrl: oidcLoginOptions.redirectUrl,
|
|
11548
|
-
dpop: oidcLoginOptions.dpop
|
|
11792
|
+
dpop: Boolean(oidcLoginOptions.dpop).toString(),
|
|
11793
|
+
keepAlive: booleanWithFallback(oidcLoginOptions.keepAlive, true).toString()
|
|
11549
11794
|
})
|
|
11550
11795
|
]);
|
|
11551
11796
|
this.redirector.redirect(targetUrl3, {
|
|
@@ -11607,7 +11852,7 @@ function getUnauthenticatedSession() {
|
|
|
11607
11852
|
return {
|
|
11608
11853
|
isLoggedIn: false,
|
|
11609
11854
|
sessionId: v4_default(),
|
|
11610
|
-
fetch: (...args) =>
|
|
11855
|
+
fetch: (...args) => fetch(...args)
|
|
11611
11856
|
};
|
|
11612
11857
|
}
|
|
11613
11858
|
async function clear(sessionId, storage2) {
|
|
@@ -11701,48 +11946,51 @@ function determineSigningAlg(supported, preferred2) {
|
|
|
11701
11946
|
return supported.includes(signingAlg);
|
|
11702
11947
|
})) !== null && _a !== void 0 ? _a : null;
|
|
11703
11948
|
}
|
|
11704
|
-
function
|
|
11705
|
-
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
return "dynamic";
|
|
11949
|
+
function isStaticClient(options) {
|
|
11950
|
+
return options.clientId !== void 0 && !isValidUrl(options.clientId);
|
|
11951
|
+
}
|
|
11952
|
+
function isSolidOidcClient(options, issuerConfig) {
|
|
11953
|
+
return issuerConfig.scopesSupported.includes("webid") && options.clientId !== void 0 && isValidUrl(options.clientId);
|
|
11954
|
+
}
|
|
11955
|
+
function isKnownClientType(clientType) {
|
|
11956
|
+
return typeof clientType === "string" && ["dynamic", "static", "solid-oidc"].includes(clientType);
|
|
11712
11957
|
}
|
|
11713
11958
|
async function handleRegistration(options, issuerConfig, storageUtility, clientRegistrar) {
|
|
11714
|
-
|
|
11715
|
-
if (
|
|
11959
|
+
let clientInfo;
|
|
11960
|
+
if (isSolidOidcClient(options, issuerConfig)) {
|
|
11961
|
+
clientInfo = {
|
|
11962
|
+
clientId: options.clientId,
|
|
11963
|
+
clientName: options.clientName,
|
|
11964
|
+
clientType: "solid-oidc"
|
|
11965
|
+
};
|
|
11966
|
+
} else if (isStaticClient(options)) {
|
|
11967
|
+
clientInfo = {
|
|
11968
|
+
clientId: options.clientId,
|
|
11969
|
+
clientSecret: options.clientSecret,
|
|
11970
|
+
clientName: options.clientName,
|
|
11971
|
+
clientType: "static"
|
|
11972
|
+
};
|
|
11973
|
+
} else {
|
|
11716
11974
|
return clientRegistrar.getClient({
|
|
11717
11975
|
sessionId: options.sessionId,
|
|
11718
11976
|
clientName: options.clientName,
|
|
11719
11977
|
redirectUrl: options.redirectUrl
|
|
11720
11978
|
}, issuerConfig);
|
|
11721
11979
|
}
|
|
11722
|
-
|
|
11723
|
-
|
|
11724
|
-
|
|
11725
|
-
|
|
11726
|
-
|
|
11727
|
-
|
|
11728
|
-
await storageUtility.setForUser(options.sessionId, {
|
|
11729
|
-
clientSecret: options.clientSecret
|
|
11730
|
-
});
|
|
11980
|
+
const infoToSave = {
|
|
11981
|
+
clientId: clientInfo.clientId,
|
|
11982
|
+
clientType: clientInfo.clientType
|
|
11983
|
+
};
|
|
11984
|
+
if (clientInfo.clientType === "static") {
|
|
11985
|
+
infoToSave.clientSecret = clientInfo.clientSecret;
|
|
11731
11986
|
}
|
|
11732
|
-
if (
|
|
11733
|
-
|
|
11734
|
-
clientName: options.clientName
|
|
11735
|
-
});
|
|
11987
|
+
if (clientInfo.clientName) {
|
|
11988
|
+
infoToSave.clientName = clientInfo.clientName;
|
|
11736
11989
|
}
|
|
11737
|
-
|
|
11738
|
-
|
|
11739
|
-
clientId: options.clientId,
|
|
11740
|
-
clientSecret: options.clientSecret,
|
|
11741
|
-
clientName: options.clientName,
|
|
11742
|
-
clientType
|
|
11743
|
-
};
|
|
11990
|
+
await storageUtility.setForUser(options.sessionId, infoToSave);
|
|
11991
|
+
return clientInfo;
|
|
11744
11992
|
}
|
|
11745
|
-
var
|
|
11993
|
+
var boundFetch = (request2, init) => fetch(request2, init);
|
|
11746
11994
|
var ClientAuthentication = class {
|
|
11747
11995
|
constructor(loginHandler, redirectHandler, logoutHandler, sessionInfoManager, issuerConfigFetcher) {
|
|
11748
11996
|
this.loginHandler = loginHandler;
|
|
@@ -11750,13 +11998,13 @@ var ClientAuthentication = class {
|
|
|
11750
11998
|
this.logoutHandler = logoutHandler;
|
|
11751
11999
|
this.sessionInfoManager = sessionInfoManager;
|
|
11752
12000
|
this.issuerConfigFetcher = issuerConfigFetcher;
|
|
11753
|
-
this.fetch =
|
|
12001
|
+
this.fetch = boundFetch;
|
|
11754
12002
|
this.logout = async (sessionId, options) => {
|
|
11755
12003
|
await this.logoutHandler.handle(sessionId, (options === null || options === void 0 ? void 0 : options.logoutType) === "idp" ? {
|
|
11756
12004
|
...options,
|
|
11757
12005
|
toLogoutUrl: this.boundLogout
|
|
11758
12006
|
} : options);
|
|
11759
|
-
this.fetch =
|
|
12007
|
+
this.fetch = boundFetch;
|
|
11760
12008
|
delete this.boundLogout;
|
|
11761
12009
|
};
|
|
11762
12010
|
this.getSessionInfo = async (sessionId) => {
|
|
@@ -11774,13 +12022,14 @@ var ClientAuthentication = class {
|
|
|
11774
12022
|
};
|
|
11775
12023
|
async function loadOidcContextFromStorage(sessionId, storageUtility, configFetcher) {
|
|
11776
12024
|
try {
|
|
11777
|
-
const [issuerIri, codeVerifier, storedRedirectIri, dpop] = await Promise.all([
|
|
12025
|
+
const [issuerIri, codeVerifier, storedRedirectIri, dpop, keepAlive] = await Promise.all([
|
|
11778
12026
|
storageUtility.getForUser(sessionId, "issuer", {
|
|
11779
12027
|
errorIfNull: true
|
|
11780
12028
|
}),
|
|
11781
12029
|
storageUtility.getForUser(sessionId, "codeVerifier"),
|
|
11782
12030
|
storageUtility.getForUser(sessionId, "redirectUrl"),
|
|
11783
|
-
storageUtility.getForUser(sessionId, "dpop", { errorIfNull: true })
|
|
12031
|
+
storageUtility.getForUser(sessionId, "dpop", { errorIfNull: true }),
|
|
12032
|
+
storageUtility.getForUser(sessionId, "keepAlive")
|
|
11784
12033
|
]);
|
|
11785
12034
|
await storageUtility.deleteForUser(sessionId, "codeVerifier");
|
|
11786
12035
|
const issuerConfig = await configFetcher.fetchConfig(issuerIri);
|
|
@@ -11788,7 +12037,9 @@ async function loadOidcContextFromStorage(sessionId, storageUtility, configFetch
|
|
|
11788
12037
|
codeVerifier,
|
|
11789
12038
|
redirectUrl: storedRedirectIri,
|
|
11790
12039
|
issuerConfig,
|
|
11791
|
-
dpop: dpop === "true"
|
|
12040
|
+
dpop: dpop === "true",
|
|
12041
|
+
// Default keepAlive to true if not found in storage.
|
|
12042
|
+
keepAlive: typeof keepAlive === "string" ? keepAlive === "true" : true
|
|
11792
12043
|
};
|
|
11793
12044
|
} catch (e) {
|
|
11794
12045
|
throw new Error(`Failed to retrieve OIDC context from storage associated with session [${sessionId}]: ${e}`);
|
|
@@ -11945,8 +12196,8 @@ async function buildAuthenticatedHeaders(targetUrl3, authToken, dpopKey, default
|
|
|
11945
12196
|
headers
|
|
11946
12197
|
};
|
|
11947
12198
|
}
|
|
11948
|
-
async function makeAuthenticatedRequest(
|
|
11949
|
-
return
|
|
12199
|
+
async function makeAuthenticatedRequest(accessToken, url7, defaultRequestInit, dpopKey) {
|
|
12200
|
+
return fetch(url7, await buildAuthenticatedHeaders(url7.toString(), accessToken, dpopKey, defaultRequestInit));
|
|
11950
12201
|
}
|
|
11951
12202
|
async function refreshAccessToken(refreshOptions, dpopKey, eventEmitter) {
|
|
11952
12203
|
var _a;
|
|
@@ -11970,7 +12221,7 @@ var computeRefreshDelay = (expiresIn) => {
|
|
|
11970
12221
|
}
|
|
11971
12222
|
return DEFAULT_EXPIRATION_TIME_SECONDS;
|
|
11972
12223
|
};
|
|
11973
|
-
async function buildAuthenticatedFetch(
|
|
12224
|
+
async function buildAuthenticatedFetch(accessToken, options) {
|
|
11974
12225
|
var _a;
|
|
11975
12226
|
let currentAccessToken = accessToken;
|
|
11976
12227
|
let latestTimeout;
|
|
@@ -12018,7 +12269,7 @@ async function buildAuthenticatedFetch(unauthFetch, accessToken, options) {
|
|
|
12018
12269
|
options.eventEmitter.emit(EVENTS.TIMEOUT_SET, expirationTimeout);
|
|
12019
12270
|
}
|
|
12020
12271
|
return async (url7, requestInit) => {
|
|
12021
|
-
let response6 = await makeAuthenticatedRequest(
|
|
12272
|
+
let response6 = await makeAuthenticatedRequest(currentAccessToken, url7, requestInit, options === null || options === void 0 ? void 0 : options.dpopKey);
|
|
12022
12273
|
const failedButNotExpectedAuthError = !response6.ok && !isExpectedAuthError(response6.status);
|
|
12023
12274
|
if (response6.ok || failedButNotExpectedAuthError) {
|
|
12024
12275
|
return response6;
|
|
@@ -12026,7 +12277,6 @@ async function buildAuthenticatedFetch(unauthFetch, accessToken, options) {
|
|
|
12026
12277
|
const hasBeenRedirected = response6.url !== url7;
|
|
12027
12278
|
if (hasBeenRedirected && (options === null || options === void 0 ? void 0 : options.dpopKey) !== void 0) {
|
|
12028
12279
|
response6 = await makeAuthenticatedRequest(
|
|
12029
|
-
unauthFetch,
|
|
12030
12280
|
currentAccessToken,
|
|
12031
12281
|
// Replace the original target IRI (`url`) by the redirection target
|
|
12032
12282
|
response6.url,
|
|
@@ -12039,7 +12289,7 @@ async function buildAuthenticatedFetch(unauthFetch, accessToken, options) {
|
|
|
12039
12289
|
}
|
|
12040
12290
|
|
|
12041
12291
|
// ../node_modules/@inrupt/solid-client-authn-browser/dist/index.mjs
|
|
12042
|
-
var
|
|
12292
|
+
var import_events = __toESM(require_events(), 1);
|
|
12043
12293
|
|
|
12044
12294
|
// ../node_modules/@inrupt/oidc-client-ext/dist/index.es.js
|
|
12045
12295
|
var import_oidc_client = __toESM(require_oidc_client_min());
|
|
@@ -12187,7 +12437,7 @@ async function getTokens(issuer2, client, data2, dpop) {
|
|
|
12187
12437
|
headers,
|
|
12188
12438
|
body: new URLSearchParams(requestBody).toString()
|
|
12189
12439
|
};
|
|
12190
|
-
const rawTokenResponse = await
|
|
12440
|
+
const rawTokenResponse = await fetch(issuer2.tokenEndpoint, tokenRequestInit);
|
|
12191
12441
|
const jsonTokenResponse = await rawTokenResponse.json();
|
|
12192
12442
|
const tokenResponse = validateTokenEndpointResponse(jsonTokenResponse, dpop);
|
|
12193
12443
|
const webId = await getWebidFromTokenPayload(tokenResponse.id_token, issuer2.jwksUri, issuer2.issuer, client.clientId);
|
|
@@ -12200,66 +12450,6 @@ async function getTokens(issuer2, client, data2, dpop) {
|
|
|
12200
12450
|
expiresIn: tokenResponse.expires_in
|
|
12201
12451
|
};
|
|
12202
12452
|
}
|
|
12203
|
-
async function getBearerToken(redirectUrl) {
|
|
12204
|
-
let signinResponse;
|
|
12205
|
-
try {
|
|
12206
|
-
const client = new import_oidc_client.OidcClient({
|
|
12207
|
-
// TODO: We should look at the various interfaces being used for storage,
|
|
12208
|
-
// i.e. between oidc-client-js (WebStorageStoreState), localStorage
|
|
12209
|
-
// (which has an interface Storage), and our own proprietary interface
|
|
12210
|
-
// IStorage - i.e. we should really just be using the browser Web Storage
|
|
12211
|
-
// API, e.g. "stateStore: window.localStorage,".
|
|
12212
|
-
// We are instantiating a new instance here, so the only value we need to
|
|
12213
|
-
// explicitly provide is the response mode (default otherwise will look
|
|
12214
|
-
// for a hash '#' fragment!).
|
|
12215
|
-
// eslint-disable-next-line camelcase
|
|
12216
|
-
response_mode: "query",
|
|
12217
|
-
// The userinfo endpoint on NSS fails, so disable this for now
|
|
12218
|
-
// Note that in Solid, information should be retrieved from the
|
|
12219
|
-
// profile referenced by the WebId.
|
|
12220
|
-
// TODO: Note that this is heavy-handed, and that this userinfo check
|
|
12221
|
-
// verifies that the `sub` claim in the id token you get along with the
|
|
12222
|
-
// access token matches the sub claim associated with the access token at
|
|
12223
|
-
// the userinfo endpoint.
|
|
12224
|
-
// That is a useful check, and in the future it should be only disabled
|
|
12225
|
-
// against NSS, and not in general.
|
|
12226
|
-
// Issue tracker: https://github.com/solid/node-solid-server/issues/1490
|
|
12227
|
-
loadUserInfo: false
|
|
12228
|
-
});
|
|
12229
|
-
signinResponse = await client.processSigninResponse(redirectUrl);
|
|
12230
|
-
if (client.settings.metadata === void 0) {
|
|
12231
|
-
throw new Error("Cannot retrieve issuer metadata from client information in storage.");
|
|
12232
|
-
}
|
|
12233
|
-
if (client.settings.metadata.jwks_uri === void 0) {
|
|
12234
|
-
throw new Error("Missing some issuer metadata from client information in storage: 'jwks_uri' is undefined");
|
|
12235
|
-
}
|
|
12236
|
-
if (client.settings.metadata.issuer === void 0) {
|
|
12237
|
-
throw new Error("Missing some issuer metadata from client information in storage: 'issuer' is undefined");
|
|
12238
|
-
}
|
|
12239
|
-
if (client.settings.client_id === void 0) {
|
|
12240
|
-
throw new Error("Missing some client information in storage: 'client_id' is undefined");
|
|
12241
|
-
}
|
|
12242
|
-
const webId = await getWebidFromTokenPayload(signinResponse.id_token, client.settings.metadata.jwks_uri, client.settings.metadata.issuer, client.settings.client_id);
|
|
12243
|
-
return {
|
|
12244
|
-
accessToken: signinResponse.access_token,
|
|
12245
|
-
idToken: signinResponse.id_token,
|
|
12246
|
-
webId,
|
|
12247
|
-
// Although not a field in the TypeScript response interface, the refresh
|
|
12248
|
-
// token (which can optionally come back with the access token (if, as per
|
|
12249
|
-
// the OAuth2 spec, we requested one using the scope of 'offline_access')
|
|
12250
|
-
// will be included in the signin response object.
|
|
12251
|
-
// eslint-disable-next-line camelcase
|
|
12252
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
12253
|
-
// @ts-ignore
|
|
12254
|
-
refreshToken: signinResponse.refresh_token
|
|
12255
|
-
};
|
|
12256
|
-
} catch (err) {
|
|
12257
|
-
throw new Error(`Problem handling Auth Code Grant (Flow) redirect - URL [${redirectUrl}]: ${err}`);
|
|
12258
|
-
}
|
|
12259
|
-
}
|
|
12260
|
-
async function getDpopToken(issuer2, client, data2) {
|
|
12261
|
-
return getTokens(issuer2, client, data2, true);
|
|
12262
|
-
}
|
|
12263
12453
|
var isValidUrl2 = (url7) => {
|
|
12264
12454
|
try {
|
|
12265
12455
|
new URL(url7);
|
|
@@ -12293,7 +12483,7 @@ async function refresh(refreshToken, issuer2, client, dpopKey) {
|
|
|
12293
12483
|
} else if (isValidUrl2(client.clientId)) {
|
|
12294
12484
|
requestBody.client_id = client.clientId;
|
|
12295
12485
|
}
|
|
12296
|
-
const rawResponse = await
|
|
12486
|
+
const rawResponse = await fetch(issuer2.tokenEndpoint, {
|
|
12297
12487
|
method: "POST",
|
|
12298
12488
|
body: new URLSearchParams(requestBody).toString(),
|
|
12299
12489
|
headers: {
|
|
@@ -12391,7 +12581,7 @@ var ClientAuthentication2 = class extends ClientAuthentication {
|
|
|
12391
12581
|
};
|
|
12392
12582
|
this.handleIncomingRedirect = async (url7, eventEmitter) => {
|
|
12393
12583
|
try {
|
|
12394
|
-
const redirectInfo = await this.redirectHandler.handle(url7, eventEmitter);
|
|
12584
|
+
const redirectInfo = await this.redirectHandler.handle(url7, eventEmitter, void 0);
|
|
12395
12585
|
this.fetch = redirectInfo.fetch.bind(window);
|
|
12396
12586
|
this.boundLogout = redirectInfo.getLogoutUrl;
|
|
12397
12587
|
await this.cleanUrlAfterRedirect(url7);
|
|
@@ -12470,8 +12660,7 @@ var AuthorizationCodeWithPkceOidcHandler = class extends AuthorizationCodeWithPk
|
|
|
12470
12660
|
authority: oidcLoginOptions.issuer.toString(),
|
|
12471
12661
|
client_id: oidcLoginOptions.client.clientId,
|
|
12472
12662
|
client_secret: oidcLoginOptions.client.clientSecret,
|
|
12473
|
-
redirect_uri: oidcLoginOptions.redirectUrl
|
|
12474
|
-
post_logout_redirect_uri: oidcLoginOptions.redirectUrl.toString(),
|
|
12663
|
+
redirect_uri: oidcLoginOptions.redirectUrl,
|
|
12475
12664
|
response_type: "code",
|
|
12476
12665
|
scope: DEFAULT_SCOPES,
|
|
12477
12666
|
filterProtocolClaims: true,
|
|
@@ -12617,7 +12806,7 @@ var IssuerConfigFetcher = class _IssuerConfigFetcher {
|
|
|
12617
12806
|
// includes the full issuer path. See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig.
|
|
12618
12807
|
issuer2.endsWith("/") ? issuer2 : `${issuer2}/`
|
|
12619
12808
|
).href;
|
|
12620
|
-
const issuerConfigRequestBody = await
|
|
12809
|
+
const issuerConfigRequestBody = await fetch(openIdConfigUrl);
|
|
12621
12810
|
try {
|
|
12622
12811
|
issuerConfig = processConfig(await issuerConfigRequestBody.json());
|
|
12623
12812
|
} catch (err) {
|
|
@@ -12708,7 +12897,6 @@ var FallbackRedirectHandler = class {
|
|
|
12708
12897
|
return getUnauthenticatedSession();
|
|
12709
12898
|
}
|
|
12710
12899
|
};
|
|
12711
|
-
var globalFetch2 = (...args) => fetch2.call(globalThis, ...args);
|
|
12712
12900
|
var AuthCodeRedirectHandler = class {
|
|
12713
12901
|
constructor(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokerRefresher) {
|
|
12714
12902
|
this.storageUtility = storageUtility;
|
|
@@ -12751,21 +12939,16 @@ var AuthCodeRedirectHandler = class {
|
|
|
12751
12939
|
throw new Error(`The redirect URL for session ${storedSessionId} is missing from storage.`);
|
|
12752
12940
|
}
|
|
12753
12941
|
const client = await this.clientRegistrar.getClient({ sessionId: storedSessionId }, issuerConfig);
|
|
12754
|
-
let tokens;
|
|
12755
12942
|
const tokenCreatedAt = Date.now();
|
|
12756
|
-
|
|
12757
|
-
|
|
12758
|
-
|
|
12759
|
-
|
|
12760
|
-
|
|
12761
|
-
|
|
12762
|
-
|
|
12763
|
-
|
|
12764
|
-
|
|
12765
|
-
window.localStorage.removeItem(`oidc.${oauthState}`);
|
|
12766
|
-
} else {
|
|
12767
|
-
tokens = await getBearerToken(url7.toString());
|
|
12768
|
-
}
|
|
12943
|
+
const tokens = await getTokens(issuerConfig, client, {
|
|
12944
|
+
grantType: "authorization_code",
|
|
12945
|
+
// We rely on our 'canHandle' function checking that the OAuth 'code'
|
|
12946
|
+
// parameter is present in our query string.
|
|
12947
|
+
code: url7.searchParams.get("code"),
|
|
12948
|
+
codeVerifier,
|
|
12949
|
+
redirectUrl: storedRedirectIri
|
|
12950
|
+
}, isDpop);
|
|
12951
|
+
window.localStorage.removeItem(`oidc.${oauthState}`);
|
|
12769
12952
|
let refreshOptions;
|
|
12770
12953
|
if (tokens.refreshToken !== void 0) {
|
|
12771
12954
|
refreshOptions = {
|
|
@@ -12774,7 +12957,7 @@ var AuthCodeRedirectHandler = class {
|
|
|
12774
12957
|
tokenRefresher: this.tokerRefresher
|
|
12775
12958
|
};
|
|
12776
12959
|
}
|
|
12777
|
-
const authFetch = await buildAuthenticatedFetch(
|
|
12960
|
+
const authFetch = await buildAuthenticatedFetch(tokens.accessToken, {
|
|
12778
12961
|
dpopKey: tokens.dpopKey,
|
|
12779
12962
|
refreshOptions,
|
|
12780
12963
|
eventEmitter,
|
|
@@ -12834,33 +13017,34 @@ var ClientRegistrar = class {
|
|
|
12834
13017
|
this.storageUtility = storageUtility;
|
|
12835
13018
|
}
|
|
12836
13019
|
async getClient(options, issuerConfig) {
|
|
12837
|
-
const [
|
|
12838
|
-
storedClientId,
|
|
12839
|
-
storedClientSecret
|
|
12840
|
-
// storedClientName,
|
|
12841
|
-
] = await Promise.all([
|
|
13020
|
+
const [storedClientId, storedClientSecret, storedClientName, storedClientType] = await Promise.all([
|
|
12842
13021
|
this.storageUtility.getForUser(options.sessionId, "clientId", {
|
|
12843
13022
|
secure: false
|
|
12844
13023
|
}),
|
|
12845
13024
|
this.storageUtility.getForUser(options.sessionId, "clientSecret", {
|
|
12846
13025
|
secure: false
|
|
13026
|
+
}),
|
|
13027
|
+
this.storageUtility.getForUser(options.sessionId, "clientName", {
|
|
13028
|
+
secure: false
|
|
13029
|
+
}),
|
|
13030
|
+
this.storageUtility.getForUser(options.sessionId, "clientType", {
|
|
13031
|
+
secure: false
|
|
12847
13032
|
})
|
|
12848
|
-
// this.storageUtility.getForUser(options.sessionId, "clientName", {
|
|
12849
|
-
// // FIXME: figure out how to persist secure storage at reload
|
|
12850
|
-
// secure: false,
|
|
12851
|
-
// }),
|
|
12852
13033
|
]);
|
|
12853
|
-
if (storedClientId) {
|
|
13034
|
+
if (storedClientId && isKnownClientType(storedClientType)) {
|
|
12854
13035
|
return {
|
|
12855
13036
|
clientId: storedClientId,
|
|
12856
13037
|
clientSecret: storedClientSecret,
|
|
12857
|
-
|
|
13038
|
+
clientName: storedClientName,
|
|
13039
|
+
// Note: static clients are not applicable in a browser context.
|
|
13040
|
+
clientType: storedClientType
|
|
12858
13041
|
};
|
|
12859
13042
|
}
|
|
12860
13043
|
try {
|
|
12861
13044
|
const registeredClient = await registerClient(options, issuerConfig);
|
|
12862
13045
|
const infoToSave = {
|
|
12863
|
-
clientId: registeredClient.clientId
|
|
13046
|
+
clientId: registeredClient.clientId,
|
|
13047
|
+
clientType: "dynamic"
|
|
12864
13048
|
};
|
|
12865
13049
|
if (registeredClient.clientSecret) {
|
|
12866
13050
|
infoToSave.clientSecret = registeredClient.clientSecret;
|
|
@@ -12969,7 +13153,7 @@ async function silentlyAuthenticate(sessionId, clientAuthn, session4) {
|
|
|
12969
13153
|
function isLoggedIn(sessionInfo) {
|
|
12970
13154
|
return !!(sessionInfo === null || sessionInfo === void 0 ? void 0 : sessionInfo.isLoggedIn);
|
|
12971
13155
|
}
|
|
12972
|
-
var Session = class
|
|
13156
|
+
var Session = class {
|
|
12973
13157
|
/**
|
|
12974
13158
|
* Session object constructor. Typically called as follows:
|
|
12975
13159
|
*
|
|
@@ -12986,7 +13170,6 @@ var Session = class _Session extends import_events2.default {
|
|
|
12986
13170
|
*
|
|
12987
13171
|
*/
|
|
12988
13172
|
constructor(sessionOptions = {}, sessionId = void 0) {
|
|
12989
|
-
super();
|
|
12990
13173
|
this.tokenRequestInProgress = false;
|
|
12991
13174
|
this.login = async (options) => {
|
|
12992
13175
|
var _a;
|
|
@@ -13043,7 +13226,7 @@ var Session = class _Session extends import_events2.default {
|
|
|
13043
13226
|
this.tokenRequestInProgress = false;
|
|
13044
13227
|
return sessionInfo;
|
|
13045
13228
|
};
|
|
13046
|
-
this.events = new
|
|
13229
|
+
this.events = new import_events.default();
|
|
13047
13230
|
if (sessionOptions.clientAuthentication) {
|
|
13048
13231
|
this.clientAuthentication = sessionOptions.clientAuthentication;
|
|
13049
13232
|
} else if (sessionOptions.secureStorage && sessionOptions.insecureStorage) {
|
|
@@ -13070,58 +13253,6 @@ var Session = class _Session extends import_events2.default {
|
|
|
13070
13253
|
this.events.on(EVENTS.SESSION_EXPIRED, () => this.internalLogout(false));
|
|
13071
13254
|
this.events.on(EVENTS.ERROR, () => this.internalLogout(false));
|
|
13072
13255
|
}
|
|
13073
|
-
/**
|
|
13074
|
-
* Register a callback function to be called when a user completes login.
|
|
13075
|
-
*
|
|
13076
|
-
* The callback is called when {@link handleIncomingRedirect} completes successfully.
|
|
13077
|
-
*
|
|
13078
|
-
* @param callback The function called when a user completes login.
|
|
13079
|
-
* @deprecated Prefer session.events.on(EVENTS.LOGIN, callback)
|
|
13080
|
-
*/
|
|
13081
|
-
onLogin(callback) {
|
|
13082
|
-
this.events.on(EVENTS.LOGIN, callback);
|
|
13083
|
-
}
|
|
13084
|
-
/**
|
|
13085
|
-
* Register a callback function to be called when a user logs out:
|
|
13086
|
-
*
|
|
13087
|
-
* @param callback The function called when a user completes logout.
|
|
13088
|
-
* @deprecated Prefer session.events.on(EVENTS.LOGOUT, callback)
|
|
13089
|
-
*/
|
|
13090
|
-
onLogout(callback) {
|
|
13091
|
-
this.events.on(EVENTS.LOGOUT, callback);
|
|
13092
|
-
}
|
|
13093
|
-
/**
|
|
13094
|
-
* Register a callback function to be called when a user logs out:
|
|
13095
|
-
*
|
|
13096
|
-
* @param callback The function called when an error occurs.
|
|
13097
|
-
* @since 1.11.0
|
|
13098
|
-
* @deprecated Prefer session.events.on(EVENTS.ERROR, callback)
|
|
13099
|
-
*/
|
|
13100
|
-
onError(callback) {
|
|
13101
|
-
this.events.on(EVENTS.ERROR, callback);
|
|
13102
|
-
}
|
|
13103
|
-
/**
|
|
13104
|
-
* Register a callback function to be called when a session is restored.
|
|
13105
|
-
*
|
|
13106
|
-
* Note: the callback will be called with the saved value of the 'current URL'
|
|
13107
|
-
* at the time the session was restored.
|
|
13108
|
-
*
|
|
13109
|
-
* @param callback The function called when a user's already logged-in session is restored, e.g., after a silent authentication is completed after a page refresh.
|
|
13110
|
-
* @deprecated Prefer session.events.on(EVENTS.SESSION_RESTORED, callback)
|
|
13111
|
-
*/
|
|
13112
|
-
onSessionRestore(callback) {
|
|
13113
|
-
this.events.on(EVENTS.SESSION_RESTORED, callback);
|
|
13114
|
-
}
|
|
13115
|
-
/**
|
|
13116
|
-
* Register a callback that runs when the session expires and can no longer
|
|
13117
|
-
* make authenticated requests, but following a user logout.
|
|
13118
|
-
* @param callback The function that runs on session expiration.
|
|
13119
|
-
* @since 1.11.0
|
|
13120
|
-
* @deprecated Prefer session.events.on(EVENTS.SESSION_EXPIRED, callback)
|
|
13121
|
-
*/
|
|
13122
|
-
onSessionExpiration(callback) {
|
|
13123
|
-
this.events.on(EVENTS.SESSION_EXPIRED, callback);
|
|
13124
|
-
}
|
|
13125
13256
|
setSessionInfo(sessionInfo) {
|
|
13126
13257
|
this.info.isLoggedIn = sessionInfo.isLoggedIn;
|
|
13127
13258
|
this.info.webId = sessionInfo.webId;
|
|
@@ -13172,16 +13303,19 @@ var BrowserSession = class {
|
|
|
13172
13303
|
* @deprecated use observeSession instead
|
|
13173
13304
|
*/
|
|
13174
13305
|
trackSession(callback) {
|
|
13175
|
-
this.session.on(EVENTS.LOGIN, () => callback(this.session.info));
|
|
13176
|
-
this.session.on(EVENTS.LOGOUT, () => callback(this.session.info));
|
|
13177
|
-
this.session.on(
|
|
13306
|
+
this.session.events.on(EVENTS.LOGIN, () => callback(this.session.info));
|
|
13307
|
+
this.session.events.on(EVENTS.LOGOUT, () => callback(this.session.info));
|
|
13308
|
+
this.session.events.on(
|
|
13309
|
+
EVENTS.SESSION_RESTORED,
|
|
13310
|
+
() => callback(this.session.info)
|
|
13311
|
+
);
|
|
13178
13312
|
callback(this.session.info);
|
|
13179
13313
|
}
|
|
13180
13314
|
observeSession() {
|
|
13181
13315
|
return this.sessionInfo$;
|
|
13182
13316
|
}
|
|
13183
13317
|
onSessionRestore(callback) {
|
|
13184
|
-
this.session.on(EVENTS.SESSION_RESTORED, callback);
|
|
13318
|
+
this.session.events.on(EVENTS.SESSION_RESTORED, callback);
|
|
13185
13319
|
}
|
|
13186
13320
|
};
|
|
13187
13321
|
|
|
@@ -23163,7 +23297,7 @@ var Document3 = "http://www.w3.org/2007/ont/link#Document";
|
|
|
23163
23297
|
var Mailbox = "http://www.w3.org/2007/ont/link#Mailbox";
|
|
23164
23298
|
var ProtocolEvent = "http://www.w3.org/2007/ont/link#ProtocolEvent";
|
|
23165
23299
|
var RDFDocument = "http://www.w3.org/2007/ont/link#RDFDocument";
|
|
23166
|
-
var
|
|
23300
|
+
var Response = "http://www.w3.org/2007/ont/link#Response";
|
|
23167
23301
|
var Session3 = "http://www.w3.org/2007/ont/link#Session";
|
|
23168
23302
|
var isMentionedIn = "http://www.w3.org/2007/ont/link#isMentionedIn";
|
|
23169
23303
|
var mentionsClass = "http://www.w3.org/2007/ont/link#mentionsClass";
|
|
@@ -23183,7 +23317,7 @@ var linkImport = /* @__PURE__ */ Object.freeze({
|
|
|
23183
23317
|
Mailbox,
|
|
23184
23318
|
ProtocolEvent,
|
|
23185
23319
|
RDFDocument,
|
|
23186
|
-
Response
|
|
23320
|
+
Response,
|
|
23187
23321
|
Session: Session3,
|
|
23188
23322
|
isMentionedIn,
|
|
23189
23323
|
mentionsClass,
|
|
@@ -33449,7 +33583,7 @@ var Document4 = "http://www.w3.org/2007/ont/link#Document";
|
|
|
33449
33583
|
var Mailbox2 = "http://www.w3.org/2007/ont/link#Mailbox";
|
|
33450
33584
|
var ProtocolEvent2 = "http://www.w3.org/2007/ont/link#ProtocolEvent";
|
|
33451
33585
|
var RDFDocument2 = "http://www.w3.org/2007/ont/link#RDFDocument";
|
|
33452
|
-
var
|
|
33586
|
+
var Response2 = "http://www.w3.org/2007/ont/link#Response";
|
|
33453
33587
|
var Session4 = "http://www.w3.org/2007/ont/link#Session";
|
|
33454
33588
|
var isMentionedIn2 = "http://www.w3.org/2007/ont/link#isMentionedIn";
|
|
33455
33589
|
var mentionsClass2 = "http://www.w3.org/2007/ont/link#mentionsClass";
|
|
@@ -33469,7 +33603,7 @@ var tabImport = /* @__PURE__ */ Object.freeze({
|
|
|
33469
33603
|
Mailbox: Mailbox2,
|
|
33470
33604
|
ProtocolEvent: ProtocolEvent2,
|
|
33471
33605
|
RDFDocument: RDFDocument2,
|
|
33472
|
-
Response:
|
|
33606
|
+
Response: Response2,
|
|
33473
33607
|
Session: Session4,
|
|
33474
33608
|
isMentionedIn: isMentionedIn2,
|
|
33475
33609
|
mentionsClass: mentionsClass2,
|
|
@@ -33491,7 +33625,7 @@ var Document5 = "http://www.w3.org/2007/ont/link#Document";
|
|
|
33491
33625
|
var Mailbox3 = "http://www.w3.org/2007/ont/link#Mailbox";
|
|
33492
33626
|
var ProtocolEvent3 = "http://www.w3.org/2007/ont/link#ProtocolEvent";
|
|
33493
33627
|
var RDFDocument3 = "http://www.w3.org/2007/ont/link#RDFDocument";
|
|
33494
|
-
var
|
|
33628
|
+
var Response3 = "http://www.w3.org/2007/ont/link#Response";
|
|
33495
33629
|
var Session5 = "http://www.w3.org/2007/ont/link#Session";
|
|
33496
33630
|
var isMentionedIn3 = "http://www.w3.org/2007/ont/link#isMentionedIn";
|
|
33497
33631
|
var mentionsClass3 = "http://www.w3.org/2007/ont/link#mentionsClass";
|
|
@@ -33511,7 +33645,7 @@ var tabontImport = /* @__PURE__ */ Object.freeze({
|
|
|
33511
33645
|
Mailbox: Mailbox3,
|
|
33512
33646
|
ProtocolEvent: ProtocolEvent3,
|
|
33513
33647
|
RDFDocument: RDFDocument3,
|
|
33514
|
-
Response:
|
|
33648
|
+
Response: Response3,
|
|
33515
33649
|
Session: Session5,
|
|
33516
33650
|
isMentionedIn: isMentionedIn3,
|
|
33517
33651
|
mentionsClass: mentionsClass3,
|