solid-ui 2.4.27-681cc0e5 → 2.4.27-68c73bef

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 CHANGED
@@ -4043,7 +4043,8 @@ var _utils = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/@nob
4043
4043
  var _signature = __webpack_require__(/*! ./signature */ "./lib/chat/signature.js");
4044
4044
  var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
4045
4045
  var $rdf = _interopRequireWildcard(__webpack_require__(/*! rdflib */ "./node_modules/rdflib/esm/index.js"));
4046
- var _cryptoKeyHelpers = __webpack_require__(/*! ../utils/cryptoKeyHelpers */ "./lib/utils/cryptoKeyHelpers.js");
4046
+ var _accessData = __webpack_require__(/*! ../utils/keyHelpers/accessData */ "./lib/utils/keyHelpers/accessData.js");
4047
+ var _acl = __webpack_require__(/*! ../utils/keyHelpers/acl */ "./lib/utils/keyHelpers/acl.js");
4047
4048
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
4048
4049
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
4049
4050
  function generatePrivateKey() {
@@ -4052,74 +4053,77 @@ function generatePrivateKey() {
4052
4053
  function generatePublicKey(privateKey) {
4053
4054
  return (0, _utils.bytesToHex)(_secp256k.schnorr.getPublicKey(privateKey));
4054
4055
  }
4056
+
4057
+ /**
4058
+ * getPublicKey
4059
+ * used for displaying messages in chat, therefore does not
4060
+ * create a new key if not found
4061
+ * @param webId
4062
+ * @returns string | undefined
4063
+ */
4055
4064
  function getPublicKey(_x) {
4056
4065
  return _getPublicKey.apply(this, arguments);
4057
4066
  }
4058
4067
  function _getPublicKey() {
4059
- _getPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
4068
+ _getPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
4060
4069
  var publicKeyDoc, key;
4061
- return _regenerator["default"].wrap(function _callee$(_context) {
4062
- while (1) switch (_context.prev = _context.next) {
4070
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
4071
+ while (1) switch (_context2.prev = _context2.next) {
4063
4072
  case 0:
4064
- _context.next = 2;
4073
+ _context2.next = 2;
4065
4074
  return _solidLogic.store.fetcher.load(webId);
4066
4075
  case 2:
4067
- _context.next = 4;
4068
- return (0, _cryptoKeyHelpers.pubKeyUrl)(webId);
4076
+ _context2.next = 4;
4077
+ return (0, _accessData.pubKeyUrl)(webId);
4069
4078
  case 4:
4070
- publicKeyDoc = _context.sent;
4071
- _context.prev = 5;
4072
- _context.next = 8;
4079
+ publicKeyDoc = _context2.sent;
4080
+ _context2.prev = 5;
4081
+ _context2.next = 8;
4073
4082
  return _solidLogic.store.fetcher.load(publicKeyDoc);
4074
4083
  case 8:
4075
4084
  // url.href)
4076
4085
  key = _solidLogic.store.any(webId, _solidLogic.store.sym(_signature.CERT + 'PublicKey'));
4077
- return _context.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
4086
+ return _context2.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
4078
4087
  case 12:
4079
- _context.prev = 12;
4080
- _context.t0 = _context["catch"](5);
4081
- return _context.abrupt("return", undefined);
4088
+ _context2.prev = 12;
4089
+ _context2.t0 = _context2["catch"](5);
4090
+ return _context2.abrupt("return", undefined);
4082
4091
  case 15:
4083
4092
  case "end":
4084
- return _context.stop();
4093
+ return _context2.stop();
4085
4094
  }
4086
- }, _callee, null, [[5, 12]]);
4095
+ }, _callee2, null, [[5, 12]]);
4087
4096
  }));
4088
4097
  return _getPublicKey.apply(this, arguments);
4089
4098
  }
4090
4099
  function getPrivateKey(_x2) {
4091
4100
  return _getPrivateKey.apply(this, arguments);
4092
4101
  }
