solid-ui 2.4.27-e6d67dd8 → 2.4.27-ea3f761a
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/README.md +6 -1
- package/dist/solid-ui.js +569 -451
- package/dist/solid-ui.js.map +1 -1
- package/dist/solid-ui.min.js +1 -1
- package/dist/solid-ui.min.js.map +1 -1
- package/lib/chat/chatLogic.js +18 -18
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/keys.d.ts +10 -2
- package/lib/chat/keys.d.ts.map +1 -1
- package/lib/chat/keys.js +132 -133
- package/lib/chat/keys.js.map +1 -1
- package/lib/chat/message.js +2 -2
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/signature.d.ts +0 -2
- package/lib/chat/signature.d.ts.map +1 -1
- package/lib/chat/signature.js +23 -20
- package/lib/chat/signature.js.map +1 -1
- package/lib/utils/keyHelpers/accessData.d.ts +10 -0
- package/lib/utils/keyHelpers/accessData.d.ts.map +1 -0
- package/lib/utils/keyHelpers/accessData.js +226 -0
- package/lib/utils/keyHelpers/accessData.js.map +1 -0
- package/lib/utils/keyHelpers/acl.d.ts +20 -0
- package/lib/utils/keyHelpers/acl.d.ts.map +1 -0
- package/lib/utils/keyHelpers/acl.js +93 -0
- package/lib/utils/keyHelpers/acl.js.map +1 -0
- package/lib/versionInfo.js +2 -2
- package/lib/versionInfo.js.map +1 -1
- package/package.json +1 -1
- package/lib/utils/cryptoKeyHelpers.d.ts +0 -5
- package/lib/utils/cryptoKeyHelpers.d.ts.map +0 -1
- package/lib/utils/cryptoKeyHelpers.js +0 -145
- package/lib/utils/cryptoKeyHelpers.js.map +0 -1
package/dist/solid-ui.js
CHANGED
|
@@ -2655,7 +2655,7 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2655
2655
|
var oldMsg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
2656
2656
|
var deleteIt = arguments.length > 2 ? arguments[2] : undefined;
|
|
2657
2657
|
return /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
2658
|
-
var sts, now, timestamp, dateStamp, chatDocument, message, me, msg, oldMsgMaker, errMsg, privateKey,
|
|
2658
|
+
var sts, now, timestamp, dateStamp, chatDocument, message, me, msg, oldMsgMaker, errMsg, privateKey, sig, _errMsg;
|
|
2659
2659
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
2660
2660
|
while (1) switch (_context2.prev = _context2.next) {
|
|
2661
2661
|
case 0:
|
|
@@ -2703,46 +2703,46 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2703
2703
|
sts.push($rdf.st(message, ns.dct('created'), dateStamp, chatDocument));
|
|
2704
2704
|
msg.created = dateStamp.value;
|
|
2705
2705
|
if (!me) {
|
|
2706
|
-
_context2.next =
|
|
2706
|
+
_context2.next = 35;
|
|
2707
2707
|
break;
|
|
2708
2708
|
}
|
|
2709
2709
|
sts.push($rdf.st(message, ns.foaf('maker'), me, chatDocument));
|
|
2710
2710
|
msg.maker = me.uri;
|
|
2711
2711
|
// privateKey the cached private key of me, cached in store
|
|
2712
2712
|
_context2.next = 32;
|
|
2713
|
-
return (0, _keys.getPrivateKey)(me
|
|
2713
|
+
return (0, _keys.getPrivateKey)(me);
|
|
2714
2714
|
case 32:
|
|
2715
2715
|
privateKey = _context2.sent;
|
|
2716
|
+
// me.uri)
|
|
2716
2717
|
// const privateKey0 = 'a11bc5d2eee6cdb3b37f5473a712cad905ccfb13fb2ccdbf1be0a1ac4fdc7d2a'
|
|
2717
|
-
// const pubKey0 = '023a9da707bee1302f66083c9d95673ff969b41607a66f52686fa774d64ceb87'
|
|
2718
|
-
pubKey =
|
|
2719
|
-
|
|
2720
|
-
/* const verify = verifySignature(sig, msg, pubKey) // alain to remove
|
|
2718
|
+
sig = (0, _signature.signMsg)(msg, privateKey); // const pubKey0 = '023a9da707bee1302f66083c9d95673ff969b41607a66f52686fa774d64ceb87'
|
|
2719
|
+
/* const pubKey = await getPublicKey(me)
|
|
2720
|
+
const verify = verifySignature(sig, msg, pubKey) // alain to remove
|
|
2721
2721
|
debug.warn('sig ' + sig)
|
|
2722
2722
|
debug.warn('verifySign ' + verify)
|
|
2723
2723
|
debug.warn(msg) */
|
|
2724
2724
|
sts.push($rdf.st(message, $rdf.sym("".concat(_signature.SEC, "Proof")), $rdf.lit(sig), chatDocument));
|
|
2725
|
-
case
|
|
2726
|
-
_context2.prev =
|
|
2727
|
-
_context2.next =
|
|
2725
|
+
case 35:
|
|
2726
|
+
_context2.prev = 35;
|
|
2727
|
+
_context2.next = 38;
|
|
2728
2728
|
return _solidLogic.store.updater.update([], sts);
|
|
2729
|
-
case
|
|
2730
|
-
_context2.next =
|
|
2729
|
+
case 38:
|
|
2730
|
+
_context2.next = 46;
|
|
2731
2731
|
break;
|
|
2732
|
-
case
|
|
2733
|
-
_context2.prev =
|
|
2734
|
-
_context2.t0 = _context2["catch"](
|
|
2732
|
+
case 40:
|
|
2733
|
+
_context2.prev = 40;
|
|
2734
|
+
_context2.t0 = _context2["catch"](35);
|
|
2735
2735
|
_errMsg = 'Error saving chat message: ' + _context2.t0;
|
|
2736
2736
|
debug.warn(_errMsg);
|
|
2737
2737
|
alert(_errMsg);
|
|
2738
2738
|
throw new Error(_errMsg);
|
|
2739
|
-
case
|
|
2739
|
+
case 46:
|
|
2740
2740
|
return _context2.abrupt("return", message);
|
|
2741
|
-
case
|
|
2741
|
+
case 47:
|
|
2742
2742
|
case "end":
|
|
2743
2743
|
return _context2.stop();
|
|
2744
2744
|
}
|
|
2745
|
-
}, _callee2, null, [[
|
|
2745
|
+
}, _callee2, null, [[35, 40]]);
|
|
2746
2746
|
})();
|
|
2747
2747
|
});
|
|
2748
2748
|
function updateMessage(_x2) {
|
|
@@ -4043,7 +4043,8 @@ var _utils = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/@nob
|
|
|
4043
4043
|
var _signature = __webpack_require__(/*! ./signature */ "./lib/chat/signature.js");
|
|
4044
4044
|
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
4045
4045
|
var $rdf = _interopRequireWildcard(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
|
|
4046
|
-
var
|
|
4046
|
+
var _accessData = __webpack_require__(/*! ../utils/keyHelpers/accessData */ "./lib/utils/keyHelpers/accessData.js");
|
|
4047
|
+
var _acl = __webpack_require__(/*! ../utils/keyHelpers/acl */ "./lib/utils/keyHelpers/acl.js");
|
|
4047
4048
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
4048
4049
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
4049
4050
|
function generatePrivateKey() {
|
|
@@ -4052,35 +4053,46 @@ function generatePrivateKey() {
|
|
|
4052
4053
|
function generatePublicKey(privateKey) {
|
|
4053
4054
|
return (0, _utils.bytesToHex)(_secp256k.schnorr.getPublicKey(privateKey));
|
|
4054
4055
|
}
|
|
4056
|
+
|
|
4057
|
+
/**
|
|
4058
|
+
* getPublicKey
|
|
4059
|
+
* used for displaying messages in chat, therefore does not
|
|
4060
|
+
* create a new key if not found
|
|
4061
|
+
* @param webId
|
|
4062
|
+
* @returns string | undefined
|
|
4063
|
+
*/
|
|
4055
4064
|
function getPublicKey(_x) {
|
|
4056
4065
|
return _getPublicKey.apply(this, arguments);
|
|
4057
4066
|
}
|
|
4058
4067
|
function _getPublicKey() {
|
|
4059
|
-
_getPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4068
|
+
_getPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
|
|
4060
4069
|
var publicKeyDoc, key;
|
|
4061
|
-
return _regenerator["default"].wrap(function
|
|
4062
|
-
while (1) switch (
|
|
4070
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
4071
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
4063
4072
|
case 0:
|
|
4064
|
-
|
|
4073
|
+
_context2.next = 2;
|
|
4065
4074
|
return _solidLogic.store.fetcher.load(webId);
|
|
4066
4075
|
case 2:
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4076
|
+
_context2.next = 4;
|
|
4077
|
+
return (0, _accessData.pubKeyUrl)(webId);
|
|
4078
|
+
case 4:
|
|
4079
|
+
publicKeyDoc = _context2.sent;
|
|
4080
|
+
_context2.prev = 5;
|
|
4081
|
+
_context2.next = 8;
|
|
4070
4082
|
return _solidLogic.store.fetcher.load(publicKeyDoc);
|
|
4071
|
-
case
|
|
4083
|
+
case 8:
|
|
4072
4084
|
// url.href)
|
|
4073
|
-
key = _solidLogic.store.any(
|
|
4074
|
-
return
|
|
4075
|
-
case
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
return
|
|
4079
|
-
case
|
|
4085
|
+
key = _solidLogic.store.any(webId, _solidLogic.store.sym(_signature.CERT + 'PublicKey'));
|
|
4086
|
+
return _context2.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
|
|
4087
|
+
case 12:
|
|
4088
|
+
_context2.prev = 12;
|
|
4089
|
+
_context2.t0 = _context2["catch"](5);
|
|
4090
|
+
return _context2.abrupt("return", undefined);
|
|
4091
|
+
case 15:
|
|
4080
4092
|
case "end":
|
|
4081
|
-
return
|
|
4093
|
+
return _context2.stop();
|
|
4082
4094
|
}
|
|
4083
|
-
},
|
|
4095
|
+
}, _callee2, null, [[5, 12]]);
|
|
4084
4096
|
}));
|
|
4085
4097
|
return _getPublicKey.apply(this, arguments);
|
|
4086
4098
|
}
|
|
@@ -4088,114 +4100,131 @@ function getPrivateKey(_x2) {
|
|
|
4088
4100
|
return _getPrivateKey.apply(this, arguments);
|
|
4089
4101
|
}
|
|
4090
4102
|
function _getPrivateKey() {
|
|
4091
|
-
_getPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4092
|
-
var publicKeyDoc, privateKeyDoc, publicKey, privateKey, validPublicKey, del, add, newPublicKey;
|
|
4093
|
-
return _regenerator["default"].wrap(function
|
|
4094
|
-
while (1) switch (
|
|
4103
|
+
_getPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId) {
|
|
4104
|
+
var publicKeyDoc, privateKeyDoc, publicKey, privateKey, validPublicKey, del, add, newPublicKey, keyContainer;
|
|
4105
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
4106
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
4095
4107
|
case 0:
|
|
4096
|
-
|
|
4108
|
+
_context3.next = 2;
|
|
4097
4109
|
return _solidLogic.store.fetcher.load(webId);
|
|
4098
4110
|
case 2:
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4111
|
+
_context3.next = 4;
|
|
4112
|
+
return (0, _accessData.pubKeyUrl)(webId);
|
|
4113
|
+
case 4:
|
|
4114
|
+
publicKeyDoc = _context3.sent;
|
|
4115
|
+
_context3.next = 7;
|
|
4116
|
+
return (0, _accessData.privKeyUrl)(webId);
|
|
4117
|
+
case 7:
|
|
4118
|
+
privateKeyDoc = _context3.sent;
|
|
4119
|
+
_context3.next = 10;
|
|
4120
|
+
return (0, _accessData.getExistingPublicKey)(webId, publicKeyDoc);
|
|
4121
|
+
case 10:
|
|
4122
|
+
publicKey = _context3.sent;
|
|
4123
|
+
_context3.next = 13;
|
|
4124
|
+
return (0, _accessData.getExistingPrivateKey)(webId, privateKeyDoc);
|
|
4125
|
+
case 13:
|
|
4126
|
+
privateKey = _context3.sent;
|
|
4110
4127
|
// is publicKey valid ?
|
|
4111
4128
|
validPublicKey = true;
|
|
4112
4129
|
if (privateKey && publicKey !== generatePublicKey(privateKey)) {
|
|
4113
|
-
if (confirm('This is strange the publicKey is not valid for\n' + webId + '\'shall we repair keeping the private key ?')) validPublicKey = false;
|
|
4130
|
+
if (confirm('This is strange the publicKey is not valid for\n' + (webId === null || webId === void 0 ? void 0 : webId.uri) + '\'shall we repair keeping the private key ?')) validPublicKey = false;
|
|
4114
4131
|
}
|
|
4115
4132
|
|
|
4116
4133
|
// create key pair or repair publicKey
|
|
4117
4134
|
if (!(!privateKey || !publicKey || !validPublicKey)) {
|
|
4118
|
-
|
|
4135
|
+
_context3.next = 34;
|
|
4119
4136
|
break;
|
|
4120
4137
|
}
|
|
4121
4138
|
del = [];
|
|
4122
|
-
add = []; // if (privateKey) del.push($rdf.st(
|
|
4139
|
+
add = []; // if (privateKey) del.push($rdf.st(webId, store.sym(CERT + 'PrivateKey'), $rdf.lit(privateKey), store.sym(privateKeyDoc)))
|
|
4123
4140
|
if (privateKey) {
|
|
4124
|
-
|
|
4141
|
+
_context3.next = 24;
|
|
4125
4142
|
break;
|
|
4126
4143
|
}
|
|
4127
4144
|
// add = []
|
|
4128
4145
|
privateKey = generatePrivateKey();
|
|
4129
|
-
add = [$rdf.st(
|
|
4130
|
-
|
|
4131
|
-
return saveKey(privateKeyDoc, [], add, webId);
|
|
4132
|
-
case
|
|
4146
|
+
add = [$rdf.st(webId, _solidLogic.store.sym(_signature.CERT + 'PrivateKey'), $rdf.literal(privateKey), _solidLogic.store.sym(privateKeyDoc))];
|
|
4147
|
+
_context3.next = 24;
|
|
4148
|
+
return saveKey(privateKeyDoc, [], add, webId.uri);
|
|
4149
|
+
case 24:
|
|
4133
4150
|
if (!(!publicKey || !validPublicKey)) {
|
|
4134
|
-
|
|
4151
|
+
_context3.next = 31;
|
|
4135
4152
|
break;
|
|
4136
4153
|
}
|
|
4137
4154
|
del = [];
|
|
4138
4155
|
// delete invalid public key
|
|
4139
4156
|
if (publicKey) {
|
|
4140
|
-
del = [$rdf.st(
|
|
4157
|
+
del = [$rdf.st(webId, _solidLogic.store.sym(_signature.CERT + 'PublicKey'), $rdf.lit(publicKey), _solidLogic.store.sym(publicKeyDoc))];
|
|
4141
4158
|
debug.log(del);
|
|
4142
4159
|
}
|
|
4143
4160
|
// update new valid key
|
|
4144
4161
|
newPublicKey = generatePublicKey(privateKey);
|
|
4145
|
-
add = [$rdf.st(
|
|
4146
|
-
|
|
4162
|
+
add = [$rdf.st(webId, _solidLogic.store.sym(_signature.CERT + 'PublicKey'), $rdf.literal(newPublicKey), _solidLogic.store.sym(publicKeyDoc))];
|
|
4163
|
+
_context3.next = 31;
|
|
4147
4164
|
return saveKey(publicKeyDoc, del, add);
|
|
4148
|
-
case
|
|
4149
|
-
|
|
4150
|
-
|
|
4165
|
+
case 31:
|
|
4166
|
+
keyContainer = privateKeyDoc.substring(0, privateKeyDoc.lastIndexOf('/') + 1);
|
|
4167
|
+
_context3.next = 34;
|
|
4168
|
+
return (0, _acl.setAcl)(keyContainer, (0, _acl.keyContainerAclBody)(webId.uri));
|
|
4169
|
+
case 34:
|
|
4170
|
+
return _context3.abrupt("return", privateKey);
|
|
4171
|
+
case 35:
|
|
4151
4172
|
case "end":
|
|
4152
|
-
return
|
|
4173
|
+
return _context3.stop();
|
|
4153
4174
|
}
|
|
4154
|
-
},
|
|
4175
|
+
}, _callee3);
|
|
4155
4176
|
}));
|
|
4156
4177
|
return _getPrivateKey.apply(this, arguments);
|
|
4157
4178
|
}
|
|
4158
|
-
function
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
function
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
}
|
|
4195
|
-
})
|
|
4196
|
-
});
|
|
4197
|
-
return
|
|
4198
|
-
|
|
4179
|
+
var deleteKey = /*#__PURE__*/function () {
|
|
4180
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(keyDoc) {
|
|
4181
|
+
var keyAclDoc, response;
|
|
4182
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
4183
|
+
while (1) switch (_context.prev = _context.next) {
|
|
4184
|
+
case 0:
|
|
4185
|
+
_context.next = 2;
|
|
4186
|
+
return _solidLogic.store.fetcher.load(keyDoc);
|
|
4187
|
+
case 2:
|
|
4188
|
+
keyAclDoc = _solidLogic.store.any(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl'));
|
|
4189
|
+
if (!keyAclDoc) {
|
|
4190
|
+
_context.next = 16;
|
|
4191
|
+
break;
|
|
4192
|
+
}
|
|
4193
|
+
_context.prev = 4;
|
|
4194
|
+
_context.next = 7;
|
|
4195
|
+
return _solidLogic.store.fetcher.webOperation('DELETE', keyAclDoc.value);
|
|
4196
|
+
case 7:
|
|
4197
|
+
response = _context.sent;
|
|
4198
|
+
// this may fail if webId is not an owner
|
|
4199
|
+
debug.log('delete ' + keyAclDoc.value + ' ' + response.status); // should test 404 and 2xx
|
|
4200
|
+
_context.next = 16;
|
|
4201
|
+
break;
|
|
4202
|
+
case 11:
|
|
4203
|
+
_context.prev = 11;
|
|
4204
|
+
_context.t0 = _context["catch"](4);
|
|
4205
|
+
if (!(_context.t0.response.status !== 404)) {
|
|
4206
|
+
_context.next = 15;
|
|
4207
|
+
break;
|
|
4208
|
+
}
|
|
4209
|
+
throw new Error(_context.t0);
|
|
4210
|
+
case 15:
|
|
4211
|
+
debug.log('delete ' + keyAclDoc.value + ' ' + _context.t0.response.status); // should test 404 and 2xx
|
|
4212
|
+
case 16:
|
|
4213
|
+
case "end":
|
|
4214
|
+
return _context.stop();
|
|
4215
|
+
}
|
|
4216
|
+
}, _callee, null, [[4, 11]]);
|
|
4217
|
+
}));
|
|
4218
|
+
return function deleteKey(_x3) {
|
|
4219
|
+
return _ref.apply(this, arguments);
|
|
4220
|
+
};
|
|
4221
|
+
}();
|
|
4222
|
+
|
|
4223
|
+
/**
|
|
4224
|
+
* delete acl if keydoc exists
|
|
4225
|
+
* create/edit keyDoc
|
|
4226
|
+
* set keyDoc acl
|
|
4227
|
+
*/
|
|
4199
4228
|
function saveKey(_x4, _x5, _x6) {
|
|
4200
4229
|
return _saveKey.apply(this, arguments);
|
|
4201
4230
|
}
|
|
@@ -4203,56 +4232,26 @@ function _saveKey() {
|
|
|
4203
4232
|
_saveKey = (0, _asyncToGenerator2["default"])(function (keyDoc, del, add) {
|
|
4204
4233
|
var me = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
|
4205
4234
|
return /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
4206
|
-
var
|
|
4235
|
+
var aclBody;
|
|
4207
4236
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
4208
4237
|
while (1) switch (_context4.prev = _context4.next) {
|
|
4209
4238
|
case 0:
|
|
4210
|
-
_context4.
|
|
4211
|
-
|
|
4212
|
-
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
break;
|
|
4216
|
-
}
|
|
4217
|
-
throw new Error("".concat(keyDoc, " ACL doc not found!"));
|
|
4239
|
+
_context4.next = 2;
|
|
4240
|
+
return deleteKey(keyDoc);
|
|
4241
|
+
case 2:
|
|
4242
|
+
_context4.next = 4;
|
|
4243
|
+
return _solidLogic.store.updater.updateMany(del, add);
|
|
4218
4244
|
case 4:
|
|
4219
|
-
|
|
4245
|
+
// or a promise store.updater.update ?
|
|
4246
|
+
// create READ only ACL
|
|
4247
|
+
aclBody = (0, _acl.keyAclBody)(keyDoc, me);
|
|
4220
4248
|
_context4.next = 7;
|
|
4221
|
-
return
|
|
4249
|
+
return (0, _acl.setAcl)(keyDoc, aclBody);
|
|
4222
4250
|
case 7:
|
|
4223
|
-
response = _context4.sent;
|
|
4224
|
-
// this may fail if webId is not an owner
|
|
4225
|
-
debug.log('delete ' + keyAclDoc.value + ' ' + response.status); // should test 404 and 2xx
|
|
4226
|
-
_context4.next = 16;
|
|
4227
|
-
break;
|
|
4228
|
-
case 11:
|
|
4229
|
-
_context4.prev = 11;
|
|
4230
|
-
_context4.t0 = _context4["catch"](4);
|
|
4231
|
-
if (!(_context4.t0.response.status !== 404)) {
|
|
4232
|
-
_context4.next = 15;
|
|
4233
|
-
break;
|
|
4234
|
-
}
|
|
4235
|
-
throw new Error(_context4.t0);
|
|
4236
|
-
case 15:
|
|
4237
|
-
debug.log('delete ' + keyAclDoc.value + ' ' + _context4.t0.response.status); // should test 404 and 2xx
|
|
4238
|
-
case 16:
|
|
4239
|
-
_context4.next = 18;
|
|
4240
|
-
return _solidLogic.store.updater.updateMany(del, add);
|
|
4241
|
-
case 18:
|
|
4242
|
-
_context4.next = 20;
|
|
4243
|
-
return setAcl(keyDoc, me);
|
|
4244
|
-
case 20:
|
|
4245
|
-
_context4.next = 25;
|
|
4246
|
-
break;
|
|
4247
|
-
case 22:
|
|
4248
|
-
_context4.prev = 22;
|
|
4249
|
-
_context4.t1 = _context4["catch"](0);
|
|
4250
|
-
throw new Error(_context4.t1);
|
|
4251
|
-
case 25:
|
|
4252
4251
|
case "end":
|
|
4253
4252
|
return _context4.stop();
|
|
4254
4253
|
}
|
|
4255
|
-
}, _callee4
|
|
4254
|
+
}, _callee4);
|
|
4256
4255
|
})();
|
|
4257
4256
|
});
|
|
4258
4257
|
return _saveKey.apply(this, arguments);
|
|
@@ -4404,11 +4403,11 @@ function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
|
4404
4403
|
|
|
4405
4404
|
// signed message, get public key and check signature
|
|
4406
4405
|
else {
|
|
4407
|
-
(0, _keys.getPublicKey)(creator
|
|
4406
|
+
(0, _keys.getPublicKey)(creator).then(function (publicKey) {
|
|
4408
4407
|
debug.log(creator.uri + '\n' + msg.created + '\n' + msg.id + '\n' + publicKey);
|
|
4409
4408
|
if (!publicKey) {
|
|
4410
4409
|
// TODO try to recreate the publicKey
|
|
4411
|
-
// if(me.uri === creator.uri) await getPrivateKey(creator
|
|
4410
|
+
// if(me.uri === creator.uri) await getPrivateKey(creator)
|
|
4412
4411
|
debug.warn('message is signed but ' + creator.uri + ' is missing publicKey');
|
|
4413
4412
|
}
|
|
4414
4413
|
// check that publicKey is a valid hex string
|
|
@@ -5211,13 +5210,11 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
5211
5210
|
value: true
|
|
5212
5211
|
}));
|
|
5213
5212
|
exports.SEC = exports.CERT = void 0;
|
|
5214
|
-
exports.finishMsg = finishMsg;
|
|
5215
5213
|
exports.getBlankMsg = getBlankMsg;
|
|
5216
5214
|
exports.getMsgHash = getMsgHash;
|
|
5217
5215
|
exports.serializeMsg = serializeMsg;
|
|
5218
5216
|
exports.signMsg = signMsg;
|
|
5219
5217
|
exports.utf8Encoder = exports.utf8Decoder = void 0;
|
|
5220
|
-
exports.validateMsg = validateMsg;
|
|
5221
5218
|
exports.verifySignature = verifySignature;
|
|
5222
5219
|
var _secp256k = __webpack_require__(/*! @noble/curves/secp256k1 */ "./node_modules/@noble/curves/secp256k1.js");
|
|
5223
5220
|
var _utils = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/@noble/hashes/utils.js");
|
|
@@ -5263,19 +5260,22 @@ function getBlankMsg() {
|
|
|
5263
5260
|
id: '',
|
|
5264
5261
|
created: '',
|
|
5265
5262
|
dateDeleted: '',
|
|
5263
|
+
// TODO to remove if not used
|
|
5266
5264
|
content: '',
|
|
5267
5265
|
maker: '',
|
|
5268
|
-
sig: ''
|
|
5266
|
+
sig: '' // TODO to remove if not used
|
|
5269
5267
|
};
|
|
5270
5268
|
}
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
message.
|
|
5276
|
-
message.
|
|
5277
|
-
|
|
5278
|
-
|
|
5269
|
+
|
|
5270
|
+
/* export function finishMsg (t: MsgTemplate, privateKey: string): Message {
|
|
5271
|
+
// to update to chat message triples
|
|
5272
|
+
const message = t as Message
|
|
5273
|
+
// message.pubkey = getPublicKey(privateKey)
|
|
5274
|
+
message.id = getMsgHash(message)
|
|
5275
|
+
message.sig = signMsg(message, privateKey)
|
|
5276
|
+
return message
|
|
5277
|
+
} */
|
|
5278
|
+
|
|
5279
5279
|
function serializeMsg(msg) {
|
|
5280
5280
|
// to update to chat messages triples
|
|
5281
5281
|
/* if (!validateMsg(msg))
|
|
@@ -5287,27 +5287,29 @@ function getMsgHash(message) {
|
|
|
5287
5287
|
var msgHash = (0, _sha.sha256)(utf8Encoder.encode(serializeMsg(message)));
|
|
5288
5288
|
return (0, _utils.bytesToHex)(msgHash);
|
|
5289
5289
|
}
|
|
5290
|
-
|
|
5291
|
-
|
|
5292
|
-
|
|
5293
|
-
function validateMsg(message) {
|
|
5294
|
-
|
|
5290
|
+
|
|
5291
|
+
// const isRecord = (obj: unknown): obj is Record<string, unknown> => obj instanceof Object
|
|
5292
|
+
|
|
5293
|
+
/* export function validateMsg<T> (message: T): message is T & UnsignedMsg {
|
|
5294
|
+
if (!isRecord(message)) return false
|
|
5295
5295
|
if (typeof message.kind !== 'number') return false
|
|
5296
5296
|
if (typeof message.content !== 'string') return false
|
|
5297
5297
|
if (typeof message.created_at !== 'number') return false
|
|
5298
5298
|
if (typeof message.pubkey !== 'string') return false
|
|
5299
5299
|
if (!message.pubkey.match(/^[a-f0-9]{64}$/)) return false
|
|
5300
|
-
|
|
5300
|
+
|
|
5301
|
+
if (!Array.isArray(message.tags)) return false
|
|
5301
5302
|
for (let i = 0; i < message.tags.length; i++) {
|
|
5302
5303
|
let tag = message.tags[i]
|
|
5303
5304
|
if (!Array.isArray(tag)) return false
|
|
5304
5305
|
for (let j = 0; j < tag.length; j++) {
|
|
5305
5306
|
if (typeof tag[j] === 'object') return false
|
|
5306
5307
|
}
|
|
5307
|
-
}
|
|
5308
|
+
}
|
|
5309
|
+
|
|
5310
|
+
return true
|
|
5311
|
+
} */
|
|
5308
5312
|
|
|
5309
|
-
return true;
|
|
5310
|
-
}
|
|
5311
5313
|
function verifySignature(sig, message, pubKey) {
|
|
5312
5314
|
return _secp256k.schnorr.verify(sig, getMsgHash(message), pubKey);
|
|
5313
5315
|
}
|
|
@@ -12518,161 +12520,6 @@ function isLight(x) {
|
|
|
12518
12520
|
|
|
12519
12521
|
/***/ }),
|
|
12520
12522
|
|
|
12521
|
-
/***/ "./lib/utils/cryptoKeyHelpers.js":
|
|
12522
|
-
/*!***************************************!*\
|
|
12523
|
-
!*** ./lib/utils/cryptoKeyHelpers.js ***!
|
|
12524
|
-
\***************************************/
|
|
12525
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12526
|
-
|
|
12527
|
-
"use strict";
|
|
12528
|
-
|
|
12529
|
-
|
|
12530
|
-
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
12531
|
-
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
12532
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
12533
|
-
value: true
|
|
12534
|
-
}));
|
|
12535
|
-
exports.privKeyUrl = void 0;
|
|
12536
|
-
exports.privateKeyExists = privateKeyExists;
|
|
12537
|
-
exports.pubKeyUrl = void 0;
|
|
12538
|
-
exports.publicKeyExists = publicKeyExists;
|
|
12539
|
-
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
12540
|
-
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
12541
|
-
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
12542
|
-
var _signature = __webpack_require__(/*! ../chat/signature */ "./lib/chat/signature.js");
|
|
12543
|
-
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
12544
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12545
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12546
|
-
var pubKeyUrl = function pubKeyUrl(webId) {
|
|
12547
|
-
var url = new URL(webId);
|
|
12548
|
-
// find storage in webId
|
|
12549
|
-
var storage = _solidLogic.store.each(_solidLogic.store.sym(webId), _solidLogic.store.sym('http://www.w3.org/ns/pim/space#storage'));
|
|
12550
|
-
var pod = storage.length === 1 ? storage : storage.find(function (node) {
|
|
12551
|
-
return url.origin === new URL(node.value).origin;
|
|
12552
|
-
});
|
|
12553
|
-
var podUrl = Array.isArray(pod) ? pod[0] : pod;
|
|
12554
|
-
if (!(podUrl !== null && podUrl !== void 0 && podUrl.value)) throw Error('No space:storage in ' + webId);
|
|
12555
|
-
var publicKeyUrl = podUrl.value + 'profile/keys/publicKey.ttl';
|
|
12556
|
-
return publicKeyUrl;
|
|
12557
|
-
};
|
|
12558
|
-
exports.pubKeyUrl = pubKeyUrl;
|
|
12559
|
-
function publicKeyExists(_x) {
|
|
12560
|
-
return _publicKeyExists.apply(this, arguments);
|
|
12561
|
-
}
|
|
12562
|
-
function _publicKeyExists() {
|
|
12563
|
-
_publicKeyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
|
|
12564
|
-
var publicKeyUrl;
|
|
12565
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
12566
|
-
while (1) switch (_context.prev = _context.next) {
|
|
12567
|
-
case 0:
|
|
12568
|
-
// find publickey
|
|
12569
|
-
publicKeyUrl = pubKeyUrl(webId);
|
|
12570
|
-
_context.next = 3;
|
|
12571
|
-
return keyExists(webId, publicKeyUrl, 'PublicKey');
|
|
12572
|
-
case 3:
|
|
12573
|
-
return _context.abrupt("return", _context.sent);
|
|
12574
|
-
case 4:
|
|
12575
|
-
case "end":
|
|
12576
|
-
return _context.stop();
|
|
12577
|
-
}
|
|
12578
|
-
}, _callee);
|
|
12579
|
-
}));
|
|
12580
|
-
return _publicKeyExists.apply(this, arguments);
|
|
12581
|
-
}
|
|
12582
|
-
var privKeyUrl = function privKeyUrl(webId) {
|
|
12583
|
-
var url = new URL(webId);
|
|
12584
|
-
// find storage in webId
|
|
12585
|
-
var storage = _solidLogic.store.each(_solidLogic.store.sym(webId), _solidLogic.store.sym('http://www.w3.org/ns/pim/space#storage'));
|
|
12586
|
-
var pod = storage.length === 1 ? storage : storage.find(function (node) {
|
|
12587
|
-
return url.origin === new URL(node.value).origin;
|
|
12588
|
-
});
|
|
12589
|
-
var podUrl = Array.isArray(pod) ? pod[0] : pod;
|
|
12590
|
-
if (!(podUrl !== null && podUrl !== void 0 && podUrl.value)) throw Error('Expected space:storage in ' + webId);
|
|
12591
|
-
var privateKeyUrl = (podUrl === null || podUrl === void 0 ? void 0 : podUrl.value) + 'profile/keys/privateKey.ttl';
|
|
12592
|
-
return privateKeyUrl;
|
|
12593
|
-
};
|
|
12594
|
-
exports.privKeyUrl = privKeyUrl;
|
|
12595
|
-
function privateKeyExists(_x2) {
|
|
12596
|
-
return _privateKeyExists.apply(this, arguments);
|
|
12597
|
-
}
|
|
12598
|
-
function _privateKeyExists() {
|
|
12599
|
-
_privateKeyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
|
|
12600
|
-
var privateKeyUrl;
|
|
12601
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
12602
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
12603
|
-
case 0:
|
|
12604
|
-
// find privateKey
|
|
12605
|
-
privateKeyUrl = privKeyUrl(webId);
|
|
12606
|
-
_context2.next = 3;
|
|
12607
|
-
return keyExists(webId, privateKeyUrl, 'PrivateKey');
|
|
12608
|
-
case 3:
|
|
12609
|
-
return _context2.abrupt("return", _context2.sent);
|
|
12610
|
-
case 4:
|
|
12611
|
-
case "end":
|
|
12612
|
-
return _context2.stop();
|
|
12613
|
-
}
|
|
12614
|
-
}, _callee2);
|
|
12615
|
-
}));
|
|
12616
|
-
return _privateKeyExists.apply(this, arguments);
|
|
12617
|
-
}
|
|
12618
|
-
function keyExists(_x3, _x4, _x5) {
|
|
12619
|
-
return _keyExists.apply(this, arguments);
|
|
12620
|
-
}
|
|
12621
|
-
function _keyExists() {
|
|
12622
|
-
_keyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId, keyUrl, keyType) {
|
|
12623
|
-
var key, _err$response, data, contentType, response;
|
|
12624
|
-
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
12625
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
12626
|
-
case 0:
|
|
12627
|
-
_context3.prev = 0;
|
|
12628
|
-
_context3.next = 3;
|
|
12629
|
-
return _solidLogic.store.fetcher.load(keyUrl);
|
|
12630
|
-
case 3:
|
|
12631
|
-
key = _solidLogic.store.any(_solidLogic.store.sym(webId), _solidLogic.store.sym(_signature.CERT + keyType));
|
|
12632
|
-
return _context3.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
|
|
12633
|
-
case 7:
|
|
12634
|
-
_context3.prev = 7;
|
|
12635
|
-
_context3.t0 = _context3["catch"](0);
|
|
12636
|
-
if (!((_context3.t0 === null || _context3.t0 === void 0 ? void 0 : (_err$response = _context3.t0.response) === null || _err$response === void 0 ? void 0 : _err$response.status) === 404)) {
|
|
12637
|
-
_context3.next = 24;
|
|
12638
|
-
break;
|
|
12639
|
-
}
|
|
12640
|
-
_context3.prev = 10;
|
|
12641
|
-
// create privateKey resource
|
|
12642
|
-
data = '';
|
|
12643
|
-
contentType = 'text/turtle';
|
|
12644
|
-
_context3.next = 15;
|
|
12645
|
-
return _solidLogic.store.fetcher.webOperation('PUT', keyUrl, {
|
|
12646
|
-
data: data,
|
|
12647
|
-
contentType: contentType
|
|
12648
|
-
});
|
|
12649
|
-
case 15:
|
|
12650
|
-
response = _context3.sent;
|
|
12651
|
-
_context3.next = 22;
|
|
12652
|
-
break;
|
|
12653
|
-
case 18:
|
|
12654
|
-
_context3.prev = 18;
|
|
12655
|
-
_context3.t1 = _context3["catch"](10);
|
|
12656
|
-
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context3.t1);
|
|
12657
|
-
throw _context3.t1;
|
|
12658
|
-
case 22:
|
|
12659
|
-
delete _solidLogic.store.fetcher.requested[keyUrl]; // delete cached 404 error
|
|
12660
|
-
return _context3.abrupt("return", undefined);
|
|
12661
|
-
case 24:
|
|
12662
|
-
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context3.t0);
|
|
12663
|
-
throw _context3.t0;
|
|
12664
|
-
case 26:
|
|
12665
|
-
case "end":
|
|
12666
|
-
return _context3.stop();
|
|
12667
|
-
}
|
|
12668
|
-
}, _callee3, null, [[0, 7], [10, 18]]);
|
|
12669
|
-
}));
|
|
12670
|
-
return _keyExists.apply(this, arguments);
|
|
12671
|
-
}
|
|
12672
|
-
//# sourceMappingURL=cryptoKeyHelpers.js.map
|
|
12673
|
-
|
|
12674
|
-
/***/ }),
|
|
12675
|
-
|
|
12676
12523
|
/***/ "./lib/utils/headerFooterHelpers.js":
|
|
12677
12524
|
/*!******************************************!*\
|
|
12678
12525
|
!*** ./lib/utils/headerFooterHelpers.js ***!
|
|
@@ -13391,6 +13238,345 @@ function predParentOf(node) {
|
|
|
13391
13238
|
|
|
13392
13239
|
/***/ }),
|
|
13393
13240
|
|
|
13241
|
+
/***/ "./lib/utils/keyHelpers/accessData.js":
|
|
13242
|
+
/*!********************************************!*\
|
|
13243
|
+
!*** ./lib/utils/keyHelpers/accessData.js ***!
|
|
13244
|
+
\********************************************/
|
|
13245
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13246
|
+
|
|
13247
|
+
"use strict";
|
|
13248
|
+
|
|
13249
|
+
|
|
13250
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
13251
|
+
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
13252
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
13253
|
+
value: true
|
|
13254
|
+
}));
|
|
13255
|
+
exports.getExistingPrivateKey = getExistingPrivateKey;
|
|
13256
|
+
exports.getExistingPublicKey = getExistingPublicKey;
|
|
13257
|
+
exports.getKeyIfExists = getKeyIfExists;
|
|
13258
|
+
exports.pubKeyUrl = exports.privKeyUrl = exports.getPodRoot = void 0;
|
|
13259
|
+
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
13260
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
13261
|
+
var debug = _interopRequireWildcard(__webpack_require__(/*! ../../debug */ "./lib/debug.js"));
|
|
13262
|
+
var _signature = __webpack_require__(/*! ../../chat/signature */ "./lib/chat/signature.js");
|
|
13263
|
+
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
13264
|
+
var ns = _interopRequireWildcard(__webpack_require__(/*! ../../ns */ "./lib/ns.js"));
|
|
13265
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13266
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13267
|
+
var getPodRoot = /*#__PURE__*/function () {
|
|
13268
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
|
|
13269
|
+
var _podRoot;
|
|
13270
|
+
var webIdURL, storages, podRoot, path, _res$headers$get, res;
|
|
13271
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
13272
|
+
while (1) switch (_context.prev = _context.next) {
|
|
13273
|
+
case 0:
|
|
13274
|
+
webIdURL = new URL(webId.uri); // find storages in webId document
|
|
13275
|
+
_context.next = 3;
|
|
13276
|
+
return _solidLogic.store.fetcher.load(webId.uri);
|
|
13277
|
+
case 3:
|
|
13278
|
+
storages = _solidLogic.store.each(webId, ns.space('storage'), null, webId.doc());
|
|
13279
|
+
if (storages !== null && storages !== void 0 && storages.length) {
|
|
13280
|
+
_context.next = 19;
|
|
13281
|
+
break;
|
|
13282
|
+
}
|
|
13283
|
+
// find storage recursively in webId URL
|
|
13284
|
+
path = webIdURL.pathname;
|
|
13285
|
+
case 6:
|
|
13286
|
+
if (!path.length) {
|
|
13287
|
+
_context.next = 17;
|
|
13288
|
+
break;
|
|
13289
|
+
}
|
|
13290
|
+
path = path.substring(0, path.lastIndexOf('/'));
|
|
13291
|
+
podRoot = _solidLogic.store.sym(webIdURL.origin + path + '/');
|
|
13292
|
+
_context.next = 11;
|
|
13293
|
+
return _solidLogic.store.fetcher.webOperation('HEAD', podRoot.uri);
|
|
13294
|
+
case 11:
|
|
13295
|
+
res = _context.sent;
|
|
13296
|
+
if (!((_res$headers$get = res.headers.get('link')) !== null && _res$headers$get !== void 0 && _res$headers$get.includes(ns.space('Storage').value))) {
|
|
13297
|
+
_context.next = 14;
|
|
13298
|
+
break;
|
|
13299
|
+
}
|
|
13300
|
+
return _context.abrupt("break", 17);
|
|
13301
|
+
case 14:
|
|
13302
|
+
if (!path) debug.warn("Current user storage not found for\n".concat(webId));
|
|
13303
|
+
_context.next = 6;
|
|
13304
|
+
break;
|
|
13305
|
+
case 17:
|
|
13306
|
+
_context.next = 21;
|
|
13307
|
+
break;
|
|
13308
|
+
case 19:
|
|
13309
|
+
// give preference to storage in webId root
|
|
13310
|
+
podRoot = storages.find(function (storage) {
|
|
13311
|
+
return webIdURL.origin === new URL(storage.value).origin;
|
|
13312
|
+
});
|
|
13313
|
+
if (!podRoot) podRoot = storages[0];
|
|
13314
|
+
case 21:
|
|
13315
|
+
return _context.abrupt("return", (_podRoot = podRoot) === null || _podRoot === void 0 ? void 0 : _podRoot.value);
|
|
13316
|
+
case 22:
|
|
13317
|
+
case "end":
|
|
13318
|
+
return _context.stop();
|
|
13319
|
+
}
|
|
13320
|
+
}, _callee);
|
|
13321
|
+
}));
|
|
13322
|
+
return function getPodRoot(_x) {
|
|
13323
|
+
return _ref.apply(this, arguments);
|
|
13324
|
+
};
|
|
13325
|
+
}();
|
|
13326
|
+
exports.getPodRoot = getPodRoot;
|
|
13327
|
+
var pubKeyUrl = /*#__PURE__*/function () {
|
|
13328
|
+
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
|
|
13329
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
13330
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
13331
|
+
case 0:
|
|
13332
|
+
_context2.prev = 0;
|
|
13333
|
+
_context2.next = 3;
|
|
13334
|
+
return getPodRoot(webId);
|
|
13335
|
+
case 3:
|
|
13336
|
+
_context2.t0 = _context2.sent;
|
|
13337
|
+
return _context2.abrupt("return", _context2.t0 + 'profile/keys/publicKey.ttl');
|
|
13338
|
+
case 7:
|
|
13339
|
+
_context2.prev = 7;
|
|
13340
|
+
_context2.t1 = _context2["catch"](0);
|
|
13341
|
+
throw new Error(_context2.t1);
|
|
13342
|
+
case 10:
|
|
13343
|
+
case "end":
|
|
13344
|
+
return _context2.stop();
|
|
13345
|
+
}
|
|
13346
|
+
}, _callee2, null, [[0, 7]]);
|
|
13347
|
+
}));
|
|
13348
|
+
return function pubKeyUrl(_x2) {
|
|
13349
|
+
return _ref2.apply(this, arguments);
|
|
13350
|
+
};
|
|
13351
|
+
}();
|
|
13352
|
+
exports.pubKeyUrl = pubKeyUrl;
|
|
13353
|
+
function getExistingPublicKey(_x3, _x4) {
|
|
13354
|
+
return _getExistingPublicKey.apply(this, arguments);
|
|
13355
|
+
}
|
|
13356
|
+
function _getExistingPublicKey() {
|
|
13357
|
+
_getExistingPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(webId, publicKeyUrl) {
|
|
13358
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
13359
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
13360
|
+
case 0:
|
|
13361
|
+
_context4.next = 2;
|
|
13362
|
+
return getKeyIfExists(webId, publicKeyUrl, 'PublicKey');
|
|
13363
|
+
case 2:
|
|
13364
|
+
return _context4.abrupt("return", _context4.sent);
|
|
13365
|
+
case 3:
|
|
13366
|
+
case "end":
|
|
13367
|
+
return _context4.stop();
|
|
13368
|
+
}
|
|
13369
|
+
}, _callee4);
|
|
13370
|
+
}));
|
|
13371
|
+
return _getExistingPublicKey.apply(this, arguments);
|
|
13372
|
+
}
|
|
13373
|
+
var privKeyUrl = /*#__PURE__*/function () {
|
|
13374
|
+
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId) {
|
|
13375
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
13376
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
13377
|
+
case 0:
|
|
13378
|
+
_context3.prev = 0;
|
|
13379
|
+
_context3.next = 3;
|
|
13380
|
+
return getPodRoot(webId);
|
|
13381
|
+
case 3:
|
|
13382
|
+
_context3.t0 = _context3.sent;
|
|
13383
|
+
return _context3.abrupt("return", _context3.t0 + 'profile/keys/privateKey.ttl');
|
|
13384
|
+
case 7:
|
|
13385
|
+
_context3.prev = 7;
|
|
13386
|
+
_context3.t1 = _context3["catch"](0);
|
|
13387
|
+
throw new Error(_context3.t1);
|
|
13388
|
+
case 10:
|
|
13389
|
+
case "end":
|
|
13390
|
+
return _context3.stop();
|
|
13391
|
+
}
|
|
13392
|
+
}, _callee3, null, [[0, 7]]);
|
|
13393
|
+
}));
|
|
13394
|
+
return function privKeyUrl(_x5) {
|
|
13395
|
+
return _ref3.apply(this, arguments);
|
|
13396
|
+
};
|
|
13397
|
+
}();
|
|
13398
|
+
exports.privKeyUrl = privKeyUrl;
|
|
13399
|
+
function getExistingPrivateKey(_x6, _x7) {
|
|
13400
|
+
return _getExistingPrivateKey.apply(this, arguments);
|
|
13401
|
+
}
|
|
13402
|
+
function _getExistingPrivateKey() {
|
|
13403
|
+
_getExistingPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(webId, privateKeyUrl) {
|
|
13404
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
13405
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
13406
|
+
case 0:
|
|
13407
|
+
_context5.next = 2;
|
|
13408
|
+
return getKeyIfExists(webId, privateKeyUrl, 'PrivateKey');
|
|
13409
|
+
case 2:
|
|
13410
|
+
return _context5.abrupt("return", _context5.sent);
|
|
13411
|
+
case 3:
|
|
13412
|
+
case "end":
|
|
13413
|
+
return _context5.stop();
|
|
13414
|
+
}
|
|
13415
|
+
}, _callee5);
|
|
13416
|
+
}));
|
|
13417
|
+
return _getExistingPrivateKey.apply(this, arguments);
|
|
13418
|
+
}
|
|
13419
|
+
function getKeyIfExists(_x8, _x9, _x10) {
|
|
13420
|
+
return _getKeyIfExists.apply(this, arguments);
|
|
13421
|
+
}
|
|
13422
|
+
function _getKeyIfExists() {
|
|
13423
|
+
_getKeyIfExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(webId, keyUrl, keyType) {
|
|
13424
|
+
var key, _err$response, data, contentType, response;
|
|
13425
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
13426
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
13427
|
+
case 0:
|
|
13428
|
+
_context6.prev = 0;
|
|
13429
|
+
_context6.next = 3;
|
|
13430
|
+
return _solidLogic.store.fetcher.load(keyUrl);
|
|
13431
|
+
case 3:
|
|
13432
|
+
key = _solidLogic.store.any(webId, _solidLogic.store.sym(_signature.CERT + keyType));
|
|
13433
|
+
return _context6.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
|
|
13434
|
+
case 7:
|
|
13435
|
+
_context6.prev = 7;
|
|
13436
|
+
_context6.t0 = _context6["catch"](0);
|
|
13437
|
+
if (!((_context6.t0 === null || _context6.t0 === void 0 ? void 0 : (_err$response = _context6.t0.response) === null || _err$response === void 0 ? void 0 : _err$response.status) === 404)) {
|
|
13438
|
+
_context6.next = 24;
|
|
13439
|
+
break;
|
|
13440
|
+
}
|
|
13441
|
+
_context6.prev = 10;
|
|
13442
|
+
// create resource
|
|
13443
|
+
data = '';
|
|
13444
|
+
contentType = 'text/turtle';
|
|
13445
|
+
_context6.next = 15;
|
|
13446
|
+
return _solidLogic.store.fetcher.webOperation('PUT', keyUrl, {
|
|
13447
|
+
data: data,
|
|
13448
|
+
contentType: contentType
|
|
13449
|
+
});
|
|
13450
|
+
case 15:
|
|
13451
|
+
response = _context6.sent;
|
|
13452
|
+
_context6.next = 22;
|
|
13453
|
+
break;
|
|
13454
|
+
case 18:
|
|
13455
|
+
_context6.prev = 18;
|
|
13456
|
+
_context6.t1 = _context6["catch"](10);
|
|
13457
|
+
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context6.t1);
|
|
13458
|
+
throw _context6.t1;
|
|
13459
|
+
case 22:
|
|
13460
|
+
delete _solidLogic.store.fetcher.requested[keyUrl]; // delete cached 404 error
|
|
13461
|
+
return _context6.abrupt("return", undefined);
|
|
13462
|
+
case 24:
|
|
13463
|
+
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context6.t0);
|
|
13464
|
+
throw _context6.t0;
|
|
13465
|
+
case 26:
|
|
13466
|
+
case "end":
|
|
13467
|
+
return _context6.stop();
|
|
13468
|
+
}
|
|
13469
|
+
}, _callee6, null, [[0, 7], [10, 18]]);
|
|
13470
|
+
}));
|
|
13471
|
+
return _getKeyIfExists.apply(this, arguments);
|
|
13472
|
+
}
|
|
13473
|
+
//# sourceMappingURL=accessData.js.map
|
|
13474
|
+
|
|
13475
|
+
/***/ }),
|
|
13476
|
+
|
|
13477
|
+
/***/ "./lib/utils/keyHelpers/acl.js":
|
|
13478
|
+
/*!*************************************!*\
|
|
13479
|
+
!*** ./lib/utils/keyHelpers/acl.js ***!
|
|
13480
|
+
\*************************************/
|
|
13481
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13482
|
+
|
|
13483
|
+
"use strict";
|
|
13484
|
+
|
|
13485
|
+
|
|
13486
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
13487
|
+
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
13488
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
13489
|
+
value: true
|
|
13490
|
+
}));
|
|
13491
|
+
exports.keyContainerAclBody = exports.keyAclBody = void 0;
|
|
13492
|
+
exports.setAcl = setAcl;
|
|
13493
|
+
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
13494
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
13495
|
+
var debug = _interopRequireWildcard(__webpack_require__(/*! ../../debug */ "./lib/debug.js"));
|
|
13496
|
+
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
13497
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13498
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
13499
|
+
/**
|
|
13500
|
+
* set ACL
|
|
13501
|
+
* @param keyDoc
|
|
13502
|
+
* @param aclBody
|
|
13503
|
+
*/
|
|
13504
|
+
function setAcl(_x, _x2) {
|
|
13505
|
+
return _setAcl.apply(this, arguments);
|
|
13506
|
+
}
|
|
13507
|
+
/**
|
|
13508
|
+
* key container ACL
|
|
13509
|
+
* @param me
|
|
13510
|
+
* @returns aclBody
|
|
13511
|
+
*/
|
|
13512
|
+
function _setAcl() {
|
|
13513
|
+
_setAcl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(keyDoc, aclBody) {
|
|
13514
|
+
var keyAclDoc, _err$response;
|
|
13515
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
13516
|
+
while (1) switch (_context.prev = _context.next) {
|
|
13517
|
+
case 0:
|
|
13518
|
+
_context.next = 2;
|
|
13519
|
+
return _solidLogic.store.fetcher.load(keyDoc);
|
|
13520
|
+
case 2:
|
|
13521
|
+
// FIXME: check the Why value on this quad:
|
|
13522
|
+
debug.log(_solidLogic.store.statementsMatching(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl')));
|
|
13523
|
+
keyAclDoc = _solidLogic.store.any(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl'));
|
|
13524
|
+
if (keyAclDoc) {
|
|
13525
|
+
_context.next = 6;
|
|
13526
|
+
break;
|
|
13527
|
+
}
|
|
13528
|
+
throw new Error('Key ACL doc not found!');
|
|
13529
|
+
case 6:
|
|
13530
|
+
_context.prev = 6;
|
|
13531
|
+
_context.next = 9;
|
|
13532
|
+
return _solidLogic.store.fetcher.webOperation('PUT', keyAclDoc.value, {
|
|
13533
|
+
data: aclBody,
|
|
13534
|
+
contentType: 'text/turtle'
|
|
13535
|
+
});
|
|
13536
|
+
case 9:
|
|
13537
|
+
_context.next = 16;
|
|
13538
|
+
break;
|
|
13539
|
+
case 11:
|
|
13540
|
+
_context.prev = 11;
|
|
13541
|
+
_context.t0 = _context["catch"](6);
|
|
13542
|
+
if (!((_context.t0 === null || _context.t0 === void 0 ? void 0 : (_err$response = _context.t0.response) === null || _err$response === void 0 ? void 0 : _err$response.status) !== 404)) {
|
|
13543
|
+
_context.next = 15;
|
|
13544
|
+
break;
|
|
13545
|
+
}
|
|
13546
|
+
throw new Error(_context.t0);
|
|
13547
|
+
case 15:
|
|
13548
|
+
debug.log('delete ' + keyAclDoc.value + ' ' + _context.t0.response.status); // should test 404 and 2xx
|
|
13549
|
+
case 16:
|
|
13550
|
+
case "end":
|
|
13551
|
+
return _context.stop();
|
|
13552
|
+
}
|
|
13553
|
+
}, _callee, null, [[6, 11]]);
|
|
13554
|
+
}));
|
|
13555
|
+
return _setAcl.apply(this, arguments);
|
|
13556
|
+
}
|
|
13557
|
+
var keyContainerAclBody = function keyContainerAclBody(me) {
|
|
13558
|
+
var aclBody = "\n@prefix : <#>.\n@prefix acl: <http://www.w3.org/ns/auth/acl#>.\n@prefix foaf: <http://xmlns.com/foaf/0.1/>.\n@prefix key: <./>.\n\n:ReadWrite\n a acl:Authorization;\n acl:accessTo key:;\n acl:default key:;\n acl:agent <".concat(me, ">;\n acl:mode acl:Read, acl:Write.\n");
|
|
13559
|
+
return aclBody;
|
|
13560
|
+
};
|
|
13561
|
+
|
|
13562
|
+
/**
|
|
13563
|
+
* Read only ACL
|
|
13564
|
+
* @param keyDoc
|
|
13565
|
+
* @param me
|
|
13566
|
+
* @returns aclBody
|
|
13567
|
+
*/
|
|
13568
|
+
exports.keyContainerAclBody = keyContainerAclBody;
|
|
13569
|
+
var keyAclBody = function keyAclBody(keyDoc, me) {
|
|
13570
|
+
var keyAgent = 'acl:agentClass foaf:Agent'; // publicKey
|
|
13571
|
+
if (me !== null && me !== void 0 && me.length) keyAgent = "acl:agent <".concat(me, ">"); // privateKey
|
|
13572
|
+
var aclBody = "\n@prefix foaf: <http://xmlns.com/foaf/0.1/>.\n@prefix acl: <http://www.w3.org/ns/auth/acl#>.\n<#Read>\n a acl:Authorization;\n ".concat(keyAgent, ";\n acl:accessTo <").concat(keyDoc.split('/').pop(), ">;\n acl:mode acl:Read.\n");
|
|
13573
|
+
return aclBody;
|
|
13574
|
+
};
|
|
13575
|
+
exports.keyAclBody = keyAclBody;
|
|
13576
|
+
//# sourceMappingURL=acl.js.map
|
|
13577
|
+
|
|
13578
|
+
/***/ }),
|
|
13579
|
+
|
|
13394
13580
|
/***/ "./lib/utils/label.js":
|
|
13395
13581
|
/*!****************************!*\
|
|
13396
13582
|
!*** ./lib/utils/label.js ***!
|
|
@@ -13519,8 +13705,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
13519
13705
|
}));
|
|
13520
13706
|
exports.versionInfo = void 0;
|
|
13521
13707
|
var versionInfo = {
|
|
13522
|
-
buildTime: '2023-
|
|
13523
|
-
commit: '
|
|
13708
|
+
buildTime: '2023-05-17T23:46:18Z',
|
|
13709
|
+
commit: 'ea3f761ad4f917a7af1cd05c989938a8f9bdff62',
|
|
13524
13710
|
npmInfo: {
|
|
13525
13711
|
'solid-ui': '2.4.27',
|
|
13526
13712
|
npm: '8.19.4',
|
|
@@ -62206,14 +62392,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
62206
62392
|
/* harmony export */ "createRemoteJWKSet": () => (/* binding */ createRemoteJWKSet)
|
|
62207
62393
|
/* harmony export */ });
|
|
62208
62394
|
/* harmony import */ var _runtime_fetch_jwks_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/fetch_jwks.js */ "./node_modules/jose/dist/browser/runtime/fetch_jwks.js");
|
|
62209
|
-
/* harmony import */ var
|
|
62210
|
-
/* harmony import */ var
|
|
62211
|
-
/* harmony import */ var _local_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./local.js */ "./node_modules/jose/dist/browser/jwks/local.js");
|
|
62212
|
-
|
|
62395
|
+
/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
|
|
62396
|
+
/* harmony import */ var _local_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./local.js */ "./node_modules/jose/dist/browser/jwks/local.js");
|
|
62213
62397
|
|
|
62214
62398
|
|
|
62215
62399
|
|
|
62216
|
-
|
|
62400
|
+
function isCloudflareWorkers() {
|
|
62401
|
+
return (typeof WebSocketPair !== 'undefined' ||
|
|
62402
|
+
(typeof navigator !== 'undefined' && navigator.userAgent === 'Cloudflare-Workers') ||
|
|
62403
|
+
(typeof EdgeRuntime !== 'undefined' && EdgeRuntime === 'vercel'));
|
|
62404
|
+
}
|
|
62405
|
+
class RemoteJWKSet extends _local_js__WEBPACK_IMPORTED_MODULE_2__.LocalJWKSet {
|
|
62217
62406
|
constructor(url, options) {
|
|
62218
62407
|
super({ keys: [] });
|
|
62219
62408
|
this._jwks = undefined;
|
|
@@ -62246,7 +62435,7 @@ class RemoteJWKSet extends _local_js__WEBPACK_IMPORTED_MODULE_3__.LocalJWKSet {
|
|
|
62246
62435
|
return await super.getKey(protectedHeader, token);
|
|
62247
62436
|
}
|
|
62248
62437
|
catch (err) {
|
|
62249
|
-
if (err instanceof
|
|
62438
|
+
if (err instanceof _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSNoMatchingKey) {
|
|
62250
62439
|
if (this.coolingDown() === false) {
|
|
62251
62440
|
await this.reload();
|
|
62252
62441
|
return super.getKey(protectedHeader, token);
|
|
@@ -62256,13 +62445,13 @@ class RemoteJWKSet extends _local_js__WEBPACK_IMPORTED_MODULE_3__.LocalJWKSet {
|
|
|
62256
62445
|
}
|
|
62257
62446
|
}
|
|
62258
62447
|
async reload() {
|
|
62259
|
-
if (this._pendingFetch &&
|
|
62448
|
+
if (this._pendingFetch && isCloudflareWorkers()) {
|
|
62260
62449
|
this._pendingFetch = undefined;
|
|
62261
62450
|
}
|
|
62262
62451
|
this._pendingFetch || (this._pendingFetch = (0,_runtime_fetch_jwks_js__WEBPACK_IMPORTED_MODULE_0__["default"])(this._url, this._timeoutDuration, this._options)
|
|
62263
62452
|
.then((json) => {
|
|
62264
|
-
if (!(0,
|
|
62265
|
-
throw new
|
|
62453
|
+
if (!(0,_local_js__WEBPACK_IMPORTED_MODULE_2__.isJWKSLike)(json)) {
|
|
62454
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSInvalid('JSON Web Key Set malformed');
|
|
62266
62455
|
}
|
|
62267
62456
|
this._jwks = { keys: json.keys };
|
|
62268
62457
|
this._jwksTimestamp = Date.now();
|
|
@@ -63450,8 +63639,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
63450
63639
|
/* harmony export */ "checkEncCryptoKey": () => (/* binding */ checkEncCryptoKey),
|
|
63451
63640
|
/* harmony export */ "checkSigCryptoKey": () => (/* binding */ checkSigCryptoKey)
|
|
63452
63641
|
/* harmony export */ });
|
|
63453
|
-
/* harmony import */ var _runtime_env_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/env.js */ "./node_modules/jose/dist/browser/runtime/env.js");
|
|
63454
|
-
|
|
63455
63642
|
function unusable(name, prop = 'algorithm.name') {
|
|
63456
63643
|
return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
|
|
63457
63644
|
}
|
|
@@ -63526,11 +63713,6 @@ function checkSigCryptoKey(key, alg, ...usages) {
|
|
|
63526
63713
|
}
|
|
63527
63714
|
case 'EdDSA': {
|
|
63528
63715
|
if (key.algorithm.name !== 'Ed25519' && key.algorithm.name !== 'Ed448') {
|
|
63529
|
-
if ((0,_runtime_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
63530
|
-
if (isAlgorithm(key.algorithm, 'NODE-ED25519'))
|
|
63531
|
-
break;
|
|
63532
|
-
throw unusable('Ed25519, Ed448, or NODE-ED25519');
|
|
63533
|
-
}
|
|
63534
63716
|
throw unusable('Ed25519 or Ed448');
|
|
63535
63717
|
}
|
|
63536
63718
|
break;
|
|
@@ -64361,14 +64543,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
64361
64543
|
/* harmony export */ "toPKCS8": () => (/* binding */ toPKCS8),
|
|
64362
64544
|
/* harmony export */ "toSPKI": () => (/* binding */ toSPKI)
|
|
64363
64545
|
/* harmony export */ });
|
|
64364
|
-
/* harmony import */ var
|
|
64365
|
-
/* harmony import */ var
|
|
64366
|
-
/* harmony import */ var
|
|
64367
|
-
/* harmony import */ var
|
|
64368
|
-
/* harmony import */ var
|
|
64369
|
-
/* harmony import */ var
|
|
64370
|
-
/* harmony import */ var _is_key_like_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./is_key_like.js */ "./node_modules/jose/dist/browser/runtime/is_key_like.js");
|
|
64371
|
-
|
|
64546
|
+
/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js");
|
|
64547
|
+
/* harmony import */ var _lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/invalid_key_input.js */ "./node_modules/jose/dist/browser/lib/invalid_key_input.js");
|
|
64548
|
+
/* harmony import */ var _base64url_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js");
|
|
64549
|
+
/* harmony import */ var _lib_format_pem_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lib/format_pem.js */ "./node_modules/jose/dist/browser/lib/format_pem.js");
|
|
64550
|
+
/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
|
|
64551
|
+
/* harmony import */ var _is_key_like_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./is_key_like.js */ "./node_modules/jose/dist/browser/runtime/is_key_like.js");
|
|
64372
64552
|
|
|
64373
64553
|
|
|
64374
64554
|
|
|
@@ -64376,8 +64556,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
64376
64556
|
|
|
64377
64557
|
|
|
64378
64558
|
const genericExport = async (keyType, keyFormat, key) => {
|
|
64379
|
-
if (!(0,
|
|
64380
|
-
throw new TypeError((0,
|
|
64559
|
+
if (!(0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_0__.isCryptoKey)(key)) {
|
|
64560
|
+
throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_1__["default"])(key, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_5__.types));
|
|
64381
64561
|
}
|
|
64382
64562
|
if (!key.extractable) {
|
|
64383
64563
|
throw new TypeError('CryptoKey is not extractable');
|
|
@@ -64385,7 +64565,7 @@ const genericExport = async (keyType, keyFormat, key) => {
|
|
|
64385
64565
|
if (key.type !== keyType) {
|
|
64386
64566
|
throw new TypeError(`key is not a ${keyType} key`);
|
|
64387
64567
|
}
|
|
64388
|
-
return (0,
|
|
64568
|
+
return (0,_lib_format_pem_js__WEBPACK_IMPORTED_MODULE_3__["default"])((0,_base64url_js__WEBPACK_IMPORTED_MODULE_2__.encodeBase64)(new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.exportKey(keyFormat, key))), `${keyType.toUpperCase()} KEY`);
|
|
64389
64569
|
};
|
|
64390
64570
|
const toSPKI = (key) => {
|
|
64391
64571
|
return genericExport('public', 'spki', key);
|
|
@@ -64423,11 +64603,11 @@ const getNamedCurve = (keyData) => {
|
|
|
64423
64603
|
case findOid(keyData, [0x2b, 0x65, 0x71]):
|
|
64424
64604
|
return 'Ed448';
|
|
64425
64605
|
default:
|
|
64426
|
-
throw new
|
|
64606
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_4__.JOSENotSupported('Invalid or unsupported EC Key Curve or OKP Key Sub Type');
|
|
64427
64607
|
}
|
|
64428
64608
|
};
|
|
64429
64609
|
const genericImport = async (replace, keyFormat, pem, alg, options) => {
|
|
64430
|
-
var _a
|
|
64610
|
+
var _a;
|
|
64431
64611
|
let algorithm;
|
|
64432
64612
|
let keyUsages;
|
|
64433
64613
|
const keyData = new Uint8Array(atob(pem.replace(replace, ''))
|
|
@@ -64483,20 +64663,9 @@ const genericImport = async (replace, keyFormat, pem, alg, options) => {
|
|
|
64483
64663
|
keyUsages = isPublic ? ['verify'] : ['sign'];
|
|
64484
64664
|
break;
|
|
64485
64665
|
default:
|
|
64486
|
-
throw new
|
|
64487
|
-
}
|
|
64488
|
-
try {
|
|
64489
|
-
return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey(keyFormat, keyData, algorithm, (_a = options === null || options === void 0 ? void 0 : options.extractable) !== null && _a !== void 0 ? _a : false, keyUsages);
|
|
64490
|
-
}
|
|
64491
|
-
catch (err) {
|
|
64492
|
-
if (algorithm.name === 'Ed25519' &&
|
|
64493
|
-
(err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
|
|
64494
|
-
(0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
64495
|
-
algorithm = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
64496
|
-
return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey(keyFormat, keyData, algorithm, (_b = options === null || options === void 0 ? void 0 : options.extractable) !== null && _b !== void 0 ? _b : false, keyUsages);
|
|
64497
|
-
}
|
|
64498
|
-
throw err;
|
|
64666
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_4__.JOSENotSupported('Invalid or unsupported "alg" (Algorithm) value');
|
|
64499
64667
|
}
|
|
64668
|
+
return _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.importKey(keyFormat, keyData, algorithm, (_a = options === null || options === void 0 ? void 0 : options.extractable) !== null && _a !== void 0 ? _a : false, keyUsages);
|
|
64500
64669
|
};
|
|
64501
64670
|
const fromPKCS8 = (pem, alg, options) => {
|
|
64502
64671
|
return genericImport(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g, 'pkcs8', pem, alg, options);
|
|
@@ -64565,12 +64734,12 @@ function parseElement(bytes) {
|
|
|
64565
64734
|
}
|
|
64566
64735
|
function spkiFromX509(buf) {
|
|
64567
64736
|
const tbsCertificate = getElement(getElement(parseElement(buf).contents)[0].contents);
|
|
64568
|
-
return (0,
|
|
64737
|
+
return (0,_base64url_js__WEBPACK_IMPORTED_MODULE_2__.encodeBase64)(tbsCertificate[tbsCertificate[0].raw[0] === 0xa0 ? 6 : 5].raw);
|
|
64569
64738
|
}
|
|
64570
64739
|
function getSPKI(x509) {
|
|
64571
64740
|
const pem = x509.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g, '');
|
|
64572
|
-
const raw = (0,
|
|
64573
|
-
return (0,
|
|
64741
|
+
const raw = (0,_base64url_js__WEBPACK_IMPORTED_MODULE_2__.decodeBase64)(pem);
|
|
64742
|
+
return (0,_lib_format_pem_js__WEBPACK_IMPORTED_MODULE_3__["default"])(spkiFromX509(raw), 'PUBLIC KEY');
|
|
64574
64743
|
}
|
|
64575
64744
|
const fromX509 = (pem, alg, options) => {
|
|
64576
64745
|
let spki;
|
|
@@ -64998,26 +65167,6 @@ const encrypt = async (enc, plaintext, cek, iv, aad) => {
|
|
|
64998
65167
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (encrypt);
|
|
64999
65168
|
|
|
65000
65169
|
|
|
65001
|
-
/***/ }),
|
|
65002
|
-
|
|
65003
|
-
/***/ "./node_modules/jose/dist/browser/runtime/env.js":
|
|
65004
|
-
/*!*******************************************************!*\
|
|
65005
|
-
!*** ./node_modules/jose/dist/browser/runtime/env.js ***!
|
|
65006
|
-
\*******************************************************/
|
|
65007
|
-
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
65008
|
-
|
|
65009
|
-
"use strict";
|
|
65010
|
-
__webpack_require__.r(__webpack_exports__);
|
|
65011
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
65012
|
-
/* harmony export */ "isCloudflareWorkers": () => (/* binding */ isCloudflareWorkers)
|
|
65013
|
-
/* harmony export */ });
|
|
65014
|
-
function isCloudflareWorkers() {
|
|
65015
|
-
return (typeof WebSocketPair !== 'undefined' ||
|
|
65016
|
-
(typeof navigator !== 'undefined' && navigator.userAgent === 'Cloudflare-Workers') ||
|
|
65017
|
-
(typeof EdgeRuntime !== 'undefined' && EdgeRuntime === 'vercel'));
|
|
65018
|
-
}
|
|
65019
|
-
|
|
65020
|
-
|
|
65021
65170
|
/***/ }),
|
|
65022
65171
|
|
|
65023
65172
|
/***/ "./node_modules/jose/dist/browser/runtime/fetch_jwks.js":
|
|
@@ -65082,11 +65231,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
65082
65231
|
/* harmony export */ "generateKeyPair": () => (/* binding */ generateKeyPair),
|
|
65083
65232
|
/* harmony export */ "generateSecret": () => (/* binding */ generateSecret)
|
|
65084
65233
|
/* harmony export */ });
|
|
65085
|
-
/* harmony import */ var
|
|
65086
|
-
/* harmony import */ var
|
|
65087
|
-
/* harmony import */ var
|
|
65088
|
-
/* harmony import */ var _random_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./random.js */ "./node_modules/jose/dist/browser/runtime/random.js");
|
|
65089
|
-
|
|
65234
|
+
/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js");
|
|
65235
|
+
/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
|
|
65236
|
+
/* harmony import */ var _random_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./random.js */ "./node_modules/jose/dist/browser/runtime/random.js");
|
|
65090
65237
|
|
|
65091
65238
|
|
|
65092
65239
|
|
|
@@ -65107,7 +65254,7 @@ async function generateSecret(alg, options) {
|
|
|
65107
65254
|
case 'A192CBC-HS384':
|
|
65108
65255
|
case 'A256CBC-HS512':
|
|
65109
65256
|
length = parseInt(alg.slice(-3), 10);
|
|
65110
|
-
return (0,
|
|
65257
|
+
return (0,_random_js__WEBPACK_IMPORTED_MODULE_2__["default"])(new Uint8Array(length >> 3));
|
|
65111
65258
|
case 'A128KW':
|
|
65112
65259
|
case 'A192KW':
|
|
65113
65260
|
case 'A256KW':
|
|
@@ -65126,20 +65273,20 @@ async function generateSecret(alg, options) {
|
|
|
65126
65273
|
keyUsages = ['encrypt', 'decrypt'];
|
|
65127
65274
|
break;
|
|
65128
65275
|
default:
|
|
65129
|
-
throw new
|
|
65276
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
65130
65277
|
}
|
|
65131
|
-
return
|
|
65278
|
+
return _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.generateKey(algorithm, (_a = options === null || options === void 0 ? void 0 : options.extractable) !== null && _a !== void 0 ? _a : false, keyUsages);
|
|
65132
65279
|
}
|
|
65133
65280
|
function getModulusLengthOption(options) {
|
|
65134
65281
|
var _a;
|
|
65135
65282
|
const modulusLength = (_a = options === null || options === void 0 ? void 0 : options.modulusLength) !== null && _a !== void 0 ? _a : 2048;
|
|
65136
65283
|
if (typeof modulusLength !== 'number' || modulusLength < 2048) {
|
|
65137
|
-
throw new
|
|
65284
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used');
|
|
65138
65285
|
}
|
|
65139
65286
|
return modulusLength;
|
|
65140
65287
|
}
|
|
65141
65288
|
async function generateKeyPair(alg, options) {
|
|
65142
|
-
var _a, _b, _c
|
|
65289
|
+
var _a, _b, _c;
|
|
65143
65290
|
let algorithm;
|
|
65144
65291
|
let keyUsages;
|
|
65145
65292
|
switch (alg) {
|
|
@@ -65198,7 +65345,7 @@ async function generateKeyPair(alg, options) {
|
|
|
65198
65345
|
algorithm = { name: crv };
|
|
65199
65346
|
break;
|
|
65200
65347
|
default:
|
|
65201
|
-
throw new
|
|
65348
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported crv option provided');
|
|
65202
65349
|
}
|
|
65203
65350
|
break;
|
|
65204
65351
|
case 'ECDH-ES':
|
|
@@ -65219,25 +65366,14 @@ async function generateKeyPair(alg, options) {
|
|
|
65219
65366
|
algorithm = { name: crv };
|
|
65220
65367
|
break;
|
|
65221
65368
|
default:
|
|
65222
|
-
throw new
|
|
65369
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448');
|
|
65223
65370
|
}
|
|
65224
65371
|
break;
|
|
65225
65372
|
}
|
|
65226
65373
|
default:
|
|
65227
|
-
throw new
|
|
65228
|
-
}
|
|
65229
|
-
try {
|
|
65230
|
-
return (await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.generateKey(algorithm, (_c = options === null || options === void 0 ? void 0 : options.extractable) !== null && _c !== void 0 ? _c : false, keyUsages));
|
|
65231
|
-
}
|
|
65232
|
-
catch (err) {
|
|
65233
|
-
if (algorithm.name === 'Ed25519' &&
|
|
65234
|
-
(err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
|
|
65235
|
-
(0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
65236
|
-
algorithm = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
65237
|
-
return (await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.generateKey(algorithm, (_d = options === null || options === void 0 ? void 0 : options.extractable) !== null && _d !== void 0 ? _d : false, keyUsages));
|
|
65238
|
-
}
|
|
65239
|
-
throw err;
|
|
65374
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
65240
65375
|
}
|
|
65376
|
+
return (_webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.generateKey(algorithm, (_c = options === null || options === void 0 ? void 0 : options.extractable) !== null && _c !== void 0 ? _c : false, keyUsages));
|
|
65241
65377
|
}
|
|
65242
65378
|
|
|
65243
65379
|
|
|
@@ -65312,11 +65448,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
65312
65448
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
65313
65449
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
65314
65450
|
/* harmony export */ });
|
|
65315
|
-
/* harmony import */ var
|
|
65316
|
-
/* harmony import */ var
|
|
65317
|
-
/* harmony import */ var
|
|
65318
|
-
/* harmony import */ var _base64url_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js");
|
|
65319
|
-
|
|
65451
|
+
/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js");
|
|
65452
|
+
/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
|
|
65453
|
+
/* harmony import */ var _base64url_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js");
|
|
65320
65454
|
|
|
65321
65455
|
|
|
65322
65456
|
|
|
@@ -65335,7 +65469,7 @@ function subtleMapping(jwk) {
|
|
|
65335
65469
|
case 'A128CBC-HS256':
|
|
65336
65470
|
case 'A192CBC-HS384':
|
|
65337
65471
|
case 'A256CBC-HS512':
|
|
65338
|
-
throw new
|
|
65472
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported(`${jwk.alg} keys cannot be imported as CryptoKey instances`);
|
|
65339
65473
|
case 'A128GCM':
|
|
65340
65474
|
case 'A192GCM':
|
|
65341
65475
|
case 'A256GCM':
|
|
@@ -65358,7 +65492,7 @@ function subtleMapping(jwk) {
|
|
|
65358
65492
|
keyUsages = ['deriveBits'];
|
|
65359
65493
|
break;
|
|
65360
65494
|
default:
|
|
65361
|
-
throw new
|
|
65495
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
65362
65496
|
}
|
|
65363
65497
|
break;
|
|
65364
65498
|
}
|
|
@@ -65387,7 +65521,7 @@ function subtleMapping(jwk) {
|
|
|
65387
65521
|
keyUsages = jwk.d ? ['decrypt', 'unwrapKey'] : ['encrypt', 'wrapKey'];
|
|
65388
65522
|
break;
|
|
65389
65523
|
default:
|
|
65390
|
-
throw new
|
|
65524
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
65391
65525
|
}
|
|
65392
65526
|
break;
|
|
65393
65527
|
}
|
|
@@ -65413,7 +65547,7 @@ function subtleMapping(jwk) {
|
|
|
65413
65547
|
keyUsages = jwk.d ? ['deriveBits'] : [];
|
|
65414
65548
|
break;
|
|
65415
65549
|
default:
|
|
65416
|
-
throw new
|
|
65550
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
65417
65551
|
}
|
|
65418
65552
|
break;
|
|
65419
65553
|
}
|
|
@@ -65431,12 +65565,12 @@ function subtleMapping(jwk) {
|
|
|
65431
65565
|
keyUsages = jwk.d ? ['deriveBits'] : [];
|
|
65432
65566
|
break;
|
|
65433
65567
|
default:
|
|
65434
|
-
throw new
|
|
65568
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
65435
65569
|
}
|
|
65436
65570
|
break;
|
|
65437
65571
|
}
|
|
65438
65572
|
default:
|
|
65439
|
-
throw new
|
|
65573
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
|
|
65440
65574
|
}
|
|
65441
65575
|
return { algorithm, keyUsages };
|
|
65442
65576
|
}
|
|
@@ -65452,23 +65586,12 @@ const parse = async (jwk) => {
|
|
|
65452
65586
|
(_b = jwk.key_ops) !== null && _b !== void 0 ? _b : keyUsages,
|
|
65453
65587
|
];
|
|
65454
65588
|
if (algorithm.name === 'PBKDF2') {
|
|
65455
|
-
return
|
|
65589
|
+
return _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.importKey('raw', (0,_base64url_js__WEBPACK_IMPORTED_MODULE_2__.decode)(jwk.k), ...rest);
|
|
65456
65590
|
}
|
|
65457
65591
|
const keyData = { ...jwk };
|
|
65458
65592
|
delete keyData.alg;
|
|
65459
65593
|
delete keyData.use;
|
|
65460
|
-
|
|
65461
|
-
return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey('jwk', keyData, ...rest);
|
|
65462
|
-
}
|
|
65463
|
-
catch (err) {
|
|
65464
|
-
if (algorithm.name === 'Ed25519' &&
|
|
65465
|
-
(err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
|
|
65466
|
-
(0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
65467
|
-
rest[0] = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
65468
|
-
return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey('jwk', keyData, ...rest);
|
|
65469
|
-
}
|
|
65470
|
-
throw err;
|
|
65471
|
-
}
|
|
65594
|
+
return _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.importKey('jwk', keyData, ...rest);
|
|
65472
65595
|
};
|
|
65473
65596
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (parse);
|
|
65474
65597
|
|
|
@@ -65710,9 +65833,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
65710
65833
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
65711
65834
|
/* harmony export */ "default": () => (/* binding */ subtleDsa)
|
|
65712
65835
|
/* harmony export */ });
|
|
65713
|
-
/* harmony import */ var
|
|
65714
|
-
/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
|
|
65715
|
-
|
|
65836
|
+
/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
|
|
65716
65837
|
|
|
65717
65838
|
function subtleDsa(alg, algorithm) {
|
|
65718
65839
|
const hash = `SHA-${alg.slice(-3)}`;
|
|
@@ -65734,12 +65855,9 @@ function subtleDsa(alg, algorithm) {
|
|
|
65734
65855
|
case 'ES512':
|
|
65735
65856
|
return { hash, name: 'ECDSA', namedCurve: algorithm.namedCurve };
|
|
65736
65857
|
case 'EdDSA':
|
|
65737
|
-
if ((0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)() && algorithm.name === 'NODE-ED25519') {
|
|
65738
|
-
return { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
65739
|
-
}
|
|
65740
65858
|
return { name: algorithm.name };
|
|
65741
65859
|
default:
|
|
65742
|
-
throw new
|
|
65860
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
65743
65861
|
}
|
|
65744
65862
|
}
|
|
65745
65863
|
|