wao 0.24.2 → 0.25.0

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/cjs/hb.js CHANGED
@@ -1028,6 +1028,7 @@ var HB = /*#__PURE__*/function () {
1028
1028
  "device-stack": ["wasi@1.0", "json-iface@1.0", "wasm-64@1.0", "patch@1.0", "multipass@1.0"],
1029
1029
  "output-prefix": "wasm",
1030
1030
  "patch-from": "/results/outbox",
1031
+ "patch-mode": "patches",
1031
1032
  "stack-keys": ["init", "compute", "snapshot", "normalize"],
1032
1033
  passes: 2
1033
1034
  });
@@ -1320,7 +1321,10 @@ var HB = /*#__PURE__*/function () {
1320
1321
  module: "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
1321
1322
  device: "process@1.0",
1322
1323
  "scheduler-device": "scheduler@1.0",
1323
- "execution-device": "genesis-wasm@1.0"
1324
+ "execution-device": "stack@1.0",
1325
+ "device-stack": ["genesis-wasm@1.0", "patch@1.0"],
1326
+ "patch-from": "/results/outbox",
1327
+ "stack-keys": ["init", "compute", "snapshot", "normalize"]
1324
1328
  });
1325
1329
  _context33.next = 4;
1326
1330
  return this.spawn(tags);
@@ -139,7 +139,7 @@ function _verify() {
139
139
  }
140
140
  }, _callee2);
141
141
  }));
142
- function verify(_x6, _x7, _x8) {
142
+ function verify(_x7, _x8, _x9) {
143
143
  return _verify2.apply(this, arguments);
144
144
  }
145
145
  return verify;
@@ -151,7 +151,7 @@ function _verify() {
151
151
  }
152
152
  }, _callee3);
153
153
  }));
154
- return function keyLookup(_x5) {
154
+ return function keyLookup(_x6) {
155
155
  return _ref5.apply(this, arguments);
156
156
  };
157
157
  }();
@@ -209,7 +209,7 @@ function _verify() {
209
209
  }
210
210
  }, _callee4, null, [[0, 7]]);
211
211
  }));
212
- function verify(_x10, _x11, _x12) {
212
+ function verify(_x11, _x12, _x13) {
213
213
  return _verify3.apply(this, arguments);
214
214
  }
215
215
  return verify;
@@ -221,7 +221,7 @@ function _verify() {
221
221
  }
222
222
  }, _callee5);
223
223
  }));
224
- return function keyLookup(_x9) {
224
+ return function keyLookup(_x10) {
225
225
  return _ref6.apply(this, arguments);
226
226
  };
227
227
  }();
@@ -476,4 +476,46 @@ var toHttpSigner = exports.toHttpSigner = function toHttpSigner(signer) {
476
476
  return _ref2.apply(this, arguments);
477
477
  };
478
478
  }();
479
- };
479
+ };
480
+
481
+ /**
482
+ * Utility function to extract the message ID from a signed message
483
+ * Based on the original code's hash calculation
484
+ */
485
+ function getMessageId(_x5) {
486
+ return _getMessageId.apply(this, arguments);
487
+ }
488
+ function _getMessageId() {
489
+ _getMessageId = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(signedMessage) {
490
+ var signatureHeader, match, signature, encoder, data, hashBuffer, hashArray, hashBase64;
491
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
492
+ while (1) switch (_context8.prev = _context8.next) {
493
+ case 0:
494
+ // Extract signature from the Signature header
495
+ signatureHeader = signedMessage.headers.Signature || signedMessage.headers.signature;
496
+ match = signatureHeader.match(/Signature:\s*'http-sig-[^:]+:([^']+)'/);
497
+ signature = match ? match[1] : null;
498
+ if (signature) {
499
+ _context8.next = 5;
500
+ break;
501
+ }
502
+ throw new Error("Could not extract signature from headers");
503
+ case 5:
504
+ // Hash the signature to get message ID
505
+ encoder = new TextEncoder();
506
+ data = encoder.encode(signature);
507
+ _context8.next = 9;
508
+ return _crypto["default"].subtle.digest("SHA-256", data);
509
+ case 9:
510
+ hashBuffer = _context8.sent;
511
+ hashArray = Array.from(new Uint8Array(hashBuffer));
512
+ hashBase64 = btoa(String.fromCharCode.apply(String, hashArray));
513
+ return _context8.abrupt("return", hashBase64);
514
+ case 13:
515
+ case "end":
516
+ return _context8.stop();
517
+ }
518
+ }, _callee8);
519
+ }));
520
+ return _getMessageId.apply(this, arguments);
521
+ }