4093
- /**
4094
- * key container ACL
4095
- * @param me
4096
- * @returns aclBody
4097
- */
4098
4102
  function _getPrivateKey() {
4099
- _getPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
4103
+ _getPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId) {
4100
4104
  var publicKeyDoc, privateKeyDoc, publicKey, privateKey, validPublicKey, del, add, newPublicKey, keyContainer;
4101
- return _regenerator["default"].wrap(function _callee2$(_context2) {
4102
- while (1) switch (_context2.prev = _context2.next) {
4105
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
4106
+ while (1) switch (_context3.prev = _context3.next) {
4103
4107
  case 0:
4104
- _context2.next = 2;
4108
+ _context3.next = 2;
4105
4109
  return _solidLogic.store.fetcher.load(webId);
4106
4110
  case 2:
4107
- _context2.next = 4;
4108
- return (0, _cryptoKeyHelpers.pubKeyUrl)(webId);
4111
+ _context3.next = 4;
4112
+ return (0, _accessData.pubKeyUrl)(webId);
4109
4113
  case 4:
4110
- publicKeyDoc = _context2.sent;
4111
- _context2.next = 7;
4112
- return (0, _cryptoKeyHelpers.privKeyUrl)(webId);
4114
+ publicKeyDoc = _context3.sent;
4115
+ _context3.next = 7;
4116
+ return (0, _accessData.privKeyUrl)(webId);
4113
4117
  case 7:
4114
- privateKeyDoc = _context2.sent;
4115
- _context2.next = 10;
4116
- return (0, _cryptoKeyHelpers.publicKeyExists)(webId);
4118
+ privateKeyDoc = _context3.sent;
4119
+ _context3.next = 10;
4120
+ return (0, _accessData.getExistingPublicKey)(webId, publicKeyDoc);
4117
4121
  case 10:
4118
- publicKey = _context2.sent;
4119
- _context2.next = 13;
4120
- return (0, _cryptoKeyHelpers.privateKeyExists)(webId);
4122
+ publicKey = _context3.sent;
4123
+ _context3.next = 13;
4124
+ return (0, _accessData.getExistingPrivateKey)(webId, privateKeyDoc);
4121
4125
  case 13:
4122
- privateKey = _context2.sent;
4126
+ privateKey = _context3.sent;
4123
4127
  // is publicKey valid ?
4124
4128
  validPublicKey = true;
4125
4129
  if (privateKey && publicKey !== generatePublicKey(privateKey)) {
@@ -4128,23 +4132,23 @@ function _getPrivateKey() {
4128
4132
 
4129
4133
  // create key pair or repair publicKey
4130
4134
  if (!(!privateKey || !publicKey || !validPublicKey)) {
4131
- _context2.next = 34;
4135
+ _context3.next = 34;
4132
4136
  break;
4133
4137
  }
4134
4138
  del = [];
4135
4139
  add = []; // if (privateKey) del.push($rdf.st(webId, store.sym(CERT + 'PrivateKey'), $rdf.lit(privateKey), store.sym(privateKeyDoc)))
4136
4140
  if (privateKey) {
4137
- _context2.next = 24;
4141
+ _context3.next = 24;
4138
4142
  break;
4139
4143
  }
4140
4144
  // add = []
4141
4145
  privateKey = generatePrivateKey();
4142
4146
  add = [$rdf.st(webId, _solidLogic.store.sym(_signature.CERT + 'PrivateKey'), $rdf.literal(privateKey), _solidLogic.store.sym(privateKeyDoc))];
4143
- _context2.next = 24;
4147
+ _context3.next = 24;
4144
4148
  return saveKey(privateKeyDoc, [], add, webId.uri);
4145
4149
  case 24:
4146
4150
  if (!(!publicKey || !validPublicKey)) {
4147
- _context2.next = 31;
4151
+ _context3.next = 31;
4148
4152
  break;
4149
4153
  }
4150
4154
  del = [];
@@ -4156,167 +4160,98 @@ function _getPrivateKey() {
4156
4160
  // update new valid key
4157
4161
  newPublicKey = generatePublicKey(privateKey);
4158
4162
  add = [$rdf.st(webId, _solidLogic.store.sym(_signature.CERT + 'PublicKey'), $rdf.literal(newPublicKey), _solidLogic.store.sym(publicKeyDoc))];
4159
- _context2.next = 31;
4163
+ _context3.next = 31;
4160
4164
  return saveKey(publicKeyDoc, del, add);
4161
4165
  case 31:
4162
4166
  keyContainer = privateKeyDoc.substring(0, privateKeyDoc.lastIndexOf('/') + 1);
4163
- _context2.next = 34;
4164
- return setAcl(keyContainer, keyContainerAclBody(webId.uri));
4167
+ _context3.next = 34;
4168
+ return (0, _acl.setAcl)(keyContainer, (0, _acl.keyContainerAclBody)(webId.uri));
4165
4169
  case 34:
4166
- return _context2.abrupt("return", privateKey);
4170
+ return _context3.abrupt("return", privateKey);
4167
4171
  case 35:
4168
4172
  case "end":
4169
- return _context2.stop();
4173
+ return _context3.stop();
4170
4174
  }
4171
- }, _callee2);
4175
+ }, _callee3);
4172
4176
  }));
4173
4177
  return _getPrivateKey.apply(this, arguments);
4174
4178
  }
