solid-ui 2.4.27-9f7a01da → 2.4.27-a6ef5829

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
@@ -2655,7 +2655,7 @@ var ChatChannel = /*#__PURE__*/function () {
2655
2655
  var oldMsg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
2656
2656
  var deleteIt = arguments.length > 2 ? arguments[2] : undefined;
2657
2657
  return /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
2658
- var sts, now, timestamp, dateStamp, chatDocument, message, me, msg, oldMsgMaker, errMsg, privateKey, pubKey, sig, _errMsg;
2658
+ var sts, now, timestamp, dateStamp, chatDocument, message, me, msg, oldMsgMaker, errMsg, privateKey, sig, _errMsg;
2659
2659
  return _regenerator["default"].wrap(function _callee2$(_context2) {
2660
2660
  while (1) switch (_context2.prev = _context2.next) {
2661
2661
  case 0:
@@ -2703,46 +2703,46 @@ var ChatChannel = /*#__PURE__*/function () {
2703
2703
  sts.push($rdf.st(message, ns.dct('created'), dateStamp, chatDocument));
2704
2704
  msg.created = dateStamp.value;
2705
2705
  if (!me) {
2706
- _context2.next = 36;
2706
+ _context2.next = 35;
2707
2707
  break;
2708
2708
  }
2709
2709
  sts.push($rdf.st(message, ns.foaf('maker'), me, chatDocument));
2710
2710
  msg.maker = me.uri;
2711
2711
  // privateKey the cached private key of me, cached in store
2712
2712
  _context2.next = 32;
2713
- return (0, _keys.getPrivateKey)(me.uri);
2713
+ return (0, _keys.getPrivateKey)(me);
2714
2714
  case 32:
2715
2715
  privateKey = _context2.sent;
2716
+ // me.uri)
2716
2717
  // const privateKey0 = 'a11bc5d2eee6cdb3b37f5473a712cad905ccfb13fb2ccdbf1be0a1ac4fdc7d2a'
2717
- // const pubKey0 = '023a9da707bee1302f66083c9d95673ff969b41607a66f52686fa774d64ceb87'
2718
- pubKey = (0, _keys.getPublicKey)(me.uri);
2719
- sig = (0, _signature.signMsg)(msg, privateKey);
2720
- /* const verify = verifySignature(sig, msg, pubKey) // alain to remove
2718
+ sig = (0, _signature.signMsg)(msg, privateKey); // const pubKey0 = '023a9da707bee1302f66083c9d95673ff969b41607a66f52686fa774d64ceb87'
2719
+ /* const pubKey = await getPublicKey(me)
2720
+ const verify = verifySignature(sig, msg, pubKey) // alain to remove
2721
2721
  debug.warn('sig ' + sig)
2722
2722
  debug.warn('verifySign ' + verify)
2723
2723
  debug.warn(msg) */
2724
2724
  sts.push($rdf.st(message, $rdf.sym("".concat(_signature.SEC, "Proof")), $rdf.lit(sig), chatDocument));
2725
- case 36:
2726
- _context2.prev = 36;
2727
- _context2.next = 39;
2725
+ case 35:
2726
+ _context2.prev = 35;
2727
+ _context2.next = 38;
2728
2728
  return _solidLogic.store.updater.update([], sts);
2729
- case 39:
2730
- _context2.next = 47;
2729
+ case 38:
2730
+ _context2.next = 46;
2731
2731
  break;
2732
- case 41:
2733
- _context2.prev = 41;
2734
- _context2.t0 = _context2["catch"](36);
2732
+ case 40:
2733
+ _context2.prev = 40;
2734
+ _context2.t0 = _context2["catch"](35);
2735
2735
  _errMsg = 'Error saving chat message: ' + _context2.t0;
2736
2736
  debug.warn(_errMsg);
2737
2737
  alert(_errMsg);
2738
2738
  throw new Error(_errMsg);
2739
- case 47:
2739
+ case 46:
2740
2740
  return _context2.abrupt("return", message);
2741
- case 48:
2741
+ case 47:
2742
2742
  case "end":
2743
2743
  return _context2.stop();
2744
2744
  }
2745
- }, _callee2, null, [[36, 41]]);
2745
+ }, _callee2, null, [[35, 40]]);
2746
2746
  })();
2747
2747
  });
2748
2748
  function updateMessage(_x2) {
@@ -4043,6 +4043,7 @@ 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
4047
  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
4048
  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
4049
  function generatePrivateKey() {
@@ -4051,160 +4052,274 @@ function generatePrivateKey() {
4051
4052
  function generatePublicKey(privateKey) {
4052
4053
  return (0, _utils.bytesToHex)(_secp256k.schnorr.getPublicKey(privateKey));
4053
4054
  }
4054
- function getPublicKey(webId) {
4055
- var publicKey = publicKeyExists(webId);
4056
- return publicKey;
4057
- }
4058
- var pubKeyUrl = function pubKeyUrl(webId) {
4059
- var url = new URL(webId);
4060
- var publicKeyUrl = url.origin + '/profile/keys/publicKey.ttl';
4061
- return publicKeyUrl;
4062
- };
4063
- function publicKeyExists(_x) {
4064
- return _publicKeyExists.apply(this, arguments);
4055
+ function getPublicKey(_x) {
4056
+ return _getPublicKey.apply(this, arguments);
4065
4057
  }
4066
- function _publicKeyExists() {
4067
- _publicKeyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
4068
- var publicKey;
4058
+ function _getPublicKey() {
4059
+ _getPublicKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(webId) {
4060
+ var publicKeyDoc, key;
4069
4061
  return _regenerator["default"].wrap(function _callee$(_context) {
4070
4062
  while (1) switch (_context.prev = _context.next) {
4071
4063
  case 0:
4072
4064
  _context.next = 2;
4073
- return _solidLogic.store.fetcher.load(pubKeyUrl(webId));
4065
+ return _solidLogic.store.fetcher.load(webId);
4074
4066
  case 2:
4075
- // url.href)
4076
- publicKey = _solidLogic.store.any(_solidLogic.store.sym(webId), _solidLogic.store.sym(_signature.CERT + 'PublicKey'));
4077
- return _context.abrupt("return", publicKey === null || publicKey === void 0 ? void 0 : publicKey.value);
4067
+ _context.next = 4;
4068
+ return (0, _cryptoKeyHelpers.pubKeyUrl)(webId);
4078
4069
  case 4:
4070
+ publicKeyDoc = _context.sent;
4071
+ _context.prev = 5;
4072
+ _context.next = 8;
4073
+ return _solidLogic.store.fetcher.load(publicKeyDoc);
4074
+ case 8:
4075
+ // url.href)
4076
+ 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);
4078
+ case 12:
4079
+ _context.prev = 12;
4080
+ _context.t0 = _context["catch"](5);
4081
+ return _context.abrupt("return", undefined);
4082
+ case 15:
4079
4083
  case "end":
4080
4084
  return _context.stop();
4081
4085
  }
4082
- }, _callee);
4086
+ }, _callee, null, [[5, 12]]);
4083
4087
  }));
4084
- return _publicKeyExists.apply(this, arguments);
4088
+ return _getPublicKey.apply(this, arguments);
4085
4089
  }
