@pod-os/core 0.12.1-6af5683.0 → 0.12.1-7d2693a.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +539 -405
- package/lib/index.js +562 -428
- package/package.json +2 -2
package/lib/index.js
CHANGED
|
@@ -60,22 +60,22 @@ var PodOS = (() => {
|
|
|
60
60
|
var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value6) {
|
|
61
61
|
return value6 !== value6;
|
|
62
62
|
};
|
|
63
|
-
function
|
|
64
|
-
|
|
63
|
+
function EventEmitter2() {
|
|
64
|
+
EventEmitter2.init.call(this);
|
|
65
65
|
}
|
|
66
|
-
module3.exports =
|
|
66
|
+
module3.exports = EventEmitter2;
|
|
67
67
|
module3.exports.once = once;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
EventEmitter2.EventEmitter = EventEmitter2;
|
|
69
|
+
EventEmitter2.prototype._events = void 0;
|
|
70
|
+
EventEmitter2.prototype._eventsCount = 0;
|
|
71
|
+
EventEmitter2.prototype._maxListeners = void 0;
|
|
72
72
|
var defaultMaxListeners = 10;
|
|
73
73
|
function checkListener(listener) {
|
|
74
74
|
if (typeof listener !== "function") {
|
|
75
75
|
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
Object.defineProperty(
|
|
78
|
+
Object.defineProperty(EventEmitter2, "defaultMaxListeners", {
|
|
79
79
|
enumerable: true,
|
|
80
80
|
get: function() {
|
|
81
81
|
return defaultMaxListeners;
|
|
@@ -87,14 +87,14 @@ var PodOS = (() => {
|
|
|
87
87
|
defaultMaxListeners = arg2;
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
|
-
|
|
90
|
+
EventEmitter2.init = function() {
|
|
91
91
|
if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) {
|
|
92
92
|
this._events = /* @__PURE__ */ Object.create(null);
|
|
93
93
|
this._eventsCount = 0;
|
|
94
94
|
}
|
|
95
95
|
this._maxListeners = this._maxListeners || void 0;
|
|
96
96
|
};
|
|
97
|
-
|
|
97
|
+
EventEmitter2.prototype.setMaxListeners = function setMaxListeners(n2) {
|
|
98
98
|
if (typeof n2 !== "number" || n2 < 0 || NumberIsNaN(n2)) {
|
|
99
99
|
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n2 + ".");
|
|
100
100
|
}
|
|
@@ -103,13 +103,13 @@ var PodOS = (() => {
|
|
|
103
103
|
};
|
|
104
104
|
function _getMaxListeners(that) {
|
|
105
105
|
if (that._maxListeners === void 0)
|
|
106
|
-
return
|
|
106
|
+
return EventEmitter2.defaultMaxListeners;
|
|
107
107
|
return that._maxListeners;
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
EventEmitter2.prototype.getMaxListeners = function getMaxListeners() {
|
|
110
110
|
return _getMaxListeners(this);
|
|
111
111
|
};
|
|
112
|
-
|
|
112
|
+
EventEmitter2.prototype.emit = function emit(type5) {
|
|
113
113
|
var args = [];
|
|
114
114
|
for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
|
|
115
115
|
var doError = type5 === "error";
|
|
@@ -186,11 +186,11 @@ var PodOS = (() => {
|
|
|
186
186
|
}
|
|
187
187
|
return target5;
|
|
188
188
|
}
|
|
189
|
-
|
|
189
|
+
EventEmitter2.prototype.addListener = function addListener(type5, listener) {
|
|
190
190
|
return _addListener(this, type5, listener, false);
|
|
191
191
|
};
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
EventEmitter2.prototype.on = EventEmitter2.prototype.addListener;
|
|
193
|
+
EventEmitter2.prototype.prependListener = function prependListener(type5, listener) {
|
|
194
194
|
return _addListener(this, type5, listener, true);
|
|
195
195
|
};
|
|
196
196
|
function onceWrapper() {
|
|
@@ -209,17 +209,17 @@ var PodOS = (() => {
|
|
|
209
209
|
state2.wrapFn = wrapped;
|
|
210
210
|
return wrapped;
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
EventEmitter2.prototype.once = function once2(type5, listener) {
|
|
213
213
|
checkListener(listener);
|
|
214
214
|
this.on(type5, _onceWrap(this, type5, listener));
|
|
215
215
|
return this;
|
|
216
216
|
};
|
|
217
|
-
|
|
217
|
+
EventEmitter2.prototype.prependOnceListener = function prependOnceListener(type5, listener) {
|
|
218
218
|
checkListener(listener);
|
|
219
219
|
this.prependListener(type5, _onceWrap(this, type5, listener));
|
|
220
220
|
return this;
|
|
221
221
|
};
|
|
222
|
-
|
|
222
|
+
EventEmitter2.prototype.removeListener = function removeListener(type5, listener) {
|
|
223
223
|
var list, events3, position4, i, originalListener;
|
|
224
224
|
checkListener(listener);
|
|
225
225
|
events3 = this._events;
|
|
@@ -259,8 +259,8 @@ var PodOS = (() => {
|
|
|
259
259
|
}
|
|
260
260
|
return this;
|
|
261
261
|
};
|
|
262
|
-
|
|
263
|
-
|
|
262
|
+
EventEmitter2.prototype.off = EventEmitter2.prototype.removeListener;
|
|
263
|
+
EventEmitter2.prototype.removeAllListeners = function removeAllListeners(type5) {
|
|
264
264
|
var listeners, events3, i;
|
|
265
265
|
events3 = this._events;
|
|
266
266
|
if (events3 === void 0)
|
|
@@ -311,20 +311,20 @@ var PodOS = (() => {
|
|
|
311
311
|
return unwrap3 ? [evlistener.listener || evlistener] : [evlistener];
|
|
312
312
|
return unwrap3 ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
|
|
313
313
|
}
|
|
314
|
-
|
|
314
|
+
EventEmitter2.prototype.listeners = function listeners(type5) {
|
|
315
315
|
return _listeners(this, type5, true);
|
|
316
316
|
};
|
|
317
|
-
|
|
317
|
+
EventEmitter2.prototype.rawListeners = function rawListeners(type5) {
|
|
318
318
|
return _listeners(this, type5, false);
|
|
319
319
|
};
|
|
320
|
-
|
|
320
|
+
EventEmitter2.listenerCount = function(emitter, type5) {
|
|
321
321
|
if (typeof emitter.listenerCount === "function") {
|
|
322
322
|
return emitter.listenerCount(type5);
|
|
323
323
|
} else {
|
|
324
324
|
return listenerCount.call(emitter, type5);
|
|
325
325
|
}
|
|
326
326
|
};
|
|
327
|
-
|
|
327
|
+
EventEmitter2.prototype.listenerCount = listenerCount;
|
|
328
328
|
function listenerCount(type5) {
|
|
329
329
|
var events3 = this._events;
|
|
330
330
|
if (events3 !== void 0) {
|
|
@@ -337,7 +337,7 @@ var PodOS = (() => {
|
|
|
337
337
|
}
|
|
338
338
|
return 0;
|
|
339
339
|
}
|
|
340
|
-
|
|
340
|
+
EventEmitter2.prototype.eventNames = function eventNames() {
|
|
341
341
|
return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
|
|
342
342
|
};
|
|
343
343
|
function arrayClone(arr, n2) {
|
|
@@ -37967,10 +37967,10 @@ var PodOS = (() => {
|
|
|
37967
37967
|
var upcased = method5.toUpperCase();
|
|
37968
37968
|
return methods.indexOf(upcased) > -1 ? upcased : method5;
|
|
37969
37969
|
}
|
|
37970
|
-
function
|
|
37970
|
+
function Request(input2, options) {
|
|
37971
37971
|
options = options || {};
|
|
37972
37972
|
var body = options.body;
|
|
37973
|
-
if (input2 instanceof
|
|
37973
|
+
if (input2 instanceof Request) {
|
|
37974
37974
|
if (input2.bodyUsed) {
|
|
37975
37975
|
throw new TypeError("Already read");
|
|
37976
37976
|
}
|
|
@@ -38002,8 +38002,8 @@ var PodOS = (() => {
|
|
|
38002
38002
|
}
|
|
38003
38003
|
this._initBody(body);
|
|
38004
38004
|
}
|
|
38005
|
-
|
|
38006
|
-
return new
|
|
38005
|
+
Request.prototype.clone = function() {
|
|
38006
|
+
return new Request(this, { body: this._bodyInit });
|
|
38007
38007
|
};
|
|
38008
38008
|
function decode4(body) {
|
|
38009
38009
|
var form2 = new FormData();
|
|
@@ -38030,8 +38030,8 @@ var PodOS = (() => {
|
|
|
38030
38030
|
});
|
|
38031
38031
|
return headers;
|
|
38032
38032
|
}
|
|
38033
|
-
Body.call(
|
|
38034
|
-
function
|
|
38033
|
+
Body.call(Request.prototype);
|
|
38034
|
+
function Response4(bodyInit, options) {
|
|
38035
38035
|
if (!options) {
|
|
38036
38036
|
options = {};
|
|
38037
38037
|
}
|
|
@@ -38043,26 +38043,26 @@ var PodOS = (() => {
|
|
|
38043
38043
|
this.url = options.url || "";
|
|
38044
38044
|
this._initBody(bodyInit);
|
|
38045
38045
|
}
|
|
38046
|
-
Body.call(
|
|
38047
|
-
|
|
38048
|
-
return new
|
|
38046
|
+
Body.call(Response4.prototype);
|
|
38047
|
+
Response4.prototype.clone = function() {
|
|
38048
|
+
return new Response4(this._bodyInit, {
|
|
38049
38049
|
status: this.status,
|
|
38050
38050
|
statusText: this.statusText,
|
|
38051
38051
|
headers: new Headers3(this.headers),
|
|
38052
38052
|
url: this.url
|
|
38053
38053
|
});
|
|
38054
38054
|
};
|
|
38055
|
-
|
|
38056
|
-
var response6 = new
|
|
38055
|
+
Response4.error = function() {
|
|
38056
|
+
var response6 = new Response4(null, { status: 0, statusText: "" });
|
|
38057
38057
|
response6.type = "error";
|
|
38058
38058
|
return response6;
|
|
38059
38059
|
};
|
|
38060
38060
|
var redirectStatuses = [301, 302, 303, 307, 308];
|
|
38061
|
-
|
|
38061
|
+
Response4.redirect = function(url7, status9) {
|
|
38062
38062
|
if (redirectStatuses.indexOf(status9) === -1) {
|
|
38063
38063
|
throw new RangeError("Invalid status code");
|
|
38064
38064
|
}
|
|
38065
|
-
return new
|
|
38065
|
+
return new Response4(null, { status: status9, headers: { location: url7 } });
|
|
38066
38066
|
};
|
|
38067
38067
|
exports2.DOMException = self2.DOMException;
|
|
38068
38068
|
try {
|
|
@@ -38077,9 +38077,9 @@ var PodOS = (() => {
|
|
|
38077
38077
|
exports2.DOMException.prototype = Object.create(Error.prototype);
|
|
38078
38078
|
exports2.DOMException.prototype.constructor = exports2.DOMException;
|
|
38079
38079
|
}
|
|
38080
|
-
function
|
|
38080
|
+
function fetch2(input2, init) {
|
|
38081
38081
|
return new Promise(function(resolve, reject2) {
|
|
38082
|
-
var request2 = new
|
|
38082
|
+
var request2 = new Request(input2, init);
|
|
38083
38083
|
if (request2.signal && request2.signal.aborted) {
|
|
38084
38084
|
return reject2(new exports2.DOMException("Aborted", "AbortError"));
|
|
38085
38085
|
}
|
|
@@ -38095,7 +38095,7 @@ var PodOS = (() => {
|
|
|
38095
38095
|
};
|
|
38096
38096
|
options.url = "responseURL" in xhr ? xhr.responseURL : options.headers.get("X-Request-URL");
|
|
38097
38097
|
var body = "response" in xhr ? xhr.response : xhr.responseText;
|
|
38098
|
-
resolve(new
|
|
38098
|
+
resolve(new Response4(body, options));
|
|
38099
38099
|
};
|
|
38100
38100
|
xhr.onerror = function() {
|
|
38101
38101
|
reject2(new TypeError("Network request failed"));
|
|
@@ -38129,17 +38129,17 @@ var PodOS = (() => {
|
|
|
38129
38129
|
xhr.send(typeof request2._bodyInit === "undefined" ? null : request2._bodyInit);
|
|
38130
38130
|
});
|
|
38131
38131
|
}
|
|
38132
|
-
|
|
38132
|
+
fetch2.polyfill = true;
|
|
38133
38133
|
if (!self2.fetch) {
|
|
38134
|
-
self2.fetch =
|
|
38134
|
+
self2.fetch = fetch2;
|
|
38135
38135
|
self2.Headers = Headers3;
|
|
38136
|
-
self2.Request =
|
|
38137
|
-
self2.Response =
|
|
38136
|
+
self2.Request = Request;
|
|
38137
|
+
self2.Response = Response4;
|
|
38138
38138
|
}
|
|
38139
38139
|
exports2.Headers = Headers3;
|
|
38140
|
-
exports2.Request =
|
|
38141
|
-
exports2.Response =
|
|
38142
|
-
exports2.fetch =
|
|
38140
|
+
exports2.Request = Request;
|
|
38141
|
+
exports2.Response = Response4;
|
|
38142
|
+
exports2.fetch = fetch2;
|
|
38143
38143
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
38144
38144
|
return exports2;
|
|
38145
38145
|
}({});
|
|
@@ -42369,20 +42369,20 @@ var PodOS = (() => {
|
|
|
42369
42369
|
if (obj === null || obj === void 0) {
|
|
42370
42370
|
return obj;
|
|
42371
42371
|
}
|
|
42372
|
-
var
|
|
42372
|
+
var clone2 = /* @__PURE__ */ Object.create(null), keys = Object.keys(obj);
|
|
42373
42373
|
for (var i = 0; i < keys.length; i++) {
|
|
42374
42374
|
var key3 = keys[i], val = obj[key3];
|
|
42375
42375
|
if (Array.isArray(val)) {
|
|
42376
|
-
|
|
42376
|
+
clone2[key3] = val.slice();
|
|
42377
42377
|
continue;
|
|
42378
42378
|
}
|
|
42379
42379
|
if (typeof val === "string" || typeof val === "number" || typeof val === "boolean") {
|
|
42380
|
-
|
|
42380
|
+
clone2[key3] = val;
|
|
42381
42381
|
continue;
|
|
42382
42382
|
}
|
|
42383
42383
|
throw new TypeError("clone is not deep and does not support nested objects");
|
|
42384
42384
|
}
|
|
42385
|
-
return
|
|
42385
|
+
return clone2;
|
|
42386
42386
|
};
|
|
42387
42387
|
lunr2.FieldRef = function(docRef, fieldName, stringValue) {
|
|
42388
42388
|
this.docRef = docRef;
|
|
@@ -45763,18 +45763,11 @@ var PodOS = (() => {
|
|
|
45763
45763
|
}) : identity;
|
|
45764
45764
|
}
|
|
45765
45765
|
|
|
45766
|
-
// ../node_modules/@inrupt/solid-client-authn-core/dist/
|
|
45767
|
-
var import_events = __toESM(require_events(), 1);
|
|
45768
|
-
|
|
45769
|
-
// ../node_modules/@inrupt/universal-fetch/dist/index-browser.mjs
|
|
45770
|
-
var indexBrowser = globalThis.fetch;
|
|
45771
|
-
var { fetch: fetch2, Response, Request, Headers } = globalThis;
|
|
45772
|
-
|
|
45773
|
-
// ../node_modules/jose/dist/browser/runtime/webcrypto.js
|
|
45766
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/webcrypto.js
|
|
45774
45767
|
var webcrypto_default = crypto;
|
|
45775
45768
|
var isCryptoKey = (key3) => key3 instanceof CryptoKey;
|
|
45776
45769
|
|
|
45777
|
-
// ../node_modules/jose/dist/browser/lib/buffer_utils.js
|
|
45770
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/buffer_utils.js
|
|
45778
45771
|
var encoder = new TextEncoder();
|
|
45779
45772
|
var decoder = new TextDecoder();
|
|
45780
45773
|
var MAX_INT32 = 2 ** 32;
|
|
@@ -45782,14 +45775,14 @@ var PodOS = (() => {
|
|
|
45782
45775
|
const size4 = buffers.reduce((acc, { length: length2 }) => acc + length2, 0);
|
|
45783
45776
|
const buf = new Uint8Array(size4);
|
|
45784
45777
|
let i = 0;
|
|
45785
|
-
|
|
45778
|
+
for (const buffer of buffers) {
|
|
45786
45779
|
buf.set(buffer, i);
|
|
45787
45780
|
i += buffer.length;
|
|
45788
|
-
}
|
|
45781
|
+
}
|
|
45789
45782
|
return buf;
|
|
45790
45783
|
}
|
|
45791
45784
|
|
|
45792
|
-
// ../node_modules/jose/dist/browser/runtime/base64url.js
|
|
45785
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/base64url.js
|
|
45793
45786
|
var encodeBase64 = (input2) => {
|
|
45794
45787
|
let unencoded = input2;
|
|
45795
45788
|
if (typeof unencoded === "string") {
|
|
@@ -45821,22 +45814,21 @@ var PodOS = (() => {
|
|
|
45821
45814
|
encoded = encoded.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
45822
45815
|
try {
|
|
45823
45816
|
return decodeBase64(encoded);
|
|
45824
|
-
} catch
|
|
45817
|
+
} catch {
|
|
45825
45818
|
throw new TypeError("The input to be decoded is not correctly encoded.");
|
|
45826
45819
|
}
|
|
45827
45820
|
};
|
|
45828
45821
|
|
|
45829
|
-
// ../node_modules/jose/dist/browser/util/errors.js
|
|
45822
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/util/errors.js
|
|
45830
45823
|
var JOSEError = class extends Error {
|
|
45831
45824
|
static get code() {
|
|
45832
45825
|
return "ERR_JOSE_GENERIC";
|
|
45833
45826
|
}
|
|
45834
45827
|
constructor(message4) {
|
|
45835
|
-
var _a;
|
|
45836
45828
|
super(message4);
|
|
45837
45829
|
this.code = "ERR_JOSE_GENERIC";
|
|
45838
45830
|
this.name = this.constructor.name;
|
|
45839
|
-
|
|
45831
|
+
Error.captureStackTrace?.(this, this.constructor);
|
|
45840
45832
|
}
|
|
45841
45833
|
};
|
|
45842
45834
|
var JWTClaimValidationFailed = class extends JOSEError {
|
|
@@ -45897,6 +45889,45 @@ var PodOS = (() => {
|
|
|
45897
45889
|
return "ERR_JWT_INVALID";
|
|
45898
45890
|
}
|
|
45899
45891
|
};
|
|
45892
|
+
var JWKSInvalid = class extends JOSEError {
|
|
45893
|
+
constructor() {
|
|
45894
|
+
super(...arguments);
|
|
45895
|
+
this.code = "ERR_JWKS_INVALID";
|
|
45896
|
+
}
|
|
45897
|
+
static get code() {
|
|
45898
|
+
return "ERR_JWKS_INVALID";
|
|
45899
|
+
}
|
|
45900
|
+
};
|
|
45901
|
+
var JWKSNoMatchingKey = class extends JOSEError {
|
|
45902
|
+
constructor() {
|
|
45903
|
+
super(...arguments);
|
|
45904
|
+
this.code = "ERR_JWKS_NO_MATCHING_KEY";
|
|
45905
|
+
this.message = "no applicable key found in the JSON Web Key Set";
|
|
45906
|
+
}
|
|
45907
|
+
static get code() {
|
|
45908
|
+
return "ERR_JWKS_NO_MATCHING_KEY";
|
|
45909
|
+
}
|
|
45910
|
+
};
|
|
45911
|
+
var JWKSMultipleMatchingKeys = class extends JOSEError {
|
|
45912
|
+
constructor() {
|
|
45913
|
+
super(...arguments);
|
|
45914
|
+
this.code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
45915
|
+
this.message = "multiple matching keys found in the JSON Web Key Set";
|
|
45916
|
+
}
|
|
45917
|
+
static get code() {
|
|
45918
|
+
return "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
|
|
45919
|
+
}
|
|
45920
|
+
};
|
|
45921
|
+
var JWKSTimeout = class extends JOSEError {
|
|
45922
|
+
constructor() {
|
|
45923
|
+
super(...arguments);
|
|
45924
|
+
this.code = "ERR_JWKS_TIMEOUT";
|
|
45925
|
+
this.message = "request timed out";
|
|
45926
|
+
}
|
|
45927
|
+
static get code() {
|
|
45928
|
+
return "ERR_JWKS_TIMEOUT";
|
|
45929
|
+
}
|
|
45930
|
+
};
|
|
45900
45931
|
var JWSSignatureVerificationFailed = class extends JOSEError {
|
|
45901
45932
|
constructor() {
|
|
45902
45933
|
super(...arguments);
|
|
@@ -45908,10 +45939,10 @@ var PodOS = (() => {
|
|
|
45908
45939
|
}
|
|
45909
45940
|
};
|
|
45910
45941
|
|
|
45911
|
-
// ../node_modules/jose/dist/browser/runtime/random.js
|
|
45942
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/random.js
|
|
45912
45943
|
var random_default = webcrypto_default.getRandomValues.bind(webcrypto_default);
|
|
45913
45944
|
|
|
45914
|
-
// ../node_modules/jose/dist/browser/lib/crypto_key.js
|
|
45945
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/crypto_key.js
|
|
45915
45946
|
function unusable(name7, prop = "algorithm.name") {
|
|
45916
45947
|
return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name7}`);
|
|
45917
45948
|
}
|
|
@@ -46005,7 +46036,7 @@ var PodOS = (() => {
|
|
|
46005
46036
|
checkUsage(key3, usages);
|
|
46006
46037
|
}
|
|
46007
46038
|
|
|
46008
|
-
// ../node_modules/jose/dist/browser/lib/invalid_key_input.js
|
|
46039
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/invalid_key_input.js
|
|
46009
46040
|
function message(msg2, actual2, ...types2) {
|
|
46010
46041
|
if (types2.length > 2) {
|
|
46011
46042
|
const last3 = types2.pop();
|
|
@@ -46020,7 +46051,7 @@ var PodOS = (() => {
|
|
|
46020
46051
|
} else if (typeof actual2 === "function" && actual2.name) {
|
|
46021
46052
|
msg2 += ` Received function ${actual2.name}`;
|
|
46022
46053
|
} else if (typeof actual2 === "object" && actual2 != null) {
|
|
46023
|
-
if (actual2.constructor
|
|
46054
|
+
if (actual2.constructor?.name) {
|
|
46024
46055
|
msg2 += ` Received an instance of ${actual2.constructor.name}`;
|
|
46025
46056
|
}
|
|
46026
46057
|
}
|
|
@@ -46033,13 +46064,13 @@ var PodOS = (() => {
|
|
|
46033
46064
|
return message(`Key for the ${alg} algorithm must be `, actual2, ...types2);
|
|
46034
46065
|
}
|
|
46035
46066
|
|
|
46036
|
-
// ../node_modules/jose/dist/browser/runtime/is_key_like.js
|
|
46067
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/is_key_like.js
|
|
46037
46068
|
var is_key_like_default = (key3) => {
|
|
46038
46069
|
return isCryptoKey(key3);
|
|
46039
46070
|
};
|
|
46040
46071
|
var types = ["CryptoKey"];
|
|
46041
46072
|
|
|
46042
|
-
// ../node_modules/jose/dist/browser/lib/is_disjoint.js
|
|
46073
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/is_disjoint.js
|
|
46043
46074
|
var isDisjoint = (...headers) => {
|
|
46044
46075
|
const sources = headers.filter(Boolean);
|
|
46045
46076
|
if (sources.length === 0 || sources.length === 1) {
|
|
@@ -46063,7 +46094,7 @@ var PodOS = (() => {
|
|
|
46063
46094
|
};
|
|
46064
46095
|
var is_disjoint_default = isDisjoint;
|
|
46065
46096
|
|
|
46066
|
-
// ../node_modules/jose/dist/browser/lib/is_object.js
|
|
46097
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/is_object.js
|
|
46067
46098
|
function isObjectLike(value6) {
|
|
46068
46099
|
return typeof value6 === "object" && value6 !== null;
|
|
46069
46100
|
}
|
|
@@ -46081,7 +46112,7 @@ var PodOS = (() => {
|
|
|
46081
46112
|
return Object.getPrototypeOf(input2) === proto;
|
|
46082
46113
|
}
|
|
46083
46114
|
|
|
46084
|
-
// ../node_modules/jose/dist/browser/runtime/check_key_length.js
|
|
46115
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/check_key_length.js
|
|
46085
46116
|
var check_key_length_default = (alg, key3) => {
|
|
46086
46117
|
if (alg.startsWith("RS") || alg.startsWith("PS")) {
|
|
46087
46118
|
const { modulusLength } = key3.algorithm;
|
|
@@ -46091,49 +46122,11 @@ var PodOS = (() => {
|
|
|
46091
46122
|
}
|
|
46092
46123
|
};
|
|
46093
46124
|
|
|
46094
|
-
// ../node_modules/jose/dist/browser/runtime/jwk_to_key.js
|
|
46125
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/jwk_to_key.js
|
|
46095
46126
|
function subtleMapping(jwk) {
|
|
46096
46127
|
let algorithm3;
|
|
46097
46128
|
let keyUsages;
|
|
46098
46129
|
switch (jwk.kty) {
|
|
46099
|
-
case "oct": {
|
|
46100
|
-
switch (jwk.alg) {
|
|
46101
|
-
case "HS256":
|
|
46102
|
-
case "HS384":
|
|
46103
|
-
case "HS512":
|
|
46104
|
-
algorithm3 = { name: "HMAC", hash: `SHA-${jwk.alg.slice(-3)}` };
|
|
46105
|
-
keyUsages = ["sign", "verify"];
|
|
46106
|
-
break;
|
|
46107
|
-
case "A128CBC-HS256":
|
|
46108
|
-
case "A192CBC-HS384":
|
|
46109
|
-
case "A256CBC-HS512":
|
|
46110
|
-
throw new JOSENotSupported(`${jwk.alg} keys cannot be imported as CryptoKey instances`);
|
|
46111
|
-
case "A128GCM":
|
|
46112
|
-
case "A192GCM":
|
|
46113
|
-
case "A256GCM":
|
|
46114
|
-
case "A128GCMKW":
|
|
46115
|
-
case "A192GCMKW":
|
|
46116
|
-
case "A256GCMKW":
|
|
46117
|
-
algorithm3 = { name: "AES-GCM" };
|
|
46118
|
-
keyUsages = ["encrypt", "decrypt"];
|
|
46119
|
-
break;
|
|
46120
|
-
case "A128KW":
|
|
46121
|
-
case "A192KW":
|
|
46122
|
-
case "A256KW":
|
|
46123
|
-
algorithm3 = { name: "AES-KW" };
|
|
46124
|
-
keyUsages = ["wrapKey", "unwrapKey"];
|
|
46125
|
-
break;
|
|
46126
|
-
case "PBES2-HS256+A128KW":
|
|
46127
|
-
case "PBES2-HS384+A192KW":
|
|
46128
|
-
case "PBES2-HS512+A256KW":
|
|
46129
|
-
algorithm3 = { name: "PBKDF2" };
|
|
46130
|
-
keyUsages = ["deriveBits"];
|
|
46131
|
-
break;
|
|
46132
|
-
default:
|
|
46133
|
-
throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
46134
|
-
}
|
|
46135
|
-
break;
|
|
46136
|
-
}
|
|
46137
46130
|
case "RSA": {
|
|
46138
46131
|
switch (jwk.alg) {
|
|
46139
46132
|
case "PS256":
|
|
@@ -46213,19 +46206,15 @@ var PodOS = (() => {
|
|
|
46213
46206
|
return { algorithm: algorithm3, keyUsages };
|
|
46214
46207
|
}
|
|
46215
46208
|
var parse = async (jwk) => {
|
|
46216
|
-
var _a, _b;
|
|
46217
46209
|
if (!jwk.alg) {
|
|
46218
46210
|
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
46219
46211
|
}
|
|
46220
46212
|
const { algorithm: algorithm3, keyUsages } = subtleMapping(jwk);
|
|
46221
46213
|
const rest3 = [
|
|
46222
46214
|
algorithm3,
|
|
46223
|
-
|
|
46224
|
-
|
|
46215
|
+
jwk.ext ?? false,
|
|
46216
|
+
jwk.key_ops ?? keyUsages
|
|
46225
46217
|
];
|
|
46226
|
-
if (algorithm3.name === "PBKDF2") {
|
|
46227
|
-
return webcrypto_default.subtle.importKey("raw", decode(jwk.k), ...rest3);
|
|
46228
|
-
}
|
|
46229
46218
|
const keyData = { ...jwk };
|
|
46230
46219
|
delete keyData.alg;
|
|
46231
46220
|
delete keyData.use;
|
|
@@ -46233,9 +46222,8 @@ var PodOS = (() => {
|
|
|
46233
46222
|
};
|
|
46234
46223
|
var jwk_to_key_default = parse;
|
|
46235
46224
|
|
|
46236
|
-
// ../node_modules/jose/dist/browser/key/import.js
|
|
46237
|
-
async function importJWK(jwk, alg
|
|
46238
|
-
var _a;
|
|
46225
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/key/import.js
|
|
46226
|
+
async function importJWK(jwk, alg) {
|
|
46239
46227
|
if (!isObject(jwk)) {
|
|
46240
46228
|
throw new TypeError("JWK must be an object");
|
|
46241
46229
|
}
|
|
@@ -46245,10 +46233,6 @@ var PodOS = (() => {
|
|
|
46245
46233
|
if (typeof jwk.k !== "string" || !jwk.k) {
|
|
46246
46234
|
throw new TypeError('missing "k" (Key Value) Parameter value');
|
|
46247
46235
|
}
|
|
46248
|
-
octAsKeyObject !== null && octAsKeyObject !== void 0 ? octAsKeyObject : octAsKeyObject = jwk.ext !== true;
|
|
46249
|
-
if (octAsKeyObject) {
|
|
46250
|
-
return jwk_to_key_default({ ...jwk, alg, ext: (_a = jwk.ext) !== null && _a !== void 0 ? _a : false });
|
|
46251
|
-
}
|
|
46252
46236
|
return decode(jwk.k);
|
|
46253
46237
|
case "RSA":
|
|
46254
46238
|
if (jwk.oth !== void 0) {
|
|
@@ -46262,7 +46246,7 @@ var PodOS = (() => {
|
|
|
46262
46246
|
}
|
|
46263
46247
|
}
|
|
46264
46248
|
|
|
46265
|
-
// ../node_modules/jose/dist/browser/lib/check_key_type.js
|
|
46249
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/check_key_type.js
|
|
46266
46250
|
var symmetricTypeCheck = (alg, key3) => {
|
|
46267
46251
|
if (key3 instanceof Uint8Array)
|
|
46268
46252
|
return;
|
|
@@ -46303,9 +46287,9 @@ var PodOS = (() => {
|
|
|
46303
46287
|
};
|
|
46304
46288
|
var check_key_type_default = checkKeyType;
|
|
46305
46289
|
|
|
46306
|
-
// ../node_modules/jose/dist/browser/lib/validate_crit.js
|
|
46290
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/validate_crit.js
|
|
46307
46291
|
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
46308
|
-
if (joseHeader.crit !== void 0 && protectedHeader
|
|
46292
|
+
if (joseHeader.crit !== void 0 && protectedHeader?.crit === void 0) {
|
|
46309
46293
|
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
46310
46294
|
}
|
|
46311
46295
|
if (!protectedHeader || protectedHeader.crit === void 0) {
|
|
@@ -46326,7 +46310,8 @@ var PodOS = (() => {
|
|
|
46326
46310
|
}
|
|
46327
46311
|
if (joseHeader[parameter2] === void 0) {
|
|
46328
46312
|
throw new Err(`Extension Header Parameter "${parameter2}" is missing`);
|
|
46329
|
-
}
|
|
46313
|
+
}
|
|
46314
|
+
if (recognized.get(parameter2) && protectedHeader[parameter2] === void 0) {
|
|
46330
46315
|
throw new Err(`Extension Header Parameter "${parameter2}" MUST be integrity protected`);
|
|
46331
46316
|
}
|
|
46332
46317
|
}
|
|
@@ -46334,7 +46319,7 @@ var PodOS = (() => {
|
|
|
46334
46319
|
}
|
|
46335
46320
|
var validate_crit_default = validateCrit;
|
|
46336
46321
|
|
|
46337
|
-
// ../node_modules/jose/dist/browser/lib/validate_algorithms.js
|
|
46322
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/validate_algorithms.js
|
|
46338
46323
|
var validateAlgorithms = (option5, algorithms) => {
|
|
46339
46324
|
if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
46340
46325
|
throw new TypeError(`"${option5}" option must be an array of strings`);
|
|
@@ -46346,7 +46331,7 @@ var PodOS = (() => {
|
|
|
46346
46331
|
};
|
|
46347
46332
|
var validate_algorithms_default = validateAlgorithms;
|
|
46348
46333
|
|
|
46349
|
-
// ../node_modules/jose/dist/browser/runtime/key_to_jwk.js
|
|
46334
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/key_to_jwk.js
|
|
46350
46335
|
var keyToJWK = async (key3) => {
|
|
46351
46336
|
if (key3 instanceof Uint8Array) {
|
|
46352
46337
|
return {
|
|
@@ -46365,15 +46350,15 @@ var PodOS = (() => {
|
|
|
46365
46350
|
};
|
|
46366
46351
|
var key_to_jwk_default = keyToJWK;
|
|
46367
46352
|
|
|
46368
|
-
// ../node_modules/jose/dist/browser/key/export.js
|
|
46353
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/key/export.js
|
|
46369
46354
|
async function exportJWK(key3) {
|
|
46370
46355
|
return key_to_jwk_default(key3);
|
|
46371
46356
|
}
|
|
46372
46357
|
|
|
46373
|
-
// ../node_modules/jose/dist/browser/jwe/flattened/encrypt.js
|
|
46358
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwe/flattened/encrypt.js
|
|
46374
46359
|
var unprotected = Symbol();
|
|
46375
46360
|
|
|
46376
|
-
// ../node_modules/jose/dist/browser/runtime/subtle_dsa.js
|
|
46361
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/subtle_dsa.js
|
|
46377
46362
|
function subtleDsa(alg, algorithm3) {
|
|
46378
46363
|
const hash2 = `SHA-${alg.slice(-3)}`;
|
|
46379
46364
|
switch (alg) {
|
|
@@ -46400,7 +46385,7 @@ var PodOS = (() => {
|
|
|
46400
46385
|
}
|
|
46401
46386
|
}
|
|
46402
46387
|
|
|
46403
|
-
// ../node_modules/jose/dist/browser/runtime/get_sign_verify_key.js
|
|
46388
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/get_sign_verify_key.js
|
|
46404
46389
|
function getCryptoKey(alg, key3, usage2) {
|
|
46405
46390
|
if (isCryptoKey(key3)) {
|
|
46406
46391
|
checkSigCryptoKey(key3, alg, usage2);
|
|
@@ -46415,22 +46400,21 @@ var PodOS = (() => {
|
|
|
46415
46400
|
throw new TypeError(invalid_key_input_default(key3, ...types, "Uint8Array"));
|
|
46416
46401
|
}
|
|
46417
46402
|
|
|
46418
|
-
// ../node_modules/jose/dist/browser/runtime/verify.js
|
|
46403
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/verify.js
|
|
46419
46404
|
var verify = async (alg, key3, signature2, data2) => {
|
|
46420
46405
|
const cryptoKey = await getCryptoKey(alg, key3, "verify");
|
|
46421
46406
|
check_key_length_default(alg, cryptoKey);
|
|
46422
46407
|
const algorithm3 = subtleDsa(alg, cryptoKey.algorithm);
|
|
46423
46408
|
try {
|
|
46424
46409
|
return await webcrypto_default.subtle.verify(algorithm3, cryptoKey, signature2, data2);
|
|
46425
|
-
} catch
|
|
46410
|
+
} catch {
|
|
46426
46411
|
return false;
|
|
46427
46412
|
}
|
|
46428
46413
|
};
|
|
46429
46414
|
var verify_default = verify;
|
|
46430
46415
|
|
|
46431
|
-
// ../node_modules/jose/dist/browser/jws/flattened/verify.js
|
|
46416
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jws/flattened/verify.js
|
|
46432
46417
|
async function flattenedVerify(jws2, key3, options) {
|
|
46433
|
-
var _a;
|
|
46434
46418
|
if (!isObject(jws2)) {
|
|
46435
46419
|
throw new JWSInvalid("Flattened JWS must be an object");
|
|
46436
46420
|
}
|
|
@@ -46454,7 +46438,7 @@ var PodOS = (() => {
|
|
|
46454
46438
|
try {
|
|
46455
46439
|
const protectedHeader = decode(jws2.protected);
|
|
46456
46440
|
parsedProt = JSON.parse(decoder.decode(protectedHeader));
|
|
46457
|
-
} catch
|
|
46441
|
+
} catch {
|
|
46458
46442
|
throw new JWSInvalid("JWS Protected Header is invalid");
|
|
46459
46443
|
}
|
|
46460
46444
|
}
|
|
@@ -46465,7 +46449,7 @@ var PodOS = (() => {
|
|
|
46465
46449
|
...parsedProt,
|
|
46466
46450
|
...jws2.header
|
|
46467
46451
|
};
|
|
46468
|
-
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options
|
|
46452
|
+
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options?.crit, parsedProt, joseHeader);
|
|
46469
46453
|
let b64 = true;
|
|
46470
46454
|
if (extensions.has("b64")) {
|
|
46471
46455
|
b64 = parsedProt.b64;
|
|
@@ -46479,7 +46463,7 @@ var PodOS = (() => {
|
|
|
46479
46463
|
}
|
|
46480
46464
|
const algorithms = options && validate_algorithms_default("algorithms", options.algorithms);
|
|
46481
46465
|
if (algorithms && !algorithms.has(alg)) {
|
|
46482
|
-
throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');
|
|
46466
|
+
throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter value not allowed');
|
|
46483
46467
|
}
|
|
46484
46468
|
if (b64) {
|
|
46485
46469
|
if (typeof jws2.payload !== "string") {
|
|
@@ -46494,11 +46478,11 @@ var PodOS = (() => {
|
|
|
46494
46478
|
resolvedKey = true;
|
|
46495
46479
|
}
|
|
46496
46480
|
check_key_type_default(alg, key3, "verify");
|
|
46497
|
-
const data2 = concat(encoder.encode(
|
|
46481
|
+
const data2 = concat(encoder.encode(jws2.protected ?? ""), encoder.encode("."), typeof jws2.payload === "string" ? encoder.encode(jws2.payload) : jws2.payload);
|
|
46498
46482
|
let signature2;
|
|
46499
46483
|
try {
|
|
46500
46484
|
signature2 = decode(jws2.signature);
|
|
46501
|
-
} catch
|
|
46485
|
+
} catch {
|
|
46502
46486
|
throw new JWSInvalid("Failed to base64url decode the signature");
|
|
46503
46487
|
}
|
|
46504
46488
|
const verified2 = await verify_default(alg, key3, signature2, data2);
|
|
@@ -46509,7 +46493,7 @@ var PodOS = (() => {
|
|
|
46509
46493
|
if (b64) {
|
|
46510
46494
|
try {
|
|
46511
46495
|
payload4 = decode(jws2.payload);
|
|
46512
|
-
} catch
|
|
46496
|
+
} catch {
|
|
46513
46497
|
throw new JWSInvalid("Failed to base64url decode the payload");
|
|
46514
46498
|
}
|
|
46515
46499
|
} else if (typeof jws2.payload === "string") {
|
|
@@ -46530,7 +46514,7 @@ var PodOS = (() => {
|
|
|
46530
46514
|
return result5;
|
|
46531
46515
|
}
|
|
46532
46516
|
|
|
46533
|
-
// ../node_modules/jose/dist/browser/jws/compact/verify.js
|
|
46517
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jws/compact/verify.js
|
|
46534
46518
|
async function compactVerify(jws2, key3, options) {
|
|
46535
46519
|
if (jws2 instanceof Uint8Array) {
|
|
46536
46520
|
jws2 = decoder.decode(jws2);
|
|
@@ -46550,56 +46534,67 @@ var PodOS = (() => {
|
|
|
46550
46534
|
return result5;
|
|
46551
46535
|
}
|
|
46552
46536
|
|
|
46553
|
-
// ../node_modules/jose/dist/browser/lib/epoch.js
|
|
46537
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/epoch.js
|
|
46554
46538
|
var epoch_default = (date5) => Math.floor(date5.getTime() / 1e3);
|
|
46555
46539
|
|
|
46556
|
-
// ../node_modules/jose/dist/browser/lib/secs.js
|
|
46540
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/secs.js
|
|
46557
46541
|
var minute = 60;
|
|
46558
46542
|
var hour = minute * 60;
|
|
46559
46543
|
var day = hour * 24;
|
|
46560
46544
|
var week = day * 7;
|
|
46561
46545
|
var year = day * 365.25;
|
|
46562
|
-
var REGEX = /^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)
|
|
46546
|
+
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;
|
|
46563
46547
|
var secs_default = (str) => {
|
|
46564
46548
|
const matched = REGEX.exec(str);
|
|
46565
|
-
if (!matched) {
|
|
46549
|
+
if (!matched || matched[4] && matched[1]) {
|
|
46566
46550
|
throw new TypeError("Invalid time period format");
|
|
46567
46551
|
}
|
|
46568
|
-
const value6 = parseFloat(matched[
|
|
46569
|
-
const unit2 = matched[
|
|
46552
|
+
const value6 = parseFloat(matched[2]);
|
|
46553
|
+
const unit2 = matched[3].toLowerCase();
|
|
46554
|
+
let numericDate;
|
|
46570
46555
|
switch (unit2) {
|
|
46571
46556
|
case "sec":
|
|
46572
46557
|
case "secs":
|
|
46573
46558
|
case "second":
|
|
46574
46559
|
case "seconds":
|
|
46575
46560
|
case "s":
|
|
46576
|
-
|
|
46561
|
+
numericDate = Math.round(value6);
|
|
46562
|
+
break;
|
|
46577
46563
|
case "minute":
|
|
46578
46564
|
case "minutes":
|
|
46579
46565
|
case "min":
|
|
46580
46566
|
case "mins":
|
|
46581
46567
|
case "m":
|
|
46582
|
-
|
|
46568
|
+
numericDate = Math.round(value6 * minute);
|
|
46569
|
+
break;
|
|
46583
46570
|
case "hour":
|
|
46584
46571
|
case "hours":
|
|
46585
46572
|
case "hr":
|
|
46586
46573
|
case "hrs":
|
|
46587
46574
|
case "h":
|
|
46588
|
-
|
|
46575
|
+
numericDate = Math.round(value6 * hour);
|
|
46576
|
+
break;
|
|
46589
46577
|
case "day":
|
|
46590
46578
|
case "days":
|
|
46591
46579
|
case "d":
|
|
46592
|
-
|
|
46580
|
+
numericDate = Math.round(value6 * day);
|
|
46581
|
+
break;
|
|
46593
46582
|
case "week":
|
|
46594
46583
|
case "weeks":
|
|
46595
46584
|
case "w":
|
|
46596
|
-
|
|
46585
|
+
numericDate = Math.round(value6 * week);
|
|
46586
|
+
break;
|
|
46597
46587
|
default:
|
|
46598
|
-
|
|
46588
|
+
numericDate = Math.round(value6 * year);
|
|
46589
|
+
break;
|
|
46599
46590
|
}
|
|
46591
|
+
if (matched[1] === "-" || matched[4] === "ago") {
|
|
46592
|
+
return -numericDate;
|
|
46593
|
+
}
|
|
46594
|
+
return numericDate;
|
|
46600
46595
|
};
|
|
46601
46596
|
|
|
46602
|
-
// ../node_modules/jose/dist/browser/lib/jwt_claims_set.js
|
|
46597
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/lib/jwt_claims_set.js
|
|
46603
46598
|
var normalizeTyp = (value6) => value6.toLowerCase().replace(/^application\//, "");
|
|
46604
46599
|
var checkAudiencePresence = (audPayload, audOption) => {
|
|
46605
46600
|
if (typeof audPayload === "string") {
|
|
@@ -46618,21 +46613,22 @@ var PodOS = (() => {
|
|
|
46618
46613
|
let payload4;
|
|
46619
46614
|
try {
|
|
46620
46615
|
payload4 = JSON.parse(decoder.decode(encodedPayload));
|
|
46621
|
-
} catch
|
|
46616
|
+
} catch {
|
|
46622
46617
|
}
|
|
46623
46618
|
if (!isObject(payload4)) {
|
|
46624
46619
|
throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");
|
|
46625
46620
|
}
|
|
46626
46621
|
const { requiredClaims = [], issuer: issuer2, subject: subject5, audience: audience5, maxTokenAge } = options;
|
|
46622
|
+
const presenceCheck = [...requiredClaims];
|
|
46627
46623
|
if (maxTokenAge !== void 0)
|
|
46628
|
-
|
|
46624
|
+
presenceCheck.push("iat");
|
|
46629
46625
|
if (audience5 !== void 0)
|
|
46630
|
-
|
|
46626
|
+
presenceCheck.push("aud");
|
|
46631
46627
|
if (subject5 !== void 0)
|
|
46632
|
-
|
|
46628
|
+
presenceCheck.push("sub");
|
|
46633
46629
|
if (issuer2 !== void 0)
|
|
46634
|
-
|
|
46635
|
-
for (const claim2 of new Set(
|
|
46630
|
+
presenceCheck.push("iss");
|
|
46631
|
+
for (const claim2 of new Set(presenceCheck.reverse())) {
|
|
46636
46632
|
if (!(claim2 in payload4)) {
|
|
46637
46633
|
throw new JWTClaimValidationFailed(`missing required "${claim2}" claim`, claim2, "missing");
|
|
46638
46634
|
}
|
|
@@ -46694,11 +46690,10 @@ var PodOS = (() => {
|
|
|
46694
46690
|
return payload4;
|
|
46695
46691
|
};
|
|
46696
46692
|
|
|
46697
|
-
// ../node_modules/jose/dist/browser/jwt/verify.js
|
|
46693
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwt/verify.js
|
|
46698
46694
|
async function jwtVerify(jwt, key3, options) {
|
|
46699
|
-
var _a;
|
|
46700
46695
|
const verified2 = await compactVerify(jwt, key3, options);
|
|
46701
|
-
if (
|
|
46696
|
+
if (verified2.protectedHeader.crit?.includes("b64") && verified2.protectedHeader.b64 === false) {
|
|
46702
46697
|
throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
|
|
46703
46698
|
}
|
|
46704
46699
|
const payload4 = jwt_claims_set_default(verified2.protectedHeader, verified2.payload, options);
|
|
@@ -46709,7 +46704,7 @@ var PodOS = (() => {
|
|
|
46709
46704
|
return result5;
|
|
46710
46705
|
}
|
|
46711
46706
|
|
|
46712
|
-
// ../node_modules/jose/dist/browser/runtime/sign.js
|
|
46707
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/sign.js
|
|
46713
46708
|
var sign = async (alg, key3, data2) => {
|
|
46714
46709
|
const cryptoKey = await getCryptoKey(alg, key3, "sign");
|
|
46715
46710
|
check_key_length_default(alg, cryptoKey);
|
|
@@ -46718,7 +46713,7 @@ var PodOS = (() => {
|
|
|
46718
46713
|
};
|
|
46719
46714
|
var sign_default = sign;
|
|
46720
46715
|
|
|
46721
|
-
// ../node_modules/jose/dist/browser/jws/flattened/sign.js
|
|
46716
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jws/flattened/sign.js
|
|
46722
46717
|
var FlattenedSign = class {
|
|
46723
46718
|
constructor(payload4) {
|
|
46724
46719
|
if (!(payload4 instanceof Uint8Array)) {
|
|
@@ -46751,7 +46746,7 @@ var PodOS = (() => {
|
|
|
46751
46746
|
...this._protectedHeader,
|
|
46752
46747
|
...this._unprotectedHeader
|
|
46753
46748
|
};
|
|
46754
|
-
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options
|
|
46749
|
+
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options?.crit, this._protectedHeader, joseHeader);
|
|
46755
46750
|
let b64 = true;
|
|
46756
46751
|
if (extensions.has("b64")) {
|
|
46757
46752
|
b64 = this._protectedHeader.b64;
|
|
@@ -46793,7 +46788,7 @@ var PodOS = (() => {
|
|
|
46793
46788
|
}
|
|
46794
46789
|
};
|
|
46795
46790
|
|
|
46796
|
-
// ../node_modules/jose/dist/browser/jws/compact/sign.js
|
|
46791
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jws/compact/sign.js
|
|
46797
46792
|
var CompactSign = class {
|
|
46798
46793
|
constructor(payload4) {
|
|
46799
46794
|
this._flattened = new FlattenedSign(payload4);
|
|
@@ -46811,9 +46806,15 @@ var PodOS = (() => {
|
|
|
46811
46806
|
}
|
|
46812
46807
|
};
|
|
46813
46808
|
|
|
46814
|
-
// ../node_modules/jose/dist/browser/jwt/produce.js
|
|
46809
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwt/produce.js
|
|
46810
|
+
function validateInput(label4, input2) {
|
|
46811
|
+
if (!Number.isFinite(input2)) {
|
|
46812
|
+
throw new TypeError(`Invalid ${label4} input`);
|
|
46813
|
+
}
|
|
46814
|
+
return input2;
|
|
46815
|
+
}
|
|
46815
46816
|
var ProduceJWT = class {
|
|
46816
|
-
constructor(payload4) {
|
|
46817
|
+
constructor(payload4 = {}) {
|
|
46817
46818
|
if (!isObject(payload4)) {
|
|
46818
46819
|
throw new TypeError("JWT Claims Set MUST be an object");
|
|
46819
46820
|
}
|
|
@@ -46837,7 +46838,9 @@ var PodOS = (() => {
|
|
|
46837
46838
|
}
|
|
46838
46839
|
setNotBefore(input2) {
|
|
46839
46840
|
if (typeof input2 === "number") {
|
|
46840
|
-
this._payload = { ...this._payload, nbf: input2 };
|
|
46841
|
+
this._payload = { ...this._payload, nbf: validateInput("setNotBefore", input2) };
|
|
46842
|
+
} else if (input2 instanceof Date) {
|
|
46843
|
+
this._payload = { ...this._payload, nbf: validateInput("setNotBefore", epoch_default(input2)) };
|
|
46841
46844
|
} else {
|
|
46842
46845
|
this._payload = { ...this._payload, nbf: epoch_default(/* @__PURE__ */ new Date()) + secs_default(input2) };
|
|
46843
46846
|
}
|
|
@@ -46845,7 +46848,9 @@ var PodOS = (() => {
|
|
|
46845
46848
|
}
|
|
46846
46849
|
setExpirationTime(input2) {
|
|
46847
46850
|
if (typeof input2 === "number") {
|
|
46848
|
-
this._payload = { ...this._payload, exp: input2 };
|
|
46851
|
+
this._payload = { ...this._payload, exp: validateInput("setExpirationTime", input2) };
|
|
46852
|
+
} else if (input2 instanceof Date) {
|
|
46853
|
+
this._payload = { ...this._payload, exp: validateInput("setExpirationTime", epoch_default(input2)) };
|
|
46849
46854
|
} else {
|
|
46850
46855
|
this._payload = { ...this._payload, exp: epoch_default(/* @__PURE__ */ new Date()) + secs_default(input2) };
|
|
46851
46856
|
}
|
|
@@ -46854,41 +46859,294 @@ var PodOS = (() => {
|
|
|
46854
46859
|
setIssuedAt(input2) {
|
|
46855
46860
|
if (typeof input2 === "undefined") {
|
|
46856
46861
|
this._payload = { ...this._payload, iat: epoch_default(/* @__PURE__ */ new Date()) };
|
|
46862
|
+
} else if (input2 instanceof Date) {
|
|
46863
|
+
this._payload = { ...this._payload, iat: validateInput("setIssuedAt", epoch_default(input2)) };
|
|
46864
|
+
} else if (typeof input2 === "string") {
|
|
46865
|
+
this._payload = {
|
|
46866
|
+
...this._payload,
|
|
46867
|
+
iat: validateInput("setIssuedAt", epoch_default(/* @__PURE__ */ new Date()) + secs_default(input2))
|
|
46868
|
+
};
|
|
46857
46869
|
} else {
|
|
46858
|
-
this._payload = { ...this._payload, iat: input2 };
|
|
46870
|
+
this._payload = { ...this._payload, iat: validateInput("setIssuedAt", input2) };
|
|
46859
46871
|
}
|
|
46860
46872
|
return this;
|
|
46861
46873
|
}
|
|
46862
46874
|
};
|
|
46863
46875
|
|
|
46864
|
-
// ../node_modules/jose/dist/browser/jwt/sign.js
|
|
46876
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwt/sign.js
|
|
46865
46877
|
var SignJWT = class extends ProduceJWT {
|
|
46866
46878
|
setProtectedHeader(protectedHeader) {
|
|
46867
46879
|
this._protectedHeader = protectedHeader;
|
|
46868
46880
|
return this;
|
|
46869
46881
|
}
|
|
46870
46882
|
async sign(key3, options) {
|
|
46871
|
-
var _a;
|
|
46872
46883
|
const sig = new CompactSign(encoder.encode(JSON.stringify(this._payload)));
|
|
46873
46884
|
sig.setProtectedHeader(this._protectedHeader);
|
|
46874
|
-
if (Array.isArray(
|
|
46885
|
+
if (Array.isArray(this._protectedHeader?.crit) && this._protectedHeader.crit.includes("b64") && this._protectedHeader.b64 === false) {
|
|
46875
46886
|
throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
|
|
46876
46887
|
}
|
|
46877
46888
|
return sig.sign(key3, options);
|
|
46878
46889
|
}
|
|
46879
46890
|
};
|
|
46880
46891
|
|
|
46881
|
-
// ../node_modules/jose/dist/browser/
|
|
46892
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwks/local.js
|
|
46893
|
+
function getKtyFromAlg(alg) {
|
|
46894
|
+
switch (typeof alg === "string" && alg.slice(0, 2)) {
|
|
46895
|
+
case "RS":
|
|
46896
|
+
case "PS":
|
|
46897
|
+
return "RSA";
|
|
46898
|
+
case "ES":
|
|
46899
|
+
return "EC";
|
|
46900
|
+
case "Ed":
|
|
46901
|
+
return "OKP";
|
|
46902
|
+
default:
|
|
46903
|
+
throw new JOSENotSupported('Unsupported "alg" value for a JSON Web Key Set');
|
|
46904
|
+
}
|
|
46905
|
+
}
|
|
46906
|
+
function isJWKSLike(jwks) {
|
|
46907
|
+
return jwks && typeof jwks === "object" && Array.isArray(jwks.keys) && jwks.keys.every(isJWKLike);
|
|
46908
|
+
}
|
|
46909
|
+
function isJWKLike(key3) {
|
|
46910
|
+
return isObject(key3);
|
|
46911
|
+
}
|
|
46912
|
+
function clone(obj) {
|
|
46913
|
+
if (typeof structuredClone === "function") {
|
|
46914
|
+
return structuredClone(obj);
|
|
46915
|
+
}
|
|
46916
|
+
return JSON.parse(JSON.stringify(obj));
|
|
46917
|
+
}
|
|
46918
|
+
var LocalJWKSet = class {
|
|
46919
|
+
constructor(jwks) {
|
|
46920
|
+
this._cached = /* @__PURE__ */ new WeakMap();
|
|
46921
|
+
if (!isJWKSLike(jwks)) {
|
|
46922
|
+
throw new JWKSInvalid("JSON Web Key Set malformed");
|
|
46923
|
+
}
|
|
46924
|
+
this._jwks = clone(jwks);
|
|
46925
|
+
}
|
|
46926
|
+
async getKey(protectedHeader, token) {
|
|
46927
|
+
const { alg, kid } = { ...protectedHeader, ...token?.header };
|
|
46928
|
+
const kty = getKtyFromAlg(alg);
|
|
46929
|
+
const candidates = this._jwks.keys.filter((jwk2) => {
|
|
46930
|
+
let candidate4 = kty === jwk2.kty;
|
|
46931
|
+
if (candidate4 && typeof kid === "string") {
|
|
46932
|
+
candidate4 = kid === jwk2.kid;
|
|
46933
|
+
}
|
|
46934
|
+
if (candidate4 && typeof jwk2.alg === "string") {
|
|
46935
|
+
candidate4 = alg === jwk2.alg;
|
|
46936
|
+
}
|
|
46937
|
+
if (candidate4 && typeof jwk2.use === "string") {
|
|
46938
|
+
candidate4 = jwk2.use === "sig";
|
|
46939
|
+
}
|
|
46940
|
+
if (candidate4 && Array.isArray(jwk2.key_ops)) {
|
|
46941
|
+
candidate4 = jwk2.key_ops.includes("verify");
|
|
46942
|
+
}
|
|
46943
|
+
if (candidate4 && alg === "EdDSA") {
|
|
46944
|
+
candidate4 = jwk2.crv === "Ed25519" || jwk2.crv === "Ed448";
|
|
46945
|
+
}
|
|
46946
|
+
if (candidate4) {
|
|
46947
|
+
switch (alg) {
|
|
46948
|
+
case "ES256":
|
|
46949
|
+
candidate4 = jwk2.crv === "P-256";
|
|
46950
|
+
break;
|
|
46951
|
+
case "ES256K":
|
|
46952
|
+
candidate4 = jwk2.crv === "secp256k1";
|
|
46953
|
+
break;
|
|
46954
|
+
case "ES384":
|
|
46955
|
+
candidate4 = jwk2.crv === "P-384";
|
|
46956
|
+
break;
|
|
46957
|
+
case "ES512":
|
|
46958
|
+
candidate4 = jwk2.crv === "P-521";
|
|
46959
|
+
break;
|
|
46960
|
+
}
|
|
46961
|
+
}
|
|
46962
|
+
return candidate4;
|
|
46963
|
+
});
|
|
46964
|
+
const { 0: jwk, length: length2 } = candidates;
|
|
46965
|
+
if (length2 === 0) {
|
|
46966
|
+
throw new JWKSNoMatchingKey();
|
|
46967
|
+
}
|
|
46968
|
+
if (length2 !== 1) {
|
|
46969
|
+
const error5 = new JWKSMultipleMatchingKeys();
|
|
46970
|
+
const { _cached } = this;
|
|
46971
|
+
error5[Symbol.asyncIterator] = async function* () {
|
|
46972
|
+
for (const jwk2 of candidates) {
|
|
46973
|
+
try {
|
|
46974
|
+
yield await importWithAlgCache(_cached, jwk2, alg);
|
|
46975
|
+
} catch {
|
|
46976
|
+
}
|
|
46977
|
+
}
|
|
46978
|
+
};
|
|
46979
|
+
throw error5;
|
|
46980
|
+
}
|
|
46981
|
+
return importWithAlgCache(this._cached, jwk, alg);
|
|
46982
|
+
}
|
|
46983
|
+
};
|
|
46984
|
+
async function importWithAlgCache(cache, jwk, alg) {
|
|
46985
|
+
const cached = cache.get(jwk) || cache.set(jwk, {}).get(jwk);
|
|
46986
|
+
if (cached[alg] === void 0) {
|
|
46987
|
+
const key3 = await importJWK({ ...jwk, ext: true }, alg);
|
|
46988
|
+
if (key3 instanceof Uint8Array || key3.type !== "public") {
|
|
46989
|
+
throw new JWKSInvalid("JSON Web Key Set members must be public keys");
|
|
46990
|
+
}
|
|
46991
|
+
cached[alg] = key3;
|
|
46992
|
+
}
|
|
46993
|
+
return cached[alg];
|
|
46994
|
+
}
|
|
46995
|
+
function createLocalJWKSet(jwks) {
|
|
46996
|
+
const set = new LocalJWKSet(jwks);
|
|
46997
|
+
const localJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token);
|
|
46998
|
+
Object.defineProperties(localJWKSet, {
|
|
46999
|
+
jwks: {
|
|
47000
|
+
value: () => clone(set._jwks),
|
|
47001
|
+
enumerable: true,
|
|
47002
|
+
configurable: false,
|
|
47003
|
+
writable: false
|
|
47004
|
+
}
|
|
47005
|
+
});
|
|
47006
|
+
return localJWKSet;
|
|
47007
|
+
}
|
|
47008
|
+
|
|
47009
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/fetch_jwks.js
|
|
47010
|
+
var fetchJwks = async (url7, timeout2, options) => {
|
|
47011
|
+
let controller2;
|
|
47012
|
+
let id6;
|
|
47013
|
+
let timedOut = false;
|
|
47014
|
+
if (typeof AbortController === "function") {
|
|
47015
|
+
controller2 = new AbortController();
|
|
47016
|
+
id6 = setTimeout(() => {
|
|
47017
|
+
timedOut = true;
|
|
47018
|
+
controller2.abort();
|
|
47019
|
+
}, timeout2);
|
|
47020
|
+
}
|
|
47021
|
+
const response6 = await fetch(url7.href, {
|
|
47022
|
+
signal: controller2 ? controller2.signal : void 0,
|
|
47023
|
+
redirect: "manual",
|
|
47024
|
+
headers: options.headers
|
|
47025
|
+
}).catch((err) => {
|
|
47026
|
+
if (timedOut)
|
|
47027
|
+
throw new JWKSTimeout();
|
|
47028
|
+
throw err;
|
|
47029
|
+
});
|
|
47030
|
+
if (id6 !== void 0)
|
|
47031
|
+
clearTimeout(id6);
|
|
47032
|
+
if (response6.status !== 200) {
|
|
47033
|
+
throw new JOSEError("Expected 200 OK from the JSON Web Key Set HTTP response");
|
|
47034
|
+
}
|
|
47035
|
+
try {
|
|
47036
|
+
return await response6.json();
|
|
47037
|
+
} catch {
|
|
47038
|
+
throw new JOSEError("Failed to parse the JSON Web Key Set HTTP response as JSON");
|
|
47039
|
+
}
|
|
47040
|
+
};
|
|
47041
|
+
var fetch_jwks_default = fetchJwks;
|
|
47042
|
+
|
|
47043
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/jwks/remote.js
|
|
47044
|
+
function isCloudflareWorkers() {
|
|
47045
|
+
return typeof WebSocketPair !== "undefined" || typeof navigator !== "undefined" && navigator.userAgent === "Cloudflare-Workers" || typeof EdgeRuntime !== "undefined" && EdgeRuntime === "vercel";
|
|
47046
|
+
}
|
|
47047
|
+
var USER_AGENT;
|
|
47048
|
+
if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
|
|
47049
|
+
const NAME = "jose";
|
|
47050
|
+
const VERSION = "v5.3.0";
|
|
47051
|
+
USER_AGENT = `${NAME}/${VERSION}`;
|
|
47052
|
+
}
|
|
47053
|
+
var RemoteJWKSet = class {
|
|
47054
|
+
constructor(url7, options) {
|
|
47055
|
+
if (!(url7 instanceof URL)) {
|
|
47056
|
+
throw new TypeError("url must be an instance of URL");
|
|
47057
|
+
}
|
|
47058
|
+
this._url = new URL(url7.href);
|
|
47059
|
+
this._options = { agent: options?.agent, headers: options?.headers };
|
|
47060
|
+
this._timeoutDuration = typeof options?.timeoutDuration === "number" ? options?.timeoutDuration : 5e3;
|
|
47061
|
+
this._cooldownDuration = typeof options?.cooldownDuration === "number" ? options?.cooldownDuration : 3e4;
|
|
47062
|
+
this._cacheMaxAge = typeof options?.cacheMaxAge === "number" ? options?.cacheMaxAge : 6e5;
|
|
47063
|
+
}
|
|
47064
|
+
coolingDown() {
|
|
47065
|
+
return typeof this._jwksTimestamp === "number" ? Date.now() < this._jwksTimestamp + this._cooldownDuration : false;
|
|
47066
|
+
}
|
|
47067
|
+
fresh() {
|
|
47068
|
+
return typeof this._jwksTimestamp === "number" ? Date.now() < this._jwksTimestamp + this._cacheMaxAge : false;
|
|
47069
|
+
}
|
|
47070
|
+
async getKey(protectedHeader, token) {
|
|
47071
|
+
if (!this._local || !this.fresh()) {
|
|
47072
|
+
await this.reload();
|
|
47073
|
+
}
|
|
47074
|
+
try {
|
|
47075
|
+
return await this._local(protectedHeader, token);
|
|
47076
|
+
} catch (err) {
|
|
47077
|
+
if (err instanceof JWKSNoMatchingKey) {
|
|
47078
|
+
if (this.coolingDown() === false) {
|
|
47079
|
+
await this.reload();
|
|
47080
|
+
return this._local(protectedHeader, token);
|
|
47081
|
+
}
|
|
47082
|
+
}
|
|
47083
|
+
throw err;
|
|
47084
|
+
}
|
|
47085
|
+
}
|
|
47086
|
+
async reload() {
|
|
47087
|
+
if (this._pendingFetch && isCloudflareWorkers()) {
|
|
47088
|
+
this._pendingFetch = void 0;
|
|
47089
|
+
}
|
|
47090
|
+
const headers = new Headers(this._options.headers);
|
|
47091
|
+
if (USER_AGENT && !headers.has("User-Agent")) {
|
|
47092
|
+
headers.set("User-Agent", USER_AGENT);
|
|
47093
|
+
this._options.headers = Object.fromEntries(headers.entries());
|
|
47094
|
+
}
|
|
47095
|
+
this._pendingFetch || (this._pendingFetch = fetch_jwks_default(this._url, this._timeoutDuration, this._options).then((json) => {
|
|
47096
|
+
this._local = createLocalJWKSet(json);
|
|
47097
|
+
this._jwksTimestamp = Date.now();
|
|
47098
|
+
this._pendingFetch = void 0;
|
|
47099
|
+
}).catch((err) => {
|
|
47100
|
+
this._pendingFetch = void 0;
|
|
47101
|
+
throw err;
|
|
47102
|
+
}));
|
|
47103
|
+
await this._pendingFetch;
|
|
47104
|
+
}
|
|
47105
|
+
};
|
|
47106
|
+
function createRemoteJWKSet(url7, options) {
|
|
47107
|
+
const set = new RemoteJWKSet(url7, options);
|
|
47108
|
+
const remoteJWKSet = async (protectedHeader, token) => set.getKey(protectedHeader, token);
|
|
47109
|
+
Object.defineProperties(remoteJWKSet, {
|
|
47110
|
+
coolingDown: {
|
|
47111
|
+
get: () => set.coolingDown(),
|
|
47112
|
+
enumerable: true,
|
|
47113
|
+
configurable: false
|
|
47114
|
+
},
|
|
47115
|
+
fresh: {
|
|
47116
|
+
get: () => set.fresh(),
|
|
47117
|
+
enumerable: true,
|
|
47118
|
+
configurable: false
|
|
47119
|
+
},
|
|
47120
|
+
reload: {
|
|
47121
|
+
value: () => set.reload(),
|
|
47122
|
+
enumerable: true,
|
|
47123
|
+
configurable: false,
|
|
47124
|
+
writable: false
|
|
47125
|
+
},
|
|
47126
|
+
reloading: {
|
|
47127
|
+
get: () => !!set._pendingFetch,
|
|
47128
|
+
enumerable: true,
|
|
47129
|
+
configurable: false
|
|
47130
|
+
},
|
|
47131
|
+
jwks: {
|
|
47132
|
+
value: () => set._local?.jwks(),
|
|
47133
|
+
enumerable: true,
|
|
47134
|
+
configurable: false,
|
|
47135
|
+
writable: false
|
|
47136
|
+
}
|
|
47137
|
+
});
|
|
47138
|
+
return remoteJWKSet;
|
|
47139
|
+
}
|
|
47140
|
+
|
|
47141
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/runtime/generate.js
|
|
46882
47142
|
function getModulusLengthOption(options) {
|
|
46883
|
-
|
|
46884
|
-
const modulusLength = (_a = options === null || options === void 0 ? void 0 : options.modulusLength) !== null && _a !== void 0 ? _a : 2048;
|
|
47143
|
+
const modulusLength = options?.modulusLength ?? 2048;
|
|
46885
47144
|
if (typeof modulusLength !== "number" || modulusLength < 2048) {
|
|
46886
47145
|
throw new JOSENotSupported("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");
|
|
46887
47146
|
}
|
|
46888
47147
|
return modulusLength;
|
|
46889
47148
|
}
|
|
46890
47149
|
async function generateKeyPair(alg, options) {
|
|
46891
|
-
var _a, _b, _c;
|
|
46892
47150
|
let algorithm3;
|
|
46893
47151
|
let keyUsages;
|
|
46894
47152
|
switch (alg) {
|
|
@@ -46938,9 +47196,9 @@ var PodOS = (() => {
|
|
|
46938
47196
|
algorithm3 = { name: "ECDSA", namedCurve: "P-521" };
|
|
46939
47197
|
keyUsages = ["sign", "verify"];
|
|
46940
47198
|
break;
|
|
46941
|
-
case "EdDSA":
|
|
47199
|
+
case "EdDSA": {
|
|
46942
47200
|
keyUsages = ["sign", "verify"];
|
|
46943
|
-
const crv =
|
|
47201
|
+
const crv = options?.crv ?? "Ed25519";
|
|
46944
47202
|
switch (crv) {
|
|
46945
47203
|
case "Ed25519":
|
|
46946
47204
|
case "Ed448":
|
|
@@ -46950,22 +47208,23 @@ var PodOS = (() => {
|
|
|
46950
47208
|
throw new JOSENotSupported("Invalid or unsupported crv option provided");
|
|
46951
47209
|
}
|
|
46952
47210
|
break;
|
|
47211
|
+
}
|
|
46953
47212
|
case "ECDH-ES":
|
|
46954
47213
|
case "ECDH-ES+A128KW":
|
|
46955
47214
|
case "ECDH-ES+A192KW":
|
|
46956
47215
|
case "ECDH-ES+A256KW": {
|
|
46957
47216
|
keyUsages = ["deriveKey", "deriveBits"];
|
|
46958
|
-
const
|
|
46959
|
-
switch (
|
|
47217
|
+
const crv = options?.crv ?? "P-256";
|
|
47218
|
+
switch (crv) {
|
|
46960
47219
|
case "P-256":
|
|
46961
47220
|
case "P-384":
|
|
46962
47221
|
case "P-521": {
|
|
46963
|
-
algorithm3 = { name: "ECDH", namedCurve:
|
|
47222
|
+
algorithm3 = { name: "ECDH", namedCurve: crv };
|
|
46964
47223
|
break;
|
|
46965
47224
|
}
|
|
46966
47225
|
case "X25519":
|
|
46967
47226
|
case "X448":
|
|
46968
|
-
algorithm3 = { name:
|
|
47227
|
+
algorithm3 = { name: crv };
|
|
46969
47228
|
break;
|
|
46970
47229
|
default:
|
|
46971
47230
|
throw new JOSENotSupported("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448");
|
|
@@ -46975,10 +47234,10 @@ var PodOS = (() => {
|
|
|
46975
47234
|
default:
|
|
46976
47235
|
throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
46977
47236
|
}
|
|
46978
|
-
return webcrypto_default.subtle.generateKey(algorithm3,
|
|
47237
|
+
return webcrypto_default.subtle.generateKey(algorithm3, options?.extractable ?? false, keyUsages);
|
|
46979
47238
|
}
|
|
46980
47239
|
|
|
46981
|
-
// ../node_modules/jose/dist/browser/key/generate_key_pair.js
|
|
47240
|
+
// ../node_modules/@inrupt/solid-client-authn-core/node_modules/jose/dist/browser/key/generate_key_pair.js
|
|
46982
47241
|
async function generateKeyPair2(alg, options) {
|
|
46983
47242
|
return generateKeyPair(alg, options);
|
|
46984
47243
|
}
|
|
@@ -47050,17 +47309,6 @@ var PodOS = (() => {
|
|
|
47050
47309
|
var SCOPE_OFFLINE = "offline_access";
|
|
47051
47310
|
var SCOPE_WEBID = "webid";
|
|
47052
47311
|
var DEFAULT_SCOPES = [SCOPE_OPENID, SCOPE_OFFLINE, SCOPE_WEBID].join(" ");
|
|
47053
|
-
var buildProxyHandler = (toExclude, errorMessage) => ({
|
|
47054
|
-
// This proxy is only a temporary measure until Session no longer extends
|
|
47055
|
-
// SessionEventEmitter, and the proxying is no longer necessary.
|
|
47056
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47057
|
-
get(target5, prop, receiver2) {
|
|
47058
|
-
if (!Object.getOwnPropertyNames(import_events.EventEmitter).includes(prop) && Object.getOwnPropertyNames(toExclude).includes(prop)) {
|
|
47059
|
-
throw new Error(`${errorMessage}: [${prop}] is not supported`);
|
|
47060
|
-
}
|
|
47061
|
-
return Reflect.get(target5, prop, receiver2);
|
|
47062
|
-
}
|
|
47063
|
-
});
|
|
47064
47312
|
var AggregateHandler = class {
|
|
47065
47313
|
constructor(handleables) {
|
|
47066
47314
|
this.handleables = handleables;
|
|
@@ -47097,24 +47345,10 @@ var PodOS = (() => {
|
|
|
47097
47345
|
}).join(", ")}`);
|
|
47098
47346
|
}
|
|
47099
47347
|
};
|
|
47100
|
-
async function fetchJwks(jwksIri, issuerIri) {
|
|
47101
|
-
const jwksResponse = await fetch2.call(globalThis, jwksIri);
|
|
47102
|
-
if (jwksResponse.status !== 200) {
|
|
47103
|
-
throw new Error(`Could not fetch JWKS for [${issuerIri}] at [${jwksIri}]: ${jwksResponse.status} ${jwksResponse.statusText}`);
|
|
47104
|
-
}
|
|
47105
|
-
let jwk;
|
|
47106
|
-
try {
|
|
47107
|
-
jwk = (await jwksResponse.json()).keys[0];
|
|
47108
|
-
} catch (e) {
|
|
47109
|
-
throw new Error(`Malformed JWKS for [${issuerIri}] at [${jwksIri}]: ${e.message}`);
|
|
47110
|
-
}
|
|
47111
|
-
return jwk;
|
|
47112
|
-
}
|
|
47113
47348
|
async function getWebidFromTokenPayload(idToken, jwksIri, issuerIri, clientId) {
|
|
47114
|
-
const jwk = await fetchJwks(jwksIri, issuerIri);
|
|
47115
47349
|
let payload4;
|
|
47116
47350
|
try {
|
|
47117
|
-
const { payload: verifiedPayload } = await jwtVerify(idToken,
|
|
47351
|
+
const { payload: verifiedPayload } = await jwtVerify(idToken, createRemoteJWKSet(new URL(jwksIri)), {
|
|
47118
47352
|
issuer: issuerIri,
|
|
47119
47353
|
audience: clientId
|
|
47120
47354
|
});
|
|
@@ -47154,17 +47388,29 @@ var PodOS = (() => {
|
|
|
47154
47388
|
cleanedUpUrl.searchParams.delete("iss");
|
|
47155
47389
|
return cleanedUpUrl;
|
|
47156
47390
|
}
|
|
47391
|
+
function booleanWithFallback(value6, fallback) {
|
|
47392
|
+
if (typeof value6 === "boolean") {
|
|
47393
|
+
return Boolean(value6);
|
|
47394
|
+
}
|
|
47395
|
+
return Boolean(fallback);
|
|
47396
|
+
}
|
|
47157
47397
|
var AuthorizationCodeWithPkceOidcHandlerBase = class {
|
|
47158
47398
|
constructor(storageUtility, redirector) {
|
|
47159
47399
|
this.storageUtility = storageUtility;
|
|
47160
47400
|
this.redirector = redirector;
|
|
47401
|
+
this.parametersGuard = (oidcLoginOptions) => {
|
|
47402
|
+
return oidcLoginOptions.issuerConfiguration.grantTypesSupported !== void 0 && oidcLoginOptions.issuerConfiguration.grantTypesSupported.indexOf("authorization_code") > -1 && oidcLoginOptions.redirectUrl !== void 0;
|
|
47403
|
+
};
|
|
47161
47404
|
this.storageUtility = storageUtility;
|
|
47162
47405
|
this.redirector = redirector;
|
|
47163
47406
|
}
|
|
47164
47407
|
async canHandle(oidcLoginOptions) {
|
|
47165
|
-
return
|
|
47408
|
+
return this.parametersGuard(oidcLoginOptions);
|
|
47166
47409
|
}
|
|
47167
47410
|
async handleRedirect({ oidcLoginOptions, state: state2, codeVerifier, targetUrl: targetUrl3 }) {
|
|
47411
|
+
if (!this.parametersGuard(oidcLoginOptions)) {
|
|
47412
|
+
throw new Error("The authorization code grant requires a redirectUrl.");
|
|
47413
|
+
}
|
|
47168
47414
|
await Promise.all([
|
|
47169
47415
|
// We use the OAuth 'state' value (which should be crypto-random) as
|
|
47170
47416
|
// the key in our storage to store our actual SessionID. We do this
|
|
@@ -47175,7 +47421,6 @@ var PodOS = (() => {
|
|
|
47175
47421
|
// that session ID can be any developer-specified value, and therefore
|
|
47176
47422
|
// may not be appropriate (since the OAuth 'state' value should really
|
|
47177
47423
|
// be an unguessable crypto-random value).
|
|
47178
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
47179
47424
|
this.storageUtility.setForUser(state2, {
|
|
47180
47425
|
sessionId: oidcLoginOptions.sessionId
|
|
47181
47426
|
}),
|
|
@@ -47184,12 +47429,12 @@ var PodOS = (() => {
|
|
|
47184
47429
|
// our session ID is unnecessary, but it provides a slightly cleaner
|
|
47185
47430
|
// separation of concerns.
|
|
47186
47431
|
this.storageUtility.setForUser(oidcLoginOptions.sessionId, {
|
|
47187
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
47188
47432
|
codeVerifier,
|
|
47189
47433
|
issuer: oidcLoginOptions.issuer.toString(),
|
|
47190
47434
|
// The redirect URL is read after redirect, so it must be stored now.
|
|
47191
47435
|
redirectUrl: oidcLoginOptions.redirectUrl,
|
|
47192
|
-
dpop: oidcLoginOptions.dpop
|
|
47436
|
+
dpop: Boolean(oidcLoginOptions.dpop).toString(),
|
|
47437
|
+
keepAlive: booleanWithFallback(oidcLoginOptions.keepAlive, true).toString()
|
|
47193
47438
|
})
|
|
47194
47439
|
]);
|
|
47195
47440
|
this.redirector.redirect(targetUrl3, {
|
|
@@ -47251,7 +47496,7 @@ var PodOS = (() => {
|
|
|
47251
47496
|
return {
|
|
47252
47497
|
isLoggedIn: false,
|
|
47253
47498
|
sessionId: v4_default(),
|
|
47254
|
-
fetch: (...args) =>
|
|
47499
|
+
fetch: (...args) => fetch(...args)
|
|
47255
47500
|
};
|
|
47256
47501
|
}
|
|
47257
47502
|
async function clear(sessionId, storage2) {
|
|
@@ -47345,48 +47590,51 @@ var PodOS = (() => {
|
|
|
47345
47590
|
return supported.includes(signingAlg);
|
|
47346
47591
|
})) !== null && _a !== void 0 ? _a : null;
|
|
47347
47592
|
}
|
|
47348
|
-
function
|
|
47349
|
-
|
|
47350
|
-
|
|
47351
|
-
|
|
47352
|
-
|
|
47353
|
-
|
|
47354
|
-
|
|
47355
|
-
return "dynamic";
|
|
47593
|
+
function isStaticClient(options) {
|
|
47594
|
+
return options.clientId !== void 0 && !isValidUrl(options.clientId);
|
|
47595
|
+
}
|
|
47596
|
+
function isSolidOidcClient(options, issuerConfig) {
|
|
47597
|
+
return issuerConfig.scopesSupported.includes("webid") && options.clientId !== void 0 && isValidUrl(options.clientId);
|
|
47598
|
+
}
|
|
47599
|
+
function isKnownClientType(clientType) {
|
|
47600
|
+
return typeof clientType === "string" && ["dynamic", "static", "solid-oidc"].includes(clientType);
|
|
47356
47601
|
}
|
|
47357
47602
|
async function handleRegistration(options, issuerConfig, storageUtility, clientRegistrar) {
|
|
47358
|
-
|
|
47359
|
-
if (
|
|
47603
|
+
let clientInfo;
|
|
47604
|
+
if (isSolidOidcClient(options, issuerConfig)) {
|
|
47605
|
+
clientInfo = {
|
|
47606
|
+
clientId: options.clientId,
|
|
47607
|
+
clientName: options.clientName,
|
|
47608
|
+
clientType: "solid-oidc"
|
|
47609
|
+
};
|
|
47610
|
+
} else if (isStaticClient(options)) {
|
|
47611
|
+
clientInfo = {
|
|
47612
|
+
clientId: options.clientId,
|
|
47613
|
+
clientSecret: options.clientSecret,
|
|
47614
|
+
clientName: options.clientName,
|
|
47615
|
+
clientType: "static"
|
|
47616
|
+
};
|
|
47617
|
+
} else {
|
|
47360
47618
|
return clientRegistrar.getClient({
|
|
47361
47619
|
sessionId: options.sessionId,
|
|
47362
47620
|
clientName: options.clientName,
|
|
47363
47621
|
redirectUrl: options.redirectUrl
|
|
47364
47622
|
}, issuerConfig);
|
|
47365
47623
|
}
|
|
47366
|
-
|
|
47367
|
-
|
|
47368
|
-
|
|
47369
|
-
|
|
47370
|
-
|
|
47371
|
-
|
|
47372
|
-
await storageUtility.setForUser(options.sessionId, {
|
|
47373
|
-
clientSecret: options.clientSecret
|
|
47374
|
-
});
|
|
47624
|
+
const infoToSave = {
|
|
47625
|
+
clientId: clientInfo.clientId,
|
|
47626
|
+
clientType: clientInfo.clientType
|
|
47627
|
+
};
|
|
47628
|
+
if (clientInfo.clientType === "static") {
|
|
47629
|
+
infoToSave.clientSecret = clientInfo.clientSecret;
|
|
47375
47630
|
}
|
|
47376
|
-
if (
|
|
47377
|
-
|
|
47378
|
-
clientName: options.clientName
|
|
47379
|
-
});
|
|
47631
|
+
if (clientInfo.clientName) {
|
|
47632
|
+
infoToSave.clientName = clientInfo.clientName;
|
|
47380
47633
|
}
|
|
47381
|
-
|
|
47382
|
-
|
|
47383
|
-
clientId: options.clientId,
|
|
47384
|
-
clientSecret: options.clientSecret,
|
|
47385
|
-
clientName: options.clientName,
|
|
47386
|
-
clientType
|
|
47387
|
-
};
|
|
47634
|
+
await storageUtility.setForUser(options.sessionId, infoToSave);
|
|
47635
|
+
return clientInfo;
|
|
47388
47636
|
}
|
|
47389
|
-
var
|
|
47637
|
+
var boundFetch = (request2, init) => fetch(request2, init);
|
|
47390
47638
|
var ClientAuthentication = class {
|
|
47391
47639
|
constructor(loginHandler, redirectHandler, logoutHandler, sessionInfoManager, issuerConfigFetcher) {
|
|
47392
47640
|
this.loginHandler = loginHandler;
|
|
@@ -47394,13 +47642,13 @@ var PodOS = (() => {
|
|
|
47394
47642
|
this.logoutHandler = logoutHandler;
|
|
47395
47643
|
this.sessionInfoManager = sessionInfoManager;
|
|
47396
47644
|
this.issuerConfigFetcher = issuerConfigFetcher;
|
|
47397
|
-
this.fetch =
|
|
47645
|
+
this.fetch = boundFetch;
|
|
47398
47646
|
this.logout = async (sessionId, options) => {
|
|
47399
47647
|
await this.logoutHandler.handle(sessionId, (options === null || options === void 0 ? void 0 : options.logoutType) === "idp" ? {
|
|
47400
47648
|
...options,
|
|
47401
47649
|
toLogoutUrl: this.boundLogout
|
|
47402
47650
|
} : options);
|
|
47403
|
-
this.fetch =
|
|
47651
|
+
this.fetch = boundFetch;
|
|
47404
47652
|
delete this.boundLogout;
|
|
47405
47653
|
};
|
|
47406
47654
|
this.getSessionInfo = async (sessionId) => {
|
|
@@ -47418,13 +47666,14 @@ var PodOS = (() => {
|
|
|
47418
47666
|
};
|
|
47419
47667
|
async function loadOidcContextFromStorage(sessionId, storageUtility, configFetcher) {
|
|
47420
47668
|
try {
|
|
47421
|
-
const [issuerIri, codeVerifier, storedRedirectIri, dpop] = await Promise.all([
|
|
47669
|
+
const [issuerIri, codeVerifier, storedRedirectIri, dpop, keepAlive] = await Promise.all([
|
|
47422
47670
|
storageUtility.getForUser(sessionId, "issuer", {
|
|
47423
47671
|
errorIfNull: true
|
|
47424
47672
|
}),
|
|
47425
47673
|
storageUtility.getForUser(sessionId, "codeVerifier"),
|
|
47426
47674
|
storageUtility.getForUser(sessionId, "redirectUrl"),
|
|
47427
|
-
storageUtility.getForUser(sessionId, "dpop", { errorIfNull: true })
|
|
47675
|
+
storageUtility.getForUser(sessionId, "dpop", { errorIfNull: true }),
|
|
47676
|
+
storageUtility.getForUser(sessionId, "keepAlive")
|
|
47428
47677
|
]);
|
|
47429
47678
|
await storageUtility.deleteForUser(sessionId, "codeVerifier");
|
|
47430
47679
|
const issuerConfig = await configFetcher.fetchConfig(issuerIri);
|
|
@@ -47432,7 +47681,9 @@ var PodOS = (() => {
|
|
|
47432
47681
|
codeVerifier,
|
|
47433
47682
|
redirectUrl: storedRedirectIri,
|
|
47434
47683
|
issuerConfig,
|
|
47435
|
-
dpop: dpop === "true"
|
|
47684
|
+
dpop: dpop === "true",
|
|
47685
|
+
// Default keepAlive to true if not found in storage.
|
|
47686
|
+
keepAlive: typeof keepAlive === "string" ? keepAlive === "true" : true
|
|
47436
47687
|
};
|
|
47437
47688
|
} catch (e) {
|
|
47438
47689
|
throw new Error(`Failed to retrieve OIDC context from storage associated with session [${sessionId}]: ${e}`);
|
|
@@ -47589,8 +47840,8 @@ var PodOS = (() => {
|
|
|
47589
47840
|
headers
|
|
47590
47841
|
};
|
|
47591
47842
|
}
|
|
47592
|
-
async function makeAuthenticatedRequest(
|
|
47593
|
-
return
|
|
47843
|
+
async function makeAuthenticatedRequest(accessToken, url7, defaultRequestInit, dpopKey) {
|
|
47844
|
+
return fetch(url7, await buildAuthenticatedHeaders(url7.toString(), accessToken, dpopKey, defaultRequestInit));
|
|
47594
47845
|
}
|
|
47595
47846
|
async function refreshAccessToken(refreshOptions, dpopKey, eventEmitter) {
|
|
47596
47847
|
var _a;
|
|
@@ -47614,7 +47865,7 @@ var PodOS = (() => {
|
|
|
47614
47865
|
}
|
|
47615
47866
|
return DEFAULT_EXPIRATION_TIME_SECONDS;
|
|
47616
47867
|
};
|
|
47617
|
-
async function buildAuthenticatedFetch(
|
|
47868
|
+
async function buildAuthenticatedFetch(accessToken, options) {
|
|
47618
47869
|
var _a;
|
|
47619
47870
|
let currentAccessToken = accessToken;
|
|
47620
47871
|
let latestTimeout;
|
|
@@ -47662,7 +47913,7 @@ var PodOS = (() => {
|
|
|
47662
47913
|
options.eventEmitter.emit(EVENTS.TIMEOUT_SET, expirationTimeout);
|
|
47663
47914
|
}
|
|
47664
47915
|
return async (url7, requestInit) => {
|
|
47665
|
-
let response6 = await makeAuthenticatedRequest(
|
|
47916
|
+
let response6 = await makeAuthenticatedRequest(currentAccessToken, url7, requestInit, options === null || options === void 0 ? void 0 : options.dpopKey);
|
|
47666
47917
|
const failedButNotExpectedAuthError = !response6.ok && !isExpectedAuthError(response6.status);
|
|
47667
47918
|
if (response6.ok || failedButNotExpectedAuthError) {
|
|
47668
47919
|
return response6;
|
|
@@ -47670,7 +47921,6 @@ var PodOS = (() => {
|
|
|
47670
47921
|
const hasBeenRedirected = response6.url !== url7;
|
|
47671
47922
|
if (hasBeenRedirected && (options === null || options === void 0 ? void 0 : options.dpopKey) !== void 0) {
|
|
47672
47923
|
response6 = await makeAuthenticatedRequest(
|
|
47673
|
-
unauthFetch,
|
|
47674
47924
|
currentAccessToken,
|
|
47675
47925
|
// Replace the original target IRI (`url`) by the redirection target
|
|
47676
47926
|
response6.url,
|
|
@@ -47683,7 +47933,7 @@ var PodOS = (() => {
|
|
|
47683
47933
|
}
|
|
47684
47934
|
|
|
47685
47935
|
// ../node_modules/@inrupt/solid-client-authn-browser/dist/index.mjs
|
|
47686
|
-
var
|
|
47936
|
+
var import_events = __toESM(require_events(), 1);
|
|
47687
47937
|
|
|
47688
47938
|
// ../node_modules/@inrupt/oidc-client-ext/dist/index.es.js
|
|
47689
47939
|
var import_oidc_client = __toESM(require_oidc_client_min());
|
|
@@ -47831,7 +48081,7 @@ var PodOS = (() => {
|
|
|
47831
48081
|
headers,
|
|
47832
48082
|
body: new URLSearchParams(requestBody).toString()
|
|
47833
48083
|
};
|
|
47834
|
-
const rawTokenResponse = await
|
|
48084
|
+
const rawTokenResponse = await fetch(issuer2.tokenEndpoint, tokenRequestInit);
|
|
47835
48085
|
const jsonTokenResponse = await rawTokenResponse.json();
|
|
47836
48086
|
const tokenResponse = validateTokenEndpointResponse(jsonTokenResponse, dpop);
|
|
47837
48087
|
const webId = await getWebidFromTokenPayload(tokenResponse.id_token, issuer2.jwksUri, issuer2.issuer, client.clientId);
|
|
@@ -47844,66 +48094,6 @@ var PodOS = (() => {
|
|
|
47844
48094
|
expiresIn: tokenResponse.expires_in
|
|
47845
48095
|
};
|
|
47846
48096
|
}
|
|
47847
|
-
async function getBearerToken(redirectUrl) {
|
|
47848
|
-
let signinResponse;
|
|
47849
|
-
try {
|
|
47850
|
-
const client = new import_oidc_client.OidcClient({
|
|
47851
|
-
// TODO: We should look at the various interfaces being used for storage,
|
|
47852
|
-
// i.e. between oidc-client-js (WebStorageStoreState), localStorage
|
|
47853
|
-
// (which has an interface Storage), and our own proprietary interface
|
|
47854
|
-
// IStorage - i.e. we should really just be using the browser Web Storage
|
|
47855
|
-
// API, e.g. "stateStore: window.localStorage,".
|
|
47856
|
-
// We are instantiating a new instance here, so the only value we need to
|
|
47857
|
-
// explicitly provide is the response mode (default otherwise will look
|
|
47858
|
-
// for a hash '#' fragment!).
|
|
47859
|
-
// eslint-disable-next-line camelcase
|
|
47860
|
-
response_mode: "query",
|
|
47861
|
-
// The userinfo endpoint on NSS fails, so disable this for now
|
|
47862
|
-
// Note that in Solid, information should be retrieved from the
|
|
47863
|
-
// profile referenced by the WebId.
|
|
47864
|
-
// TODO: Note that this is heavy-handed, and that this userinfo check
|
|
47865
|
-
// verifies that the `sub` claim in the id token you get along with the
|
|
47866
|
-
// access token matches the sub claim associated with the access token at
|
|
47867
|
-
// the userinfo endpoint.
|
|
47868
|
-
// That is a useful check, and in the future it should be only disabled
|
|
47869
|
-
// against NSS, and not in general.
|
|
47870
|
-
// Issue tracker: https://github.com/solid/node-solid-server/issues/1490
|
|
47871
|
-
loadUserInfo: false
|
|
47872
|
-
});
|
|
47873
|
-
signinResponse = await client.processSigninResponse(redirectUrl);
|
|
47874
|
-
if (client.settings.metadata === void 0) {
|
|
47875
|
-
throw new Error("Cannot retrieve issuer metadata from client information in storage.");
|
|
47876
|
-
}
|
|
47877
|
-
if (client.settings.metadata.jwks_uri === void 0) {
|
|
47878
|
-
throw new Error("Missing some issuer metadata from client information in storage: 'jwks_uri' is undefined");
|
|
47879
|
-
}
|
|
47880
|
-
if (client.settings.metadata.issuer === void 0) {
|
|
47881
|
-
throw new Error("Missing some issuer metadata from client information in storage: 'issuer' is undefined");
|
|
47882
|
-
}
|
|
47883
|
-
if (client.settings.client_id === void 0) {
|
|
47884
|
-
throw new Error("Missing some client information in storage: 'client_id' is undefined");
|
|
47885
|
-
}
|
|
47886
|
-
const webId = await getWebidFromTokenPayload(signinResponse.id_token, client.settings.metadata.jwks_uri, client.settings.metadata.issuer, client.settings.client_id);
|
|
47887
|
-
return {
|
|
47888
|
-
accessToken: signinResponse.access_token,
|
|
47889
|
-
idToken: signinResponse.id_token,
|
|
47890
|
-
webId,
|
|
47891
|
-
// Although not a field in the TypeScript response interface, the refresh
|
|
47892
|
-
// token (which can optionally come back with the access token (if, as per
|
|
47893
|
-
// the OAuth2 spec, we requested one using the scope of 'offline_access')
|
|
47894
|
-
// will be included in the signin response object.
|
|
47895
|
-
// eslint-disable-next-line camelcase
|
|
47896
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
47897
|
-
// @ts-ignore
|
|
47898
|
-
refreshToken: signinResponse.refresh_token
|
|
47899
|
-
};
|
|
47900
|
-
} catch (err) {
|
|
47901
|
-
throw new Error(`Problem handling Auth Code Grant (Flow) redirect - URL [${redirectUrl}]: ${err}`);
|
|
47902
|
-
}
|
|
47903
|
-
}
|
|
47904
|
-
async function getDpopToken(issuer2, client, data2) {
|
|
47905
|
-
return getTokens(issuer2, client, data2, true);
|
|
47906
|
-
}
|
|
47907
48097
|
var isValidUrl2 = (url7) => {
|
|
47908
48098
|
try {
|
|
47909
48099
|
new URL(url7);
|
|
@@ -47937,7 +48127,7 @@ var PodOS = (() => {
|
|
|
47937
48127
|
} else if (isValidUrl2(client.clientId)) {
|
|
47938
48128
|
requestBody.client_id = client.clientId;
|
|
47939
48129
|
}
|
|
47940
|
-
const rawResponse = await
|
|
48130
|
+
const rawResponse = await fetch(issuer2.tokenEndpoint, {
|
|
47941
48131
|
method: "POST",
|
|
47942
48132
|
body: new URLSearchParams(requestBody).toString(),
|
|
47943
48133
|
headers: {
|
|
@@ -48035,7 +48225,7 @@ var PodOS = (() => {
|
|
|
48035
48225
|
};
|
|
48036
48226
|
this.handleIncomingRedirect = async (url7, eventEmitter) => {
|
|
48037
48227
|
try {
|
|
48038
|
-
const redirectInfo = await this.redirectHandler.handle(url7, eventEmitter);
|
|
48228
|
+
const redirectInfo = await this.redirectHandler.handle(url7, eventEmitter, void 0);
|
|
48039
48229
|
this.fetch = redirectInfo.fetch.bind(window);
|
|
48040
48230
|
this.boundLogout = redirectInfo.getLogoutUrl;
|
|
48041
48231
|
await this.cleanUrlAfterRedirect(url7);
|
|
@@ -48114,8 +48304,7 @@ var PodOS = (() => {
|
|
|
48114
48304
|
authority: oidcLoginOptions.issuer.toString(),
|
|
48115
48305
|
client_id: oidcLoginOptions.client.clientId,
|
|
48116
48306
|
client_secret: oidcLoginOptions.client.clientSecret,
|
|
48117
|
-
redirect_uri: oidcLoginOptions.redirectUrl
|
|
48118
|
-
post_logout_redirect_uri: oidcLoginOptions.redirectUrl.toString(),
|
|
48307
|
+
redirect_uri: oidcLoginOptions.redirectUrl,
|
|
48119
48308
|
response_type: "code",
|
|
48120
48309
|
scope: DEFAULT_SCOPES,
|
|
48121
48310
|
filterProtocolClaims: true,
|
|
@@ -48261,7 +48450,7 @@ var PodOS = (() => {
|
|
|
48261
48450
|
// includes the full issuer path. See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig.
|
|
48262
48451
|
issuer2.endsWith("/") ? issuer2 : `${issuer2}/`
|
|
48263
48452
|
).href;
|
|
48264
|
-
const issuerConfigRequestBody = await
|
|
48453
|
+
const issuerConfigRequestBody = await fetch(openIdConfigUrl);
|
|
48265
48454
|
try {
|
|
48266
48455
|
issuerConfig = processConfig(await issuerConfigRequestBody.json());
|
|
48267
48456
|
} catch (err) {
|
|
@@ -48352,7 +48541,6 @@ var PodOS = (() => {
|
|
|
48352
48541
|
return getUnauthenticatedSession();
|
|
48353
48542
|
}
|
|
48354
48543
|
};
|
|
48355
|
-
var globalFetch2 = (...args) => fetch2.call(globalThis, ...args);
|
|
48356
48544
|
var AuthCodeRedirectHandler = class {
|
|
48357
48545
|
constructor(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokerRefresher) {
|
|
48358
48546
|
this.storageUtility = storageUtility;
|
|
@@ -48395,21 +48583,16 @@ var PodOS = (() => {
|
|
|
48395
48583
|
throw new Error(`The redirect URL for session ${storedSessionId} is missing from storage.`);
|
|
48396
48584
|
}
|
|
48397
48585
|
const client = await this.clientRegistrar.getClient({ sessionId: storedSessionId }, issuerConfig);
|
|
48398
|
-
let tokens;
|
|
48399
48586
|
const tokenCreatedAt = Date.now();
|
|
48400
|
-
|
|
48401
|
-
|
|
48402
|
-
|
|
48403
|
-
|
|
48404
|
-
|
|
48405
|
-
|
|
48406
|
-
|
|
48407
|
-
|
|
48408
|
-
|
|
48409
|
-
window.localStorage.removeItem(`oidc.${oauthState}`);
|
|
48410
|
-
} else {
|
|
48411
|
-
tokens = await getBearerToken(url7.toString());
|
|
48412
|
-
}
|
|
48587
|
+
const tokens = await getTokens(issuerConfig, client, {
|
|
48588
|
+
grantType: "authorization_code",
|
|
48589
|
+
// We rely on our 'canHandle' function checking that the OAuth 'code'
|
|
48590
|
+
// parameter is present in our query string.
|
|
48591
|
+
code: url7.searchParams.get("code"),
|
|
48592
|
+
codeVerifier,
|
|
48593
|
+
redirectUrl: storedRedirectIri
|
|
48594
|
+
}, isDpop);
|
|
48595
|
+
window.localStorage.removeItem(`oidc.${oauthState}`);
|
|
48413
48596
|
let refreshOptions;
|
|
48414
48597
|
if (tokens.refreshToken !== void 0) {
|
|
48415
48598
|
refreshOptions = {
|
|
@@ -48418,7 +48601,7 @@ var PodOS = (() => {
|
|
|
48418
48601
|
tokenRefresher: this.tokerRefresher
|
|
48419
48602
|
};
|
|
48420
48603
|
}
|
|
48421
|
-
const authFetch = await buildAuthenticatedFetch(
|
|
48604
|
+
const authFetch = await buildAuthenticatedFetch(tokens.accessToken, {
|
|
48422
48605
|
dpopKey: tokens.dpopKey,
|
|
48423
48606
|
refreshOptions,
|
|
48424
48607
|
eventEmitter,
|
|
@@ -48478,33 +48661,34 @@ var PodOS = (() => {
|
|
|
48478
48661
|
this.storageUtility = storageUtility;
|
|
48479
48662
|
}
|
|
48480
48663
|
async getClient(options, issuerConfig) {
|
|
48481
|
-
const [
|
|
48482
|
-
storedClientId,
|
|
48483
|
-
storedClientSecret
|
|
48484
|
-
// storedClientName,
|
|
48485
|
-
] = await Promise.all([
|
|
48664
|
+
const [storedClientId, storedClientSecret, storedClientName, storedClientType] = await Promise.all([
|
|
48486
48665
|
this.storageUtility.getForUser(options.sessionId, "clientId", {
|
|
48487
48666
|
secure: false
|
|
48488
48667
|
}),
|
|
48489
48668
|
this.storageUtility.getForUser(options.sessionId, "clientSecret", {
|
|
48490
48669
|
secure: false
|
|
48670
|
+
}),
|
|
48671
|
+
this.storageUtility.getForUser(options.sessionId, "clientName", {
|
|
48672
|
+
secure: false
|
|
48673
|
+
}),
|
|
48674
|
+
this.storageUtility.getForUser(options.sessionId, "clientType", {
|
|
48675
|
+
secure: false
|
|
48491
48676
|
})
|
|
48492
|
-
// this.storageUtility.getForUser(options.sessionId, "clientName", {
|
|
48493
|
-
// // FIXME: figure out how to persist secure storage at reload
|
|
48494
|
-
// secure: false,
|
|
48495
|
-
// }),
|
|
48496
48677
|
]);
|
|
48497
|
-
if (storedClientId) {
|
|
48678
|
+
if (storedClientId && isKnownClientType(storedClientType)) {
|
|
48498
48679
|
return {
|
|
48499
48680
|
clientId: storedClientId,
|
|
48500
48681
|
clientSecret: storedClientSecret,
|
|
48501
|
-
|
|
48682
|
+
clientName: storedClientName,
|
|
48683
|
+
// Note: static clients are not applicable in a browser context.
|
|
48684
|
+
clientType: storedClientType
|
|
48502
48685
|
};
|
|
48503
48686
|
}
|
|
48504
48687
|
try {
|
|
48505
48688
|
const registeredClient = await registerClient(options, issuerConfig);
|
|
48506
48689
|
const infoToSave = {
|
|
48507
|
-
clientId: registeredClient.clientId
|
|
48690
|
+
clientId: registeredClient.clientId,
|
|
48691
|
+
clientType: "dynamic"
|
|
48508
48692
|
};
|
|
48509
48693
|
if (registeredClient.clientSecret) {
|
|
48510
48694
|
infoToSave.clientSecret = registeredClient.clientSecret;
|
|
@@ -48613,7 +48797,7 @@ var PodOS = (() => {
|
|
|
48613
48797
|
function isLoggedIn(sessionInfo) {
|
|
48614
48798
|
return !!(sessionInfo === null || sessionInfo === void 0 ? void 0 : sessionInfo.isLoggedIn);
|
|
48615
48799
|
}
|
|
48616
|
-
var Session = class
|
|
48800
|
+
var Session = class {
|
|
48617
48801
|
/**
|
|
48618
48802
|
* Session object constructor. Typically called as follows:
|
|
48619
48803
|
*
|
|
@@ -48630,7 +48814,6 @@ var PodOS = (() => {
|
|
|
48630
48814
|
*
|
|
48631
48815
|
*/
|
|
48632
48816
|
constructor(sessionOptions = {}, sessionId = void 0) {
|
|
48633
|
-
super();
|
|
48634
48817
|
this.tokenRequestInProgress = false;
|
|
48635
48818
|
this.login = async (options) => {
|
|
48636
48819
|
var _a;
|
|
@@ -48687,7 +48870,7 @@ var PodOS = (() => {
|
|
|
48687
48870
|
this.tokenRequestInProgress = false;
|
|
48688
48871
|
return sessionInfo;
|
|
48689
48872
|
};
|
|
48690
|
-
this.events = new
|
|
48873
|
+
this.events = new import_events.default();
|
|
48691
48874
|
if (sessionOptions.clientAuthentication) {
|
|
48692
48875
|
this.clientAuthentication = sessionOptions.clientAuthentication;
|
|
48693
48876
|
} else if (sessionOptions.secureStorage && sessionOptions.insecureStorage) {
|
|
@@ -48714,58 +48897,6 @@ var PodOS = (() => {
|
|
|
48714
48897
|
this.events.on(EVENTS.SESSION_EXPIRED, () => this.internalLogout(false));
|
|
48715
48898
|
this.events.on(EVENTS.ERROR, () => this.internalLogout(false));
|
|
48716
48899
|
}
|
|
48717
|
-
/**
|
|
48718
|
-
* Register a callback function to be called when a user completes login.
|
|
48719
|
-
*
|
|
48720
|
-
* The callback is called when {@link handleIncomingRedirect} completes successfully.
|
|
48721
|
-
*
|
|
48722
|
-
* @param callback The function called when a user completes login.
|
|
48723
|
-
* @deprecated Prefer session.events.on(EVENTS.LOGIN, callback)
|
|
48724
|
-
*/
|
|
48725
|
-
onLogin(callback) {
|
|
48726
|
-
this.events.on(EVENTS.LOGIN, callback);
|
|
48727
|
-
}
|
|
48728
|
-
/**
|
|
48729
|
-
* Register a callback function to be called when a user logs out:
|
|
48730
|
-
*
|
|
48731
|
-
* @param callback The function called when a user completes logout.
|
|
48732
|
-
* @deprecated Prefer session.events.on(EVENTS.LOGOUT, callback)
|
|
48733
|
-
*/
|
|
48734
|
-
onLogout(callback) {
|
|
48735
|
-
this.events.on(EVENTS.LOGOUT, callback);
|
|
48736
|
-
}
|
|
48737
|
-
/**
|
|
48738
|
-
* Register a callback function to be called when a user logs out:
|
|
48739
|
-
*
|
|
48740
|
-
* @param callback The function called when an error occurs.
|
|
48741
|
-
* @since 1.11.0
|
|
48742
|
-
* @deprecated Prefer session.events.on(EVENTS.ERROR, callback)
|
|
48743
|
-
*/
|
|
48744
|
-
onError(callback) {
|
|
48745
|
-
this.events.on(EVENTS.ERROR, callback);
|
|
48746
|
-
}
|
|
48747
|
-
/**
|
|
48748
|
-
* Register a callback function to be called when a session is restored.
|
|
48749
|
-
*
|
|
48750
|
-
* Note: the callback will be called with the saved value of the 'current URL'
|
|
48751
|
-
* at the time the session was restored.
|
|
48752
|
-
*
|
|
48753
|
-
* @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.
|
|
48754
|
-
* @deprecated Prefer session.events.on(EVENTS.SESSION_RESTORED, callback)
|
|
48755
|
-
*/
|
|
48756
|
-
onSessionRestore(callback) {
|
|
48757
|
-
this.events.on(EVENTS.SESSION_RESTORED, callback);
|
|
48758
|
-
}
|
|
48759
|
-
/**
|
|
48760
|
-
* Register a callback that runs when the session expires and can no longer
|
|
48761
|
-
* make authenticated requests, but following a user logout.
|
|
48762
|
-
* @param callback The function that runs on session expiration.
|
|
48763
|
-
* @since 1.11.0
|
|
48764
|
-
* @deprecated Prefer session.events.on(EVENTS.SESSION_EXPIRED, callback)
|
|
48765
|
-
*/
|
|
48766
|
-
onSessionExpiration(callback) {
|
|
48767
|
-
this.events.on(EVENTS.SESSION_EXPIRED, callback);
|
|
48768
|
-
}
|
|
48769
48900
|
setSessionInfo(sessionInfo) {
|
|
48770
48901
|
this.info.isLoggedIn = sessionInfo.isLoggedIn;
|
|
48771
48902
|
this.info.webId = sessionInfo.webId;
|
|
@@ -48816,16 +48947,19 @@ var PodOS = (() => {
|
|
|
48816
48947
|
* @deprecated use observeSession instead
|
|
48817
48948
|
*/
|
|
48818
48949
|
trackSession(callback) {
|
|
48819
|
-
this.session.on(EVENTS.LOGIN, () => callback(this.session.info));
|
|
48820
|
-
this.session.on(EVENTS.LOGOUT, () => callback(this.session.info));
|
|
48821
|
-
this.session.on(
|
|
48950
|
+
this.session.events.on(EVENTS.LOGIN, () => callback(this.session.info));
|
|
48951
|
+
this.session.events.on(EVENTS.LOGOUT, () => callback(this.session.info));
|
|
48952
|
+
this.session.events.on(
|
|
48953
|
+
EVENTS.SESSION_RESTORED,
|
|
48954
|
+
() => callback(this.session.info)
|
|
48955
|
+
);
|
|
48822
48956
|
callback(this.session.info);
|
|
48823
48957
|
}
|
|
48824
48958
|
observeSession() {
|
|
48825
48959
|
return this.sessionInfo$;
|
|
48826
48960
|
}
|
|
48827
48961
|
onSessionRestore(callback) {
|
|
48828
|
-
this.session.on(EVENTS.SESSION_RESTORED, callback);
|
|
48962
|
+
this.session.events.on(EVENTS.SESSION_RESTORED, callback);
|
|
48829
48963
|
}
|
|
48830
48964
|
};
|
|
48831
48965
|
|
|
@@ -58819,7 +58953,7 @@ var PodOS = (() => {
|
|
|
58819
58953
|
var Mailbox = "http://www.w3.org/2007/ont/link#Mailbox";
|
|
58820
58954
|
var ProtocolEvent = "http://www.w3.org/2007/ont/link#ProtocolEvent";
|
|
58821
58955
|
var RDFDocument = "http://www.w3.org/2007/ont/link#RDFDocument";
|
|
58822
|
-
var
|
|
58956
|
+
var Response = "http://www.w3.org/2007/ont/link#Response";
|
|
58823
58957
|
var Session3 = "http://www.w3.org/2007/ont/link#Session";
|
|
58824
58958
|
var isMentionedIn = "http://www.w3.org/2007/ont/link#isMentionedIn";
|
|
58825
58959
|
var mentionsClass = "http://www.w3.org/2007/ont/link#mentionsClass";
|
|
@@ -58839,7 +58973,7 @@ var PodOS = (() => {
|
|
|
58839
58973
|
Mailbox,
|
|
58840
58974
|
ProtocolEvent,
|
|
58841
58975
|
RDFDocument,
|
|
58842
|
-
Response
|
|
58976
|
+
Response,
|
|
58843
58977
|
Session: Session3,
|
|
58844
58978
|
isMentionedIn,
|
|
58845
58979
|
mentionsClass,
|
|
@@ -69105,7 +69239,7 @@ var PodOS = (() => {
|
|
|
69105
69239
|
var Mailbox2 = "http://www.w3.org/2007/ont/link#Mailbox";
|
|
69106
69240
|
var ProtocolEvent2 = "http://www.w3.org/2007/ont/link#ProtocolEvent";
|
|
69107
69241
|
var RDFDocument2 = "http://www.w3.org/2007/ont/link#RDFDocument";
|
|
69108
|
-
var
|
|
69242
|
+
var Response2 = "http://www.w3.org/2007/ont/link#Response";
|
|
69109
69243
|
var Session4 = "http://www.w3.org/2007/ont/link#Session";
|
|
69110
69244
|
var isMentionedIn2 = "http://www.w3.org/2007/ont/link#isMentionedIn";
|
|
69111
69245
|
var mentionsClass2 = "http://www.w3.org/2007/ont/link#mentionsClass";
|
|
@@ -69125,7 +69259,7 @@ var PodOS = (() => {
|
|
|
69125
69259
|
Mailbox: Mailbox2,
|
|
69126
69260
|
ProtocolEvent: ProtocolEvent2,
|
|
69127
69261
|
RDFDocument: RDFDocument2,
|
|
69128
|
-
Response:
|
|
69262
|
+
Response: Response2,
|
|
69129
69263
|
Session: Session4,
|
|
69130
69264
|
isMentionedIn: isMentionedIn2,
|
|
69131
69265
|
mentionsClass: mentionsClass2,
|
|
@@ -69147,7 +69281,7 @@ var PodOS = (() => {
|
|
|
69147
69281
|
var Mailbox3 = "http://www.w3.org/2007/ont/link#Mailbox";
|
|
69148
69282
|
var ProtocolEvent3 = "http://www.w3.org/2007/ont/link#ProtocolEvent";
|
|
69149
69283
|
var RDFDocument3 = "http://www.w3.org/2007/ont/link#RDFDocument";
|
|
69150
|
-
var
|
|
69284
|
+
var Response3 = "http://www.w3.org/2007/ont/link#Response";
|
|
69151
69285
|
var Session5 = "http://www.w3.org/2007/ont/link#Session";
|
|
69152
69286
|
var isMentionedIn3 = "http://www.w3.org/2007/ont/link#isMentionedIn";
|
|
69153
69287
|
var mentionsClass3 = "http://www.w3.org/2007/ont/link#mentionsClass";
|
|
@@ -69167,7 +69301,7 @@ var PodOS = (() => {
|
|
|
69167
69301
|
Mailbox: Mailbox3,
|
|
69168
69302
|
ProtocolEvent: ProtocolEvent3,
|
|
69169
69303
|
RDFDocument: RDFDocument3,
|
|
69170
|
-
Response:
|
|
69304
|
+
Response: Response3,
|
|
69171
69305
|
Session: Session5,
|
|
69172
69306
|
isMentionedIn: isMentionedIn3,
|
|
69173
69307
|
mentionsClass: mentionsClass3,
|