4175
- var keyContainerAclBody = function keyContainerAclBody(me) {
4176
- 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");
4177
- return aclBody;
4178
- };
4179
-
4180
- /**
4181
- * Read only ACL
4182
- * @param keyDoc
4183
- * @param me
4184
- * @returns aclBody
4185
- */
4186
- var keyAclBody = function keyAclBody(keyDoc, me) {
4187
- var keyAgent = 'acl:agentClass foaf:Agent'; // publicKey
4188
- if (me !== null && me !== void 0 && me.length) keyAgent = "acl:agent <".concat(me, ">"); // privateKey
4189
- 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");
4190
- return aclBody;
4191
- };
4192
-
4193
- /**
4194
- * set ACL
4195
- * @param keyDoc
4196
- * @param aclBody
4197
- */
4198
- function setAcl(_x3, _x4) {
4199
- return _setAcl.apply(this, arguments);
4200
- }
4201
- /**
4202
- * delete acl if keydoc exists
4203
- * create/edit keyDoc
4204
- * set keyDoc acl
4205
- */
4206
- function _setAcl() {
4207
- _setAcl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(keyDoc, aclBody) {
4208
- var keyAclDoc, response, aclResponse;
4209
- return _regenerator["default"].wrap(function _callee3$(_context3) {
4210
- while (1) switch (_context3.prev = _context3.next) {
4179
+ var deleteKey = /*#__PURE__*/function () {
4180
+ var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(keyDoc) {
4181
+ var keyAclDoc, response;
4182
+ return _regenerator["default"].wrap(function _callee$(_context) {
4183
+ while (1) switch (_context.prev = _context.next) {
4211
4184
  case 0:
4212
- _context3.next = 2;
4185
+ _context.next = 2;
4213
4186
  return _solidLogic.store.fetcher.load(keyDoc);
4214
4187
  case 2:
4215
- // FIXME: check the Why value on this quad:
4216
- debug.log(_solidLogic.store.statementsMatching(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl')));
4217
4188
  keyAclDoc = _solidLogic.store.any(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl'));
4218
- if (keyAclDoc) {
4219
- _context3.next = 6;
4189
+ if (!keyAclDoc) {
4190
+ _context.next = 16;
4220
4191
  break;
4221
4192
  }
4222
- throw new Error('Key ACL doc not found!');
4223
- case 6:
4224
- _context3.prev = 6;
4225
- _context3.next = 9;
4193
+ _context.prev = 4;
4194
+ _context.next = 7;
4226
4195
  return _solidLogic.store.fetcher.webOperation('DELETE', keyAclDoc.value);
4227
- case 9:
4228
- response = _context3.sent;
4196
+ case 7:
4197
+ response = _context.sent;
4229
4198
  // this may fail if webId is not an owner
4230
4199
  debug.log('delete ' + keyAclDoc.value + ' ' + response.status); // should test 404 and 2xx
4231
- _context3.next = 18;
4200
+ _context.next = 16;
4232
4201
  break;
4233
- case 13:
4234
- _context3.prev = 13;
4235
- _context3.t0 = _context3["catch"](6);
4236
- if (!(_context3.t0.response.status !== 404)) {
4237
- _context3.next = 17;
4202
+ case 11:
4203
+ _context.prev = 11;
4204
+ _context.t0 = _context["catch"](4);
4205
+ if (!(_context.t0.response.status !== 404)) {
4206
+ _context.next = 15;
4238
4207
  break;
4239
4208
  }
4240
- throw new Error(_context3.t0);
4241
- case 17:
4242
- debug.log('delete ' + keyAclDoc.value + ' ' + _context3.t0.response.status); // should test 404 and 2xx
4243
- case 18:
4244
- _context3.next = 20;
4245
- return _solidLogic.store.fetcher.webOperation('PUT', keyAclDoc.value, {
4246
- data: aclBody,
4247
- contentType: 'text/turtle'
4248
- });
4249
- case 20:
4250
- aclResponse = _context3.sent;
4251
- case 21:
4209
+ throw new Error(_context.t0);
4210
+ case 15:
4211
+ debug.log('delete ' + keyAclDoc.value + ' ' + _context.t0.response.status); // should test 404 and 2xx
4212
+ case 16:
4252
4213
  case "end":
4253
- return _context3.stop();
4214
+ return _context.stop();
4254
4215
  }
4255
- }, _callee3, null, [[6, 13]]);
4216
+ }, _callee, null, [[4, 11]]);
4256
4217
  }));
4257
- return _setAcl.apply(this, arguments);
4258
- }
4259
- function saveKey(_x5, _x6, _x7) {
4218
+ return function deleteKey(_x3) {
4219
+ return _ref.apply(this, arguments);
4220
+ };
4221
+ }();
4222
+
4223
+ /**
4224
+ * delete acl if keydoc exists
4225
+ * create/edit keyDoc
4226
+ * set keyDoc acl
4227
+ */
4228
+ function saveKey(_x4, _x5, _x6) {
4260
4229
  return _saveKey.apply(this, arguments);
4261
4230
  }
4262
4231
  function _saveKey() {
4263
4232
  _saveKey = (0, _asyncToGenerator2["default"])(function (keyDoc, del, add) {
4264
4233
  var me = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
4265
4234
  return /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
4266
- var keyAclDoc, response, aclBody;
4235
+ var aclBody;
4267
4236
  return _regenerator["default"].wrap(function _callee4$(_context4) {
4268
4237
  while (1) switch (_context4.prev = _context4.next) {
4269
4238
  case 0:
4270
4239
  _context4.next = 2;
4271
- return _solidLogic.store.fetcher.load(keyDoc);
4240
+ return deleteKey(keyDoc);
4272
4241
  case 2:
4273
- _context4.prev = 2;
4274
- // get keyAcldoc
4275
- keyAclDoc = _solidLogic.store.any(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl'));
4276
- if (!keyAclDoc) {
4277
- _context4.next = 17;
4278
- break;
4279
- }
4280
- _context4.prev = 5;
4281
- _context4.next = 8;
4282
- return _solidLogic.store.fetcher.webOperation('DELETE', keyAclDoc.value);
4283
- case 8:
4284
- response = _context4.sent;
4285
- // this may fail if webId is not an owner
4286
- debug.log('delete ' + keyAclDoc.value + ' ' + response.status); // should test 404 and 2xx
4287
- _context4.next = 17;
4288
- break;
4289
- case 12:
4290
- _context4.prev = 12;
4291
- _context4.t0 = _context4["catch"](5);
4292
- if (!(_context4.t0.response.status !== 404)) {
4293
- _context4.next = 16;
4294
- break;
4295
- }
4296
- throw new Error(_context4.t0);
4297
- case 16:
4298
- debug.log('delete ' + keyAclDoc.value + ' ' + _context4.t0.response.status); // should test 404 and 2xx
4299
- case 17:
4300
- _context4.next = 19;
4242
+ _context4.next = 4;
4301
4243
  return _solidLogic.store.updater.updateMany(del, add);
4302
- case 19:
4244
+ case 4:
4303
4245
  // or a promise store.updater.update ?
4304
4246
  // create READ only ACL
4305
- aclBody = keyAclBody(keyDoc, me);
4306
- _context4.next = 22;
4307
- return setAcl(keyDoc, aclBody);
4308
- case 22:
4309
- _context4.next = 27;
4310
- break;
4311
- case 24:
4312
- _context4.prev = 24;
4313
- _context4.t1 = _context4["catch"](2);
4314
- throw new Error(_context4.t1);
4315
- case 27:
4247
+ aclBody = (0, _acl.keyAclBody)(keyDoc, me);
4248
+ _context4.next = 7;
4249
+ return (0, _acl.setAcl)(keyDoc, aclBody);
4250
+ case 7:
4316
4251
  case "end":
4317
4252
  return _context4.stop();
4318
4253
  }
4319
- }, _callee4, null, [[2, 24], [5, 12]]);
4254
+ }, _callee4);
4320
4255
  })();
4321
4256
  });
4322
4257
  return _saveKey.apply(this, arguments);
@@ -12585,251 +12520,6 @@ function isLight(x) {
12585
12520
 
12586
12521
  /***/ }),
12587
12522
 
12588
- /***/ "./lib/utils/cryptoKeyHelpers.js":
12589
- /*!***************************************!*\
12590
- !*** ./lib/utils/cryptoKeyHelpers.js ***!
12591
- \***************************************/
12592
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
12593
-
12594
- "use strict";
12595
-
12596
-
12597
- var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
12598
- var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
12599
- Object.defineProperty(exports, "__esModule", ({
12600
- value: true
12601
- }));
12602
- exports.privKeyUrl = void 0;
12603
- exports.privateKeyExists = privateKeyExists;
12604
- exports.pubKeyUrl = void 0;
12605
- exports.publicKeyExists = publicKeyExists;
12606
- var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
12607
- var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
12608
- var debug = _interopRequireWildcard(__webpack_require__(/*! ../debug */ "./lib/debug.js"));
12609
- var _signature = __webpack_require__(/*! ../chat/signature */ "./lib/chat/signature.js");
12610
- var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
12611
- var ns = _interopRequireWildcard(__webpack_require__(/*! ../ns */ "./lib/ns.js"));
12612
- 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); }
12613
- 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; }
12614
- var getPodRoot = /*#__PURE__*/function () {
12615
- var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
12616
- var _podRoot;
12617
- var webIdURL, storages, podRoot, path, _res$headers$get, res;
12618
- return _regenerator["default"].wrap(function _callee$(_context) {
12619
- while (1) switch (_context.prev = _context.next) {
12620
- case 0:
12621
- webIdURL = new URL(webId.uri); // find storages in webId document
12622
- _context.next = 3;
12623
- return _solidLogic.store.fetcher.load(webId.uri);
12624
- case 3:
12625
- storages = _solidLogic.store.each(webId, ns.space('storage'), null, webId.doc());
12626
- if (storages !== null && storages !== void 0 && storages.length) {
12627
- _context.next = 19;
12628
- break;
12629
- }
12630
- // find storage recursively in webId URL
12631
- path = webIdURL.pathname;
12632
- case 6:
12633
- if (!path.length) {
12634
- _context.next = 17;
12635
- break;
12636
- }
12637
- path = path.substring(0, path.lastIndexOf('/'));
12638
- podRoot = _solidLogic.store.sym(webIdURL.origin + path + '/');
12639
- _context.next = 11;
12640
- return _solidLogic.store.fetcher.webOperation('HEAD', podRoot.uri);
12641
- case 11:
12642
- res = _context.sent;
12643
- if (!((_res$headers$get = res.headers.get('link')) !== null && _res$headers$get !== void 0 && _res$headers$get.includes(ns.space('Storage').value))) {
12644
- _context.next = 14;
12645
- break;
12646
- }
12647
- return _context.abrupt("break", 17);
12648
- case 14:
12649
- if (!path) debug.warn("Current user storage not found for\n".concat(webId));
12650
- _context.next = 6;
12651
- break;
12652
- case 17:
12653
- _context.next = 21;
12654
- break;
12655
- case 19:
12656
- // give preference to storage in webId root
12657
- podRoot = storages.find(function (storage) {
12658
- return webIdURL.origin === new URL(storage.value).origin;
12659
- });
12660
- if (!podRoot) podRoot = storages[0];
12661
- case 21:
12662
- return _context.abrupt("return", (_podRoot = podRoot) === null || _podRoot === void 0 ? void 0 : _podRoot.value);
12663
- case 22:
12664
- case "end":
12665
- return _context.stop();
12666
- }
12667
- }, _callee);
12668
- }));
12669
- return function getPodRoot(_x) {
12670
- return _ref.apply(this, arguments);
12671
- };
12672
- }();
12673
- var pubKeyUrl = /*#__PURE__*/function () {
12674
- var _ref2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
12675
- return _regenerator["default"].wrap(function _callee2$(_context2) {
12676
- while (1) switch (_context2.prev = _context2.next) {
12677
- case 0:
12678
- _context2.prev = 0;
12679
- _context2.next = 3;
12680
- return getPodRoot(webId);
12681
- case 3:
12682
- _context2.t0 = _context2.sent;
12683
- return _context2.abrupt("return", _context2.t0 + 'profile/keys/publicKey.ttl');
12684
- case 7:
12685
- _context2.prev = 7;
12686
- _context2.t1 = _context2["catch"](0);
12687
- throw new Error(_context2.t1);
12688
- case 10:
12689
- case "end":
12690
- return _context2.stop();
12691
- }
12692
- }, _callee2, null, [[0, 7]]);
12693
- }));
12694
- return function pubKeyUrl(_x2) {
12695
- return _ref2.apply(this, arguments);
12696
- };
12697
- }();
12698
- exports.pubKeyUrl = pubKeyUrl;
12699
- function publicKeyExists(_x3) {
12700
- return _publicKeyExists.apply(this, arguments);
12701
- }
12702
- function _publicKeyExists() {
12703
- _publicKeyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(webId) {
12704
- var publicKeyUrl;
12705
- return _regenerator["default"].wrap(function _callee4$(_context4) {
12706
- while (1) switch (_context4.prev = _context4.next) {
12707
- case 0:
12708
- _context4.next = 2;
12709
- return pubKeyUrl(webId);
12710
- case 2:
12711
- publicKeyUrl = _context4.sent;
12712
- _context4.next = 5;
12713
- return keyExists(webId, publicKeyUrl, 'PublicKey');
12714
- case 5:
12715
- return _context4.abrupt("return", _context4.sent);
12716
- case 6:
12717
- case "end":
12718
- return _context4.stop();
12719
- }
12720
- }, _callee4);
12721
- }));
12722
- return _publicKeyExists.apply(this, arguments);
12723
- }
12724
- var privKeyUrl = /*#__PURE__*/function () {
12725
- var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId) {
12726
- return _regenerator["default"].wrap(function _callee3$(_context3) {
12727
- while (1) switch (_context3.prev = _context3.next) {
12728
- case 0:
12729
- _context3.prev = 0;
12730
- _context3.next = 3;
12731
- return getPodRoot(webId);
12732
- case 3:
12733
- _context3.t0 = _context3.sent;
12734
- return _context3.abrupt("return", _context3.t0 + 'profile/keys/privateKey.ttl');
12735
- case 7:
12736
- _context3.prev = 7;
12737
- _context3.t1 = _context3["catch"](0);
12738
- throw new Error(_context3.t1);
12739
- case 10:
12740
- case "end":
12741
- return _context3.stop();
12742
- }
12743
- }, _callee3, null, [[0, 7]]);
12744
- }));
12745
- return function privKeyUrl(_x4) {
12746
- return _ref3.apply(this, arguments);
12747
- };
12748
- }();
12749
- exports.privKeyUrl = privKeyUrl;
12750
- function privateKeyExists(_x5) {
12751
- return _privateKeyExists.apply(this, arguments);
12752
- }
12753
- function _privateKeyExists() {
12754
- _privateKeyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(webId) {
12755
- var privateKeyUrl;
12756
- return _regenerator["default"].wrap(function _callee5$(_context5) {
12757
- while (1) switch (_context5.prev = _context5.next) {
12758
- case 0:
12759
- _context5.next = 2;
12760
- return privKeyUrl(webId);
12761
- case 2:
12762
- privateKeyUrl = _context5.sent;
12763
- _context5.next = 5;
12764
- return keyExists(webId, privateKeyUrl, 'PrivateKey');
12765
- case 5:
12766
- return _context5.abrupt("return", _context5.sent);
12767
- case 6:
12768
- case "end":
12769
- return _context5.stop();
12770
- }
12771
- }, _callee5);
12772
- }));
12773
- return _privateKeyExists.apply(this, arguments);
12774
- }
12775
- function keyExists(_x6, _x7, _x8) {
12776
- return _keyExists.apply(this, arguments);
12777
- }
12778
- function _keyExists() {
12779
- _keyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(webId, keyUrl, keyType) {
12780
- var key, _err$response, data, contentType, response;
12781
- return _regenerator["default"].wrap(function _callee6$(_context6) {
12782
- while (1) switch (_context6.prev = _context6.next) {
12783
- case 0:
12784
- _context6.prev = 0;
12785
- _context6.next = 3;
12786
- return _solidLogic.store.fetcher.load(keyUrl);
12787
- case 3:
12788
- key = _solidLogic.store.any(webId, _solidLogic.store.sym(_signature.CERT + keyType));
12789
- return _context6.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
12790
- case 7:
12791
- _context6.prev = 7;
12792
- _context6.t0 = _context6["catch"](0);
12793
- 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)) {
12794
- _context6.next = 24;
12795
- break;
12796
- }
12797
- _context6.prev = 10;
12798
- // create privateKey resource
12799
- data = '';
12800
- contentType = 'text/turtle';
12801
- _context6.next = 15;
12802
- return _solidLogic.store.fetcher.webOperation('PUT', keyUrl, {
12803
- data: data,
12804
- contentType: contentType
12805
- });
12806
- case 15:
12807
- response = _context6.sent;
12808
- _context6.next = 22;
12809
- break;
12810
- case 18:
12811
- _context6.prev = 18;
12812
- _context6.t1 = _context6["catch"](10);
12813
- debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context6.t1);
12814
- throw _context6.t1;
12815
- case 22:
12816
- delete _solidLogic.store.fetcher.requested[keyUrl]; // delete cached 404 error
12817
- return _context6.abrupt("return", undefined);
12818
- case 24:
12819
- debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context6.t0);
12820
- throw _context6.t0;
12821
- case 26:
12822
- case "end":
12823
- return _context6.stop();
12824
- }
12825
- }, _callee6, null, [[0, 7], [10, 18]]);
12826
- }));
12827
- return _keyExists.apply(this, arguments);
12828
- }
12829
- //# sourceMappingURL=cryptoKeyHelpers.js.map
12830
-
12831
- /***/ }),
12832
-
12833
12523
  /***/ "./lib/utils/headerFooterHelpers.js":