4086
- var privKeyUrl = function privKeyUrl(webId) {
4087
- var url = new URL(webId);
4088
- var privateKeyUrl = url.origin + '/profile/keys/privateKey.ttl';
4089
- return privateKeyUrl;
4090
- };
4091
- function privateKeyExists(_x2) {
4092
- return _privateKeyExists.apply(this, arguments);
4090
+ function getPrivateKey(_x2) {
4091
+ return _getPrivateKey.apply(this, arguments);
4093
4092
  }
4094
- function _privateKeyExists() {
4095
- _privateKeyExists = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
4096
- var privateKeyUrl, privateKey, _err$response, data, contentType, response;
4093
+ /**
4094
+ * key container ACL
4095
+ * @param me
4096
+ * @returns aclBody
4097
+ */
4098
+ function _getPrivateKey() {
4099
+ _getPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(webId) {
4100
+ var publicKeyDoc, privateKeyDoc, publicKey, privateKey, validPublicKey, del, add, newPublicKey, keyContainer;
4097
4101
  return _regenerator["default"].wrap(function _callee2$(_context2) {
4098
4102
  while (1) switch (_context2.prev = _context2.next) {
4099
4103
  case 0:
4100
- /* const url = new URL(webId)
4101
- const privateKeyUrl = url.protocol + '//' + url.host + '/profile/privateKey.ttl' */
4102
- privateKeyUrl = privKeyUrl(webId);
4103
- /* debug.warn('Alain privateKeyExists')
4104
- debug.warn(webId)
4105
- debug.warn(privateKeyUrl) */
4106
- _context2.prev = 1;
4104
+ _context2.next = 2;
4105
+ return _solidLogic.store.fetcher.load(webId);
4106
+ case 2:
4107
4107
  _context2.next = 4;
4108
- return _solidLogic.store.fetcher.load(privateKeyUrl);
4108
+ return (0, _cryptoKeyHelpers.pubKeyUrl)(webId);
4109
4109
  case 4:
4110
- privateKey = _solidLogic.store.any(_solidLogic.store.sym(webId), _solidLogic.store.sym(_signature.CERT + 'PrivateKey'));
4111
- return _context2.abrupt("return", privateKey === null || privateKey === void 0 ? void 0 : privateKey.value);
4112
- case 8:
4113
- _context2.prev = 8;
4114
- _context2.t0 = _context2["catch"](1);
4115
- if (!((_context2.t0 === null || _context2.t0 === void 0 ? void 0 : (_err$response = _context2.t0.response) === null || _err$response === void 0 ? void 0 : _err$response.status) === 404)) {
4116
- _context2.next = 25;
4110
+ publicKeyDoc = _context2.sent;
4111
+ _context2.next = 7;
4112
+ return (0, _cryptoKeyHelpers.privKeyUrl)(webId);
4113
+ case 7:
4114
+ privateKeyDoc = _context2.sent;
4115
+ _context2.next = 10;
4116
+ return (0, _cryptoKeyHelpers.publicKeyExists)(webId);
4117
+ case 10:
4118
+ publicKey = _context2.sent;
4119
+ _context2.next = 13;
4120
+ return (0, _cryptoKeyHelpers.privateKeyExists)(webId);
4121
+ case 13:
4122
+ privateKey = _context2.sent;
4123
+ // is publicKey valid ?
4124
+ validPublicKey = true;
4125
+ if (privateKey && publicKey !== generatePublicKey(privateKey)) {
4126
+ if (confirm('This is strange the publicKey is not valid for\n' + (webId === null || webId === void 0 ? void 0 : webId.uri) + '\'shall we repair keeping the private key ?')) validPublicKey = false;
4127
+ }
4128
+
4129
+ // create key pair or repair publicKey
4130
+ if (!(!privateKey || !publicKey || !validPublicKey)) {
4131
+ _context2.next = 34;
4117
4132
  break;
4118
4133
  }
4119
- _context2.prev = 11;
4120
- // create privateKey resource
4121
- data = '';
4122
- contentType = 'text/ttl';
4123
- _context2.next = 16;
4124
- return _solidLogic.store.fetcher.webOperation('PUT', privateKeyUrl, {
4125
- data: data,
4126
- contentType: contentType
4127
- });
4128
- case 16:
4129
- response = _context2.sent;
4130
- _context2.next = 23;
4131
- break;
4132
- case 19:
4133
- _context2.prev = 19;
4134
- _context2.t1 = _context2["catch"](11);
4135
- debug.log('createIfNotExists doc FAILED: ' + privateKeyUrl + ': ' + _context2.t1);
4136
- throw _context2.t1;
4137
- case 23:
4138
- delete _solidLogic.store.fetcher.requested[privateKeyUrl]; // delete cached 404 error
4139
- return _context2.abrupt("return", undefined);
4140
- case 25:
4141
- debug.log('createIfNotExists doc FAILED: ' + privateKeyUrl + ': ' + _context2.t0);
4142
- throw _context2.t0;
4143
- case 27:
4134
+ del = [];
4135
+ add = []; // if (privateKey) del.push($rdf.st(webId, store.sym(CERT + 'PrivateKey'), $rdf.lit(privateKey), store.sym(privateKeyDoc)))
4136
+ if (privateKey) {
4137
+ _context2.next = 24;
4138
+ break;
4139
+ }
4140
+ // add = []
4141
+ privateKey = generatePrivateKey();
4142
+ add = [$rdf.st(webId, _solidLogic.store.sym(_signature.CERT + 'PrivateKey'), $rdf.literal(privateKey), _solidLogic.store.sym(privateKeyDoc))];
4143
+ _context2.next = 24;
4144
+ return saveKey(privateKeyDoc, [], add, webId.uri);
4145
+ case 24:
4146
+ if (!(!publicKey || !validPublicKey)) {
4147
+ _context2.next = 31;
4148
+ break;
4149
+ }
4150
+ del = [];
4151
+ // delete invalid public key
4152
+ if (publicKey) {
4153
+ del = [$rdf.st(webId, _solidLogic.store.sym(_signature.CERT + 'PublicKey'), $rdf.lit(publicKey), _solidLogic.store.sym(publicKeyDoc))];
4154
+ debug.log(del);
4155
+ }
4156
+ // update new valid key
4157
+ newPublicKey = generatePublicKey(privateKey);
4158
+ add = [$rdf.st(webId, _solidLogic.store.sym(_signature.CERT + 'PublicKey'), $rdf.literal(newPublicKey), _solidLogic.store.sym(publicKeyDoc))];
4159
+ _context2.next = 31;
4160
+ return saveKey(publicKeyDoc, del, add);
4161
+ case 31:
4162
+ keyContainer = privateKeyDoc.substring(0, privateKeyDoc.lastIndexOf('/') + 1);
4163
+ _context2.next = 34;
4164
+ return setAcl(keyContainer, keyContainerAclBody(webId.uri));
4165
+ case 34:
4166
+ return _context2.abrupt("return", privateKey);
4167
+ case 35:
4144
4168
  case "end":
4145
4169
  return _context2.stop();
4146
4170
  }
4147
- }, _callee2, null, [[1, 8], [11, 19]]);
4171
+ }, _callee2);
4148
4172
  }));
