@aztec/merkle-tree 0.26.6 → 0.27.1

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/dest/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * from './interfaces/indexed_tree.js';
3
3
  export * from './interfaces/merkle_tree.js';
4
4
  export * from './interfaces/update_only_tree.js';
5
5
  export * from './pedersen.js';
6
+ export * from './sha_256.js';
6
7
  export * from './sparse_tree/sparse_tree.js';
7
8
  export { StandardIndexedTree } from './standard_indexed_tree/standard_indexed_tree.js';
8
9
  export { StandardIndexedTreeWithAppend } from './standard_indexed_tree/test/standard_indexed_tree_with_append.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,eAAe,CAAC;AAC9B,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AACvF,OAAO,EAAE,6BAA6B,EAAE,MAAM,mEAAmE,CAAC;AAClH,cAAc,kCAAkC,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC;AACjD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kCAAkC,CAAC;AACjD,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AACvF,OAAO,EAAE,6BAA6B,EAAE,MAAM,mEAAmE,CAAC;AAClH,cAAc,kCAAkC,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,cAAc,iCAAiC,CAAC;AAChD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC"}
package/dest/index.js CHANGED
@@ -3,6 +3,7 @@ export * from './interfaces/indexed_tree.js';
3
3
  export * from './interfaces/merkle_tree.js';
4
4
  export * from './interfaces/update_only_tree.js';
5
5
  export * from './pedersen.js';
6
+ export * from './sha_256.js';
6
7
  export * from './sparse_tree/sparse_tree.js';
7
8
  export { StandardIndexedTree } from './standard_indexed_tree/standard_indexed_tree.js';
8
9
  export { StandardIndexedTreeWithAppend } from './standard_indexed_tree/test/standard_indexed_tree_with_append.js';
@@ -14,4 +15,4 @@ export * from './snapshots/snapshot_builder.js';
14
15
  export * from './snapshots/full_snapshot.js';
15
16
  export * from './snapshots/append_only_snapshot.js';
16
17
  export * from './snapshots/indexed_tree_snapshot.js';
17
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsY0FBYyxrQ0FBa0MsQ0FBQztBQUNqRCxjQUFjLDhCQUE4QixDQUFDO0FBQzdDLGNBQWMsNkJBQTZCLENBQUM7QUFDNUMsY0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BQWMsa0NBQWtDLENBQUM7QUFDakQsT0FBTyxFQUFFLFlBQVksRUFBRSxXQUFXLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUMzRCxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sZUFBZSxDQUFDO0FBQ3hDLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQztBQUMxQyxjQUFjLGlDQUFpQyxDQUFDO0FBQ2hELGNBQWMsOEJBQThCLENBQUM7QUFDN0MsY0FBYyxxQ0FBcUMsQ0FBQztBQUNwRCxjQUFjLHNDQUFzQyxDQUFDIn0=
@@ -0,0 +1,12 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { Hasher } from '@aztec/types/interfaces';
3
+ /**
4
+ * A helper class encapsulating SHA256 hash functionality.
5
+ * @deprecated Don't call SHA256 directly in production code. Instead, create suitably-named functions for specific
6
+ * purposes.
7
+ */
8
+ export declare class SHA256 implements Hasher {
9
+ hash(lhs: Uint8Array, rhs: Uint8Array): Buffer;
10
+ hashInputs(inputs: Buffer[]): Buffer;
11
+ }
12
+ //# sourceMappingURL=sha_256.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sha_256.d.ts","sourceRoot":"","sources":["../src/sha_256.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAEjD;;;;GAIG;AACH,qBAAa,MAAO,YAAW,MAAM;IAK5B,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,GAAG,MAAM;IAQ9C,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM;CAG5C"}
@@ -0,0 +1,23 @@
1
+ import { sha256 } from '@aztec/foundation/crypto';
2
+ /**
3
+ * A helper class encapsulating SHA256 hash functionality.
4
+ * @deprecated Don't call SHA256 directly in production code. Instead, create suitably-named functions for specific
5
+ * purposes.
6
+ */
7
+ export class SHA256 {
8
+ /*
9
+ * @deprecated Don't call SHA256 directly in production code. Instead, create suitably-named functions for specific
10
+ * purposes.
11
+ */
12
+ hash(lhs, rhs) {
13
+ return sha256(Buffer.concat([Buffer.from(lhs), Buffer.from(rhs)]));
14
+ }
15
+ /*
16
+ * @deprecated Don't call SHA256 directly in production code. Instead, create suitably-named functions for specific
17
+ * purposes.
18
+ */
19
+ hashInputs(inputs) {
20
+ return sha256(Buffer.concat(inputs));
21
+ }
22
+ }
23
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2hhXzI1Ni5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9zaGFfMjU2LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSwwQkFBMEIsQ0FBQztBQUdsRDs7OztHQUlHO0FBQ0gsTUFBTSxPQUFPLE1BQU07SUFDakI7OztPQUdHO0lBQ0ksSUFBSSxDQUFDLEdBQWUsRUFBRSxHQUFlO1FBQzFDLE9BQU8sTUFBTSxDQUFDLE1BQU0sQ0FBQyxNQUFNLENBQUMsQ0FBQyxNQUFNLENBQUMsSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLE1BQU0sQ0FBQyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7SUFDckUsQ0FBQztJQUVEOzs7T0FHRztJQUNJLFVBQVUsQ0FBQyxNQUFnQjtRQUNoQyxPQUFPLE1BQU0sQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDLE1BQU0sQ0FBQyxDQUFDLENBQUM7SUFDdkMsQ0FBQztDQUNGIn0=
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/merkle-tree",
3
- "version": "0.26.6",
3
+ "version": "0.27.1",
4
4
  "type": "module",
