solid-ui 2.4.27-fd5a7172 → 2.4.28-1c2b4154
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 +161 -180
- 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 +2 -9
- package/lib/chat/chatLogic.js.map +1 -1
- package/lib/chat/keys.d.ts.map +1 -1
- package/lib/chat/keys.js +9 -9
- package/lib/chat/keys.js.map +1 -1
- package/lib/chat/message.js +37 -12
- package/lib/chat/message.js.map +1 -1
- package/lib/chat/signature.d.ts +0 -1
- package/lib/chat/signature.d.ts.map +1 -1
- package/lib/chat/signature.js +3 -4
- package/lib/chat/signature.js.map +1 -1
- package/lib/utils/keyHelpers/accessData.d.ts +1 -2
- package/lib/utils/keyHelpers/accessData.d.ts.map +1 -1
- package/lib/utils/keyHelpers/accessData.js +107 -143
- package/lib/utils/keyHelpers/accessData.js.map +1 -1
- package/lib/versionInfo.js +3 -3
- package/lib/versionInfo.js.map +1 -1
- package/package.json +1 -1
package/dist/solid-ui.js
CHANGED
|
@@ -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;
|
|
@@ -2714,14 +2713,8 @@ var ChatChannel = /*#__PURE__*/function () {
|
|
|
2714
2713
|
case 32:
|
|
2715
2714
|
privateKey = _context2.sent;
|
|
2716
2715
|
// me.uri)
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
/* const pubKey = await getPublicKey(me)
|
|
2720
|
-
const verify = verifySignature(sig, msg, pubKey) // alain to remove
|
|
2721
|
-
debug.warn('sig ' + sig)
|
|
2722
|
-
debug.warn('verifySign ' + verify)
|
|
2723
|
-
debug.warn(msg) */
|
|
2724
|
-
sts.push($rdf.st(message, $rdf.sym("".concat(_signature.SEC, "Proof")), $rdf.lit(sig), chatDocument));
|
|
2716
|
+
sig = (0, _signature.signMsg)(msg, privateKey);
|
|
2717
|
+
sts.push($rdf.st(message, $rdf.sym("".concat(_signature.SEC, "proofValue")), $rdf.lit(sig), chatDocument));
|
|
2725
2718
|
case 35:
|
|
2726
2719
|
_context2.prev = 35;
|
|
2727
2720
|
_context2.next = 38;
|
|
@@ -4040,7 +4033,7 @@ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/r
|
|
|
4040
4033
|
var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
|
|
4041
4034
|
var _secp256k = __webpack_require__(/*! @noble/curves/secp256k1 */ "./node_modules/@noble/curves/secp256k1.js");
|
|
4042
4035
|
var _utils = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/@noble/hashes/utils.js");
|
|
4043
|
-
var
|
|
4036
|
+
var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
|
|
4044
4037
|
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
4045
4038
|
var $rdf = _interopRequireWildcard(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
|
|
4046
4039
|
var _accessData = __webpack_require__(/*! ../utils/keyHelpers/accessData */ "./lib/utils/keyHelpers/accessData.js");
|
|
@@ -4082,7 +4075,7 @@ function _getPublicKey() {
|
|
|
4082
4075
|
return _solidLogic.store.fetcher.load(publicKeyDoc);
|
|
4083
4076
|
case 8:
|
|
4084
4077
|
// url.href)
|
|
4085
|
-
key = _solidLogic.store.any(webId,
|
|
4078
|
+
key = _solidLogic.store.any(webId, ns.solid('publicKey'));
|
|
4086
4079
|
return _context2.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
|
|
4087
4080
|
case 12:
|
|
4088
4081
|
_context2.prev = 12;
|
|
@@ -4136,14 +4129,14 @@ function _getPrivateKey() {
|
|
|
4136
4129
|
break;
|
|
4137
4130
|
}
|
|
4138
4131
|
del = [];
|
|
4139
|
-
add = [];
|
|
4132
|
+
add = [];
|
|
4140
4133
|
if (privateKey) {
|
|
4141
4134
|
_context3.next = 24;
|
|
4142
4135
|
break;
|
|
4143
4136
|
}
|
|
4144
4137
|
// add = []
|
|
4145
4138
|
privateKey = generatePrivateKey();
|
|
4146
|
-
add = [$rdf.st(webId,
|
|
4139
|
+
add = [$rdf.st(webId, ns.solid('privateKey'), $rdf.literal(privateKey), _solidLogic.store.sym(privateKeyDoc))];
|
|
4147
4140
|
_context3.next = 24;
|
|
4148
4141
|
return saveKey(privateKeyDoc, [], add, webId.uri);
|
|
4149
4142
|
case 24:
|
|
@@ -4154,12 +4147,12 @@ function _getPrivateKey() {
|
|
|
4154
4147
|
del = [];
|
|
4155
4148
|
// delete invalid public key
|
|
4156
4149
|
if (publicKey) {
|
|
4157
|
-
del = [$rdf.st(webId,
|
|
4150
|
+
del = [$rdf.st(webId, ns.solid('publicKey'), $rdf.lit(publicKey), _solidLogic.store.sym(publicKeyDoc))];
|
|
4158
4151
|
debug.log(del);
|
|
4159
4152
|
}
|
|
4160
4153
|
// update new valid key
|
|
4161
4154
|
newPublicKey = generatePublicKey(privateKey);
|
|
4162
|
-
add = [$rdf.st(webId,
|
|
4155
|
+
add = [$rdf.st(webId, ns.solid('publicKey'), $rdf.literal(newPublicKey), _solidLogic.store.sym(publicKeyDoc))];
|
|
4163
4156
|
_context3.next = 31;
|
|
4164
4157
|
return saveKey(publicKeyDoc, del, add);
|
|
4165
4158
|
case 31:
|
|
@@ -4176,7 +4169,7 @@ function _getPrivateKey() {
|
|
|
4176
4169
|
}));
|
|
4177
4170
|
return _getPrivateKey.apply(this, arguments);
|
|
4178
4171
|
}
|
|
4179
|
-
var
|
|
4172
|
+
var deleteKeyAcl = /*#__PURE__*/function () {
|
|
4180
4173
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(keyDoc) {
|
|
4181
4174
|
var keyAclDoc, response;
|
|
4182
4175
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
@@ -4215,7 +4208,7 @@ var deleteKey = /*#__PURE__*/function () {
|
|
|
4215
4208
|
}
|
|
4216
4209
|
}, _callee, null, [[4, 11]]);
|
|
4217
4210
|
}));
|
|
4218
|
-
return function
|
|
4211
|
+
return function deleteKeyAcl(_x3) {
|
|
4219
4212
|
return _ref.apply(this, arguments);
|
|
4220
4213
|
};
|
|
4221
4214
|
}();
|
|
@@ -4237,7 +4230,7 @@ function _saveKey() {
|
|
|
4237
4230
|
while (1) switch (_context4.prev = _context4.next) {
|
|
4238
4231
|
case 0:
|
|
4239
4232
|
_context4.next = 2;
|
|
4240
|
-
return
|
|
4233
|
+
return deleteKeyAcl(keyDoc);
|
|
4241
4234
|
case 2:
|
|
4242
4235
|
_context4.next = 4;
|
|
4243
4236
|
return _solidLogic.store.updater.updateMany(del, add);
|
|
@@ -4308,7 +4301,11 @@ var messageBodyStyle = style.messageBodyStyle;
|
|
|
4308
4301
|
var label = utils.label;
|
|
4309
4302
|
|
|
4310
4303
|
/**
|
|
4304
|
+
* elementForImageURI
|
|
4311
4305
|
* HTML component for an image
|
|
4306
|
+
* @param imageUri
|
|
4307
|
+
* @param options { inlineImageHeightEms }
|
|
4308
|
+
* @returns HTMLAnchorElement For Image
|
|
4312
4309
|
*/
|
|
4313
4310
|
function elementForImageURI(imageUri, options) {
|
|
4314
4311
|
var img = dom.createElement('img');
|
|
@@ -4338,21 +4335,27 @@ var anchor = function anchor(text, term) {
|
|
|
4338
4335
|
a.textContent = text;
|
|
4339
4336
|
return a;
|
|
4340
4337
|
};
|
|
4341
|
-
function
|
|
4338
|
+
function nickname(person) {
|
|
4342
4339
|
var s = _solidLogic.store.any(person, ns.foaf('nick'));
|
|
4343
4340
|
if (s) return '' + s.value;
|
|
4344
4341
|
return '' + label(person);
|
|
4345
4342
|
}
|
|
4346
4343
|
|
|
4347
4344
|
/**
|
|
4345
|
+
* creatorAndDate
|
|
4348
4346
|
* Displays creator and date for a chat message
|
|
4349
4347
|
* inside the `td1` element
|
|
4348
|
+
* @param td1
|
|
4349
|
+
* @param creator
|
|
4350
|
+
* @param date
|
|
4351
|
+
* @param message
|
|
4352
|
+
* @returns HTMLAnchorElement For Image
|
|
4350
4353
|
*/
|
|
4351
4354
|
function creatorAndDate(td1, creator, date, message) {
|
|
4352
|
-
var nickAnchor = td1.appendChild(anchor(
|
|
4355
|
+
var nickAnchor = td1.appendChild(anchor(nickname(creator), creator));
|
|
4353
4356
|
if (creator.uri) {
|
|
4354
4357
|
_solidLogic.store.fetcher.nowOrWhenFetched(creator.doc(), undefined, function (_ok, _body) {
|
|
4355
|
-
nickAnchor.textContent =
|
|
4358
|
+
nickAnchor.textContent = nickname(creator);
|
|
4356
4359
|
});
|
|
4357
4360
|
}
|
|
4358
4361
|
td1.appendChild(dom.createElement('br'));
|
|
@@ -4360,14 +4363,20 @@ function creatorAndDate(td1, creator, date, message) {
|
|
|
4360
4363
|
}
|
|
4361
4364
|
|
|
4362
4365
|
/**
|
|
4366
|
+
* creatorAndDateHorizontal
|
|
4363
4367
|
* Horizontally displays creator and date for a chat message
|
|
4364
4368
|
* inside the `td1` element
|
|
4369
|
+
* @param td1
|
|
4370
|
+
* @param creator
|
|
4371
|
+
* @param date
|
|
4372
|
+
* @param message
|
|
4373
|
+
* @returns HTMLAnchorElement For Image
|
|
4365
4374
|
*/
|
|
4366
4375
|
function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
4367
4376
|
var nickAnchor = td1.appendChild(anchor(label(creator), creator));
|
|
4368
4377
|
if (creator.uri) {
|
|
4369
4378
|
_solidLogic.store.fetcher.nowOrWhenFetched(creator.doc(), undefined, function (_ok, _body) {
|
|
4370
|
-
nickAnchor.textContent =
|
|
4379
|
+
nickAnchor.textContent = nickname(creator);
|
|
4371
4380
|
});
|
|
4372
4381
|
}
|
|
4373
4382
|
var dateBit = td1.appendChild(anchor(date, message));
|
|
@@ -4377,9 +4386,17 @@ function creatorAndDateHorizontal(td1, creator, date, message) {
|
|
|
4377
4386
|
}
|
|
4378
4387
|
|
|
4379
4388
|
/**
|
|
4389
|
+
* renderMessageRow
|
|
4380
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
|
|
4381
4397
|
*/
|
|
4382
4398
|
function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
4399
|
+
var unsignedMessage = false;
|
|
4383
4400
|
var colorizeByAuthor = options.colorizeByAuthor === '1' || options.colorizeByAuthor === true;
|
|
4384
4401
|
var creator = _solidLogic.store.any(message, ns.foaf('maker'));
|
|
4385
4402
|
var date = _solidLogic.store.any(message, ns.dct('created'));
|
|
@@ -4389,7 +4406,7 @@ function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
|
4389
4406
|
// use latest content if same owner, else use original
|
|
4390
4407
|
var msgId = creator.uri === latestVersionCreator.uri ? latestVersion : message;
|
|
4391
4408
|
var content = _solidLogic.store.any(msgId, ns.sioc('content'));
|
|
4392
|
-
var signature = _solidLogic.store.any(msgId, $rdf.sym("".concat(_signature.SEC, "
|
|
4409
|
+
var signature = _solidLogic.store.any(msgId, $rdf.sym("".concat(_signature.SEC, "proofValue")));
|
|
4393
4410
|
|
|
4394
4411
|
// set message object
|
|
4395
4412
|
var msg = (0, _signature.getBlankMsg)();
|
|
@@ -4399,10 +4416,11 @@ function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
|
4399
4416
|
msg.maker = creator.uri;
|
|
4400
4417
|
|
|
4401
4418
|
// unsigned message
|
|
4402
|
-
if (!(signature !== null && signature !== void 0 && signature.value))
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
else {
|
|
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
|
|
4406
4424
|
(0, _keys.getPublicKey)(creator).then(function (publicKey) {
|
|
4407
4425
|
debug.log(creator.uri + '\n' + msg.created + '\n' + msg.id + '\n' + publicKey);
|
|
4408
4426
|
if (!publicKey) {
|
|
@@ -4422,6 +4440,7 @@ function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
|
4422
4440
|
var sortDate = _solidLogic.store.the(originalMessage, ns.dct('created'), null, originalMessage.doc()); // In message
|
|
4423
4441
|
|
|
4424
4442
|
var messageRow = dom.createElement('tr');
|
|
4443
|
+
if (unsignedMessage) messageRow.setAttribute('style', 'background-color: red');
|
|
4425
4444
|
messageRow.AJAR_date = sortDate.value;
|
|
4426
4445
|
messageRow.AJAR_subject = message;
|
|
4427
4446
|
var td1 = dom.createElement('td');
|
|
@@ -4510,7 +4529,8 @@ function renderMessageRow(channelObject, message, fresh, options, userContext) {
|
|
|
4510
4529
|
toolsTD.appendChild(tools);
|
|
4511
4530
|
});
|
|
4512
4531
|
return messageRow;
|
|
4513
|
-
}
|
|
4532
|
+
} // END OF RENDERMESSAGE
|
|
4533
|
+
|
|
4514
4534
|
function switchToEditor(messageRow, message, channelObject, userContext) {
|
|
4515
4535
|
var messageTable = messageRow.parentNode;
|
|
4516
4536
|
var editRow = renderMessageEditor(channelObject, messageTable, userContext, channelObject.options, (0, _chatLogic.mostRecentVersion)(message));
|
|
@@ -4555,8 +4575,6 @@ function renderMessageEditor(channelObject, messageTable, userContext, options,
|
|
|
4555
4575
|
while (1) switch (_context7.prev = _context7.next) {
|
|
4556
4576
|
case 0:
|
|
4557
4577
|
sendComplete = function _sendComplete(message, _text2) {
|
|
4558
|
-
// const dateStamp = store.any(message, ns.dct('created'), null, message.doc())
|
|
4559
|
-
// const content = $rdf.literal(text2)
|
|
4560
4578
|
(0, _infinite.insertMessageIntoTable)(channelObject, messageTable, message, false, options, userContext); // not green
|
|
4561
4579
|
|
|
4562
4580
|
if (originalMessage) {
|
|
@@ -5209,7 +5227,7 @@ function messageToolbar(message, messageRow, userContext, channelObject) {
|
|
|
5209
5227
|
Object.defineProperty(exports, "__esModule", ({
|
|
5210
5228
|
value: true
|
|
5211
5229
|
}));
|
|
5212
|
-
exports.SEC =
|
|
5230
|
+
exports.SEC = void 0;
|
|
5213
5231
|
exports.getBlankMsg = getBlankMsg;
|
|
5214
5232
|
exports.getMsgHash = getMsgHash;
|
|
5215
5233
|
exports.serializeMsg = serializeMsg;
|
|
@@ -5227,8 +5245,7 @@ exports.utf8Decoder = utf8Decoder;
|
|
|
5227
5245
|
var utf8Encoder = new TextEncoder();
|
|
5228
5246
|
exports.utf8Encoder = utf8Encoder;
|
|
5229
5247
|
var SEC = 'https://w3id.org/security#'; // Proof, VerificationMethod
|
|
5230
|
-
|
|
5231
|
-
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
|
|
5232
5249
|
|
|
5233
5250
|
/* eslint-disable no-unused-vars */
|
|
5234
5251
|
/* export enum Kind {
|
|
@@ -5254,7 +5271,7 @@ var CERT = 'http://www.w3.org/ns/auth/cert#'; // PrivateKey, PublicKey
|
|
|
5254
5271
|
ProfileBadge = 30009,
|
|
5255
5272
|
Article = 30023
|
|
5256
5273
|
} */
|
|
5257
|
-
exports.
|
|
5274
|
+
exports.SEC = SEC;
|
|
5258
5275
|
function getBlankMsg() {
|
|
5259
5276
|
return {
|
|
5260
5277
|
id: '',
|
|
@@ -13255,218 +13272,182 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
13255
13272
|
exports.getExistingPrivateKey = getExistingPrivateKey;
|
|
13256
13273
|
exports.getExistingPublicKey = getExistingPublicKey;
|
|
13257
13274
|
exports.getKeyIfExists = getKeyIfExists;
|
|
13258
|
-
exports.pubKeyUrl = exports.privKeyUrl =
|
|
13275
|
+
exports.pubKeyUrl = exports.privKeyUrl = void 0;
|
|
13259
13276
|
var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
|
|
13260
13277
|
var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
|
|
13261
13278
|
var debug = _interopRequireWildcard(__webpack_require__(/*! ../../debug */ "./lib/debug.js"));
|
|
13262
|
-
var _signature = __webpack_require__(/*! ../../chat/signature */ "./lib/chat/signature.js");
|
|
13263
13279
|
var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
|
|
13264
13280
|
var ns = _interopRequireWildcard(__webpack_require__(/*! ../../ns */ "./lib/ns.js"));
|
|
13265
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); }
|
|
13266
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; }
|
|
13267
|
-
|
|
13283
|
+
/* export const getPodRoot = async (webId: NamedNode) => {
|
|
13284
|
+
const webIdURL = new URL(webId.uri)
|
|
13285
|
+
// find storages in webId document
|
|
13286
|
+
await store.fetcher.load(webId.uri)
|
|
13287
|
+
const storages = store.each(webId, ns.space('storage'), null, webId.doc())
|
|
13288
|
+
var podRoot: NamedNode | undefined
|
|
13289
|
+
if (!storages?.length) {
|
|
13290
|
+
// find storage recursively in webId URL
|
|
13291
|
+
let path = webIdURL.pathname
|
|
13292
|
+
while (path.length) {
|
|
13293
|
+
path = path.substring(0, path.lastIndexOf('/'))
|
|
13294
|
+
podRoot = store.sym(webIdURL.origin + path + '/')
|
|
13295
|
+
const res = await store.fetcher.webOperation('HEAD', podRoot.uri)
|
|
13296
|
+
if (res.headers.get('link')?.includes(ns.space('Storage').value)) break
|
|
13297
|
+
if (!path) debug.warn(`Current user storage not found for\n${webId}`)
|
|
13298
|
+
}
|
|
13299
|
+
} else {
|
|
13300
|
+
// give preference to storage in webId root
|
|
13301
|
+
podRoot = storages.find((storage) => webIdURL.origin === new URL(storage.value).origin) as NamedNode
|
|
13302
|
+
if (!podRoot) podRoot = storages[0] as NamedNode
|
|
13303
|
+
}
|
|
13304
|
+
|
|
13305
|
+
return podRoot as NamedNode
|
|
13306
|
+
} */
|
|
13307
|
+
|
|
13308
|
+
var pubKeyUrl = /*#__PURE__*/function () {
|
|
13268
13309
|
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
|
|
13269
|
-
var
|
|
13270
|
-
var
|
|
13310
|
+
var _store$any, _parentSettings;
|
|
13311
|
+
var parentSettings;
|
|
13271
13312
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
13272
13313
|
while (1) switch (_context.prev = _context.next) {
|
|
13273
13314
|
case 0:
|
|
13274
|
-
|
|
13275
|
-
|
|
13276
|
-
|
|
13277
|
-
|
|
13278
|
-
storages = _solidLogic.store.each(webId, ns.space('storage'), null, webId.doc());
|
|
13279
|
-
if (storages !== null && storages !== void 0 && storages.length) {
|
|
13280
|
-
_context.next = 19;
|
|
13281
|
-
break;
|
|
13282
|
-
}
|
|
13283
|
-
// find storage recursively in webId URL
|
|
13284
|
-
path = webIdURL.pathname;
|
|
13285
|
-
case 6:
|
|
13286
|
-
if (!path.length) {
|
|
13287
|
-
_context.next = 17;
|
|
13288
|
-
break;
|
|
13289
|
-
}
|
|
13290
|
-
path = path.substring(0, path.lastIndexOf('/'));
|
|
13291
|
-
podRoot = _solidLogic.store.sym(webIdURL.origin + path + '/');
|
|
13292
|
-
_context.next = 11;
|
|
13293
|
-
return _solidLogic.store.fetcher.webOperation('HEAD', podRoot.uri);
|
|
13294
|
-
case 11:
|
|
13295
|
-
res = _context.sent;
|
|
13296
|
-
if (!((_res$headers$get = res.headers.get('link')) !== null && _res$headers$get !== void 0 && _res$headers$get.includes(ns.space('Storage').value))) {
|
|
13297
|
-
_context.next = 14;
|
|
13315
|
+
parentSettings = (_store$any = _solidLogic.store.any(webId, ns.space('preferencesFile'), null, webId.doc())) === null || _store$any === void 0 ? void 0 : _store$any.value;
|
|
13316
|
+
parentSettings = (_parentSettings = parentSettings) === null || _parentSettings === void 0 ? void 0 : _parentSettings.split('/').slice(0, -2).join('/');
|
|
13317
|
+
if (parentSettings) {
|
|
13318
|
+
_context.next = 4;
|
|
13298
13319
|
break;
|
|
13299
13320
|
}
|
|
13300
|
-
|
|
13301
|
-
case
|
|
13302
|
-
|
|
13303
|
-
|
|
13304
|
-
break;
|
|
13305
|
-
case 17:
|
|
13306
|
-
_context.next = 21;
|
|
13307
|
-
break;
|
|
13308
|
-
case 19:
|
|
13309
|
-
// give preference to storage in webId root
|
|
13310
|
-
podRoot = storages.find(function (storage) {
|
|
13311
|
-
return webIdURL.origin === new URL(storage.value).origin;
|
|
13312
|
-
});
|
|
13313
|
-
if (!podRoot) podRoot = storages[0];
|
|
13314
|
-
case 21:
|
|
13315
|
-
return _context.abrupt("return", (_podRoot = podRoot) === null || _podRoot === void 0 ? void 0 : _podRoot.value);
|
|
13316
|
-
case 22:
|
|
13321
|
+
throw new Error("prefererencesFile is expected to exist in ".concat(webId.doc));
|
|
13322
|
+
case 4:
|
|
13323
|
+
return _context.abrupt("return", "".concat(parentSettings, "/profile/keys/publicKey.ttl"));
|
|
13324
|
+
case 5:
|
|
13317
13325
|
case "end":
|
|
13318
13326
|
return _context.stop();
|
|
13319
13327
|
}
|
|
13320
13328
|
}, _callee);
|
|
13321
13329
|
}));
|
|
13322
|
-
return function
|
|
13330
|
+
return function pubKeyUrl(_x) {
|
|
13323
13331
|
return _ref.apply(this, arguments);
|
|
13324
13332
|
};
|
|
13325
13333
|
}();
|
|
13326
|
-
exports.getPodRoot = getPodRoot;
|
|
13327
|
-
var pubKeyUrl = /*#__PURE__*/function () {
|
|
13328
|
-
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
|
|
13329
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
13330
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
13331
|
-
case 0:
|
|
13332
|
-
_context2.prev = 0;
|
|
13333
|
-
_context2.next = 3;
|
|
13334
|
-
return getPodRoot(webId);
|
|
13335
|
-
case 3:
|
|
13336
|
-
_context2.t0 = _context2.sent;
|
|
13337
|
-
return _context2.abrupt("return", _context2.t0 + 'profile/keys/publicKey.ttl');
|
|
13338
|
-
case 7:
|
|
13339
|
-
_context2.prev = 7;
|
|
13340
|
-
_context2.t1 = _context2["catch"](0);
|
|
13341
|
-
throw new Error(_context2.t1);
|
|
13342
|
-
case 10:
|
|
13343
|
-
case "end":
|
|
13344
|
-
return _context2.stop();
|
|
13345
|
-
}
|
|
13346
|
-
}, _callee2, null, [[0, 7]]);
|
|
13347
|
-
}));
|
|
13348
|
-
return function pubKeyUrl(_x2) {
|
|
13349
|
-
return _ref2.apply(this, arguments);
|
|
13350
|
-
};
|
|
13351
|
-
}();
|
|
13352
13334
|
exports.pubKeyUrl = pubKeyUrl;
|
|
13353
|
-
function getExistingPublicKey(
|
|
13335
|
+
function getExistingPublicKey(_x2, _x3) {
|
|
13354
13336
|
return _getExistingPublicKey.apply(this, arguments);
|
|
13355
13337
|
}
|
|
13356
13338
|
function _getExistingPublicKey() {
|
|
13357
|
-
_getExistingPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
13358
|
-
return _regenerator["default"].wrap(function
|
|
13359
|
-
while (1) switch (
|
|
13339
|
+
_getExistingPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId, publicKeyUrl) {
|
|
13340
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
13341
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
13360
13342
|
case 0:
|
|
13361
|
-
|
|
13362
|
-
return getKeyIfExists(webId, publicKeyUrl, '
|
|
13343
|
+
_context3.next = 2;
|
|
13344
|
+
return getKeyIfExists(webId, publicKeyUrl, 'publicKey');
|
|
13363
13345
|
case 2:
|
|
13364
|
-
return
|
|
13346
|
+
return _context3.abrupt("return", _context3.sent);
|
|
13365
13347
|
case 3:
|
|
13366
13348
|
case "end":
|
|
13367
|
-
return
|
|
13349
|
+
return _context3.stop();
|
|
13368
13350
|
}
|
|
13369
|
-
},
|
|
13351
|
+
}, _callee3);
|
|
13370
13352
|
}));
|
|
13371
13353
|
return _getExistingPublicKey.apply(this, arguments);
|
|
13372
13354
|
}
|
|
13373
13355
|
var privKeyUrl = /*#__PURE__*/function () {
|
|
13374
|
-
var
|
|
13375
|
-
|
|
13376
|
-
|
|
13356
|
+
var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
|
|
13357
|
+
var _store$any2, _settings;
|
|
13358
|
+
var settings;
|
|
13359
|
+
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
13360
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
13377
13361
|
case 0:
|
|
13378
|
-
|
|
13379
|
-
|
|
13380
|
-
|
|
13381
|
-
|
|
13382
|
-
|
|
13383
|
-
|
|
13384
|
-
|
|
13385
|
-
|
|
13386
|
-
|
|
13387
|
-
|
|
13388
|
-
case 10:
|
|
13362
|
+
settings = (_store$any2 = _solidLogic.store.any(webId, ns.space('preferencesFile'), null, webId.doc())) === null || _store$any2 === void 0 ? void 0 : _store$any2.value;
|
|
13363
|
+
settings = (_settings = settings) === null || _settings === void 0 ? void 0 : _settings.split('/').slice(0, -1).join('/');
|
|
13364
|
+
if (settings) {
|
|
13365
|
+
_context2.next = 4;
|
|
13366
|
+
break;
|
|
13367
|
+
}
|
|
13368
|
+
throw new Error("prefererencesFile is expected to exist in ".concat(webId.doc));
|
|
13369
|
+
case 4:
|
|
13370
|
+
return _context2.abrupt("return", "".concat(settings, "/keys/privateKey.ttl"));
|
|
13371
|
+
case 5:
|
|
13389
13372
|
case "end":
|
|
13390
|
-
return
|
|
13373
|
+
return _context2.stop();
|
|
13391
13374
|
}
|
|
13392
|
-
},
|
|
13375
|
+
}, _callee2);
|
|
13393
13376
|
}));
|
|
13394
|
-
return function privKeyUrl(
|
|
13395
|
-
return
|
|
13377
|
+
return function privKeyUrl(_x4) {
|
|
13378
|
+
return _ref2.apply(this, arguments);
|
|
13396
13379
|
};
|
|
13397
13380
|
}();
|
|
13398
13381
|
exports.privKeyUrl = privKeyUrl;
|
|
13399
|
-
function getExistingPrivateKey(
|
|
13382
|
+
function getExistingPrivateKey(_x5, _x6) {
|
|
13400
13383
|
return _getExistingPrivateKey.apply(this, arguments);
|
|
13401
13384
|
}
|
|
13402
13385
|
function _getExistingPrivateKey() {
|
|
13403
|
-
_getExistingPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
13404
|
-
return _regenerator["default"].wrap(function
|
|
13405
|
-
while (1) switch (
|
|
13386
|
+
_getExistingPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(webId, privateKeyUrl) {
|
|
13387
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
13388
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
13406
13389
|
case 0:
|
|
13407
|
-
|
|
13408
|
-
return getKeyIfExists(webId, privateKeyUrl, '
|
|
13390
|
+
_context4.next = 2;
|
|
13391
|
+
return getKeyIfExists(webId, privateKeyUrl, 'privateKey');
|
|
13409
13392
|
case 2:
|
|
13410
|
-
return
|
|
13393
|
+
return _context4.abrupt("return", _context4.sent);
|
|
13411
13394
|
case 3:
|
|
13412
13395
|
case "end":
|
|
13413
|
-
return
|
|
13396
|
+
return _context4.stop();
|
|
13414
13397
|
}
|
|
13415
|
-
},
|
|
13398
|
+
}, _callee4);
|
|
13416
13399
|
}));
|
|
13417
13400
|
return _getExistingPrivateKey.apply(this, arguments);
|
|
13418
13401
|
}
|
|
13419
|
-
function getKeyIfExists(_x8, _x9
|
|
13402
|
+
function getKeyIfExists(_x7, _x8, _x9) {
|
|
13420
13403
|
return _getKeyIfExists.apply(this, arguments);
|
|
13421
13404
|
}
|
|
13422
13405
|
function _getKeyIfExists() {
|
|
13423
|
-
_getKeyIfExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
13424
|
-
var key
|
|
13425
|
-
return _regenerator["default"].wrap(function
|
|
13426
|
-
while (1) switch (
|
|
13406
|
+
_getKeyIfExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(webId, keyUrl, keyType) {
|
|
13407
|
+
var key;
|
|
13408
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
13409
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
13427
13410
|
case 0:
|
|
13428
|
-
|
|
13429
|
-
|
|
13411
|
+
_context5.prev = 0;
|
|
13412
|
+
_context5.next = 3;
|
|
13430
13413
|
return _solidLogic.store.fetcher.load(keyUrl);
|
|
13431
13414
|
case 3:
|
|
13432
|
-
key = _solidLogic.store.any(webId,
|
|
13433
|
-
return
|
|
13415
|
+
key = _solidLogic.store.any(webId, ns.solid(keyType)); // store.sym(CERT + keyType))
|
|
13416
|
+
return _context5.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
|
|
13434
13417
|
case 7:
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
if (!(
|
|
13438
|
-
|
|
13418
|
+
_context5.prev = 7;
|
|
13419
|
+
_context5.t0 = _context5["catch"](0);
|
|
13420
|
+
if (!(_context5.t0.response.status === 404)) {
|
|
13421
|
+
_context5.next = 24;
|
|
13439
13422
|
break;
|
|
13440
13423
|
}
|
|
13441
|
-
|
|
13442
|
-
|
|
13443
|
-
|
|
13444
|
-
contentType = 'text/turtle';
|
|
13445
|
-
_context6.next = 15;
|
|
13424
|
+
debug.log('createIfNotExists: doc does NOT exist, will create... ' + keyUrl);
|
|
13425
|
+
_context5.prev = 11;
|
|
13426
|
+
_context5.next = 14;
|
|
13446
13427
|
return _solidLogic.store.fetcher.webOperation('PUT', keyUrl, {
|
|
13447
|
-
data:
|
|
13448
|
-
contentType:
|
|
13428
|
+
data: '',
|
|
13429
|
+
contentType: 'text/turtle'
|
|
13449
13430
|
});
|
|
13450
|
-
case
|
|
13451
|
-
|
|
13452
|
-
_context6.next = 22;
|
|
13431
|
+
case 14:
|
|
13432
|
+
_context5.next = 20;
|
|
13453
13433
|
break;
|
|
13454
|
-
case
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' +
|
|
13458
|
-
throw
|
|
13459
|
-
case
|
|
13434
|
+
case 16:
|
|
13435
|
+
_context5.prev = 16;
|
|
13436
|
+
_context5.t1 = _context5["catch"](11);
|
|
13437
|
+
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context5.t1);
|
|
13438
|
+
throw _context5.t1;
|
|
13439
|
+
case 20:
|
|
13460
13440
|
delete _solidLogic.store.fetcher.requested[keyUrl]; // delete cached 404 error
|
|
13461
|
-
|
|
13441
|
+
// debug.log('createIfNotExists doc created ok ' + doc)
|
|
13442
|
+
return _context5.abrupt("return", undefined);
|
|
13462
13443
|
case 24:
|
|
13463
|
-
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' +
|
|
13464
|
-
throw
|
|
13444
|
+
debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context5.t0);
|
|
13445
|
+
throw _context5.t0;
|
|
13465
13446
|
case 26:
|
|
13466
13447
|
case "end":
|
|
13467
|
-
return
|
|
13448
|
+
return _context5.stop();
|
|
13468
13449
|
}
|
|
13469
|
-
},
|
|
13450
|
+
}, _callee5, null, [[0, 7], [11, 16]]);
|
|
13470
13451
|
}));
|
|
13471
13452
|
return _getKeyIfExists.apply(this, arguments);
|
|
13472
13453
|
}
|
|
@@ -13705,10 +13686,10 @@ Object.defineProperty(exports, "__esModule", ({
|
|
|
13705
13686
|
}));
|
|
13706
13687
|
exports.versionInfo = void 0;
|
|
13707
13688
|
var versionInfo = {
|
|
13708
|
-
buildTime: '2023-05-
|
|
13709
|
-
commit: '
|
|
13689
|
+
buildTime: '2023-05-26T10:41:25Z',
|
|
13690
|
+
commit: '1c2b415466be94bd30f6183f1180047f5a94a8bb',
|
|
13710
13691
|
npmInfo: {
|
|
13711
|
-
'solid-ui': '2.4.
|
|
13692
|
+
'solid-ui': '2.4.28',
|
|
13712
13693
|
npm: '8.19.4',
|
|
13713
13694
|
node: '16.20.0',
|
|
13714
13695
|
v8: '9.4.146.26-node.26',
|