wao 0.24.1 → 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 +15 -10
- package/cjs/signer-utils.js +47 -5
- package/cjs/signer.js +318 -616
- package/esm/hb.js +11 -5
- package/esm/signer-utils.js +25 -0
- package/esm/signer.js +269 -482
- package/package.json +1 -1
package/cjs/hb.js
CHANGED
|
@@ -655,19 +655,20 @@ var HB = /*#__PURE__*/function () {
|
|
|
655
655
|
key: "compute",
|
|
656
656
|
value: function () {
|
|
657
657
|
var _compute = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee19(_ref7) {
|
|
658
|
-
var pid, slot;
|
|
658
|
+
var pid, slot, _ref7$path, path;
|
|
659
659
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
660
660
|
while (1) switch (_context19.prev = _context19.next) {
|
|
661
661
|
case 0:
|
|
662
|
-
pid = _ref7.pid, slot = _ref7.slot;
|
|
663
|
-
|
|
662
|
+
pid = _ref7.pid, slot = _ref7.slot, _ref7$path = _ref7.path, path = _ref7$path === void 0 ? "" : _ref7$path;
|
|
663
|
+
if (path && !/^\//.test(path)) path = "/" + path;
|
|
664
|
+
_context19.next = 4;
|
|
664
665
|
return this.getJSON({
|
|
665
|
-
path: "/".concat(pid, "/compute"),
|
|
666
|
+
path: "/".concat(pid, "/compute").concat(path),
|
|
666
667
|
slot: slot
|
|
667
668
|
});
|
|
668
|
-
case 3:
|
|
669
|
-
return _context19.abrupt("return", _context19.sent);
|
|
670
669
|
case 4:
|
|
670
|
+
return _context19.abrupt("return", _context19.sent);
|
|
671
|
+
case 5:
|
|
671
672
|
case "end":
|
|
672
673
|
return _context19.stop();
|
|
673
674
|
}
|
|
@@ -948,7 +949,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
948
949
|
(_pid2 = pid) !== null && _pid2 !== void 0 ? _pid2 : pid = this.pid;
|
|
949
950
|
_tags = (0, _ramda.mergeLeft)(tags, {
|
|
950
951
|
method: "POST",
|
|
951
|
-
path: "/".concat(pid, "
|
|
952
|
+
path: "/".concat(pid, "/schedule"),
|
|
952
953
|
Type: "Message",
|
|
953
954
|
Target: pid
|
|
954
955
|
});
|
|
@@ -1024,9 +1025,10 @@ var HB = /*#__PURE__*/function () {
|
|
|
1024
1025
|
Type: "Process",
|
|
1025
1026
|
image: image,
|
|
1026
1027
|
"execution-device": "stack@1.0",
|
|
1027
|
-
"device-stack": ["wasi@1.0", "json-iface@1.0", "wasm-64@1.0", "multipass@1.0"],
|
|
1028
|
+
"device-stack": ["wasi@1.0", "json-iface@1.0", "wasm-64@1.0", "patch@1.0", "multipass@1.0"],
|
|
1028
1029
|
"output-prefix": "wasm",
|
|
1029
1030
|
"patch-from": "/results/outbox",
|
|
1031
|
+
"patch-mode": "patches",
|
|
1030
1032
|
"stack-keys": ["init", "compute", "snapshot", "normalize"],
|
|
1031
1033
|
passes: 2
|
|
1032
1034
|
});
|
|
@@ -1216,7 +1218,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
1216
1218
|
if (path && !/^\//.test(path)) path = "/" + path;
|
|
1217
1219
|
_context30.next = 4;
|
|
1218
1220
|
return this.getJSON({
|
|
1219
|
-
path: "/".concat(pid, "
|
|
1221
|
+
path: "/".concat(pid, "/now").concat(path)
|
|
1220
1222
|
});
|
|
1221
1223
|
case 4:
|
|
1222
1224
|
return _context30.abrupt("return", _context30.sent);
|
|
@@ -1319,7 +1321,10 @@ var HB = /*#__PURE__*/function () {
|
|
|
1319
1321
|
module: "ISShJH1ij-hPPt9St5UFFr_8Ys3Kj5cyg7zrMGt7H9s",
|
|
1320
1322
|
device: "process@1.0",
|
|
1321
1323
|
"scheduler-device": "scheduler@1.0",
|
|
1322
|
-
"execution-device": "
|
|
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"]
|
|
1323
1328
|
});
|
|
1324
1329
|
_context33.next = 4;
|
|
1325
1330
|
return this.spawn(tags);
|
package/cjs/signer-utils.js
CHANGED
|
@@ -139,7 +139,7 @@ function _verify() {
|
|
|
139
139
|
}
|
|
140
140
|
}, _callee2);
|
|
141
141
|
}));
|
|
142
|
-
function verify(
|
|
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(
|
|
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(
|
|
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(
|
|
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
|
+
}
|