5
5
  "exports": "./dest/index.js",
6
6
  "typedocOptions": {
@@ -32,10 +32,10 @@
32
32
  "testTimeout": 15000
33
33
  },
34
34
  "dependencies": {
35
- "@aztec/circuit-types": "0.26.6",
36
- "@aztec/foundation": "0.26.6",
37
- "@aztec/kv-store": "0.26.6",
38
- "@aztec/types": "0.26.6",
35
+ "@aztec/circuit-types": "0.27.1",
36
+ "@aztec/foundation": "0.27.1",
37
+ "@aztec/kv-store": "0.27.1",
38
+ "@aztec/types": "0.27.1",
39
39
  "sha256": "^0.2.0",
40
40
  "tslib": "^2.4.0"
41
41
  },
package/src/index.ts CHANGED
@@ -3,6 +3,7 @@ export * from './interfaces/indexed_tree.js';
3
3
  export * from './interfaces/merkle_tree.js';
4
4
  export * from './interfaces/update_only_tree.js';
5
5
  export * from './pedersen.js';
6
+ export * from './sha_256.js';
6
7
  export * from './sparse_tree/sparse_tree.js';
7
8
  export { StandardIndexedTree } from './standard_indexed_tree/standard_indexed_tree.js';
8
9
  export { StandardIndexedTreeWithAppend } from './standard_indexed_tree/test/standard_indexed_tree_with_append.js';
package/src/sha_256.ts ADDED
@@ -0,0 +1,25 @@
1
+ import { sha256 } from '@aztec/foundation/crypto';
2
+ import { Hasher } from '@aztec/types/interfaces';
3
+
4
+ /**
5
+ * A helper class encapsulating SHA256 hash functionality.
6
+ * @deprecated Don't call SHA256 directly in production code. Instead, create suitably-named functions for specific
7
+ * purposes.
8
+ */
9
+ export class SHA256 implements Hasher {
10
+ /*
11
+ * @deprecated Don't call SHA256 directly in production code. Instead, create suitably-named functions for specific
12
+ * purposes.
13
+ */
14
+ public hash(lhs: Uint8Array, rhs: Uint8Array): Buffer {
15
+ return sha256(Buffer.concat([Buffer.from(lhs), Buffer.from(rhs)]));
16
+ }
17
+
18
+ /*
19
+ * @deprecated Don't call SHA256 directly in production code. Instead, create suitably-named functions for specific
20
+ * purposes.
21
+ */
22
+ public hashInputs(inputs: Buffer[]): Buffer {
23
+ return sha256(Buffer.concat(inputs));
24
+ }
25
+ }