12834
12524
  /*!******************************************!*\
12835
12525
  !*** ./lib/utils/headerFooterHelpers.js ***!
@@ -13548,6 +13238,345 @@ function predParentOf(node) {
13548
13238
 
13549
13239
  /***/ }),
13550
13240
 
13241
+ /***/ "./lib/utils/keyHelpers/accessData.js":
13242
+ /*!********************************************!*\
13243
+ !*** ./lib/utils/keyHelpers/accessData.js ***!
13244
+ \********************************************/
13245
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
13246
+
13247
+ "use strict";
13248
+
13249
+
13250
+ var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
13251
+ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
13252
+ Object.defineProperty(exports, "__esModule", ({
13253
+ value: true
13254
+ }));
13255
+ exports.getExistingPrivateKey = getExistingPrivateKey;
13256
+ exports.getExistingPublicKey = getExistingPublicKey;
13257
+ exports.getKeyIfExists = getKeyIfExists;
13258
+ exports.pubKeyUrl = exports.privKeyUrl = exports.getPodRoot = void 0;
13259
+ var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
13260
+ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
13261
+ var debug = _interopRequireWildcard(__webpack_require__(/*! ../../debug */ "./lib/debug.js"));
13262
+ var _signature = __webpack_require__(/*! ../../chat/signature */ "./lib/chat/signature.js");
13263
+ var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
13264
+ var ns = _interopRequireWildcard(__webpack_require__(/*! ../../ns */ "./lib/ns.js"));
13265
+ 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
+ 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
+ var getPodRoot = /*#__PURE__*/function () {
13268
+ var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
13269
+ var _podRoot;
13270
+ var webIdURL, storages, podRoot, path, _res$headers$get, res;
13271
+ return _regenerator["default"].wrap(function _callee$(_context) {
13272
+ while (1) switch (_context.prev = _context.next) {
13273
+ case 0:
13274
+ webIdURL = new URL(webId.uri); // find storages in webId document
13275
+ _context.next = 3;
13276
+ return _solidLogic.store.fetcher.load(webId.uri);
13277
+ case 3:
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;
13298
+ break;
13299
+ }
13300
+ return _context.abrupt("break", 17);
13301
+ case 14:
13302
+ if (!path) debug.warn("Current user storage not found for\n".concat(webId));
13303
+ _context.next = 6;
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:
13317
+ case "end":
13318
+ return _context.stop();
13319
+ }
13320
+ }, _callee);
13321
+ }));
13322
+ return function getPodRoot(_x) {
13323
+ return _ref.apply(this, arguments);
13324
+ };
13325
+ }();
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
+ exports.pubKeyUrl = pubKeyUrl;
13353
+ function getExistingPublicKey(_x3, _x4) {
13354
+ return _getExistingPublicKey.apply(this, arguments);
13355
+ }
13356
+ function _getExistingPublicKey() {
13357
+ _getExistingPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(webId, publicKeyUrl) {
13358
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
13359
+ while (1) switch (_context4.prev = _context4.next) {
13360
+ case 0:
13361
+ _context4.next = 2;
13362
+ return getKeyIfExists(webId, publicKeyUrl, 'PublicKey');
13363
+ case 2:
13364
+ return _context4.abrupt("return", _context4.sent);
13365
+ case 3:
13366
+ case "end":
13367
+ return _context4.stop();
13368
+ }
13369
+ }, _callee4);
13370
+ }));
13371
+ return _getExistingPublicKey.apply(this, arguments);
13372
+ }
13373
+ var privKeyUrl = /*#__PURE__*/function () {
13374
+ var _ref3 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId) {
13375
+ return _regenerator["default"].wrap(function _callee3$(_context3) {
13376
+ while (1) switch (_context3.prev = _context3.next) {
13377
+ case 0:
13378
+ _context3.prev = 0;
13379
+ _context3.next = 3;
13380
+ return getPodRoot(webId);
13381
+ case 3:
13382
+ _context3.t0 = _context3.sent;
13383
+ return _context3.abrupt("return", _context3.t0 + 'profile/keys/privateKey.ttl');
13384
+ case 7:
13385
+ _context3.prev = 7;
13386
+ _context3.t1 = _context3["catch"](0);
13387
+ throw new Error(_context3.t1);
13388
+ case 10:
13389
+ case "end":
13390
+ return _context3.stop();
13391
+ }
13392
+ }, _callee3, null, [[0, 7]]);
13393
+ }));
13394
+ return function privKeyUrl(_x5) {
13395
+ return _ref3.apply(this, arguments);
13396
+ };
13397
+ }();
13398
+ exports.privKeyUrl = privKeyUrl;
13399
+ function getExistingPrivateKey(_x6, _x7) {
13400
+ return _getExistingPrivateKey.apply(this, arguments);
13401
+ }
13402
+ function _getExistingPrivateKey() {
13403
+ _getExistingPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(webId, privateKeyUrl) {
13404
+ return _regenerator["default"].wrap(function _callee5$(_context5) {
13405
+ while (1) switch (_context5.prev = _context5.next) {
13406
+ case 0:
13407
+ _context5.next = 2;
13408
+ return getKeyIfExists(webId, privateKeyUrl, 'PrivateKey');
13409
+ case 2:
13410
+ return _context5.abrupt("return", _context5.sent);
13411
+ case 3:
13412
+ case "end":
13413
+ return _context5.stop();
13414
+ }
13415
+ }, _callee5);
13416
+ }));
13417
+ return _getExistingPrivateKey.apply(this, arguments);
13418
+ }
13419
+ function getKeyIfExists(_x8, _x9, _x10) {
13420
+ return _getKeyIfExists.apply(this, arguments);
13421
+ }
13422
+ function _getKeyIfExists() {
13423
+ _getKeyIfExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(webId, keyUrl, keyType) {
13424
+ var key, _err$response, data, contentType, response;
13425
+ return _regenerator["default"].wrap(function _callee6$(_context6) {
13426
+ while (1) switch (_context6.prev = _context6.next) {
13427
+ case 0:
13428
+ _context6.prev = 0;
13429
+ _context6.next = 3;
13430
+ return _solidLogic.store.fetcher.load(keyUrl);
13431
+ case 3:
13432
+ key = _solidLogic.store.any(webId, _solidLogic.store.sym(_signature.CERT + keyType));
13433
+ return _context6.abrupt("return", key === null || key === void 0 ? void 0 : key.value);
13434
+ case 7:
13435
+ _context6.prev = 7;
13436
+ _context6.t0 = _context6["catch"](0);
13437
+ 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)) {
13438
+ _context6.next = 24;
13439
+ break;
13440
+ }
13441
+ _context6.prev = 10;
13442
+ // create resource
13443
+ data = '';
13444
+ contentType = 'text/turtle';
13445
+ _context6.next = 15;
13446
+ return _solidLogic.store.fetcher.webOperation('PUT', keyUrl, {
13447
+ data: data,
13448
+ contentType: contentType
13449
+ });
13450
+ case 15:
13451
+ response = _context6.sent;
13452
+ _context6.next = 22;
13453
+ break;
13454
+ case 18:
13455
+ _context6.prev = 18;
13456
+ _context6.t1 = _context6["catch"](10);
13457
+ debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context6.t1);
13458
+ throw _context6.t1;
13459
+ case 22:
13460
+ delete _solidLogic.store.fetcher.requested[keyUrl]; // delete cached 404 error
13461
+ return _context6.abrupt("return", undefined);
13462
+ case 24:
13463
+ debug.log('createIfNotExists doc FAILED: ' + keyUrl + ': ' + _context6.t0);
13464
+ throw _context6.t0;
13465
+ case 26:
13466
+ case "end":
13467
+ return _context6.stop();
13468
+ }
13469
+ }, _callee6, null, [[0, 7], [10, 18]]);
13470
+ }));
13471
+ return _getKeyIfExists.apply(this, arguments);
13472
+ }
13473
+ //# sourceMappingURL=accessData.js.map
13474
+
13475
+ /***/ }),
13476
+
13477
+ /***/ "./lib/utils/keyHelpers/acl.js":
13478
+ /*!*************************************!*\
13479
+ !*** ./lib/utils/keyHelpers/acl.js ***!
13480
+ \*************************************/
13481
+ /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
13482
+
13483
+ "use strict";
13484
+
13485
+
13486
+ var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js");
13487
+ var _typeof = __webpack_require__(/*! @babel/runtime/helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js");
13488
+ Object.defineProperty(exports, "__esModule", ({
13489
+ value: true
13490
+ }));
13491
+ exports.keyContainerAclBody = exports.keyAclBody = void 0;
13492
+ exports.setAcl = setAcl;
13493
+ var _regenerator = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/regenerator */ "./node_modules/@babel/runtime/regenerator/index.js"));
13494
+ var _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/asyncToGenerator */ "./node_modules/@babel/runtime/helpers/asyncToGenerator.js"));
13495
+ var debug = _interopRequireWildcard(__webpack_require__(/*! ../../debug */ "./lib/debug.js"));
13496
+ var _solidLogic = __webpack_require__(/*! solid-logic */ "./node_modules/solid-logic/lib/index.js");
13497
+ 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); }
13498
+ 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; }
13499
+ /**
13500
+ * set ACL
13501
+ * @param keyDoc
13502
+ * @param aclBody
13503
+ */
13504
+ function setAcl(_x, _x2) {
13505
+ return _setAcl.apply(this, arguments);
13506
+ }
13507
+ /**
13508
+ * key container ACL
13509
+ * @param me
13510
+ * @returns aclBody
13511
+ */
13512
+ function _setAcl() {
13513
+ _setAcl = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(keyDoc, aclBody) {
13514
+ var keyAclDoc, _err$response;
13515
+ return _regenerator["default"].wrap(function _callee$(_context) {
13516
+ while (1) switch (_context.prev = _context.next) {
13517
+ case 0:
13518
+ _context.next = 2;
13519
+ return _solidLogic.store.fetcher.load(keyDoc);
13520
+ case 2:
13521
+ // FIXME: check the Why value on this quad:
13522
+ debug.log(_solidLogic.store.statementsMatching(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl')));
13523
+ keyAclDoc = _solidLogic.store.any(_solidLogic.store.sym(keyDoc), _solidLogic.store.sym('http://www.iana.org/assignments/link-relations/acl'));
13524
+ if (keyAclDoc) {
13525
+ _context.next = 6;
13526
+ break;
13527
+ }
13528
+ throw new Error('Key ACL doc not found!');
13529
+ case 6:
13530
+ _context.prev = 6;
13531
+ _context.next = 9;
13532
+ return _solidLogic.store.fetcher.webOperation('PUT', keyAclDoc.value, {
13533
+ data: aclBody,
13534
+ contentType: 'text/turtle'
13535
+ });
13536
+ case 9:
13537
+ _context.next = 16;
13538
+ break;
13539
+ case 11:
13540
+ _context.prev = 11;
13541
+ _context.t0 = _context["catch"](6);
13542
+ 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)) {
13543
+ _context.next = 15;
13544
+ break;
13545
+ }
13546
+ throw new Error(_context.t0);
13547
+ case 15:
13548
+ debug.log('delete ' + keyAclDoc.value + ' ' + _context.t0.response.status); // should test 404 and 2xx
13549
+ case 16:
13550
+ case "end":
13551
+ return _context.stop();
13552
+ }
13553
+ }, _callee, null, [[6, 11]]);
13554
+ }));
13555
+ return _setAcl.apply(this, arguments);
13556
+ }
13557
+ var keyContainerAclBody = function keyContainerAclBody(me) {
13558
+ 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");
13559
+ return aclBody;
13560
+ };
13561
+
13562
+ /**
13563
+ * Read only ACL
13564
+ * @param keyDoc
13565
+ * @param me
13566
+ * @returns aclBody
13567
+ */
13568
+ exports.keyContainerAclBody = keyContainerAclBody;
13569
+ var keyAclBody = function keyAclBody(keyDoc, me) {
13570
+ var keyAgent = 'acl:agentClass foaf:Agent'; // publicKey
13571
+ if (me !== null && me !== void 0 && me.length) keyAgent = "acl:agent <".concat(me, ">"); // privateKey
13572
+ 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");
13573
+ return aclBody;
13574
+ };
13575
+ exports.keyAclBody = keyAclBody;
13576
+ //# sourceMappingURL=acl.js.map
13577
+
13578
+ /***/ }),
13579
+
13551
13580
  /***/ "./lib/utils/label.js":