4149
- return _privateKeyExists.apply(this, arguments);
4150
- }
4151
- function getPrivateKey(_x3) {
4152
4173
  return _getPrivateKey.apply(this, arguments);
4153
4174
  }
4154
- function _getPrivateKey() {
4155
- _getPrivateKey = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(webId) {
4156
- var publicKeyUrl, privateKeyUrl, publicKey, privateKey, del, add;
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;
4157
4209
  return _regenerator["default"].wrap(function _callee3$(_context3) {
4158
4210
  while (1) switch (_context3.prev = _context3.next) {
4159
4211
  case 0:
4160
- /* const url = new URL(webId)
4161
- url.hash = '' */
4162
- /* const privateKeyUrl = url.protocol + '//' + url.host + '/profile/privateKey.ttl' */
4163
- publicKeyUrl = pubKeyUrl(webId);
4164
- privateKeyUrl = privKeyUrl(webId); // find publickey
4165
- _context3.next = 4;
4166
- return publicKeyExists(webId);
4167
- case 4:
4168
- publicKey = _context3.sent;
4169
- _context3.next = 7;
4170
- return privateKeyExists(webId);
4171
- case 7:
4172
- privateKey = _context3.sent;
4173
- // debug.warn('privateKey ' + privateKey)
4174
- if (privateKey && publicKey !== generatePublicKey(privateKey)) debug.warn('publicKey is not valid');
4175
-
4176
- // simulate new key pair
4177
- /* const newPrivateKey = generatePrivateKey()
4178
- const newPublicKey = generatePublicKey(newPrivateKey)
4179
- debug.log('newPrivateKey ' + newPrivateKey)
4180
- debug.log('newPublicKey ' + newPublicKey) */
4181
-
4182
- // create key pair
4183
- if (!(!privateKey || !publicKey)) {
4184
- _context3.next = 20;
4212
+ _context3.next = 2;
4213
+ return _solidLogic.store.fetcher.load(keyDoc);
4214
+ 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
+ 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;
4185
4220
  break;
4186
4221
  }
4187
- del = [];
4188
- add = [];
4189
- if (privateKey) del.push($rdf.st($rdf.sym(webId), $rdf.sym(_signature.CERT + 'PrivateKey'), $rdf.lit(privateKey), $rdf.sym(privateKeyUrl)));
4190
- if (publicKey) del.push($rdf.st($rdf.sym(webId), $rdf.sym(_signature.CERT + 'PublicKey'), $rdf.lit(publicKey), $rdf.sym(publicKeyUrl)));
4191
- privateKey = generatePrivateKey();
4192
- publicKey = generatePublicKey(privateKey);
4193
- /* debug.log('newPrivateKey-1 ' + privateKey)
4194
- debug.log('newPublicKey-1 ' + publicKey) */
4195
- add.push($rdf.st($rdf.sym(webId), $rdf.sym(_signature.CERT + 'PrivateKey'), $rdf.literal(privateKey), $rdf.sym(privateKeyUrl)));
4196
- add.push($rdf.st($rdf.sym(webId), $rdf.sym(_signature.CERT + 'PublicKey'), $rdf.literal(publicKey), $rdf.sym(publicKeyUrl)));
4222
+ throw new Error('Key ACL doc not found!');
4223
+ case 6:
4224
+ _context3.prev = 6;
4225
+ _context3.next = 9;
4226
+ return _solidLogic.store.fetcher.webOperation('DELETE', keyAclDoc.value);
4227
+ case 9:
4228
+ response = _context3.sent;
4229
+ // this may fail if webId is not an owner
4230
+ debug.log('delete ' + keyAclDoc.value + ' ' + response.status); // should test 404 and 2xx
4231
+ _context3.next = 18;
4232
+ 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;
4238
+ break;
4239
+ }
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:
4197
4244
  _context3.next = 20;
4198
- return _solidLogic.store.updater.updateMany(del, add);
4245
+ return _solidLogic.store.fetcher.webOperation('PUT', keyAclDoc.value, {
4246
+ data: aclBody,
4247
+ contentType: 'text/turtle'
4248
+ });
4199
4249
  case 20:
4200
- return _context3.abrupt("return", privateKey);
4250
+ aclResponse = _context3.sent;
4201
4251
  case 21:
4202
4252
  case "end":
4203
4253
  return _context3.stop();
4204
4254
  }
4205
- }, _callee3);
4255
+ }, _callee3, null, [[6, 13]]);
4206
4256
  }));
4207
- return _getPrivateKey.apply(this, arguments);
4257
+ return _setAcl.apply(this, arguments);
4258
+ }
4259
+ function saveKey(_x5, _x6, _x7) {
4260
+ return _saveKey.apply(this, arguments);
4261
+ }
4262
+ function _saveKey() {
4263
+ _saveKey = (0, _asyncToGenerator2["default"])(function (keyDoc, del, add) {
4264
+ var me = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '';
4265
+ return /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
4266
+ var keyAclDoc, response, aclBody;
4267
+ return _regenerator["default"].wrap(function _callee4$(_context4) {
4268
+ while (1) switch (_context4.prev = _context4.next) {
4269
+ case 0:
4270
+ _context4.next = 2;
4271
+ return _solidLogic.store.fetcher.load(keyDoc);
4272
+ 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;
4301
+ return _solidLogic.store.updater.updateMany(del, add);
4302
+ case 19:
4303
+ // or a promise store.updater.update ?
4304
+ // 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:
4316
+ case "end":
4317
+ return _context4.stop();
4318
+ }
4319
+ }, _callee4, null, [[2, 24], [5, 12]]);
4320
+ })();
4321
+ });
4322
+ return _saveKey.apply(this, arguments);
4208
4323
  }
4209
4324
  //# sourceMappingURL=keys.js.map
