wao 0.32.2 → 0.33.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/erl_json.js +317 -0
- package/cjs/erl_str.js +1037 -0
- package/cjs/hb.js +8 -22
- package/cjs/http.js +674 -0
- package/cjs/{httpsig.js → httpsig2.js} +5 -5
- package/cjs/hyperbeam.js +2 -1
- package/cjs/utils.js +8 -36
- package/esm/erl_json.js +289 -0
- package/esm/erl_str.js +1139 -0
- package/esm/hb.js +4 -20
- package/esm/http.js +619 -0
- package/esm/{httpsig.js → httpsig2.js} +2 -1
- package/esm/hyperbeam.js +1 -1
- package/esm/utils.js +7 -1
- package/package.json +3 -2
- package/cjs/collect-body-keys.js +0 -470
- package/cjs/encode-utils.js +0 -241
- package/cjs/encode.js +0 -1338
- package/cjs/http-message-signatures/httpbis.js +0 -497
- package/cjs/http-message-signatures/index.js +0 -26
- package/cjs/http-message-signatures/structured-header.js +0 -129
- package/cjs/id.js +0 -470
- package/cjs/send.js +0 -192
- package/cjs/signer-utils.js +0 -631
- package/cjs/signer.js +0 -204
- package/esm/collect-body-keys.js +0 -436
- package/esm/encode-utils.js +0 -185
- package/esm/encode.js +0 -1216
- package/esm/http-message-signatures/httpbis.js +0 -438
- package/esm/http-message-signatures/index.js +0 -4
- package/esm/http-message-signatures/structured-header.js +0 -105
- package/esm/id.js +0 -459
- package/esm/send.js +0 -124
- package/esm/signer-utils.js +0 -494
- package/esm/signer.js +0 -89
package/cjs/hb.js
CHANGED
|
@@ -7,11 +7,10 @@ exports["default"] = void 0;
|
|
|
7
7
|
var _aoconnect = require("@permaweb/aoconnect");
|
|
8
8
|
var _ramda = require("ramda");
|
|
9
9
|
var _utils = require("./utils.js");
|
|
10
|
-
var
|
|
11
|
-
var _send3 = require("./send.js");
|
|
10
|
+
var _hbsig = require("hbsig");
|
|
12
11
|
var _hyperAos = _interopRequireDefault(require("./lua/hyper-aos.js"));
|
|
13
12
|
var _aos_wamr = _interopRequireDefault(require("./lua/aos_wamr.js"));
|
|
14
|
-
var _httpsig = require("./
|
|
13
|
+
var _httpsig = require("./httpsig2.js");
|
|
15
14
|
var _excluded = ["path"],
|
|
16
15
|
_excluded2 = ["action", "tags"],
|
|
17
16
|
_excluded3 = ["action", "tags"],
|
|
@@ -38,11 +37,6 @@ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o =
|
|
|
38
37
|
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
39
38
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
40
39
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
41
|
-
var seed = function seed(num) {
|
|
42
|
-
var array = new Array(num);
|
|
43
|
-
for (var i = 0; i < num; i++) array[i] = Math.floor(Math.random() * 256);
|
|
44
|
-
return Buffer.from(array).toString("base64");
|
|
45
|
-
};
|
|
46
40
|
var HB = /*#__PURE__*/function () {
|
|
47
41
|
function HB() {
|
|
48
42
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
@@ -66,7 +60,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
66
60
|
case 0:
|
|
67
61
|
path = encoded.path, msg = _objectWithoutProperties(encoded, _excluded);
|
|
68
62
|
_context.next = 3;
|
|
69
|
-
return (0,
|
|
63
|
+
return (0, _hbsig.sign)({
|
|
70
64
|
jwk: this.jwk,
|
|
71
65
|
msg: msg,
|
|
72
66
|
path: path,
|
|
@@ -91,18 +85,10 @@ var HB = /*#__PURE__*/function () {
|
|
|
91
85
|
this.jwk = jwk;
|
|
92
86
|
this.signer = (0, _aoconnect.createSigner)(jwk, this.url);
|
|
93
87
|
this.addr = (0, _utils.toAddr)(jwk.n);
|
|
94
|
-
this.sign = (0,
|
|
88
|
+
this.sign = (0, _hbsig.signer)({
|
|
95
89
|
signer: this.signer,
|
|
96
90
|
url: this.url
|
|
97
91
|
});
|
|
98
|
-
var _connect = (0, _aoconnect.connect)({
|
|
99
|
-
MODE: "mainnet",
|
|
100
|
-
URL: this.url,
|
|
101
|
-
device: "",
|
|
102
|
-
signer: this.signer
|
|
103
|
-
}),
|
|
104
|
-
request = _connect.request;
|
|
105
|
-
this._request = request;
|
|
106
92
|
}
|
|
107
93
|
}, {
|
|
108
94
|
key: "setInfo",
|
|
@@ -168,7 +154,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
168
154
|
while (1) switch (_context4.prev = _context4.next) {
|
|
169
155
|
case 0:
|
|
170
156
|
_context4.next = 2;
|
|
171
|
-
return (0,
|
|
157
|
+
return (0, _hbsig.send)(msg);
|
|
172
158
|
case 2:
|
|
173
159
|
return _context4.abrupt("return", _context4.sent);
|
|
174
160
|
case 3:
|
|
@@ -888,7 +874,7 @@ var HB = /*#__PURE__*/function () {
|
|
|
888
874
|
_context25.t0 = this;
|
|
889
875
|
_context25.next = 4;
|
|
890
876
|
return this.commit((0, _ramda.mergeLeft)(tags, {
|
|
891
|
-
"random-seed": seed(16),
|
|
877
|
+
"random-seed": (0, _utils.seed)(16),
|
|
892
878
|
type: "Process",
|
|
893
879
|
"execution-device": "test-device@1.0",
|
|
894
880
|
device: "process@1.0",
|
|
@@ -1107,8 +1093,8 @@ var HB = /*#__PURE__*/function () {
|
|
|
1107
1093
|
return this.sign(obj, opts);
|
|
1108
1094
|
case 2:
|
|
1109
1095
|
msg = _context30.sent;
|
|
1110
|
-
hmacId = (0,
|
|
1111
|
-
rsaId = (0,
|
|
1096
|
+
hmacId = (0, _hbsig.hmacid)(msg.headers);
|
|
1097
|
+
rsaId = (0, _hbsig.rsaid)(msg.headers);
|
|
1112
1098
|
committer = this.addr;
|
|
1113
1099
|
meta = {
|
|
1114
1100
|
alg: "rsa-pss-sha512",
|