13552
13581
  /*!****************************!*\
13553
13582
  !*** ./lib/utils/label.js ***!
@@ -13676,8 +13705,8 @@ Object.defineProperty(exports, "__esModule", ({
13676
13705
  }));
13677
13706
  exports.versionInfo = void 0;
13678
13707
  var versionInfo = {
13679
- buildTime: '2023-05-07T21:57:02Z',
13680
- commit: '681cc0e500bcd423f9d02e0222fb2f2034cb40d6',
13708
+ buildTime: '2023-05-17T23:43:46Z',
13709
+ commit: '68c73befd0d8a4eddd797d469e88a13e1f7e175a',
13681
13710
  npmInfo: {
13682
13711
  'solid-ui': '2.4.27',
13683
13712
  npm: '8.19.4',
@@ -66493,22 +66522,7 @@ module.exports = JSON.parse('{"application/1d-interleaved-parityfec":{"source":"
66493
66522
  /******/
66494
66523
  /******/ /* webpack/runtime/publicPath */
66495
66524
  /******/ (() => {
66496
- /******/ var scriptUrl;
66497
- /******/ if (__webpack_require__.g.importScripts) scriptUrl = __webpack_require__.g.location + "";
66498
- /******/ var document = __webpack_require__.g.document;
66499
- /******/ if (!scriptUrl && document) {
66500
- /******/ if (document.currentScript)
66501
- /******/ scriptUrl = document.currentScript.src;
66502
- /******/ if (!scriptUrl) {
66503
- /******/ var scripts = document.getElementsByTagName("script");
66504
- /******/ if(scripts.length) scriptUrl = scripts[scripts.length - 1].src
66505
- /******/ }
66506
- /******/ }
66507
- /******/ // When supporting browsers where an automatic publicPath is not supported you must specify an output.publicPath manually via configuration
66508
- /******/ // or pass an empty string ("") and set the __webpack_public_path__ variable from your code to use your own logic.
66509
- /******/ if (!scriptUrl) throw new Error("Automatic publicPath is not supported in this browser");
66510
- /******/ scriptUrl = scriptUrl.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
66511
- /******/ __webpack_require__.p = scriptUrl;
66525
+ /******/ __webpack_require__.p = "";
66512
66526
  /******/ })();
66513
66527
  /******/
66514
66528
  /******/ /* webpack/runtime/jsonp chunk loading */