4210
4325
 
@@ -4335,44 +4450,37 @@ function renderMessageRow(channelObject, message, fresh, options, userContext) {
4335
4450
  var date = _solidLogic.store.any(message, ns.dct('created'));
4336
4451
  var latestVersion = (0, _chatLogic.mostRecentVersion)(message);
4337
4452
  var latestVersionCreator = _solidLogic.store.any(latestVersion, ns.foaf('maker'));
4453
+
4338
4454
  // use latest content if same owner, else use original
4339
4455
  var msgId = creator.uri === latestVersionCreator.uri ? latestVersion : message;
4340
4456
  var content = _solidLogic.store.any(msgId, ns.sioc('content'));
4341
4457
  var signature = _solidLogic.store.any(msgId, $rdf.sym("".concat(_signature.SEC, "Proof")));
4342
- debug.log('alain ' + (signature === null || signature === void 0 ? void 0 : signature.value));
4343
4458
 
4344
- // verify signature
4459
+ // set message object
4345
4460
  var msg = (0, _signature.getBlankMsg)();
4346
4461
  msg.id = msgId.uri;
4347
4462
  msg.created = _solidLogic.store.any(msgId, ns.dct('created')).value;
4348
4463
  msg.content = content.value;
4349
4464
  msg.maker = creator.uri;
4350
- try {
4351
- var publicKey = function publicKey(webId) {
4352
- var pubKey;
4353
- (0, _keys.getPublicKey)(webId).then(function (publicKey) {
4354
- debug.log('alain publicKey ' + publicKey);
4355
- pubKey = publicKey;
4356
- });
4357
- return pubKey;
4358
- };
4359
- var pubKey = publicKey(creator.uri); // await getPublicKey(creator.uri)
4360
- debug.log('alain pubKey ' + pubKey);
4361
- debug.log(creator.uri);
4362
- } catch (err) {
4363
- debug.warn(err);
4364
- }
4365
- try {
4366
- // pubKey could be store in a cache for all makers
4367
- /* const pubKey0 = '023a9da707bee1302f66083c9d95673ff969b41607a66f52686fa774d64ceb87'
4368
- debug.warn('publicKeys\n' + pubKey0 + '\n' + pubKey)
4369
- const privKey0 = getPrivateKey(creator.uri) // alain to remove
4370
- // unsigned messages should be signaled as unsecured
4371
- debug.warn(msg)
4372
- debug.warn(signature?.value) */
4373
- if (signature !== null && signature !== void 0 && signature.value && !(0, _signature.verifySignature)(signature.value, msg, pubKey)) throw new Error('invalid signature');
4374
- } catch (err) {
4375
- debug.log(err);
4465
+
4466
+ // unsigned message
4467
+ if (!(signature !== null && signature !== void 0 && signature.value)) debug.warn(msgId.uri + ' is unsigned'); // TODO replace with UI (colored message ?)
4468
+
4469
+ // signed message, get public key and check signature
4470
+ else {
4471
+ (0, _keys.getPublicKey)(creator).then(function (publicKey) {
4472
+ debug.log(creator.uri + '\n' + msg.created + '\n' + msg.id + '\n' + publicKey);
4473
+ if (!publicKey) {
4474
+ // TODO try to recreate the publicKey
4475
+ // if(me.uri === creator.uri) await getPrivateKey(creator)
4476
+ debug.warn('message is signed but ' + creator.uri + ' is missing publicKey');
4477
+ }
4478
+ // check that publicKey is a valid hex string
4479
+ var regex = /[0-9A-Fa-f]{6}/g;
4480
+ if (!(publicKey !== null && publicKey !== void 0 && publicKey.match(regex))) debug.warn('invalid publicKey hex string\n' + creator.uri + '\n' + publicKey);
4481
+ // verify signature
4482
+ else if (signature !== null && signature !== void 0 && signature.value && !(0, _signature.verifySignature)(signature === null || signature === void 0 ? void 0 : signature.value, msg, publicKey)) debug.warn('invalid signature\n' + msg.id);
4483
+ });
4376
4484
  }
4377
4485
  var originalMessage = (0, _chatLogic.originalVersion)(message);
4378
4486
  var edited = !message.sameTerm(originalMessage);
@@ -5167,13 +5275,11 @@ Object.defineProperty(exports, "__esModule", ({
5167
5275
  value: true
5168
5276
  }));
5169
5277
  exports.SEC = exports.CERT = void 0;
5170
- exports.finishMsg = finishMsg;
5171
5278
  exports.getBlankMsg = getBlankMsg;
5172
5279
  exports.getMsgHash = getMsgHash;
5173
5280
  exports.serializeMsg = serializeMsg;
5174
5281
  exports.signMsg = signMsg;
5175
5282
  exports.utf8Encoder = exports.utf8Decoder = void 0;
5176
- exports.validateMsg = validateMsg;
5177
5283
  exports.verifySignature = verifySignature;
5178
5284
  var _secp256k = __webpack_require__(/*! @noble/curves/secp256k1 */ "./node_modules/@noble/curves/secp256k1.js");
5179
5285
  var _utils = __webpack_require__(/*! @noble/hashes/utils */ "./node_modules/@noble/hashes/utils.js");
@@ -5219,19 +5325,22 @@ function getBlankMsg() {
5219
5325
  id: '',
5220
5326
  created: '',
5221
5327
  dateDeleted: '',
5328
+ // TODO to remove if not used
5222
5329
  content: '',
5223
5330
  maker: '',
5224
- sig: ''
5331
+ sig: '' // TODO to remove if not used
5225
5332
  };
5226
5333
  }
5227
- function finishMsg(t, privateKey) {
5228
- // to update to chat message triples
5229
- var message = t;
5230
- // message.pubkey = getPublicKey(privateKey)
5231
- message.id = getMsgHash(message);
5232
- message.sig = signMsg(message, privateKey);
5233
- return message;
5234
- }
5334
+
5335
+ /* export function finishMsg (t: MsgTemplate, privateKey: string): Message {
5336
+ // to update to chat message triples
5337
+ const message = t as Message
5338
+ // message.pubkey = getPublicKey(privateKey)
5339
+ message.id = getMsgHash(message)
5340
+ message.sig = signMsg(message, privateKey)
5341
+ return message
5342
+ } */
5343
+
5235
5344
  function serializeMsg(msg) {
5236
5345
  // to update to chat messages triples
5237
5346
  /* if (!validateMsg(msg))
@@ -5243,27 +5352,29 @@ function getMsgHash(message) {
5243
5352
  var msgHash = (0, _sha.sha256)(utf8Encoder.encode(serializeMsg(message)));
5244
5353
  return (0, _utils.bytesToHex)(msgHash);
5245
5354
  }
5246
- var isRecord = function isRecord(obj) {
5247
- return obj instanceof Object;
5248
- };
5249
- function validateMsg(message) {
5250
- /* if (!isRecord(message)) return false
5355
+
5356
+ // const isRecord = (obj: unknown): obj is Record<string, unknown> => obj instanceof Object
5357
+
5358
+ /* export function validateMsg<T> (message: T): message is T & UnsignedMsg {
5359
+ if (!isRecord(message)) return false
5251
5360
  if (typeof message.kind !== 'number') return false
5252
5361
  if (typeof message.content !== 'string') return false
5253
5362
  if (typeof message.created_at !== 'number') return false
5254
5363
  if (typeof message.pubkey !== 'string') return false
5255
5364
  if (!message.pubkey.match(/^[a-f0-9]{64}$/)) return false
5256
- if (!Array.isArray(message.tags)) return false
5365
+
5366
+ if (!Array.isArray(message.tags)) return false
5257
5367
  for (let i = 0; i < message.tags.length; i++) {
5258
5368
  let tag = message.tags[i]
5259
5369
  if (!Array.isArray(tag)) return false
5260
5370
  for (let j = 0; j < tag.length; j++) {
5261
5371
  if (typeof tag[j] === 'object') return false
5262
5372
  }
5263
- } */
5373
+ }
5374
+
5375
+ return true
5376
+ } */
5264
5377
 
