wao 0.33.0 → 0.33.2

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
@@ -10,7 +10,7 @@ var _utils = require("./utils.js");
10
10
  var _hbsig = require("hbsig");
11
11
  var _hyperAos = _interopRequireDefault(require("./lua/hyper-aos.js"));
12
12
  var _aos_wamr = _interopRequireDefault(require("./lua/aos_wamr.js"));
13
- var _httpsig = require("./httpsig2.js");
13
+ var _httpsigUtils = require("./httpsig-utils.js");
14
14
  var _excluded = ["path"],
15
15
  _excluded2 = ["action", "tags"],
16
16
  _excluded3 = ["action", "tags"],
@@ -1084,43 +1084,24 @@ var HB = /*#__PURE__*/function () {
1084
1084
  }, {
1085
1085
  key: "commit",
1086
1086
  value: function () {
1087
- var _commit = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(obj, opts) {
1088
- var msg, hmacId, rsaId, committer, meta, meta2, sigs;
1087
+ var _commit2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee30(obj, opts) {
1089
1088
  return _regeneratorRuntime().wrap(function _callee30$(_context30) {
1090
1089
  while (1) switch (_context30.prev = _context30.next) {
1091
1090
  case 0:
1092
1091
  _context30.next = 2;
1093
- return this.sign(obj, opts);
1092
+ return (0, _hbsig.commit)(obj, _objectSpread(_objectSpread({}, opts), {}, {
1093
+ signer: this.sign
1094
+ }));
1094
1095
  case 2:
1095
- msg = _context30.sent;
1096
- hmacId = (0, _hbsig.hmacid)(msg.headers);
1097
- rsaId = (0, _hbsig.rsaid)(msg.headers);
1098
- committer = this.addr;
1099
- meta = {
1100
- alg: "rsa-pss-sha512",
1101
- "commitment-device": "httpsig@1.0"
1102
- };
1103
- meta2 = {
1104
- alg: "hmac-sha256",
1105
- "commitment-device": "httpsig@1.0"
1106
- };
1107
- sigs = {
1108
- signature: msg.headers.signature,
1109
- "signature-input": msg.headers["signature-input"]
1110
- };
1111
- return _context30.abrupt("return", _objectSpread({
1112
- commitments: _defineProperty(_defineProperty({}, rsaId, _objectSpread(_objectSpread({}, meta), {}, {
1113
- committer: committer
1114
- }, sigs)), hmacId, _objectSpread(_objectSpread({}, meta2), sigs))
1115
- }, obj));
1116
- case 10:
1096
+ return _context30.abrupt("return", _context30.sent);
1097
+ case 3:
1117
1098
  case "end":
1118
1099
  return _context30.stop();
1119
1100
  }
1120
1101
  }, _callee30, this);
1121
1102
  }));
1122
1103
  function commit(_x18, _x19) {
1123
- return _commit.apply(this, arguments);
1104
+ return _commit2.apply(this, arguments);
1124
1105
  }
1125
1106
  return commit;
1126
1107
  }()
@@ -1348,7 +1329,7 @@ var HB = /*#__PURE__*/function () {
1348
1329
  body: _context34.t1,
1349
1330
  status: _context34.t2
1350
1331
  };
1351
- return _context34.abrupt("return", _objectSpread(_objectSpread({}, (0, _httpsig.from)(http)), http));
1332
+ return _context34.abrupt("return", _objectSpread(_objectSpread({}, (0, _httpsigUtils.from)(http)), http));
1352
1333
  case 19:
1353
1334
  case "end":
1354
1335
  return _context34.stop();
@@ -7,7 +7,6 @@ exports.verifyContentDigest = exports.toBuffer = exports.hasValidSignature = exp
7
7
  var _ramda = require("ramda");
8
8
  var _hbsig = require("hbsig");
9
9
  var _base64url = _interopRequireDefault(require("base64url"));
10
- var _utils = require("./utils.js");
11
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
12
11
  function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
