zkjson 0.1.33 → 0.2.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/collection.js CHANGED
@@ -3,7 +3,7 @@ const { pad, toSignal, id2str, encode, toIndex } = require("./encoder")
3
3
  const Doc = require("./doc")
4
4
 
5
5
  class Collection {
6
- constructor({ size_val = 5, size_path = 5, size_json = 16, level = 100 }) {
6
+ constructor({ size_val = 256, size_path = 5, size_json = 256, level = 254 }) {
7
7
  this.size_val = size_val
8
8
  this.size_path = size_path
9
9
  this.size_json = size_json
package/db.js CHANGED
@@ -6,11 +6,11 @@ const Collection = require("./collection")
6
6
 
7
7
  class DB {
8
8
  constructor({
9
- size_val = 5,
9
+ size_val = 256,
10
10
  size_path = 5,
11
- level = 100,
11
+ level = 254,
12
12
  size_json = 256,
13
- size_txs = 10,
13
+ size_txs = 100,
14
14
  level_col = 8,
15
15
  wasm,
16
16
  zkey,
@@ -22,7 +22,7 @@ class DB {
22
22
  this.wasmRU = wasmRU
23
23
  this.zkeyRU = zkeyRU
24
24
  this.level_col = level_col
25
- this.size = size_val
25
+ this.size_val = size_val
26
26
  this.size_path = size_path
27
27
  this.level = level
28
28
  this.size_json = size_json
@@ -255,7 +255,7 @@ class DB {
255
255
 
256
256
  async getInputs({ id, col_id, json, path, val }) {
257
257
  const col_root = this.tree.F.toObject(this.tree.root).toString()
258
- const col_res = await this.getCol(id)
258
+ const col_res = await this.getCol(col_id)
259
259
 
260
260
  let col_siblings = col_res.siblings
261
261
  for (let i = 0; i < col_siblings.length; i++)
package/doc.js CHANGED
@@ -11,7 +11,7 @@ const {
11
11
  } = require("./encoder")
12
12
 
13
13
  module.exports = class Doc {
14
- constructor({ size_val = 5, size_path = 5, size_json = 256, wasm, zkey }) {
14
+ constructor({ size_val = 256, size_path = 5, size_json = 256, wasm, zkey }) {
15
15
  this.size_val = size_val
16
16
  this.size_path = size_path
17
17
  this.size_json = size_json
@@ -51,7 +51,7 @@ module.exports = class Doc {
51
51
  const { proof, publicSignals } = await snarkjs.groth16.fullProve(
52
52
  inputs,
53
53
  this.wasm,
54
- this.zkey
54
+ this.zkey,
55
55
  )
56
56
  return [
57
57
  ...proof.pi_a.slice(0, 2),
package/json.js CHANGED
@@ -1,15 +1,16 @@
1
1
  const { pad, toSignal, encode, encodePath, encodeVal } = require("./encoder")
2
2
 
3
3
  module.exports = class Json {
4
- constructor({ size = 5, size_json = 256 }) {
5
- this.size = size
4
+ constructor({ size_val = 256, size_path = 5, size_json = 256 }) {
5
+ this.size_val = size_val
6
+ this.size_path = size_path
6
7
  this.size_json = size_json
7
8
  }
8
9
  async getInputs({ json, path, val }) {
9
10
  return {
10
11
  json: pad(toSignal(encode(json)), this.size_json),
11
- path: pad(toSignal(encodePath(path)), this.size),
12
- val: pad(toSignal(encodeVal(val)), this.size),
12
+ path: pad(toSignal(encodePath(path)), this.size_path),
13
+ val: pad(toSignal(encodeVal(val)), this.size_val),
13
14
  }
14
15
  }
15
16
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zkjson",
3
- "version": "0.1.33",
3
+ "version": "0.2.0",
4
4
  "description": "Zero Knowledge Provable JSON",
5
5
  "main": "index.js",
6
6
  "license": "MIT",