solid-ui 2.4.27-3652e5cb → 2.4.27-38005bd7
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 +5 -1
- package/dist/solid-ui.js +215 -128
- 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 +3 -2
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/keys.d.ts +3 -2
- package/lib/chat/keys.d.ts.map +1 -1
- package/lib/chat/keys.js +45 -37
- package/lib/chat/keys.js.map +1 -1
- package/lib/chat/message.js +2 -2
- package/lib/chat/message.js.map +1 -1
- package/lib/utils/cryptoKeyHelpers.d.ts +5 -4
- package/lib/utils/cryptoKeyHelpers.d.ts.map +1 -1
- package/lib/utils/cryptoKeyHelpers.js +163 -85
- package/lib/utils/cryptoKeyHelpers.js.map +1 -1
- package/lib/versionInfo.js +2 -2
- package/lib/versionInfo.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -67,7 +67,11 @@ npm run storybook
|
|
|
67
67
|
If there is no story for the component yet, add a new one to `./src/stories`.
|
|
68
68
|
|
|
69
69
|
When you want to test the component within a solid-pane, you can use the [development mode of solid-panes](https://github.com/solidos/solid-panes#development).
|
|
70
|
-
|
|
70
|
+
|
|
71
|
+
## Adding Tests
|
|
72
|
+
|
|
73
|
+
Need to point to Unit test Readme.
|
|
74
|
+
|
|
71
75
|
## Further documentation
|
|
72
76
|
|
|
73
77
|
- [Some code know-how](https://github.com/SolidOS/solidos/wiki/2.-Solid-UI-know-how)
|
package/dist/solid-ui.js
CHANGED
|
@@ -2710,12 +2710,13 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
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
2718
|
// const pubKey0 = '023a9da707bee1302f66083c9d95673ff969b41607a66f52686fa774d64ceb87'
|
|
2718
|
-
pubKey = (0, _keys.getPublicKey)(me
|
|
2719
|
+
pubKey = (0, _keys.getPublicKey)(me);
|
|
2719
2720
|
sig = (0, _signature.signMsg)(msg, privateKey);
|
|
2720
2721
|
/* const verify = verifySignature(sig, msg, pubKey) // alain to remove
|
|
2721
2722
|
debug.warn('sig ' + sig)
|
|
@@ -4064,23 +4065,26 @@ function _getPublicKey() {
|
|
|
4064
4065
|
_context.next = 2;
|
|
4065
4066
|
return _solidLogic.store.fetcher.load(webId);
|
|
4066
4067
|
case 2:
|
|
4067
|
-
|
|
4068
|
-
|
|
4069
|
-
|
|
4068
|
+
_context.next = 4;
|
|
4069
|
+
return (0, _cryptoKeyHelpers.pubKeyUrl)(webId);
|
|
4070
|
+
case 4:
|
|
4071
|
+
publicKeyDoc = _context.sent;
|
|
4072
|
+
_context.prev = 5;
|
|
4073
|
+
_context.next = 8;
|
|
4070
4074
|
return _solidLogic.store.fetcher.load(publicKeyDoc);
|
|
4071
|
-
case
|
|
4075
|
+
case 8:
|
|
4072
4076
|
// url.href)
|
|
4073
|
-
key = _solidLogic.store.any(
|
|
4077
|
+
key = _solidLogic.store.any(webId, _solidLogic.store.sym(_signature.CERT + 'PublicKey'));
|
|
4074
4078
|
return _context.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
|
|
4075
|
-
case
|
|
4076
|
-
_context.prev =
|
|
4077
|
-
_context.t0 = _context["catch"](
|
|
4079
|
+
case 12:
|
|
4080
|
+
_context.prev = 12;
|
|
4081
|
+
_context.t0 = _context["catch"](5);
|
|
4078
4082
|
return _context.abrupt("return", undefined);
|
|
4079
|
-
case
|
|
4083
|
+
case 15:
|
|
4080
4084
|
case "end":
|
|
4081
4085
|
return _context.stop();
|
|
4082
4086
|
}
|
|
4083
|
-
}, _callee, null, [[
|
|
4087
|
+
}, _callee, null, [[5, 12]]);
|
|
4084
4088
|
}));
|
|
4085
4089
|
return _getPublicKey.apply(this, arguments);
|
|
4086
4090
|
}
|
|
@@ -4101,62 +4105,67 @@ function _getPrivateKey() {
|
|
|
4101
4105
|
_context2.next = 2;
|
|
4102
4106
|
return _solidLogic.store.fetcher.load(webId);
|
|
4103
4107
|
case 2:
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
+
_context2.next = 4;
|
|
4109
|
+
return (0, _cryptoKeyHelpers.pubKeyUrl)(webId);
|
|
4110
|
+
case 4:
|
|
4111
|
+
publicKeyDoc = _context2.sent;
|
|
4112
|
+
_context2.next = 7;
|
|
4113
|
+
return (0, _cryptoKeyHelpers.privKeyUrl)(webId);
|
|
4114
|
+
case 7:
|
|
4115
|
+
privateKeyDoc = _context2.sent;
|
|
4116
|
+
_context2.next = 10;
|
|
4108
4117
|
return (0, _cryptoKeyHelpers.publicKeyExists)(webId);
|
|
4109
|
-
case
|
|
4118
|
+
case 10:
|
|
4110
4119
|
publicKey = _context2.sent;
|
|
4111
|
-
_context2.next =
|
|
4120
|
+
_context2.next = 13;
|
|
4112
4121
|
return (0, _cryptoKeyHelpers.privateKeyExists)(webId);
|
|
4113
|
-
case
|
|
4122
|
+
case 13:
|
|
4114
4123
|
privateKey = _context2.sent;
|
|
4115
4124
|
// is publicKey valid ?
|
|
4116
4125
|
validPublicKey = true;
|
|
4117
4126
|
if (privateKey && publicKey !== generatePublicKey(privateKey)) {
|
|
4118
|
-
if (confirm('This is strange the publicKey is not valid for\n' + webId + '\'shall we repair keeping the private key ?')) validPublicKey = false;
|
|
4127
|
+
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;
|
|
4119
4128
|
}
|
|
4120
4129
|
|
|
4121
4130
|
// create key pair or repair publicKey
|
|
4122
4131
|
if (!(!privateKey || !publicKey || !validPublicKey)) {
|
|
4123
|
-
_context2.next =
|
|
4132
|
+
_context2.next = 34;
|
|
4124
4133
|
break;
|
|
4125
4134
|
}
|
|
4126
4135
|
del = [];
|
|
4127
|
-
add = []; // if (privateKey) del.push($rdf.st(
|
|
4136
|
+
add = []; // if (privateKey) del.push($rdf.st(webId, store.sym(CERT + 'PrivateKey'), $rdf.lit(privateKey), store.sym(privateKeyDoc)))
|
|
4128
4137
|
if (privateKey) {
|
|
4129
|
-
_context2.next =
|
|
4138
|
+
_context2.next = 24;
|
|
4130
4139
|
break;
|
|
4131
4140
|
}
|
|
4132
4141
|
// add = []
|
|
4133
4142
|
privateKey = generatePrivateKey();
|
|
4134
|
-
add = [$rdf.st(
|
|
4135
|
-
_context2.next =
|
|
4136
|
-
return saveKey(privateKeyDoc, [], add, webId);
|
|
4137
|
-
case
|
|
4143
|
+
add = [$rdf.st(webId, _solidLogic.store.sym(_signature.CERT + 'PrivateKey'), $rdf.literal(privateKey), _solidLogic.store.sym(privateKeyDoc))];
|
|
4144
|
+
_context2.next = 24;
|
|
4145
|
+
return saveKey(privateKeyDoc, [], add, webId.uri);
|
|
4146
|
+
case 24:
|
|
4138
4147
|
if (!(!publicKey || !validPublicKey)) {
|
|
4139
|
-
_context2.next =
|
|
4148
|
+
_context2.next = 31;
|
|
4140
4149
|
break;
|
|
4141
4150
|
}
|
|
4142
4151
|
del = [];
|
|
4143
4152
|
// delete invalid public key
|
|
4144
4153
|
if (publicKey) {
|
|
4145
|
-
del = [$rdf.st(
|
|
4154
|
+
del = [$rdf.st(webId, _solidLogic.store.sym(_signature.CERT + 'PublicKey'), $rdf.lit(publicKey), _solidLogic.store.sym(publicKeyDoc))];
|
|
4146
4155
|
debug.log(del);
|
|
4147
4156
|
}
|
|
4148
4157
|
// update new valid key
|
|
4149
4158
|
newPublicKey = generatePublicKey(privateKey);
|
|
4150
|
-
add = [$rdf.st(
|
|
4151
|
-
_context2.next =
|
|
4159
|
+
add = [$rdf.st(webId, _solidLogic.store.sym(_signature.CERT + 'PublicKey'), $rdf.literal(newPublicKey), _solidLogic.store.sym(publicKeyDoc))];
|
|
4160
|
+
_context2.next = 31;
|
|
4152
4161
|
return saveKey(publicKeyDoc, del, add);
|
|
4153
|
-
case
|
|
4162
|
+
case 31:
|
|
4154
4163
|
keyContainer = privateKeyDoc.substring(0, privateKeyDoc.lastIndexOf('/') + 1);
|
|
4155
|
-
_context2.next =
|
|
4156
|
-
return setAcl(keyContainer, keyContainerAclBody(webId));
|
|
4157
|
-
case
|
|
4164
|
+
_context2.next = 34;
|
|
4165
|
+
return setAcl(keyContainer, keyContainerAclBody(webId.uri));
|
|
4166
|
+
case 34:
|
|
4158
4167
|
return _context2.abrupt("return", privateKey);
|
|
4159
|
-
case
|
|
4168
|
+
case 35:
|
|
4160
4169
|
case "end":
|
|
4161
4170
|
return _context2.stop();
|
|
4162
4171
|
}
|
|
@@ -4205,8 +4214,8 @@ function _setAcl() {
|
|
|
4205
4214
|
return _solidLogic.store.fetcher.load(keyDoc);
|
|
4206
4215
|
case 2:
|
|
4207
4216
|
// FIXME: check the Why value on this quad:
|
|
4208
|
-
debug.log(_solidLogic.store.statementsMatching(
|
|
4209
|
-
keyAclDoc = _solidLogic.store.any(
|
|
4217
|
+
debug.log(_solidLogic.store.statementsMatching(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl')));
|
|
4218
|
+
keyAclDoc = _solidLogic.store.any(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl'));
|
|
4210
4219
|
if (keyAclDoc) {
|
|
4211
4220
|
_context3.next = 6;
|
|
4212
4221
|
break;
|
|
@@ -4264,7 +4273,7 @@ function _saveKey() {
|
|
|
4264
4273
|
case 2:
|
|
4265
4274
|
_context4.prev = 2;
|
|
4266
4275
|
// get keyAcldoc
|
|
4267
|
-
keyAclDoc = _solidLogic.store.any(
|
|
4276
|
+
keyAclDoc = _solidLogic.store.any(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl'));
|
|
4268
4277
|
if (!keyAclDoc) {
|
|
4269
4278
|
_context4.next = 17;
|
|
4270
4279
|
break;
|
|
@@ -4460,11 +4469,11 @@ function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
|
4460
4469
|
|
|
4461
4470
|
// signed message, get public key and check signature
|
|
4462
4471
|
else {
|
|
4463
|
-
(0, _keys.getPublicKey)(creator
|
|
4472
|
+
(0, _keys.getPublicKey)(creator).then(function (publicKey) {
|
|
4464
4473
|
debug.log(creator.uri + '\n' + msg.created + '\n' + msg.id + '\n' + publicKey);
|
|
4465
4474
|
if (!publicKey) {
|
|
4466
4475
|
// TODO try to recreate the publicKey
|
|
4467
|
-
// if(me.uri === creator.uri) await getPrivateKey(creator
|
|
4476
|
+
// if(me.uri === creator.uri) await getPrivateKey(creator)
|
|
4468
4477
|
debug.warn('message is signed but ' + creator.uri + ' is missing publicKey');
|
|
4469
4478
|
}
|
|
4470
4479
|
// check that publicKey is a valid hex string
|
|
@@ -12597,143 +12606,221 @@ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/r
|
|
|
12597
12606
|
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
12598
12607
|
var _signature = __webpack_require__(/*! ../chat/signature */ "./lib/chat/signature.js");
|
|
12599
12608
|
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
12609
|
+
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
12600
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); }
|
|
12601
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; }
|
|
12602
|
-
|
|
12603
|
-
|
|
12604
|
-
|
|
12605
|
-
|
|
12606
|
-
// find storage in webId
|
|
12607
|
-
const storage = store.each(store.sym(webId), store.sym('http://www.w3.org/ns/pim/space#storage'))
|
|
12608
|
-
const pod = storage.length === 1 ? storage : storage.find(node => url.origin === new URL(node.value).origin)
|
|
12609
|
-
const podRoot = Array.isArray(pod) ? pod[0] : pod
|
|
12610
|
-
if (!podRoot?.value) throw Error('No space:storage in ' + webId)
|
|
12611
|
-
return podRoot.value
|
|
12612
|
-
} */
|
|
12613
|
-
|
|
12614
|
-
var pubKeyUrl = function pubKeyUrl(webId) {
|
|
12615
|
-
var url = new URL(webId);
|
|
12616
|
-
// find storage in webId
|
|
12617
|
-
var storage = _solidLogic.store.each(_solidLogic.store.sym(webId), _solidLogic.store.sym('http://www.w3.org/ns/pim/space#storage'));
|
|
12618
|
-
var pod = storage.length === 1 ? storage : storage.find(function (node) {
|
|
12619
|
-
return url.origin === new URL(node.value).origin;
|
|
12620
|
-
});
|
|
12621
|
-
var podUrl = Array.isArray(pod) ? pod[0] : pod;
|
|
12622
|
-
if (!(podUrl !== null && podUrl !== void 0 && podUrl.value)) throw Error('No space:storage in ' + webId);
|
|
12623
|
-
var publicKeyUrl = (podUrl === null || podUrl === void 0 ? void 0 : podUrl.value) + 'profile/keys/publicKey.ttl';
|
|
12624
|
-
return publicKeyUrl;
|
|
12625
|
-
};
|
|
12626
|
-
exports.pubKeyUrl = pubKeyUrl;
|
|
12627
|
-
function publicKeyExists(_x) {
|
|
12628
|
-
return _publicKeyExists.apply(this, arguments);
|
|
12629
|
-
}
|
|
12630
|
-
function _publicKeyExists() {
|
|
12631
|
-
_publicKeyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
|
|
12632
|
-
var publicKeyUrl;
|
|
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;
|
|
12633
12616
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
12634
12617
|
while (1) switch (_context.prev = _context.next) {
|
|
12635
12618
|
case 0:
|
|
12636
|
-
// find
|
|
12637
|
-
publicKeyUrl = pubKeyUrl(webId);
|
|
12619
|
+
webIdURL = new URL(webId.uri); // find storages in webId document
|
|
12638
12620
|
_context.next = 3;
|
|
12639
|
-
return
|
|
12621
|
+
return _solidLogic.store.fetcher.load(webId.uri);
|
|
12640
12622
|
case 3:
|
|
12641
|
-
|
|
12642
|
-
|
|
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:
|
|
12643
12662
|
case "end":
|
|
12644
12663
|
return _context.stop();
|
|
12645
12664
|
}
|
|
12646
12665
|
}, _callee);
|
|
12647
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) {
|
|
12648
12698
|
return _publicKeyExists.apply(this, arguments);
|
|
12649
12699
|
}
|
|
12650
|
-
|
|
12651
|
-
|
|
12652
|
-
|
|
12653
|
-
|
|
12654
|
-
|
|
12655
|
-
|
|
12656
|
-
|
|
12657
|
-
|
|
12658
|
-
|
|
12659
|
-
|
|
12660
|
-
|
|
12661
|
-
|
|
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
|
+
}();
|
|
12662
12747
|
exports.privKeyUrl = privKeyUrl;
|
|
12663
|
-
function privateKeyExists(
|
|
12748
|
+
function privateKeyExists(_x5) {
|
|
12664
12749
|
return _privateKeyExists.apply(this, arguments);
|
|
12665
12750
|
}
|
|
12666
12751
|
function _privateKeyExists() {
|
|
12667
|
-
_privateKeyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
12752
|
+
_privateKeyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(webId) {
|
|
12668
12753
|
var privateKeyUrl;
|
|
12669
|
-
return _regenerator["default"].wrap(function
|
|
12670
|
-
while (1) switch (
|
|
12754
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
12755
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
12671
12756
|
case 0:
|
|
12672
|
-
|
|
12673
|
-
|
|
12674
|
-
|
|
12757
|
+
_context5.next = 2;
|
|
12758
|
+
return privKeyUrl(webId);
|
|
12759
|
+
case 2:
|
|
12760
|
+
privateKeyUrl = _context5.sent;
|
|
12761
|
+
_context5.next = 5;
|
|
12675
12762
|
return keyExists(webId, privateKeyUrl, 'PrivateKey');
|
|
12676
|
-
case
|
|
12677
|
-
return
|
|
12678
|
-
case
|
|
12763
|
+
case 5:
|
|
12764
|
+
return _context5.abrupt("return", _context5.sent);
|
|
12765
|
+
case 6:
|
|
12679
12766
|
case "end":
|
|
12680
|
-
return
|
|
12767
|
+
return _context5.stop();
|
|
12681
12768
|
}
|
|
12682
|
-
},
|
|
12769
|
+
}, _callee5);
|
|
12683
12770
|
}));
|
|
12684
12771
|
return _privateKeyExists.apply(this, arguments);
|
|
12685
12772
|
}
|
|
12686
|
-
function keyExists(
|
|
12773
|
+
function keyExists(_x6, _x7, _x8) {
|
|
12687
12774
|
return _keyExists.apply(this, arguments);
|
|
12688
12775
|
}
|
|
12689
12776
|
function _keyExists() {
|
|
12690
|
-
_keyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
12777
|
+
_keyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(webId, keyUrl, keyType) {
|
|
12691
12778
|
var key, _err$response, data, contentType, response;
|
|
12692
|
-
return _regenerator["default"].wrap(function
|
|
12693
|
-
while (1) switch (
|
|
12779
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
12780
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
12694
12781
|
case 0:
|
|
12695
|
-
|
|
12696
|
-
|
|
12782
|
+
_context6.prev = 0;
|
|
12783
|
+
_context6.next = 3;
|
|
12697
12784
|
return _solidLogic.store.fetcher.load(keyUrl);
|
|
12698
12785
|
case 3:
|
|
12699
|
-
key = _solidLogic.store.any(
|
|
12700
|
-
return
|
|
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);
|
|
12701
12788
|
case 7:
|
|
12702
|
-
|
|
12703
|
-
|
|
12704
|
-
if (!((
|
|
12705
|
-
|
|
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;
|
|
12706
12793
|
break;
|
|
12707
12794
|
}
|
|
12708
|
-
|
|
12795
|
+
_context6.prev = 10;
|
|
12709
12796
|
// create privateKey resource
|
|
12710
12797
|
data = '';
|
|
12711
12798
|
contentType = 'text/turtle';
|
|
12712
|
-
|
|
12799
|
+
_context6.next = 15;
|
|
12713
12800
|
return _solidLogic.store.fetcher.webOperation('PUT', keyUrl, {
|
|
12714
12801
|
data: data,
|
|
12715
12802
|
contentType: contentType
|
|
12716
12803
|
});
|
|
12717
12804
|
case 15:
|
|
12718
|
-
response =
|
|
12719
|
-
|
|
12805
|
+
response = _context6.sent;
|
|
12806
|
+
_context6.next = 22;
|
|
12720
12807
|
break;
|
|
12721
12808
|
case 18:
|
|
12722
|
-
|
|
12723
|
-
|
|
12724
|
-
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' +
|
|
12725
|
-
throw
|
|
12809
|
+
_context6.prev = 18;
|
|
12810
|
+
_context6.t1 = _context6["catch"](10);
|
|
12811
|
+
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context6.t1);
|
|
12812
|
+
throw _context6.t1;
|
|
12726
12813
|
case 22:
|
|
12727
12814
|
delete _solidLogic.store.fetcher.requested[keyUrl]; // delete cached 404 error
|
|
12728
|
-
return
|
|
12815
|
+
return _context6.abrupt("return", undefined);
|
|
12729
12816
|
case 24:
|
|
12730
|
-
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' +
|
|
12731
|
-
throw
|
|
12817
|
+
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context6.t0);
|
|
12818
|
+
throw _context6.t0;
|
|
12732
12819
|
case 26:
|
|
12733
12820
|
case "end":
|
|
12734
|
-
return
|
|
12821
|
+
return _context6.stop();
|
|
12735
12822
|
}
|
|
12736
|
-
},
|
|
12823
|
+
}, _callee6, null, [[0, 7], [10, 18]]);
|
|
12737
12824
|
}));
|
|
12738
12825
|
return _keyExists.apply(this, arguments);
|
|
12739
12826
|
}
|
|
@@ -13587,8 +13674,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
13587
13674
|
}));
|
|
13588
13675
|
exports.versionInfo = void 0;
|
|
13589
13676
|
var versionInfo = {
|
|
13590
|
-
buildTime: '2023-05-
|
|
13591
|
-
commit: '
|
|
13677
|
+
buildTime: '2023-05-07T18:23:54Z',
|
|
13678
|
+
commit: '38005bd7679085e6b3dce878782ac928c0e74ab8',
|
|
13592
13679
|
npmInfo: {
|
|
13593
13680
|
'solid-ui': '2.4.27',
|
|
13594
13681
|
npm: '8.19.4',
|