5265
- return true;
5266
- }
5267
5378
  function verifySignature(sig, message, pubKey) {
5268
5379
  return _secp256k.schnorr.verify(sig, getMsgHash(message), pubKey);
5269
5380
  }
@@ -12474,6 +12585,251 @@ function isLight(x) {
12474
12585
 
12475
12586
  /***/ }),
12476
12587
 
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
+
12477
12833
  /***/ "./lib/utils/headerFooterHelpers.js":
12478
12834
  /*!******************************************!*\
12479
12835
  !*** ./lib/utils/headerFooterHelpers.js ***!
@@ -13320,8 +13676,8 @@ Object.defineProperty(exports, "__esModule", ({
13320
13676
  }));
13321
13677
  exports.versionInfo = void 0;
13322
13678
  var versionInfo = {
13323
- buildTime: '2023-04-25T08:53:43Z',
13324
- commit: '9f7a01da36a7e5e6b71dafcecf7bc9393366980e',
13679
+ buildTime: '2023-05-07T21:57:02Z',
13680
+ commit: 'a6ef5829342bf6cf9edc192a9493be0812c08dbf',
13325
13681
  npmInfo: {
13326
13682
  'solid-ui': '2.4.27',
13327
13683
  npm: '8.19.4',
@@ -62007,14 +62363,17 @@ __webpack_require__.r(__webpack_exports__);
62007
62363
  /* harmony export */ "createRemoteJWKSet": () => (/* binding */ createRemoteJWKSet)
62008
62364
  /* harmony export */ });
62009
62365
  /* harmony import */ var _runtime_fetch_jwks_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/fetch_jwks.js */ "./node_modules/jose/dist/browser/runtime/fetch_jwks.js");
62010
- /* harmony import */ var _runtime_env_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../runtime/env.js */ "./node_modules/jose/dist/browser/runtime/env.js");
62011
- /* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
62012
- /* harmony import */ var _local_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./local.js */ "./node_modules/jose/dist/browser/jwks/local.js");
62013
-
62366
+ /* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
62367
+ /* harmony import */ var _local_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./local.js */ "./node_modules/jose/dist/browser/jwks/local.js");
62014
62368
 
62015
62369
 
62016
62370
 
