@pod-os/core 0.12.1-7d2693a.0 → 0.12.1-b3f906d.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 +405 -539
- package/lib/index.js +428 -562
- package/package.json +6 -6
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 EventEmitter3() {
|
|
64
|
+
EventEmitter3.init.call(this);
|
|
65
65
|
}
|
|
66
|
-
module3.exports =
|
|
66
|
+
module3.exports = EventEmitter3;
|
|
67
67
|
module3.exports.once = once;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
EventEmitter3.EventEmitter = EventEmitter3;
|
|
69
|
+
EventEmitter3.prototype._events = void 0;
|
|
70
|
+
EventEmitter3.prototype._eventsCount = 0;
|
|
71
|
+
EventEmitter3.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(EventEmitter3, "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
|
+
EventEmitter3.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
|
+
EventEmitter3.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 EventEmitter3.defaultMaxListeners;
|
|
107
107
|
return that._maxListeners;
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
EventEmitter3.prototype.getMaxListeners = function getMaxListeners() {
|
|
110
110
|
return _getMaxListeners(this);
|
|
111
111
|
};
|
|
112
|
-
|
|
112
|
+
EventEmitter3.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
|
+
EventEmitter3.prototype.addListener = function addListener(type5, listener) {
|
|
190
190
|
return _addListener(this, type5, listener, false);
|
|
191
191
|
};
|
|
192
|
-
|
|
193
|
-
|
|
192
|
+
EventEmitter3.prototype.on = EventEmitter3.prototype.addListener;
|
|
193
|
+
EventEmitter3.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
|
+
EventEmitter3.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
|
+
EventEmitter3.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
|
+
EventEmitter3.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
|
+
EventEmitter3.prototype.off = EventEmitter3.prototype.removeListener;
|
|
263
|
+
EventEmitter3.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
|
+
EventEmitter3.prototype.listeners = function listeners(type5) {
|
|
315
315
|
return _listeners(this, type5, true);
|
|
316
316
|
};
|
|
317
|
-
|
|
317
|
+
EventEmitter3.prototype.rawListeners = function rawListeners(type5) {
|
|
318
318
|
return _listeners(this, type5, false);
|
|
319
319
|
};
|
|
320
|
-
|
|
320
|
+
EventEmitter3.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
|
+
EventEmitter3.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
|
+
EventEmitter3.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 Request2(input2, options) {
|
|
37971
37971
|
options = options || {};
|
|
37972
37972
|
var body = options.body;
|
|
37973
|
-
if (input2 instanceof
|
|
37973
|
+
if (input2 instanceof Request2) {
|
|
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
|
+
Request2.prototype.clone = function() {
|
|
38006
|
+
return new Request2(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(Request2.prototype);
|
|
38034
|
+
function Response5(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(Response5.prototype);
|
|
38047
|
+
Response5.prototype.clone = function() {
|
|
38048
|
+
return new Response5(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
|
+
Response5.error = function() {
|
|
38056
|
+
var response6 = new Response5(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
|
+
Response5.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 Response5(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 fetch3(input2, init) {
|
|
38081
38081
|
return new Promise(function(resolve, reject2) {
|
|
38082
|
-
var request2 = new
|
|
38082
|
+
var request2 = new Request2(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 Response5(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
|
+
fetch3.polyfill = true;
|
|
38133
38133
|
if (!self2.fetch) {
|
|
38134
|
-
self2.fetch =
|
|
38134
|
+
self2.fetch = fetch3;
|
|
38135
38135
|
self2.Headers = Headers3;
|
|
38136
|
-
self2.Request =
|
|
38137
|
-
self2.Response =
|
|
38136
|
+
self2.Request = Request2;
|
|
38137
|
+
self2.Response = Response5;
|
|
38138
38138
|
}
|
|
38139
38139
|
exports2.Headers = Headers3;
|
|
38140
|
-
exports2.Request =
|
|
38141
|
-
exports2.Response =
|
|
38142
|
-
exports2.fetch =
|
|
38140
|
+
exports2.Request = Request2;
|
|
38141
|
+
exports2.Response = Response5;
|
|
38142
|
+
exports2.fetch = fetch3;
|
|
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 clone = /* @__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
|
+
clone[key3] = val.slice();
|
|
42377
42377
|
continue;
|
|
42378
42378
|
}
|
|
42379
42379
|
if (typeof val === "string" || typeof val === "number" || typeof val === "boolean") {
|
|
42380
|
-
|
|
42380
|
+
clone[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 clone;
|
|
42386
42386
|
};
|
|
42387
42387
|
lunr2.FieldRef = function(docRef, fieldName, stringValue) {
|
|
42388
42388
|
this.docRef = docRef;
|
|
@@ -45763,11 +45763,18 @@ var PodOS = (() => {
|
|
|
45763
45763
|
}) : identity;
|
|
45764
45764
|
}
|
|
45765
45765
|
|
|
45766
|
-
// ../node_modules/@inrupt/solid-client-authn-core/
|
|
45766
|
+
// ../node_modules/@inrupt/solid-client-authn-core/dist/index.mjs
|
|
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
|
|
45767
45774
|
var webcrypto_default = crypto;
|
|
45768
45775
|
var isCryptoKey = (key3) => key3 instanceof CryptoKey;
|
|
45769
45776
|
|
|
45770
|
-
// ../node_modules
|
|
45777
|
+
// ../node_modules/jose/dist/browser/lib/buffer_utils.js
|
|
45771
45778
|
var encoder = new TextEncoder();
|
|
45772
45779
|
var decoder = new TextDecoder();
|
|
45773
45780
|
var MAX_INT32 = 2 ** 32;
|
|
@@ -45775,14 +45782,14 @@ var PodOS = (() => {
|
|
|
45775
45782
|
const size4 = buffers.reduce((acc, { length: length2 }) => acc + length2, 0);
|
|
45776
45783
|
const buf = new Uint8Array(size4);
|
|
45777
45784
|
let i = 0;
|
|
45778
|
-
|
|
45785
|
+
buffers.forEach((buffer) => {
|
|
45779
45786
|
buf.set(buffer, i);
|
|
45780
45787
|
i += buffer.length;
|
|
45781
|
-
}
|
|
45788
|
+
});
|
|
45782
45789
|
return buf;
|
|
45783
45790
|
}
|
|
45784
45791
|
|
|
45785
|
-
// ../node_modules
|
|
45792
|
+
// ../node_modules/jose/dist/browser/runtime/base64url.js
|
|
45786
45793
|
var encodeBase64 = (input2) => {
|
|
45787
45794
|
let unencoded = input2;
|
|
45788
45795
|
if (typeof unencoded === "string") {
|
|
@@ -45814,21 +45821,22 @@ var PodOS = (() => {
|
|
|
45814
45821
|
encoded = encoded.replace(/-/g, "+").replace(/_/g, "/").replace(/\s/g, "");
|
|
45815
45822
|
try {
|
|
45816
45823
|
return decodeBase64(encoded);
|
|
45817
|
-
} catch {
|
|
45824
|
+
} catch (_a) {
|
|
45818
45825
|
throw new TypeError("The input to be decoded is not correctly encoded.");
|
|
45819
45826
|
}
|
|
45820
45827
|
};
|
|
45821
45828
|
|
|
45822
|
-
// ../node_modules
|
|
45829
|
+
// ../node_modules/jose/dist/browser/util/errors.js
|
|
45823
45830
|
var JOSEError = class extends Error {
|
|
45824
45831
|
static get code() {
|
|
45825
45832
|
return "ERR_JOSE_GENERIC";
|
|
45826
45833
|
}
|
|
45827
45834
|
constructor(message4) {
|
|
45835
|
+
var _a;
|
|
45828
45836
|
super(message4);
|
|
45829
45837
|
this.code = "ERR_JOSE_GENERIC";
|
|
45830
45838
|
this.name = this.constructor.name;
|
|
45831
|
-
Error.captureStackTrace
|
|
45839
|
+
(_a = Error.captureStackTrace) === null || _a === void 0 ? void 0 : _a.call(Error, this, this.constructor);
|
|
45832
45840
|
}
|
|
45833
45841
|
};
|
|
45834
45842
|
var JWTClaimValidationFailed = class extends JOSEError {
|
|
@@ -45889,45 +45897,6 @@ var PodOS = (() => {
|
|
|
45889
45897
|
return "ERR_JWT_INVALID";
|
|
45890
45898
|
}
|
|
45891
45899
|
};
|
|
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
|
-
};
|
|
45931
45900
|
var JWSSignatureVerificationFailed = class extends JOSEError {
|
|
45932
45901
|
constructor() {
|
|
45933
45902
|
super(...arguments);
|
|
@@ -45939,10 +45908,10 @@ var PodOS = (() => {
|
|
|
45939
45908
|
}
|
|
45940
45909
|
};
|
|
45941
45910
|
|
|
45942
|
-
// ../node_modules
|
|
45911
|
+
// ../node_modules/jose/dist/browser/runtime/random.js
|
|
45943
45912
|
var random_default = webcrypto_default.getRandomValues.bind(webcrypto_default);
|
|
45944
45913
|
|
|
45945
|
-
// ../node_modules
|
|
45914
|
+
// ../node_modules/jose/dist/browser/lib/crypto_key.js
|
|
45946
45915
|
function unusable(name7, prop = "algorithm.name") {
|
|
45947
45916
|
return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name7}`);
|
|
45948
45917
|
}
|
|
@@ -46036,7 +46005,7 @@ var PodOS = (() => {
|
|
|
46036
46005
|
checkUsage(key3, usages);
|
|
46037
46006
|
}
|
|
46038
46007
|
|
|
46039
|
-
// ../node_modules
|
|
46008
|
+
// ../node_modules/jose/dist/browser/lib/invalid_key_input.js
|
|
46040
46009
|
function message(msg2, actual2, ...types2) {
|
|
46041
46010
|
if (types2.length > 2) {
|
|
46042
46011
|
const last3 = types2.pop();
|
|
@@ -46051,7 +46020,7 @@ var PodOS = (() => {
|
|
|
46051
46020
|
} else if (typeof actual2 === "function" && actual2.name) {
|
|
46052
46021
|
msg2 += ` Received function ${actual2.name}`;
|
|
46053
46022
|
} else if (typeof actual2 === "object" && actual2 != null) {
|
|
46054
|
-
if (actual2.constructor
|
|
46023
|
+
if (actual2.constructor && actual2.constructor.name) {
|
|
46055
46024
|
msg2 += ` Received an instance of ${actual2.constructor.name}`;
|
|
46056
46025
|
}
|
|
46057
46026
|
}
|
|
@@ -46064,13 +46033,13 @@ var PodOS = (() => {
|
|
|
46064
46033
|
return message(`Key for the ${alg} algorithm must be `, actual2, ...types2);
|
|
46065
46034
|
}
|
|
46066
46035
|
|
|
46067
|
-
// ../node_modules
|
|
46036
|
+
// ../node_modules/jose/dist/browser/runtime/is_key_like.js
|
|
46068
46037
|
var is_key_like_default = (key3) => {
|
|
46069
46038
|
return isCryptoKey(key3);
|
|
46070
46039
|
};
|
|
46071
46040
|
var types = ["CryptoKey"];
|
|
46072
46041
|
|
|
46073
|
-
// ../node_modules
|
|
46042
|
+
// ../node_modules/jose/dist/browser/lib/is_disjoint.js
|
|
46074
46043
|
var isDisjoint = (...headers) => {
|
|
46075
46044
|
const sources = headers.filter(Boolean);
|
|
46076
46045
|
if (sources.length === 0 || sources.length === 1) {
|
|
@@ -46094,7 +46063,7 @@ var PodOS = (() => {
|
|
|
46094
46063
|
};
|
|
46095
46064
|
var is_disjoint_default = isDisjoint;
|
|
46096
46065
|
|
|
46097
|
-
// ../node_modules
|
|
46066
|
+
// ../node_modules/jose/dist/browser/lib/is_object.js
|
|
46098
46067
|
function isObjectLike(value6) {
|
|
46099
46068
|
return typeof value6 === "object" && value6 !== null;
|
|
46100
46069
|
}
|
|
@@ -46112,7 +46081,7 @@ var PodOS = (() => {
|
|
|
46112
46081
|
return Object.getPrototypeOf(input2) === proto;
|
|
46113
46082
|
}
|
|
46114
46083
|
|
|
46115
|
-
// ../node_modules
|
|
46084
|
+
// ../node_modules/jose/dist/browser/runtime/check_key_length.js
|
|
46116
46085
|
var check_key_length_default = (alg, key3) => {
|
|
46117
46086
|
if (alg.startsWith("RS") || alg.startsWith("PS")) {
|
|
46118
46087
|
const { modulusLength } = key3.algorithm;
|
|
@@ -46122,11 +46091,49 @@ var PodOS = (() => {
|
|
|
46122
46091
|
}
|
|
46123
46092
|
};
|
|
46124
46093
|
|
|
46125
|
-
// ../node_modules
|
|
46094
|
+
// ../node_modules/jose/dist/browser/runtime/jwk_to_key.js
|
|
46126
46095
|
function subtleMapping(jwk) {
|
|
46127
46096
|
let algorithm3;
|
|
46128
46097
|
let keyUsages;
|
|
46129
46098
|
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
|
+
}
|
|
46130
46137
|
case "RSA": {
|
|
46131
46138
|
switch (jwk.alg) {
|
|
46132
46139
|
case "PS256":
|
|
@@ -46206,15 +46213,19 @@ var PodOS = (() => {
|
|
|
46206
46213
|
return { algorithm: algorithm3, keyUsages };
|
|
46207
46214
|
}
|
|
46208
46215
|
var parse = async (jwk) => {
|
|
46216
|
+
var _a, _b;
|
|
46209
46217
|
if (!jwk.alg) {
|
|
46210
46218
|
throw new TypeError('"alg" argument is required when "jwk.alg" is not present');
|
|
46211
46219
|
}
|
|
46212
46220
|
const { algorithm: algorithm3, keyUsages } = subtleMapping(jwk);
|
|
46213
46221
|
const rest3 = [
|
|
46214
46222
|
algorithm3,
|
|
46215
|
-
jwk.ext
|
|
46216
|
-
jwk.key_ops
|
|
46223
|
+
(_a = jwk.ext) !== null && _a !== void 0 ? _a : false,
|
|
46224
|
+
(_b = jwk.key_ops) !== null && _b !== void 0 ? _b : keyUsages
|
|
46217
46225
|
];
|
|
46226
|
+
if (algorithm3.name === "PBKDF2") {
|
|
46227
|
+
return webcrypto_default.subtle.importKey("raw", decode(jwk.k), ...rest3);
|
|
46228
|
+
}
|
|
46218
46229
|
const keyData = { ...jwk };
|
|
46219
46230
|
delete keyData.alg;
|
|
46220
46231
|
delete keyData.use;
|
|
@@ -46222,8 +46233,9 @@ var PodOS = (() => {
|
|
|
46222
46233
|
};
|
|
46223
46234
|
var jwk_to_key_default = parse;
|
|
46224
46235
|
|
|
46225
|
-
// ../node_modules
|
|
46226
|
-
async function importJWK(jwk, alg) {
|
|
46236
|
+
// ../node_modules/jose/dist/browser/key/import.js
|
|
46237
|
+
async function importJWK(jwk, alg, octAsKeyObject) {
|
|
46238
|
+
var _a;
|
|
46227
46239
|
if (!isObject(jwk)) {
|
|
46228
46240
|
throw new TypeError("JWK must be an object");
|
|
46229
46241
|
}
|
|
@@ -46233,6 +46245,10 @@ var PodOS = (() => {
|
|
|
46233
46245
|
if (typeof jwk.k !== "string" || !jwk.k) {
|
|
46234
46246
|
throw new TypeError('missing "k" (Key Value) Parameter value');
|
|
46235
46247
|
}
|
|
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
|
+
}
|
|
46236
46252
|
return decode(jwk.k);
|
|
46237
46253
|
case "RSA":
|
|
46238
46254
|
if (jwk.oth !== void 0) {
|
|
@@ -46246,7 +46262,7 @@ var PodOS = (() => {
|
|
|
46246
46262
|
}
|
|
46247
46263
|
}
|
|
46248
46264
|
|
|
46249
|
-
// ../node_modules
|
|
46265
|
+
// ../node_modules/jose/dist/browser/lib/check_key_type.js
|
|
46250
46266
|
var symmetricTypeCheck = (alg, key3) => {
|
|
46251
46267
|
if (key3 instanceof Uint8Array)
|
|
46252
46268
|
return;
|
|
@@ -46287,9 +46303,9 @@ var PodOS = (() => {
|
|
|
46287
46303
|
};
|
|
46288
46304
|
var check_key_type_default = checkKeyType;
|
|
46289
46305
|
|
|
46290
|
-
// ../node_modules
|
|
46306
|
+
// ../node_modules/jose/dist/browser/lib/validate_crit.js
|
|
46291
46307
|
function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
|
|
46292
|
-
if (joseHeader.crit !== void 0 && protectedHeader
|
|
46308
|
+
if (joseHeader.crit !== void 0 && protectedHeader.crit === void 0) {
|
|
46293
46309
|
throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
|
|
46294
46310
|
}
|
|
46295
46311
|
if (!protectedHeader || protectedHeader.crit === void 0) {
|
|
@@ -46310,8 +46326,7 @@ var PodOS = (() => {
|
|
|
46310
46326
|
}
|
|
46311
46327
|
if (joseHeader[parameter2] === void 0) {
|
|
46312
46328
|
throw new Err(`Extension Header Parameter "${parameter2}" is missing`);
|
|
46313
|
-
}
|
|
46314
|
-
if (recognized.get(parameter2) && protectedHeader[parameter2] === void 0) {
|
|
46329
|
+
} else if (recognized.get(parameter2) && protectedHeader[parameter2] === void 0) {
|
|
46315
46330
|
throw new Err(`Extension Header Parameter "${parameter2}" MUST be integrity protected`);
|
|
46316
46331
|
}
|
|
46317
46332
|
}
|
|
@@ -46319,7 +46334,7 @@ var PodOS = (() => {
|
|
|
46319
46334
|
}
|
|
46320
46335
|
var validate_crit_default = validateCrit;
|
|
46321
46336
|
|
|
46322
|
-
// ../node_modules
|
|
46337
|
+
// ../node_modules/jose/dist/browser/lib/validate_algorithms.js
|
|
46323
46338
|
var validateAlgorithms = (option5, algorithms) => {
|
|
46324
46339
|
if (algorithms !== void 0 && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
|
|
46325
46340
|
throw new TypeError(`"${option5}" option must be an array of strings`);
|
|
@@ -46331,7 +46346,7 @@ var PodOS = (() => {
|
|
|
46331
46346
|
};
|
|
46332
46347
|
var validate_algorithms_default = validateAlgorithms;
|
|
46333
46348
|
|
|
46334
|
-
// ../node_modules
|
|
46349
|
+
// ../node_modules/jose/dist/browser/runtime/key_to_jwk.js
|
|
46335
46350
|
var keyToJWK = async (key3) => {
|
|
46336
46351
|
if (key3 instanceof Uint8Array) {
|
|
46337
46352
|
return {
|
|
@@ -46350,15 +46365,15 @@ var PodOS = (() => {
|
|
|
46350
46365
|
};
|
|
46351
46366
|
var key_to_jwk_default = keyToJWK;
|
|
46352
46367
|
|
|
46353
|
-
// ../node_modules
|
|
46368
|
+
// ../node_modules/jose/dist/browser/key/export.js
|
|
46354
46369
|
async function exportJWK(key3) {
|
|
46355
46370
|
return key_to_jwk_default(key3);
|
|
46356
46371
|
}
|
|
46357
46372
|
|
|
46358
|
-
// ../node_modules
|
|
46373
|
+
// ../node_modules/jose/dist/browser/jwe/flattened/encrypt.js
|
|
46359
46374
|
var unprotected = Symbol();
|
|
46360
46375
|
|
|
46361
|
-
// ../node_modules
|
|
46376
|
+
// ../node_modules/jose/dist/browser/runtime/subtle_dsa.js
|
|
46362
46377
|
function subtleDsa(alg, algorithm3) {
|
|
46363
46378
|
const hash2 = `SHA-${alg.slice(-3)}`;
|
|
46364
46379
|
switch (alg) {
|
|
@@ -46385,7 +46400,7 @@ var PodOS = (() => {
|
|
|
46385
46400
|
}
|
|
46386
46401
|
}
|
|
46387
46402
|
|
|
46388
|
-
// ../node_modules
|
|
46403
|
+
// ../node_modules/jose/dist/browser/runtime/get_sign_verify_key.js
|
|
46389
46404
|
function getCryptoKey(alg, key3, usage2) {
|
|
46390
46405
|
if (isCryptoKey(key3)) {
|
|
46391
46406
|
checkSigCryptoKey(key3, alg, usage2);
|
|
@@ -46400,21 +46415,22 @@ var PodOS = (() => {
|
|
|
46400
46415
|
throw new TypeError(invalid_key_input_default(key3, ...types, "Uint8Array"));
|
|
46401
46416
|
}
|
|
46402
46417
|
|
|
46403
|
-
// ../node_modules
|
|
46418
|
+
// ../node_modules/jose/dist/browser/runtime/verify.js
|
|
46404
46419
|
var verify = async (alg, key3, signature2, data2) => {
|
|
46405
46420
|
const cryptoKey = await getCryptoKey(alg, key3, "verify");
|
|
46406
46421
|
check_key_length_default(alg, cryptoKey);
|
|
46407
46422
|
const algorithm3 = subtleDsa(alg, cryptoKey.algorithm);
|
|
46408
46423
|
try {
|
|
46409
46424
|
return await webcrypto_default.subtle.verify(algorithm3, cryptoKey, signature2, data2);
|
|
46410
|
-
} catch {
|
|
46425
|
+
} catch (_a) {
|
|
46411
46426
|
return false;
|
|
46412
46427
|
}
|
|
46413
46428
|
};
|
|
46414
46429
|
var verify_default = verify;
|
|
46415
46430
|
|
|
46416
|
-
// ../node_modules
|
|
46431
|
+
// ../node_modules/jose/dist/browser/jws/flattened/verify.js
|
|
46417
46432
|
async function flattenedVerify(jws2, key3, options) {
|
|
46433
|
+
var _a;
|
|
46418
46434
|
if (!isObject(jws2)) {
|
|
46419
46435
|
throw new JWSInvalid("Flattened JWS must be an object");
|
|
46420
46436
|
}
|
|
@@ -46438,7 +46454,7 @@ var PodOS = (() => {
|
|
|
46438
46454
|
try {
|
|
46439
46455
|
const protectedHeader = decode(jws2.protected);
|
|
46440
46456
|
parsedProt = JSON.parse(decoder.decode(protectedHeader));
|
|
46441
|
-
} catch {
|
|
46457
|
+
} catch (_b) {
|
|
46442
46458
|
throw new JWSInvalid("JWS Protected Header is invalid");
|
|
46443
46459
|
}
|
|
46444
46460
|
}
|
|
@@ -46449,7 +46465,7 @@ var PodOS = (() => {
|
|
|
46449
46465
|
...parsedProt,
|
|
46450
46466
|
...jws2.header
|
|
46451
46467
|
};
|
|
46452
|
-
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options
|
|
46468
|
+
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options === null || options === void 0 ? void 0 : options.crit, parsedProt, joseHeader);
|
|
46453
46469
|
let b64 = true;
|
|
46454
46470
|
if (extensions.has("b64")) {
|
|
46455
46471
|
b64 = parsedProt.b64;
|
|
@@ -46463,7 +46479,7 @@ var PodOS = (() => {
|
|
|
46463
46479
|
}
|
|
46464
46480
|
const algorithms = options && validate_algorithms_default("algorithms", options.algorithms);
|
|
46465
46481
|
if (algorithms && !algorithms.has(alg)) {
|
|
46466
|
-
throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter
|
|
46482
|
+
throw new JOSEAlgNotAllowed('"alg" (Algorithm) Header Parameter not allowed');
|
|
46467
46483
|
}
|
|
46468
46484
|
if (b64) {
|
|
46469
46485
|
if (typeof jws2.payload !== "string") {
|
|
@@ -46478,11 +46494,11 @@ var PodOS = (() => {
|
|
|
46478
46494
|
resolvedKey = true;
|
|
46479
46495
|
}
|
|
46480
46496
|
check_key_type_default(alg, key3, "verify");
|
|
46481
|
-
const data2 = concat(encoder.encode(jws2.protected
|
|
46497
|
+
const data2 = concat(encoder.encode((_a = jws2.protected) !== null && _a !== void 0 ? _a : ""), encoder.encode("."), typeof jws2.payload === "string" ? encoder.encode(jws2.payload) : jws2.payload);
|
|
46482
46498
|
let signature2;
|
|
46483
46499
|
try {
|
|
46484
46500
|
signature2 = decode(jws2.signature);
|
|
46485
|
-
} catch {
|
|
46501
|
+
} catch (_c) {
|
|
46486
46502
|
throw new JWSInvalid("Failed to base64url decode the signature");
|
|
46487
46503
|
}
|
|
46488
46504
|
const verified2 = await verify_default(alg, key3, signature2, data2);
|
|
@@ -46493,7 +46509,7 @@ var PodOS = (() => {
|
|
|
46493
46509
|
if (b64) {
|
|
46494
46510
|
try {
|
|
46495
46511
|
payload4 = decode(jws2.payload);
|
|
46496
|
-
} catch {
|
|
46512
|
+
} catch (_d) {
|
|
46497
46513
|
throw new JWSInvalid("Failed to base64url decode the payload");
|
|
46498
46514
|
}
|
|
46499
46515
|
} else if (typeof jws2.payload === "string") {
|
|
@@ -46514,7 +46530,7 @@ var PodOS = (() => {
|
|
|
46514
46530
|
return result5;
|
|
46515
46531
|
}
|
|
46516
46532
|
|
|
46517
|
-
// ../node_modules
|
|
46533
|
+
// ../node_modules/jose/dist/browser/jws/compact/verify.js
|
|
46518
46534
|
async function compactVerify(jws2, key3, options) {
|
|
46519
46535
|
if (jws2 instanceof Uint8Array) {
|
|
46520
46536
|
jws2 = decoder.decode(jws2);
|
|
@@ -46534,67 +46550,56 @@ var PodOS = (() => {
|
|
|
46534
46550
|
return result5;
|
|
46535
46551
|
}
|
|
46536
46552
|
|
|
46537
|
-
// ../node_modules
|
|
46553
|
+
// ../node_modules/jose/dist/browser/lib/epoch.js
|
|
46538
46554
|
var epoch_default = (date5) => Math.floor(date5.getTime() / 1e3);
|
|
46539
46555
|
|
|
46540
|
-
// ../node_modules
|
|
46556
|
+
// ../node_modules/jose/dist/browser/lib/secs.js
|
|
46541
46557
|
var minute = 60;
|
|
46542
46558
|
var hour = minute * 60;
|
|
46543
46559
|
var day = hour * 24;
|
|
46544
46560
|
var week = day * 7;
|
|
46545
46561
|
var year = day * 365.25;
|
|
46546
|
-
var REGEX = /^(
|
|
46562
|
+
var REGEX = /^(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)$/i;
|
|
46547
46563
|
var secs_default = (str) => {
|
|
46548
46564
|
const matched = REGEX.exec(str);
|
|
46549
|
-
if (!matched
|
|
46565
|
+
if (!matched) {
|
|
46550
46566
|
throw new TypeError("Invalid time period format");
|
|
46551
46567
|
}
|
|
46552
|
-
const value6 = parseFloat(matched[
|
|
46553
|
-
const unit2 = matched[
|
|
46554
|
-
let numericDate;
|
|
46568
|
+
const value6 = parseFloat(matched[1]);
|
|
46569
|
+
const unit2 = matched[2].toLowerCase();
|
|
46555
46570
|
switch (unit2) {
|
|
46556
46571
|
case "sec":
|
|
46557
46572
|
case "secs":
|
|
46558
46573
|
case "second":
|
|
46559
46574
|
case "seconds":
|
|
46560
46575
|
case "s":
|
|
46561
|
-
|
|
46562
|
-
break;
|
|
46576
|
+
return Math.round(value6);
|
|
46563
46577
|
case "minute":
|
|
46564
46578
|
case "minutes":
|
|
46565
46579
|
case "min":
|
|
46566
46580
|
case "mins":
|
|
46567
46581
|
case "m":
|
|
46568
|
-
|
|
46569
|
-
break;
|
|
46582
|
+
return Math.round(value6 * minute);
|
|
46570
46583
|
case "hour":
|
|
46571
46584
|
case "hours":
|
|
46572
46585
|
case "hr":
|
|
46573
46586
|
case "hrs":
|
|
46574
46587
|
case "h":
|
|
46575
|
-
|
|
46576
|
-
break;
|
|
46588
|
+
return Math.round(value6 * hour);
|
|
46577
46589
|
case "day":
|
|
46578
46590
|
case "days":
|
|
46579
46591
|
case "d":
|
|
46580
|
-
|
|
46581
|
-
break;
|
|
46592
|
+
return Math.round(value6 * day);
|
|
46582
46593
|
case "week":
|
|
46583
46594
|
case "weeks":
|
|
46584
46595
|
case "w":
|
|
46585
|
-
|
|
46586
|
-
break;
|
|
46596
|
+
return Math.round(value6 * week);
|
|
46587
46597
|
default:
|
|
46588
|
-
|
|
46589
|
-
break;
|
|
46598
|
+
return Math.round(value6 * year);
|
|
46590
46599
|
}
|
|
46591
|
-
if (matched[1] === "-" || matched[4] === "ago") {
|
|
46592
|
-
return -numericDate;
|
|
46593
|
-
}
|
|
46594
|
-
return numericDate;
|
|
46595
46600
|
};
|
|
46596
46601
|
|
|
46597
|
-
// ../node_modules
|
|
46602
|
+
// ../node_modules/jose/dist/browser/lib/jwt_claims_set.js
|
|
46598
46603
|
var normalizeTyp = (value6) => value6.toLowerCase().replace(/^application\//, "");
|
|
46599
46604
|
var checkAudiencePresence = (audPayload, audOption) => {
|
|
46600
46605
|
if (typeof audPayload === "string") {
|
|
@@ -46613,22 +46618,21 @@ var PodOS = (() => {
|
|
|
46613
46618
|
let payload4;
|
|
46614
46619
|
try {
|
|
46615
46620
|
payload4 = JSON.parse(decoder.decode(encodedPayload));
|
|
46616
|
-
} catch {
|
|
46621
|
+
} catch (_a) {
|
|
46617
46622
|
}
|
|
46618
46623
|
if (!isObject(payload4)) {
|
|
46619
46624
|
throw new JWTInvalid("JWT Claims Set must be a top-level JSON object");
|
|
46620
46625
|
}
|
|
46621
46626
|
const { requiredClaims = [], issuer: issuer2, subject: subject5, audience: audience5, maxTokenAge } = options;
|
|
46622
|
-
const presenceCheck = [...requiredClaims];
|
|
46623
46627
|
if (maxTokenAge !== void 0)
|
|
46624
|
-
|
|
46628
|
+
requiredClaims.push("iat");
|
|
46625
46629
|
if (audience5 !== void 0)
|
|
46626
|
-
|
|
46630
|
+
requiredClaims.push("aud");
|
|
46627
46631
|
if (subject5 !== void 0)
|
|
46628
|
-
|
|
46632
|
+
requiredClaims.push("sub");
|
|
46629
46633
|
if (issuer2 !== void 0)
|
|
46630
|
-
|
|
46631
|
-
for (const claim2 of new Set(
|
|
46634
|
+
requiredClaims.push("iss");
|
|
46635
|
+
for (const claim2 of new Set(requiredClaims.reverse())) {
|
|
46632
46636
|
if (!(claim2 in payload4)) {
|
|
46633
46637
|
throw new JWTClaimValidationFailed(`missing required "${claim2}" claim`, claim2, "missing");
|
|
46634
46638
|
}
|
|
@@ -46690,10 +46694,11 @@ var PodOS = (() => {
|
|
|
46690
46694
|
return payload4;
|
|
46691
46695
|
};
|
|
46692
46696
|
|
|
46693
|
-
// ../node_modules
|
|
46697
|
+
// ../node_modules/jose/dist/browser/jwt/verify.js
|
|
46694
46698
|
async function jwtVerify(jwt, key3, options) {
|
|
46699
|
+
var _a;
|
|
46695
46700
|
const verified2 = await compactVerify(jwt, key3, options);
|
|
46696
|
-
if (verified2.protectedHeader.crit
|
|
46701
|
+
if (((_a = verified2.protectedHeader.crit) === null || _a === void 0 ? void 0 : _a.includes("b64")) && verified2.protectedHeader.b64 === false) {
|
|
46697
46702
|
throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
|
|
46698
46703
|
}
|
|
46699
46704
|
const payload4 = jwt_claims_set_default(verified2.protectedHeader, verified2.payload, options);
|
|
@@ -46704,7 +46709,7 @@ var PodOS = (() => {
|
|
|
46704
46709
|
return result5;
|
|
46705
46710
|
}
|
|
46706
46711
|
|
|
46707
|
-
// ../node_modules
|
|
46712
|
+
// ../node_modules/jose/dist/browser/runtime/sign.js
|
|
46708
46713
|
var sign = async (alg, key3, data2) => {
|
|
46709
46714
|
const cryptoKey = await getCryptoKey(alg, key3, "sign");
|
|
46710
46715
|
check_key_length_default(alg, cryptoKey);
|
|
@@ -46713,7 +46718,7 @@ var PodOS = (() => {
|
|
|
46713
46718
|
};
|
|
46714
46719
|
var sign_default = sign;
|
|
46715
46720
|
|
|
46716
|
-
// ../node_modules
|
|
46721
|
+
// ../node_modules/jose/dist/browser/jws/flattened/sign.js
|
|
46717
46722
|
var FlattenedSign = class {
|
|
46718
46723
|
constructor(payload4) {
|
|
46719
46724
|
if (!(payload4 instanceof Uint8Array)) {
|
|
@@ -46746,7 +46751,7 @@ var PodOS = (() => {
|
|
|
46746
46751
|
...this._protectedHeader,
|
|
46747
46752
|
...this._unprotectedHeader
|
|
46748
46753
|
};
|
|
46749
|
-
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options
|
|
46754
|
+
const extensions = validate_crit_default(JWSInvalid, /* @__PURE__ */ new Map([["b64", true]]), options === null || options === void 0 ? void 0 : options.crit, this._protectedHeader, joseHeader);
|
|
46750
46755
|
let b64 = true;
|
|
46751
46756
|
if (extensions.has("b64")) {
|
|
46752
46757
|
b64 = this._protectedHeader.b64;
|
|
@@ -46788,7 +46793,7 @@ var PodOS = (() => {
|
|
|
46788
46793
|
}
|
|
46789
46794
|
};
|
|
46790
46795
|
|
|
46791
|
-
// ../node_modules
|
|
46796
|
+
// ../node_modules/jose/dist/browser/jws/compact/sign.js
|
|
46792
46797
|
var CompactSign = class {
|
|
46793
46798
|
constructor(payload4) {
|
|
46794
46799
|
this._flattened = new FlattenedSign(payload4);
|
|
@@ -46806,15 +46811,9 @@ var PodOS = (() => {
|
|
|
46806
46811
|
}
|
|
46807
46812
|
};
|
|
46808
46813
|
|
|
46809
|
-
// ../node_modules
|
|
46810
|
-
function validateInput(label4, input2) {
|
|
46811
|
-
if (!Number.isFinite(input2)) {
|
|
46812
|
-
throw new TypeError(`Invalid ${label4} input`);
|
|
46813
|
-
}
|
|
46814
|
-
return input2;
|
|
46815
|
-
}
|
|
46814
|
+
// ../node_modules/jose/dist/browser/jwt/produce.js
|
|
46816
46815
|
var ProduceJWT = class {
|
|
46817
|
-
constructor(payload4
|
|
46816
|
+
constructor(payload4) {
|
|
46818
46817
|
if (!isObject(payload4)) {
|
|
46819
46818
|
throw new TypeError("JWT Claims Set MUST be an object");
|
|
46820
46819
|
}
|
|
@@ -46838,9 +46837,7 @@ var PodOS = (() => {
|
|
|
46838
46837
|
}
|
|
46839
46838
|
setNotBefore(input2) {
|
|
46840
46839
|
if (typeof input2 === "number") {
|
|
46841
|
-
this._payload = { ...this._payload, nbf:
|
|
46842
|
-
} else if (input2 instanceof Date) {
|
|
46843
|
-
this._payload = { ...this._payload, nbf: validateInput("setNotBefore", epoch_default(input2)) };
|
|
46840
|
+
this._payload = { ...this._payload, nbf: input2 };
|
|
46844
46841
|
} else {
|
|
46845
46842
|
this._payload = { ...this._payload, nbf: epoch_default(/* @__PURE__ */ new Date()) + secs_default(input2) };
|
|
46846
46843
|
}
|
|
@@ -46848,9 +46845,7 @@ var PodOS = (() => {
|
|
|
46848
46845
|
}
|
|
46849
46846
|
setExpirationTime(input2) {
|
|
46850
46847
|
if (typeof input2 === "number") {
|
|
46851
|
-
this._payload = { ...this._payload, exp:
|
|
46852
|
-
} else if (input2 instanceof Date) {
|
|
46853
|
-
this._payload = { ...this._payload, exp: validateInput("setExpirationTime", epoch_default(input2)) };
|
|
46848
|
+
this._payload = { ...this._payload, exp: input2 };
|
|
46854
46849
|
} else {
|
|
46855
46850
|
this._payload = { ...this._payload, exp: epoch_default(/* @__PURE__ */ new Date()) + secs_default(input2) };
|
|
46856
46851
|
}
|
|
@@ -46859,294 +46854,41 @@ var PodOS = (() => {
|
|
|
46859
46854
|
setIssuedAt(input2) {
|
|
46860
46855
|
if (typeof input2 === "undefined") {
|
|
46861
46856
|
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
|
-
};
|
|
46869
46857
|
} else {
|
|
46870
|
-
this._payload = { ...this._payload, iat:
|
|
46858
|
+
this._payload = { ...this._payload, iat: input2 };
|
|
46871
46859
|
}
|
|
46872
46860
|
return this;
|
|
46873
46861
|
}
|
|
46874
46862
|
};
|
|
46875
46863
|
|
|
46876
|
-
// ../node_modules
|
|
46864
|
+
// ../node_modules/jose/dist/browser/jwt/sign.js
|
|
46877
46865
|
var SignJWT = class extends ProduceJWT {
|
|
46878
46866
|
setProtectedHeader(protectedHeader) {
|
|
46879
46867
|
this._protectedHeader = protectedHeader;
|
|
46880
46868
|
return this;
|
|
46881
46869
|
}
|
|
46882
46870
|
async sign(key3, options) {
|
|
46871
|
+
var _a;
|
|
46883
46872
|
const sig = new CompactSign(encoder.encode(JSON.stringify(this._payload)));
|
|
46884
46873
|
sig.setProtectedHeader(this._protectedHeader);
|
|
46885
|
-
if (Array.isArray(this._protectedHeader
|
|
46874
|
+
if (Array.isArray((_a = this._protectedHeader) === null || _a === void 0 ? void 0 : _a.crit) && this._protectedHeader.crit.includes("b64") && this._protectedHeader.b64 === false) {
|
|
46886
46875
|
throw new JWTInvalid("JWTs MUST NOT use unencoded payload");
|
|
46887
46876
|
}
|
|
46888
46877
|
return sig.sign(key3, options);
|
|
46889
46878
|
}
|
|
46890
46879
|
};
|
|
46891
46880
|
|
|
46892
|
-
// ../node_modules
|
|
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
|
|
46881
|
+
// ../node_modules/jose/dist/browser/runtime/generate.js
|
|
47142
46882
|
function getModulusLengthOption(options) {
|
|
47143
|
-
|
|
46883
|
+
var _a;
|
|
46884
|
+
const modulusLength = (_a = options === null || options === void 0 ? void 0 : options.modulusLength) !== null && _a !== void 0 ? _a : 2048;
|
|
47144
46885
|
if (typeof modulusLength !== "number" || modulusLength < 2048) {
|
|
47145
46886
|
throw new JOSENotSupported("Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used");
|
|
47146
46887
|
}
|
|
47147
46888
|
return modulusLength;
|
|
47148
46889
|
}
|
|
47149
46890
|
async function generateKeyPair(alg, options) {
|
|
46891
|
+
var _a, _b, _c;
|
|
47150
46892
|
let algorithm3;
|
|
47151
46893
|
let keyUsages;
|
|
47152
46894
|
switch (alg) {
|
|
@@ -47196,9 +46938,9 @@ var PodOS = (() => {
|
|
|
47196
46938
|
algorithm3 = { name: "ECDSA", namedCurve: "P-521" };
|
|
47197
46939
|
keyUsages = ["sign", "verify"];
|
|
47198
46940
|
break;
|
|
47199
|
-
case "EdDSA":
|
|
46941
|
+
case "EdDSA":
|
|
47200
46942
|
keyUsages = ["sign", "verify"];
|
|
47201
|
-
const crv = options
|
|
46943
|
+
const crv = (_a = options === null || options === void 0 ? void 0 : options.crv) !== null && _a !== void 0 ? _a : "Ed25519";
|
|
47202
46944
|
switch (crv) {
|
|
47203
46945
|
case "Ed25519":
|
|
47204
46946
|
case "Ed448":
|
|
@@ -47208,23 +46950,22 @@ var PodOS = (() => {
|
|
|
47208
46950
|
throw new JOSENotSupported("Invalid or unsupported crv option provided");
|
|
47209
46951
|
}
|
|
47210
46952
|
break;
|
|
47211
|
-
}
|
|
47212
46953
|
case "ECDH-ES":
|
|
47213
46954
|
case "ECDH-ES+A128KW":
|
|
47214
46955
|
case "ECDH-ES+A192KW":
|
|
47215
46956
|
case "ECDH-ES+A256KW": {
|
|
47216
46957
|
keyUsages = ["deriveKey", "deriveBits"];
|
|
47217
|
-
const
|
|
47218
|
-
switch (
|
|
46958
|
+
const crv2 = (_b = options === null || options === void 0 ? void 0 : options.crv) !== null && _b !== void 0 ? _b : "P-256";
|
|
46959
|
+
switch (crv2) {
|
|
47219
46960
|
case "P-256":
|
|
47220
46961
|
case "P-384":
|
|
47221
46962
|
case "P-521": {
|
|
47222
|
-
algorithm3 = { name: "ECDH", namedCurve:
|
|
46963
|
+
algorithm3 = { name: "ECDH", namedCurve: crv2 };
|
|
47223
46964
|
break;
|
|
47224
46965
|
}
|
|
47225
46966
|
case "X25519":
|
|
47226
46967
|
case "X448":
|
|
47227
|
-
algorithm3 = { name:
|
|
46968
|
+
algorithm3 = { name: crv2 };
|
|
47228
46969
|
break;
|
|
47229
46970
|
default:
|
|
47230
46971
|
throw new JOSENotSupported("Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448");
|
|
@@ -47234,10 +46975,10 @@ var PodOS = (() => {
|
|
|
47234
46975
|
default:
|
|
47235
46976
|
throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
47236
46977
|
}
|
|
47237
|
-
return webcrypto_default.subtle.generateKey(algorithm3, options
|
|
46978
|
+
return webcrypto_default.subtle.generateKey(algorithm3, (_c = options === null || options === void 0 ? void 0 : options.extractable) !== null && _c !== void 0 ? _c : false, keyUsages);
|
|
47238
46979
|
}
|
|
47239
46980
|
|
|
47240
|
-
// ../node_modules
|
|
46981
|
+
// ../node_modules/jose/dist/browser/key/generate_key_pair.js
|
|
47241
46982
|
async function generateKeyPair2(alg, options) {
|
|
47242
46983
|
return generateKeyPair(alg, options);
|
|
47243
46984
|
}
|
|
@@ -47309,6 +47050,17 @@ var PodOS = (() => {
|
|
|
47309
47050
|
var SCOPE_OFFLINE = "offline_access";
|
|
47310
47051
|
var SCOPE_WEBID = "webid";
|
|
47311
47052
|
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
|
+
});
|
|
47312
47064
|
var AggregateHandler = class {
|
|
47313
47065
|
constructor(handleables) {
|
|
47314
47066
|
this.handleables = handleables;
|
|
@@ -47345,10 +47097,24 @@ var PodOS = (() => {
|
|
|
47345
47097
|
}).join(", ")}`);
|
|
47346
47098
|
}
|
|
47347
47099
|
};
|
|
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
|
+
}
|
|
47348
47113
|
async function getWebidFromTokenPayload(idToken, jwksIri, issuerIri, clientId) {
|
|
47114
|
+
const jwk = await fetchJwks(jwksIri, issuerIri);
|
|
47349
47115
|
let payload4;
|
|
47350
47116
|
try {
|
|
47351
|
-
const { payload: verifiedPayload } = await jwtVerify(idToken,
|
|
47117
|
+
const { payload: verifiedPayload } = await jwtVerify(idToken, await importJWK(jwk), {
|
|
47352
47118
|
issuer: issuerIri,
|
|
47353
47119
|
audience: clientId
|
|
47354
47120
|
});
|
|
@@ -47388,29 +47154,17 @@ var PodOS = (() => {
|
|
|
47388
47154
|
cleanedUpUrl.searchParams.delete("iss");
|
|
47389
47155
|
return cleanedUpUrl;
|
|
47390
47156
|
}
|
|
47391
|
-
function booleanWithFallback(value6, fallback) {
|
|
47392
|
-
if (typeof value6 === "boolean") {
|
|
47393
|
-
return Boolean(value6);
|
|
47394
|
-
}
|
|
47395
|
-
return Boolean(fallback);
|
|
47396
|
-
}
|
|
47397
47157
|
var AuthorizationCodeWithPkceOidcHandlerBase = class {
|
|
47398
47158
|
constructor(storageUtility, redirector) {
|
|
47399
47159
|
this.storageUtility = storageUtility;
|
|
47400
47160
|
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
|
-
};
|
|
47404
47161
|
this.storageUtility = storageUtility;
|
|
47405
47162
|
this.redirector = redirector;
|
|
47406
47163
|
}
|
|
47407
47164
|
async canHandle(oidcLoginOptions) {
|
|
47408
|
-
return
|
|
47165
|
+
return !!(oidcLoginOptions.issuerConfiguration.grantTypesSupported && oidcLoginOptions.issuerConfiguration.grantTypesSupported.indexOf("authorization_code") > -1);
|
|
47409
47166
|
}
|
|
47410
47167
|
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
|
-
}
|
|
47414
47168
|
await Promise.all([
|
|
47415
47169
|
// We use the OAuth 'state' value (which should be crypto-random) as
|
|
47416
47170
|
// the key in our storage to store our actual SessionID. We do this
|
|
@@ -47421,6 +47175,7 @@ var PodOS = (() => {
|
|
|
47421
47175
|
// that session ID can be any developer-specified value, and therefore
|
|
47422
47176
|
// may not be appropriate (since the OAuth 'state' value should really
|
|
47423
47177
|
// be an unguessable crypto-random value).
|
|
47178
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
47424
47179
|
this.storageUtility.setForUser(state2, {
|
|
47425
47180
|
sessionId: oidcLoginOptions.sessionId
|
|
47426
47181
|
}),
|
|
@@ -47429,12 +47184,12 @@ var PodOS = (() => {
|
|
|
47429
47184
|
// our session ID is unnecessary, but it provides a slightly cleaner
|
|
47430
47185
|
// separation of concerns.
|
|
47431
47186
|
this.storageUtility.setForUser(oidcLoginOptions.sessionId, {
|
|
47187
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
47432
47188
|
codeVerifier,
|
|
47433
47189
|
issuer: oidcLoginOptions.issuer.toString(),
|
|
47434
47190
|
// The redirect URL is read after redirect, so it must be stored now.
|
|
47435
47191
|
redirectUrl: oidcLoginOptions.redirectUrl,
|
|
47436
|
-
dpop:
|
|
47437
|
-
keepAlive: booleanWithFallback(oidcLoginOptions.keepAlive, true).toString()
|
|
47192
|
+
dpop: oidcLoginOptions.dpop ? "true" : "false"
|
|
47438
47193
|
})
|
|
47439
47194
|
]);
|
|
47440
47195
|
this.redirector.redirect(targetUrl3, {
|
|
@@ -47496,7 +47251,7 @@ var PodOS = (() => {
|
|
|
47496
47251
|
return {
|
|
47497
47252
|
isLoggedIn: false,
|
|
47498
47253
|
sessionId: v4_default(),
|
|
47499
|
-
fetch: (...args) =>
|
|
47254
|
+
fetch: (...args) => fetch2.call(globalThis, ...args)
|
|
47500
47255
|
};
|
|
47501
47256
|
}
|
|
47502
47257
|
async function clear(sessionId, storage2) {
|
|
@@ -47590,51 +47345,48 @@ var PodOS = (() => {
|
|
|
47590
47345
|
return supported.includes(signingAlg);
|
|
47591
47346
|
})) !== null && _a !== void 0 ? _a : null;
|
|
47592
47347
|
}
|
|
47593
|
-
function
|
|
47594
|
-
|
|
47595
|
-
|
|
47596
|
-
|
|
47597
|
-
|
|
47598
|
-
|
|
47599
|
-
|
|
47600
|
-
return
|
|
47348
|
+
function determineClientType(options, issuerConfig) {
|
|
47349
|
+
if (options.clientId !== void 0 && !isValidUrl(options.clientId)) {
|
|
47350
|
+
return "static";
|
|
47351
|
+
}
|
|
47352
|
+
if (issuerConfig.scopesSupported.includes("webid") && options.clientId !== void 0 && isValidUrl(options.clientId)) {
|
|
47353
|
+
return "solid-oidc";
|
|
47354
|
+
}
|
|
47355
|
+
return "dynamic";
|
|
47601
47356
|
}
|
|
47602
47357
|
async function handleRegistration(options, issuerConfig, storageUtility, clientRegistrar) {
|
|
47603
|
-
|
|
47604
|
-
if (
|
|
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 {
|
|
47358
|
+
const clientType = determineClientType(options, issuerConfig);
|
|
47359
|
+
if (clientType === "dynamic") {
|
|
47618
47360
|
return clientRegistrar.getClient({
|
|
47619
47361
|
sessionId: options.sessionId,
|
|
47620
47362
|
clientName: options.clientName,
|
|
47621
47363
|
redirectUrl: options.redirectUrl
|
|
47622
47364
|
}, issuerConfig);
|
|
47623
47365
|
}
|
|
47624
|
-
|
|
47625
|
-
|
|
47626
|
-
|
|
47627
|
-
|
|
47628
|
-
|
|
47629
|
-
|
|
47366
|
+
await storageUtility.setForUser(options.sessionId, {
|
|
47367
|
+
// If the client is either static or solid-oidc compliant, its client ID cannot be undefined.
|
|
47368
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
47369
|
+
clientId: options.clientId
|
|
47370
|
+
});
|
|
47371
|
+
if (options.clientSecret) {
|
|
47372
|
+
await storageUtility.setForUser(options.sessionId, {
|
|
47373
|
+
clientSecret: options.clientSecret
|
|
47374
|
+
});
|
|
47630
47375
|
}
|
|
47631
|
-
if (
|
|
47632
|
-
|
|
47376
|
+
if (options.clientName) {
|
|
47377
|
+
await storageUtility.setForUser(options.sessionId, {
|
|
47378
|
+
clientName: options.clientName
|
|
47379
|
+
});
|
|
47633
47380
|
}
|
|
47634
|
-
|
|
47635
|
-
|
|
47381
|
+
return {
|
|
47382
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
47383
|
+
clientId: options.clientId,
|
|
47384
|
+
clientSecret: options.clientSecret,
|
|
47385
|
+
clientName: options.clientName,
|
|
47386
|
+
clientType
|
|
47387
|
+
};
|
|
47636
47388
|
}
|
|
47637
|
-
var
|
|
47389
|
+
var globalFetch = (request2, init) => fetch2.call(globalThis, request2, init);
|
|
47638
47390
|
var ClientAuthentication = class {
|
|
47639
47391
|
constructor(loginHandler, redirectHandler, logoutHandler, sessionInfoManager, issuerConfigFetcher) {
|
|
47640
47392
|
this.loginHandler = loginHandler;
|
|
@@ -47642,13 +47394,13 @@ var PodOS = (() => {
|
|
|
47642
47394
|
this.logoutHandler = logoutHandler;
|
|
47643
47395
|
this.sessionInfoManager = sessionInfoManager;
|
|
47644
47396
|
this.issuerConfigFetcher = issuerConfigFetcher;
|
|
47645
|
-
this.fetch =
|
|
47397
|
+
this.fetch = globalFetch;
|
|
47646
47398
|
this.logout = async (sessionId, options) => {
|
|
47647
47399
|
await this.logoutHandler.handle(sessionId, (options === null || options === void 0 ? void 0 : options.logoutType) === "idp" ? {
|
|
47648
47400
|
...options,
|
|
47649
47401
|
toLogoutUrl: this.boundLogout
|
|
47650
47402
|
} : options);
|
|
47651
|
-
this.fetch =
|
|
47403
|
+
this.fetch = globalFetch;
|
|
47652
47404
|
delete this.boundLogout;
|
|
47653
47405
|
};
|
|
47654
47406
|
this.getSessionInfo = async (sessionId) => {
|
|
@@ -47666,14 +47418,13 @@ var PodOS = (() => {
|
|
|
47666
47418
|
};
|
|
47667
47419
|
async function loadOidcContextFromStorage(sessionId, storageUtility, configFetcher) {
|
|
47668
47420
|
try {
|
|
47669
|
-
const [issuerIri, codeVerifier, storedRedirectIri, dpop
|
|
47421
|
+
const [issuerIri, codeVerifier, storedRedirectIri, dpop] = await Promise.all([
|
|
47670
47422
|
storageUtility.getForUser(sessionId, "issuer", {
|
|
47671
47423
|
errorIfNull: true
|
|
47672
47424
|
}),
|
|
47673
47425
|
storageUtility.getForUser(sessionId, "codeVerifier"),
|
|
47674
47426
|
storageUtility.getForUser(sessionId, "redirectUrl"),
|
|
47675
|
-
storageUtility.getForUser(sessionId, "dpop", { errorIfNull: true })
|
|
47676
|
-
storageUtility.getForUser(sessionId, "keepAlive")
|
|
47427
|
+
storageUtility.getForUser(sessionId, "dpop", { errorIfNull: true })
|
|
47677
47428
|
]);
|
|
47678
47429
|
await storageUtility.deleteForUser(sessionId, "codeVerifier");
|
|
47679
47430
|
const issuerConfig = await configFetcher.fetchConfig(issuerIri);
|
|
@@ -47681,9 +47432,7 @@ var PodOS = (() => {
|
|
|
47681
47432
|
codeVerifier,
|
|
47682
47433
|
redirectUrl: storedRedirectIri,
|
|
47683
47434
|
issuerConfig,
|
|
47684
|
-
dpop: dpop === "true"
|
|
47685
|
-
// Default keepAlive to true if not found in storage.
|
|
47686
|
-
keepAlive: typeof keepAlive === "string" ? keepAlive === "true" : true
|
|
47435
|
+
dpop: dpop === "true"
|
|
47687
47436
|
};
|
|
47688
47437
|
} catch (e) {
|
|
47689
47438
|
throw new Error(`Failed to retrieve OIDC context from storage associated with session [${sessionId}]: ${e}`);
|
|
@@ -47840,8 +47589,8 @@ var PodOS = (() => {
|
|
|
47840
47589
|
headers
|
|
47841
47590
|
};
|
|
47842
47591
|
}
|
|
47843
|
-
async function makeAuthenticatedRequest(accessToken, url7, defaultRequestInit, dpopKey) {
|
|
47844
|
-
return
|
|
47592
|
+
async function makeAuthenticatedRequest(unauthFetch, accessToken, url7, defaultRequestInit, dpopKey) {
|
|
47593
|
+
return unauthFetch(url7, await buildAuthenticatedHeaders(url7.toString(), accessToken, dpopKey, defaultRequestInit));
|
|
47845
47594
|
}
|
|
47846
47595
|
async function refreshAccessToken(refreshOptions, dpopKey, eventEmitter) {
|
|
47847
47596
|
var _a;
|
|
@@ -47865,7 +47614,7 @@ var PodOS = (() => {
|
|
|
47865
47614
|
}
|
|
47866
47615
|
return DEFAULT_EXPIRATION_TIME_SECONDS;
|
|
47867
47616
|
};
|
|
47868
|
-
async function buildAuthenticatedFetch(accessToken, options) {
|
|
47617
|
+
async function buildAuthenticatedFetch(unauthFetch, accessToken, options) {
|
|
47869
47618
|
var _a;
|
|
47870
47619
|
let currentAccessToken = accessToken;
|
|
47871
47620
|
let latestTimeout;
|
|
@@ -47913,7 +47662,7 @@ var PodOS = (() => {
|
|
|
47913
47662
|
options.eventEmitter.emit(EVENTS.TIMEOUT_SET, expirationTimeout);
|
|
47914
47663
|
}
|
|
47915
47664
|
return async (url7, requestInit) => {
|
|
47916
|
-
let response6 = await makeAuthenticatedRequest(currentAccessToken, url7, requestInit, options === null || options === void 0 ? void 0 : options.dpopKey);
|
|
47665
|
+
let response6 = await makeAuthenticatedRequest(unauthFetch, currentAccessToken, url7, requestInit, options === null || options === void 0 ? void 0 : options.dpopKey);
|
|
47917
47666
|
const failedButNotExpectedAuthError = !response6.ok && !isExpectedAuthError(response6.status);
|
|
47918
47667
|
if (response6.ok || failedButNotExpectedAuthError) {
|
|
47919
47668
|
return response6;
|
|
@@ -47921,6 +47670,7 @@ var PodOS = (() => {
|
|
|
47921
47670
|
const hasBeenRedirected = response6.url !== url7;
|
|
47922
47671
|
if (hasBeenRedirected && (options === null || options === void 0 ? void 0 : options.dpopKey) !== void 0) {
|
|
47923
47672
|
response6 = await makeAuthenticatedRequest(
|
|
47673
|
+
unauthFetch,
|
|
47924
47674
|
currentAccessToken,
|
|
47925
47675
|
// Replace the original target IRI (`url`) by the redirection target
|
|
47926
47676
|
response6.url,
|
|
@@ -47933,7 +47683,7 @@ var PodOS = (() => {
|
|
|
47933
47683
|
}
|
|
47934
47684
|
|
|
47935
47685
|
// ../node_modules/@inrupt/solid-client-authn-browser/dist/index.mjs
|
|
47936
|
-
var
|
|
47686
|
+
var import_events2 = __toESM(require_events(), 1);
|
|
47937
47687
|
|
|
47938
47688
|
// ../node_modules/@inrupt/oidc-client-ext/dist/index.es.js
|
|
47939
47689
|
var import_oidc_client = __toESM(require_oidc_client_min());
|
|
@@ -48081,7 +47831,7 @@ var PodOS = (() => {
|
|
|
48081
47831
|
headers,
|
|
48082
47832
|
body: new URLSearchParams(requestBody).toString()
|
|
48083
47833
|
};
|
|
48084
|
-
const rawTokenResponse = await
|
|
47834
|
+
const rawTokenResponse = await fetch2(issuer2.tokenEndpoint, tokenRequestInit);
|
|
48085
47835
|
const jsonTokenResponse = await rawTokenResponse.json();
|
|
48086
47836
|
const tokenResponse = validateTokenEndpointResponse(jsonTokenResponse, dpop);
|
|
48087
47837
|
const webId = await getWebidFromTokenPayload(tokenResponse.id_token, issuer2.jwksUri, issuer2.issuer, client.clientId);
|
|
@@ -48094,6 +47844,66 @@ var PodOS = (() => {
|
|
|
48094
47844
|
expiresIn: tokenResponse.expires_in
|
|
48095
47845
|
};
|
|
48096
47846
|
}
|
|
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
|
+
}
|
|
48097
47907
|
var isValidUrl2 = (url7) => {
|
|
48098
47908
|
try {
|
|
48099
47909
|
new URL(url7);
|
|
@@ -48127,7 +47937,7 @@ var PodOS = (() => {
|
|
|
48127
47937
|
} else if (isValidUrl2(client.clientId)) {
|
|
48128
47938
|
requestBody.client_id = client.clientId;
|
|
48129
47939
|
}
|
|
48130
|
-
const rawResponse = await
|
|
47940
|
+
const rawResponse = await fetch2(issuer2.tokenEndpoint, {
|
|
48131
47941
|
method: "POST",
|
|
48132
47942
|
body: new URLSearchParams(requestBody).toString(),
|
|
48133
47943
|
headers: {
|
|
@@ -48225,7 +48035,7 @@ var PodOS = (() => {
|
|
|
48225
48035
|
};
|
|
48226
48036
|
this.handleIncomingRedirect = async (url7, eventEmitter) => {
|
|
48227
48037
|
try {
|
|
48228
|
-
const redirectInfo = await this.redirectHandler.handle(url7, eventEmitter
|
|
48038
|
+
const redirectInfo = await this.redirectHandler.handle(url7, eventEmitter);
|
|
48229
48039
|
this.fetch = redirectInfo.fetch.bind(window);
|
|
48230
48040
|
this.boundLogout = redirectInfo.getLogoutUrl;
|
|
48231
48041
|
await this.cleanUrlAfterRedirect(url7);
|
|
@@ -48304,7 +48114,8 @@ var PodOS = (() => {
|
|
|
48304
48114
|
authority: oidcLoginOptions.issuer.toString(),
|
|
48305
48115
|
client_id: oidcLoginOptions.client.clientId,
|
|
48306
48116
|
client_secret: oidcLoginOptions.client.clientSecret,
|
|
48307
|
-
redirect_uri: oidcLoginOptions.redirectUrl,
|
|
48117
|
+
redirect_uri: oidcLoginOptions.redirectUrl.toString(),
|
|
48118
|
+
post_logout_redirect_uri: oidcLoginOptions.redirectUrl.toString(),
|
|
48308
48119
|
response_type: "code",
|
|
48309
48120
|
scope: DEFAULT_SCOPES,
|
|
48310
48121
|
filterProtocolClaims: true,
|
|
@@ -48450,7 +48261,7 @@ var PodOS = (() => {
|
|
|
48450
48261
|
// includes the full issuer path. See https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderConfig.
|
|
48451
48262
|
issuer2.endsWith("/") ? issuer2 : `${issuer2}/`
|
|
48452
48263
|
).href;
|
|
48453
|
-
const issuerConfigRequestBody = await
|
|
48264
|
+
const issuerConfigRequestBody = await fetch2.call(globalThis, openIdConfigUrl);
|
|
48454
48265
|
try {
|
|
48455
48266
|
issuerConfig = processConfig(await issuerConfigRequestBody.json());
|
|
48456
48267
|
} catch (err) {
|
|
@@ -48541,6 +48352,7 @@ var PodOS = (() => {
|
|
|
48541
48352
|
return getUnauthenticatedSession();
|
|
48542
48353
|
}
|
|
48543
48354
|
};
|
|
48355
|
+
var globalFetch2 = (...args) => fetch2.call(globalThis, ...args);
|
|
48544
48356
|
var AuthCodeRedirectHandler = class {
|
|
48545
48357
|
constructor(storageUtility, sessionInfoManager, issuerConfigFetcher, clientRegistrar, tokerRefresher) {
|
|
48546
48358
|
this.storageUtility = storageUtility;
|
|
@@ -48583,16 +48395,21 @@ var PodOS = (() => {
|
|
|
48583
48395
|
throw new Error(`The redirect URL for session ${storedSessionId} is missing from storage.`);
|
|
48584
48396
|
}
|
|
48585
48397
|
const client = await this.clientRegistrar.getClient({ sessionId: storedSessionId }, issuerConfig);
|
|
48398
|
+
let tokens;
|
|
48586
48399
|
const tokenCreatedAt = Date.now();
|
|
48587
|
-
|
|
48588
|
-
|
|
48589
|
-
|
|
48590
|
-
|
|
48591
|
-
|
|
48592
|
-
|
|
48593
|
-
|
|
48594
|
-
|
|
48595
|
-
|
|
48400
|
+
if (isDpop) {
|
|
48401
|
+
tokens = await getDpopToken(issuerConfig, client, {
|
|
48402
|
+
grantType: "authorization_code",
|
|
48403
|
+
// We rely on our 'canHandle' function checking that the OAuth 'code'
|
|
48404
|
+
// parameter is present in our query string.
|
|
48405
|
+
code: url7.searchParams.get("code"),
|
|
48406
|
+
codeVerifier,
|
|
48407
|
+
redirectUrl: storedRedirectIri
|
|
48408
|
+
});
|
|
48409
|
+
window.localStorage.removeItem(`oidc.${oauthState}`);
|
|
48410
|
+
} else {
|
|
48411
|
+
tokens = await getBearerToken(url7.toString());
|
|
48412
|
+
}
|
|
48596
48413
|
let refreshOptions;
|
|
48597
48414
|
if (tokens.refreshToken !== void 0) {
|
|
48598
48415
|
refreshOptions = {
|
|
@@ -48601,7 +48418,7 @@ var PodOS = (() => {
|
|
|
48601
48418
|
tokenRefresher: this.tokerRefresher
|
|
48602
48419
|
};
|
|
48603
48420
|
}
|
|
48604
|
-
const authFetch = await buildAuthenticatedFetch(tokens.accessToken, {
|
|
48421
|
+
const authFetch = await buildAuthenticatedFetch(globalFetch2, tokens.accessToken, {
|
|
48605
48422
|
dpopKey: tokens.dpopKey,
|
|
48606
48423
|
refreshOptions,
|
|
48607
48424
|
eventEmitter,
|
|
@@ -48661,34 +48478,33 @@ var PodOS = (() => {
|
|
|
48661
48478
|
this.storageUtility = storageUtility;
|
|
48662
48479
|
}
|
|
48663
48480
|
async getClient(options, issuerConfig) {
|
|
48664
|
-
const [
|
|
48481
|
+
const [
|
|
48482
|
+
storedClientId,
|
|
48483
|
+
storedClientSecret
|
|
48484
|
+
// storedClientName,
|
|
48485
|
+
] = await Promise.all([
|
|
48665
48486
|
this.storageUtility.getForUser(options.sessionId, "clientId", {
|
|
48666
48487
|
secure: false
|
|
48667
48488
|
}),
|
|
48668
48489
|
this.storageUtility.getForUser(options.sessionId, "clientSecret", {
|
|
48669
48490
|
secure: false
|
|
48670
|
-
}),
|
|
48671
|
-
this.storageUtility.getForUser(options.sessionId, "clientName", {
|
|
48672
|
-
secure: false
|
|
48673
|
-
}),
|
|
48674
|
-
this.storageUtility.getForUser(options.sessionId, "clientType", {
|
|
48675
|
-
secure: false
|
|
48676
48491
|
})
|
|
48492
|
+
// this.storageUtility.getForUser(options.sessionId, "clientName", {
|
|
48493
|
+
// // FIXME: figure out how to persist secure storage at reload
|
|
48494
|
+
// secure: false,
|
|
48495
|
+
// }),
|
|
48677
48496
|
]);
|
|
48678
|
-
if (storedClientId
|
|
48497
|
+
if (storedClientId) {
|
|
48679
48498
|
return {
|
|
48680
48499
|
clientId: storedClientId,
|
|
48681
48500
|
clientSecret: storedClientSecret,
|
|
48682
|
-
|
|
48683
|
-
// Note: static clients are not applicable in a browser context.
|
|
48684
|
-
clientType: storedClientType
|
|
48501
|
+
clientType: "dynamic"
|
|
48685
48502
|
};
|
|
48686
48503
|
}
|
|
48687
48504
|
try {
|
|
48688
48505
|
const registeredClient = await registerClient(options, issuerConfig);
|
|
48689
48506
|
const infoToSave = {
|
|
48690
|
-
clientId: registeredClient.clientId
|
|
48691
|
-
clientType: "dynamic"
|
|
48507
|
+
clientId: registeredClient.clientId
|
|
48692
48508
|
};
|
|
48693
48509
|
if (registeredClient.clientSecret) {
|
|
48694
48510
|
infoToSave.clientSecret = registeredClient.clientSecret;
|
|
@@ -48797,7 +48613,7 @@ var PodOS = (() => {
|
|
|
48797
48613
|
function isLoggedIn(sessionInfo) {
|
|
48798
48614
|
return !!(sessionInfo === null || sessionInfo === void 0 ? void 0 : sessionInfo.isLoggedIn);
|
|
48799
48615
|
}
|
|
48800
|
-
var Session = class {
|
|
48616
|
+
var Session = class _Session extends import_events2.default {
|
|
48801
48617
|
/**
|
|
48802
48618
|
* Session object constructor. Typically called as follows:
|
|
48803
48619
|
*
|
|
@@ -48814,6 +48630,7 @@ var PodOS = (() => {
|
|
|
48814
48630
|
*
|
|
48815
48631
|
*/
|
|
48816
48632
|
constructor(sessionOptions = {}, sessionId = void 0) {
|
|
48633
|
+
super();
|
|
48817
48634
|
this.tokenRequestInProgress = false;
|
|
48818
48635
|
this.login = async (options) => {
|
|
48819
48636
|
var _a;
|
|
@@ -48870,7 +48687,7 @@ var PodOS = (() => {
|
|
|
48870
48687
|
this.tokenRequestInProgress = false;
|
|
48871
48688
|
return sessionInfo;
|
|
48872
48689
|
};
|
|
48873
|
-
this.events = new
|
|
48690
|
+
this.events = new Proxy(this, buildProxyHandler(_Session.prototype, "events only implements ISessionEventListener"));
|
|
48874
48691
|
if (sessionOptions.clientAuthentication) {
|
|
48875
48692
|
this.clientAuthentication = sessionOptions.clientAuthentication;
|
|
48876
48693
|
} else if (sessionOptions.secureStorage && sessionOptions.insecureStorage) {
|
|
@@ -48897,6 +48714,58 @@ var PodOS = (() => {
|
|
|
48897
48714
|
this.events.on(EVENTS.SESSION_EXPIRED, () => this.internalLogout(false));
|
|
48898
48715
|
this.events.on(EVENTS.ERROR, () => this.internalLogout(false));
|
|
48899
48716
|
}
|
|
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
|
+
}
|
|
48900
48769
|
setSessionInfo(sessionInfo) {
|
|
48901
48770
|
this.info.isLoggedIn = sessionInfo.isLoggedIn;
|
|
48902
48771
|
this.info.webId = sessionInfo.webId;
|
|
@@ -48947,19 +48816,16 @@ var PodOS = (() => {
|
|
|
48947
48816
|
* @deprecated use observeSession instead
|
|
48948
48817
|
*/
|
|
48949
48818
|
trackSession(callback) {
|
|
48950
|
-
this.session.
|
|
48951
|
-
this.session.
|
|
48952
|
-
this.session.
|
|
48953
|
-
EVENTS.SESSION_RESTORED,
|
|
48954
|
-
() => callback(this.session.info)
|
|
48955
|
-
);
|
|
48819
|
+
this.session.on(EVENTS.LOGIN, () => callback(this.session.info));
|
|
48820
|
+
this.session.on(EVENTS.LOGOUT, () => callback(this.session.info));
|
|
48821
|
+
this.session.on(EVENTS.SESSION_RESTORED, () => callback(this.session.info));
|
|
48956
48822
|
callback(this.session.info);
|
|
48957
48823
|
}
|
|
48958
48824
|
observeSession() {
|
|
48959
48825
|
return this.sessionInfo$;
|
|
48960
48826
|
}
|
|
48961
48827
|
onSessionRestore(callback) {
|
|
48962
|
-
this.session.
|
|
48828
|
+
this.session.on(EVENTS.SESSION_RESTORED, callback);
|
|
48963
48829
|
}
|
|
48964
48830
|
};
|
|
48965
48831
|
|
|
@@ -58953,7 +58819,7 @@ var PodOS = (() => {
|
|
|
58953
58819
|
var Mailbox = "http://www.w3.org/2007/ont/link#Mailbox";
|
|
58954
58820
|
var ProtocolEvent = "http://www.w3.org/2007/ont/link#ProtocolEvent";
|
|
58955
58821
|
var RDFDocument = "http://www.w3.org/2007/ont/link#RDFDocument";
|
|
58956
|
-
var
|
|
58822
|
+
var Response2 = "http://www.w3.org/2007/ont/link#Response";
|
|
58957
58823
|
var Session3 = "http://www.w3.org/2007/ont/link#Session";
|
|
58958
58824
|
var isMentionedIn = "http://www.w3.org/2007/ont/link#isMentionedIn";
|
|
58959
58825
|
var mentionsClass = "http://www.w3.org/2007/ont/link#mentionsClass";
|
|
@@ -58973,7 +58839,7 @@ var PodOS = (() => {
|
|
|
58973
58839
|
Mailbox,
|
|
58974
58840
|
ProtocolEvent,
|
|
58975
58841
|
RDFDocument,
|
|
58976
|
-
Response,
|
|
58842
|
+
Response: Response2,
|
|
58977
58843
|
Session: Session3,
|
|
58978
58844
|
isMentionedIn,
|
|
58979
58845
|
mentionsClass,
|
|
@@ -69239,7 +69105,7 @@ var PodOS = (() => {
|
|
|
69239
69105
|
var Mailbox2 = "http://www.w3.org/2007/ont/link#Mailbox";
|
|
69240
69106
|
var ProtocolEvent2 = "http://www.w3.org/2007/ont/link#ProtocolEvent";
|
|
69241
69107
|
var RDFDocument2 = "http://www.w3.org/2007/ont/link#RDFDocument";
|
|
69242
|
-
var
|
|
69108
|
+
var Response3 = "http://www.w3.org/2007/ont/link#Response";
|
|
69243
69109
|
var Session4 = "http://www.w3.org/2007/ont/link#Session";
|
|
69244
69110
|
var isMentionedIn2 = "http://www.w3.org/2007/ont/link#isMentionedIn";
|
|
69245
69111
|
var mentionsClass2 = "http://www.w3.org/2007/ont/link#mentionsClass";
|
|
@@ -69259,7 +69125,7 @@ var PodOS = (() => {
|
|
|
69259
69125
|
Mailbox: Mailbox2,
|
|
69260
69126
|
ProtocolEvent: ProtocolEvent2,
|
|
69261
69127
|
RDFDocument: RDFDocument2,
|
|
69262
|
-
Response:
|
|
69128
|
+
Response: Response3,
|
|
69263
69129
|
Session: Session4,
|
|
69264
69130
|
isMentionedIn: isMentionedIn2,
|
|
69265
69131
|
mentionsClass: mentionsClass2,
|
|
@@ -69281,7 +69147,7 @@ var PodOS = (() => {
|
|
|
69281
69147
|
var Mailbox3 = "http://www.w3.org/2007/ont/link#Mailbox";
|
|
69282
69148
|
var ProtocolEvent3 = "http://www.w3.org/2007/ont/link#ProtocolEvent";
|
|
69283
69149
|
var RDFDocument3 = "http://www.w3.org/2007/ont/link#RDFDocument";
|
|
69284
|
-
var
|
|
69150
|
+
var Response4 = "http://www.w3.org/2007/ont/link#Response";
|
|
69285
69151
|
var Session5 = "http://www.w3.org/2007/ont/link#Session";
|
|
69286
69152
|
var isMentionedIn3 = "http://www.w3.org/2007/ont/link#isMentionedIn";
|
|
69287
69153
|
var mentionsClass3 = "http://www.w3.org/2007/ont/link#mentionsClass";
|
|
@@ -69301,7 +69167,7 @@ var PodOS = (() => {
|
|
|
69301
69167
|
Mailbox: Mailbox3,
|
|
69302
69168
|
ProtocolEvent: ProtocolEvent3,
|
|
69303
69169
|
RDFDocument: RDFDocument3,
|
|
69304
|
-
Response:
|
|
69170
|
+
Response: Response4,
|
|
69305
69171
|
Session: Session5,
|
|
69306
69172
|
isMentionedIn: isMentionedIn3,
|
|
69307
69173
|
mentionsClass: mentionsClass3,
|