@solarity/zkit 0.2.5 → 0.3.0-rc.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/README.md +8 -8
- package/dist/core/CircuitZKit.d.ts +24 -22
- package/dist/core/CircuitZKit.d.ts.map +1 -1
- package/dist/core/CircuitZKit.js +30 -44
- package/dist/core/CircuitZKit.js.map +1 -1
- package/dist/core/protocols/AbstractImplementer.d.ts +15 -0
- package/dist/core/protocols/AbstractImplementer.d.ts.map +1 -0
- package/dist/core/protocols/AbstractImplementer.js +36 -0
- package/dist/core/protocols/AbstractImplementer.js.map +1 -0
- package/dist/core/protocols/Groth16Implementer.d.ts +10 -0
- package/dist/core/protocols/Groth16Implementer.d.ts.map +1 -0
- package/dist/core/protocols/Groth16Implementer.js +50 -0
- package/dist/core/protocols/Groth16Implementer.js.map +1 -0
- package/dist/core/protocols/PlonkImplementer.d.ts +10 -0
- package/dist/core/protocols/PlonkImplementer.d.ts.map +1 -0
- package/dist/core/protocols/PlonkImplementer.js +51 -0
- package/dist/core/protocols/PlonkImplementer.js.map +1 -0
- package/dist/core/protocols/index.d.ts +4 -0
- package/dist/core/protocols/index.d.ts.map +1 -0
- package/dist/core/protocols/index.js +10 -0
- package/dist/core/protocols/index.js.map +1 -0
- package/dist/core/templates/verifier_groth16.vy.ejs +118 -0
- package/dist/core/templates/verifier_plonk.sol.ejs +681 -0
- package/dist/core/templates/verifier_plonk.vy.ejs +650 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/types/circuit-zkit.d.ts +1 -34
- package/dist/types/circuit-zkit.d.ts.map +1 -1
- package/dist/types/proof-utils.d.ts +7 -0
- package/dist/types/proof-utils.d.ts.map +1 -0
- package/dist/types/proof-utils.js +3 -0
- package/dist/types/proof-utils.js.map +1 -0
- package/dist/types/protocols/groth16.d.ts +28 -0
- package/dist/types/protocols/groth16.d.ts.map +1 -0
- package/dist/types/protocols/groth16.js +3 -0
- package/dist/types/protocols/groth16.js.map +1 -0
- package/dist/types/protocols/index.d.ts +31 -0
- package/dist/types/protocols/index.d.ts.map +1 -0
- package/dist/types/protocols/index.js +19 -0
- package/dist/types/protocols/index.js.map +1 -0
- package/dist/types/protocols/plonk.d.ts +26 -0
- package/dist/types/protocols/plonk.d.ts.map +1 -0
- package/dist/types/{types.js → protocols/plonk.js} +1 -1
- package/dist/types/protocols/plonk.js.map +1 -0
- package/package.json +7 -6
- package/src/core/CircuitZKit.ts +42 -63
- package/src/core/protocols/AbstractImplementer.ts +67 -0
- package/src/core/protocols/Groth16Implementer.ts +29 -0
- package/src/core/protocols/PlonkImplementer.ts +32 -0
- package/src/core/protocols/index.ts +3 -0
- package/src/core/templates/verifier_groth16.vy.ejs +118 -0
- package/src/core/templates/verifier_plonk.sol.ejs +681 -0
- package/src/core/templates/verifier_plonk.vy.ejs +650 -0
- package/src/index.ts +5 -1
- package/src/types/circuit-zkit.ts +1 -31
- package/src/types/proof-utils.ts +9 -0
- package/src/types/protocols/groth16.ts +21 -0
- package/src/types/protocols/index.ts +49 -0
- package/src/types/protocols/plonk.ts +28 -0
- package/dist/config/config.d.ts +0 -27
- package/dist/config/config.d.ts.map +0 -1
- package/dist/config/config.js +0 -19
- package/dist/config/config.js.map +0 -1
- package/dist/core/CircomZKit.d.ts +0 -39
- package/dist/core/CircomZKit.d.ts.map +0 -1
- package/dist/core/CircomZKit.js +0 -94
- package/dist/core/CircomZKit.js.map +0 -1
- package/dist/core/ManagerZKit.d.ts +0 -97
- package/dist/core/ManagerZKit.d.ts.map +0 -1
- package/dist/core/ManagerZKit.js +0 -222
- package/dist/core/ManagerZKit.js.map +0 -1
- package/dist/types/types.d.ts +0 -46
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/types.js.map +0 -1
- package/dist/utils/utils.d.ts +0 -18
- package/dist/utils/utils.d.ts.map +0 -1
- package/dist/utils/utils.js +0 -58
- package/dist/utils/utils.js.map +0 -1
package/dist/types/types.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export type NumericString = `${number}` | string;
|
|
2
|
-
export type PublicSignals = NumericString[];
|
|
3
|
-
export type Groth16Proof = {
|
|
4
|
-
pi_a: [NumericString, NumericString];
|
|
5
|
-
pi_b: [[NumericString, NumericString], [NumericString, NumericString]];
|
|
6
|
-
pi_c: [NumericString, NumericString];
|
|
7
|
-
protocol: string;
|
|
8
|
-
curve: string;
|
|
9
|
-
};
|
|
10
|
-
export type Calldata = [
|
|
11
|
-
[
|
|
12
|
-
NumericString,
|
|
13
|
-
NumericString
|
|
14
|
-
],
|
|
15
|
-
[
|
|
16
|
-
[NumericString, NumericString],
|
|
17
|
-
[NumericString, NumericString]
|
|
18
|
-
],
|
|
19
|
-
[
|
|
20
|
-
NumericString,
|
|
21
|
-
NumericString
|
|
22
|
-
],
|
|
23
|
-
[
|
|
24
|
-
NumericString
|
|
25
|
-
]
|
|
26
|
-
];
|
|
27
|
-
export type ProofStruct = {
|
|
28
|
-
proof: Groth16Proof;
|
|
29
|
-
publicSignals: PublicSignals;
|
|
30
|
-
};
|
|
31
|
-
export type NumberLike = number | bigint | string;
|
|
32
|
-
export type ArrayLike = NumberLike[] | ArrayLike[];
|
|
33
|
-
export type InputLike = NumberLike | ArrayLike;
|
|
34
|
-
export type Inputs = Record<string, InputLike>;
|
|
35
|
-
export type CircuitInfo = {
|
|
36
|
-
path: string;
|
|
37
|
-
id: string | null;
|
|
38
|
-
};
|
|
39
|
-
export type FileType = "r1cs" | "zkey" | "vkey" | "sym" | "json" | "wasm" | "sol";
|
|
40
|
-
export type DirType = "circuit" | "artifact" | "verifier";
|
|
41
|
-
export type TemplateType = "groth16";
|
|
42
|
-
export type PtauInfo = {
|
|
43
|
-
file: string;
|
|
44
|
-
url: string | null;
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-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AM,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAClF,MAAM,MAAM,OAAO,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAC1D,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC;AAErC,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACpB,CAAC"}
|
package/dist/types/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types/types.ts"],"names":[],"mappings":""}
|
package/dist/utils/utils.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reads a directory recursively and calls the callback for each file.
|
|
3
|
-
*
|
|
4
|
-
* @dev After Node.js 20.0.0 the `recursive` option is available.
|
|
5
|
-
*
|
|
6
|
-
* @param {string} dir - The directory to read.
|
|
7
|
-
* @param {(dir: string, file: string) => void} callback - The callback function.
|
|
8
|
-
*/
|
|
9
|
-
export declare function readDirRecursively(dir: string, callback: (dir: string, file: string) => void): void;
|
|
10
|
-
/**
|
|
11
|
-
* Downloads a file from the specified URL.
|
|
12
|
-
*
|
|
13
|
-
* @param {string} file - The path to save the file to.
|
|
14
|
-
* @param {string} url - The URL to download the file from.
|
|
15
|
-
* @returns {Promise<boolean>} Whether the file was downloaded successfully.
|
|
16
|
-
*/
|
|
17
|
-
export declare function downloadFile(file: string, url: string): Promise<boolean>;
|
|
18
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AAIA;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI,CAkBnG;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAoB9E"}
|
package/dist/utils/utils.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.downloadFile = exports.readDirRecursively = void 0;
|
|
7
|
-
const fs_1 = __importDefault(require("fs"));
|
|
8
|
-
const path_1 = __importDefault(require("path"));
|
|
9
|
-
const https_1 = __importDefault(require("https"));
|
|
10
|
-
/**
|
|
11
|
-
* Reads a directory recursively and calls the callback for each file.
|
|
12
|
-
*
|
|
13
|
-
* @dev After Node.js 20.0.0 the `recursive` option is available.
|
|
14
|
-
*
|
|
15
|
-
* @param {string} dir - The directory to read.
|
|
16
|
-
* @param {(dir: string, file: string) => void} callback - The callback function.
|
|
17
|
-
*/
|
|
18
|
-
function readDirRecursively(dir, callback) {
|
|
19
|
-
if (!fs_1.default.existsSync(dir)) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const entries = fs_1.default.readdirSync(dir, { withFileTypes: true });
|
|
23
|
-
for (const entry of entries) {
|
|
24
|
-
const entryPath = path_1.default.join(dir, entry.name);
|
|
25
|
-
if (entry.isDirectory()) {
|
|
26
|
-
readDirRecursively(entryPath, callback);
|
|
27
|
-
}
|
|
28
|
-
if (entry.isFile()) {
|
|
29
|
-
callback(dir, entryPath);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.readDirRecursively = readDirRecursively;
|
|
34
|
-
/**
|
|
35
|
-
* Downloads a file from the specified URL.
|
|
36
|
-
*
|
|
37
|
-
* @param {string} file - The path to save the file to.
|
|
38
|
-
* @param {string} url - The URL to download the file from.
|
|
39
|
-
* @returns {Promise<boolean>} Whether the file was downloaded successfully.
|
|
40
|
-
*/
|
|
41
|
-
async function downloadFile(file, url) {
|
|
42
|
-
const fileStream = fs_1.default.createWriteStream(file);
|
|
43
|
-
return new Promise((resolve, reject) => {
|
|
44
|
-
const request = https_1.default.get(url, (response) => {
|
|
45
|
-
response.pipe(fileStream);
|
|
46
|
-
});
|
|
47
|
-
fileStream.on("finish", () => resolve(true));
|
|
48
|
-
request.on("error", (err) => {
|
|
49
|
-
fs_1.default.unlink(file, () => reject(err));
|
|
50
|
-
});
|
|
51
|
-
fileStream.on("error", (err) => {
|
|
52
|
-
fs_1.default.unlink(file, () => reject(err));
|
|
53
|
-
});
|
|
54
|
-
request.end();
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
exports.downloadFile = downloadFile;
|
|
58
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/utils/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,gDAAwB;AACxB,kDAA0B;AAE1B;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAAC,GAAW,EAAE,QAA6C;IAC3F,IAAI,CAAC,YAAE,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACxB,OAAO;IACT,CAAC;IAED,MAAM,OAAO,GAAG,YAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC;IAE7D,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QAE7C,IAAI,KAAK,CAAC,WAAW,EAAE,EAAE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