62017
- class RemoteJWKSet extends _local_js__WEBPACK_IMPORTED_MODULE_3__.LocalJWKSet {
62371
+ function isCloudflareWorkers() {
62372
+ return (typeof WebSocketPair !== 'undefined' ||
62373
+ (typeof navigator !== 'undefined' && navigator.userAgent === 'Cloudflare-Workers') ||
62374
+ (typeof EdgeRuntime !== 'undefined' && EdgeRuntime === 'vercel'));
62375
+ }
62376
+ class RemoteJWKSet extends _local_js__WEBPACK_IMPORTED_MODULE_2__.LocalJWKSet {
62018
62377
  constructor(url, options) {
62019
62378
  super({ keys: [] });
62020
62379
  this._jwks = undefined;
@@ -62047,7 +62406,7 @@ class RemoteJWKSet extends _local_js__WEBPACK_IMPORTED_MODULE_3__.LocalJWKSet {
62047
62406
  return await super.getKey(protectedHeader, token);
62048
62407
  }
62049
62408
  catch (err) {
62050
- if (err instanceof _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWKSNoMatchingKey) {
62409
+ if (err instanceof _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSNoMatchingKey) {
62051
62410
  if (this.coolingDown() === false) {
62052
62411
  await this.reload();
62053
62412
  return super.getKey(protectedHeader, token);
@@ -62057,13 +62416,13 @@ class RemoteJWKSet extends _local_js__WEBPACK_IMPORTED_MODULE_3__.LocalJWKSet {
62057
62416
  }
62058
62417
  }
62059
62418
  async reload() {
62060
- if (this._pendingFetch && (0,_runtime_env_js__WEBPACK_IMPORTED_MODULE_1__.isCloudflareWorkers)()) {
62419
+ if (this._pendingFetch && isCloudflareWorkers()) {
62061
62420
  this._pendingFetch = undefined;
62062
62421
  }
62063
62422
  this._pendingFetch || (this._pendingFetch = (0,_runtime_fetch_jwks_js__WEBPACK_IMPORTED_MODULE_0__["default"])(this._url, this._timeoutDuration, this._options)
62064
62423
  .then((json) => {
62065
- if (!(0,_local_js__WEBPACK_IMPORTED_MODULE_3__.isJWKSLike)(json)) {
62066
- throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JWKSInvalid('JSON Web Key Set malformed');
62424
+ if (!(0,_local_js__WEBPACK_IMPORTED_MODULE_2__.isJWKSLike)(json)) {
62425
+ throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JWKSInvalid('JSON Web Key Set malformed');
62067
62426
  }
62068
62427
  this._jwks = { keys: json.keys };
62069
62428
  this._jwksTimestamp = Date.now();
@@ -63251,8 +63610,6 @@ __webpack_require__.r(__webpack_exports__);
63251
63610
  /* harmony export */ "checkEncCryptoKey": () => (/* binding */ checkEncCryptoKey),
63252
63611
  /* harmony export */ "checkSigCryptoKey": () => (/* binding */ checkSigCryptoKey)
63253
63612
  /* harmony export */ });
63254
- /* harmony import */ var _runtime_env_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../runtime/env.js */ "./node_modules/jose/dist/browser/runtime/env.js");
63255
-
63256
63613
  function unusable(name, prop = 'algorithm.name') {
63257
63614
  return new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name}`);
63258
63615
  }
@@ -63327,11 +63684,6 @@ function checkSigCryptoKey(key, alg, ...usages) {
63327
63684
  }
63328
63685
  case 'EdDSA': {
63329
63686
  if (key.algorithm.name !== 'Ed25519' && key.algorithm.name !== 'Ed448') {
63330
- if ((0,_runtime_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
63331
- if (isAlgorithm(key.algorithm, 'NODE-ED25519'))
63332
- break;
63333
- throw unusable('Ed25519, Ed448, or NODE-ED25519');
63334
- }
63335
63687
  throw unusable('Ed25519 or Ed448');
63336
63688
  }
63337
63689
  break;
@@ -64162,14 +64514,12 @@ __webpack_require__.r(__webpack_exports__);
64162
64514
  /* harmony export */ "toPKCS8": () => (/* binding */ toPKCS8),
64163
64515
  /* harmony export */ "toSPKI": () => (/* binding */ toSPKI)
64164
64516
  /* harmony export */ });
64165
- /* harmony import */ var _env_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./env.js */ "./node_modules/jose/dist/browser/runtime/env.js");
64166
- /* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js");
64167
- /* harmony import */ var _lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../lib/invalid_key_input.js */ "./node_modules/jose/dist/browser/lib/invalid_key_input.js");
64168
- /* harmony import */ var _base64url_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js");
64169
- /* harmony import */ var _lib_format_pem_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../lib/format_pem.js */ "./node_modules/jose/dist/browser/lib/format_pem.js");
64170
- /* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
64171
- /* harmony import */ var _is_key_like_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./is_key_like.js */ "./node_modules/jose/dist/browser/runtime/is_key_like.js");
64172
-
64517
+ /* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js");
64518
+ /* harmony import */ var _lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../lib/invalid_key_input.js */ "./node_modules/jose/dist/browser/lib/invalid_key_input.js");
64519
+ /* harmony import */ var _base64url_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js");
64520
+ /* harmony import */ var _lib_format_pem_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../lib/format_pem.js */ "./node_modules/jose/dist/browser/lib/format_pem.js");
64521
+ /* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
64522
+ /* harmony import */ var _is_key_like_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./is_key_like.js */ "./node_modules/jose/dist/browser/runtime/is_key_like.js");
64173
64523
 
64174
64524
 
64175
64525
 
@@ -64177,8 +64527,8 @@ __webpack_require__.r(__webpack_exports__);
64177
64527
 
64178
64528
 
64179
64529
  const genericExport = async (keyType, keyFormat, key) => {
64180
- if (!(0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_1__.isCryptoKey)(key)) {
64181
- throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_2__["default"])(key, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_6__.types));
64530
+ if (!(0,_webcrypto_js__WEBPACK_IMPORTED_MODULE_0__.isCryptoKey)(key)) {
64531
+ throw new TypeError((0,_lib_invalid_key_input_js__WEBPACK_IMPORTED_MODULE_1__["default"])(key, ..._is_key_like_js__WEBPACK_IMPORTED_MODULE_5__.types));
64182
64532
  }
64183
64533
  if (!key.extractable) {
64184
64534
  throw new TypeError('CryptoKey is not extractable');
@@ -64186,7 +64536,7 @@ const genericExport = async (keyType, keyFormat, key) => {
64186
64536
  if (key.type !== keyType) {
64187
64537
  throw new TypeError(`key is not a ${keyType} key`);
64188
64538
  }
64189
- return (0,_lib_format_pem_js__WEBPACK_IMPORTED_MODULE_4__["default"])((0,_base64url_js__WEBPACK_IMPORTED_MODULE_3__.encodeBase64)(new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.exportKey(keyFormat, key))), `${keyType.toUpperCase()} KEY`);
64539
+ return (0,_lib_format_pem_js__WEBPACK_IMPORTED_MODULE_3__["default"])((0,_base64url_js__WEBPACK_IMPORTED_MODULE_2__.encodeBase64)(new Uint8Array(await _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.exportKey(keyFormat, key))), `${keyType.toUpperCase()} KEY`);
64190
64540
  };
64191
64541
  const toSPKI = (key) => {
64192
64542
  return genericExport('public', 'spki', key);
@@ -64224,11 +64574,11 @@ const getNamedCurve = (keyData) => {
64224
64574
  case findOid(keyData, [0x2b, 0x65, 0x71]):
64225
64575
  return 'Ed448';
64226
64576
  default:
64227
- throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JOSENotSupported('Invalid or unsupported EC Key Curve or OKP Key Sub Type');
64577
+ throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_4__.JOSENotSupported('Invalid or unsupported EC Key Curve or OKP Key Sub Type');
64228
64578
  }
64229
64579
  };
64230
64580
  const genericImport = async (replace, keyFormat, pem, alg, options) => {
64231
- var _a, _b;
64581
+ var _a;
64232
64582
  let algorithm;
64233
64583
  let keyUsages;
64234
64584
  const keyData = new Uint8Array(atob(pem.replace(replace, ''))
@@ -64284,20 +64634,9 @@ const genericImport = async (replace, keyFormat, pem, alg, options) => {
64284
64634
  keyUsages = isPublic ? ['verify'] : ['sign'];
64285
64635
  break;
64286
64636
  default:
64287
- throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_5__.JOSENotSupported('Invalid or unsupported "alg" (Algorithm) value');
64288
- }
64289
- try {
64290
- return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey(keyFormat, keyData, algorithm, (_a = options === null || options === void 0 ? void 0 : options.extractable) !== null && _a !== void 0 ? _a : false, keyUsages);
64291
- }
64292
- catch (err) {
64293
- if (algorithm.name === 'Ed25519' &&
64294
- (err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
64295
- (0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
64296
- algorithm = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
64297
- return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey(keyFormat, keyData, algorithm, (_b = options === null || options === void 0 ? void 0 : options.extractable) !== null && _b !== void 0 ? _b : false, keyUsages);
64298
- }
64299
- throw err;
64637
+ throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_4__.JOSENotSupported('Invalid or unsupported "alg" (Algorithm) value');
64300
64638
  }
64639
+ return _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.importKey(keyFormat, keyData, algorithm, (_a = options === null || options === void 0 ? void 0 : options.extractable) !== null && _a !== void 0 ? _a : false, keyUsages);
64301
64640
  };
64302
64641
  const fromPKCS8 = (pem, alg, options) => {
64303
64642
  return genericImport(/(?:-----(?:BEGIN|END) PRIVATE KEY-----|\s)/g, 'pkcs8', pem, alg, options);
@@ -64366,12 +64705,12 @@ function parseElement(bytes) {
64366
64705
  }
64367
64706
  function spkiFromX509(buf) {
64368
64707
  const tbsCertificate = getElement(getElement(parseElement(buf).contents)[0].contents);
64369
- return (0,_base64url_js__WEBPACK_IMPORTED_MODULE_3__.encodeBase64)(tbsCertificate[tbsCertificate[0].raw[0] === 0xa0 ? 6 : 5].raw);
64708
+ return (0,_base64url_js__WEBPACK_IMPORTED_MODULE_2__.encodeBase64)(tbsCertificate[tbsCertificate[0].raw[0] === 0xa0 ? 6 : 5].raw);
64370
64709
  }
64371
64710
  function getSPKI(x509) {
64372
64711
  const pem = x509.replace(/(?:-----(?:BEGIN|END) CERTIFICATE-----|\s)/g, '');
64373
- const raw = (0,_base64url_js__WEBPACK_IMPORTED_MODULE_3__.decodeBase64)(pem);
64374
- return (0,_lib_format_pem_js__WEBPACK_IMPORTED_MODULE_4__["default"])(spkiFromX509(raw), 'PUBLIC KEY');
64712
+ const raw = (0,_base64url_js__WEBPACK_IMPORTED_MODULE_2__.decodeBase64)(pem);
64713
+ return (0,_lib_format_pem_js__WEBPACK_IMPORTED_MODULE_3__["default"])(spkiFromX509(raw), 'PUBLIC KEY');
64375
64714
  }
64376
64715
  const fromX509 = (pem, alg, options) => {
64377
64716
  let spki;
@@ -64799,26 +65138,6 @@ const encrypt = async (enc, plaintext, cek, iv, aad) => {
64799
65138
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (encrypt);
64800
65139
 
64801
65140
 
64802
- /***/ }),
64803
-
64804
- /***/ "./node_modules/jose/dist/browser/runtime/env.js":
64805
- /*!*******************************************************!*\
64806
- !*** ./node_modules/jose/dist/browser/runtime/env.js ***!
64807
- \*******************************************************/
64808
- /***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
64809
-
64810
- "use strict";
64811
- __webpack_require__.r(__webpack_exports__);
64812
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
64813
- /* harmony export */ "isCloudflareWorkers": () => (/* binding */ isCloudflareWorkers)
64814
- /* harmony export */ });
64815
- function isCloudflareWorkers() {
64816
- return (typeof WebSocketPair !== 'undefined' ||
64817
- (typeof navigator !== 'undefined' && navigator.userAgent === 'Cloudflare-Workers') ||
64818
- (typeof EdgeRuntime !== 'undefined' && EdgeRuntime === 'vercel'));
64819
- }
64820
-
64821
-
64822
65141
  /***/ }),
64823
65142
 
64824
65143
  /***/ "./node_modules/jose/dist/browser/runtime/fetch_jwks.js":
@@ -64883,11 +65202,9 @@ __webpack_require__.r(__webpack_exports__);
64883
65202
  /* harmony export */ "generateKeyPair": () => (/* binding */ generateKeyPair),
64884
65203
  /* harmony export */ "generateSecret": () => (/* binding */ generateSecret)
64885
65204
  /* harmony export */ });
64886
- /* harmony import */ var _env_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./env.js */ "./node_modules/jose/dist/browser/runtime/env.js");
64887
- /* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js");
64888
- /* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
64889
- /* harmony import */ var _random_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./random.js */ "./node_modules/jose/dist/browser/runtime/random.js");
64890
-
65205
+ /* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js");
65206
+ /* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
65207
+ /* harmony import */ var _random_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./random.js */ "./node_modules/jose/dist/browser/runtime/random.js");
64891
65208
 
64892
65209
 
64893
65210
 
@@ -64908,7 +65225,7 @@ async function generateSecret(alg, options) {
64908
65225
  case 'A192CBC-HS384':
64909
65226
  case 'A256CBC-HS512':
64910
65227
  length = parseInt(alg.slice(-3), 10);
64911
- return (0,_random_js__WEBPACK_IMPORTED_MODULE_3__["default"])(new Uint8Array(length >> 3));
65228
+ return (0,_random_js__WEBPACK_IMPORTED_MODULE_2__["default"])(new Uint8Array(length >> 3));
64912
65229
  case 'A128KW':
64913
65230
  case 'A192KW':
64914
65231
  case 'A256KW':
@@ -64927,20 +65244,20 @@ async function generateSecret(alg, options) {
64927
65244
  keyUsages = ['encrypt', 'decrypt'];
64928
65245
  break;
64929
65246
  default:
64930
- throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
65247
+ throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
64931
65248
  }
64932
- return _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.generateKey(algorithm, (_a = options === null || options === void 0 ? void 0 : options.extractable) !== null && _a !== void 0 ? _a : false, keyUsages);
65249
+ return _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.generateKey(algorithm, (_a = options === null || options === void 0 ? void 0 : options.extractable) !== null && _a !== void 0 ? _a : false, keyUsages);
64933
65250
  }
64934
65251
  function getModulusLengthOption(options) {
64935
65252
  var _a;
64936
65253
  const modulusLength = (_a = options === null || options === void 0 ? void 0 : options.modulusLength) !== null && _a !== void 0 ? _a : 2048;
64937
65254
  if (typeof modulusLength !== 'number' || modulusLength < 2048) {
64938
- throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used');
65255
+ throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported modulusLength option provided, 2048 bits or larger keys must be used');
64939
65256
  }
64940
65257
  return modulusLength;
64941
65258
  }
64942
65259
  async function generateKeyPair(alg, options) {
64943
- var _a, _b, _c, _d;
65260
+ var _a, _b, _c;
64944
65261
  let algorithm;
64945
65262
  let keyUsages;
64946
65263
  switch (alg) {
@@ -64999,7 +65316,7 @@ async function generateKeyPair(alg, options) {
64999
65316
  algorithm = { name: crv };
65000
65317
  break;
65001
65318
  default:
65002
- throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported crv option provided');
65319
+ throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported crv option provided');
65003
65320
  }
65004
65321
  break;
65005
65322
  case 'ECDH-ES':
@@ -65020,25 +65337,14 @@ async function generateKeyPair(alg, options) {
65020
65337
  algorithm = { name: crv };
65021
65338
  break;
65022
65339
  default:
65023
- throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448');
65340
+ throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported crv option provided, supported values are P-256, P-384, P-521, X25519, and X448');
65024
65341
  }
65025
65342
  break;
65026
65343
  }
65027
65344
  default:
65028
- throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
65029
- }
65030
- try {
65031
- return (await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.generateKey(algorithm, (_c = options === null || options === void 0 ? void 0 : options.extractable) !== null && _c !== void 0 ? _c : false, keyUsages));
65032
- }
65033
- catch (err) {
65034
- if (algorithm.name === 'Ed25519' &&
65035
- (err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
65036
- (0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
65037
- algorithm = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
65038
- return (await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.generateKey(algorithm, (_d = options === null || options === void 0 ? void 0 : options.extractable) !== null && _d !== void 0 ? _d : false, keyUsages));
65039
- }
65040
- throw err;
65345
+ throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
65041
65346
  }
65347
+ return (_webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.generateKey(algorithm, (_c = options === null || options === void 0 ? void 0 : options.extractable) !== null && _c !== void 0 ? _c : false, keyUsages));
65042
65348
  }
65043
65349
 
65044
65350
 
@@ -65113,11 +65419,9 @@ __webpack_require__.r(__webpack_exports__);
65113
65419
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
65114
65420
  /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
65115
65421
  /* harmony export */ });
65116
- /* harmony import */ var _env_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./env.js */ "./node_modules/jose/dist/browser/runtime/env.js");
65117
- /* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js");
65118
- /* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
65119
- /* harmony import */ var _base64url_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js");
65120
-
65422
+ /* harmony import */ var _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./webcrypto.js */ "./node_modules/jose/dist/browser/runtime/webcrypto.js");
65423
+ /* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
65424
+ /* harmony import */ var _base64url_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./base64url.js */ "./node_modules/jose/dist/browser/runtime/base64url.js");
65121
65425
 
65122
65426
 
65123
65427
 
@@ -65136,7 +65440,7 @@ function subtleMapping(jwk) {
65136
65440
  case 'A128CBC-HS256':
65137
65441
  case 'A192CBC-HS384':
65138
65442
  case 'A256CBC-HS512':
65139
- throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported(`${jwk.alg} keys cannot be imported as CryptoKey instances`);
65443
+ throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported(`${jwk.alg} keys cannot be imported as CryptoKey instances`);
65140
65444
  case 'A128GCM':
65141
65445
  case 'A192GCM':
65142
65446
  case 'A256GCM':
@@ -65159,7 +65463,7 @@ function subtleMapping(jwk) {
65159
65463
  keyUsages = ['deriveBits'];
65160
65464
  break;
65161
65465
  default:
65162
- throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
65466
+ throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
65163
65467
  }
65164
65468
  break;
65165
65469
  }
@@ -65188,7 +65492,7 @@ function subtleMapping(jwk) {
65188
65492
  keyUsages = jwk.d ? ['decrypt', 'unwrapKey'] : ['encrypt', 'wrapKey'];
65189
65493
  break;
65190
65494
  default:
65191
- throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
65495
+ throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
65192
65496
  }
65193
65497
  break;
65194
65498
  }
@@ -65214,7 +65518,7 @@ function subtleMapping(jwk) {
65214
65518
  keyUsages = jwk.d ? ['deriveBits'] : [];
65215
65519
  break;
65216
65520
  default:
65217
- throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
65521
+ throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
65218
65522
  }
65219
65523
  break;
65220
65524
  }
@@ -65232,12 +65536,12 @@ function subtleMapping(jwk) {
65232
65536
  keyUsages = jwk.d ? ['deriveBits'] : [];
65233
65537
  break;
65234
65538
  default:
65235
- throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
65539
+ throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
65236
65540
  }
65237
65541
  break;
65238
65542
  }
65239
65543
  default:
65240
- throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_2__.JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
65544
+ throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported('Invalid or unsupported JWK "kty" (Key Type) Parameter value');
65241
65545
  }
65242
65546
  return { algorithm, keyUsages };
65243
65547
  }
@@ -65253,23 +65557,12 @@ const parse = async (jwk) => {
65253
65557
  (_b = jwk.key_ops) !== null && _b !== void 0 ? _b : keyUsages,
65254
65558
  ];
65255
65559
  if (algorithm.name === 'PBKDF2') {
65256
- return _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey('raw', (0,_base64url_js__WEBPACK_IMPORTED_MODULE_3__.decode)(jwk.k), ...rest);
65560
+ return _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.importKey('raw', (0,_base64url_js__WEBPACK_IMPORTED_MODULE_2__.decode)(jwk.k), ...rest);
65257
65561
  }
65258
65562
  const keyData = { ...jwk };
65259
65563
  delete keyData.alg;
65260
65564
  delete keyData.use;
65261
- try {
65262
- return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey('jwk', keyData, ...rest);
65263
- }
65264
- catch (err) {
65265
- if (algorithm.name === 'Ed25519' &&
65266
- (err === null || err === void 0 ? void 0 : err.name) === 'NotSupportedError' &&
65267
- (0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)()) {
65268
- rest[0] = { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
65269
- return await _webcrypto_js__WEBPACK_IMPORTED_MODULE_1__["default"].subtle.importKey('jwk', keyData, ...rest);
65270
- }
65271
- throw err;
65272
- }
65565
+ return _webcrypto_js__WEBPACK_IMPORTED_MODULE_0__["default"].subtle.importKey('jwk', keyData, ...rest);
65273
65566
  };
65274
65567
  /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (parse);
65275
65568
 
@@ -65511,9 +65804,7 @@ __webpack_require__.r(__webpack_exports__);
65511
65804
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
65512
65805
  /* harmony export */ "default": () => (/* binding */ subtleDsa)
65513
65806
  /* harmony export */ });
65514
- /* harmony import */ var _env_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./env.js */ "./node_modules/jose/dist/browser/runtime/env.js");
65515
- /* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
65516
-
65807
+ /* harmony import */ var _util_errors_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/errors.js */ "./node_modules/jose/dist/browser/util/errors.js");
65517
65808
 
65518
65809
  function subtleDsa(alg, algorithm) {
65519
65810
  const hash = `SHA-${alg.slice(-3)}`;
@@ -65535,12 +65826,9 @@ function subtleDsa(alg, algorithm) {
65535
65826
  case 'ES512':
65536
65827
  return { hash, name: 'ECDSA', namedCurve: algorithm.namedCurve };
65537
65828
  case 'EdDSA':
65538
- if ((0,_env_js__WEBPACK_IMPORTED_MODULE_0__.isCloudflareWorkers)() && algorithm.name === 'NODE-ED25519') {
65539
- return { name: 'NODE-ED25519', namedCurve: 'NODE-ED25519' };
65540
- }
65541
65829
  return { name: algorithm.name };
65542
65830
  default:
65543
- throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_1__.JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
65831
+ throw new _util_errors_js__WEBPACK_IMPORTED_MODULE_0__.JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
65544
65832
  }
65545
65833
  }
65546
65834