@pod-os/core 0.12.1-6af5683.0 → 0.12.1-a4967bb.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/{chunk-GBIS3SJI.js → chunk-7VQUARYZ.js} +60 -1
- package/dist/{dist-TVYD2Q5S.js → dist-F3EUFQHU.js} +227 -193
- package/dist/index.js +872 -484
- package/lib/index.js +1345 -803
- package/package.json +16 -16
- package/types/Store.spec.d.ts +0 -1
- package/types/thing/Thing.d.ts +2 -0
- package/types/thing/labelFromUri.d.ts +1 -0
- package/types/thing/labelFromUri.spec.d.ts +1 -0
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
lit,
|
|
9
9
|
namedNode,
|
|
10
10
|
st
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-7VQUARYZ.js";
|
|
12
12
|
import {
|
|
13
13
|
__commonJS,
|
|
14
14
|
__export,
|
|
@@ -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)
|
|
@@ -281,7 +281,7 @@ var require_events = __commonJS({
|
|
|
281
281
|
}
|
|
282
282
|
return this;
|
|
283
283
|
};
|
|
284
|
-
function _listeners(target5, type5,
|
|
284
|
+
function _listeners(target5, type5, unwrap) {
|
|
285
285
|
var events3 = target5._events;
|
|
286
286
|
if (events3 === void 0)
|
|
287
287
|
return [];
|
|
@@ -289,23 +289,23 @@ var require_events = __commonJS({
|
|
|
289
289
|
if (evlistener === void 0)
|
|
290
290
|
return [];
|
|
291
291
|
if (typeof evlistener === "function")
|
|
292
|
-
return
|
|
293
|
-
return
|
|
292
|
+
return unwrap ? [evlistener.listener || evlistener] : [evlistener];
|
|
293
|
+
return unwrap ? 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,44 +10170,45 @@ 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 {
|
|
10199
10191
|
static get code() {
|
|
10200
10192
|
return "ERR_JWT_CLAIM_VALIDATION_FAILED";
|
|
10201
10193
|
}
|
|
10202
|
-
constructor(message4, claim2 = "unspecified", reason2 = "unspecified") {
|
|
10194
|
+
constructor(message4, payload4, claim2 = "unspecified", reason2 = "unspecified") {
|
|
10203
10195
|
super(message4);
|
|
10204
10196
|
this.code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
|
|
10205
10197
|
this.claim = claim2;
|
|
10206
10198
|
this.reason = reason2;
|
|
10199
|
+
this.payload = payload4;
|
|
10207
10200
|
}
|
|
10208
10201
|
};
|
|
10209
10202
|
var JWTExpired = class extends JOSEError {
|
|
10210
10203
|
static get code() {
|
|
10211
10204
|
return "ERR_JWT_EXPIRED";
|
|
10212
10205
|
}
|
|
10213
|
-
constructor(message4, claim2 = "unspecified", reason2 = "unspecified") {
|
|
10206
|
+
constructor(message4, payload4, claim2 = "unspecified", reason2 = "unspecified") {
|
|
10214
10207
|
super(message4);
|
|
10215
10208
|
this.code = "ERR_JWT_EXPIRED";
|
|
10216
10209
|
this.claim = claim2;
|
|
10217
10210
|
this.reason = reason2;
|
|
10211
|
+
this.payload = payload4;
|
|
10218
10212
|
}
|
|
10219
10213
|
};
|
|
10220
10214
|
var JOSEAlgNotAllowed = class extends JOSEError {
|
|
@@ -10253,6 +10247,45 @@ var JWTInvalid = class extends JOSEError {
|
|
|
10253
10247
|
return "ERR_JWT_INVALID";
|
|
10254
10248
|
}
|
|
10255
10249
|
};
|
|
10250
|
+
var JWKSInvalid = class extends JOSEError {
|
|
10251
|
+
constructor() {
|
|
10252
|
+
super(...arguments);
|
|
10253
|
+
this.code = "ERR_JWKS_INVALID";
|
|
10254
|
+
}
|
|
10255
|
+
static get code() {
|
|
10256
|
+
return "ERR_JWKS_INVALID";
|
|
10257
|
+
}
|
|
10258
|
+
};
|
|
10259
|
+
var JWKSNoMatchingKey = class extends JOSEError {
|
|
10260
|
+
constructor() {
|
|
10261
|
+
super(...arguments);
|
|
10262
|
+
this.code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
10263
|
+
this.message = "no applicable key found in the JSON Web Key Set";
|
|
10264
|
+
}
|
|
10265
|
+
static get code() {
|
|
10266
|
+
return "ERR_JWKS_NO_MATCHING_KEY";
|
|
10267
|
+
}
|
|
10268
|
+
};
|
|
10269
|
+
var JWKSMultipleMatchingKeys = class extends JOSEError {
|
|
10270
|
+
constructor() {
|
|
10271
|
+
super(...arguments);
|
|
10272
|
+
this.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
10273
|
+
this.message = "multiple matching keys found in the JSON Web Key Set";
|
|
10274
|
+
}
|
|
10275
|
+
static get code() {
|
|
10276
|
+
return "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
10277
|
+
}
|
|
10278
|
+
};
|
|
10279
|
+
var JWKSTimeout = class extends JOSEError {
|
|
10280
|
+
constructor() {
|
|
10281
|
+
super(...arguments);
|
|
10282
|
+
this.code = "ERR_JWKS_TIMEOUT";
|
|
10283
|
+
this.message = "request timed out";
|
|
10284
|
+
}
|
|
10285
|
+
static get code() {
|
|
10286
|
+
return "ERR_JWKS_TIMEOUT";
|
|
10287
|
+
}
|
|
10288
|
+
};
|
|
10256
10289
|
var JWSSignatureVerificationFailed = class extends JOSEError {
|
|
10257
10290
|
constructor() {
|
|
10258
10291
|
super(...arguments);
|
|
@@ -10264,10 +10297,7 @@ var JWSSignatureVerificationFailed = class extends JOSEError {
|
|
|
10264
10297
|
}
|
|
10265
10298
|
};
|
|
10266
10299
|
|
|
10267
|
-
// ../node_modules/jose/dist/browser/
|
|
10268
|
-
var random_default = webcrypto_default.getRandomValues.bind(webcrypto_default);
|
|
10269
|
-
|
|
10270
|
-
// ../node_modules/jose/dist/browser/lib/crypto_key.js
|
|
10300
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/crypto_key.js
|
|
10271
10301
|
function unusable(name7, prop = "algorithm.name") {
|
|
10272
10302
|
return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name7}`);
|
|
10273
10303
|
}
|
|
@@ -10361,8 +10391,9 @@ function checkSigCryptoKey(key3, alg, ...usages) {
|
|
|
10361
10391
|
checkUsage(key3, usages);
|
|
10362
10392
|
}
|
|
10363
10393
|
|
|
10364
|
-
// ../node_modules/jose/dist/browser/lib/invalid_key_input.js
|
|
10394
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/invalid_key_input.js
|
|
10365
10395
|
function message(msg, actual2, ...types2) {
|
|
10396
|
+
types2 = types2.filter(Boolean);
|
|
10366
10397
|
if (types2.length > 2) {
|
|
10367
10398
|
const last3 = types2.pop();
|
|
10368
10399
|
msg += `one of type ${types2.join(", ")}, or ${last3}.`;
|
|
@@ -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,16 @@ 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
|
+
if (isCryptoKey(key3)) {
|
|
10426
|
+
return true;
|
|
10427
|
+
}
|
|
10428
|
+
return key3?.[Symbol.toStringTag] === "KeyObject";
|
|
10395
10429
|
};
|
|
10396
10430
|
var types = ["CryptoKey"];
|
|
10397
10431
|
|
|
10398
|
-
// ../node_modules/jose/dist/browser/lib/is_disjoint.js
|
|
10432
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/is_disjoint.js
|
|
10399
10433
|
var isDisjoint = (...headers) => {
|
|
10400
10434
|
const sources = headers.filter(Boolean);
|
|
10401
10435
|
if (sources.length === 0 || sources.length === 1) {
|
|
@@ -10419,7 +10453,7 @@ var isDisjoint = (...headers) => {
|
|
|
10419
10453
|
};
|
|
10420
10454
|
var is_disjoint_default = isDisjoint;
|
|
10421
10455
|
|
|
10422
|
-
// ../node_modules/jose/dist/browser/lib/is_object.js
|
|
10456
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/is_object.js
|
|
10423
10457
|
function isObjectLike(value6) {
|
|
10424
10458
|
return typeof value6 === "object" && value6 !== null;
|
|
10425
10459
|
}
|
|
@@ -10437,7 +10471,7 @@ function isObject(input2) {
|
|
|
10437
10471
|
return Object.getPrototypeOf(input2) === proto;
|
|
10438
10472
|
}
|
|
10439
10473
|
|
|
10440
|
-
// ../node_modules/jose/dist/browser/runtime/check_key_length.js
|
|
10474
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/check_key_length.js
|
|
10441
10475
|
var check_key_length_default = (alg, key3) => {
|
|
10442
10476
|
if (alg.startsWith("RS") || alg.startsWith("PS")) {
|
|
10443
10477
|
const { modulusLength } = key3.algorithm;
|
|
@@ -10447,49 +10481,25 @@ var check_key_length_default = (alg, key3) => {
|
|
|
10447
10481
|
}
|
|
10448
10482
|
};
|
|
10449
10483
|
|
|
10450
|
-
// ../node_modules/jose/dist/browser/
|
|
10484
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/is_jwk.js
|
|
10485
|
+
function isJWK(key3) {
|
|
10486
|
+
return isObject(key3) && typeof key3.kty === "string";
|
|
10487
|
+
}
|
|
10488
|
+
function isPrivateJWK(key3) {
|
|
10489
|
+
return key3.kty !== "oct" && typeof key3.d === "string";
|
|
10490
|
+
}
|
|
10491
|
+
function isPublicJWK(key3) {
|
|
10492
|
+
return key3.kty !== "oct" && typeof key3.d === "undefined";
|
|
10493
|
+
}
|
|
10494
|
+
function isSecretJWK(key3) {
|
|
10495
|
+
return isJWK(key3) && key3.kty === "oct" && typeof key3.k === "string";
|
|
10496
|
+
}
|
|
10497
|
+
|
|
10498
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/jwk_to_key.js
|
|
10451
10499
|
function subtleMapping(jwk) {
|
|
10452
10500
|
let algorithm3;
|
|
10453
10501
|
let keyUsages;
|
|
10454
10502
|
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
10503
|
case "RSA": {
|
|
10494
10504
|
switch (jwk.alg) {
|
|
10495
10505
|
case "PS256":
|
|
@@ -10569,19 +10579,15 @@ function subtleMapping(jwk) {
|
|
|
10569
10579
|
return { algorithm: algorithm3, keyUsages };
|
|
10570
10580
|
}
|
|
10571
10581
|
var parse = async (jwk) => {
|
|
10572
|
-
var _a, _b;
|
|
10573
10582
|
if (!jwk.alg) {
|
|
10574
10583
|
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
10575
10584
|
}
|
|
10576
10585
|
const { algorithm: algorithm3, keyUsages } = subtleMapping(jwk);
|
|
10577
10586
|
const rest3 = [
|
|
10578
10587
|
algorithm3,
|
|
10579
|
-
|
|
10580
|
-
|
|
10588
|
+
jwk.ext ?? false,
|
|
10589
|
+
jwk.key_ops ?? keyUsages
|
|
10581
10590
|
];
|
|
10582
|
-
if (algorithm3.name === "PBKDF2") {
|
|
10583
|
-
return webcrypto_default.subtle.importKey("raw", decode(jwk.k), ...rest3);
|
|
10584
|
-
}
|
|
10585
10591
|
const keyData = { ...jwk };
|
|
10586
10592
|
delete keyData.alg;
|
|
10587
10593
|
delete keyData.use;
|
|
@@ -10589,9 +10595,74 @@ var parse = async (jwk) => {
|
|
|
10589
10595
|
};
|
|
10590
10596
|
var jwk_to_key_default = parse;
|
|
10591
10597
|
|
|
10592
|
-
// ../node_modules/jose/dist/browser/
|
|
10593
|
-
|
|
10594
|
-
|
|
10598
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/normalize_key.js
|
|
10599
|
+
var exportKeyValue = (k) => decode(k);
|
|
10600
|
+
var privCache;
|
|
10601
|
+
var pubCache;
|
|
10602
|
+
var isKeyObject = (key3) => {
|
|
10603
|
+
return key3?.[Symbol.toStringTag] === "KeyObject";
|
|
10604
|
+
};
|
|
10605
|
+
var importAndCache = async (cache, key3, jwk, alg, freeze = false) => {
|
|
10606
|
+
let cached = cache.get(key3);
|
|
10607
|
+
if (cached?.[alg]) {
|
|
10608
|
+
return cached[alg];
|
|
10609
|
+
}
|
|
10610
|
+
const cryptoKey = await jwk_to_key_default({ ...jwk, alg });
|
|
10611
|
+
if (freeze)
|
|
10612
|
+
Object.freeze(key3);
|
|
10613
|
+
if (!cached) {
|
|
10614
|
+
cache.set(key3, { [alg]: cryptoKey });
|
|
10615
|
+
} else {
|
|
10616
|
+
cached[alg] = cryptoKey;
|
|
10617
|
+
}
|
|
10618
|
+
return cryptoKey;
|
|
10619
|
+
};
|
|
10620
|
+
var normalizePublicKey = (key3, alg) => {
|
|
10621
|
+
if (isKeyObject(key3)) {
|
|
10622
|
+
let jwk = key3.export({ format: "jwk" });
|
|
10623
|
+
delete jwk.d;
|
|
10624
|
+
delete jwk.dp;
|
|
10625
|
+
delete jwk.dq;
|
|
10626
|
+
delete jwk.p;
|
|
10627
|
+
delete jwk.q;
|
|
10628
|
+
delete jwk.qi;
|
|
10629
|
+
if (jwk.k) {
|
|
10630
|
+
return exportKeyValue(jwk.k);
|
|
10631
|
+
}
|
|
10632
|
+
pubCache || (pubCache = /* @__PURE__ */ new WeakMap());
|
|
10633
|
+
return importAndCache(pubCache, key3, jwk, alg);
|
|
10634
|
+
}
|
|
10635
|
+
if (isJWK(key3)) {
|
|
10636
|
+
if (key3.k)
|
|
10637
|
+
return decode(key3.k);
|
|
10638
|
+
pubCache || (pubCache = /* @__PURE__ */ new WeakMap());
|
|
10639
|
+
const cryptoKey = importAndCache(pubCache, key3, key3, alg, true);
|
|
10640
|
+
return cryptoKey;
|
|
10641
|
+
}
|
|
10642
|
+
return key3;
|
|
10643
|
+
};
|
|
10644
|
+
var normalizePrivateKey = (key3, alg) => {
|
|
10645
|
+
if (isKeyObject(key3)) {
|
|
10646
|
+
let jwk = key3.export({ format: "jwk" });
|
|
10647
|
+
if (jwk.k) {
|
|
10648
|
+
return exportKeyValue(jwk.k);
|
|
10649
|
+
}
|
|
10650
|
+
privCache || (privCache = /* @__PURE__ */ new WeakMap());
|
|
10651
|
+
return importAndCache(privCache, key3, jwk, alg);
|
|
10652
|
+
}
|
|
10653
|
+
if (isJWK(key3)) {
|
|
10654
|
+
if (key3.k)
|
|
10655
|
+
return decode(key3.k);
|
|
10656
|
+
privCache || (privCache = /* @__PURE__ */ new WeakMap());
|
|
10657
|
+
const cryptoKey = importAndCache(privCache, key3, key3, alg, true);
|
|
10658
|
+
return cryptoKey;
|
|
10659
|
+
}
|
|
10660
|
+
return key3;
|
|
10661
|
+
};
|
|
10662
|
+
var normalize_key_default = { normalizePublicKey, normalizePrivateKey };
|
|
10663
|
+
|
|
10664
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/key/import.js
|
|
10665
|
+
async function importJWK(jwk, alg) {
|
|
10595
10666
|
if (!isObject(jwk)) {
|
|
10596
10667
|
throw new TypeError("JWK must be an object");
|
|
10597
10668
|
}
|
|
@@ -10601,10 +10672,6 @@ async function importJWK(jwk, alg, octAsKeyObject) {
|
|
|
10601
10672
|
if (typeof jwk.k !== "string" || !jwk.k) {
|
|
10602
10673
|
throw new TypeError('missing "k" (Key Value) Parameter value');
|
|
10603
10674
|
}
|
|
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
10675
|
return decode(jwk.k);
|
|
10609
10676
|
case "RSA":
|
|
10610
10677
|
if (jwk.oth !== void 0) {
|
|
@@ -10618,50 +10685,81 @@ async function importJWK(jwk, alg, octAsKeyObject) {
|
|
|
10618
10685
|
}
|
|
10619
10686
|
}
|
|
10620
10687
|
|
|
10621
|
-
// ../node_modules/jose/dist/browser/lib/check_key_type.js
|
|
10622
|
-
var
|
|
10688
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/check_key_type.js
|
|
10689
|
+
var tag = (key3) => key3?.[Symbol.toStringTag];
|
|
10690
|
+
var jwkMatchesOp = (alg, key3, usage2) => {
|
|
10691
|
+
if (key3.use !== void 0 && key3.use !== "sig") {
|
|
10692
|
+
throw new TypeError("Invalid key for this operation, when present its use must be sig");
|
|
10693
|
+
}
|
|
10694
|
+
if (key3.key_ops !== void 0 && key3.key_ops.includes?.(usage2) !== true) {
|
|
10695
|
+
throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${usage2}`);
|
|
10696
|
+
}
|
|
10697
|
+
if (key3.alg !== void 0 && key3.alg !== alg) {
|
|
10698
|
+
throw new TypeError(`Invalid key for this operation, when present its alg must be ${alg}`);
|
|
10699
|
+
}
|
|
10700
|
+
return true;
|
|
10701
|
+
};
|
|
10702
|
+
var symmetricTypeCheck = (alg, key3, usage2, allowJwk) => {
|
|
10623
10703
|
if (key3 instanceof Uint8Array)
|
|
10624
10704
|
return;
|
|
10705
|
+
if (allowJwk && isJWK(key3)) {
|
|
10706
|
+
if (isSecretJWK(key3) && jwkMatchesOp(alg, key3, usage2))
|
|
10707
|
+
return;
|
|
10708
|
+
throw new TypeError(`JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present`);
|
|
10709
|
+
}
|
|
10625
10710
|
if (!is_key_like_default(key3)) {
|
|
10626
|
-
throw new TypeError(withAlg(alg, key3, ...types, "Uint8Array"));
|
|
10711
|
+
throw new TypeError(withAlg(alg, key3, ...types, "Uint8Array", allowJwk ? "JSON Web Key" : null));
|
|
10627
10712
|
}
|
|
10628
10713
|
if (key3.type !== "secret") {
|
|
10629
|
-
throw new TypeError(`${
|
|
10714
|
+
throw new TypeError(`${tag(key3)} instances for symmetric algorithms must be of type "secret"`);
|
|
10630
10715
|
}
|
|
10631
10716
|
};
|
|
10632
|
-
var asymmetricTypeCheck = (alg, key3, usage2) => {
|
|
10717
|
+
var asymmetricTypeCheck = (alg, key3, usage2, allowJwk) => {
|
|
10718
|
+
if (allowJwk && isJWK(key3)) {
|
|
10719
|
+
switch (usage2) {
|
|
10720
|
+
case "sign":
|
|
10721
|
+
if (isPrivateJWK(key3) && jwkMatchesOp(alg, key3, usage2))
|
|
10722
|
+
return;
|
|
10723
|
+
throw new TypeError(`JSON Web Key for this operation be a private JWK`);
|
|
10724
|
+
case "verify":
|
|
10725
|
+
if (isPublicJWK(key3) && jwkMatchesOp(alg, key3, usage2))
|
|
10726
|
+
return;
|
|
10727
|
+
throw new TypeError(`JSON Web Key for this operation be a public JWK`);
|
|
10728
|
+
}
|
|
10729
|
+
}
|
|
10633
10730
|
if (!is_key_like_default(key3)) {
|
|
10634
|
-
throw new TypeError(withAlg(alg, key3, ...types));
|
|
10731
|
+
throw new TypeError(withAlg(alg, key3, ...types, allowJwk ? "JSON Web Key" : null));
|
|
10635
10732
|
}
|
|
10636
10733
|
if (key3.type === "secret") {
|
|
10637
|
-
throw new TypeError(`${
|
|
10734
|
+
throw new TypeError(`${tag(key3)} instances for asymmetric algorithms must not be of type "secret"`);
|
|
10638
10735
|
}
|
|
10639
10736
|
if (usage2 === "sign" && key3.type === "public") {
|
|
10640
|
-
throw new TypeError(`${
|
|
10737
|
+
throw new TypeError(`${tag(key3)} instances for asymmetric algorithm signing must be of type "private"`);
|
|
10641
10738
|
}
|
|
10642
10739
|
if (usage2 === "decrypt" && key3.type === "public") {
|
|
10643
|
-
throw new TypeError(`${
|
|
10740
|
+
throw new TypeError(`${tag(key3)} instances for asymmetric algorithm decryption must be of type "private"`);
|
|
10644
10741
|
}
|
|
10645
10742
|
if (key3.algorithm && usage2 === "verify" && key3.type === "private") {
|
|
10646
|
-
throw new TypeError(`${
|
|
10743
|
+
throw new TypeError(`${tag(key3)} instances for asymmetric algorithm verifying must be of type "public"`);
|
|
10647
10744
|
}
|
|
10648
10745
|
if (key3.algorithm && usage2 === "encrypt" && key3.type === "private") {
|
|
10649
|
-
throw new TypeError(`${
|
|
10746
|
+
throw new TypeError(`${tag(key3)} instances for asymmetric algorithm encryption must be of type "public"`);
|
|
10650
10747
|
}
|
|
10651
10748
|
};
|
|
10652
|
-
|
|
10749
|
+
function checkKeyType(allowJwk, alg, key3, usage2) {
|
|
10653
10750
|
const symmetric = alg.startsWith("HS") || alg === "dir" || alg.startsWith("PBES2") || /^A\d{3}(?:GCM)?KW$/.test(alg);
|
|
10654
10751
|
if (symmetric) {
|
|
10655
|
-
symmetricTypeCheck(alg, key3);
|
|
10752
|
+
symmetricTypeCheck(alg, key3, usage2, allowJwk);
|
|
10656
10753
|
} else {
|
|
10657
|
-
asymmetricTypeCheck(alg, key3, usage2);
|
|
10754
|
+
asymmetricTypeCheck(alg, key3, usage2, allowJwk);
|
|
10658
10755
|
}
|
|
10659
|
-
}
|
|
10660
|
-
var check_key_type_default = checkKeyType;
|
|
10756
|
+
}
|
|
10757
|
+
var check_key_type_default = checkKeyType.bind(void 0, false);
|
|
10758
|
+
var checkKeyTypeWithJwk = checkKeyType.bind(void 0, true);
|
|
10661
10759
|
|
|
10662
|
-
// ../node_modules/jose/dist/browser/lib/validate_crit.js
|
|
10760
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/validate_crit.js
|
|
10663
10761
|
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
10664
|
-
if (joseHeader.crit !== void 0 && protectedHeader
|
|
10762
|
+
if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) {
|
|
10665
10763
|
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
10666
10764
|
}
|
|
10667
10765
|
if (!protectedHeader || protectedHeader.crit === void 0) {
|
|
@@ -10682,7 +10780,8 @@ function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader,
|
|
|
10682
10780
|
}
|
|
10683
10781
|
if (joseHeader[parameter2] === void 0) {
|
|
10684
10782
|
throw new Err(`Extension Header Parameter "${parameter2}" is missing`);
|
|
10685
|
-
}
|
|
10783
|
+
}
|
|
10784
|
+
if (recognized.get(parameter2) && protectedHeader[parameter2] === void 0) {
|
|
10686
10785
|
throw new Err(`Extension Header Parameter "${parameter2}" MUST be integrity protected`);
|
|
10687
10786
|
}
|
|
10688
10787
|
}
|
|
@@ -10690,7 +10789,7 @@ function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader,
|
|
|
10690
10789
|
}
|
|
10691
10790
|
var validate_crit_default = validateCrit;
|
|
10692
10791
|
|
|
10693
|
-
// ../node_modules/jose/dist/browser/lib/validate_algorithms.js
|
|
10792
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/validate_algorithms.js
|
|
10694
10793
|
var validateAlgorithms = (option5, algorithms) => {
|
|
10695
10794
|
if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
10696
10795
|
throw new TypeError(`"${option5}" option must be an array of strings`);
|
|
@@ -10702,7 +10801,7 @@ var validateAlgorithms = (option5, algorithms) => {
|
|
|
10702
10801
|
};
|
|
10703
10802
|
var validate_algorithms_default = validateAlgorithms;
|
|
10704
10803
|
|
|
10705
|
-
// ../node_modules/jose/dist/browser/runtime/key_to_jwk.js
|
|
10804
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/key_to_jwk.js
|
|
10706
10805
|
var keyToJWK = async (key3) => {
|
|
10707
10806
|
if (key3 instanceof Uint8Array) {
|
|
10708
10807
|
return {
|
|
@@ -10721,15 +10820,12 @@ var keyToJWK = async (key3) => {
|
|
|
10721
10820
|
};
|
|
10722
10821
|
var key_to_jwk_default = keyToJWK;
|
|
10723
10822
|
|
|
10724
|
-
// ../node_modules/jose/dist/browser/key/export.js
|
|
10823
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/key/export.js
|
|
10725
10824
|
async function exportJWK(key3) {
|
|
10726
10825
|
return key_to_jwk_default(key3);
|
|
10727
10826
|
}
|
|
10728
10827
|
|
|
10729
|
-
// ../node_modules/jose/dist/browser/
|
|
10730
|
-
var unprotected = Symbol();
|
|
10731
|
-
|
|
10732
|
-
// ../node_modules/jose/dist/browser/runtime/subtle_dsa.js
|
|
10828
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/subtle_dsa.js
|
|
10733
10829
|
function subtleDsa(alg, algorithm3) {
|
|
10734
10830
|
const hash2 = `SHA-${alg.slice(-3)}`;
|
|
10735
10831
|
switch (alg) {
|
|
@@ -10756,8 +10852,14 @@ function subtleDsa(alg, algorithm3) {
|
|
|
10756
10852
|
}
|
|
10757
10853
|
}
|
|
10758
10854
|
|
|
10759
|
-
// ../node_modules/jose/dist/browser/runtime/get_sign_verify_key.js
|
|
10760
|
-
function getCryptoKey(alg, key3, usage2) {
|
|
10855
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/get_sign_verify_key.js
|
|
10856
|
+
async function getCryptoKey(alg, key3, usage2) {
|
|
10857
|
+
if (usage2 === "sign") {
|
|
10858
|
+
key3 = await normalize_key_default.normalizePrivateKey(key3, alg);
|
|
10859
|
+
}
|
|
10860
|
+
if (usage2 === "verify") {
|
|
10861
|
+
key3 = await normalize_key_default.normalizePublicKey(key3, alg);
|
|
10862
|
+
}
|
|
10761
10863
|
if (isCryptoKey(key3)) {
|
|
10762
10864
|
checkSigCryptoKey(key3, alg, usage2);
|
|
10763
10865
|
return key3;
|
|
@@ -10768,25 +10870,24 @@ function getCryptoKey(alg, key3, usage2) {
|
|
|
10768
10870
|
}
|
|
10769
10871
|
return webcrypto_default.subtle.importKey("raw", key3, { hash: `SHA-${alg.slice(-3)}`, name: "HMAC" }, false, [usage2]);
|
|
10770
10872
|
}
|
|
10771
|
-
throw new TypeError(invalid_key_input_default(key3, ...types, "Uint8Array"));
|
|
10873
|
+
throw new TypeError(invalid_key_input_default(key3, ...types, "Uint8Array", "JSON Web Key"));
|
|
10772
10874
|
}
|
|
10773
10875
|
|
|
10774
|
-
// ../node_modules/jose/dist/browser/runtime/verify.js
|
|
10876
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/verify.js
|
|
10775
10877
|
var verify = async (alg, key3, signature2, data2) => {
|
|
10776
10878
|
const cryptoKey = await getCryptoKey(alg, key3, "verify");
|
|
10777
10879
|
check_key_length_default(alg, cryptoKey);
|
|
10778
10880
|
const algorithm3 = subtleDsa(alg, cryptoKey.algorithm);
|
|
10779
10881
|
try {
|
|
10780
10882
|
return await webcrypto_default.subtle.verify(algorithm3, cryptoKey, signature2, data2);
|
|
10781
|
-
} catch
|
|
10883
|
+
} catch {
|
|
10782
10884
|
return false;
|
|
10783
10885
|
}
|
|
10784
10886
|
};
|
|
10785
10887
|
var verify_default = verify;
|
|
10786
10888
|
|
|
10787
|
-
// ../node_modules/jose/dist/browser/jws/flattened/verify.js
|
|
10889
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jws/flattened/verify.js
|
|
10788
10890
|
async function flattenedVerify(jws2, key3, options) {
|
|
10789
|
-
var _a;
|
|
10790
10891
|
if (!isObject(jws2)) {
|
|
10791
10892
|
throw new JWSInvalid("Flattened JWS must be an object");
|
|
10792
10893
|
}
|
|
@@ -10810,7 +10911,7 @@ async function flattenedVerify(jws2, key3, options) {
|
|
|
10810
10911
|
try {
|
|
10811
10912
|
const protectedHeader = decode(jws2.protected);
|
|
10812
10913
|
parsedProt = JSON.parse(decoder.decode(protectedHeader));
|
|
10813
|
-
} catch
|
|
10914
|
+
} catch {
|
|
10814
10915
|
throw new JWSInvalid("JWS Protected Header is invalid");
|
|
10815
10916
|
}
|
|
10816
10917
|
}
|
|
@@ -10821,7 +10922,7 @@ async function flattenedVerify(jws2, key3, options) {
|
|
|
10821
10922
|
...parsedProt,
|
|
10822
10923
|
...jws2.header
|
|
10823
10924
|
};
|
|
10824
|
-
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options
|
|
10925
|
+
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options?.crit, parsedProt, joseHeader);
|
|
10825
10926
|
let b64 = true;
|
|
10826
10927
|
if (extensions.has("b64")) {
|
|
10827
10928
|
b64 = parsedProt.b64;
|
|
@@ -10835,7 +10936,7 @@ async function flattenedVerify(jws2, key3, options) {
|
|
|
10835
10936
|
}
|
|
10836
10937
|
const algorithms = options && validate_algorithms_default("algorithms", options.algorithms);
|
|
10837
10938
|
if (algorithms && !algorithms.has(alg)) {
|
|
10838
|
-
throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');
|
|
10939
|
+
throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed');
|
|
10839
10940
|
}
|
|
10840
10941
|
if (b64) {
|
|
10841
10942
|
if (typeof jws2.payload !== "string") {
|
|
@@ -10848,13 +10949,18 @@ async function flattenedVerify(jws2, key3, options) {
|
|
|
10848
10949
|
if (typeof key3 === "function") {
|
|
10849
10950
|
key3 = await key3(parsedProt, jws2);
|
|
10850
10951
|
resolvedKey = true;
|
|
10952
|
+
checkKeyTypeWithJwk(alg, key3, "verify");
|
|
10953
|
+
if (isJWK(key3)) {
|
|
10954
|
+
key3 = await importJWK(key3, alg);
|
|
10955
|
+
}
|
|
10956
|
+
} else {
|
|
10957
|
+
checkKeyTypeWithJwk(alg, key3, "verify");
|
|
10851
10958
|
}
|
|
10852
|
-
|
|
10853
|
-
const data2 = concat(encoder.encode((_a = jws2.protected) !== null && _a !== void 0 ? _a : ""), encoder.encode("."), typeof jws2.payload === "string" ? encoder.encode(jws2.payload) : jws2.payload);
|
|
10959
|
+
const data2 = concat(encoder.encode(jws2.protected ?? ""), encoder.encode("."), typeof jws2.payload === "string" ? encoder.encode(jws2.payload) : jws2.payload);
|
|
10854
10960
|
let signature2;
|
|
10855
10961
|
try {
|
|
10856
10962
|
signature2 = decode(jws2.signature);
|
|
10857
|
-
} catch
|
|
10963
|
+
} catch {
|
|
10858
10964
|
throw new JWSInvalid("Failed to base64url decode the signature");
|
|
10859
10965
|
}
|
|
10860
10966
|
const verified2 = await verify_default(alg, key3, signature2, data2);
|
|
@@ -10865,7 +10971,7 @@ async function flattenedVerify(jws2, key3, options) {
|
|
|
10865
10971
|
if (b64) {
|
|
10866
10972
|
try {
|
|
10867
10973
|
payload4 = decode(jws2.payload);
|
|
10868
|
-
} catch
|
|
10974
|
+
} catch {
|
|
10869
10975
|
throw new JWSInvalid("Failed to base64url decode the payload");
|
|
10870
10976
|
}
|
|
10871
10977
|
} else if (typeof jws2.payload === "string") {
|
|
@@ -10886,7 +10992,7 @@ async function flattenedVerify(jws2, key3, options) {
|
|
|
10886
10992
|
return result5;
|
|
10887
10993
|
}
|
|
10888
10994
|
|
|
10889
|
-
// ../node_modules/jose/dist/browser/jws/compact/verify.js
|
|
10995
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jws/compact/verify.js
|
|
10890
10996
|
async function compactVerify(jws2, key3, options) {
|
|
10891
10997
|
if (jws2 instanceof Uint8Array) {
|
|
10892
10998
|
jws2 = decoder.decode(jws2);
|
|
@@ -10906,56 +11012,67 @@ async function compactVerify(jws2, key3, options) {
|
|
|
10906
11012
|
return result5;
|
|
10907
11013
|
}
|
|
10908
11014
|
|
|
10909
|
-
// ../node_modules/jose/dist/browser/lib/epoch.js
|
|
11015
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/epoch.js
|
|
10910
11016
|
var epoch_default = (date5) => Math.floor(date5.getTime() / 1e3);
|
|
10911
11017
|
|
|
10912
|
-
// ../node_modules/jose/dist/browser/lib/secs.js
|
|
11018
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/secs.js
|
|
10913
11019
|
var minute = 60;
|
|
10914
11020
|
var hour = minute * 60;
|
|
10915
11021
|
var day = hour * 24;
|
|
10916
11022
|
var week = day * 7;
|
|
10917
11023
|
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)
|
|
11024
|
+
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
11025
|
var secs_default = (str) => {
|
|
10920
11026
|
const matched = REGEX.exec(str);
|
|
10921
|
-
if (!matched) {
|
|
11027
|
+
if (!matched || matched[4] && matched[1]) {
|
|
10922
11028
|
throw new TypeError("Invalid time period format");
|
|
10923
11029
|
}
|
|
10924
|
-
const value6 = parseFloat(matched[
|
|
10925
|
-
const unit2 = matched[
|
|
11030
|
+
const value6 = parseFloat(matched[2]);
|
|
11031
|
+
const unit2 = matched[3].toLowerCase();
|
|
11032
|
+
let numericDate;
|
|
10926
11033
|
switch (unit2) {
|
|
10927
11034
|
case "sec":
|
|
10928
11035
|
case "secs":
|
|
10929
11036
|
case "second":
|
|
10930
11037
|
case "seconds":
|
|
10931
11038
|
case "s":
|
|
10932
|
-
|
|
11039
|
+
numericDate = Math.round(value6);
|
|
11040
|
+
break;
|
|
10933
11041
|
case "minute":
|
|
10934
11042
|
case "minutes":
|
|
10935
11043
|
case "min":
|
|
10936
11044
|
case "mins":
|
|
10937
11045
|
case "m":
|
|
10938
|
-
|
|
11046
|
+
numericDate = Math.round(value6 * minute);
|
|
11047
|
+
break;
|
|
10939
11048
|
case "hour":
|
|
10940
11049
|
case "hours":
|
|
10941
11050
|
case "hr":
|
|
10942
11051
|
case "hrs":
|
|
10943
11052
|
case "h":
|
|
10944
|
-
|
|
11053
|
+
numericDate = Math.round(value6 * hour);
|
|
11054
|
+
break;
|
|
10945
11055
|
case "day":
|
|
10946
11056
|
case "days":
|
|
10947
11057
|
case "d":
|
|
10948
|
-
|
|
11058
|
+
numericDate = Math.round(value6 * day);
|
|
11059
|
+
break;
|
|
10949
11060
|
case "week":
|
|
10950
11061
|
case "weeks":
|
|
10951
11062
|
case "w":
|
|
10952
|
-
|
|
11063
|
+
numericDate = Math.round(value6 * week);
|
|
11064
|
+
break;
|
|
10953
11065
|
default:
|
|
10954
|
-
|
|
11066
|
+
numericDate = Math.round(value6 * year);
|
|
11067
|
+
break;
|
|
11068
|
+
}
|
|
11069
|
+
if (matched[1] === "-" || matched[4] === "ago") {
|
|
11070
|
+
return -numericDate;
|
|
10955
11071
|
}
|
|
11072
|
+
return numericDate;
|
|
10956
11073
|
};
|
|
10957
11074
|
|
|
10958
|
-
// ../node_modules/jose/dist/browser/lib/jwt_claims_set.js
|
|
11075
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/jwt_claims_set.js
|
|
10959
11076
|
var normalizeTyp = (value6) => value6.toLowerCase().replace(/^application\//, "");
|
|
10960
11077
|
var checkAudiencePresence = (audPayload, audOption) => {
|
|
10961
11078
|
if (typeof audPayload === "string") {
|
|
@@ -10967,40 +11084,41 @@ var checkAudiencePresence = (audPayload, audOption) => {
|
|
|
10967
11084
|
return false;
|
|
10968
11085
|
};
|
|
10969
11086
|
var jwt_claims_set_default = (protectedHeader, encodedPayload, options = {}) => {
|
|
10970
|
-
const { typ } = options;
|
|
10971
|
-
if (typ && (typeof protectedHeader.typ !== "string" || normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) {
|
|
10972
|
-
throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', "typ", "check_failed");
|
|
10973
|
-
}
|
|
10974
11087
|
let payload4;
|
|
10975
11088
|
try {
|
|
10976
11089
|
payload4 = JSON.parse(decoder.decode(encodedPayload));
|
|
10977
|
-
} catch
|
|
11090
|
+
} catch {
|
|
10978
11091
|
}
|
|
10979
11092
|
if (!isObject(payload4)) {
|
|
10980
11093
|
throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");
|
|
10981
11094
|
}
|
|
11095
|
+
const { typ } = options;
|
|
11096
|
+
if (typ && (typeof protectedHeader.typ !== "string" || normalizeTyp(protectedHeader.typ) !== normalizeTyp(typ))) {
|
|
11097
|
+
throw new JWTClaimValidationFailed('unexpected "typ" JWT header value', payload4, "typ", "check_failed");
|
|
11098
|
+
}
|
|
10982
11099
|
const { requiredClaims = [], issuer: issuer2, subject: subject5, audience: audience5, maxTokenAge } = options;
|
|
11100
|
+
const presenceCheck = [...requiredClaims];
|
|
10983
11101
|
if (maxTokenAge !== void 0)
|
|
10984
|
-
|
|
11102
|
+
presenceCheck.push("iat");
|
|
10985
11103
|
if (audience5 !== void 0)
|
|
10986
|
-
|
|
11104
|
+
presenceCheck.push("aud");
|
|
10987
11105
|
if (subject5 !== void 0)
|
|
10988
|
-
|
|
11106
|
+
presenceCheck.push("sub");
|
|
10989
11107
|
if (issuer2 !== void 0)
|
|
10990
|
-
|
|
10991
|
-
for (const claim2 of new Set(
|
|
11108
|
+
presenceCheck.push("iss");
|
|
11109
|
+
for (const claim2 of new Set(presenceCheck.reverse())) {
|
|
10992
11110
|
if (!(claim2 in payload4)) {
|
|
10993
|
-
throw new JWTClaimValidationFailed(`missing required "${claim2}" claim`, claim2, "missing");
|
|
11111
|
+
throw new JWTClaimValidationFailed(`missing required "${claim2}" claim`, payload4, claim2, "missing");
|
|
10994
11112
|
}
|
|
10995
11113
|
}
|
|
10996
11114
|
if (issuer2 && !(Array.isArray(issuer2) ? issuer2 : [issuer2]).includes(payload4.iss)) {
|
|
10997
|
-
throw new JWTClaimValidationFailed('unexpected "iss" claim value', "iss", "check_failed");
|
|
11115
|
+
throw new JWTClaimValidationFailed('unexpected "iss" claim value', payload4, "iss", "check_failed");
|
|
10998
11116
|
}
|
|
10999
11117
|
if (subject5 && payload4.sub !== subject5) {
|
|
11000
|
-
throw new JWTClaimValidationFailed('unexpected "sub" claim value', "sub", "check_failed");
|
|
11118
|
+
throw new JWTClaimValidationFailed('unexpected "sub" claim value', payload4, "sub", "check_failed");
|
|
11001
11119
|
}
|
|
11002
11120
|
if (audience5 && !checkAudiencePresence(payload4.aud, typeof audience5 === "string" ? [audience5] : audience5)) {
|
|
11003
|
-
throw new JWTClaimValidationFailed('unexpected "aud" claim value', "aud", "check_failed");
|
|
11121
|
+
throw new JWTClaimValidationFailed('unexpected "aud" claim value', payload4, "aud", "check_failed");
|
|
11004
11122
|
}
|
|
11005
11123
|
let tolerance;
|
|
11006
11124
|
switch (typeof options.clockTolerance) {
|
|
@@ -11019,42 +11137,41 @@ var jwt_claims_set_default = (protectedHeader, encodedPayload, options = {}) =>
|
|
|
11019
11137
|
const { currentDate } = options;
|
|
11020
11138
|
const now = epoch_default(currentDate || /* @__PURE__ */ new Date());
|
|
11021
11139
|
if ((payload4.iat !== void 0 || maxTokenAge) && typeof payload4.iat !== "number") {
|
|
11022
|
-
throw new JWTClaimValidationFailed('"iat" claim must be a number', "iat", "invalid");
|
|
11140
|
+
throw new JWTClaimValidationFailed('"iat" claim must be a number', payload4, "iat", "invalid");
|
|
11023
11141
|
}
|
|
11024
11142
|
if (payload4.nbf !== void 0) {
|
|
11025
11143
|
if (typeof payload4.nbf !== "number") {
|
|
11026
|
-
throw new JWTClaimValidationFailed('"nbf" claim must be a number', "nbf", "invalid");
|
|
11144
|
+
throw new JWTClaimValidationFailed('"nbf" claim must be a number', payload4, "nbf", "invalid");
|
|
11027
11145
|
}
|
|
11028
11146
|
if (payload4.nbf > now + tolerance) {
|
|
11029
|
-
throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', "nbf", "check_failed");
|
|
11147
|
+
throw new JWTClaimValidationFailed('"nbf" claim timestamp check failed', payload4, "nbf", "check_failed");
|
|
11030
11148
|
}
|
|
11031
11149
|
}
|
|
11032
11150
|
if (payload4.exp !== void 0) {
|
|
11033
11151
|
if (typeof payload4.exp !== "number") {
|
|
11034
|
-
throw new JWTClaimValidationFailed('"exp" claim must be a number', "exp", "invalid");
|
|
11152
|
+
throw new JWTClaimValidationFailed('"exp" claim must be a number', payload4, "exp", "invalid");
|
|
11035
11153
|
}
|
|
11036
11154
|
if (payload4.exp <= now - tolerance) {
|
|
11037
|
-
throw new JWTExpired('"exp" claim timestamp check failed', "exp", "check_failed");
|
|
11155
|
+
throw new JWTExpired('"exp" claim timestamp check failed', payload4, "exp", "check_failed");
|
|
11038
11156
|
}
|
|
11039
11157
|
}
|
|
11040
11158
|
if (maxTokenAge) {
|
|
11041
11159
|
const age2 = now - payload4.iat;
|
|
11042
11160
|
const max2 = typeof maxTokenAge === "number" ? maxTokenAge : secs_default(maxTokenAge);
|
|
11043
11161
|
if (age2 - tolerance > max2) {
|
|
11044
|
-
throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', "iat", "check_failed");
|
|
11162
|
+
throw new JWTExpired('"iat" claim timestamp check failed (too far in the past)', payload4, "iat", "check_failed");
|
|
11045
11163
|
}
|
|
11046
11164
|
if (age2 < 0 - tolerance) {
|
|
11047
|
-
throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', "iat", "check_failed");
|
|
11165
|
+
throw new JWTClaimValidationFailed('"iat" claim timestamp check failed (it should be in the past)', payload4, "iat", "check_failed");
|
|
11048
11166
|
}
|
|
11049
11167
|
}
|
|
11050
11168
|
return payload4;
|
|
11051
11169
|
};
|
|
11052
11170
|
|
|
11053
|
-
// ../node_modules/jose/dist/browser/jwt/verify.js
|
|
11171
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwt/verify.js
|
|
11054
11172
|
async function jwtVerify(jwt, key3, options) {
|
|
11055
|
-
var _a;
|
|
11056
11173
|
const verified2 = await compactVerify(jwt, key3, options);
|
|
11057
|
-
if (
|
|
11174
|
+
if (verified2.protectedHeader.crit?.includes("b64") && verified2.protectedHeader.b64 === false) {
|
|
11058
11175
|
throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
|
|
11059
11176
|
}
|
|
11060
11177
|
const payload4 = jwt_claims_set_default(verified2.protectedHeader, verified2.payload, options);
|
|
@@ -11065,7 +11182,7 @@ async function jwtVerify(jwt, key3, options) {
|
|
|
11065
11182
|
return result5;
|
|
11066
11183
|
}
|
|
11067
11184
|
|
|
11068
|
-
// ../node_modules/jose/dist/browser/runtime/sign.js
|
|
11185
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/sign.js
|
|
11069
11186
|
var sign = async (alg, key3, data2) => {
|
|
11070
11187
|
const cryptoKey = await getCryptoKey(alg, key3, "sign");
|
|
11071
11188
|
check_key_length_default(alg, cryptoKey);
|
|
@@ -11074,7 +11191,7 @@ var sign = async (alg, key3, data2) => {
|
|
|
11074
11191
|
};
|
|
11075
11192
|
var sign_default = sign;
|
|
11076
11193
|
|
|
11077
|
-
// ../node_modules/jose/dist/browser/jws/flattened/sign.js
|
|
11194
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jws/flattened/sign.js
|
|
11078
11195
|
var FlattenedSign = class {
|
|
11079
11196
|
constructor(payload4) {
|
|
11080
11197
|
if (!(payload4 instanceof Uint8Array)) {
|
|
@@ -11107,7 +11224,7 @@ var FlattenedSign = class {
|
|
|
11107
11224
|
...this._protectedHeader,
|
|
11108
11225
|
...this._unprotectedHeader
|
|
11109
11226
|
};
|
|
11110
|
-
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options
|
|
11227
|
+
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options?.crit, this._protectedHeader, joseHeader);
|
|
11111
11228
|
let b64 = true;
|
|
11112
11229
|
if (extensions.has("b64")) {
|
|
11113
11230
|
b64 = this._protectedHeader.b64;
|
|
@@ -11119,7 +11236,7 @@ var FlattenedSign = class {
|
|
|
11119
11236
|
if (typeof alg !== "string" || !alg) {
|
|
11120
11237
|
throw new JWSInvalid('JWS "alg" (Algorithm) Header Parameter missing or invalid');
|
|
11121
11238
|
}
|
|
11122
|
-
|
|
11239
|
+
checkKeyTypeWithJwk(alg, key3, "sign");
|
|
11123
11240
|
let payload4 = this._payload;
|
|
11124
11241
|
if (b64) {
|
|
11125
11242
|
payload4 = encoder.encode(encode(payload4));
|
|
@@ -11149,7 +11266,7 @@ var FlattenedSign = class {
|
|
|
11149
11266
|
}
|
|
11150
11267
|
};
|
|
11151
11268
|
|
|
11152
|
-
// ../node_modules/jose/dist/browser/jws/compact/sign.js
|
|
11269
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jws/compact/sign.js
|
|
11153
11270
|
var CompactSign = class {
|
|
11154
11271
|
constructor(payload4) {
|
|
11155
11272
|
this._flattened = new FlattenedSign(payload4);
|
|
@@ -11167,9 +11284,15 @@ var CompactSign = class {
|
|
|
11167
11284
|
}
|
|
11168
11285
|
};
|
|
11169
11286
|
|
|
11170
|
-
// ../node_modules/jose/dist/browser/jwt/produce.js
|
|
11287
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwt/produce.js
|
|
11288
|
+
function validateInput(label4, input2) {
|
|
11289
|
+
if (!Number.isFinite(input2)) {
|
|
11290
|
+
throw new TypeError(`Invalid ${label4} input`);
|
|
11291
|
+
}
|
|
11292
|
+
return input2;
|
|
11293
|
+
}
|
|
11171
11294
|
var ProduceJWT = class {
|
|
11172
|
-
constructor(payload4) {
|
|
11295
|
+
constructor(payload4 = {}) {
|
|
11173
11296
|
if (!isObject(payload4)) {
|
|
11174
11297
|
throw new TypeError("JWT Claims Set MUST be an object");
|
|
11175
11298
|
}
|
|
@@ -11193,7 +11316,9 @@ var ProduceJWT = class {
|
|
|
11193
11316
|
}
|
|
11194
11317
|
setNotBefore(input2) {
|
|
11195
11318
|
if (typeof input2 === "number") {
|
|
11196
|
-
this._payload = { ...this._payload, nbf: input2 };
|
|
11319
|
+
this._payload = { ...this._payload, nbf: validateInput("setNotBefore", input2) };
|
|
11320
|
+
} else if (input2 instanceof Date) {
|
|
11321
|
+
this._payload = { ...this._payload, nbf: validateInput("setNotBefore", epoch_default(input2)) };
|
|
11197
11322
|
} else {
|
|
11198
11323
|
this._payload = { ...this._payload, nbf: epoch_default(/* @__PURE__ */ new Date()) + secs_default(input2) };
|
|
11199
11324
|
}
|
|
@@ -11201,7 +11326,9 @@ var ProduceJWT = class {
|
|
|
11201
11326
|
}
|
|
11202
11327
|
setExpirationTime(input2) {
|
|
11203
11328
|
if (typeof input2 === "number") {
|
|
11204
|
-
this._payload = { ...this._payload, exp: input2 };
|
|
11329
|
+
this._payload = { ...this._payload, exp: validateInput("setExpirationTime", input2) };
|
|
11330
|
+
} else if (input2 instanceof Date) {
|
|
11331
|
+
this._payload = { ...this._payload, exp: validateInput("setExpirationTime", epoch_default(input2)) };
|
|
11205
11332
|
} else {
|
|
11206
11333
|
this._payload = { ...this._payload, exp: epoch_default(/* @__PURE__ */ new Date()) + secs_default(input2) };
|
|
11207
11334
|
}
|
|
@@ -11210,41 +11337,318 @@ var ProduceJWT = class {
|
|
|
11210
11337
|
setIssuedAt(input2) {
|
|
11211
11338
|
if (typeof input2 === "undefined") {
|
|
11212
11339
|
this._payload = { ...this._payload, iat: epoch_default(/* @__PURE__ */ new Date()) };
|
|
11340
|
+
} else if (input2 instanceof Date) {
|
|
11341
|
+
this._payload = { ...this._payload, iat: validateInput("setIssuedAt", epoch_default(input2)) };
|
|
11342
|
+
} else if (typeof input2 === "string") {
|
|
11343
|
+
this._payload = {
|
|
11344
|
+
...this._payload,
|
|
11345
|
+
iat: validateInput("setIssuedAt", epoch_default(/* @__PURE__ */ new Date()) + secs_default(input2))
|
|
11346
|
+
};
|
|
11213
11347
|
} else {
|
|
11214
|
-
this._payload = { ...this._payload, iat: input2 };
|
|
11348
|
+
this._payload = { ...this._payload, iat: validateInput("setIssuedAt", input2) };
|
|
11215
11349
|
}
|
|
11216
11350
|
return this;
|
|
11217
11351
|
}
|
|
11218
11352
|
};
|
|
11219
11353
|
|
|
11220
|
-
// ../node_modules/jose/dist/browser/jwt/sign.js
|
|
11354
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwt/sign.js
|
|
11221
11355
|
var SignJWT = class extends ProduceJWT {
|
|
11222
11356
|
setProtectedHeader(protectedHeader) {
|
|
11223
11357
|
this._protectedHeader = protectedHeader;
|
|
11224
11358
|
return this;
|
|
11225
11359
|
}
|
|
11226
11360
|
async sign(key3, options) {
|
|
11227
|
-
var _a;
|
|
11228
11361
|
const sig = new CompactSign(encoder.encode(JSON.stringify(this._payload)));
|
|
11229
11362
|
sig.setProtectedHeader(this._protectedHeader);
|
|
11230
|
-
if (Array.isArray(
|
|
11363
|
+
if (Array.isArray(this._protectedHeader?.crit) && this._protectedHeader.crit.includes("b64") && this._protectedHeader.b64 === false) {
|
|
11231
11364
|
throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
|
|
11232
11365
|
}
|
|
11233
11366
|
return sig.sign(key3, options);
|
|
11234
11367
|
}
|
|
11235
11368
|
};
|
|
11236
11369
|
|
|
11237
|
-
// ../node_modules/jose/dist/browser/
|
|
11370
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwks/local.js
|
|
11371
|
+
function getKtyFromAlg(alg) {
|
|
11372
|
+
switch (typeof alg === "string" && alg.slice(0, 2)) {
|
|
11373
|
+
case "RS":
|
|
11374
|
+
case "PS":
|
|
11375
|
+
return "RSA";
|
|
11376
|
+
case "ES":
|
|
11377
|
+
return "EC";
|
|
11378
|
+
case "Ed":
|
|
11379
|
+
return "OKP";
|
|
11380
|
+
default:
|
|
11381
|
+
throw new JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set');
|
|
11382
|
+
}
|
|
11383
|
+
}
|
|
11384
|
+
function isJWKSLike(jwks) {
|
|
11385
|
+
return jwks && typeof jwks === "object" && Array.isArray(jwks.keys) && jwks.keys.every(isJWKLike);
|
|
11386
|
+
}
|
|
11387
|
+
function isJWKLike(key3) {
|
|
11388
|
+
return isObject(key3);
|
|
11389
|
+
}
|
|
11390
|
+
function clone(obj) {
|
|
11391
|
+
if (typeof structuredClone === "function") {
|
|
11392
|
+
return structuredClone(obj);
|
|
11393
|
+
}
|
|
11394
|
+
return JSON.parse(JSON.stringify(obj));
|
|
11395
|
+
}
|
|
11396
|
+
var LocalJWKSet = class {
|
|
11397
|
+
constructor(jwks) {
|
|
11398
|
+
this._cached = /* @__PURE__ */ new WeakMap();
|
|
11399
|
+
if (!isJWKSLike(jwks)) {
|
|
11400
|
+
throw new JWKSInvalid("JSON Web Key Set malformed");
|
|
11401
|
+
}
|
|
11402
|
+
this._jwks = clone(jwks);
|
|
11403
|
+
}
|
|
11404
|
+
async getKey(protectedHeader, token) {
|
|
11405
|
+
const { alg, kid } = { ...protectedHeader, ...token?.header };
|
|
11406
|
+
const kty = getKtyFromAlg(alg);
|
|
11407
|
+
const candidates = this._jwks.keys.filter((jwk2) => {
|
|
11408
|
+
let candidate4 = kty === jwk2.kty;
|
|
11409
|
+
if (candidate4 && typeof kid === "string") {
|
|
11410
|
+
candidate4 = kid === jwk2.kid;
|
|
11411
|
+
}
|
|
11412
|
+
if (candidate4 && typeof jwk2.alg === "string") {
|
|
11413
|
+
candidate4 = alg === jwk2.alg;
|
|
11414
|
+
}
|
|
11415
|
+
if (candidate4 && typeof jwk2.use === "string") {
|
|
11416
|
+
candidate4 = jwk2.use === "sig";
|
|
11417
|
+
}
|
|
11418
|
+
if (candidate4 && Array.isArray(jwk2.key_ops)) {
|
|
11419
|
+
candidate4 = jwk2.key_ops.includes("verify");
|
|
11420
|
+
}
|
|
11421
|
+
if (candidate4 && alg === "EdDSA") {
|
|
11422
|
+
candidate4 = jwk2.crv === "Ed25519" || jwk2.crv === "Ed448";
|
|
11423
|
+
}
|
|
11424
|
+
if (candidate4) {
|
|
11425
|
+
switch (alg) {
|
|
11426
|
+
case "ES256":
|
|
11427
|
+
candidate4 = jwk2.crv === "P-256";
|
|
11428
|
+
break;
|
|
11429
|
+
case "ES256K":
|
|
11430
|
+
candidate4 = jwk2.crv === "secp256k1";
|
|
11431
|
+
break;
|
|
11432
|
+
case "ES384":
|
|
11433
|
+
candidate4 = jwk2.crv === "P-384";
|
|
11434
|
+
break;
|
|
11435
|
+
case "ES512":
|
|
11436
|
+
candidate4 = jwk2.crv === "P-521";
|
|
11437
|
+
break;
|
|
11438
|
+
}
|
|
11439
|
+
}
|
|
11440
|
+
return candidate4;
|
|
11441
|
+
});
|
|
11442
|
+
const { 0: jwk, length: length2 } = candidates;
|
|
11443
|
+
if (length2 === 0) {
|
|
11444
|
+
throw new JWKSNoMatchingKey();
|
|
11445
|
+
}
|
|
11446
|
+
if (length2 !== 1) {
|
|
11447
|
+
const error4 = new JWKSMultipleMatchingKeys();
|
|
11448
|
+
const { _cached } = this;
|
|
11449
|
+
error4[Symbol.asyncIterator] = async function* () {
|
|
11450
|
+
for (const jwk2 of candidates) {
|
|
11451
|
+
try {
|
|
11452
|
+
yield await importWithAlgCache(_cached, jwk2, alg);
|
|
11453
|
+
} catch {
|
|
11454
|
+
}
|
|
11455
|
+
}
|
|
11456
|
+
};
|
|
11457
|
+
throw error4;
|
|
11458
|
+
}
|
|
11459
|
+
return importWithAlgCache(this._cached, jwk, alg);
|
|
11460
|
+
}
|
|
11461
|
+
};
|
|
11462
|
+
async function importWithAlgCache(cache, jwk, alg) {
|
|
11463
|
+
const cached = cache.get(jwk) || cache.set(jwk, {}).get(jwk);
|
|
11464
|
+
if (cached[alg] === void 0) {
|
|
11465
|
+
const key3 = await importJWK({ ...jwk, ext: true }, alg);
|
|
11466
|
+
if (key3 instanceof Uint8Array || key3.type !== "public") {
|
|
11467
|
+
throw new JWKSInvalid("JSON Web Key Set members must be public keys");
|
|
11468
|
+
}
|
|
11469
|
+
cached[alg] = key3;
|
|
11470
|
+
}
|
|
11471
|
+
return cached[alg];
|
|
11472
|
+
}
|
|
11473
|
+
function createLocalJWKSet(jwks) {
|
|
11474
|
+
const set = new LocalJWKSet(jwks);
|
|
11475
|
+
const localJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token);
|
|
11476
|
+
Object.defineProperties(localJWKSet, {
|
|
11477
|
+
jwks: {
|
|
11478
|
+
value: () => clone(set._jwks),
|
|
11479
|
+
enumerable: true,
|
|
11480
|
+
configurable: false,
|
|
11481
|
+
writable: false
|
|
11482
|
+
}
|
|
11483
|
+
});
|
|
11484
|
+
return localJWKSet;
|
|
11485
|
+
}
|
|
11486
|
+
|
|
11487
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/fetch_jwks.js
|
|
11488
|
+
var fetchJwks = async (url7, timeout2, options) => {
|
|
11489
|
+
let controller2;
|
|
11490
|
+
let id4;
|
|
11491
|
+
let timedOut = false;
|
|
11492
|
+
if (typeof AbortController === "function") {
|
|
11493
|
+
controller2 = new AbortController();
|
|
11494
|
+
id4 = setTimeout(() => {
|
|
11495
|
+
timedOut = true;
|
|
11496
|
+
controller2.abort();
|
|
11497
|
+
}, timeout2);
|
|
11498
|
+
}
|
|
11499
|
+
const response6 = await fetch(url7.href, {
|
|
11500
|
+
signal: controller2 ? controller2.signal : void 0,
|
|
11501
|
+
redirect: "manual",
|
|
11502
|
+
headers: options.headers
|
|
11503
|
+
}).catch((err) => {
|
|
11504
|
+
if (timedOut)
|
|
11505
|
+
throw new JWKSTimeout();
|
|
11506
|
+
throw err;
|
|
11507
|
+
});
|
|
11508
|
+
if (id4 !== void 0)
|
|
11509
|
+
clearTimeout(id4);
|
|
11510
|
+
if (response6.status !== 200) {
|
|
11511
|
+
throw new JOSEError("Expected 200 OK from the JSON Web Key Set HTTP response");
|
|
11512
|
+
}
|
|
11513
|
+
try {
|
|
11514
|
+
return await response6.json();
|
|
11515
|
+
} catch {
|
|
11516
|
+
throw new JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON");
|
|
11517
|
+
}
|
|
11518
|
+
};
|
|
11519
|
+
var fetch_jwks_default = fetchJwks;
|
|
11520
|
+
|
|
11521
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwks/remote.js
|
|
11522
|
+
function isCloudflareWorkers() {
|
|
11523
|
+
return typeof WebSocketPair !== "undefined" || typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime !== "undefined" && EdgeRuntime === "vercel";
|
|
11524
|
+
}
|
|
11525
|
+
var USER_AGENT;
|
|
11526
|
+
if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
|
|
11527
|
+
const NAME = "jose";
|
|
11528
|
+
const VERSION = "v5.9.3";
|
|
11529
|
+
USER_AGENT = `${NAME}/${VERSION}`;
|
|
11530
|
+
}
|
|
11531
|
+
var jwksCache = Symbol();
|
|
11532
|
+
function isFreshJwksCache(input2, cacheMaxAge) {
|
|
11533
|
+
if (typeof input2 !== "object" || input2 === null) {
|
|
11534
|
+
return false;
|
|
11535
|
+
}
|
|
11536
|
+
if (!("uat" in input2) || typeof input2.uat !== "number" || Date.now() - input2.uat >= cacheMaxAge) {
|
|
11537
|
+
return false;
|
|
11538
|
+
}
|
|
11539
|
+
if (!("jwks" in input2) || !isObject(input2.jwks) || !Array.isArray(input2.jwks.keys) || !Array.prototype.every.call(input2.jwks.keys, isObject)) {
|
|
11540
|
+
return false;
|
|
11541
|
+
}
|
|
11542
|
+
return true;
|
|
11543
|
+
}
|
|
11544
|
+
var RemoteJWKSet = class {
|
|
11545
|
+
constructor(url7, options) {
|
|
11546
|
+
if (!(url7 instanceof URL)) {
|
|
11547
|
+
throw new TypeError("url must be an instance of URL");
|
|
11548
|
+
}
|
|
11549
|
+
this._url = new URL(url7.href);
|
|
11550
|
+
this._options = { agent: options?.agent, headers: options?.headers };
|
|
11551
|
+
this._timeoutDuration = typeof options?.timeoutDuration === "number" ? options?.timeoutDuration : 5e3;
|
|
11552
|
+
this._cooldownDuration = typeof options?.cooldownDuration === "number" ? options?.cooldownDuration : 3e4;
|
|
11553
|
+
this._cacheMaxAge = typeof options?.cacheMaxAge === "number" ? options?.cacheMaxAge : 6e5;
|
|
11554
|
+
if (options?.[jwksCache] !== void 0) {
|
|
11555
|
+
this._cache = options?.[jwksCache];
|
|
11556
|
+
if (isFreshJwksCache(options?.[jwksCache], this._cacheMaxAge)) {
|
|
11557
|
+
this._jwksTimestamp = this._cache.uat;
|
|
11558
|
+
this._local = createLocalJWKSet(this._cache.jwks);
|
|
11559
|
+
}
|
|
11560
|
+
}
|
|
11561
|
+
}
|
|
11562
|
+
coolingDown() {
|
|
11563
|
+
return typeof this._jwksTimestamp === "number" ? Date.now() < this._jwksTimestamp + this._cooldownDuration : false;
|
|
11564
|
+
}
|
|
11565
|
+
fresh() {
|
|
11566
|
+
return typeof this._jwksTimestamp === "number" ? Date.now() < this._jwksTimestamp + this._cacheMaxAge : false;
|
|
11567
|
+
}
|
|
11568
|
+
async getKey(protectedHeader, token) {
|
|
11569
|
+
if (!this._local || !this.fresh()) {
|
|
11570
|
+
await this.reload();
|
|
11571
|
+
}
|
|
11572
|
+
try {
|
|
11573
|
+
return await this._local(protectedHeader, token);
|
|
11574
|
+
} catch (err) {
|
|
11575
|
+
if (err instanceof JWKSNoMatchingKey) {
|
|
11576
|
+
if (this.coolingDown() === false) {
|
|
11577
|
+
await this.reload();
|
|
11578
|
+
return this._local(protectedHeader, token);
|
|
11579
|
+
}
|
|
11580
|
+
}
|
|
11581
|
+
throw err;
|
|
11582
|
+
}
|
|
11583
|
+
}
|
|
11584
|
+
async reload() {
|
|
11585
|
+
if (this._pendingFetch && isCloudflareWorkers()) {
|
|
11586
|
+
this._pendingFetch = void 0;
|
|
11587
|
+
}
|
|
11588
|
+
const headers = new Headers(this._options.headers);
|
|
11589
|
+
if (USER_AGENT && !headers.has("User-Agent")) {
|
|
11590
|
+
headers.set("User-Agent", USER_AGENT);
|
|
11591
|
+
this._options.headers = Object.fromEntries(headers.entries());
|
|
11592
|
+
}
|
|
11593
|
+
this._pendingFetch || (this._pendingFetch = fetch_jwks_default(this._url, this._timeoutDuration, this._options).then((json) => {
|
|
11594
|
+
this._local = createLocalJWKSet(json);
|
|
11595
|
+
if (this._cache) {
|
|
11596
|
+
this._cache.uat = Date.now();
|
|
11597
|
+
this._cache.jwks = json;
|
|
11598
|
+
}
|
|
11599
|
+
this._jwksTimestamp = Date.now();
|
|
11600
|
+
this._pendingFetch = void 0;
|
|
11601
|
+
}).catch((err) => {
|
|
11602
|
+
this._pendingFetch = void 0;
|
|
11603
|
+
throw err;
|
|
11604
|
+
}));
|
|
11605
|
+
await this._pendingFetch;
|
|
11606
|
+
}
|
|
11607
|
+
};
|
|
11608
|
+
function createRemoteJWKSet(url7, options) {
|
|
11609
|
+
const set = new RemoteJWKSet(url7, options);
|
|
11610
|
+
const remoteJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token);
|
|
11611
|
+
Object.defineProperties(remoteJWKSet, {
|
|
11612
|
+
coolingDown: {
|
|
11613
|
+
get: () => set.coolingDown(),
|
|
11614
|
+
enumerable: true,
|
|
11615
|
+
configurable: false
|
|
11616
|
+
},
|
|
11617
|
+
fresh: {
|
|
11618
|
+
get: () => set.fresh(),
|
|
11619
|
+
enumerable: true,
|
|
11620
|
+
configurable: false
|
|
11621
|
+
},
|
|
11622
|
+
reload: {
|
|
11623
|
+
value: () => set.reload(),
|
|
11624
|
+
enumerable: true,
|
|
11625
|
+
configurable: false,
|
|
11626
|
+
writable: false
|
|
11627
|
+
},
|
|
11628
|
+
reloading: {
|
|
11629
|
+
get: () => !!set._pendingFetch,
|
|
11630
|
+
enumerable: true,
|
|
11631
|
+
configurable: false
|
|
11632
|
+
},
|
|
11633
|
+
jwks: {
|
|
11634
|
+
value: () => set._local?.jwks(),
|
|
11635
|
+
enumerable: true,
|
|
11636
|
+
configurable: false,
|
|
11637
|
+
writable: false
|
|
11638
|
+
}
|
|
11639
|
+
});
|
|
11640
|
+
return remoteJWKSet;
|
|
11641
|
+
}
|
|
11642
|
+
|
|
11643
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/generate.js
|
|
11238
11644
|
function getModulusLengthOption(options) {
|
|
11239
|
-
|
|
11240
|
-
const modulusLength = (_a = options === null || options === void 0 ? void 0 : options.modulusLength) !== null && _a !== void 0 ? _a : 2048;
|
|
11645
|
+
const modulusLength = options?.modulusLength ?? 2048;
|
|
11241
11646
|
if (typeof modulusLength !== "number" || modulusLength < 2048) {
|
|
11242
11647
|
throw new JOSENotSupported("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");
|
|
11243
11648
|
}
|
|
11244
11649
|
return modulusLength;
|
|
11245
11650
|
}
|
|
11246
11651
|
async function generateKeyPair(alg, options) {
|
|
11247
|
-
var _a, _b, _c;
|
|
11248
11652
|
let algorithm3;
|
|
11249
11653
|
let keyUsages;
|
|
11250
11654
|
switch (alg) {
|
|
@@ -11294,9 +11698,9 @@ async function generateKeyPair(alg, options) {
|
|
|
11294
11698
|
algorithm3 = { name: "ECDSA", namedCurve: "P-521" };
|
|
11295
11699
|
keyUsages = ["sign", "verify"];
|
|
11296
11700
|
break;
|
|
11297
|
-
case "EdDSA":
|
|
11701
|
+
case "EdDSA": {
|
|
11298
11702
|
keyUsages = ["sign", "verify"];
|
|
11299
|
-
const crv =
|
|
11703
|
+
const crv = options?.crv ?? "Ed25519";
|
|
11300
11704
|
switch (crv) {
|
|
11301
11705
|
case "Ed25519":
|
|
11302
11706
|
case "Ed448":
|
|
@@ -11306,22 +11710,23 @@ async function generateKeyPair(alg, options) {
|
|
|
11306
11710
|
throw new JOSENotSupported("Invalid or unsupported crv option provided");
|
|
11307
11711
|
}
|
|
11308
11712
|
break;
|
|
11713
|
+
}
|
|
11309
11714
|
case "ECDH-ES":
|
|
11310
11715
|
case "ECDH-ES+A128KW":
|
|
11311
11716
|
case "ECDH-ES+A192KW":
|
|
11312
11717
|
case "ECDH-ES+A256KW": {
|
|
11313
11718
|
keyUsages = ["deriveKey", "deriveBits"];
|
|
11314
|
-
const
|
|
11315
|
-
switch (
|
|
11719
|
+
const crv = options?.crv ?? "P-256";
|
|
11720
|
+
switch (crv) {
|
|
11316
11721
|
case "P-256":
|
|
11317
11722
|
case "P-384":
|
|
11318
11723
|
case "P-521": {
|
|
11319
|
-
algorithm3 = { name: "ECDH", namedCurve:
|
|
11724
|
+
algorithm3 = { name: "ECDH", namedCurve: crv };
|
|
11320
11725
|
break;
|
|
11321
11726
|
}
|
|
11322
11727
|
case "X25519":
|
|
11323
11728
|
case "X448":
|
|
11324
|
-
algorithm3 = { name:
|
|
11729
|
+
algorithm3 = { name: crv };
|
|
11325
11730
|
break;
|
|
11326
11731
|
default:
|
|
11327
11732
|
throw new JOSENotSupported("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448");
|
|
@@ -11331,15 +11736,25 @@ async function generateKeyPair(alg, options) {
|
|
|
11331
11736
|
default:
|
|
11332
11737
|
throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
11333
11738
|
}
|
|
11334
|
-
return webcrypto_default.subtle.generateKey(algorithm3,
|
|
11739
|
+
return webcrypto_default.subtle.generateKey(algorithm3, options?.extractable ?? false, keyUsages);
|
|
11335
11740
|
}
|
|
11336
11741
|
|
|
11337
|
-
// ../node_modules/jose/dist/browser/key/generate_key_pair.js
|
|
11742
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/key/generate_key_pair.js
|
|
11338
11743
|
async function generateKeyPair2(alg, options) {
|
|
11339
11744
|
return generateKeyPair(alg, options);
|
|
11340
11745
|
}
|
|
11341
11746
|
|
|
11342
|
-
// ../node_modules/uuid/dist/esm-browser/
|
|
11747
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/uuid/dist/esm-browser/stringify.js
|
|
11748
|
+
var byteToHex = [];
|
|
11749
|
+
for (i = 0; i < 256; ++i) {
|
|
11750
|
+
byteToHex.push((i + 256).toString(16).slice(1));
|
|
11751
|
+
}
|
|
11752
|
+
var i;
|
|
11753
|
+
function unsafeStringify(arr, offset3 = 0) {
|
|
11754
|
+
return (byteToHex[arr[offset3 + 0]] + byteToHex[arr[offset3 + 1]] + byteToHex[arr[offset3 + 2]] + byteToHex[arr[offset3 + 3]] + "-" + byteToHex[arr[offset3 + 4]] + byteToHex[arr[offset3 + 5]] + "-" + byteToHex[arr[offset3 + 6]] + byteToHex[arr[offset3 + 7]] + "-" + byteToHex[arr[offset3 + 8]] + byteToHex[arr[offset3 + 9]] + "-" + byteToHex[arr[offset3 + 10]] + byteToHex[arr[offset3 + 11]] + byteToHex[arr[offset3 + 12]] + byteToHex[arr[offset3 + 13]] + byteToHex[arr[offset3 + 14]] + byteToHex[arr[offset3 + 15]]).toLowerCase();
|
|
11755
|
+
}
|
|
11756
|
+
|
|
11757
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/uuid/dist/esm-browser/rng.js
|
|
11343
11758
|
var getRandomValues;
|
|
11344
11759
|
var rnds8 = new Uint8Array(16);
|
|
11345
11760
|
function rng() {
|
|
@@ -11352,33 +11767,24 @@ function rng() {
|
|
|
11352
11767
|
return getRandomValues(rnds8);
|
|
11353
11768
|
}
|
|
11354
11769
|
|
|
11355
|
-
// ../node_modules/uuid/dist/esm-browser/
|
|
11356
|
-
var byteToHex = [];
|
|
11357
|
-
for (let i = 0; i < 256; ++i) {
|
|
11358
|
-
byteToHex.push((i + 256).toString(16).slice(1));
|
|
11359
|
-
}
|
|
11360
|
-
function unsafeStringify(arr, offset3 = 0) {
|
|
11361
|
-
return byteToHex[arr[offset3 + 0]] + byteToHex[arr[offset3 + 1]] + byteToHex[arr[offset3 + 2]] + byteToHex[arr[offset3 + 3]] + "-" + byteToHex[arr[offset3 + 4]] + byteToHex[arr[offset3 + 5]] + "-" + byteToHex[arr[offset3 + 6]] + byteToHex[arr[offset3 + 7]] + "-" + byteToHex[arr[offset3 + 8]] + byteToHex[arr[offset3 + 9]] + "-" + byteToHex[arr[offset3 + 10]] + byteToHex[arr[offset3 + 11]] + byteToHex[arr[offset3 + 12]] + byteToHex[arr[offset3 + 13]] + byteToHex[arr[offset3 + 14]] + byteToHex[arr[offset3 + 15]];
|
|
11362
|
-
}
|
|
11363
|
-
|
|
11364
|
-
// ../node_modules/uuid/dist/esm-browser/native.js
|
|
11770
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/uuid/dist/esm-browser/native.js
|
|
11365
11771
|
var randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
11366
11772
|
var native_default = {
|
|
11367
11773
|
randomUUID
|
|
11368
11774
|
};
|
|
11369
11775
|
|
|
11370
|
-
// ../node_modules/uuid/dist/esm-browser/v4.js
|
|
11776
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/uuid/dist/esm-browser/v4.js
|
|
11371
11777
|
function v4(options, buf, offset3) {
|
|
11372
11778
|
if (native_default.randomUUID && !buf && !options) {
|
|
11373
11779
|
return native_default.randomUUID();
|
|
11374
11780
|
}
|
|
11375
11781
|
options = options || {};
|
|
11376
|
-
|
|
11782
|
+
var rnds = options.random || (options.rng || rng)();
|
|
11377
11783
|
rnds[6] = rnds[6] & 15 | 64;
|
|
11378
11784
|
rnds[8] = rnds[8] & 63 | 128;
|
|
11379
11785
|
if (buf) {
|
|
11380
11786
|
offset3 = offset3 || 0;
|
|
11381
|
-
for (
|
|
11787
|
+
for (var i = 0; i < 16; ++i) {
|
|
11382
11788
|
buf[offset3 + i] = rnds[i];
|
|
11383
11789
|
}
|
|
11384
11790
|
return buf;
|
|
@@ -11406,17 +11812,6 @@ var SCOPE_OPENID = "openid";
|
|
|
11406
11812
|
var SCOPE_OFFLINE = "offline_access";
|
|
11407
11813
|
var SCOPE_WEBID = "webid";
|
|
11408
11814
|
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
11815
|
var AggregateHandler = class {
|
|
11421
11816
|
constructor(handleables) {
|
|
11422
11817
|
this.handleables = handleables;
|
|
@@ -11453,24 +11848,11 @@ var AggregateHandler = class {
|
|
|
11453
11848
|
}).join(", ")}`);
|
|
11454
11849
|
}
|
|
11455
11850
|
};
|
|
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
11851
|
async function getWebidFromTokenPayload(idToken, jwksIri, issuerIri, clientId) {
|
|
11470
|
-
const jwk = await fetchJwks(jwksIri, issuerIri);
|
|
11471
11852
|
let payload4;
|
|
11853
|
+
let clientIdInPayload;
|
|
11472
11854
|
try {
|
|
11473
|
-
const { payload: verifiedPayload } = await jwtVerify(idToken,
|
|
11855
|
+
const { payload: verifiedPayload } = await jwtVerify(idToken, createRemoteJWKSet(new URL(jwksIri)), {
|
|
11474
11856
|
issuer: issuerIri,
|
|
11475
11857
|
audience: clientId
|
|
11476
11858
|
});
|
|
@@ -11478,15 +11860,24 @@ async function getWebidFromTokenPayload(idToken, jwksIri, issuerIri, clientId) {
|
|
|
11478
11860
|
} catch (e) {
|
|
11479
11861
|
throw new Error(`Token verification failed: ${e.stack}`);
|
|
11480
11862
|
}
|
|
11863
|
+
if (typeof payload4.azp === "string") {
|
|
11864
|
+
clientIdInPayload = payload4.azp;
|
|
11865
|
+
}
|
|
11481
11866
|
if (typeof payload4.webid === "string") {
|
|
11482
|
-
return
|
|
11867
|
+
return {
|
|
11868
|
+
webId: payload4.webid,
|
|
11869
|
+
clientId: clientIdInPayload
|
|
11870
|
+
};
|
|
11483
11871
|
}
|
|
11484
11872
|
if (typeof payload4.sub !== "string") {
|
|
11485
11873
|
throw new Error(`The token ${JSON.stringify(payload4)} is invalid: it has no 'webid' claim and no 'sub' claim.`);
|
|
11486
11874
|
}
|
|
11487
11875
|
try {
|
|
11488
11876
|
new URL(payload4.sub);
|
|
11489
|
-
return
|
|
11877
|
+
return {
|
|
11878
|
+
webId: payload4.sub,
|
|
11879
|
+
clientId: clientIdInPayload
|
|
11880
|
+
};
|
|
11490
11881
|
} catch (e) {
|
|
11491
11882
|
throw new Error(`The token has no 'webid' claim, and its 'sub' claim of [${payload4.sub}] is invalid as a URL - error [${e}].`);
|
|
11492
11883
|
}
|
|
@@ -11510,17 +11901,29 @@ function removeOpenIdParams(redirectUrl) {
|
|
|
11510
11901
|
cleanedUpUrl.searchParams.delete("iss");
|
|
11511
11902
|
return cleanedUpUrl;
|
|
11512
11903
|
}
|
|
11904
|
+
function booleanWithFallback(value6, fallback) {
|
|
11905
|
+
if (typeof value6 === "boolean") {
|
|
11906
|
+
return Boolean(value6);
|
|
11907
|
+
}
|
|
11908
|
+
return Boolean(fallback);
|
|
11909
|
+
}
|
|
11513
11910
|
var AuthorizationCodeWithPkceOidcHandlerBase = class {
|
|
11514
11911
|
constructor(storageUtility, redirector) {
|
|
11515
11912
|
this.storageUtility = storageUtility;
|
|
11516
11913
|
this.redirector = redirector;
|
|
11914
|
+
this.parametersGuard = (oidcLoginOptions) => {
|
|
11915
|
+
return oidcLoginOptions.issuerConfiguration.grantTypesSupported !== void 0 && oidcLoginOptions.issuerConfiguration.grantTypesSupported.indexOf("authorization_code") > -1 && oidcLoginOptions.redirectUrl !== void 0;
|
|
11916
|
+
};
|
|
11517
11917
|
this.storageUtility = storageUtility;
|
|
11518
11918
|
this.redirector = redirector;
|
|
11519
11919
|
}
|
|
11520
11920
|
async canHandle(oidcLoginOptions) {
|
|
11521
|
-
return
|
|
11921
|
+
return this.parametersGuard(oidcLoginOptions);
|
|
11522
11922
|
}
|
|
11523
11923
|
async handleRedirect({ oidcLoginOptions, state: state2, codeVerifier, targetUrl: targetUrl3 }) {
|
|
11924
|
+
if (!this.parametersGuard(oidcLoginOptions)) {
|
|
11925
|
+
throw new Error("The authorization code grant requires a redirectUrl.");
|
|
11926
|
+
}
|
|
11524
11927
|
await Promise.all([
|
|
11525
11928
|
// We use the OAuth 'state' value (which should be crypto-random) as
|
|
11526
11929
|
// the key in our storage to store our actual SessionID. We do this
|
|
@@ -11531,7 +11934,6 @@ var AuthorizationCodeWithPkceOidcHandlerBase = class {
|
|
|
11531
11934
|
// that session ID can be any developer-specified value, and therefore
|
|
11532
11935
|
// may not be appropriate (since the OAuth 'state' value should really
|
|
11533
11936
|
// be an unguessable crypto-random value).
|
|
11534
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
11535
11937
|
this.storageUtility.setForUser(state2, {
|
|
11536
11938
|
sessionId: oidcLoginOptions.sessionId
|
|
11537
11939
|
}),
|
|
@@ -11540,12 +11942,12 @@ var AuthorizationCodeWithPkceOidcHandlerBase = class {
|
|
|
11540
11942
|
// our session ID is unnecessary, but it provides a slightly cleaner
|
|
11541
11943
|
// separation of concerns.
|
|
11542
11944
|
this.storageUtility.setForUser(oidcLoginOptions.sessionId, {
|
|
11543
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
11544
11945
|
codeVerifier,
|
|
11545
11946
|
issuer: oidcLoginOptions.issuer.toString(),
|
|
11546
11947
|
// The redirect URL is read after redirect, so it must be stored now.
|
|
11547
11948
|
redirectUrl: oidcLoginOptions.redirectUrl,
|
|
11548
|
-
dpop: oidcLoginOptions.dpop
|
|
11949
|
+
dpop: Boolean(oidcLoginOptions.dpop).toString(),
|
|
11950
|
+
keepAlive: booleanWithFallback(oidcLoginOptions.keepAlive, true).toString()
|
|
11549
11951
|
})
|
|
11550
11952
|
]);
|
|
11551
11953
|
this.redirector.redirect(targetUrl3, {
|
|
@@ -11607,7 +12009,7 @@ function getUnauthenticatedSession() {
|
|
|
11607
12009
|
return {
|
|
11608
12010
|
isLoggedIn: false,
|
|
11609
12011
|
sessionId: v4_default(),
|
|
11610
|
-
fetch: (...args) =>
|
|
12012
|
+
fetch: (...args) => fetch(...args)
|
|
11611
12013
|
};
|
|
11612
12014
|
}
|
|
11613
12015
|
async function clear(sessionId, storage2) {
|
|
@@ -11701,48 +12103,51 @@ function determineSigningAlg(supported, preferred2) {
|
|
|
11701
12103
|
return supported.includes(signingAlg);
|
|
11702
12104
|
})) !== null && _a !== void 0 ? _a : null;
|
|
11703
12105
|
}
|
|
11704
|
-
function
|
|
11705
|
-
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
|
|
11709
|
-
|
|
11710
|
-
|
|
11711
|
-
return "dynamic";
|
|
12106
|
+
function isStaticClient(options) {
|
|
12107
|
+
return options.clientId !== void 0 && !isValidUrl(options.clientId);
|
|
12108
|
+
}
|
|
12109
|
+
function isSolidOidcClient(options, issuerConfig) {
|
|
12110
|
+
return issuerConfig.scopesSupported.includes("webid") && options.clientId !== void 0 && isValidUrl(options.clientId);
|
|
12111
|
+
}
|
|
12112
|
+
function isKnownClientType(clientType) {
|
|
12113
|
+
return typeof clientType === "string" && ["dynamic", "static", "solid-oidc"].includes(clientType);
|
|
11712
12114
|
}
|
|
11713
12115
|
async function handleRegistration(options, issuerConfig, storageUtility, clientRegistrar) {
|
|
11714
|
-
|
|
11715
|
-
if (
|
|
12116
|
+
let clientInfo;
|
|
12117
|
+
if (isSolidOidcClient(options, issuerConfig)) {
|
|
12118
|
+
clientInfo = {
|
|
12119
|
+
clientId: options.clientId,
|
|
12120
|
+
clientName: options.clientName,
|
|
12121
|
+
clientType: "solid-oidc"
|
|
12122
|
+
};
|
|
12123
|
+
} else if (isStaticClient(options)) {
|
|
12124
|
+
clientInfo = {
|
|
12125
|
+
clientId: options.clientId,
|
|
12126
|
+
clientSecret: options.clientSecret,
|
|
12127
|
+
clientName: options.clientName,
|
|
12128
|
+
clientType: "static"
|
|
12129
|
+
};
|
|
12130
|
+
} else {
|
|
11716
12131
|
return clientRegistrar.getClient({
|
|
11717
12132
|
sessionId: options.sessionId,
|
|
11718
12133
|
clientName: options.clientName,
|
|
11719
12134
|
redirectUrl: options.redirectUrl
|
|
11720
12135
|
}, issuerConfig);
|
|
11721
12136
|
}
|
|
11722
|
-
|
|
11723
|
-
|
|
11724
|
-
|
|
11725
|
-
|
|
11726
|
-
|
|
11727
|
-
|
|
11728
|
-
await storageUtility.setForUser(options.sessionId, {
|
|
11729
|
-
clientSecret: options.clientSecret
|
|
11730
|
-
});
|
|
12137
|
+
const infoToSave = {
|
|
12138
|
+
clientId: clientInfo.clientId,
|
|
12139
|
+
clientType: clientInfo.clientType
|
|
12140
|
+
};
|
|
12141
|
+
if (clientInfo.clientType === "static") {
|
|
12142
|
+
infoToSave.clientSecret = clientInfo.clientSecret;
|
|
11731
12143
|
}
|
|
11732
|
-
if (
|
|
11733
|
-
|
|
11734
|
-
clientName: options.clientName
|
|
11735
|
-
});
|
|
12144
|
+
if (clientInfo.clientName) {
|
|
12145
|
+
infoToSave.clientName = clientInfo.clientName;
|
|
11736
12146
|
}
|
|
11737
|
-
|
|
11738
|
-
|
|
11739
|
-
clientId: options.clientId,
|
|
11740
|
-
clientSecret: options.clientSecret,
|
|
11741
|
-
clientName: options.clientName,
|
|
11742
|
-
clientType
|
|
11743
|
-
};
|
|
12147
|
+
await storageUtility.setForUser(options.sessionId, infoToSave);
|
|
12148
|
+
return clientInfo;
|
|
11744
12149
|
}
|
|
11745
|
-
var
|
|
12150
|
+
var boundFetch = (request2, init) => fetch(request2, init);
|
|
11746
12151
|
var ClientAuthentication = class {
|
|
11747
12152
|
constructor(loginHandler, redirectHandler, logoutHandler, sessionInfoManager, issuerConfigFetcher) {
|
|
11748
12153
|
this.loginHandler = loginHandler;
|
|
@@ -11750,13 +12155,13 @@ var ClientAuthentication = class {
|
|
|
11750
12155
|
this.logoutHandler = logoutHandler;
|
|
11751
12156
|
this.sessionInfoManager = sessionInfoManager;
|
|
11752
12157
|
this.issuerConfigFetcher = issuerConfigFetcher;
|
|
11753
|
-
this.fetch =
|
|
12158
|
+
this.fetch = boundFetch;
|
|
11754
12159
|
this.logout = async (sessionId, options) => {
|
|
11755
12160
|
await this.logoutHandler.handle(sessionId, (options === null || options === void 0 ? void 0 : options.logoutType) === "idp" ? {
|
|
11756
12161
|
...options,
|
|
11757
12162
|
toLogoutUrl: this.boundLogout
|
|
11758
12163
|
} : options);
|
|
11759
|
-
this.fetch =
|
|
12164
|
+
this.fetch = boundFetch;
|
|
11760
12165
|
delete this.boundLogout;
|
|
11761
12166
|
};
|
|
11762
12167
|
this.getSessionInfo = async (sessionId) => {
|
|
@@ -11774,13 +12179,14 @@ var ClientAuthentication = class {
|
|
|
11774
12179
|
};
|
|
11775
12180
|
async function loadOidcContextFromStorage(sessionId, storageUtility, configFetcher) {
|
|
11776
12181
|
try {
|
|
11777
|
-
const [issuerIri, codeVerifier, storedRedirectIri, dpop] = await Promise.all([
|
|
12182
|
+
const [issuerIri, codeVerifier, storedRedirectIri, dpop, keepAlive] = await Promise.all([
|
|
11778
12183
|
storageUtility.getForUser(sessionId, "issuer", {
|
|
11779
12184
|
errorIfNull: true
|
|
11780
12185
|
}),
|
|
11781
12186
|
storageUtility.getForUser(sessionId, "codeVerifier"),
|
|
11782
12187
|
storageUtility.getForUser(sessionId, "redirectUrl"),
|
|
11783
|
-
storageUtility.getForUser(sessionId, "dpop", { errorIfNull: true })
|
|
12188
|
+
storageUtility.getForUser(sessionId, "dpop", { errorIfNull: true }),
|
|
12189
|
+
storageUtility.getForUser(sessionId, "keepAlive")
|
|
11784
12190
|
]);
|
|
11785
12191
|
await storageUtility.deleteForUser(sessionId, "codeVerifier");
|
|
11786
12192
|
const issuerConfig = await configFetcher.fetchConfig(issuerIri);
|
|
@@ -11788,12 +12194,34 @@ async function loadOidcContextFromStorage(sessionId, storageUtility, configFetch
|
|
|
11788
12194
|
codeVerifier,
|
|
11789
12195
|
redirectUrl: storedRedirectIri,
|
|
11790
12196
|
issuerConfig,
|
|
11791
|
-
dpop: dpop === "true"
|
|
12197
|
+
dpop: dpop === "true",
|
|
12198
|
+
// Default keepAlive to true if not found in storage.
|
|
12199
|
+
keepAlive: typeof keepAlive === "string" ? keepAlive === "true" : true
|
|
11792
12200
|
};
|
|
11793
12201
|
} catch (e) {
|
|
11794
12202
|
throw new Error(`Failed to retrieve OIDC context from storage associated with session [${sessionId}]: ${e}`);
|
|
11795
12203
|
}
|
|
11796
12204
|
}
|
|
12205
|
+
async function saveSessionInfoToStorage(storageUtility, sessionId, webId, clientId, isLoggedIn2, refreshToken, secure, dpopKey) {
|
|
12206
|
+
if (refreshToken !== void 0) {
|
|
12207
|
+
await storageUtility.setForUser(sessionId, { refreshToken }, { secure });
|
|
12208
|
+
}
|
|
12209
|
+
if (webId !== void 0) {
|
|
12210
|
+
await storageUtility.setForUser(sessionId, { webId }, { secure });
|
|
12211
|
+
}
|
|
12212
|
+
if (clientId !== void 0) {
|
|
12213
|
+
await storageUtility.setForUser(sessionId, { clientId }, { secure });
|
|
12214
|
+
}
|
|
12215
|
+
if (isLoggedIn2 !== void 0) {
|
|
12216
|
+
await storageUtility.setForUser(sessionId, { isLoggedIn: isLoggedIn2 }, { secure });
|
|
12217
|
+
}
|
|
12218
|
+
if (dpopKey !== void 0) {
|
|
12219
|
+
await storageUtility.setForUser(sessionId, {
|
|
12220
|
+
publicKey: JSON.stringify(dpopKey.publicKey),
|
|
12221
|
+
privateKey: JSON.stringify(await exportJWK(dpopKey.privateKey))
|
|
12222
|
+
}, { secure });
|
|
12223
|
+
}
|
|
12224
|
+
}
|
|
11797
12225
|
var StorageUtility = class {
|
|
11798
12226
|
constructor(secureStorage, insecureStorage) {
|
|
11799
12227
|
this.secureStorage = secureStorage;
|
|
@@ -11945,8 +12373,8 @@ async function buildAuthenticatedHeaders(targetUrl3, authToken, dpopKey, default
|
|
|
11945
12373
|
headers
|
|
11946
12374
|
};
|
|
11947
12375
|
}
|
|
11948
|
-
async function makeAuthenticatedRequest(
|
|
11949
|
-
return
|
|
12376
|
+
async function makeAuthenticatedRequest(accessToken, url7, defaultRequestInit, dpopKey) {
|
|
12377
|
+
return fetch(url7, await buildAuthenticatedHeaders(url7.toString(), accessToken, dpopKey, defaultRequestInit));
|
|
11950
12378
|
}
|
|
11951
12379
|
async function refreshAccessToken(refreshOptions, dpopKey, eventEmitter) {
|
|
11952
12380
|
var _a;
|
|
@@ -11970,7 +12398,7 @@ var computeRefreshDelay = (expiresIn) => {
|
|
|
11970
12398
|
}
|
|
11971
12399
|
return DEFAULT_EXPIRATION_TIME_SECONDS;
|
|
11972
12400
|
};
|
|
11973
|
-
async function buildAuthenticatedFetch(
|
|
12401
|
+
async function buildAuthenticatedFetch(accessToken, options) {
|
|
11974
12402
|
var _a;
|
|
11975
12403
|
let currentAccessToken = accessToken;
|
|
11976
12404
|
let latestTimeout;
|
|
@@ -12018,7 +12446,7 @@ async function buildAuthenticatedFetch(unauthFetch, accessToken, options) {
|
|
|
12018
12446
|
options.eventEmitter.emit(EVENTS.TIMEOUT_SET, expirationTimeout);
|
|
12019
12447
|
}
|
|
12020
12448
|
return async (url7, requestInit) => {
|
|
12021
|
-
let response6 = await makeAuthenticatedRequest(
|
|
12449
|
+
let response6 = await makeAuthenticatedRequest(currentAccessToken, url7, requestInit, options === null || options === void 0 ? void 0 : options.dpopKey);
|
|
12022
12450
|
const failedButNotExpectedAuthError = !response6.ok && !isExpectedAuthError(response6.status);
|
|
12023
12451
|
if (response6.ok || failedButNotExpectedAuthError) {
|
|
12024
12452
|
return response6;
|
|
@@ -12026,7 +12454,6 @@ async function buildAuthenticatedFetch(unauthFetch, accessToken, options) {
|
|
|
12026
12454
|
const hasBeenRedirected = response6.url !== url7;
|
|
12027
12455
|
if (hasBeenRedirected && (options === null || options === void 0 ? void 0 : options.dpopKey) !== void 0) {
|
|
12028
12456
|
response6 = await makeAuthenticatedRequest(
|
|
12029
|
-
unauthFetch,
|
|
12030
12457
|
currentAccessToken,
|
|
12031
12458
|
// Replace the original target IRI (`url`) by the redirection target
|
|
12032
12459
|
response6.url,
|
|
@@ -12038,8 +12465,57 @@ async function buildAuthenticatedFetch(unauthFetch, accessToken, options) {
|
|
|
12038
12465
|
};
|
|
12039
12466
|
}
|
|
12040
12467
|
|
|
12468
|
+
// ../node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/esm-browser/stringify.js
|
|
12469
|
+
var byteToHex2 = [];
|
|
12470
|
+
for (i = 0; i < 256; ++i) {
|
|
12471
|
+
byteToHex2.push((i + 256).toString(16).slice(1));
|
|
12472
|
+
}
|
|
12473
|
+
var i;
|
|
12474
|
+
function unsafeStringify2(arr, offset3 = 0) {
|
|
12475
|
+
return (byteToHex2[arr[offset3 + 0]] + byteToHex2[arr[offset3 + 1]] + byteToHex2[arr[offset3 + 2]] + byteToHex2[arr[offset3 + 3]] + "-" + byteToHex2[arr[offset3 + 4]] + byteToHex2[arr[offset3 + 5]] + "-" + byteToHex2[arr[offset3 + 6]] + byteToHex2[arr[offset3 + 7]] + "-" + byteToHex2[arr[offset3 + 8]] + byteToHex2[arr[offset3 + 9]] + "-" + byteToHex2[arr[offset3 + 10]] + byteToHex2[arr[offset3 + 11]] + byteToHex2[arr[offset3 + 12]] + byteToHex2[arr[offset3 + 13]] + byteToHex2[arr[offset3 + 14]] + byteToHex2[arr[offset3 + 15]]).toLowerCase();
|
|
12476
|
+
}
|
|
12477
|
+
|
|
12478
|
+
// ../node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/esm-browser/rng.js
|
|
12479
|
+
var getRandomValues2;
|
|
12480
|
+
var rnds82 = new Uint8Array(16);
|
|
12481
|
+
function rng2() {
|
|
12482
|
+
if (!getRandomValues2) {
|
|
12483
|
+
getRandomValues2 = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
12484
|
+
if (!getRandomValues2) {
|
|
12485
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
12486
|
+
}
|
|
12487
|
+
}
|
|
12488
|
+
return getRandomValues2(rnds82);
|
|
12489
|
+
}
|
|
12490
|
+
|
|
12491
|
+
// ../node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/esm-browser/native.js
|
|
12492
|
+
var randomUUID2 = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
12493
|
+
var native_default2 = {
|
|
12494
|
+
randomUUID: randomUUID2
|
|
12495
|
+
};
|
|
12496
|
+
|
|
12497
|
+
// ../node_modules/@inrupt/solid-client-authn-browser/node_modules/uuid/dist/esm-browser/v4.js
|
|
12498
|
+
function v42(options, buf, offset3) {
|
|
12499
|
+
if (native_default2.randomUUID && !buf && !options) {
|
|
12500
|
+
return native_default2.randomUUID();
|
|
12501
|
+
}
|
|
12502
|
+
options = options || {};
|
|
12503
|
+
var rnds = options.random || (options.rng || rng2)();
|
|
12504
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
12505
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
12506
|
+
if (buf) {
|
|
12507
|
+
offset3 = offset3 || 0;
|
|
12508
|
+
for (var i = 0; i < 16; ++i) {
|
|
12509
|
+
buf[offset3 + i] = rnds[i];
|
|
12510
|
+
}
|
|
12511
|
+
return buf;
|
|
12512
|
+
}
|
|
12513
|
+
return unsafeStringify2(rnds);
|
|
12514
|
+
}
|
|
12515
|
+
var v4_default2 = v42;
|
|
12516
|
+
|
|
12041
12517
|
// ../node_modules/@inrupt/solid-client-authn-browser/dist/index.mjs
|
|
12042
|
-
var
|
|
12518
|
+
var import_events = __toESM(require_events(), 1);
|
|
12043
12519
|
|
|
12044
12520
|
// ../node_modules/@inrupt/oidc-client-ext/dist/index.es.js
|
|
12045
12521
|
var import_oidc_client = __toESM(require_oidc_client_min());
|
|
@@ -12187,79 +12663,20 @@ async function getTokens(issuer2, client, data2, dpop) {
|
|
|
12187
12663
|
headers,
|
|
12188
12664
|
body: new URLSearchParams(requestBody).toString()
|
|
12189
12665
|
};
|
|
12190
|
-
const rawTokenResponse = await
|
|
12666
|
+
const rawTokenResponse = await fetch(issuer2.tokenEndpoint, tokenRequestInit);
|
|
12191
12667
|
const jsonTokenResponse = await rawTokenResponse.json();
|
|
12192
12668
|
const tokenResponse = validateTokenEndpointResponse(jsonTokenResponse, dpop);
|
|
12193
|
-
const webId = await getWebidFromTokenPayload(tokenResponse.id_token, issuer2.jwksUri, issuer2.issuer, client.clientId);
|
|
12669
|
+
const { webId, clientId } = await getWebidFromTokenPayload(tokenResponse.id_token, issuer2.jwksUri, issuer2.issuer, client.clientId);
|
|
12194
12670
|
return {
|
|
12195
12671
|
accessToken: tokenResponse.access_token,
|
|
12196
12672
|
idToken: tokenResponse.id_token,
|
|
12197
12673
|
refreshToken: hasRefreshToken(tokenResponse) ? tokenResponse.refresh_token : void 0,
|
|
12198
12674
|
webId,
|
|
12675
|
+
clientId,
|
|
12199
12676
|
dpopKey,
|
|
12200
12677
|
expiresIn: tokenResponse.expires_in
|
|
12201
12678
|
};
|
|
12202
12679
|
}
|
|
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
12680
|
var isValidUrl2 = (url7) => {
|
|
12264
12681
|
try {
|
|
12265
12682
|
new URL(url7);
|
|
@@ -12293,7 +12710,7 @@ async function refresh(refreshToken, issuer2, client, dpopKey) {
|
|
|
12293
12710
|
} else if (isValidUrl2(client.clientId)) {
|
|
12294
12711
|
requestBody.client_id = client.clientId;
|
|
12295
12712
|
}
|
|
12296
|
-
const rawResponse = await
|
|
12713
|
+
const rawResponse = await fetch(issuer2.tokenEndpoint, {
|
|
12297
12714
|
method: "POST",
|
|
12298
12715
|
body: new URLSearchParams(requestBody).toString(),
|
|
12299
12716
|
headers: {
|
|
@@ -12309,7 +12726,7 @@ async function refresh(refreshToken, issuer2, client, dpopKey) {
|
|
|
12309
12726
|
throw new Error(`The token endpoint of issuer ${issuer2.issuer} returned a malformed response.`);
|
|
12310
12727
|
}
|
|
12311
12728
|
const validatedResponse = validateTokenEndpointResponse(response6, dpopKey !== void 0);
|
|
12312
|
-
const webId = await getWebidFromTokenPayload(validatedResponse.id_token, issuer2.jwksUri, issuer2.issuer, client.clientId);
|
|
12729
|
+
const { webId } = await getWebidFromTokenPayload(validatedResponse.id_token, issuer2.jwksUri, issuer2.issuer, client.clientId);
|
|
12313
12730
|
return {
|
|
12314
12731
|
accessToken: validatedResponse.access_token,
|
|
12315
12732
|
idToken: validatedResponse.id_token,
|
|
@@ -12391,7 +12808,7 @@ var ClientAuthentication2 = class extends ClientAuthentication {
|
|
|
12391
12808
|
};
|
|
12392
12809
|
this.handleIncomingRedirect = async (url7, eventEmitter) => {
|
|
12393
12810
|
try {
|
|
12394
|
-
const redirectInfo = await this.redirectHandler.handle(url7, eventEmitter);
|
|
12811
|
+
const redirectInfo = await this.redirectHandler.handle(url7, eventEmitter, void 0);
|
|
12395
12812
|
this.fetch = redirectInfo.fetch.bind(window);
|
|
12396
12813
|
this.boundLogout = redirectInfo.getLogoutUrl;
|
|
12397
12814
|
await this.cleanUrlAfterRedirect(url7);
|
|
@@ -12399,7 +12816,8 @@ var ClientAuthentication2 = class extends ClientAuthentication {
|
|
|
12399
12816
|
isLoggedIn: redirectInfo.isLoggedIn,
|
|
12400
12817
|
webId: redirectInfo.webId,
|
|
12401
12818
|
sessionId: redirectInfo.sessionId,
|
|
12402
|
-
expirationDate: redirectInfo.expirationDate
|
|
12819
|
+
expirationDate: redirectInfo.expirationDate,
|
|
12820
|
+
clientAppId: redirectInfo.clientAppId
|
|
12403
12821
|
};
|
|
12404
12822
|
} catch (err) {
|
|
12405
12823
|
await this.cleanUrlAfterRedirect(url7);
|
|
@@ -12470,8 +12888,7 @@ var AuthorizationCodeWithPkceOidcHandler = class extends AuthorizationCodeWithPk
|
|
|
12470
12888
|
authority: oidcLoginOptions.issuer.toString(),
|
|
12471
12889
|
client_id: oidcLoginOptions.client.clientId,
|
|
12472
12890
|
client_secret: oidcLoginOptions.client.clientSecret,
|
|
12473
|
-
redirect_uri: oidcLoginOptions.redirectUrl
|
|
12474
|
-
post_logout_redirect_uri: oidcLoginOptions.redirectUrl.toString(),
|
|
12891
|
+
redirect_uri: oidcLoginOptions.redirectUrl,
|
|
12475
12892
|
response_type: "code",
|
|
12476
12893
|
scope: DEFAULT_SCOPES,
|
|
12477
12894
|
filterProtocolClaims: true,
|
|
@@ -12617,7 +13034,7 @@ var IssuerConfigFetcher = class _IssuerConfigFetcher {
|
|
|
12617
13034
|
// includes the full issuer path. See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig.
|
|
12618
13035
|
issuer2.endsWith("/") ? issuer2 : `${issuer2}/`
|
|
12619
13036
|
).href;
|
|
12620
|
-
const issuerConfigRequestBody = await
|
|
13037
|
+
const issuerConfigRequestBody = await fetch(openIdConfigUrl);
|
|
12621
13038
|
try {
|
|
12622
13039
|
issuerConfig = processConfig(await issuerConfigRequestBody.json());
|
|
12623
13040
|
} catch (err) {
|
|
@@ -12708,7 +13125,6 @@ var FallbackRedirectHandler = class {
|
|
|
12708
13125
|
return getUnauthenticatedSession();
|
|
12709
13126
|
}
|
|
12710
13127
|
};
|
|
12711
|
-
var globalFetch2 = (...args) => fetch2.call(globalThis, ...args);
|
|
12712
13128
|
var AuthCodeRedirectHandler = class {
|
|
12713
13129
|
constructor(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokerRefresher) {
|
|
12714
13130
|
this.storageUtility = storageUtility;
|
|
@@ -12751,21 +13167,16 @@ var AuthCodeRedirectHandler = class {
|
|
|
12751
13167
|
throw new Error(`The redirect URL for session ${storedSessionId} is missing from storage.`);
|
|
12752
13168
|
}
|
|
12753
13169
|
const client = await this.clientRegistrar.getClient({ sessionId: storedSessionId }, issuerConfig);
|
|
12754
|
-
let tokens;
|
|
12755
13170
|
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
|
-
}
|
|
13171
|
+
const tokens = await getTokens(issuerConfig, client, {
|
|
13172
|
+
grantType: "authorization_code",
|
|
13173
|
+
// We rely on our 'canHandle' function checking that the OAuth 'code'
|
|
13174
|
+
// parameter is present in our query string.
|
|
13175
|
+
code: url7.searchParams.get("code"),
|
|
13176
|
+
codeVerifier,
|
|
13177
|
+
redirectUrl: storedRedirectIri
|
|
13178
|
+
}, isDpop);
|
|
13179
|
+
window.localStorage.removeItem(`oidc.${oauthState}`);
|
|
12769
13180
|
let refreshOptions;
|
|
12770
13181
|
if (tokens.refreshToken !== void 0) {
|
|
12771
13182
|
refreshOptions = {
|
|
@@ -12774,16 +13185,13 @@ var AuthCodeRedirectHandler = class {
|
|
|
12774
13185
|
tokenRefresher: this.tokerRefresher
|
|
12775
13186
|
};
|
|
12776
13187
|
}
|
|
12777
|
-
const authFetch = await buildAuthenticatedFetch(
|
|
13188
|
+
const authFetch = await buildAuthenticatedFetch(tokens.accessToken, {
|
|
12778
13189
|
dpopKey: tokens.dpopKey,
|
|
12779
13190
|
refreshOptions,
|
|
12780
13191
|
eventEmitter,
|
|
12781
13192
|
expiresIn: tokens.expiresIn
|
|
12782
13193
|
});
|
|
12783
|
-
await this.storageUtility
|
|
12784
|
-
webId: tokens.webId,
|
|
12785
|
-
isLoggedIn: "true"
|
|
12786
|
-
}, { secure: true });
|
|
13194
|
+
await saveSessionInfoToStorage(this.storageUtility, storedSessionId, tokens.webId, tokens.clientId, "true", void 0, true);
|
|
12787
13195
|
const sessionInfo = await this.sessionInfoManager.get(storedSessionId);
|
|
12788
13196
|
if (!sessionInfo) {
|
|
12789
13197
|
throw new Error(`Could not retrieve session: [${storedSessionId}].`);
|
|
@@ -12834,33 +13242,34 @@ var ClientRegistrar = class {
|
|
|
12834
13242
|
this.storageUtility = storageUtility;
|
|
12835
13243
|
}
|
|
12836
13244
|
async getClient(options, issuerConfig) {
|
|
12837
|
-
const [
|
|
12838
|
-
storedClientId,
|
|
12839
|
-
storedClientSecret
|
|
12840
|
-
// storedClientName,
|
|
12841
|
-
] = await Promise.all([
|
|
13245
|
+
const [storedClientId, storedClientSecret, storedClientName, storedClientType] = await Promise.all([
|
|
12842
13246
|
this.storageUtility.getForUser(options.sessionId, "clientId", {
|
|
12843
13247
|
secure: false
|
|
12844
13248
|
}),
|
|
12845
13249
|
this.storageUtility.getForUser(options.sessionId, "clientSecret", {
|
|
12846
13250
|
secure: false
|
|
13251
|
+
}),
|
|
13252
|
+
this.storageUtility.getForUser(options.sessionId, "clientName", {
|
|
13253
|
+
secure: false
|
|
13254
|
+
}),
|
|
13255
|
+
this.storageUtility.getForUser(options.sessionId, "clientType", {
|
|
13256
|
+
secure: false
|
|
12847
13257
|
})
|
|
12848
|
-
// this.storageUtility.getForUser(options.sessionId, "clientName", {
|
|
12849
|
-
// // FIXME: figure out how to persist secure storage at reload
|
|
12850
|
-
// secure: false,
|
|
12851
|
-
// }),
|
|
12852
13258
|
]);
|
|
12853
|
-
if (storedClientId) {
|
|
13259
|
+
if (storedClientId && isKnownClientType(storedClientType)) {
|
|
12854
13260
|
return {
|
|
12855
13261
|
clientId: storedClientId,
|
|
12856
13262
|
clientSecret: storedClientSecret,
|
|
12857
|
-
|
|
13263
|
+
clientName: storedClientName,
|
|
13264
|
+
// Note: static clients are not applicable in a browser context.
|
|
13265
|
+
clientType: storedClientType
|
|
12858
13266
|
};
|
|
12859
13267
|
}
|
|
12860
13268
|
try {
|
|
12861
13269
|
const registeredClient = await registerClient(options, issuerConfig);
|
|
12862
13270
|
const infoToSave = {
|
|
12863
|
-
clientId: registeredClient.clientId
|
|
13271
|
+
clientId: registeredClient.clientId,
|
|
13272
|
+
clientType: "dynamic"
|
|
12864
13273
|
};
|
|
12865
13274
|
if (registeredClient.clientSecret) {
|
|
12866
13275
|
infoToSave.clientSecret = registeredClient.clientSecret;
|
|
@@ -12919,9 +13328,6 @@ var TokenRefresher = class {
|
|
|
12919
13328
|
const tokenSet = await refresh(refreshToken, oidcContext.issuerConfig, clientInfo, dpopKey);
|
|
12920
13329
|
if (tokenSet.refreshToken !== void 0) {
|
|
12921
13330
|
eventEmitter === null || eventEmitter === void 0 ? void 0 : eventEmitter.emit(EVENTS.NEW_REFRESH_TOKEN, tokenSet.refreshToken);
|
|
12922
|
-
await this.storageUtility.setForUser(sessionId, {
|
|
12923
|
-
refreshToken: tokenSet.refreshToken
|
|
12924
|
-
});
|
|
12925
13331
|
}
|
|
12926
13332
|
return tokenSet;
|
|
12927
13333
|
}
|
|
@@ -12969,7 +13375,7 @@ async function silentlyAuthenticate(sessionId, clientAuthn, session4) {
|
|
|
12969
13375
|
function isLoggedIn(sessionInfo) {
|
|
12970
13376
|
return !!(sessionInfo === null || sessionInfo === void 0 ? void 0 : sessionInfo.isLoggedIn);
|
|
12971
13377
|
}
|
|
12972
|
-
var Session = class
|
|
13378
|
+
var Session = class {
|
|
12973
13379
|
/**
|
|
12974
13380
|
* Session object constructor. Typically called as follows:
|
|
12975
13381
|
*
|
|
@@ -12986,7 +13392,6 @@ var Session = class _Session extends import_events2.default {
|
|
|
12986
13392
|
*
|
|
12987
13393
|
*/
|
|
12988
13394
|
constructor(sessionOptions = {}, sessionId = void 0) {
|
|
12989
|
-
super();
|
|
12990
13395
|
this.tokenRequestInProgress = false;
|
|
12991
13396
|
this.login = async (options) => {
|
|
12992
13397
|
var _a;
|
|
@@ -13043,7 +13448,7 @@ var Session = class _Session extends import_events2.default {
|
|
|
13043
13448
|
this.tokenRequestInProgress = false;
|
|
13044
13449
|
return sessionInfo;
|
|
13045
13450
|
};
|
|
13046
|
-
this.events = new
|
|
13451
|
+
this.events = new import_events.default();
|
|
13047
13452
|
if (sessionOptions.clientAuthentication) {
|
|
13048
13453
|
this.clientAuthentication = sessionOptions.clientAuthentication;
|
|
13049
13454
|
} else if (sessionOptions.secureStorage && sessionOptions.insecureStorage) {
|
|
@@ -13058,11 +13463,12 @@ var Session = class _Session extends import_events2.default {
|
|
|
13058
13463
|
this.info = {
|
|
13059
13464
|
sessionId: sessionOptions.sessionInfo.sessionId,
|
|
13060
13465
|
isLoggedIn: false,
|
|
13061
|
-
webId: sessionOptions.sessionInfo.webId
|
|
13466
|
+
webId: sessionOptions.sessionInfo.webId,
|
|
13467
|
+
clientAppId: sessionOptions.sessionInfo.clientAppId
|
|
13062
13468
|
};
|
|
13063
13469
|
} else {
|
|
13064
13470
|
this.info = {
|
|
13065
|
-
sessionId: sessionId !== null && sessionId !== void 0 ? sessionId :
|
|
13471
|
+
sessionId: sessionId !== null && sessionId !== void 0 ? sessionId : v4_default2(),
|
|
13066
13472
|
isLoggedIn: false
|
|
13067
13473
|
};
|
|
13068
13474
|
}
|
|
@@ -13070,62 +13476,11 @@ var Session = class _Session extends import_events2.default {
|
|
|
13070
13476
|
this.events.on(EVENTS.SESSION_EXPIRED, () => this.internalLogout(false));
|
|
13071
13477
|
this.events.on(EVENTS.ERROR, () => this.internalLogout(false));
|
|
13072
13478
|
}
|
|
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
13479
|
setSessionInfo(sessionInfo) {
|
|
13126
13480
|
this.info.isLoggedIn = sessionInfo.isLoggedIn;
|
|
13127
13481
|
this.info.webId = sessionInfo.webId;
|
|
13128
13482
|
this.info.sessionId = sessionInfo.sessionId;
|
|
13483
|
+
this.info.clientAppId = sessionInfo.clientAppId;
|
|
13129
13484
|
this.info.expirationDate = sessionInfo.expirationDate;
|
|
13130
13485
|
this.events.on(EVENTS.SESSION_EXTENDED, (expiresIn) => {
|
|
13131
13486
|
this.info.expirationDate = Date.now() + expiresIn * 1e3;
|
|
@@ -13172,16 +13527,19 @@ var BrowserSession = class {
|
|
|
13172
13527
|
* @deprecated use observeSession instead
|
|
13173
13528
|
*/
|
|
13174
13529
|
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(
|
|
13530
|
+
this.session.events.on(EVENTS.LOGIN, () => callback(this.session.info));
|
|
13531
|
+
this.session.events.on(EVENTS.LOGOUT, () => callback(this.session.info));
|
|
13532
|
+
this.session.events.on(
|
|
13533
|
+
EVENTS.SESSION_RESTORED,
|
|
13534
|
+
() => callback(this.session.info)
|
|
13535
|
+
);
|
|
13178
13536
|
callback(this.session.info);
|
|
13179
13537
|
}
|
|
13180
13538
|
observeSession() {
|
|
13181
13539
|
return this.sessionInfo$;
|
|
13182
13540
|
}
|
|
13183
13541
|
onSessionRestore(callback) {
|
|
13184
|
-
this.session.on(EVENTS.SESSION_RESTORED, callback);
|
|
13542
|
+
this.session.events.on(EVENTS.SESSION_RESTORED, callback);
|
|
13185
13543
|
}
|
|
13186
13544
|
};
|
|
13187
13545
|
|
|
@@ -13242,7 +13600,7 @@ var FileFetcher = class {
|
|
|
13242
13600
|
|
|
13243
13601
|
// src/modules/contacts.ts
|
|
13244
13602
|
async function loadContactsModule(store) {
|
|
13245
|
-
const module2 = await import("./dist-
|
|
13603
|
+
const module2 = await import("./dist-F3EUFQHU.js");
|
|
13246
13604
|
return new module2.default({
|
|
13247
13605
|
store: store.graph,
|
|
13248
13606
|
fetcher: store.fetcher,
|
|
@@ -13284,6 +13642,30 @@ function labelForType(typeUri) {
|
|
|
13284
13642
|
}
|
|
13285
13643
|
}
|
|
13286
13644
|
|
|
13645
|
+
// src/thing/labelFromUri.ts
|
|
13646
|
+
function labelFromUri(uri6) {
|
|
13647
|
+
const url7 = new URL(uri6);
|
|
13648
|
+
if (isTooGeneric(url7.hash)) {
|
|
13649
|
+
return (getFilename(url7) || url7.host + url7.pathname) + url7.hash;
|
|
13650
|
+
}
|
|
13651
|
+
return labelFromFragment(url7.hash) || getFilename(url7) || url7.host;
|
|
13652
|
+
}
|
|
13653
|
+
function labelFromFragment(fragment) {
|
|
13654
|
+
return fragment ? fragment.split("#")[1] : null;
|
|
13655
|
+
}
|
|
13656
|
+
function isTooGeneric(fragment) {
|
|
13657
|
+
const genericFragments = ["#it", "#this", "#me", "#i"];
|
|
13658
|
+
return genericFragments.includes(fragment);
|
|
13659
|
+
}
|
|
13660
|
+
function getFilename(url7) {
|
|
13661
|
+
if (url7.pathname.endsWith("/")) {
|
|
13662
|
+
const containerName = url7.pathname.split("/").at(-2);
|
|
13663
|
+
return containerName ? containerName + "/" : null;
|
|
13664
|
+
} else {
|
|
13665
|
+
return url7.pathname.split("/").pop();
|
|
13666
|
+
}
|
|
13667
|
+
}
|
|
13668
|
+
|
|
13287
13669
|
// src/thing/Thing.ts
|
|
13288
13670
|
var Thing = class {
|
|
13289
13671
|
constructor(uri6, store, editable = false) {
|
|
@@ -13305,13 +13687,17 @@ var Thing = class {
|
|
|
13305
13687
|
"http://schema.org/caption",
|
|
13306
13688
|
"https://schema.org/caption"
|
|
13307
13689
|
);
|
|
13308
|
-
|
|
13690
|
+
if (value6) {
|
|
13691
|
+
return value6;
|
|
13692
|
+
}
|
|
13693
|
+
return labelFromUri(this.uri);
|
|
13309
13694
|
}
|
|
13310
13695
|
literals() {
|
|
13311
13696
|
const statements = this.store.statementsMatching(namedNode(this.uri));
|
|
13312
13697
|
const values = statements.filter((it) => isLiteral(it.object)).reduce(accumulateValues, {});
|
|
13313
13698
|
return Object.keys(values).map((predicate2) => ({
|
|
13314
13699
|
predicate: predicate2,
|
|
13700
|
+
label: labelFromUri(predicate2),
|
|
13315
13701
|
values: values[predicate2]
|
|
13316
13702
|
}));
|
|
13317
13703
|
}
|
|
@@ -13320,6 +13706,7 @@ var Thing = class {
|
|
|
13320
13706
|
const values = statements.filter((it) => isNamedNode(it.object) && !isRdfType(it.predicate)).reduce(accumulateValues, {});
|
|
13321
13707
|
return Object.keys(values).map((predicate2) => ({
|
|
13322
13708
|
predicate: predicate2,
|
|
13709
|
+
label: labelFromUri(predicate2),
|
|
13323
13710
|
uris: values[predicate2]
|
|
13324
13711
|
}));
|
|
13325
13712
|
}
|
|
@@ -13332,6 +13719,7 @@ var Thing = class {
|
|
|
13332
13719
|
const values = statements.reduce(accumulateSubjects, {});
|
|
13333
13720
|
return Object.keys(values).map((predicate2) => ({
|
|
13334
13721
|
predicate: predicate2,
|
|
13722
|
+
label: labelFromUri(predicate2),
|
|
13335
13723
|
uris: values[predicate2]
|
|
13336
13724
|
}));
|
|
13337
13725
|
}
|
|
@@ -13757,7 +14145,7 @@ var provider = "http://www.w3.org/ns/activitystreams#provider";
|
|
|
13757
14145
|
var replies = "http://www.w3.org/ns/activitystreams#replies";
|
|
13758
14146
|
var result = "http://www.w3.org/ns/activitystreams#result";
|
|
13759
14147
|
var audience = "http://www.w3.org/ns/activitystreams#audience";
|
|
13760
|
-
var
|
|
14148
|
+
var tag2 = "http://www.w3.org/ns/activitystreams#tag";
|
|
13761
14149
|
var tags = "http://www.w3.org/ns/activitystreams#tags";
|
|
13762
14150
|
var target = "http://www.w3.org/ns/activitystreams#target";
|
|
13763
14151
|
var origin2 = "http://www.w3.org/ns/activitystreams#origin";
|
|
@@ -13875,7 +14263,7 @@ var asImport = /* @__PURE__ */ Object.freeze({
|
|
|
13875
14263
|
replies,
|
|
13876
14264
|
result,
|
|
13877
14265
|
audience,
|
|
13878
|
-
tag,
|
|
14266
|
+
tag: tag2,
|
|
13879
14267
|
tags,
|
|
13880
14268
|
target,
|
|
13881
14269
|
origin: origin2,
|
|
@@ -18326,7 +18714,7 @@ var Patient = "http://hl7.org/fhir/Patient";
|
|
|
18326
18714
|
var _identified = "http://hl7.org/fhir/_identified";
|
|
18327
18715
|
var ExplanationOfBenefitAdjudication = "http://hl7.org/fhir/ExplanationOfBenefitAdjudication";
|
|
18328
18716
|
var _Subscription = "http://hl7.org/fhir/_Subscription";
|
|
18329
|
-
var
|
|
18717
|
+
var tag3 = "http://hl7.org/fhir/tag";
|
|
18330
18718
|
var _performed = "http://hl7.org/fhir/_performed";
|
|
18331
18719
|
var _formOf = "http://hl7.org/fhir/_formOf";
|
|
18332
18720
|
var DeviceDefinitionPackagingComponentPackagingPackaging = "http://hl7.org/fhir/DeviceDefinitionPackagingComponentPackagingPackaging";
|
|
@@ -22559,7 +22947,7 @@ var fhirImport = /* @__PURE__ */ Object.freeze({
|
|
|
22559
22947
|
_identified,
|
|
22560
22948
|
ExplanationOfBenefitAdjudication,
|
|
22561
22949
|
_Subscription,
|
|
22562
|
-
tag:
|
|
22950
|
+
tag: tag3,
|
|
22563
22951
|
_performed,
|
|
22564
22952
|
_formOf,
|
|
22565
22953
|
DeviceDefinitionPackagingComponentPackagingPackaging,
|
|
@@ -23163,7 +23551,7 @@ var Document3 = "http://www.w3.org/2007/ont/link#Document";
|
|
|
23163
23551
|
var Mailbox = "http://www.w3.org/2007/ont/link#Mailbox";
|
|
23164
23552
|
var ProtocolEvent = "http://www.w3.org/2007/ont/link#ProtocolEvent";
|
|
23165
23553
|
var RDFDocument = "http://www.w3.org/2007/ont/link#RDFDocument";
|
|
23166
|
-
var
|
|
23554
|
+
var Response = "http://www.w3.org/2007/ont/link#Response";
|
|
23167
23555
|
var Session3 = "http://www.w3.org/2007/ont/link#Session";
|
|
23168
23556
|
var isMentionedIn = "http://www.w3.org/2007/ont/link#isMentionedIn";
|
|
23169
23557
|
var mentionsClass = "http://www.w3.org/2007/ont/link#mentionsClass";
|
|
@@ -23183,7 +23571,7 @@ var linkImport = /* @__PURE__ */ Object.freeze({
|
|
|
23183
23571
|
Mailbox,
|
|
23184
23572
|
ProtocolEvent,
|
|
23185
23573
|
RDFDocument,
|
|
23186
|
-
Response
|
|
23574
|
+
Response,
|
|
23187
23575
|
Session: Session3,
|
|
23188
23576
|
isMentionedIn,
|
|
23189
23577
|
mentionsClass,
|
|
@@ -33449,7 +33837,7 @@ var Document4 = "http://www.w3.org/2007/ont/link#Document";
|
|
|
33449
33837
|
var Mailbox2 = "http://www.w3.org/2007/ont/link#Mailbox";
|
|
33450
33838
|
var ProtocolEvent2 = "http://www.w3.org/2007/ont/link#ProtocolEvent";
|
|
33451
33839
|
var RDFDocument2 = "http://www.w3.org/2007/ont/link#RDFDocument";
|
|
33452
|
-
var
|
|
33840
|
+
var Response2 = "http://www.w3.org/2007/ont/link#Response";
|
|
33453
33841
|
var Session4 = "http://www.w3.org/2007/ont/link#Session";
|
|
33454
33842
|
var isMentionedIn2 = "http://www.w3.org/2007/ont/link#isMentionedIn";
|
|
33455
33843
|
var mentionsClass2 = "http://www.w3.org/2007/ont/link#mentionsClass";
|
|
@@ -33469,7 +33857,7 @@ var tabImport = /* @__PURE__ */ Object.freeze({
|
|
|
33469
33857
|
Mailbox: Mailbox2,
|
|
33470
33858
|
ProtocolEvent: ProtocolEvent2,
|
|
33471
33859
|
RDFDocument: RDFDocument2,
|
|
33472
|
-
Response:
|
|
33860
|
+
Response: Response2,
|
|
33473
33861
|
Session: Session4,
|
|
33474
33862
|
isMentionedIn: isMentionedIn2,
|
|
33475
33863
|
mentionsClass: mentionsClass2,
|
|
@@ -33491,7 +33879,7 @@ var Document5 = "http://www.w3.org/2007/ont/link#Document";
|
|
|
33491
33879
|
var Mailbox3 = "http://www.w3.org/2007/ont/link#Mailbox";
|
|
33492
33880
|
var ProtocolEvent3 = "http://www.w3.org/2007/ont/link#ProtocolEvent";
|
|
33493
33881
|
var RDFDocument3 = "http://www.w3.org/2007/ont/link#RDFDocument";
|
|
33494
|
-
var
|
|
33882
|
+
var Response3 = "http://www.w3.org/2007/ont/link#Response";
|
|
33495
33883
|
var Session5 = "http://www.w3.org/2007/ont/link#Session";
|
|
33496
33884
|
var isMentionedIn3 = "http://www.w3.org/2007/ont/link#isMentionedIn";
|
|
33497
33885
|
var mentionsClass3 = "http://www.w3.org/2007/ont/link#mentionsClass";
|
|
@@ -33511,7 +33899,7 @@ var tabontImport = /* @__PURE__ */ Object.freeze({
|
|
|
33511
33899
|
Mailbox: Mailbox3,
|
|
33512
33900
|
ProtocolEvent: ProtocolEvent3,
|
|
33513
33901
|
RDFDocument: RDFDocument3,
|
|
33514
|
-
Response:
|
|
33902
|
+
Response: Response3,
|
|
33515
33903
|
Session: Session5,
|
|
33516
33904
|
isMentionedIn: isMentionedIn3,
|
|
33517
33905
|
mentionsClass: mentionsClass3,
|