solid-ui 2.4.27-2910a831 → 2.4.27-2b3a51cb
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 +662 -381
- 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 +188 -46
- package/lib/chat/keys.js.map +1 -1
- package/lib/chat/message.js +54 -33
- 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 +209 -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 -114
- 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,68 +4053,209 @@ function generatePrivateKey() {
|
|
|
4052
4053
|
function generatePublicKey(privateKey) {
|
|
4053
4054
|
return (0, _utils.bytesToHex)(_secp256k.schnorr.getPublicKey(privateKey));
|
|
4054
4055
|
}
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
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
|
+
*/
|
|
4064
|
+
function getPublicKey(_x) {
|
|
4065
|
+
return _getPublicKey.apply(this, arguments);
|
|
4066
|
+
}
|
|
4067
|
+
function _getPublicKey() {
|
|
4068
|
+
_getPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
|
|
4069
|
+
var publicKeyDoc, key;
|
|
4070
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
4071
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
4072
|
+
case 0:
|
|
4073
|
+
_context2.next = 2;
|
|
4074
|
+
return _solidLogic.store.fetcher.load(webId);
|
|
4075
|
+
case 2:
|
|
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;
|
|
4082
|
+
return _solidLogic.store.fetcher.load(publicKeyDoc);
|
|
4083
|
+
case 8:
|
|
4084
|
+
// url.href)
|
|
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:
|
|
4092
|
+
case "end":
|
|
4093
|
+
return _context2.stop();
|
|
4094
|
+
}
|
|
4095
|
+
}, _callee2, null, [[5, 12]]);
|
|
4096
|
+
}));
|
|
4097
|
+
return _getPublicKey.apply(this, arguments);
|
|
4058
4098
|
}
|
|
4059
|
-
function getPrivateKey(
|
|
4099
|
+
function getPrivateKey(_x2) {
|
|
4060
4100
|
return _getPrivateKey.apply(this, arguments);
|
|
4061
4101
|
}
|
|
4062
4102
|
function _getPrivateKey() {
|
|
4063
|
-
_getPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4064
|
-
var
|
|
4065
|
-
return _regenerator["default"].wrap(function
|
|
4066
|
-
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) {
|
|
4067
4107
|
case 0:
|
|
4068
|
-
|
|
4069
|
-
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
_context.next = 4;
|
|
4074
|
-
return (0, _cryptoKeyHelpers.publicKeyExists)(webId);
|
|
4108
|
+
_context3.next = 2;
|
|
4109
|
+
return _solidLogic.store.fetcher.load(webId);
|
|
4110
|
+
case 2:
|
|
4111
|
+
_context3.next = 4;
|
|
4112
|
+
return (0, _accessData.pubKeyUrl)(webId);
|
|
4075
4113
|
case 4:
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
return (0,
|
|
4114
|
+
publicKeyDoc = _context3.sent;
|
|
4115
|
+
_context3.next = 7;
|
|
4116
|
+
return (0, _accessData.privKeyUrl)(webId);
|
|
4079
4117
|
case 7:
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
|
|
4085
|
-
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
if (
|
|
4092
|
-
|
|
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;
|
|
4127
|
+
// is publicKey valid ?
|
|
4128
|
+
validPublicKey = true;
|
|
4129
|
+
if (privateKey && publicKey !== generatePublicKey(privateKey)) {
|
|
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;
|
|
4131
|
+
}
|
|
4132
|
+
|
|
4133
|
+
// create key pair or repair publicKey
|
|
4134
|
+
if (!(!privateKey || !publicKey || !validPublicKey)) {
|
|
4135
|
+
_context3.next = 34;
|
|
4093
4136
|
break;
|
|
4094
4137
|
}
|
|
4095
4138
|
del = [];
|
|
4096
|
-
add = [];
|
|
4097
|
-
if (privateKey)
|
|
4098
|
-
|
|
4139
|
+
add = []; // if (privateKey) del.push($rdf.st(webId, store.sym(CERT + 'PrivateKey'), $rdf.lit(privateKey), store.sym(privateKeyDoc)))
|
|
4140
|
+
if (privateKey) {
|
|
4141
|
+
_context3.next = 24;
|
|
4142
|
+
break;
|
|
4143
|
+
}
|
|
4144
|
+
// add = []
|
|
4099
4145
|
privateKey = generatePrivateKey();
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
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:
|
|
4150
|
+
if (!(!publicKey || !validPublicKey)) {
|
|
4151
|
+
_context3.next = 31;
|
|
4152
|
+
break;
|
|
4153
|
+
}
|
|
4154
|
+
del = [];
|
|
4155
|
+
// delete invalid public key
|
|
4156
|
+
if (publicKey) {
|
|
4157
|
+
del = [$rdf.st(webId, _solidLogic.store.sym(_signature.CERT + 'PublicKey'), $rdf.lit(publicKey), _solidLogic.store.sym(publicKeyDoc))];
|
|
4158
|
+
debug.log(del);
|
|
4159
|
+
}
|
|
4160
|
+
// update new valid key
|
|
4161
|
+
newPublicKey = generatePublicKey(privateKey);
|
|
4162
|
+
add = [$rdf.st(webId, _solidLogic.store.sym(_signature.CERT + 'PublicKey'), $rdf.literal(newPublicKey), _solidLogic.store.sym(publicKeyDoc))];
|
|
4163
|
+
_context3.next = 31;
|
|
4164
|
+
return saveKey(publicKeyDoc, del, add);
|
|
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:
|
|
4110
4172
|
case "end":
|
|
4111
|
-
return
|
|
4173
|
+
return _context3.stop();
|
|
4112
4174
|
}
|
|
4113
|
-
},
|
|
4175
|
+
}, _callee3);
|
|
4114
4176
|
}));
|
|
4115
4177
|
return _getPrivateKey.apply(this, arguments);
|
|
4116
4178
|
}
|
|
4179
|
+
var deleteKeyAcl = /*#__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 deleteKeyAcl(_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
|
+
*/
|
|
4228
|
+
function saveKey(_x4, _x5, _x6) {
|
|
4229
|
+
return _saveKey.apply(this, arguments);
|
|
4230
|
+
}
|
|
4231
|
+
function _saveKey() {
|
|
4232
|
+
_saveKey = (0, _asyncToGenerator2["default"])(function (keyDoc, del, add) {
|
|
4233
|
+
var me = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
|
4234
|
+
return /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
4235
|
+
var aclBody;
|
|
4236
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
4237
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
4238
|
+
case 0:
|
|
4239
|
+
_context4.next = 2;
|
|
4240
|
+
return deleteKeyAcl(keyDoc);
|
|
4241
|
+
case 2:
|
|
4242
|
+
_context4.next = 4;
|
|
4243
|
+
return _solidLogic.store.updater.updateMany(del, add);
|
|
4244
|
+
case 4:
|
|
4245
|
+
// or a promise store.updater.update ?
|
|
4246
|
+
// create READ only ACL
|
|
4247
|
+
aclBody = (0, _acl.keyAclBody)(keyDoc, me);
|
|
4248
|
+
_context4.next = 7;
|
|
4249
|
+
return (0, _acl.setAcl)(keyDoc, aclBody);
|
|
4250
|
+
case 7:
|
|
4251
|
+
case "end":
|
|
4252
|
+
return _context4.stop();
|
|
4253
|
+
}
|
|
4254
|
+
}, _callee4);
|
|
4255
|
+
})();
|
|
4256
|
+
});
|
|
4257
|
+
return _saveKey.apply(this, arguments);
|
|
4258
|
+
}
|
|
4117
4259
|
//# sourceMappingURL=keys.js.map
|
|
4118
4260
|
|
|
4119
4261
|
/***/ }),
|
|
@@ -4166,7 +4308,11 @@ var messageBodyStyle = style.messageBodyStyle;
|
|
|
4166
4308
|
var label = utils.label;
|
|
4167
4309
|
|
|
4168
4310
|
/**
|
|
4311
|
+
* elementForImageURI
|
|
4169
4312
|
* HTML component for an image
|
|
4313
|
+
* @param imageUri
|
|
4314
|
+
* @param options { inlineImageHeightEms }
|
|
4315
|
+
* @returns HTMLAnchorElement For Image
|
|
4170
4316
|
*/
|
|
4171
4317
|
function elementForImageURI(imageUri, options) {
|
|
4172
4318
|
var img = dom.createElement('img');
|
|
@@ -4196,21 +4342,27 @@ var anchor = function anchor(text, term) {
|
|
|
4196
4342
|
a.textContent = text;
|
|
4197
4343
|
return a;
|
|
4198
4344
|
};
|
|
4199
|
-
function
|
|
4345
|
+
function nickname(person) {
|
|
4200
4346
|
var s = _solidLogic.store.any(person, ns.foaf('nick'));
|
|
4201
4347
|
if (s) return '' + s.value;
|
|
4202
4348
|
return '' + label(person);
|
|
4203
4349
|
}
|
|
4204
4350
|
|
|
4205
4351
|
/**
|
|
4352
|
+
* creatorAndDate
|
|
4206
4353
|
* Displays creator and date for a chat message
|
|
4207
4354
|
* inside the `td1` element
|
|
4355
|
+
* @param td1
|
|
4356
|
+
* @param creator
|
|
4357
|
+
* @param date
|
|
4358
|
+
* @param message
|
|
4359
|
+
* @returns HTMLAnchorElement For Image
|
|
4208
4360
|
*/
|
|
4209
4361
|
function creatorAndDate(td1, creator, date, message) {
|
|
4210
|
-
var nickAnchor = td1.appendChild(anchor(
|
|
4362
|
+
var nickAnchor = td1.appendChild(anchor(nickname(creator), creator));
|
|
4211
4363
|
if (creator.uri) {
|
|
4212
4364
|
_solidLogic.store.fetcher.nowOrWhenFetched(creator.doc(), undefined, function (_ok, _body) {
|
|
4213
|
-
nickAnchor.textContent =
|
|
4365
|
+
nickAnchor.textContent = nickname(creator);
|
|
4214
4366
|
});
|
|
4215
4367
|
}
|
|
4216
4368
|
td1.appendChild(dom.createElement('br'));
|
|
@@ -4218,14 +4370,20 @@ function creatorAndDate(td1, creator, date, message) {
|
|
|
4218
4370
|
}
|
|
4219
4371
|
|
|
4220
4372
|
/**
|
|
4373
|
+
* creatorAndDateHorizontal
|
|
4221
4374
|
* Horizontally displays creator and date for a chat message
|
|
4222
4375
|
* inside the `td1` element
|
|
4376
|
+
* @param td1
|
|
4377
|
+
* @param creator
|
|
4378
|
+
* @param date
|
|
4379
|
+
* @param message
|
|
4380
|
+
* @returns HTMLAnchorElement For Image
|
|
4223
4381
|
*/
|
|
4224
4382
|
function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
4225
4383
|
var nickAnchor = td1.appendChild(anchor(label(creator), creator));
|
|
4226
4384
|
if (creator.uri) {
|
|
4227
4385
|
_solidLogic.store.fetcher.nowOrWhenFetched(creator.doc(), undefined, function (_ok, _body) {
|
|
4228
|
-
nickAnchor.textContent =
|
|
4386
|
+
nickAnchor.textContent = nickname(creator);
|
|
4229
4387
|
});
|
|
4230
4388
|
}
|
|
4231
4389
|
var dateBit = td1.appendChild(anchor(date, message));
|
|
@@ -4235,58 +4393,62 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
|
4235
4393
|
}
|
|
4236
4394
|
|
|
4237
4395
|
/**
|
|
4396
|
+
* renderMessageRow
|
|
4238
4397
|
* Renders a chat message, read-only mode
|
|
4398
|
+
* @param channelObject
|
|
4399
|
+
* @param message
|
|
4400
|
+
* @param fresh
|
|
4401
|
+
* @param options
|
|
4402
|
+
* @param userContext
|
|
4403
|
+
* @returns Message Row HTML Table Element
|
|
4239
4404
|
*/
|
|
4240
4405
|
function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
4406
|
+
var unsignedMessage = false;
|
|
4241
4407
|
var colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
|
|
4408
|
+
debug.log('HELLOOOOO SI am here using this render');
|
|
4242
4409
|
var creator = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
4243
4410
|
var date = _solidLogic.store.any(message, ns.dct('created'));
|
|
4244
4411
|
var latestVersion = (0, _chatLogic.mostRecentVersion)(message);
|
|
4245
4412
|
var latestVersionCreator = _solidLogic.store.any(latestVersion, ns.foaf('maker'));
|
|
4413
|
+
|
|
4246
4414
|
// use latest content if same owner, else use original
|
|
4247
4415
|
var msgId = creator.uri === latestVersionCreator.uri ? latestVersion : message;
|
|
4248
4416
|
var content = _solidLogic.store.any(msgId, ns.sioc('content'));
|
|
4249
4417
|
var signature = _solidLogic.store.any(msgId, $rdf.sym("".concat(_signature.SEC, "Proof")));
|
|
4250
|
-
debug.log('alain ' + (signature === null || signature === void 0 ? void 0 : signature.value));
|
|
4251
4418
|
|
|
4252
|
-
//
|
|
4419
|
+
// set message object
|
|
4253
4420
|
var msg = (0, _signature.getBlankMsg)();
|
|
4254
4421
|
msg.id = msgId.uri;
|
|
4255
4422
|
msg.created = _solidLogic.store.any(msgId, ns.dct('created')).value;
|
|
4256
4423
|
msg.content = content.value;
|
|
4257
4424
|
msg.maker = creator.uri;
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
// unsigned messages should be signaled as unsecured
|
|
4279
|
-
debug.warn(msg)
|
|
4280
|
-
debug.warn(signature?.value) */
|
|
4281
|
-
if (signature !== null && signature !== void 0 && signature.value && !(0, _signature.verifySignature)(signature.value, msg, pubKey)) throw new Error('invalid signature');
|
|
4282
|
-
} catch (err) {
|
|
4283
|
-
debug.log(err);
|
|
4425
|
+
|
|
4426
|
+
// unsigned message
|
|
4427
|
+
if (!(signature !== null && signature !== void 0 && signature.value)) {
|
|
4428
|
+
unsignedMessage = true;
|
|
4429
|
+
debug.warn(msgId.uri + ' is unsigned'); // TODO replace with UI (colored message ?)
|
|
4430
|
+
} else {
|
|
4431
|
+
// signed message, get public key and check signature
|
|
4432
|
+
(0, _keys.getPublicKey)(creator).then(function (publicKey) {
|
|
4433
|
+
debug.log(creator.uri + '\n' + msg.created + '\n' + msg.id + '\n' + publicKey);
|
|
4434
|
+
if (!publicKey) {
|
|
4435
|
+
// TODO try to recreate the publicKey
|
|
4436
|
+
// if(me.uri === creator.uri) await getPrivateKey(creator)
|
|
4437
|
+
debug.warn('message is signed but ' + creator.uri + ' is missing publicKey');
|
|
4438
|
+
}
|
|
4439
|
+
// check that publicKey is a valid hex string
|
|
4440
|
+
var regex = /[0-9A-Fa-f]{6}/g;
|
|
4441
|
+
if (!(publicKey !== null && publicKey !== void 0 && publicKey.match(regex))) debug.warn('invalid publicKey hex string\n' + creator.uri + '\n' + publicKey);
|
|
4442
|
+
// verify signature
|
|
4443
|
+
else if (signature !== null && signature !== void 0 && signature.value && !(0, _signature.verifySignature)(signature === null || signature === void 0 ? void 0 : signature.value, msg, publicKey)) debug.warn('invalid signature\n' + msg.id);
|
|
4444
|
+
});
|
|
4284
4445
|
}
|
|
4285
4446
|
var originalMessage = (0, _chatLogic.originalVersion)(message);
|
|
4286
4447
|
var edited = !message.sameTerm(originalMessage);
|
|
4287
4448
|
var sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()); // In message
|
|
4288
4449
|
|
|
4289
4450
|
var messageRow = dom.createElement('tr');
|
|
4451
|
+
if (unsignedMessage) messageRow.setAttribute('style', 'background-color: red');
|
|
4290
4452
|
messageRow.AJAR_date = sortDate.value;
|
|
4291
4453
|
messageRow.AJAR_subject = message;
|
|
4292
4454
|
var td1 = dom.createElement('td');
|
|
@@ -4375,7 +4537,8 @@ function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
|
4375
4537
|
toolsTD.appendChild(tools);
|
|
4376
4538
|
});
|
|
4377
4539
|
return messageRow;
|
|
4378
|
-
}
|
|
4540
|
+
} // END OF RENDERMESSAGE
|
|
4541
|
+
|
|
4379
4542
|
function switchToEditor(messageRow, message, channelObject, userContext) {
|
|
4380
4543
|
var messageTable = messageRow.parentNode;
|
|
4381
4544
|
var editRow = renderMessageEditor(channelObject, messageTable, userContext, channelObject.options, (0, _chatLogic.mostRecentVersion)(message));
|
|
@@ -5075,13 +5238,11 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
5075
5238
|
value: true
|
|
5076
5239
|
}));
|
|
5077
5240
|
exports.SEC = exports.CERT = void 0;
|
|
5078
|
-
exports.finishMsg = finishMsg;
|
|
5079
5241
|
exports.getBlankMsg = getBlankMsg;
|
|
5080
5242
|
exports.getMsgHash = getMsgHash;
|
|
5081
5243
|
exports.serializeMsg = serializeMsg;
|
|
5082
5244
|
exports.signMsg = signMsg;
|
|
5083
5245
|
exports.utf8Encoder = exports.utf8Decoder = void 0;
|
|
5084
|
-
exports.validateMsg = validateMsg;
|
|
5085
5246
|
exports.verifySignature = verifySignature;
|
|
5086
5247
|
var _secp256k = __webpack_require__(/*! @noble/curves/secp256k1 */ "./node_modules/@noble/curves/secp256k1.js");
|
|
5087
5248
|
var _utils = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/@noble/hashes/utils.js");
|
|
@@ -5127,19 +5288,22 @@ function getBlankMsg() {
|
|
|
5127
5288
|
id: '',
|
|
5128
5289
|
created: '',
|
|
5129
5290
|
dateDeleted: '',
|
|
5291
|
+
// TODO to remove if not used
|
|
5130
5292
|
content: '',
|
|
5131
5293
|
maker: '',
|
|
5132
|
-
sig: ''
|
|
5294
|
+
sig: '' // TODO to remove if not used
|
|
5133
5295
|
};
|
|
5134
5296
|
}
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
message.
|
|
5140
|
-
message.
|
|
5141
|
-
|
|
5142
|
-
|
|
5297
|
+
|
|
5298
|
+
/* export function finishMsg (t: MsgTemplate, privateKey: string): Message {
|
|
5299
|
+
// to update to chat message triples
|
|
5300
|
+
const message = t as Message
|
|
5301
|
+
// message.pubkey = getPublicKey(privateKey)
|
|
5302
|
+
message.id = getMsgHash(message)
|
|
5303
|
+
message.sig = signMsg(message, privateKey)
|
|
5304
|
+
return message
|
|
5305
|
+
} */
|
|
5306
|
+
|
|
5143
5307
|
function serializeMsg(msg) {
|
|
5144
5308
|
// to update to chat messages triples
|
|
5145
5309
|
/* if (!validateMsg(msg))
|
|
@@ -5151,27 +5315,29 @@ function getMsgHash(message) {
|
|
|
5151
5315
|
var msgHash = (0, _sha.sha256)(utf8Encoder.encode(serializeMsg(message)));
|
|
5152
5316
|
return (0, _utils.bytesToHex)(msgHash);
|
|
5153
5317
|
}
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
function validateMsg(message) {
|
|
5158
|
-
|
|
5318
|
+
|
|
5319
|
+
// const isRecord = (obj: unknown): obj is Record<string, unknown> => obj instanceof Object
|
|
5320
|
+
|
|
5321
|
+
/* export function validateMsg<T> (message: T): message is T & UnsignedMsg {
|
|
5322
|
+
if (!isRecord(message)) return false
|
|
5159
5323
|
if (typeof message.kind !== 'number') return false
|
|
5160
5324
|
if (typeof message.content !== 'string') return false
|
|
5161
5325
|
if (typeof message.created_at !== 'number') return false
|
|
5162
5326
|
if (typeof message.pubkey !== 'string') return false
|
|
5163
5327
|
if (!message.pubkey.match(/^[a-f0-9]{64}$/)) return false
|
|
5164
|
-
|
|
5328
|
+
|
|
5329
|
+
if (!Array.isArray(message.tags)) return false
|
|
5165
5330
|
for (let i = 0; i < message.tags.length; i++) {
|
|
5166
5331
|
let tag = message.tags[i]
|
|
5167
5332
|
if (!Array.isArray(tag)) return false
|
|
5168
5333
|
for (let j = 0; j < tag.length; j++) {
|
|
5169
5334
|
if (typeof tag[j] === 'object') return false
|
|
5170
5335
|
}
|
|
5171
|
-
}
|
|
5336
|
+
}
|
|
5337
|
+
|
|
5338
|
+
return true
|
|
5339
|
+
} */
|
|
5172
5340
|
|
|
5173
|
-
return true;
|
|
5174
|
-
}
|
|
5175
5341
|
function verifySignature(sig, message, pubKey) {
|
|
5176
5342
|
return _secp256k.schnorr.verify(sig, getMsgHash(message), pubKey);
|
|
5177
5343
|
}
|
|
@@ -12382,130 +12548,6 @@ function isLight(x) {
|
|
|
12382
12548
|
|
|
12383
12549
|
/***/ }),
|
|
12384
12550
|
|
|
12385
|
-
/***/ "./lib/utils/cryptoKeyHelpers.js":
|
|
12386
|
-
/*!***************************************!*\
|
|
12387
|
-
!*** ./lib/utils/cryptoKeyHelpers.js ***!
|
|
12388
|
-
\***************************************/
|
|
12389
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12390
|
-
|
|
12391
|
-
"use strict";
|
|
12392
|
-
|
|
12393
|
-
|
|
12394
|
-
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
12395
|
-
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
12396
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
12397
|
-
value: true
|
|
12398
|
-
}));
|
|
12399
|
-
exports.privKeyUrl = void 0;
|
|
12400
|
-
exports.privateKeyExists = privateKeyExists;
|
|
12401
|
-
exports.pubKeyUrl = void 0;
|
|
12402
|
-
exports.publicKeyExists = publicKeyExists;
|
|
12403
|
-
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
12404
|
-
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
12405
|
-
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
12406
|
-
var _signature = __webpack_require__(/*! ../chat/signature */ "./lib/chat/signature.js");
|
|
12407
|
-
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
12408
|
-
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); }
|
|
12409
|
-
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; }
|
|
12410
|
-
var pubKeyUrl = function pubKeyUrl(webId) {
|
|
12411
|
-
var url = new URL(webId);
|
|
12412
|
-
var publicKeyUrl = url.origin + '/profile/keys/publicKey.ttl';
|
|
12413
|
-
return publicKeyUrl;
|
|
12414
|
-
};
|
|
12415
|
-
exports.pubKeyUrl = pubKeyUrl;
|
|
12416
|
-
function publicKeyExists(_x) {
|
|
12417
|
-
return _publicKeyExists.apply(this, arguments);
|
|
12418
|
-
}
|
|
12419
|
-
function _publicKeyExists() {
|
|
12420
|
-
_publicKeyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
|
|
12421
|
-
var publicKey;
|
|
12422
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
12423
|
-
while (1) switch (_context.prev = _context.next) {
|
|
12424
|
-
case 0:
|
|
12425
|
-
_context.next = 2;
|
|
12426
|
-
return _solidLogic.store.fetcher.load(pubKeyUrl(webId));
|
|
12427
|
-
case 2:
|
|
12428
|
-
// url.href)
|
|
12429
|
-
publicKey = _solidLogic.store.any(_solidLogic.store.sym(webId), _solidLogic.store.sym(_signature.CERT + 'PublicKey'));
|
|
12430
|
-
return _context.abrupt("return", publicKey === null || publicKey === void 0 ? void 0 : publicKey.value);
|
|
12431
|
-
case 4:
|
|
12432
|
-
case "end":
|
|
12433
|
-
return _context.stop();
|
|
12434
|
-
}
|
|
12435
|
-
}, _callee);
|
|
12436
|
-
}));
|
|
12437
|
-
return _publicKeyExists.apply(this, arguments);
|
|
12438
|
-
}
|
|
12439
|
-
var privKeyUrl = function privKeyUrl(webId) {
|
|
12440
|
-
var url = new URL(webId);
|
|
12441
|
-
var privateKeyUrl = url.origin + '/profile/keys/privateKey.ttl';
|
|
12442
|
-
return privateKeyUrl;
|
|
12443
|
-
};
|
|
12444
|
-
exports.privKeyUrl = privKeyUrl;
|
|
12445
|
-
function privateKeyExists(_x2) {
|
|
12446
|
-
return _privateKeyExists.apply(this, arguments);
|
|
12447
|
-
}
|
|
12448
|
-
function _privateKeyExists() {
|
|
12449
|
-
_privateKeyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
|
|
12450
|
-
var privateKeyUrl, privateKey, _err$response, data, contentType, response;
|
|
12451
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
12452
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
12453
|
-
case 0:
|
|
12454
|
-
/* const url = new URL(webId)
|
|
12455
|
-
const privateKeyUrl = url.protocol + '//' + url.host + '/profile/privateKey.ttl' */
|
|
12456
|
-
privateKeyUrl = privKeyUrl(webId);
|
|
12457
|
-
/* debug.warn('Alain privateKeyExists')
|
|
12458
|
-
debug.warn(webId)
|
|
12459
|
-
debug.warn(privateKeyUrl) */
|
|
12460
|
-
_context2.prev = 1;
|
|
12461
|
-
_context2.next = 4;
|
|
12462
|
-
return _solidLogic.store.fetcher.load(privateKeyUrl);
|
|
12463
|
-
case 4:
|
|
12464
|
-
privateKey = _solidLogic.store.any(_solidLogic.store.sym(webId), _solidLogic.store.sym(_signature.CERT + 'PrivateKey'));
|
|
12465
|
-
return _context2.abrupt("return", privateKey === null || privateKey === void 0 ? void 0 : privateKey.value);
|
|
12466
|
-
case 8:
|
|
12467
|
-
_context2.prev = 8;
|
|
12468
|
-
_context2.t0 = _context2["catch"](1);
|
|
12469
|
-
if (!((_context2.t0 === null || _context2.t0 === void 0 ? void 0 : (_err$response = _context2.t0.response) === null || _err$response === void 0 ? void 0 : _err$response.status) === 404)) {
|
|
12470
|
-
_context2.next = 25;
|
|
12471
|
-
break;
|
|
12472
|
-
}
|
|
12473
|
-
_context2.prev = 11;
|
|
12474
|
-
// create privateKey resource
|
|
12475
|
-
data = '';
|
|
12476
|
-
contentType = 'text/ttl';
|
|
12477
|
-
_context2.next = 16;
|
|
12478
|
-
return _solidLogic.store.fetcher.webOperation('PUT', privateKeyUrl, {
|
|
12479
|
-
data: data,
|
|
12480
|
-
contentType: contentType
|
|
12481
|
-
});
|
|
12482
|
-
case 16:
|
|
12483
|
-
response = _context2.sent;
|
|
12484
|
-
_context2.next = 23;
|
|
12485
|
-
break;
|
|
12486
|
-
case 19:
|
|
12487
|
-
_context2.prev = 19;
|
|
12488
|
-
_context2.t1 = _context2["catch"](11);
|
|
12489
|
-
debug.log('createIfNotExists doc FAILED: ' + privateKeyUrl + ': ' + _context2.t1);
|
|
12490
|
-
throw _context2.t1;
|
|
12491
|
-
case 23:
|
|
12492
|
-
delete _solidLogic.store.fetcher.requested[privateKeyUrl]; // delete cached 404 error
|
|
12493
|
-
return _context2.abrupt("return", undefined);
|
|
12494
|
-
case 25:
|
|
12495
|
-
debug.log('createIfNotExists doc FAILED: ' + privateKeyUrl + ': ' + _context2.t0);
|
|
12496
|
-
throw _context2.t0;
|
|
12497
|
-
case 27:
|
|
12498
|
-
case "end":
|
|
12499
|
-
return _context2.stop();
|
|
12500
|
-
}
|
|
12501
|
-
}, _callee2, null, [[1, 8], [11, 19]]);
|
|
12502
|
-
}));
|
|
12503
|
-
return _privateKeyExists.apply(this, arguments);
|
|
12504
|
-
}
|
|
12505
|
-
//# sourceMappingURL=cryptoKeyHelpers.js.map
|
|
12506
|
-
|
|
12507
|
-
/***/ }),
|
|
12508
|
-
|
|
12509
12551
|
/***/ "./lib/utils/headerFooterHelpers.js":
|
|
12510
12552
|
/*!******************************************!*\
|
|
12511
12553
|
!*** ./lib/utils/headerFooterHelpers.js ***!
|
|
@@ -13224,6 +13266,328 @@ function predParentOf(node) {
|
|
|
13224
13266
|
|
|
13225
13267
|
/***/ }),
|
|
13226
13268
|
|
|
13269
|
+
/***/ "./lib/utils/keyHelpers/accessData.js":
|
|
13270
|
+
/*!********************************************!*\
|
|
13271
|
+
!*** ./lib/utils/keyHelpers/accessData.js ***!
|
|
13272
|
+
\********************************************/
|
|
13273
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13274
|
+
|
|
13275
|
+
"use strict";
|
|
13276
|
+
|
|
13277
|
+
|
|
13278
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
13279
|
+
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
13280
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
13281
|
+
value: true
|
|
13282
|
+
}));
|
|
13283
|
+
exports.getExistingPrivateKey = getExistingPrivateKey;
|
|
13284
|
+
exports.getExistingPublicKey = getExistingPublicKey;
|
|
13285
|
+
exports.getKeyIfExists = getKeyIfExists;
|
|
13286
|
+
exports.pubKeyUrl = exports.privKeyUrl = exports.getPodRoot = void 0;
|
|
13287
|
+
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
13288
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
13289
|
+
var debug = _interopRequireWildcard(__webpack_require__(/*! ../../debug */ "./lib/debug.js"));
|
|
13290
|
+
var _signature = __webpack_require__(/*! ../../chat/signature */ "./lib/chat/signature.js");
|
|
13291
|
+
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
13292
|
+
var ns = _interopRequireWildcard(__webpack_require__(/*! ../../ns */ "./lib/ns.js"));
|
|
13293
|
+
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); }
|
|
13294
|
+
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; }
|
|
13295
|
+
var getPodRoot = /*#__PURE__*/function () {
|
|
13296
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
|
|
13297
|
+
var webIdURL, storages, podRoot, path, _res$headers$get, res;
|
|
13298
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
13299
|
+
while (1) switch (_context.prev = _context.next) {
|
|
13300
|
+
case 0:
|
|
13301
|
+
webIdURL = new URL(webId.uri); // find storages in webId document
|
|
13302
|
+
_context.next = 3;
|
|
13303
|
+
return _solidLogic.store.fetcher.load(webId.uri);
|
|
13304
|
+
case 3:
|
|
13305
|
+
storages = _solidLogic.store.each(webId, ns.space('storage'), null, webId.doc());
|
|
13306
|
+
if (storages !== null && storages !== void 0 && storages.length) {
|
|
13307
|
+
_context.next = 19;
|
|
13308
|
+
break;
|
|
13309
|
+
}
|
|
13310
|
+
// find storage recursively in webId URL
|
|
13311
|
+
path = webIdURL.pathname;
|
|
13312
|
+
case 6:
|
|
13313
|
+
if (!path.length) {
|
|
13314
|
+
_context.next = 17;
|
|
13315
|
+
break;
|
|
13316
|
+
}
|
|
13317
|
+
path = path.substring(0, path.lastIndexOf('/'));
|
|
13318
|
+
podRoot = _solidLogic.store.sym(webIdURL.origin + path + '/');
|
|
13319
|
+
_context.next = 11;
|
|
13320
|
+
return _solidLogic.store.fetcher.webOperation('HEAD', podRoot.uri);
|
|
13321
|
+
case 11:
|
|
13322
|
+
res = _context.sent;
|
|
13323
|
+
if (!((_res$headers$get = res.headers.get('link')) !== null && _res$headers$get !== void 0 && _res$headers$get.includes(ns.space('Storage').value))) {
|
|
13324
|
+
_context.next = 14;
|
|
13325
|
+
break;
|
|
13326
|
+
}
|
|
13327
|
+
return _context.abrupt("break", 17);
|
|
13328
|
+
case 14:
|
|
13329
|
+
if (!path) debug.warn("Current user storage not found for\n".concat(webId));
|
|
13330
|
+
_context.next = 6;
|
|
13331
|
+
break;
|
|
13332
|
+
case 17:
|
|
13333
|
+
_context.next = 21;
|
|
13334
|
+
break;
|
|
13335
|
+
case 19:
|
|
13336
|
+
// give preference to storage in webId root
|
|
13337
|
+
podRoot = storages.find(function (storage) {
|
|
13338
|
+
return webIdURL.origin === new URL(storage.value).origin;
|
|
13339
|
+
});
|
|
13340
|
+
if (!podRoot) podRoot = storages[0];
|
|
13341
|
+
case 21:
|
|
13342
|
+
return _context.abrupt("return", podRoot);
|
|
13343
|
+
case 22:
|
|
13344
|
+
case "end":
|
|
13345
|
+
return _context.stop();
|
|
13346
|
+
}
|
|
13347
|
+
}, _callee);
|
|
13348
|
+
}));
|
|
13349
|
+
return function getPodRoot(_x) {
|
|
13350
|
+
return _ref.apply(this, arguments);
|
|
13351
|
+
};
|
|
13352
|
+
}();
|
|
13353
|
+
exports.getPodRoot = getPodRoot;
|
|
13354
|
+
var pubKeyUrl = /*#__PURE__*/function () {
|
|
13355
|
+
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
|
|
13356
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
13357
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
13358
|
+
case 0:
|
|
13359
|
+
_context2.prev = 0;
|
|
13360
|
+
_context2.next = 3;
|
|
13361
|
+
return getPodRoot(webId);
|
|
13362
|
+
case 3:
|
|
13363
|
+
_context2.t0 = _context2.sent.value;
|
|
13364
|
+
return _context2.abrupt("return", _context2.t0 + 'profile/keys/publicKey.ttl');
|
|
13365
|
+
case 7:
|
|
13366
|
+
_context2.prev = 7;
|
|
13367
|
+
_context2.t1 = _context2["catch"](0);
|
|
13368
|
+
throw new Error(_context2.t1);
|
|
13369
|
+
case 10:
|
|
13370
|
+
case "end":
|
|
13371
|
+
return _context2.stop();
|
|
13372
|
+
}
|
|
13373
|
+
}, _callee2, null, [[0, 7]]);
|
|
13374
|
+
}));
|
|
13375
|
+
return function pubKeyUrl(_x2) {
|
|
13376
|
+
return _ref2.apply(this, arguments);
|
|
13377
|
+
};
|
|
13378
|
+
}();
|
|
13379
|
+
exports.pubKeyUrl = pubKeyUrl;
|
|
13380
|
+
function getExistingPublicKey(_x3, _x4) {
|
|
13381
|
+
return _getExistingPublicKey.apply(this, arguments);
|
|
13382
|
+
}
|
|
13383
|
+
function _getExistingPublicKey() {
|
|
13384
|
+
_getExistingPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(webId, publicKeyUrl) {
|
|
13385
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
13386
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
13387
|
+
case 0:
|
|
13388
|
+
_context4.next = 2;
|
|
13389
|
+
return getKeyIfExists(webId, publicKeyUrl, 'PublicKey');
|
|
13390
|
+
case 2:
|
|
13391
|
+
return _context4.abrupt("return", _context4.sent);
|
|
13392
|
+
case 3:
|
|
13393
|
+
case "end":
|
|
13394
|
+
return _context4.stop();
|
|
13395
|
+
}
|
|
13396
|
+
}, _callee4);
|
|
13397
|
+
}));
|
|
13398
|
+
return _getExistingPublicKey.apply(this, arguments);
|
|
13399
|
+
}
|
|
13400
|
+
var privKeyUrl = /*#__PURE__*/function () {
|
|
13401
|
+
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId) {
|
|
13402
|
+
var _store$any, _settings;
|
|
13403
|
+
var settings, _settings2, podRoot;
|
|
13404
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
13405
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
13406
|
+
case 0:
|
|
13407
|
+
settings = (_store$any = _solidLogic.store.any(webId, ns.space('preferencesFile'), null, webId.doc())) === null || _store$any === void 0 ? void 0 : _store$any.value;
|
|
13408
|
+
settings = (_settings = settings) === null || _settings === void 0 ? void 0 : _settings.split('/').slice(0, -1).join('/');
|
|
13409
|
+
_context3.prev = 2;
|
|
13410
|
+
_context3.next = 5;
|
|
13411
|
+
return getPodRoot(webId);
|
|
13412
|
+
case 5:
|
|
13413
|
+
podRoot = _context3.sent;
|
|
13414
|
+
if ((_settings2 = settings) !== null && _settings2 !== void 0 && _settings2.startsWith(podRoot.value)) {
|
|
13415
|
+
_context3.next = 8;
|
|
13416
|
+
break;
|
|
13417
|
+
}
|
|
13418
|
+
throw new Error("/settings/ is expected to be in ".concat(podRoot.value));
|
|
13419
|
+
case 8:
|
|
13420
|
+
return _context3.abrupt("return", "".concat(settings, "/keys/privateKey.ttl"));
|
|
13421
|
+
case 11:
|
|
13422
|
+
_context3.prev = 11;
|
|
13423
|
+
_context3.t0 = _context3["catch"](2);
|
|
13424
|
+
throw new Error(_context3.t0);
|
|
13425
|
+
case 14:
|
|
13426
|
+
case "end":
|
|
13427
|
+
return _context3.stop();
|
|
13428
|
+
}
|
|
13429
|
+
}, _callee3, null, [[2, 11]]);
|
|
13430
|
+
}));
|
|
13431
|
+
return function privKeyUrl(_x5) {
|
|
13432
|
+
return _ref3.apply(this, arguments);
|
|
13433
|
+
};
|
|
13434
|
+
}();
|
|
13435
|
+
exports.privKeyUrl = privKeyUrl;
|
|
13436
|
+
function getExistingPrivateKey(_x6, _x7) {
|
|
13437
|
+
return _getExistingPrivateKey.apply(this, arguments);
|
|
13438
|
+
}
|
|
13439
|
+
function _getExistingPrivateKey() {
|
|
13440
|
+
_getExistingPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(webId, privateKeyUrl) {
|
|
13441
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
13442
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
13443
|
+
case 0:
|
|
13444
|
+
_context5.next = 2;
|
|
13445
|
+
return getKeyIfExists(webId, privateKeyUrl, 'PrivateKey');
|
|
13446
|
+
case 2:
|
|
13447
|
+
return _context5.abrupt("return", _context5.sent);
|
|
13448
|
+
case 3:
|
|
13449
|
+
case "end":
|
|
13450
|
+
return _context5.stop();
|
|
13451
|
+
}
|
|
13452
|
+
}, _callee5);
|
|
13453
|
+
}));
|
|
13454
|
+
return _getExistingPrivateKey.apply(this, arguments);
|
|
13455
|
+
}
|
|
13456
|
+
function getKeyIfExists(_x8, _x9, _x10) {
|
|
13457
|
+
return _getKeyIfExists.apply(this, arguments);
|
|
13458
|
+
}
|
|
13459
|
+
function _getKeyIfExists() {
|
|
13460
|
+
_getKeyIfExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(webId, keyUrl, keyType) {
|
|
13461
|
+
var key;
|
|
13462
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
13463
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
13464
|
+
case 0:
|
|
13465
|
+
_context6.prev = 0;
|
|
13466
|
+
_context6.next = 3;
|
|
13467
|
+
return _solidLogic.store.fetcher.load(keyUrl);
|
|
13468
|
+
case 3:
|
|
13469
|
+
key = _solidLogic.store.any(webId, _solidLogic.store.sym(_signature.CERT + keyType));
|
|
13470
|
+
return _context6.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
|
|
13471
|
+
case 7:
|
|
13472
|
+
_context6.prev = 7;
|
|
13473
|
+
_context6.t0 = _context6["catch"](0);
|
|
13474
|
+
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context6.t0);
|
|
13475
|
+
throw _context6.t0;
|
|
13476
|
+
case 11:
|
|
13477
|
+
case "end":
|
|
13478
|
+
return _context6.stop();
|
|
13479
|
+
}
|
|
13480
|
+
}, _callee6, null, [[0, 7]]);
|
|
13481
|
+
}));
|
|
13482
|
+
return _getKeyIfExists.apply(this, arguments);
|
|
13483
|
+
}
|
|
13484
|
+
//# sourceMappingURL=accessData.js.map
|
|
13485
|
+
|
|
13486
|
+
/***/ }),
|
|
13487
|
+
|
|
13488
|
+
/***/ "./lib/utils/keyHelpers/acl.js":
|
|
13489
|
+
/*!*************************************!*\
|
|
13490
|
+
!*** ./lib/utils/keyHelpers/acl.js ***!
|
|
13491
|
+
\*************************************/
|
|
13492
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13493
|
+
|
|
13494
|
+
"use strict";
|
|
13495
|
+
|
|
13496
|
+
|
|
13497
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
13498
|
+
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
13499
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
13500
|
+
value: true
|
|
13501
|
+
}));
|
|
13502
|
+
exports.keyContainerAclBody = exports.keyAclBody = void 0;
|
|
13503
|
+
exports.setAcl = setAcl;
|
|
13504
|
+
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
13505
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
13506
|
+
var debug = _interopRequireWildcard(__webpack_require__(/*! ../../debug */ "./lib/debug.js"));
|
|
13507
|
+
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
13508
|
+
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); }
|
|
13509
|
+
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; }
|
|
13510
|
+
/**
|
|
13511
|
+
* set ACL
|
|
13512
|
+
* @param keyDoc
|
|
13513
|
+
* @param aclBody
|
|
13514
|
+
*/
|
|
13515
|
+
function setAcl(_x, _x2) {
|
|
13516
|
+
return _setAcl.apply(this, arguments);
|
|
13517
|
+
}
|
|
13518
|
+
/**
|
|
13519
|
+
* key container ACL
|
|
13520
|
+
* @param me
|
|
13521
|
+
* @returns aclBody
|
|
13522
|
+
*/
|
|
13523
|
+
function _setAcl() {
|
|
13524
|
+
_setAcl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(keyDoc, aclBody) {
|
|
13525
|
+
var keyAclDoc, _err$response;
|
|
13526
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
13527
|
+
while (1) switch (_context.prev = _context.next) {
|
|
13528
|
+
case 0:
|
|
13529
|
+
_context.next = 2;
|
|
13530
|
+
return _solidLogic.store.fetcher.load(keyDoc);
|
|
13531
|
+
case 2:
|
|
13532
|
+
// FIXME: check the Why value on this quad:
|
|
13533
|
+
debug.log(_solidLogic.store.statementsMatching(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl')));
|
|
13534
|
+
keyAclDoc = _solidLogic.store.any(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl'));
|
|
13535
|
+
if (keyAclDoc) {
|
|
13536
|
+
_context.next = 6;
|
|
13537
|
+
break;
|
|
13538
|
+
}
|
|
13539
|
+
throw new Error('Key ACL doc not found!');
|
|
13540
|
+
case 6:
|
|
13541
|
+
_context.prev = 6;
|
|
13542
|
+
_context.next = 9;
|
|
13543
|
+
return _solidLogic.store.fetcher.webOperation('PUT', keyAclDoc.value, {
|
|
13544
|
+
data: aclBody,
|
|
13545
|
+
contentType: 'text/turtle'
|
|
13546
|
+
});
|
|
13547
|
+
case 9:
|
|
13548
|
+
_context.next = 16;
|
|
13549
|
+
break;
|
|
13550
|
+
case 11:
|
|
13551
|
+
_context.prev = 11;
|
|
13552
|
+
_context.t0 = _context["catch"](6);
|
|
13553
|
+
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)) {
|
|
13554
|
+
_context.next = 15;
|
|
13555
|
+
break;
|
|
13556
|
+
}
|
|
13557
|
+
throw new Error(_context.t0);
|
|
13558
|
+
case 15:
|
|
13559
|
+
debug.log('delete ' + keyAclDoc.value + ' ' + _context.t0.response.status); // should test 404 and 2xx
|
|
13560
|
+
case 16:
|
|
13561
|
+
case "end":
|
|
13562
|
+
return _context.stop();
|
|
13563
|
+
}
|
|
13564
|
+
}, _callee, null, [[6, 11]]);
|
|
13565
|
+
}));
|
|
13566
|
+
return _setAcl.apply(this, arguments);
|
|
13567
|
+
}
|
|
13568
|
+
var keyContainerAclBody = function keyContainerAclBody(me) {
|
|
13569
|
+
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");
|
|
13570
|
+
return aclBody;
|
|
13571
|
+
};
|
|
13572
|
+
|
|
13573
|
+
/**
|
|
13574
|
+
* Read only ACL
|
|
13575
|
+
* @param keyDoc
|
|
13576
|
+
* @param me
|
|
13577
|
+
* @returns aclBody
|
|
13578
|
+
*/
|
|
13579
|
+
exports.keyContainerAclBody = keyContainerAclBody;
|
|
13580
|
+
var keyAclBody = function keyAclBody(keyDoc, me) {
|
|
13581
|
+
var keyAgent = 'acl:agentClass foaf:Agent'; // publicKey
|
|
13582
|
+
if (me !== null && me !== void 0 && me.length) keyAgent = "acl:agent <".concat(me, ">"); // privateKey
|
|
13583
|
+
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");
|
|
13584
|
+
return aclBody;
|
|
13585
|
+
};
|
|
13586
|
+
exports.keyAclBody = keyAclBody;
|
|
13587
|
+
//# sourceMappingURL=acl.js.map
|
|
13588
|
+
|
|
13589
|
+
/***/ }),
|
|
13590
|
+
|
|
13227
13591
|
/***/ "./lib/utils/label.js":
|
|
13228
13592
|
/*!****************************!*\
|
|
13229
13593
|
!*** ./lib/utils/label.js ***!
|
|
@@ -13352,8 +13716,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
13352
13716
|
}));
|
|
13353
13717
|
exports.versionInfo = void 0;
|
|
13354
13718
|
var versionInfo = {
|
|
13355
|
-
buildTime: '2023-
|
|
13356
|
-
commit: '
|
|
13719
|
+
buildTime: '2023-05-22T10:59:12Z',
|
|
13720
|
+
commit: '2b3a51cb84091739c0efb8edd333f3411f8a7804',
|
|
13357
13721
|
npmInfo: {
|
|
13358
13722
|
'solid-ui': '2.4.27',
|
|
13359
13723
|
npm: '8.19.4',
|
|
@@ -62039,14 +62403,17 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
62039
62403
|
/* harmony export */ "createRemoteJWKSet": () => (/* binding */ createRemoteJWKSet)
|
|
62040
62404
|
/* harmony export */ });
|
|
62041
62405
|
/* 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");
|
|
62042
|
-
/* harmony import */ var
|
|
62043
|
-
/* harmony import */ var
|
|
62044
|
-
/* harmony import */ var _local_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./local.js */ "./node_modules/jose/dist/browser/jwks/local.js");
|
|
62045
|
-
|
|
62406
|
+
/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
|
|
62407
|
+
/* harmony import */ var _local_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./local.js */ "./node_modules/jose/dist/browser/jwks/local.js");
|
|
62046
62408
|
|
|
62047
62409
|
|
|
62048
62410
|
|
|
62049
|
-
|
|
62411
|
+
function isCloudflareWorkers() {
|
|
62412
|
+
return (typeof WebSocketPair !== 'undefined' ||
|
|
62413
|
+
(typeof navigator !== 'undefined' && navigator.userAgent === 'Cloudflare-Workers') ||
|
|
62414
|
+
(typeof EdgeRuntime !== 'undefined' && EdgeRuntime === 'vercel'));
|
|
62415
|
+
}
|
|
62416
|
+
class RemoteJWKSet extends _local_js__WEBPACK_IMPORTED_MODULE_2__.LocalJWKSet {
|
|
62050
62417
|
constructor(url, options) {
|
|
62051
62418
|
super({ keys: [] });
|
|
62052
62419
|
this._jwks = undefined;
|
|
@@ -62079,7 +62446,7 @@ class RemoteJWKSet extends _local_js__WEBPACK_IMPORTED_MODULE_3__.LocalJWKSet {
|
|
|
62079
62446
|
return await super.getKey(protectedHeader, token);
|
|
62080
62447
|
}
|
|
62081
62448
|
catch (err) {
|
|
62082
|
-
if (err instanceof
|
|
62449
|
+
if (err instanceof _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSNoMatchingKey) {
|
|
62083
62450
|
if (this.coolingDown() === false) {
|
|
62084
62451
|
await this.reload();
|
|
62085
62452
|
return super.getKey(protectedHeader, token);
|
|
@@ -62089,13 +62456,13 @@ class RemoteJWKSet extends _local_js__WEBPACK_IMPORTED_MODULE_3__.LocalJWKSet {
|
|
|
62089
62456
|
}
|
|
62090
62457
|
}
|
|
62091
62458
|
async reload() {
|
|
62092
|
-
if (this._pendingFetch &&
|
|
62459
|
+
if (this._pendingFetch && isCloudflareWorkers()) {
|
|
62093
62460
|
this._pendingFetch = undefined;
|
|
62094
62461
|
}
|
|
62095
62462
|
this._pendingFetch || (this._pendingFetch = (0,_runtime_fetch_jwks_js__WEBPACK_IMPORTED_MODULE_0__["default"])(this._url, this._timeoutDuration, this._options)
|
|
62096
62463
|
.then((json) => {
|
|
62097
|
-
if (!(0,
|
|
62098
|
-
throw new
|
|
62464
|
+
if (!(0,_local_js__WEBPACK_IMPORTED_MODULE_2__.isJWKSLike)(json)) {
|
|
62465
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSInvalid('JSON Web Key Set malformed');
|
|
62099
62466
|
}
|
|
62100
62467
|
this._jwks = { keys: json.keys };
|
|
62101
62468
|
this._jwksTimestamp = Date.now();
|
|
@@ -63283,8 +63650,6 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
63283
63650
|
/* harmony export */ "checkEncCryptoKey": () => (/* binding */ checkEncCryptoKey),
|
|
63284
63651
|
/* harmony export */ "checkSigCryptoKey": () => (/* binding */ checkSigCryptoKey)
|
|
63285
63652
|
/* harmony export */ });
|
|
63286
|
-
/* harmony import */ var _runtime_env_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/env.js */ "./node_modules/jose/dist/browser/runtime/env.js");
|
|
63287
|
-
|
|
63288
63653
|
function unusable(name, prop = 'algorithm.name') {
|
|
63289
63654
|
return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
|
|
63290
63655
|
}
|
|
@@ -63359,11 +63724,6 @@ function checkSigCryptoKey(key, alg, ...usages) {
|
|
|
63359
63724
|
}
|
|
63360
63725
|
case 'EdDSA': {
|
|
63361
63726
|
if (key.algorithm.name !== 'Ed25519' && key.algorithm.name !== 'Ed448') {
|
|
63362
|
-
if ((0,_runtime_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
63363
|
-
if (isAlgorithm(key.algorithm, 'NODE-ED25519'))
|
|
63364
|
-
break;
|
|
63365
|
-
throw unusable('Ed25519, Ed448, or NODE-ED25519');
|
|
63366
|
-
}
|
|
63367
63727
|
throw unusable('Ed25519 or Ed448');
|
|
63368
63728
|
}
|
|
63369
63729
|
break;
|
|
@@ -64194,14 +64554,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
64194
64554
|
/* harmony export */ "toPKCS8": () => (/* binding */ toPKCS8),
|
|
64195
64555
|
/* harmony export */ "toSPKI": () => (/* binding */ toSPKI)
|
|
64196
64556
|
/* harmony export */ });
|
|
64197
|
-
/* harmony import */ var
|
|
64198
|
-
/* harmony import */ var
|
|
64199
|
-
/* harmony import */ var
|
|
64200
|
-
/* harmony import */ var
|
|
64201
|
-
/* harmony import */ var
|
|
64202
|
-
/* harmony import */ var
|
|
64203
|
-
/* 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");
|
|
64204
|
-
|
|
64557
|
+
/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js");
|
|
64558
|
+
/* 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");
|
|
64559
|
+
/* harmony import */ var _base64url_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js");
|
|
64560
|
+
/* 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");
|
|
64561
|
+
/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
|
|
64562
|
+
/* 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");
|
|
64205
64563
|
|
|
64206
64564
|
|
|
64207
64565
|
|
|
@@ -64209,8 +64567,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
64209
64567
|
|
|
64210
64568
|
|
|
64211
64569
|
const genericExport = async (keyType, keyFormat, key) => {
|
|
64212
|
-
if (!(0,
|
|
64213
|
-
throw new TypeError((0,
|
|
64570
|
+
if (!(0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_0__.isCryptoKey)(key)) {
|
|
64571
|
+
throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_1__["default"])(key, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_5__.types));
|
|
64214
64572
|
}
|
|
64215
64573
|
if (!key.extractable) {
|
|
64216
64574
|
throw new TypeError('CryptoKey is not extractable');
|
|
@@ -64218,7 +64576,7 @@ const genericExport = async (keyType, keyFormat, key) => {
|
|
|
64218
64576
|
if (key.type !== keyType) {
|
|
64219
64577
|
throw new TypeError(`key is not a ${keyType} key`);
|
|
64220
64578
|
}
|
|
64221
|
-
return (0,
|
|
64579
|
+
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`);
|
|
64222
64580
|
};
|
|
64223
64581
|
const toSPKI = (key) => {
|
|
64224
64582
|
return genericExport('public', 'spki', key);
|
|
@@ -64256,11 +64614,11 @@ const getNamedCurve = (keyData) => {
|
|
|
64256
64614
|
case findOid(keyData, [0x2b, 0x65, 0x71]):
|
|
64257
64615
|
return 'Ed448';
|
|
64258
64616
|
default:
|
|
64259
|
-
throw new
|
|
64617
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_4__.JOSENotSupported('Invalid or unsupported EC Key Curve or OKP Key Sub Type');
|
|
64260
64618
|
}
|
|
64261
64619
|
};
|
|
64262
64620
|
const genericImport = async (replace, keyFormat, pem, alg, options) => {
|
|
64263
|
-
var _a
|
|
64621
|
+
var _a;
|
|
64264
64622
|
let algorithm;
|
|
64265
64623
|
let keyUsages;
|
|
64266
64624
|
const keyData = new Uint8Array(atob(pem.replace(replace, ''))
|
|
@@ -64316,20 +64674,9 @@ const genericImport = async (replace, keyFormat, pem, alg, options) => {
|
|
|
64316
64674
|
keyUsages = isPublic ? ['verify'] : ['sign'];
|
|
64317
64675
|
break;
|
|
64318
64676
|
default:
|
|
64319
|
-
throw new
|
|
64320
|
-
}
|
|
64321
|
-
try {
|
|
64322
|
-
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);
|
|
64323
|
-
}
|
|
64324
|
-
catch (err) {
|
|
64325
|
-
if (algorithm.name === 'Ed25519' &&
|
|
64326
|
-
(err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
|
|
64327
|
-
(0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
64328
|
-
algorithm = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
64329
|
-
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);
|
|
64330
|
-
}
|
|
64331
|
-
throw err;
|
|
64677
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_4__.JOSENotSupported('Invalid or unsupported "alg" (Algorithm) value');
|
|
64332
64678
|
}
|
|
64679
|
+
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);
|
|
64333
64680
|
};
|
|
64334
64681
|
const fromPKCS8 = (pem, alg, options) => {
|
|
64335
64682
|
return genericImport(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g, 'pkcs8', pem, alg, options);
|
|
@@ -64398,12 +64745,12 @@ function parseElement(bytes) {
|
|
|
64398
64745
|
}
|
|
64399
64746
|
function spkiFromX509(buf) {
|
|
64400
64747
|
const tbsCertificate = getElement(getElement(parseElement(buf).contents)[0].contents);
|
|
64401
|
-
return (0,
|
|
64748
|
+
return (0,_base64url_js__WEBPACK_IMPORTED_MODULE_2__.encodeBase64)(tbsCertificate[tbsCertificate[0].raw[0] === 0xa0 ? 6 : 5].raw);
|
|
64402
64749
|
}
|
|
64403
64750
|
function getSPKI(x509) {
|
|
64404
64751
|
const pem = x509.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g, '');
|
|
64405
|
-
const raw = (0,
|
|
64406
|
-
return (0,
|
|
64752
|
+
const raw = (0,_base64url_js__WEBPACK_IMPORTED_MODULE_2__.decodeBase64)(pem);
|
|
64753
|
+
return (0,_lib_format_pem_js__WEBPACK_IMPORTED_MODULE_3__["default"])(spkiFromX509(raw), 'PUBLIC KEY');
|
|
64407
64754
|
}
|
|
64408
64755
|
const fromX509 = (pem, alg, options) => {
|
|
64409
64756
|
let spki;
|
|
@@ -64831,26 +65178,6 @@ const encrypt = async (enc, plaintext, cek, iv, aad) => {
|
|
|
64831
65178
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (encrypt);
|
|
64832
65179
|
|
|
64833
65180
|
|
|
64834
|
-
/***/ }),
|
|
64835
|
-
|
|
64836
|
-
/***/ "./node_modules/jose/dist/browser/runtime/env.js":
|
|
64837
|
-
/*!*******************************************************!*\
|
|
64838
|
-
!*** ./node_modules/jose/dist/browser/runtime/env.js ***!
|
|
64839
|
-
\*******************************************************/
|
|
64840
|
-
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
|
64841
|
-
|
|
64842
|
-
"use strict";
|
|
64843
|
-
__webpack_require__.r(__webpack_exports__);
|
|
64844
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
64845
|
-
/* harmony export */ "isCloudflareWorkers": () => (/* binding */ isCloudflareWorkers)
|
|
64846
|
-
/* harmony export */ });
|
|
64847
|
-
function isCloudflareWorkers() {
|
|
64848
|
-
return (typeof WebSocketPair !== 'undefined' ||
|
|
64849
|
-
(typeof navigator !== 'undefined' && navigator.userAgent === 'Cloudflare-Workers') ||
|
|
64850
|
-
(typeof EdgeRuntime !== 'undefined' && EdgeRuntime === 'vercel'));
|
|
64851
|
-
}
|
|
64852
|
-
|
|
64853
|
-
|
|
64854
65181
|
/***/ }),
|
|
64855
65182
|
|
|
64856
65183
|
/***/ "./node_modules/jose/dist/browser/runtime/fetch_jwks.js":
|
|
@@ -64915,11 +65242,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
64915
65242
|
/* harmony export */ "generateKeyPair": () => (/* binding */ generateKeyPair),
|
|
64916
65243
|
/* harmony export */ "generateSecret": () => (/* binding */ generateSecret)
|
|
64917
65244
|
/* harmony export */ });
|
|
64918
|
-
/* harmony import */ var
|
|
64919
|
-
/* harmony import */ var
|
|
64920
|
-
/* harmony import */ var
|
|
64921
|
-
/* harmony import */ var _random_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./random.js */ "./node_modules/jose/dist/browser/runtime/random.js");
|
|
64922
|
-
|
|
65245
|
+
/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js");
|
|
65246
|
+
/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
|
|
65247
|
+
/* harmony import */ var _random_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./random.js */ "./node_modules/jose/dist/browser/runtime/random.js");
|
|
64923
65248
|
|
|
64924
65249
|
|
|
64925
65250
|
|
|
@@ -64940,7 +65265,7 @@ async function generateSecret(alg, options) {
|
|
|
64940
65265
|
case 'A192CBC-HS384':
|
|
64941
65266
|
case 'A256CBC-HS512':
|
|
64942
65267
|
length = parseInt(alg.slice(-3), 10);
|
|
64943
|
-
return (0,
|
|
65268
|
+
return (0,_random_js__WEBPACK_IMPORTED_MODULE_2__["default"])(new Uint8Array(length >> 3));
|
|
64944
65269
|
case 'A128KW':
|
|
64945
65270
|
case 'A192KW':
|
|
64946
65271
|
case 'A256KW':
|
|
@@ -64959,20 +65284,20 @@ async function generateSecret(alg, options) {
|
|
|
64959
65284
|
keyUsages = ['encrypt', 'decrypt'];
|
|
64960
65285
|
break;
|
|
64961
65286
|
default:
|
|
64962
|
-
throw new
|
|
65287
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
64963
65288
|
}
|
|
64964
|
-
return
|
|
65289
|
+
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);
|
|
64965
65290
|
}
|
|
64966
65291
|
function getModulusLengthOption(options) {
|
|
64967
65292
|
var _a;
|
|
64968
65293
|
const modulusLength = (_a = options === null || options === void 0 ? void 0 : options.modulusLength) !== null && _a !== void 0 ? _a : 2048;
|
|
64969
65294
|
if (typeof modulusLength !== 'number' || modulusLength < 2048) {
|
|
64970
|
-
throw new
|
|
65295
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used');
|
|
64971
65296
|
}
|
|
64972
65297
|
return modulusLength;
|
|
64973
65298
|
}
|
|
64974
65299
|
async function generateKeyPair(alg, options) {
|
|
64975
|
-
var _a, _b, _c
|
|
65300
|
+
var _a, _b, _c;
|
|
64976
65301
|
let algorithm;
|
|
64977
65302
|
let keyUsages;
|
|
64978
65303
|
switch (alg) {
|
|
@@ -65031,7 +65356,7 @@ async function generateKeyPair(alg, options) {
|
|
|
65031
65356
|
algorithm = { name: crv };
|
|
65032
65357
|
break;
|
|
65033
65358
|
default:
|
|
65034
|
-
throw new
|
|
65359
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported crv option provided');
|
|
65035
65360
|
}
|
|
65036
65361
|
break;
|
|
65037
65362
|
case 'ECDH-ES':
|
|
@@ -65052,25 +65377,14 @@ async function generateKeyPair(alg, options) {
|
|
|
65052
65377
|
algorithm = { name: crv };
|
|
65053
65378
|
break;
|
|
65054
65379
|
default:
|
|
65055
|
-
throw new
|
|
65380
|
+
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');
|
|
65056
65381
|
}
|
|
65057
65382
|
break;
|
|
65058
65383
|
}
|
|
65059
65384
|
default:
|
|
65060
|
-
throw new
|
|
65061
|
-
}
|
|
65062
|
-
try {
|
|
65063
|
-
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));
|
|
65064
|
-
}
|
|
65065
|
-
catch (err) {
|
|
65066
|
-
if (algorithm.name === 'Ed25519' &&
|
|
65067
|
-
(err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
|
|
65068
|
-
(0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
65069
|
-
algorithm = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
65070
|
-
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));
|
|
65071
|
-
}
|
|
65072
|
-
throw err;
|
|
65385
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
65073
65386
|
}
|
|
65387
|
+
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));
|
|
65074
65388
|
}
|
|
65075
65389
|
|
|
65076
65390
|
|
|
@@ -65145,11 +65459,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
65145
65459
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
65146
65460
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
65147
65461
|
/* harmony export */ });
|
|
65148
|
-
/* harmony import */ var
|
|
65149
|
-
/* harmony import */ var
|
|
65150
|
-
/* harmony import */ var
|
|
65151
|
-
/* harmony import */ var _base64url_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js");
|
|
65152
|
-
|
|
65462
|
+
/* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js");
|
|
65463
|
+
/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
|
|
65464
|
+
/* harmony import */ var _base64url_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js");
|
|
65153
65465
|
|
|
65154
65466
|
|
|
65155
65467
|
|
|
@@ -65168,7 +65480,7 @@ function subtleMapping(jwk) {
|
|
|
65168
65480
|
case 'A128CBC-HS256':
|
|
65169
65481
|
case 'A192CBC-HS384':
|
|
65170
65482
|
case 'A256CBC-HS512':
|
|
65171
|
-
throw new
|
|
65483
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported(`${jwk.alg} keys cannot be imported as CryptoKey instances`);
|
|
65172
65484
|
case 'A128GCM':
|
|
65173
65485
|
case 'A192GCM':
|
|
65174
65486
|
case 'A256GCM':
|
|
@@ -65191,7 +65503,7 @@ function subtleMapping(jwk) {
|
|
|
65191
65503
|
keyUsages = ['deriveBits'];
|
|
65192
65504
|
break;
|
|
65193
65505
|
default:
|
|
65194
|
-
throw new
|
|
65506
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
65195
65507
|
}
|
|
65196
65508
|
break;
|
|
65197
65509
|
}
|
|
@@ -65220,7 +65532,7 @@ function subtleMapping(jwk) {
|
|
|
65220
65532
|
keyUsages = jwk.d ? ['decrypt', 'unwrapKey'] : ['encrypt', 'wrapKey'];
|
|
65221
65533
|
break;
|
|
65222
65534
|
default:
|
|
65223
|
-
throw new
|
|
65535
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
65224
65536
|
}
|
|
65225
65537
|
break;
|
|
65226
65538
|
}
|
|
@@ -65246,7 +65558,7 @@ function subtleMapping(jwk) {
|
|
|
65246
65558
|
keyUsages = jwk.d ? ['deriveBits'] : [];
|
|
65247
65559
|
break;
|
|
65248
65560
|
default:
|
|
65249
|
-
throw new
|
|
65561
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
65250
65562
|
}
|
|
65251
65563
|
break;
|
|
65252
65564
|
}
|
|
@@ -65264,12 +65576,12 @@ function subtleMapping(jwk) {
|
|
|
65264
65576
|
keyUsages = jwk.d ? ['deriveBits'] : [];
|
|
65265
65577
|
break;
|
|
65266
65578
|
default:
|
|
65267
|
-
throw new
|
|
65579
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
|
|
65268
65580
|
}
|
|
65269
65581
|
break;
|
|
65270
65582
|
}
|
|
65271
65583
|
default:
|
|
65272
|
-
throw new
|
|
65584
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
|
|
65273
65585
|
}
|
|
65274
65586
|
return { algorithm, keyUsages };
|
|
65275
65587
|
}
|
|
@@ -65285,23 +65597,12 @@ const parse = async (jwk) => {
|
|
|
65285
65597
|
(_b = jwk.key_ops) !== null && _b !== void 0 ? _b : keyUsages,
|
|
65286
65598
|
];
|
|
65287
65599
|
if (algorithm.name === 'PBKDF2') {
|
|
65288
|
-
return
|
|
65600
|
+
return _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.importKey('raw', (0,_base64url_js__WEBPACK_IMPORTED_MODULE_2__.decode)(jwk.k), ...rest);
|
|
65289
65601
|
}
|
|
65290
65602
|
const keyData = { ...jwk };
|
|
65291
65603
|
delete keyData.alg;
|
|
65292
65604
|
delete keyData.use;
|
|
65293
|
-
|
|
65294
|
-
return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey('jwk', keyData, ...rest);
|
|
65295
|
-
}
|
|
65296
|
-
catch (err) {
|
|
65297
|
-
if (algorithm.name === 'Ed25519' &&
|
|
65298
|
-
(err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
|
|
65299
|
-
(0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
|
|
65300
|
-
rest[0] = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
65301
|
-
return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey('jwk', keyData, ...rest);
|
|
65302
|
-
}
|
|
65303
|
-
throw err;
|
|
65304
|
-
}
|
|
65605
|
+
return _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.importKey('jwk', keyData, ...rest);
|
|
65305
65606
|
};
|
|
65306
65607
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (parse);
|
|
65307
65608
|
|
|
@@ -65543,9 +65844,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
65543
65844
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
65544
65845
|
/* harmony export */ "default": () => (/* binding */ subtleDsa)
|
|
65545
65846
|
/* harmony export */ });
|
|
65546
|
-
/* harmony import */ var
|
|
65547
|
-
/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
|
|
65548
|
-
|
|
65847
|
+
/* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
|
|
65549
65848
|
|
|
65550
65849
|
function subtleDsa(alg, algorithm) {
|
|
65551
65850
|
const hash = `SHA-${alg.slice(-3)}`;
|
|
@@ -65567,12 +65866,9 @@ function subtleDsa(alg, algorithm) {
|
|
|
65567
65866
|
case 'ES512':
|
|
65568
65867
|
return { hash, name: 'ECDSA', namedCurve: algorithm.namedCurve };
|
|
65569
65868
|
case 'EdDSA':
|
|
65570
|
-
if ((0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)() && algorithm.name === 'NODE-ED25519') {
|
|
65571
|
-
return { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
|
|
65572
|
-
}
|
|
65573
65869
|
return { name: algorithm.name };
|
|
65574
65870
|
default:
|
|
65575
|
-
throw new
|
|
65871
|
+
throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
|
|
65576
65872
|
}
|
|
65577
65873
|
}
|
|
65578
65874
|
|
|
@@ -66237,22 +66533,7 @@ module.exports = JSON.parse('{"application/1d-interleaved-parityfec":{"source":"
|
|
|
66237
66533
|
/******/
|
|
66238
66534
|
/******/ /* webpack/runtime/publicPath */
|
|
66239
66535
|
/******/ (() => {
|
|
66240
|
-
/******/
|
|
66241
|
-
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
66242
|
-
/******/ var document = __webpack_require__.g.document;
|
|
66243
|
-
/******/ if (!scriptUrl && document) {
|
|
66244
|
-
/******/ if (document.currentScript)
|
|
66245
|
-
/******/ scriptUrl = document.currentScript.src;
|
|
66246
|
-
/******/ if (!scriptUrl) {
|
|
66247
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
66248
|
-
/******/ if(scripts.length) scriptUrl = scripts[scripts.length - 1].src
|
|
66249
|
-
/******/ }
|
|
66250
|
-
/******/ }
|
|
66251
|
-
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
|
|
66252
|
-
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
|
|
66253
|
-
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
|
|
66254
|
-
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
66255
|
-
/******/ __webpack_require__.p = scriptUrl;
|
|
66536
|
+
/******/ __webpack_require__.p = "";
|
|
66256
66537
|
/******/ })();
|
|
66257
66538
|
/******/
|
|
66258
66539
|
/******/ /* webpack/runtime/jsonp chunk loading */
|