solid-ui 2.4.27-20175fe3 → 2.4.27-2766a189
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/solid-ui.js +222 -117
- 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/keys.d.ts +1 -1
- package/lib/chat/keys.d.ts.map +1 -1
- package/lib/chat/keys.js +63 -100
- package/lib/chat/keys.js.map +1 -1
- package/lib/chat/message.js +14 -14
- package/lib/chat/message.js.map +1 -1
- package/lib/utils/cryptoKeyHelpers.d.ts +5 -0
- package/lib/utils/cryptoKeyHelpers.d.ts.map +1 -0
- package/lib/utils/cryptoKeyHelpers.js +132 -0
- package/lib/utils/cryptoKeyHelpers.js.map +1 -0
- package/lib/versionInfo.js +2 -2
- package/lib/versionInfo.js.map +1 -1
- package/package.json +1 -1
package/dist/solid-ui.js
CHANGED
|
@@ -4037,12 +4037,12 @@ exports.getPrivateKey = getPrivateKey;
|
|
|
4037
4037
|
exports.getPublicKey = getPublicKey;
|
|
4038
4038
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
4039
4039
|
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
4040
|
-
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
4041
4040
|
var _secp256k = __webpack_require__(/*! @noble/curves/secp256k1 */ "./node_modules/@noble/curves/secp256k1.js");
|
|
4042
4041
|
var _utils = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/@noble/hashes/utils.js");
|
|
4043
4042
|
var _signature = __webpack_require__(/*! ./signature */ "./lib/chat/signature.js");
|
|
4044
4043
|
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
4045
4044
|
var $rdf = _interopRequireWildcard(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
|
|
4045
|
+
var _cryptoKeyHelpers = __webpack_require__(/*! ../utils/cryptoKeyHelpers */ "./lib/utils/cryptoKeyHelpers.js");
|
|
4046
4046
|
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); }
|
|
4047
4047
|
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; }
|
|
4048
4048
|
function generatePrivateKey() {
|
|
@@ -4051,133 +4051,96 @@ function generatePrivateKey() {
|
|
|
4051
4051
|
function generatePublicKey(privateKey) {
|
|
4052
4052
|
return (0, _utils.bytesToHex)(_secp256k.schnorr.getPublicKey(privateKey));
|
|
4053
4053
|
}
|
|
4054
|
-
function getPublicKey(
|
|
4055
|
-
|
|
4056
|
-
return publicKey;
|
|
4057
|
-
}
|
|
4058
|
-
function publicKeyExists(webId) {
|
|
4059
|
-
// find publickey
|
|
4060
|
-
var url = new URL(webId);
|
|
4061
|
-
url.hash = '';
|
|
4062
|
-
/* debug.warn('Alain publicKeyExists')
|
|
4063
|
-
debug.warn(webId)
|
|
4064
|
-
debug.warn(url.href) */
|
|
4065
|
-
_solidLogic.store.fetcher.load(url.href);
|
|
4066
|
-
var publicKey = _solidLogic.store.any(_solidLogic.store.sym(webId), _solidLogic.store.sym(_signature.CERT + 'PublicKey'));
|
|
4067
|
-
return publicKey === null || publicKey === void 0 ? void 0 : publicKey.value; // as NamedNode
|
|
4068
|
-
}
|
|
4069
|
-
|
|
4070
|
-
var privKeyUrl = function privKeyUrl(webId) {
|
|
4071
|
-
var url = new URL(webId);
|
|
4072
|
-
var privateKeyUrl = url.protocol + '//' + url.host + '/profile/privateKey.ttl';
|
|
4073
|
-
return privateKeyUrl;
|
|
4074
|
-
};
|
|
4075
|
-
function privateKeyExists(_x) {
|
|
4076
|
-
return _privateKeyExists.apply(this, arguments);
|
|
4054
|
+
function getPublicKey(_x) {
|
|
4055
|
+
return _getPublicKey.apply(this, arguments);
|
|
4077
4056
|
}
|
|
4078
|
-
function
|
|
4079
|
-
|
|
4080
|
-
var
|
|
4057
|
+
function _getPublicKey() {
|
|
4058
|
+
_getPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
|
|
4059
|
+
var publicKeyUrl, key;
|
|
4081
4060
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
4082
4061
|
while (1) switch (_context.prev = _context.next) {
|
|
4083
4062
|
case 0:
|
|
4084
|
-
|
|
4085
|
-
const privateKeyUrl = url.protocol + '//' + url.host + '/profile/privateKey.ttl' */
|
|
4086
|
-
privateKeyUrl = privKeyUrl(webId);
|
|
4087
|
-
/* debug.warn('Alain privateKeyExists')
|
|
4088
|
-
debug.warn(webId)
|
|
4089
|
-
debug.warn(privateKeyUrl) */
|
|
4063
|
+
publicKeyUrl = (0, _cryptoKeyHelpers.pubKeyUrl)(webId);
|
|
4090
4064
|
_context.prev = 1;
|
|
4091
|
-
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4065
|
+
_context.next = 4;
|
|
4066
|
+
return _solidLogic.store.fetcher.load(publicKeyUrl);
|
|
4067
|
+
case 4:
|
|
4068
|
+
// url.href)
|
|
4069
|
+
key = _solidLogic.store.any(_solidLogic.store.sym(webId), _solidLogic.store.sym(_signature.CERT + 'PublicKey'));
|
|
4070
|
+
return _context.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
|
|
4071
|
+
case 8:
|
|
4072
|
+
_context.prev = 8;
|
|
4096
4073
|
_context.t0 = _context["catch"](1);
|
|
4097
|
-
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)) {
|
|
4098
|
-
_context.next = 24;
|
|
4099
|
-
break;
|
|
4100
|
-
}
|
|
4101
|
-
_context.prev = 10;
|
|
4102
|
-
// create privateKey resource
|
|
4103
|
-
data = '';
|
|
4104
|
-
contentType = 'text/ttl';
|
|
4105
|
-
_context.next = 15;
|
|
4106
|
-
return _solidLogic.store.fetcher.webOperation('PUT', privateKeyUrl, {
|
|
4107
|
-
data: data,
|
|
4108
|
-
contentType: contentType
|
|
4109
|
-
});
|
|
4110
|
-
case 15:
|
|
4111
|
-
response = _context.sent;
|
|
4112
|
-
_context.next = 22;
|
|
4113
|
-
break;
|
|
4114
|
-
case 18:
|
|
4115
|
-
_context.prev = 18;
|
|
4116
|
-
_context.t1 = _context["catch"](10);
|
|
4117
|
-
debug.log('createIfNotExists doc FAILED: ' + privateKeyUrl + ': ' + _context.t1);
|
|
4118
|
-
throw _context.t1;
|
|
4119
|
-
case 22:
|
|
4120
|
-
delete _solidLogic.store.fetcher.requested[privateKeyUrl]; // delete cached 404 error
|
|
4121
4074
|
return _context.abrupt("return", undefined);
|
|
4122
|
-
case
|
|
4123
|
-
debug.log('createIfNotExists doc FAILED: ' + privateKeyUrl + ': ' + _context.t0);
|
|
4124
|
-
throw _context.t0;
|
|
4125
|
-
case 26:
|
|
4075
|
+
case 11:
|
|
4126
4076
|
case "end":
|
|
4127
4077
|
return _context.stop();
|
|
4128
4078
|
}
|
|
4129
|
-
}, _callee, null, [[1,
|
|
4079
|
+
}, _callee, null, [[1, 8]]);
|
|
4130
4080
|
}));
|
|
4131
|
-
return
|
|
4081
|
+
return _getPublicKey.apply(this, arguments);
|
|
4132
4082
|
}
|
|
4133
4083
|
function getPrivateKey(_x2) {
|
|
4134
4084
|
return _getPrivateKey.apply(this, arguments);
|
|
4135
4085
|
}
|
|
4136
4086
|
function _getPrivateKey() {
|
|
4137
4087
|
_getPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
|
|
4138
|
-
var
|
|
4088
|
+
var publicKeyUrl, privateKeyUrl, publicKey, privateKey, validPublicKey, del, add;
|
|
4139
4089
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
4140
4090
|
while (1) switch (_context2.prev = _context2.next) {
|
|
4141
4091
|
case 0:
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4092
|
+
// find key url's
|
|
4093
|
+
publicKeyUrl = (0, _cryptoKeyHelpers.pubKeyUrl)(webId);
|
|
4094
|
+
privateKeyUrl = (0, _cryptoKeyHelpers.privKeyUrl)(webId); // find key pair
|
|
4095
|
+
_context2.next = 4;
|
|
4096
|
+
return (0, _cryptoKeyHelpers.publicKeyExists)(webId);
|
|
4097
|
+
case 4:
|
|
4098
|
+
publicKey = _context2.sent;
|
|
4099
|
+
_context2.next = 7;
|
|
4100
|
+
return (0, _cryptoKeyHelpers.privateKeyExists)(webId);
|
|
4101
|
+
case 7:
|
|
4151
4102
|
privateKey = _context2.sent;
|
|
4152
|
-
//
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
// create key pair
|
|
4162
|
-
if (!(!privateKey || !publicKey)) {
|
|
4163
|
-
_context2.next = 19;
|
|
4103
|
+
// is publicKey valid ?
|
|
4104
|
+
validPublicKey = true;
|
|
4105
|
+
if (privateKey && publicKey !== generatePublicKey(privateKey)) {
|
|
4106
|
+
if (confirm('This is strange the publicKey is not valid for\n' + webId + '\'shall we repair keeping the private key ?')) validPublicKey = false;
|
|
4107
|
+
}
|
|
4108
|
+
|
|
4109
|
+
// create key pair or repair publicKey
|
|
4110
|
+
if (!(!privateKey || !publicKey || !validPublicKey)) {
|
|
4111
|
+
_context2.next = 17;
|
|
4164
4112
|
break;
|
|
4165
4113
|
}
|
|
4166
4114
|
del = [];
|
|
4167
|
-
add = [];
|
|
4168
|
-
if (privateKey)
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4115
|
+
add = []; // if (privateKey) del.push($rdf.st($rdf.sym(webId), $rdf.sym(CERT + 'PrivateKey'), $rdf.lit(privateKey), $rdf.sym(privateKeyUrl)))
|
|
4116
|
+
if (!privateKey) {
|
|
4117
|
+
privateKey = generatePrivateKey();
|
|
4118
|
+
add.push($rdf.st($rdf.sym(webId), $rdf.sym(_signature.CERT + 'PrivateKey'), $rdf.literal(privateKey), $rdf.sym(privateKeyUrl)));
|
|
4119
|
+
// TODO delete privateKeyUrl.acl, it may exist !!!
|
|
4120
|
+
}
|
|
4121
|
+
|
|
4122
|
+
if (!publicKey || !validPublicKey) {
|
|
4123
|
+
// delete invalid public key
|
|
4124
|
+
if (publicKey) {
|
|
4125
|
+
del.push($rdf.st($rdf.sym(webId), $rdf.sym(_signature.CERT + 'PublicKey'), $rdf.lit(publicKey), $rdf.sym(publicKeyUrl)));
|
|
4126
|
+
}
|
|
4127
|
+
// insert new valid key
|
|
4128
|
+
publicKey = generatePublicKey(privateKey);
|
|
4129
|
+
add.push($rdf.st($rdf.sym(webId), $rdf.sym(_signature.CERT + 'PublicKey'), $rdf.literal(publicKey), $rdf.sym(publicKeyUrl)));
|
|
4130
|
+
// TODO delete privateKeyUrl.acl, it may exist !!!
|
|
4131
|
+
}
|
|
4132
|
+
/* debug.log('new key pair ' + webId)
|
|
4133
|
+
debug.log('newPrivateKey-1 ' + privateKey)
|
|
4173
4134
|
debug.log('newPublicKey-1 ' + publicKey) */
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4135
|
+
/* debug.log('del')
|
|
4136
|
+
debug.log(del)
|
|
4137
|
+
debug.log('add')
|
|
4138
|
+
debug.log(add) */
|
|
4139
|
+
_context2.next = 17;
|
|
4177
4140
|
return _solidLogic.store.updater.updateMany(del, add);
|
|
4178
|
-
case
|
|
4141
|
+
case 17:
|
|
4179
4142
|
return _context2.abrupt("return", privateKey);
|
|
4180
|
-
case
|
|
4143
|
+
case 18:
|
|
4181
4144
|
case "end":
|
|
4182
4145
|
return _context2.stop();
|
|
4183
4146
|
}
|
|
@@ -4315,10 +4278,9 @@ function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
|
4315
4278
|
var latestVersion = (0, _chatLogic.mostRecentVersion)(message);
|
|
4316
4279
|
var latestVersionCreator = _solidLogic.store.any(latestVersion, ns.foaf('maker'));
|
|
4317
4280
|
// use latest content if same owner, else use original
|
|
4318
|
-
var msgId = creator === latestVersionCreator ? latestVersion : message;
|
|
4281
|
+
var msgId = creator.uri === latestVersionCreator.uri ? latestVersion : message;
|
|
4319
4282
|
var content = _solidLogic.store.any(msgId, ns.sioc('content'));
|
|
4320
4283
|
var signature = _solidLogic.store.any(msgId, $rdf.sym("".concat(_signature.SEC, "Proof")));
|
|
4321
|
-
debug.log('alain ' + (signature === null || signature === void 0 ? void 0 : signature.value));
|
|
4322
4284
|
|
|
4323
4285
|
// verify signature
|
|
4324
4286
|
var msg = (0, _signature.getBlankMsg)();
|
|
@@ -4326,18 +4288,19 @@ function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
|
4326
4288
|
msg.created = _solidLogic.store.any(msgId, ns.dct('created')).value;
|
|
4327
4289
|
msg.content = content.value;
|
|
4328
4290
|
msg.maker = creator.uri;
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4291
|
+
|
|
4292
|
+
// unsigned message
|
|
4293
|
+
if (signature !== null && signature !== void 0 && signature.value) debug.warn(msgId.uri + ' is unsigned'); // TODO replace with UI (colored message ?)
|
|
4294
|
+
// get public key and check signature
|
|
4295
|
+
else {
|
|
4296
|
+
(0, _keys.getPublicKey)(creator.uri).then(function (publicKey) {
|
|
4297
|
+
if (!publicKey) debug.warn('message is signed but ' + creator.uri + ' is missing publicKey');
|
|
4298
|
+
// check publicKey is valid hex string
|
|
4299
|
+
var regex = /[0-9A-Fa-f]{6}/g;
|
|
4300
|
+
if (!(publicKey !== null && publicKey !== void 0 && publicKey.match(regex))) debug.warn('invalid publicKey hex string\n' + creator.uri + '\n' + publicKey);
|
|
4301
|
+
// verify signature
|
|
4302
|
+
else if (signature !== null && signature !== void 0 && signature.value && !(0, _signature.verifySignature)(signature.value, msg, publicKey)) debug.warn('invalid signature\n' + msg.id);
|
|
4303
|
+
});
|
|
4341
4304
|
}
|
|
4342
4305
|
var originalMessage = (0, _chatLogic.originalVersion)(message);
|
|
4343
4306
|
var edited = !message.sameTerm(originalMessage);
|
|
@@ -12439,6 +12402,148 @@ function isLight(x) {
|
|
|
12439
12402
|
|
|
12440
12403
|
/***/ }),
|
|
12441
12404
|
|
|
12405
|
+
/***/ "./lib/utils/cryptoKeyHelpers.js":
|
|
12406
|
+
/*!***************************************!*\
|
|
12407
|
+
!*** ./lib/utils/cryptoKeyHelpers.js ***!
|
|
12408
|
+
\***************************************/
|
|
12409
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
12410
|
+
|
|
12411
|
+
"use strict";
|
|
12412
|
+
|
|
12413
|
+
|
|
12414
|
+
var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
|
|
12415
|
+
var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
|
|
12416
|
+
Object.defineProperty(exports, "__esModule", ({
|
|
12417
|
+
value: true
|
|
12418
|
+
}));
|
|
12419
|
+
exports.privKeyUrl = void 0;
|
|
12420
|
+
exports.privateKeyExists = privateKeyExists;
|
|
12421
|
+
exports.pubKeyUrl = void 0;
|
|
12422
|
+
exports.publicKeyExists = publicKeyExists;
|
|
12423
|
+
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
12424
|
+
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
12425
|
+
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
12426
|
+
var _signature = __webpack_require__(/*! ../chat/signature */ "./lib/chat/signature.js");
|
|
12427
|
+
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
12428
|
+
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); }
|
|
12429
|
+
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; }
|
|
12430
|
+
var pubKeyUrl = function pubKeyUrl(webId) {
|
|
12431
|
+
var url = new URL(webId);
|
|
12432
|
+
var publicKeyUrl = url.origin + '/profile/keys/publicKey.ttl';
|
|
12433
|
+
return publicKeyUrl;
|
|
12434
|
+
};
|
|
12435
|
+
exports.pubKeyUrl = pubKeyUrl;
|
|
12436
|
+
function publicKeyExists(_x) {
|
|
12437
|
+
return _publicKeyExists.apply(this, arguments);
|
|
12438
|
+
}
|
|
12439
|
+
function _publicKeyExists() {
|
|
12440
|
+
_publicKeyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
|
|
12441
|
+
var publicKeyUrl;
|
|
12442
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
12443
|
+
while (1) switch (_context.prev = _context.next) {
|
|
12444
|
+
case 0:
|
|
12445
|
+
// find publickey
|
|
12446
|
+
publicKeyUrl = pubKeyUrl(webId);
|
|
12447
|
+
_context.next = 3;
|
|
12448
|
+
return keyExists(webId, publicKeyUrl, 'PublicKey');
|
|
12449
|
+
case 3:
|
|
12450
|
+
return _context.abrupt("return", _context.sent);
|
|
12451
|
+
case 4:
|
|
12452
|
+
case "end":
|
|
12453
|
+
return _context.stop();
|
|
12454
|
+
}
|
|
12455
|
+
}, _callee);
|
|
12456
|
+
}));
|
|
12457
|
+
return _publicKeyExists.apply(this, arguments);
|
|
12458
|
+
}
|
|
12459
|
+
var privKeyUrl = function privKeyUrl(webId) {
|
|
12460
|
+
var url = new URL(webId);
|
|
12461
|
+
var privateKeyUrl = url.origin + '/profile/keys/privateKey.ttl';
|
|
12462
|
+
return privateKeyUrl;
|
|
12463
|
+
};
|
|
12464
|
+
exports.privKeyUrl = privKeyUrl;
|
|
12465
|
+
function privateKeyExists(_x2) {
|
|
12466
|
+
return _privateKeyExists.apply(this, arguments);
|
|
12467
|
+
}
|
|
12468
|
+
function _privateKeyExists() {
|
|
12469
|
+
_privateKeyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
|
|
12470
|
+
var privateKeyUrl;
|
|
12471
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
12472
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
12473
|
+
case 0:
|
|
12474
|
+
// find privateKey
|
|
12475
|
+
privateKeyUrl = privKeyUrl(webId);
|
|
12476
|
+
_context2.next = 3;
|
|
12477
|
+
return keyExists(webId, privateKeyUrl, 'PrivateKey');
|
|
12478
|
+
case 3:
|
|
12479
|
+
return _context2.abrupt("return", _context2.sent);
|
|
12480
|
+
case 4:
|
|
12481
|
+
case "end":
|
|
12482
|
+
return _context2.stop();
|
|
12483
|
+
}
|
|
12484
|
+
}, _callee2);
|
|
12485
|
+
}));
|
|
12486
|
+
return _privateKeyExists.apply(this, arguments);
|
|
12487
|
+
}
|
|
12488
|
+
function keyExists(_x3, _x4, _x5) {
|
|
12489
|
+
return _keyExists.apply(this, arguments);
|
|
12490
|
+
}
|
|
12491
|
+
function _keyExists() {
|
|
12492
|
+
_keyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId, keyUrl, keyType) {
|
|
12493
|
+
var key, _err$response, data, contentType, response;
|
|
12494
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
12495
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
12496
|
+
case 0:
|
|
12497
|
+
_context3.prev = 0;
|
|
12498
|
+
_context3.next = 3;
|
|
12499
|
+
return _solidLogic.store.fetcher.load(keyUrl);
|
|
12500
|
+
case 3:
|
|
12501
|
+
// url.href)
|
|
12502
|
+
key = _solidLogic.store.any(_solidLogic.store.sym(webId), _solidLogic.store.sym(_signature.CERT + keyType));
|
|
12503
|
+
return _context3.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
|
|
12504
|
+
case 7:
|
|
12505
|
+
_context3.prev = 7;
|
|
12506
|
+
_context3.t0 = _context3["catch"](0);
|
|
12507
|
+
if (!((_context3.t0 === null || _context3.t0 === void 0 ? void 0 : (_err$response = _context3.t0.response) === null || _err$response === void 0 ? void 0 : _err$response.status) === 404)) {
|
|
12508
|
+
_context3.next = 24;
|
|
12509
|
+
break;
|
|
12510
|
+
}
|
|
12511
|
+
_context3.prev = 10;
|
|
12512
|
+
// create privateKey resource
|
|
12513
|
+
data = '';
|
|
12514
|
+
contentType = 'text/turtle';
|
|
12515
|
+
_context3.next = 15;
|
|
12516
|
+
return _solidLogic.store.fetcher.webOperation('PUT', keyUrl, {
|
|
12517
|
+
data: data,
|
|
12518
|
+
contentType: contentType
|
|
12519
|
+
});
|
|
12520
|
+
case 15:
|
|
12521
|
+
response = _context3.sent;
|
|
12522
|
+
_context3.next = 22;
|
|
12523
|
+
break;
|
|
12524
|
+
case 18:
|
|
12525
|
+
_context3.prev = 18;
|
|
12526
|
+
_context3.t1 = _context3["catch"](10);
|
|
12527
|
+
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context3.t1);
|
|
12528
|
+
throw _context3.t1;
|
|
12529
|
+
case 22:
|
|
12530
|
+
delete _solidLogic.store.fetcher.requested[keyUrl]; // delete cached 404 error
|
|
12531
|
+
return _context3.abrupt("return", undefined);
|
|
12532
|
+
case 24:
|
|
12533
|
+
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context3.t0);
|
|
12534
|
+
throw _context3.t0;
|
|
12535
|
+
case 26:
|
|
12536
|
+
case "end":
|
|
12537
|
+
return _context3.stop();
|
|
12538
|
+
}
|
|
12539
|
+
}, _callee3, null, [[0, 7], [10, 18]]);
|
|
12540
|
+
}));
|
|
12541
|
+
return _keyExists.apply(this, arguments);
|
|
12542
|
+
}
|
|
12543
|
+
//# sourceMappingURL=cryptoKeyHelpers.js.map
|
|
12544
|
+
|
|
12545
|
+
/***/ }),
|
|
12546
|
+
|
|
12442
12547
|
/***/ "./lib/utils/headerFooterHelpers.js":
|
|
12443
12548
|
/*!******************************************!*\
|
|
12444
12549
|
!*** ./lib/utils/headerFooterHelpers.js ***!
|
|
@@ -13285,8 +13390,8 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
13285
13390
|
}));
|
|
13286
13391
|
exports.versionInfo = void 0;
|
|
13287
13392
|
var versionInfo = {
|
|
13288
|
-
buildTime: '2023-04-
|
|
13289
|
-
commit: '
|
|
13393
|
+
buildTime: '2023-04-27T18:48:41Z',
|
|
13394
|
+
commit: '2766a18921371fdd8973e038c654ebdd72f8b347',
|
|
13290
13395
|
npmInfo: {
|
|
13291
13396
|
'solid-ui': '2.4.27',
|
|
13292
13397
|
npm: '8.19.4',
|