solid-ui 2.4.27-4ef6eeb2 → 2.4.27-52d7fdb7
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 +2 -1
- package/dist/solid-ui.js +528 -489
- 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 +14 -22
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/keys.d.ts +8 -1
- package/lib/chat/keys.d.ts.map +1 -1
- package/lib/chat/keys.js +102 -167
- package/lib/chat/keys.js.map +1 -1
- package/lib/chat/message.js +38 -13
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/signature.d.ts +0 -3
- package/lib/chat/signature.d.ts.map +1 -1
- package/lib/chat/signature.js +26 -24
- 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/{cryptoKeyHelpers.js → keyHelpers/accessData.js} +67 -70
- 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 -6
- package/lib/utils/cryptoKeyHelpers.d.ts.map +0 -1
- 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:
|
|
@@ -2682,7 +2682,6 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2682
2682
|
if (deleteIt) {
|
|
2683
2683
|
// we need to add a specific signature, else anyone can delete a msg ?
|
|
2684
2684
|
sts.push($rdf.st(message, ns.schema('dateDeleted'), dateStamp, chatDocument));
|
|
2685
|
-
// msg.dateDeleted = dateStamp
|
|
2686
2685
|
}
|
|
2687
2686
|
_context2.next = 20;
|
|
2688
2687
|
break;
|
|
@@ -2703,7 +2702,7 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2703
2702
|
sts.push($rdf.st(message, ns.dct('created'), dateStamp, chatDocument));
|
|
2704
2703
|
msg.created = dateStamp.value;
|
|
2705
2704
|
if (!me) {
|
|
2706
|
-
_context2.next =
|
|
2705
|
+
_context2.next = 35;
|
|
2707
2706
|
break;
|
|
2708
2707
|
}
|
|
2709
2708
|
sts.push($rdf.st(message, ns.foaf('maker'), me, chatDocument));
|
|
@@ -2714,36 +2713,29 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2714
2713
|
case 32:
|
|
2715
2714
|
privateKey = _context2.sent;
|
|
2716
2715
|
// me.uri)
|
|
2717
|
-
// const privateKey0 = 'a11bc5d2eee6cdb3b37f5473a712cad905ccfb13fb2ccdbf1be0a1ac4fdc7d2a'
|
|
2718
|
-
// const pubKey0 = '023a9da707bee1302f66083c9d95673ff969b41607a66f52686fa774d64ceb87'
|
|
2719
|
-
pubKey = (0, _keys.getPublicKey)(me.uri);
|
|
2720
2716
|
sig = (0, _signature.signMsg)(msg, privateKey);
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
sts.push($rdf.st(message, $rdf.sym("".concat(_signature.SEC, "Proof")), $rdf.lit(sig), chatDocument));
|
|
2726
|
-
case 36:
|
|
2727
|
-
_context2.prev = 36;
|
|
2728
|
-
_context2.next = 39;
|
|
2717
|
+
sts.push($rdf.st(message, $rdf.sym("".concat(_signature.SEC, "proofValue")), $rdf.lit(sig), chatDocument));
|
|
2718
|
+
case 35:
|
|
2719
|
+
_context2.prev = 35;
|
|
2720
|
+
_context2.next = 38;
|
|
2729
2721
|
return _solidLogic.store.updater.update([], sts);
|
|
2730
|
-
case
|
|
2731
|
-
_context2.next =
|
|
2722
|
+
case 38:
|
|
2723
|
+
_context2.next = 46;
|
|
2732
2724
|
break;
|
|
2733
|
-
case
|
|
2734
|
-
_context2.prev =
|
|
2735
|
-
_context2.t0 = _context2["catch"](
|
|
2725
|
+
case 40:
|
|
2726
|
+
_context2.prev = 40;
|
|
2727
|
+
_context2.t0 = _context2["catch"](35);
|
|
2736
2728
|
_errMsg = 'Error saving chat message: ' + _context2.t0;
|
|
2737
2729
|
debug.warn(_errMsg);
|
|
2738
2730
|
alert(_errMsg);
|
|
2739
2731
|
throw new Error(_errMsg);
|
|
2740
|
-
case
|
|
2732
|
+
case 46:
|
|
2741
2733
|
return _context2.abrupt("return", message);
|
|
2742
|
-
case
|
|
2734
|
+
case 47:
|
|
2743
2735
|
case "end":
|
|
2744
2736
|
return _context2.stop();
|
|
2745
2737
|
}
|
|
2746
|
-
}, _callee2, null, [[
|
|
2738
|
+
}, _callee2, null, [[35, 40]]);
|
|
2747
2739
|
})();
|
|
2748
2740
|
});
|
|
2749
2741
|
function updateMessage(_x2) {
|
|
@@ -4041,10 +4033,11 @@ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/r
|
|
|
4041
4033
|
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
4042
4034
|
var _secp256k = __webpack_require__(/*! @noble/curves/secp256k1 */ "./node_modules/@noble/curves/secp256k1.js");
|
|
4043
4035
|
var _utils = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/@noble/hashes/utils.js");
|
|
4044
|
-
var
|
|
4036
|
+
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
4045
4037
|
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
4046
4038
|
var $rdf = _interopRequireWildcard(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
|
|
4047
|
-
var
|
|
4039
|
+
var _accessData = __webpack_require__(/*! ../utils/keyHelpers/accessData */ "./lib/utils/keyHelpers/accessData.js");
|
|
4040
|
+
var _acl = __webpack_require__(/*! ../utils/keyHelpers/acl */ "./lib/utils/keyHelpers/acl.js");
|
|
4048
4041
|
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); }
|
|
4049
4042
|
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; }
|
|
4050
4043
|
function generatePrivateKey() {
|
|
@@ -4053,271 +4046,205 @@ function generatePrivateKey() {
|
|
|
4053
4046
|
function generatePublicKey(privateKey) {
|
|
4054
4047
|
return (0, _utils.bytesToHex)(_secp256k.schnorr.getPublicKey(privateKey));
|
|
4055
4048
|
}
|
|
4049
|
+
|
|
4050
|
+
/**
|
|
4051
|
+
* getPublicKey
|
|
4052
|
+
* used for displaying messages in chat, therefore does not
|
|
4053
|
+
* create a new key if not found
|
|
4054
|
+
* @param webId
|
|
4055
|
+
* @returns string | undefined
|
|
4056
|
+
*/
|
|
4056
4057
|
function getPublicKey(_x) {
|
|
4057
4058
|
return _getPublicKey.apply(this, arguments);
|
|
4058
4059
|
}
|
|
4059
4060
|
function _getPublicKey() {
|
|
4060
|
-
_getPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4061
|
+
_getPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
|
|
4061
4062
|
var publicKeyDoc, key;
|
|
4062
|
-
return _regenerator["default"].wrap(function
|
|
4063
|
-
while (1) switch (
|
|
4063
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
4064
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
4064
4065
|
case 0:
|
|
4065
|
-
|
|
4066
|
+
_context2.next = 2;
|
|
4066
4067
|
return _solidLogic.store.fetcher.load(webId);
|
|
4067
4068
|
case 2:
|
|
4068
|
-
|
|
4069
|
-
return (0,
|
|
4069
|
+
_context2.next = 4;
|
|
4070
|
+
return (0, _accessData.pubKeyUrl)(webId);
|
|
4070
4071
|
case 4:
|
|
4071
|
-
publicKeyDoc =
|
|
4072
|
-
|
|
4073
|
-
|
|
4072
|
+
publicKeyDoc = _context2.sent;
|
|
4073
|
+
_context2.prev = 5;
|
|
4074
|
+
_context2.next = 8;
|
|
4074
4075
|
return _solidLogic.store.fetcher.load(publicKeyDoc);
|
|
4075
4076
|
case 8:
|
|
4076
4077
|
// url.href)
|
|
4077
|
-
key = _solidLogic.store.any(webId,
|
|
4078
|
-
return
|
|
4078
|
+
key = _solidLogic.store.any(webId, ns.solid('publicKey'));
|
|
4079
|
+
return _context2.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
|
|
4079
4080
|
case 12:
|
|
4080
|
-
|
|
4081
|
-
|
|
4082
|
-
return
|
|
4081
|
+
_context2.prev = 12;
|
|
4082
|
+
_context2.t0 = _context2["catch"](5);
|
|
4083
|
+
return _context2.abrupt("return", undefined);
|
|
4083
4084
|
case 15:
|
|
4084
4085
|
case "end":
|
|
4085
|
-
return
|
|
4086
|
+
return _context2.stop();
|
|
4086
4087
|
}
|
|
4087
|
-
},
|
|
4088
|
+
}, _callee2, null, [[5, 12]]);
|
|
4088
4089
|
}));
|
|
4089
4090
|
return _getPublicKey.apply(this, arguments);
|
|
4090
4091
|
}
|
|
4091
4092
|
function getPrivateKey(_x2) {
|
|
4092
4093
|
return _getPrivateKey.apply(this, arguments);
|
|
4093
4094
|
}
|
|
4094
|
-
/**
|
|
4095
|
-
* key container ACL
|
|
4096
|
-
* @param me
|
|
4097
|
-
* @returns aclBody
|
|
4098
|
-
*/
|
|
4099
4095
|
function _getPrivateKey() {
|
|
4100
|
-
_getPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
4096
|
+
_getPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId) {
|
|
4101
4097
|
var publicKeyDoc, privateKeyDoc, publicKey, privateKey, validPublicKey, del, add, newPublicKey, keyContainer;
|
|
4102
|
-
return _regenerator["default"].wrap(function
|
|
4103
|
-
while (1) switch (
|
|
4098
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
4099
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
4104
4100
|
case 0:
|
|
4105
|
-
|
|
4101
|
+
_context3.next = 2;
|
|
4106
4102
|
return _solidLogic.store.fetcher.load(webId);
|
|
4107
4103
|
case 2:
|
|
4108
|
-
|
|
4109
|
-
return (0,
|
|
4104
|
+
_context3.next = 4;
|
|
4105
|
+
return (0, _accessData.pubKeyUrl)(webId);
|
|
4110
4106
|
case 4:
|
|
4111
|
-
publicKeyDoc =
|
|
4112
|
-
|
|
4113
|
-
return (0,
|
|
4107
|
+
publicKeyDoc = _context3.sent;
|
|
4108
|
+
_context3.next = 7;
|
|
4109
|
+
return (0, _accessData.privKeyUrl)(webId);
|
|
4114
4110
|
case 7:
|
|
4115
|
-
privateKeyDoc =
|
|
4116
|
-
|
|
4117
|
-
return (0,
|
|
4111
|
+
privateKeyDoc = _context3.sent;
|
|
4112
|
+
_context3.next = 10;
|
|
4113
|
+
return (0, _accessData.getExistingPublicKey)(webId, publicKeyDoc);
|
|
4118
4114
|
case 10:
|
|
4119
|
-
publicKey =
|
|
4120
|
-
|
|
4121
|
-
return (0,
|
|
4115
|
+
publicKey = _context3.sent;
|
|
4116
|
+
_context3.next = 13;
|
|
4117
|
+
return (0, _accessData.getExistingPrivateKey)(webId, privateKeyDoc);
|
|
4122
4118
|
case 13:
|
|
4123
|
-
privateKey =
|
|
4119
|
+
privateKey = _context3.sent;
|
|
4124
4120
|
// is publicKey valid ?
|
|
4125
4121
|
validPublicKey = true;
|
|
4126
4122
|
if (privateKey && publicKey !== generatePublicKey(privateKey)) {
|
|
4127
|
-
if (confirm('This is strange the publicKey is not valid for\n' + webId + '\'shall we repair keeping the private key ?')) validPublicKey = false;
|
|
4123
|
+
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;
|
|
4128
4124
|
}
|
|
4129
4125
|
|
|
4130
4126
|
// create key pair or repair publicKey
|
|
4131
4127
|
if (!(!privateKey || !publicKey || !validPublicKey)) {
|
|
4132
|
-
|
|
4128
|
+
_context3.next = 34;
|
|
4133
4129
|
break;
|
|
4134
4130
|
}
|
|
4135
4131
|
del = [];
|
|
4136
|
-
add = [];
|
|
4132
|
+
add = [];
|
|
4137
4133
|
if (privateKey) {
|
|
4138
|
-
|
|
4134
|
+
_context3.next = 24;
|
|
4139
4135
|
break;
|
|
4140
4136
|
}
|
|
4141
4137
|
// add = []
|
|
4142
4138
|
privateKey = generatePrivateKey();
|
|
4143
|
-
add = [$rdf.st(webId,
|
|
4144
|
-
|
|
4139
|
+
add = [$rdf.st(webId, ns.solid('privateKey'), $rdf.literal(privateKey), _solidLogic.store.sym(privateKeyDoc))];
|
|
4140
|
+
_context3.next = 24;
|
|
4145
4141
|
return saveKey(privateKeyDoc, [], add, webId.uri);
|
|
4146
4142
|
case 24:
|
|
4147
4143
|
if (!(!publicKey || !validPublicKey)) {
|
|
4148
|
-
|
|
4144
|
+
_context3.next = 31;
|
|
4149
4145
|
break;
|
|
4150
4146
|
}
|
|
4151
4147
|
del = [];
|
|
4152
4148
|
// delete invalid public key
|
|
4153
4149
|
if (publicKey) {
|
|
4154
|
-
del = [$rdf.st(webId,
|
|
4150
|
+
del = [$rdf.st(webId, ns.solid('publicKey'), $rdf.lit(publicKey), _solidLogic.store.sym(publicKeyDoc))];
|
|
4155
4151
|
debug.log(del);
|
|
4156
4152
|
}
|
|
4157
4153
|
// update new valid key
|
|
4158
4154
|
newPublicKey = generatePublicKey(privateKey);
|
|
4159
|
-
add = [$rdf.st(webId,
|
|
4160
|
-
|
|
4155
|
+
add = [$rdf.st(webId, ns.solid('publicKey'), $rdf.literal(newPublicKey), _solidLogic.store.sym(publicKeyDoc))];
|
|
4156
|
+
_context3.next = 31;
|
|
4161
4157
|
return saveKey(publicKeyDoc, del, add);
|
|
4162
4158
|
case 31:
|
|
4163
4159
|
keyContainer = privateKeyDoc.substring(0, privateKeyDoc.lastIndexOf('/') + 1);
|
|
4164
|
-
|
|
4165
|
-
return setAcl(keyContainer, keyContainerAclBody(webId.uri));
|
|
4160
|
+
_context3.next = 34;
|
|
4161
|
+
return (0, _acl.setAcl)(keyContainer, (0, _acl.keyContainerAclBody)(webId.uri));
|
|
4166
4162
|
case 34:
|
|
4167
|
-
return
|
|
4163
|
+
return _context3.abrupt("return", privateKey);
|
|
4168
4164
|
case 35:
|
|
4169
4165
|
case "end":
|
|
4170
|
-
return
|
|
4166
|
+
return _context3.stop();
|
|
4171
4167
|
}
|
|
4172
|
-
},
|
|
4168
|
+
}, _callee3);
|
|
4173
4169
|
}));
|
|
4174
4170
|
return _getPrivateKey.apply(this, arguments);
|
|
4175
4171
|
}
|
|
4176
|
-
var
|
|
4177
|
-
var
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
/**
|
|
4182
|
-
* Read only ACL
|
|
4183
|
-
* @param keyDoc
|
|
4184
|
-
* @param me
|
|
4185
|
-
* @returns aclBody
|
|
4186
|
-
*/
|
|
4187
|
-
var keyAclBody = function keyAclBody(keyDoc, me) {
|
|
4188
|
-
var keyAgent = 'acl:agentClass foaf:Agent'; // publicKey
|
|
4189
|
-
if (me !== null && me !== void 0 && me.length) keyAgent = "acl:agent <".concat(me, ">"); // privateKey
|
|
4190
|
-
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");
|
|
4191
|
-
return aclBody;
|
|
4192
|
-
};
|
|
4193
|
-
|
|
4194
|
-
/**
|
|
4195
|
-
* set ACL
|
|
4196
|
-
* @param keyDoc
|
|
4197
|
-
* @param aclBody
|
|
4198
|
-
*/
|
|
4199
|
-
function setAcl(_x3, _x4) {
|
|
4200
|
-
return _setAcl.apply(this, arguments);
|
|
4201
|
-
}
|
|
4202
|
-
/**
|
|
4203
|
-
* delete acl if keydoc exists
|
|
4204
|
-
* create/edit keyDoc
|
|
4205
|
-
* set keyDoc acl
|
|
4206
|
-
*/
|
|
4207
|
-
function _setAcl() {
|
|
4208
|
-
_setAcl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(keyDoc, aclBody) {
|
|
4209
|
-
var keyAclDoc, response, aclResponse;
|
|
4210
|
-
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
4211
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
4172
|
+
var deleteKeyAcl = /*#__PURE__*/function () {
|
|
4173
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(keyDoc) {
|
|
4174
|
+
var keyAclDoc, response;
|
|
4175
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
4176
|
+
while (1) switch (_context.prev = _context.next) {
|
|
4212
4177
|
case 0:
|
|
4213
|
-
|
|
4178
|
+
_context.next = 2;
|
|
4214
4179
|
return _solidLogic.store.fetcher.load(keyDoc);
|
|
4215
4180
|
case 2:
|
|
4216
|
-
// FIXME: check the Why value on this quad:
|
|
4217
|
-
debug.log(_solidLogic.store.statementsMatching(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl')));
|
|
4218
4181
|
keyAclDoc = _solidLogic.store.any(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl'));
|
|
4219
|
-
if (keyAclDoc) {
|
|
4220
|
-
|
|
4182
|
+
if (!keyAclDoc) {
|
|
4183
|
+
_context.next = 16;
|
|
4221
4184
|
break;
|
|
4222
4185
|
}
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
_context3.prev = 6;
|
|
4226
|
-
_context3.next = 9;
|
|
4186
|
+
_context.prev = 4;
|
|
4187
|
+
_context.next = 7;
|
|
4227
4188
|
return _solidLogic.store.fetcher.webOperation('DELETE', keyAclDoc.value);
|
|
4228
|
-
case
|
|
4229
|
-
response =
|
|
4189
|
+
case 7:
|
|
4190
|
+
response = _context.sent;
|
|
4230
4191
|
// this may fail if webId is not an owner
|
|
4231
4192
|
debug.log('delete ' + keyAclDoc.value + ' ' + response.status); // should test 404 and 2xx
|
|
4232
|
-
|
|
4193
|
+
_context.next = 16;
|
|
4233
4194
|
break;
|
|
4234
|
-
case
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
if (!(
|
|
4238
|
-
|
|
4195
|
+
case 11:
|
|
4196
|
+
_context.prev = 11;
|
|
4197
|
+
_context.t0 = _context["catch"](4);
|
|
4198
|
+
if (!(_context.t0.response.status !== 404)) {
|
|
4199
|
+
_context.next = 15;
|
|
4239
4200
|
break;
|
|
4240
4201
|
}
|
|
4241
|
-
throw new Error(
|
|
4242
|
-
case
|
|
4243
|
-
debug.log('delete ' + keyAclDoc.value + ' ' +
|
|
4244
|
-
case
|
|
4245
|
-
_context3.next = 20;
|
|
4246
|
-
return _solidLogic.store.fetcher.webOperation('PUT', keyAclDoc.value, {
|
|
4247
|
-
data: aclBody,
|
|
4248
|
-
contentType: 'text/turtle'
|
|
4249
|
-
});
|
|
4250
|
-
case 20:
|
|
4251
|
-
aclResponse = _context3.sent;
|
|
4252
|
-
case 21:
|
|
4202
|
+
throw new Error(_context.t0);
|
|
4203
|
+
case 15:
|
|
4204
|
+
debug.log('delete ' + keyAclDoc.value + ' ' + _context.t0.response.status); // should test 404 and 2xx
|
|
4205
|
+
case 16:
|
|
4253
4206
|
case "end":
|
|
4254
|
-
return
|
|
4207
|
+
return _context.stop();
|
|
4255
4208
|
}
|
|
4256
|
-
},
|
|
4209
|
+
}, _callee, null, [[4, 11]]);
|
|
4257
4210
|
}));
|
|
4258
|
-
return
|
|
4259
|
-
|
|
4260
|
-
|
|
4211
|
+
return function deleteKeyAcl(_x3) {
|
|
4212
|
+
return _ref.apply(this, arguments);
|
|
4213
|
+
};
|
|
4214
|
+
}();
|
|
4215
|
+
|
|
4216
|
+
/**
|
|
4217
|
+
* delete acl if keydoc exists
|
|
4218
|
+
* create/edit keyDoc
|
|
4219
|
+
* set keyDoc acl
|
|
4220
|
+
*/
|
|
4221
|
+
function saveKey(_x4, _x5, _x6) {
|
|
4261
4222
|
return _saveKey.apply(this, arguments);
|
|
4262
4223
|
}
|
|
4263
4224
|
function _saveKey() {
|
|
4264
4225
|
_saveKey = (0, _asyncToGenerator2["default"])(function (keyDoc, del, add) {
|
|
4265
4226
|
var me = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
|
|
4266
4227
|
return /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
4267
|
-
var
|
|
4228
|
+
var aclBody;
|
|
4268
4229
|
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
4269
4230
|
while (1) switch (_context4.prev = _context4.next) {
|
|
4270
4231
|
case 0:
|
|
4271
4232
|
_context4.next = 2;
|
|
4272
|
-
return
|
|
4233
|
+
return deleteKeyAcl(keyDoc);
|
|
4273
4234
|
case 2:
|
|
4274
|
-
_context4.
|
|
4275
|
-
// get keyAcldoc
|
|
4276
|
-
keyAclDoc = _solidLogic.store.any(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl'));
|
|
4277
|
-
if (!keyAclDoc) {
|
|
4278
|
-
_context4.next = 17;
|
|
4279
|
-
break;
|
|
4280
|
-
}
|
|
4281
|
-
_context4.prev = 5;
|
|
4282
|
-
_context4.next = 8;
|
|
4283
|
-
return _solidLogic.store.fetcher.webOperation('DELETE', keyAclDoc.value);
|
|
4284
|
-
case 8:
|
|
4285
|
-
response = _context4.sent;
|
|
4286
|
-
// this may fail if webId is not an owner
|
|
4287
|
-
debug.log('delete ' + keyAclDoc.value + ' ' + response.status); // should test 404 and 2xx
|
|
4288
|
-
_context4.next = 17;
|
|
4289
|
-
break;
|
|
4290
|
-
case 12:
|
|
4291
|
-
_context4.prev = 12;
|
|
4292
|
-
_context4.t0 = _context4["catch"](5);
|
|
4293
|
-
if (!(_context4.t0.response.status !== 404)) {
|
|
4294
|
-
_context4.next = 16;
|
|
4295
|
-
break;
|
|
4296
|
-
}
|
|
4297
|
-
throw new Error(_context4.t0);
|
|
4298
|
-
case 16:
|
|
4299
|
-
debug.log('delete ' + keyAclDoc.value + ' ' + _context4.t0.response.status); // should test 404 and 2xx
|
|
4300
|
-
case 17:
|
|
4301
|
-
_context4.next = 19;
|
|
4235
|
+
_context4.next = 4;
|
|
4302
4236
|
return _solidLogic.store.updater.updateMany(del, add);
|
|
4303
|
-
case
|
|
4237
|
+
case 4:
|
|
4304
4238
|
// or a promise store.updater.update ?
|
|
4305
4239
|
// create READ only ACL
|
|
4306
|
-
aclBody = keyAclBody(keyDoc, me);
|
|
4307
|
-
_context4.next =
|
|
4308
|
-
return setAcl(keyDoc, aclBody);
|
|
4309
|
-
case
|
|
4310
|
-
_context4.next = 27;
|
|
4311
|
-
break;
|
|
4312
|
-
case 24:
|
|
4313
|
-
_context4.prev = 24;
|
|
4314
|
-
_context4.t1 = _context4["catch"](2);
|
|
4315
|
-
throw new Error(_context4.t1);
|
|
4316
|
-
case 27:
|
|
4240
|
+
aclBody = (0, _acl.keyAclBody)(keyDoc, me);
|
|
4241
|
+
_context4.next = 7;
|
|
4242
|
+
return (0, _acl.setAcl)(keyDoc, aclBody);
|
|
4243
|
+
case 7:
|
|
4317
4244
|
case "end":
|
|
4318
4245
|
return _context4.stop();
|
|
4319
4246
|
}
|
|
4320
|
-
}, _callee4
|
|
4247
|
+
}, _callee4);
|
|
4321
4248
|
})();
|
|
4322
4249
|
});
|
|
4323
4250
|
return _saveKey.apply(this, arguments);
|
|
@@ -4374,7 +4301,11 @@ var messageBodyStyle = style.messageBodyStyle;
|
|
|
4374
4301
|
var label = utils.label;
|
|
4375
4302
|
|
|
4376
4303
|
/**
|
|
4304
|
+
* elementForImageURI
|
|
4377
4305
|
* HTML component for an image
|
|
4306
|
+
* @param imageUri
|
|
4307
|
+
* @param options { inlineImageHeightEms }
|
|
4308
|
+
* @returns HTMLAnchorElement For Image
|
|
4378
4309
|
*/
|
|
4379
4310
|
function elementForImageURI(imageUri, options) {
|
|
4380
4311
|
var img = dom.createElement('img');
|
|
@@ -4404,21 +4335,27 @@ var anchor = function anchor(text, term) {
|
|
|
4404
4335
|
a.textContent = text;
|
|
4405
4336
|
return a;
|
|
4406
4337
|
};
|
|
4407
|
-
function
|
|
4338
|
+
function nickname(person) {
|
|
4408
4339
|
var s = _solidLogic.store.any(person, ns.foaf('nick'));
|
|
4409
4340
|
if (s) return '' + s.value;
|
|
4410
4341
|
return '' + label(person);
|
|
4411
4342
|
}
|
|
4412
4343
|
|
|
4413
4344
|
/**
|
|
4345
|
+
* creatorAndDate
|
|
4414
4346
|
* Displays creator and date for a chat message
|
|
4415
4347
|
* inside the `td1` element
|
|
4348
|
+
* @param td1
|
|
4349
|
+
* @param creator
|
|
4350
|
+
* @param date
|
|
4351
|
+
* @param message
|
|
4352
|
+
* @returns HTMLAnchorElement For Image
|
|
4416
4353
|
*/
|
|
4417
4354
|
function creatorAndDate(td1, creator, date, message) {
|
|
4418
|
-
var nickAnchor = td1.appendChild(anchor(
|
|
4355
|
+
var nickAnchor = td1.appendChild(anchor(nickname(creator), creator));
|
|
4419
4356
|
if (creator.uri) {
|
|
4420
4357
|
_solidLogic.store.fetcher.nowOrWhenFetched(creator.doc(), undefined, function (_ok, _body) {
|
|
4421
|
-
nickAnchor.textContent =
|
|
4358
|
+
nickAnchor.textContent = nickname(creator);
|
|
4422
4359
|
});
|
|
4423
4360
|
}
|
|
4424
4361
|
td1.appendChild(dom.createElement('br'));
|
|
@@ -4426,14 +4363,20 @@ function creatorAndDate(td1, creator, date, message) {
|
|
|
4426
4363
|
}
|
|
4427
4364
|
|
|
4428
4365
|
/**
|
|
4366
|
+
* creatorAndDateHorizontal
|
|
4429
4367
|
* Horizontally displays creator and date for a chat message
|
|
4430
4368
|
* inside the `td1` element
|
|
4369
|
+
* @param td1
|
|
4370
|
+
* @param creator
|
|
4371
|
+
* @param date
|
|
4372
|
+
* @param message
|
|
4373
|
+
* @returns HTMLAnchorElement For Image
|
|
4431
4374
|
*/
|
|
4432
4375
|
function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
4433
4376
|
var nickAnchor = td1.appendChild(anchor(label(creator), creator));
|
|
4434
4377
|
if (creator.uri) {
|
|
4435
4378
|
_solidLogic.store.fetcher.nowOrWhenFetched(creator.doc(), undefined, function (_ok, _body) {
|
|
4436
|
-
nickAnchor.textContent =
|
|
4379
|
+
nickAnchor.textContent = nickname(creator);
|
|
4437
4380
|
});
|
|
4438
4381
|
}
|
|
4439
4382
|
var dateBit = td1.appendChild(anchor(date, message));
|
|
@@ -4443,9 +4386,17 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
|
4443
4386
|
}
|
|
4444
4387
|
|
|
4445
4388
|
/**
|
|
4389
|
+
* renderMessageRow
|
|
4446
4390
|
* Renders a chat message, read-only mode
|
|
4391
|
+
* @param channelObject
|
|
4392
|
+
* @param message
|
|
4393
|
+
* @param fresh
|
|
4394
|
+
* @param options
|
|
4395
|
+
* @param userContext
|
|
4396
|
+
* @returns Message Row HTML Table Element
|
|
4447
4397
|
*/
|
|
4448
4398
|
function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
4399
|
+
var unsignedMessage = false;
|
|
4449
4400
|
var colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
|
|
4450
4401
|
var creator = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
4451
4402
|
var date = _solidLogic.store.any(message, ns.dct('created'));
|
|
@@ -4455,7 +4406,7 @@ function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
|
4455
4406
|
// use latest content if same owner, else use original
|
|
4456
4407
|
var msgId = creator.uri === latestVersionCreator.uri ? latestVersion : message;
|
|
4457
4408
|
var content = _solidLogic.store.any(msgId, ns.sioc('content'));
|
|
4458
|
-
var signature = _solidLogic.store.any(msgId, $rdf.sym("".concat(_signature.SEC, "
|
|
4409
|
+
var signature = _solidLogic.store.any(msgId, $rdf.sym("".concat(_signature.SEC, "proofValue")));
|
|
4459
4410
|
|
|
4460
4411
|
// set message object
|
|
4461
4412
|
var msg = (0, _signature.getBlankMsg)();
|
|
@@ -4465,11 +4416,12 @@ function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
|
4465
4416
|
msg.maker = creator.uri;
|
|
4466
4417
|
|
|
4467
4418
|
// unsigned message
|
|
4468
|
-
if (!(signature !== null && signature !== void 0 && signature.value))
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
else {
|
|
4472
|
-
|
|
4419
|
+
if (!(signature !== null && signature !== void 0 && signature.value)) {
|
|
4420
|
+
unsignedMessage = true;
|
|
4421
|
+
debug.warn(msgId.uri + ' is unsigned'); // TODO replace with UI (colored message ?)
|
|
4422
|
+
} else {
|
|
4423
|
+
// signed message, get public key and check signature
|
|
4424
|
+
(0, _keys.getPublicKey)(creator).then(function (publicKey) {
|
|
4473
4425
|
debug.log(creator.uri + '\n' + msg.created + '\n' + msg.id + '\n' + publicKey);
|
|
4474
4426
|
if (!publicKey) {
|
|
4475
4427
|
// TODO try to recreate the publicKey
|
|
@@ -4488,6 +4440,7 @@ function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
|
4488
4440
|
var sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()); // In message
|
|
4489
4441
|
|
|
4490
4442
|
var messageRow = dom.createElement('tr');
|
|
4443
|
+
if (unsignedMessage) messageRow.setAttribute('style', 'background-color: red');
|
|
4491
4444
|
messageRow.AJAR_date = sortDate.value;
|
|
4492
4445
|
messageRow.AJAR_subject = message;
|
|
4493
4446
|
var td1 = dom.createElement('td');
|
|
@@ -4576,7 +4529,8 @@ function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
|
4576
4529
|
toolsTD.appendChild(tools);
|
|
4577
4530
|
});
|
|
4578
4531
|
return messageRow;
|
|
4579
|
-
}
|
|
4532
|
+
} // END OF RENDERMESSAGE
|
|
4533
|
+
|
|
4580
4534
|
function switchToEditor(messageRow, message, channelObject, userContext) {
|
|
4581
4535
|
var messageTable = messageRow.parentNode;
|
|
4582
4536
|
var editRow = renderMessageEditor(channelObject, messageTable, userContext, channelObject.options, (0, _chatLogic.mostRecentVersion)(message));
|
|
@@ -4621,8 +4575,6 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4621
4575
|
while (1) switch (_context7.prev = _context7.next) {
|
|
4622
4576
|
case 0:
|
|
4623
4577
|
sendComplete = function _sendComplete(message, _text2) {
|
|
4624
|
-
// const dateStamp = store.any(message, ns.dct('created'), null, message.doc())
|
|
4625
|
-
// const content = $rdf.literal(text2)
|
|
4626
4578
|
(0, _infinite.insertMessageIntoTable)(channelObject, messageTable, message, false, options, userContext); // not green
|
|
4627
4579
|
|
|
4628
4580
|
if (originalMessage) {
|
|
@@ -5275,14 +5227,12 @@ function messageToolbar(message, messageRow, userContext, channelObject) {
|
|
|
5275
5227
|
Object.defineProperty(exports, "__esModule", ({
|
|
5276
5228
|
value: true
|
|
5277
5229
|
}));
|
|
5278
|
-
exports.SEC =
|
|
5279
|
-
exports.finishMsg = finishMsg;
|
|
5230
|
+
exports.SEC = void 0;
|
|
5280
5231
|
exports.getBlankMsg = getBlankMsg;
|
|
5281
5232
|
exports.getMsgHash = getMsgHash;
|
|
5282
5233
|
exports.serializeMsg = serializeMsg;
|
|
5283
5234
|
exports.signMsg = signMsg;
|
|
5284
5235
|
exports.utf8Encoder = exports.utf8Decoder = void 0;
|
|
5285
|
-
exports.validateMsg = validateMsg;
|
|
5286
5236
|
exports.verifySignature = verifySignature;
|
|
5287
5237
|
var _secp256k = __webpack_require__(/*! @noble/curves/secp256k1 */ "./node_modules/@noble/curves/secp256k1.js");
|
|
5288
5238
|
var _utils = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/@noble/hashes/utils.js");
|
|
@@ -5295,8 +5245,7 @@ exports.utf8Decoder = utf8Decoder;
|
|
|
5295
5245
|
var utf8Encoder = new TextEncoder();
|
|
5296
5246
|
exports.utf8Encoder = utf8Encoder;
|
|
5297
5247
|
var SEC = 'https://w3id.org/security#'; // Proof, VerificationMethod
|
|
5298
|
-
|
|
5299
|
-
var CERT = 'http://www.w3.org/ns/auth/cert#'; // PrivateKey, PublicKey
|
|
5248
|
+
// export const CERT = 'http://www.w3.org/ns/auth/cert#' // PrivateKey, PublicKey, key
|
|
5300
5249
|
|
|
5301
5250
|
/* eslint-disable no-unused-vars */
|
|
5302
5251
|
/* export enum Kind {
|
|
@@ -5322,25 +5271,28 @@ var CERT = 'http://www.w3.org/ns/auth/cert#'; // PrivateKey, PublicKey
|
|
|
5322
5271
|
ProfileBadge = 30009,
|
|
5323
5272
|
Article = 30023
|
|
5324
5273
|
} */
|
|
5325
|
-
exports.
|
|
5274
|
+
exports.SEC = SEC;
|
|
5326
5275
|
function getBlankMsg() {
|
|
5327
5276
|
return {
|
|
5328
5277
|
id: '',
|
|
5329
5278
|
created: '',
|
|
5330
5279
|
dateDeleted: '',
|
|
5280
|
+
// TODO to remove if not used
|
|
5331
5281
|
content: '',
|
|
5332
5282
|
maker: '',
|
|
5333
|
-
sig: ''
|
|
5283
|
+
sig: '' // TODO to remove if not used
|
|
5334
5284
|
};
|
|
5335
5285
|
}
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
message.
|
|
5341
|
-
message.
|
|
5342
|
-
|
|
5343
|
-
|
|
5286
|
+
|
|
5287
|
+
/* export function finishMsg (t: MsgTemplate, privateKey: string): Message {
|
|
5288
|
+
// to update to chat message triples
|
|
5289
|
+
const message = t as Message
|
|
5290
|
+
// message.pubkey = getPublicKey(privateKey)
|
|
5291
|
+
message.id = getMsgHash(message)
|
|
5292
|
+
message.sig = signMsg(message, privateKey)
|
|
5293
|
+
return message
|
|
5294
|
+
} */
|
|
5295
|
+
|
|
5344
5296
|
function serializeMsg(msg) {
|
|
5345
5297
|
// to update to chat messages triples
|
|
5346
5298
|
/* if (!validateMsg(msg))
|
|
@@ -5352,27 +5304,29 @@ function getMsgHash(message) {
|
|
|
5352
5304
|
var msgHash = (0, _sha.sha256)(utf8Encoder.encode(serializeMsg(message)));
|
|
5353
5305
|
return (0, _utils.bytesToHex)(msgHash);
|
|
5354
5306
|
}
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
function validateMsg(message) {
|
|
5359
|
-
|
|
5307
|
+
|
|
5308
|
+
// const isRecord = (obj: unknown): obj is Record<string, unknown> => obj instanceof Object
|
|
5309
|
+
|
|
5310
|
+
/* export function validateMsg<T> (message: T): message is T & UnsignedMsg {
|
|
5311
|
+
if (!isRecord(message)) return false
|
|
5360
5312
|
if (typeof message.kind !== 'number') return false
|
|
5361
5313
|
if (typeof message.content !== 'string') return false
|
|
5362
5314
|
if (typeof message.created_at !== 'number') return false
|
|
5363
5315
|
if (typeof message.pubkey !== 'string') return false
|
|
5364
5316
|
if (!message.pubkey.match(/^[a-f0-9]{64}$/)) return false
|
|
5365
|
-
|
|
5317
|
+
|
|
5318
|
+
if (!Array.isArray(message.tags)) return false
|
|
5366
5319
|
for (let i = 0; i < message.tags.length; i++) {
|
|
5367
5320
|
let tag = message.tags[i]
|
|
5368
5321
|
if (!Array.isArray(tag)) return false
|
|
5369
5322
|
for (let j = 0; j < tag.length; j++) {
|
|
5370
5323
|
if (typeof tag[j] === 'object') return false
|
|
5371
5324
|
}
|
|
5372
|
-
}
|
|
5325
|
+
}
|
|
5326
|
+
|
|
5327
|
+
return true
|
|
5328
|
+
} */
|
|
5373
5329
|
|
|
5374
|
-
return true;
|
|
5375
|
-
}
|
|
5376
5330
|
function verifySignature(sig, message, pubKey) {
|
|
5377
5331
|
return _secp256k.schnorr.verify(sig, getMsgHash(message), pubKey);
|
|
5378
5332
|
}
|
|
@@ -12583,251 +12537,6 @@ function isLight(x) {
|
|
|
12583
12537
|
|
|
12584
12538
|
/***/ }),
|
|
12585
12539
|
|
|
12586
|
-
/***/ "./lib/utils/cryptoKeyHelpers.js":
|
|
12587
|
-
/*!***************************************!*\
|
|
12588
|
-
!*** ./lib/utils/cryptoKeyHelpers.js ***!
|
|
12589
|
-
\***************************************/
|
|
12590
|
-
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12591
|
-
|
|
12592
|
-
"use strict";
|
|
12593
|
-
|
|
12594
|
-
|
|
12595
|
-
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
12596
|
-
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
12597
|
-
Object.defineProperty(exports, "__esModule", ({
|
|
12598
|
-
value: true
|
|
12599
|
-
}));
|
|
12600
|
-
exports.privKeyUrl = void 0;
|
|
12601
|
-
exports.privateKeyExists = privateKeyExists;
|
|
12602
|
-
exports.pubKeyUrl = void 0;
|
|
12603
|
-
exports.publicKeyExists = publicKeyExists;
|
|
12604
|
-
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
12605
|
-
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
12606
|
-
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
12607
|
-
var _signature = __webpack_require__(/*! ../chat/signature */ "./lib/chat/signature.js");
|
|
12608
|
-
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
12609
|
-
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
12610
|
-
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); }
|
|
12611
|
-
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; }
|
|
12612
|
-
var getPodRoot = /*#__PURE__*/function () {
|
|
12613
|
-
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
|
|
12614
|
-
var _podRoot;
|
|
12615
|
-
var webIdURL, storages, podRoot, path, _res$headers$get, res;
|
|
12616
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
12617
|
-
while (1) switch (_context.prev = _context.next) {
|
|
12618
|
-
case 0:
|
|
12619
|
-
webIdURL = new URL(webId.uri); // find storages in webId document
|
|
12620
|
-
_context.next = 3;
|
|
12621
|
-
return _solidLogic.store.fetcher.load(webId.uri);
|
|
12622
|
-
case 3:
|
|
12623
|
-
storages = _solidLogic.store.each(webId, ns.space('storage'), null, webId.doc());
|
|
12624
|
-
if (storages !== null && storages !== void 0 && storages.length) {
|
|
12625
|
-
_context.next = 19;
|
|
12626
|
-
break;
|
|
12627
|
-
}
|
|
12628
|
-
// find storage recursively in webId URL
|
|
12629
|
-
path = webIdURL.pathname;
|
|
12630
|
-
case 6:
|
|
12631
|
-
if (!path.length) {
|
|
12632
|
-
_context.next = 17;
|
|
12633
|
-
break;
|
|
12634
|
-
}
|
|
12635
|
-
path = path.substring(0, path.lastIndexOf('/'));
|
|
12636
|
-
podRoot = _solidLogic.store.sym(webIdURL.origin + path + '/');
|
|
12637
|
-
_context.next = 11;
|
|
12638
|
-
return _solidLogic.store.fetcher.webOperation('HEAD', podRoot.uri);
|
|
12639
|
-
case 11:
|
|
12640
|
-
res = _context.sent;
|
|
12641
|
-
if (!((_res$headers$get = res.headers.get('link')) !== null && _res$headers$get !== void 0 && _res$headers$get.includes(ns.space('Storage').value))) {
|
|
12642
|
-
_context.next = 14;
|
|
12643
|
-
break;
|
|
12644
|
-
}
|
|
12645
|
-
return _context.abrupt("break", 17);
|
|
12646
|
-
case 14:
|
|
12647
|
-
if (!path) debug.warn("Current user storage not found for\n".concat(webId));
|
|
12648
|
-
_context.next = 6;
|
|
12649
|
-
break;
|
|
12650
|
-
case 17:
|
|
12651
|
-
_context.next = 21;
|
|
12652
|
-
break;
|
|
12653
|
-
case 19:
|
|
12654
|
-
// give preference to storage in webId root
|
|
12655
|
-
podRoot = storages.find(function (storage) {
|
|
12656
|
-
return webIdURL.origin === new URL(storage.value).origin;
|
|
12657
|
-
});
|
|
12658
|
-
if (!podRoot) podRoot = storages[0];
|
|
12659
|
-
case 21:
|
|
12660
|
-
return _context.abrupt("return", (_podRoot = podRoot) === null || _podRoot === void 0 ? void 0 : _podRoot.value);
|
|
12661
|
-
case 22:
|
|
12662
|
-
case "end":
|
|
12663
|
-
return _context.stop();
|
|
12664
|
-
}
|
|
12665
|
-
}, _callee);
|
|
12666
|
-
}));
|
|
12667
|
-
return function getPodRoot(_x) {
|
|
12668
|
-
return _ref.apply(this, arguments);
|
|
12669
|
-
};
|
|
12670
|
-
}();
|
|
12671
|
-
var pubKeyUrl = /*#__PURE__*/function () {
|
|
12672
|
-
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
|
|
12673
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
12674
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
12675
|
-
case 0:
|
|
12676
|
-
_context2.prev = 0;
|
|
12677
|
-
_context2.next = 3;
|
|
12678
|
-
return getPodRoot(webId);
|
|
12679
|
-
case 3:
|
|
12680
|
-
_context2.t0 = _context2.sent;
|
|
12681
|
-
return _context2.abrupt("return", _context2.t0 + 'profile/keys/publicKey.ttl');
|
|
12682
|
-
case 7:
|
|
12683
|
-
_context2.prev = 7;
|
|
12684
|
-
_context2.t1 = _context2["catch"](0);
|
|
12685
|
-
throw new Error(_context2.t1);
|
|
12686
|
-
case 10:
|
|
12687
|
-
case "end":
|
|
12688
|
-
return _context2.stop();
|
|
12689
|
-
}
|
|
12690
|
-
}, _callee2, null, [[0, 7]]);
|
|
12691
|
-
}));
|
|
12692
|
-
return function pubKeyUrl(_x2) {
|
|
12693
|
-
return _ref2.apply(this, arguments);
|
|
12694
|
-
};
|
|
12695
|
-
}();
|
|
12696
|
-
exports.pubKeyUrl = pubKeyUrl;
|
|
12697
|
-
function publicKeyExists(_x3) {
|
|
12698
|
-
return _publicKeyExists.apply(this, arguments);
|
|
12699
|
-
}
|
|
12700
|
-
function _publicKeyExists() {
|
|
12701
|
-
_publicKeyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(webId) {
|
|
12702
|
-
var publicKeyUrl;
|
|
12703
|
-
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
12704
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
12705
|
-
case 0:
|
|
12706
|
-
_context4.next = 2;
|
|
12707
|
-
return pubKeyUrl(webId);
|
|
12708
|
-
case 2:
|
|
12709
|
-
publicKeyUrl = _context4.sent;
|
|
12710
|
-
_context4.next = 5;
|
|
12711
|
-
return keyExists(webId, publicKeyUrl, 'PublicKey');
|
|
12712
|
-
case 5:
|
|
12713
|
-
return _context4.abrupt("return", _context4.sent);
|
|
12714
|
-
case 6:
|
|
12715
|
-
case "end":
|
|
12716
|
-
return _context4.stop();
|
|
12717
|
-
}
|
|
12718
|
-
}, _callee4);
|
|
12719
|
-
}));
|
|
12720
|
-
return _publicKeyExists.apply(this, arguments);
|
|
12721
|
-
}
|
|
12722
|
-
var privKeyUrl = /*#__PURE__*/function () {
|
|
12723
|
-
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId) {
|
|
12724
|
-
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
12725
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
12726
|
-
case 0:
|
|
12727
|
-
_context3.prev = 0;
|
|
12728
|
-
_context3.next = 3;
|
|
12729
|
-
return getPodRoot(webId);
|
|
12730
|
-
case 3:
|
|
12731
|
-
_context3.t0 = _context3.sent;
|
|
12732
|
-
return _context3.abrupt("return", _context3.t0 + 'profile/keys/privateKey.ttl');
|
|
12733
|
-
case 7:
|
|
12734
|
-
_context3.prev = 7;
|
|
12735
|
-
_context3.t1 = _context3["catch"](0);
|
|
12736
|
-
throw new Error(_context3.t1);
|
|
12737
|
-
case 10:
|
|
12738
|
-
case "end":
|
|
12739
|
-
return _context3.stop();
|
|
12740
|
-
}
|
|
12741
|
-
}, _callee3, null, [[0, 7]]);
|
|
12742
|
-
}));
|
|
12743
|
-
return function privKeyUrl(_x4) {
|
|
12744
|
-
return _ref3.apply(this, arguments);
|
|
12745
|
-
};
|
|
12746
|
-
}();
|
|
12747
|
-
exports.privKeyUrl = privKeyUrl;
|
|
12748
|
-
function privateKeyExists(_x5) {
|
|
12749
|
-
return _privateKeyExists.apply(this, arguments);
|
|
12750
|
-
}
|
|
12751
|
-
function _privateKeyExists() {
|
|
12752
|
-
_privateKeyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(webId) {
|
|
12753
|
-
var privateKeyUrl;
|
|
12754
|
-
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
12755
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
12756
|
-
case 0:
|
|
12757
|
-
_context5.next = 2;
|
|
12758
|
-
return privKeyUrl(webId);
|
|
12759
|
-
case 2:
|
|
12760
|
-
privateKeyUrl = _context5.sent;
|
|
12761
|
-
_context5.next = 5;
|
|
12762
|
-
return keyExists(webId, privateKeyUrl, 'PrivateKey');
|
|
12763
|
-
case 5:
|
|
12764
|
-
return _context5.abrupt("return", _context5.sent);
|
|
12765
|
-
case 6:
|
|
12766
|
-
case "end":
|
|
12767
|
-
return _context5.stop();
|
|
12768
|
-
}
|
|
12769
|
-
}, _callee5);
|
|
12770
|
-
}));
|
|
12771
|
-
return _privateKeyExists.apply(this, arguments);
|
|
12772
|
-
}
|
|
12773
|
-
function keyExists(_x6, _x7, _x8) {
|
|
12774
|
-
return _keyExists.apply(this, arguments);
|
|
12775
|
-
}
|
|
12776
|
-
function _keyExists() {
|
|
12777
|
-
_keyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(webId, keyUrl, keyType) {
|
|
12778
|
-
var key, _err$response, data, contentType, response;
|
|
12779
|
-
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
12780
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
12781
|
-
case 0:
|
|
12782
|
-
_context6.prev = 0;
|
|
12783
|
-
_context6.next = 3;
|
|
12784
|
-
return _solidLogic.store.fetcher.load(keyUrl);
|
|
12785
|
-
case 3:
|
|
12786
|
-
key = _solidLogic.store.any(webId, _solidLogic.store.sym(_signature.CERT + keyType));
|
|
12787
|
-
return _context6.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
|
|
12788
|
-
case 7:
|
|
12789
|
-
_context6.prev = 7;
|
|
12790
|
-
_context6.t0 = _context6["catch"](0);
|
|
12791
|
-
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)) {
|
|
12792
|
-
_context6.next = 24;
|
|
12793
|
-
break;
|
|
12794
|
-
}
|
|
12795
|
-
_context6.prev = 10;
|
|
12796
|
-
// create privateKey resource
|
|
12797
|
-
data = '';
|
|
12798
|
-
contentType = 'text/turtle';
|
|
12799
|
-
_context6.next = 15;
|
|
12800
|
-
return _solidLogic.store.fetcher.webOperation('PUT', keyUrl, {
|
|
12801
|
-
data: data,
|
|
12802
|
-
contentType: contentType
|
|
12803
|
-
});
|
|
12804
|
-
case 15:
|
|
12805
|
-
response = _context6.sent;
|
|
12806
|
-
_context6.next = 22;
|
|
12807
|
-
break;
|
|
12808
|
-
case 18:
|
|
12809
|
-
_context6.prev = 18;
|
|
12810
|
-
_context6.t1 = _context6["catch"](10);
|
|
12811
|
-
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context6.t1);
|
|
12812
|
-
throw _context6.t1;
|
|
12813
|
-
case 22:
|
|
12814
|
-
delete _solidLogic.store.fetcher.requested[keyUrl]; // delete cached 404 error
|
|
12815
|
-
return _context6.abrupt("return", undefined);
|
|
12816
|
-
case 24:
|
|
12817
|
-
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context6.t0);
|
|
12818
|
-
throw _context6.t0;
|
|
12819
|
-
case 26:
|
|
12820
|
-
case "end":
|
|
12821
|
-
return _context6.stop();
|
|
12822
|
-
}
|
|
12823
|
-
}, _callee6, null, [[0, 7], [10, 18]]);
|
|
12824
|
-
}));
|
|
12825
|
-
return _keyExists.apply(this, arguments);
|
|
12826
|
-
}
|
|
12827
|
-
//# sourceMappingURL=cryptoKeyHelpers.js.map
|
|
12828
|
-
|
|
12829
|
-
/***/ }),
|
|
12830
|
-
|
|
12831
12540
|
/***/ "./lib/utils/headerFooterHelpers.js":
|
|
12832
12541
|
/*!******************************************!*\
|
|
12833
12542
|
!*** ./lib/utils/headerFooterHelpers.js ***!
|
|
@@ -13546,6 +13255,351 @@ function predParentOf(node) {
|
|
|
13546
13255
|
|
|
13547
13256
|
/***/ }),
|
|
13548
13257
|
|
|
13258
|
+
/***/ "./lib/utils/keyHelpers/accessData.js":
|
|
13259
|
+
/*!********************************************!*\
|
|
13260
|
+
!*** ./lib/utils/keyHelpers/accessData.js ***!
|
|
13261
|
+
\********************************************/
|
|
13262
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13263
|
+
|
|
13264
|
+
"use strict";
|
|
13265
|
+
|
|
13266
|
+
|
|
13267
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
13268
|
+
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
13269
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
13270
|
+
value: true
|
|
13271
|
+
}));
|
|
13272
|
+
exports.getExistingPrivateKey = getExistingPrivateKey;
|
|
13273
|
+
exports.getExistingPublicKey = getExistingPublicKey;
|
|
13274
|
+
exports.getKeyIfExists = getKeyIfExists;
|
|
13275
|
+
exports.pubKeyUrl = exports.privKeyUrl = exports.getPodRoot = void 0;
|
|
13276
|
+
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
13277
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
13278
|
+
var debug = _interopRequireWildcard(__webpack_require__(/*! ../../debug */ "./lib/debug.js"));
|
|
13279
|
+
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
13280
|
+
var ns = _interopRequireWildcard(__webpack_require__(/*! ../../ns */ "./lib/ns.js"));
|
|
13281
|
+
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); }
|
|
13282
|
+
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; }
|
|
13283
|
+
var getPodRoot = /*#__PURE__*/function () {
|
|
13284
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
|
|
13285
|
+
var webIdURL, storages, podRoot, path, _res$headers$get, res;
|
|
13286
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
13287
|
+
while (1) switch (_context.prev = _context.next) {
|
|
13288
|
+
case 0:
|
|
13289
|
+
webIdURL = new URL(webId.uri); // find storages in webId document
|
|
13290
|
+
_context.next = 3;
|
|
13291
|
+
return _solidLogic.store.fetcher.load(webId.uri);
|
|
13292
|
+
case 3:
|
|
13293
|
+
storages = _solidLogic.store.each(webId, ns.space('storage'), null, webId.doc());
|
|
13294
|
+
if (storages !== null && storages !== void 0 && storages.length) {
|
|
13295
|
+
_context.next = 19;
|
|
13296
|
+
break;
|
|
13297
|
+
}
|
|
13298
|
+
// find storage recursively in webId URL
|
|
13299
|
+
path = webIdURL.pathname;
|
|
13300
|
+
case 6:
|
|
13301
|
+
if (!path.length) {
|
|
13302
|
+
_context.next = 17;
|
|
13303
|
+
break;
|
|
13304
|
+
}
|
|
13305
|
+
path = path.substring(0, path.lastIndexOf('/'));
|
|
13306
|
+
podRoot = _solidLogic.store.sym(webIdURL.origin + path + '/');
|
|
13307
|
+
_context.next = 11;
|
|
13308
|
+
return _solidLogic.store.fetcher.webOperation('HEAD', podRoot.uri);
|
|
13309
|
+
case 11:
|
|
13310
|
+
res = _context.sent;
|
|
13311
|
+
if (!((_res$headers$get = res.headers.get('link')) !== null && _res$headers$get !== void 0 && _res$headers$get.includes(ns.space('Storage').value))) {
|
|
13312
|
+
_context.next = 14;
|
|
13313
|
+
break;
|
|
13314
|
+
}
|
|
13315
|
+
return _context.abrupt("break", 17);
|
|
13316
|
+
case 14:
|
|
13317
|
+
if (!path) debug.warn("Current user storage not found for\n".concat(webId));
|
|
13318
|
+
_context.next = 6;
|
|
13319
|
+
break;
|
|
13320
|
+
case 17:
|
|
13321
|
+
_context.next = 21;
|
|
13322
|
+
break;
|
|
13323
|
+
case 19:
|
|
13324
|
+
// give preference to storage in webId root
|
|
13325
|
+
podRoot = storages.find(function (storage) {
|
|
13326
|
+
return webIdURL.origin === new URL(storage.value).origin;
|
|
13327
|
+
});
|
|
13328
|
+
if (!podRoot) podRoot = storages[0];
|
|
13329
|
+
case 21:
|
|
13330
|
+
return _context.abrupt("return", podRoot);
|
|
13331
|
+
case 22:
|
|
13332
|
+
case "end":
|
|
13333
|
+
return _context.stop();
|
|
13334
|
+
}
|
|
13335
|
+
}, _callee);
|
|
13336
|
+
}));
|
|
13337
|
+
return function getPodRoot(_x) {
|
|
13338
|
+
return _ref.apply(this, arguments);
|
|
13339
|
+
};
|
|
13340
|
+
}();
|
|
13341
|
+
exports.getPodRoot = getPodRoot;
|
|
13342
|
+
var pubKeyUrl = /*#__PURE__*/function () {
|
|
13343
|
+
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
|
|
13344
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
13345
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
13346
|
+
case 0:
|
|
13347
|
+
_context2.prev = 0;
|
|
13348
|
+
_context2.next = 3;
|
|
13349
|
+
return getPodRoot(webId);
|
|
13350
|
+
case 3:
|
|
13351
|
+
_context2.t0 = _context2.sent.value;
|
|
13352
|
+
return _context2.abrupt("return", _context2.t0 + 'profile/keys/publicKey.ttl');
|
|
13353
|
+
case 7:
|
|
13354
|
+
_context2.prev = 7;
|
|
13355
|
+
_context2.t1 = _context2["catch"](0);
|
|
13356
|
+
throw new Error(_context2.t1);
|
|
13357
|
+
case 10:
|
|
13358
|
+
case "end":
|
|
13359
|
+
return _context2.stop();
|
|
13360
|
+
}
|
|
13361
|
+
}, _callee2, null, [[0, 7]]);
|
|
13362
|
+
}));
|
|
13363
|
+
return function pubKeyUrl(_x2) {
|
|
13364
|
+
return _ref2.apply(this, arguments);
|
|
13365
|
+
};
|
|
13366
|
+
}();
|
|
13367
|
+
exports.pubKeyUrl = pubKeyUrl;
|
|
13368
|
+
function getExistingPublicKey(_x3, _x4) {
|
|
13369
|
+
return _getExistingPublicKey.apply(this, arguments);
|
|
13370
|
+
}
|
|
13371
|
+
function _getExistingPublicKey() {
|
|
13372
|
+
_getExistingPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(webId, publicKeyUrl) {
|
|
13373
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
13374
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
13375
|
+
case 0:
|
|
13376
|
+
_context4.next = 2;
|
|
13377
|
+
return getKeyIfExists(webId, publicKeyUrl, 'publicKey');
|
|
13378
|
+
case 2:
|
|
13379
|
+
return _context4.abrupt("return", _context4.sent);
|
|
13380
|
+
case 3:
|
|
13381
|
+
case "end":
|
|
13382
|
+
return _context4.stop();
|
|
13383
|
+
}
|
|
13384
|
+
}, _callee4);
|
|
13385
|
+
}));
|
|
13386
|
+
return _getExistingPublicKey.apply(this, arguments);
|
|
13387
|
+
}
|
|
13388
|
+
var privKeyUrl = /*#__PURE__*/function () {
|
|
13389
|
+
var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId) {
|
|
13390
|
+
var _store$any, _settings;
|
|
13391
|
+
var settings, _settings2, podRoot;
|
|
13392
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
13393
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
13394
|
+
case 0:
|
|
13395
|
+
settings = (_store$any = _solidLogic.store.any(webId, ns.space('preferencesFile'), null, webId.doc())) === null || _store$any === void 0 ? void 0 : _store$any.value;
|
|
13396
|
+
settings = (_settings = settings) === null || _settings === void 0 ? void 0 : _settings.split('/').slice(0, -1).join('/');
|
|
13397
|
+
_context3.prev = 2;
|
|
13398
|
+
_context3.next = 5;
|
|
13399
|
+
return getPodRoot(webId);
|
|
13400
|
+
case 5:
|
|
13401
|
+
podRoot = _context3.sent;
|
|
13402
|
+
if ((_settings2 = settings) !== null && _settings2 !== void 0 && _settings2.startsWith(podRoot.value)) {
|
|
13403
|
+
_context3.next = 8;
|
|
13404
|
+
break;
|
|
13405
|
+
}
|
|
13406
|
+
throw new Error("/settings/ is expected to be in ".concat(podRoot.value));
|
|
13407
|
+
case 8:
|
|
13408
|
+
return _context3.abrupt("return", "".concat(settings, "/keys/privateKey.ttl"));
|
|
13409
|
+
case 11:
|
|
13410
|
+
_context3.prev = 11;
|
|
13411
|
+
_context3.t0 = _context3["catch"](2);
|
|
13412
|
+
throw new Error(_context3.t0);
|
|
13413
|
+
case 14:
|
|
13414
|
+
case "end":
|
|
13415
|
+
return _context3.stop();
|
|
13416
|
+
}
|
|
13417
|
+
}, _callee3, null, [[2, 11]]);
|
|
13418
|
+
}));
|
|
13419
|
+
return function privKeyUrl(_x5) {
|
|
13420
|
+
return _ref3.apply(this, arguments);
|
|
13421
|
+
};
|
|
13422
|
+
}();
|
|
13423
|
+
exports.privKeyUrl = privKeyUrl;
|
|
13424
|
+
function getExistingPrivateKey(_x6, _x7) {
|
|
13425
|
+
return _getExistingPrivateKey.apply(this, arguments);
|
|
13426
|
+
}
|
|
13427
|
+
function _getExistingPrivateKey() {
|
|
13428
|
+
_getExistingPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(webId, privateKeyUrl) {
|
|
13429
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
13430
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
13431
|
+
case 0:
|
|
13432
|
+
_context5.next = 2;
|
|
13433
|
+
return getKeyIfExists(webId, privateKeyUrl, 'privateKey');
|
|
13434
|
+
case 2:
|
|
13435
|
+
return _context5.abrupt("return", _context5.sent);
|
|
13436
|
+
case 3:
|
|
13437
|
+
case "end":
|
|
13438
|
+
return _context5.stop();
|
|
13439
|
+
}
|
|
13440
|
+
}, _callee5);
|
|
13441
|
+
}));
|
|
13442
|
+
return _getExistingPrivateKey.apply(this, arguments);
|
|
13443
|
+
}
|
|
13444
|
+
function getKeyIfExists(_x8, _x9, _x10) {
|
|
13445
|
+
return _getKeyIfExists.apply(this, arguments);
|
|
13446
|
+
}
|
|
13447
|
+
function _getKeyIfExists() {
|
|
13448
|
+
_getKeyIfExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(webId, keyUrl, keyType) {
|
|
13449
|
+
var key;
|
|
13450
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
13451
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
13452
|
+
case 0:
|
|
13453
|
+
_context6.prev = 0;
|
|
13454
|
+
_context6.next = 3;
|
|
13455
|
+
return _solidLogic.store.fetcher.load(keyUrl);
|
|
13456
|
+
case 3:
|
|
13457
|
+
key = _solidLogic.store.any(webId, ns.solid(keyType)); // store.sym(CERT + keyType))
|
|
13458
|
+
return _context6.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
|
|
13459
|
+
case 7:
|
|
13460
|
+
_context6.prev = 7;
|
|
13461
|
+
_context6.t0 = _context6["catch"](0);
|
|
13462
|
+
if (!(_context6.t0.response.status === 404)) {
|
|
13463
|
+
_context6.next = 24;
|
|
13464
|
+
break;
|
|
13465
|
+
}
|
|
13466
|
+
debug.log('createIfNotExists: doc does NOT exist, will create... ' + keyUrl);
|
|
13467
|
+
_context6.prev = 11;
|
|
13468
|
+
_context6.next = 14;
|
|
13469
|
+
return _solidLogic.store.fetcher.webOperation('PUT', keyUrl, {
|
|
13470
|
+
data: '',
|
|
13471
|
+
contentType: 'text/turtle'
|
|
13472
|
+
});
|
|
13473
|
+
case 14:
|
|
13474
|
+
_context6.next = 20;
|
|
13475
|
+
break;
|
|
13476
|
+
case 16:
|
|
13477
|
+
_context6.prev = 16;
|
|
13478
|
+
_context6.t1 = _context6["catch"](11);
|
|
13479
|
+
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context6.t1);
|
|
13480
|
+
throw _context6.t1;
|
|
13481
|
+
case 20:
|
|
13482
|
+
delete _solidLogic.store.fetcher.requested[keyUrl]; // delete cached 404 error
|
|
13483
|
+
// debug.log('createIfNotExists doc created ok ' + doc)
|
|
13484
|
+
return _context6.abrupt("return", undefined);
|
|
13485
|
+
case 24:
|
|
13486
|
+
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context6.t0);
|
|
13487
|
+
throw _context6.t0;
|
|
13488
|
+
case 26:
|
|
13489
|
+
case "end":
|
|
13490
|
+
return _context6.stop();
|
|
13491
|
+
}
|
|
13492
|
+
}, _callee6, null, [[0, 7], [11, 16]]);
|
|
13493
|
+
}));
|
|
13494
|
+
return _getKeyIfExists.apply(this, arguments);
|
|
13495
|
+
}
|
|
13496
|
+
//# sourceMappingURL=accessData.js.map
|
|
13497
|
+
|
|
13498
|
+
/***/ }),
|
|
13499
|
+
|
|
13500
|
+
/***/ "./lib/utils/keyHelpers/acl.js":
|
|
13501
|
+
/*!*************************************!*\
|
|
13502
|
+
!*** ./lib/utils/keyHelpers/acl.js ***!
|
|
13503
|
+
\*************************************/
|
|
13504
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
13505
|
+
|
|
13506
|
+
"use strict";
|
|
13507
|
+
|
|
13508
|
+
|
|
13509
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
13510
|
+
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
13511
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
13512
|
+
value: true
|
|
13513
|
+
}));
|
|
13514
|
+
exports.keyContainerAclBody = exports.keyAclBody = void 0;
|
|
13515
|
+
exports.setAcl = setAcl;
|
|
13516
|
+
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
13517
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
13518
|
+
var debug = _interopRequireWildcard(__webpack_require__(/*! ../../debug */ "./lib/debug.js"));
|
|
13519
|
+
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
13520
|
+
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); }
|
|
13521
|
+
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; }
|
|
13522
|
+
/**
|
|
13523
|
+
* set ACL
|
|
13524
|
+
* @param keyDoc
|
|
13525
|
+
* @param aclBody
|
|
13526
|
+
*/
|
|
13527
|
+
function setAcl(_x, _x2) {
|
|
13528
|
+
return _setAcl.apply(this, arguments);
|
|
13529
|
+
}
|
|
13530
|
+
/**
|
|
13531
|
+
* key container ACL
|
|
13532
|
+
* @param me
|
|
13533
|
+
* @returns aclBody
|
|
13534
|
+
*/
|
|
13535
|
+
function _setAcl() {
|
|
13536
|
+
_setAcl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(keyDoc, aclBody) {
|
|
13537
|
+
var keyAclDoc, _err$response;
|
|
13538
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
13539
|
+
while (1) switch (_context.prev = _context.next) {
|
|
13540
|
+
case 0:
|
|
13541
|
+
_context.next = 2;
|
|
13542
|
+
return _solidLogic.store.fetcher.load(keyDoc);
|
|
13543
|
+
case 2:
|
|
13544
|
+
// FIXME: check the Why value on this quad:
|
|
13545
|
+
debug.log(_solidLogic.store.statementsMatching(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl')));
|
|
13546
|
+
keyAclDoc = _solidLogic.store.any(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl'));
|
|
13547
|
+
if (keyAclDoc) {
|
|
13548
|
+
_context.next = 6;
|
|
13549
|
+
break;
|
|
13550
|
+
}
|
|
13551
|
+
throw new Error('Key ACL doc not found!');
|
|
13552
|
+
case 6:
|
|
13553
|
+
_context.prev = 6;
|
|
13554
|
+
_context.next = 9;
|
|
13555
|
+
return _solidLogic.store.fetcher.webOperation('PUT', keyAclDoc.value, {
|
|
13556
|
+
data: aclBody,
|
|
13557
|
+
contentType: 'text/turtle'
|
|
13558
|
+
});
|
|
13559
|
+
case 9:
|
|
13560
|
+
_context.next = 16;
|
|
13561
|
+
break;
|
|
13562
|
+
case 11:
|
|
13563
|
+
_context.prev = 11;
|
|
13564
|
+
_context.t0 = _context["catch"](6);
|
|
13565
|
+
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)) {
|
|
13566
|
+
_context.next = 15;
|
|
13567
|
+
break;
|
|
13568
|
+
}
|
|
13569
|
+
throw new Error(_context.t0);
|
|
13570
|
+
case 15:
|
|
13571
|
+
debug.log('delete ' + keyAclDoc.value + ' ' + _context.t0.response.status); // should test 404 and 2xx
|
|
13572
|
+
case 16:
|
|
13573
|
+
case "end":
|
|
13574
|
+
return _context.stop();
|
|
13575
|
+
}
|
|
13576
|
+
}, _callee, null, [[6, 11]]);
|
|
13577
|
+
}));
|
|
13578
|
+
return _setAcl.apply(this, arguments);
|
|
13579
|
+
}
|
|
13580
|
+
var keyContainerAclBody = function keyContainerAclBody(me) {
|
|
13581
|
+
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");
|
|
13582
|
+
return aclBody;
|
|
13583
|
+
};
|
|
13584
|
+
|
|
13585
|
+
/**
|
|
13586
|
+
* Read only ACL
|
|
13587
|
+
* @param keyDoc
|
|
13588
|
+
* @param me
|
|
13589
|
+
* @returns aclBody
|
|
13590
|
+
*/
|
|
13591
|
+
exports.keyContainerAclBody = keyContainerAclBody;
|
|
13592
|
+
var keyAclBody = function keyAclBody(keyDoc, me) {
|
|
13593
|
+
var keyAgent = 'acl:agentClass foaf:Agent'; // publicKey
|
|
13594
|
+
if (me !== null && me !== void 0 && me.length) keyAgent = "acl:agent <".concat(me, ">"); // privateKey
|
|
13595
|
+
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");
|
|
13596
|
+
return aclBody;
|
|
13597
|
+
};
|
|
13598
|
+
exports.keyAclBody = keyAclBody;
|
|
13599
|
+
//# sourceMappingURL=acl.js.map
|
|
13600
|
+
|
|
13601
|
+
/***/ }),
|
|
13602
|
+
|
|
13549
13603
|
/***/ "./lib/utils/label.js":
|
|
13550
13604
|
/*!****************************!*\
|
|
13551
13605
|
!*** ./lib/utils/label.js ***!
|
|
@@ -13674,8 +13728,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
13674
13728
|
}));
|
|
13675
13729
|
exports.versionInfo = void 0;
|
|
13676
13730
|
var versionInfo = {
|
|
13677
|
-
buildTime: '2023-05-
|
|
13678
|
-
commit: '
|
|
13731
|
+
buildTime: '2023-05-24T23:47:16Z',
|
|
13732
|
+
commit: '52d7fdb725a76c09c5562ad5156a586dec6c9734',
|
|
13679
13733
|
npmInfo: {
|
|
13680
13734
|
'solid-ui': '2.4.27',
|
|
13681
13735
|
npm: '8.19.4',
|
|
@@ -66491,22 +66545,7 @@ module.exports = JSON.parse('{"application/1d-interleaved-parityfec":{"source":"
|
|
|
66491
66545
|
/******/
|
|
66492
66546
|
/******/ /* webpack/runtime/publicPath */
|
|
66493
66547
|
/******/ (() => {
|
|
66494
|
-
/******/
|
|
66495
|
-
/******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
|
|
66496
|
-
/******/ var document = __webpack_require__.g.document;
|
|
66497
|
-
/******/ if (!scriptUrl && document) {
|
|
66498
|
-
/******/ if (document.currentScript)
|
|
66499
|
-
/******/ scriptUrl = document.currentScript.src;
|
|
66500
|
-
/******/ if (!scriptUrl) {
|
|
66501
|
-
/******/ var scripts = document.getElementsByTagName("script");
|
|
66502
|
-
/******/ if(scripts.length) scriptUrl = scripts[scripts.length - 1].src
|
|
66503
|
-
/******/ }
|
|
66504
|
-
/******/ }
|
|
66505
|
-
/******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
|
|
66506
|
-
/******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
|
|
66507
|
-
/******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
|
|
66508
|
-
/******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
66509
|
-
/******/ __webpack_require__.p = scriptUrl;
|
|
66548
|
+
/******/ __webpack_require__.p = "";
|
|
66510
66549
|
/******/ })();
|
|
66511
66550
|
/******/
|
|
66512
66551
|
/******/ /* webpack/runtime/jsonp chunk loading */
|