13
12
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -931,7 +930,7 @@ var from = exports.from = function from(http) {
931
930
  hashpath: (_sigData$params$tag = sigData === null || sigData === void 0 || (_sigData$params = sigData.params) === null || _sigData$params === void 0 ? void 0 : _sigData$params.tag) !== null && _sigData$params$tag !== void 0 ? _sigData$params$tag : null
932
931
  };
933
932
  try {
934
- ret.signer = (0, _utils.toAddr)(sigData.params.keyid);
933
+ ret.signer = (0, _hbsig.toAddr)(sigData.params.keyid);
935
934
  } catch (e) {}
936
935
 
937
936
  // Check if @path was in the signed components
@@ -9,6 +9,7 @@
9
9
  "deploy": "node scripts/deploy.js"
10
10
  },
11
11
  "dependencies": {
12
- "wao": "^0.32.2"
12
+ "hbsig": "^0.0.6",
13
+ "wao": "^0.33.2"
13
14
  }
14
15
  }
package/esm/hb.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { createSigner } from "@permaweb/aoconnect"
2
2
  import { isEmpty, last, isNotNil, mergeLeft, clone } from "ramda"
3
3
  import { toAddr, buildTags, seed } from "./utils.js"
4
- import { rsaid, hmacid, sign, signer, send as _send } from "hbsig"
4
+ import { rsaid, hmacid, sign, signer, send as _send, commit } from "hbsig"
5
5
  import hyper_aos from "./lua/hyper-aos.js"
6
6
  import aos_wamr from "./lua/aos_wamr.js"
7
- import { from } from "./httpsig2.js"
7
+ import { from } from "./httpsig-utils.js"
8
8
 
9
9
  class HB {
10
10
  constructor({
@@ -262,23 +262,7 @@ class HB {
262
262
  }
263
263
 
264
264
  async commit(obj, opts) {
265
- const msg = await this.sign(obj, opts)
266
- const hmacId = hmacid(msg.headers)
267
- const rsaId = rsaid(msg.headers)
268
- const committer = this.addr
269
- const meta = { alg: "rsa-pss-sha512", "commitment-device": "httpsig@1.0" }
270
- const meta2 = { alg: "hmac-sha256", "commitment-device": "httpsig@1.0" }
271
- const sigs = {
272
- signature: msg.headers.signature,
273
- "signature-input": msg.headers["signature-input"],
274
- }
275
- return {
276
- commitments: {
277
- [rsaId]: { ...meta, committer, ...sigs },
278
- [hmacId]: { ...meta2, ...sigs },
279
- },
280
- ...obj,
281
- }
265
+ return await commit(obj, { ...opts, signer: this.sign })
282
266
  }
283
267
 
284
268
  async p(path, ...args) {
@@ -1,7 +1,6 @@
1
1
  import { trim } from "ramda"
2
- import { decodeSigInput } from "hbsig"
2
+ import { toAddr, decodeSigInput } from "hbsig"
3
3
  import base64url from "base64url"
4
- import { toAddr } from "./utils.js"
5
4
 
6
5
  /**
7
6
  * Get multipart boundary from content-type header
@@ -9,6 +9,7 @@
9
9
  "deploy": "node scripts/deploy.js"
10
10
  },
11
11
  "dependencies": {
12
- "wao": "^0.32.2"
12
+ "hbsig": "^0.0.6",
13
+ "wao": "^0.33.2"
13
14
  }
14
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.33.0",
3
+ "version": "0.33.2",
4
4
  "bin": {
5
5
  "wao": "./cjs/cli.js",
6
6
  "wao-esm": "./esm/cli.js"
@@ -48,7 +48,7 @@
48
48
  "express": "^5.1.0",
49
49
  "fast-sha256": "^1.3.0",
50
50
  "graphql": "^16.10.0",
51
- "hbsig": "^0.0.3",
51
+ "hbsig": "^0.0.6",
52
52
  "http-message-signatures": "^1.0.4",
53
53
  "lmdb": "^3.2.2",
54
54
  "localforage": "^1.10.0",