@noir-lang/noir_js 0.23.0 → 0.24.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/lib/program.cjs +6 -6
- package/lib/program.d.ts +4 -4
- package/lib/program.mjs +6 -6
- package/lib/witness_generation.cjs +7 -0
- package/lib/witness_generation.mjs +7 -0
- package/package.json +7 -6
package/lib/program.cjs
CHANGED
|
@@ -85,13 +85,13 @@ class Noir {
|
|
|
85
85
|
*
|
|
86
86
|
* @example
|
|
87
87
|
* ```typescript
|
|
88
|
-
* async
|
|
88
|
+
* async generateProof(input)
|
|
89
89
|
* ```
|
|
90
90
|
*
|
|
91
91
|
*/
|
|
92
|
-
async
|
|
92
|
+
async generateProof(inputs, foreignCallHandler) {
|
|
93
93
|
const { witness } = await this.execute(inputs, foreignCallHandler);
|
|
94
|
-
return this.getBackend().
|
|
94
|
+
return this.getBackend().generateProof(witness);
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
97
|
*
|
|
@@ -101,12 +101,12 @@ class Noir {
|
|
|
101
101
|
*
|
|
102
102
|
* @example
|
|
103
103
|
* ```typescript
|
|
104
|
-
* async
|
|
104
|
+
* async verifyProof(proof)
|
|
105
105
|
* ```
|
|
106
106
|
*
|
|
107
107
|
*/
|
|
108
|
-
async
|
|
109
|
-
return this.getBackend().
|
|
108
|
+
async verifyProof(proofData) {
|
|
109
|
+
return this.getBackend().verifyProof(proofData);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
exports.Noir = Noir;
|
package/lib/program.d.ts
CHANGED
|
@@ -40,11 +40,11 @@ export declare class Noir {
|
|
|
40
40
|
*
|
|
41
41
|
* @example
|
|
42
42
|
* ```typescript
|
|
43
|
-
* async
|
|
43
|
+
* async generateProof(input)
|
|
44
44
|
* ```
|
|
45
45
|
*
|
|
46
46
|
*/
|
|
47
|
-
|
|
47
|
+
generateProof(inputs: InputMap, foreignCallHandler?: ForeignCallHandler): Promise<ProofData>;
|
|
48
48
|
/**
|
|
49
49
|
*
|
|
50
50
|
* @description
|
|
@@ -53,9 +53,9 @@ export declare class Noir {
|
|
|
53
53
|
*
|
|
54
54
|
* @example
|
|
55
55
|
* ```typescript
|
|
56
|
-
* async
|
|
56
|
+
* async verifyProof(proof)
|
|
57
57
|
* ```
|
|
58
58
|
*
|
|
59
59
|
*/
|
|
60
|
-
|
|
60
|
+
verifyProof(proofData: ProofData): Promise<boolean>;
|
|
61
61
|
}
|
package/lib/program.mjs
CHANGED
|
@@ -59,13 +59,13 @@ export class Noir {
|
|
|
59
59
|
*
|
|
60
60
|
* @example
|
|
61
61
|
* ```typescript
|
|
62
|
-
* async
|
|
62
|
+
* async generateProof(input)
|
|
63
63
|
* ```
|
|
64
64
|
*
|
|
65
65
|
*/
|
|
66
|
-
async
|
|
66
|
+
async generateProof(inputs, foreignCallHandler) {
|
|
67
67
|
const { witness } = await this.execute(inputs, foreignCallHandler);
|
|
68
|
-
return this.getBackend().
|
|
68
|
+
return this.getBackend().generateProof(witness);
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
71
71
|
*
|
|
@@ -75,11 +75,11 @@ export class Noir {
|
|
|
75
75
|
*
|
|
76
76
|
* @example
|
|
77
77
|
* ```typescript
|
|
78
|
-
* async
|
|
78
|
+
* async verifyProof(proof)
|
|
79
79
|
* ```
|
|
80
80
|
*
|
|
81
81
|
*/
|
|
82
|
-
async
|
|
83
|
-
return this.getBackend().
|
|
82
|
+
async verifyProof(proofData) {
|
|
83
|
+
return this.getBackend().verifyProof(proofData);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -19,6 +19,13 @@ const defaultForeignCallHandler = async (name, args) => {
|
|
|
19
19
|
// If a user needs to print values then they should provide a custom foreign call handler.
|
|
20
20
|
return [];
|
|
21
21
|
}
|
|
22
|
+
else if (name == 'assert_message') {
|
|
23
|
+
// By default we do not do anything for `assert_message` foreign calls due to a need for formatting,
|
|
24
|
+
// however we provide an empty response in order to not halt execution.
|
|
25
|
+
//
|
|
26
|
+
// If a user needs to use dynamic assertion messages then they should provide a custom foreign call handler.
|
|
27
|
+
return [];
|
|
28
|
+
}
|
|
22
29
|
throw Error(`Unexpected oracle during execution: ${name}(${args.join(', ')})`);
|
|
23
30
|
};
|
|
24
31
|
// Generates the witnesses needed to feed into the chosen proving system
|
|
@@ -16,6 +16,13 @@ const defaultForeignCallHandler = async (name, args) => {
|
|
|
16
16
|
// If a user needs to print values then they should provide a custom foreign call handler.
|
|
17
17
|
return [];
|
|
18
18
|
}
|
|
19
|
+
else if (name == 'assert_message') {
|
|
20
|
+
// By default we do not do anything for `assert_message` foreign calls due to a need for formatting,
|
|
21
|
+
// however we provide an empty response in order to not halt execution.
|
|
22
|
+
//
|
|
23
|
+
// If a user needs to use dynamic assertion messages then they should provide a custom foreign call handler.
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
19
26
|
throw Error(`Unexpected oracle during execution: ${name}(${args.join(', ')})`);
|
|
20
27
|
};
|
|
21
28
|
// Generates the witnesses needed to feed into the chosen proving system
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"contributors": [
|
|
4
4
|
"The Noir Team <team@noir-lang.org>"
|
|
5
5
|
],
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.24.0",
|
|
7
7
|
"packageManager": "yarn@3.5.1",
|
|
8
8
|
"license": "(MIT OR Apache-2.0)",
|
|
9
9
|
"type": "module",
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
"url": "https://github.com/noir-lang/noir/issues"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@noir-lang/acvm_js": "0.
|
|
21
|
-
"@noir-lang/noirc_abi": "0.
|
|
22
|
-
"@noir-lang/types": "0.
|
|
20
|
+
"@noir-lang/acvm_js": "0.40.0",
|
|
21
|
+
"@noir-lang/noirc_abi": "0.24.0",
|
|
22
|
+
"@noir-lang/types": "0.24.0"
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
25
|
"lib",
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"scripts": {
|
|
38
38
|
"dev": "tsc-multi --watch",
|
|
39
39
|
"build": "tsc-multi",
|
|
40
|
-
"test": "yarn test:node:esm && yarn test:node:cjs",
|
|
40
|
+
"test": "yarn test:compile_program && yarn test:node:esm && yarn test:node:cjs",
|
|
41
|
+
"test:compile_program": "./scripts/compile_test_programs.sh",
|
|
41
42
|
"test:node:esm": "mocha --timeout 25000 --exit --config ./.mocharc.json",
|
|
42
43
|
"test:node:cjs": "mocha --timeout 25000 --exit --config ./.mocharc.cjs.json",
|
|
43
44
|
"prettier": "prettier 'src/**/*.ts'",
|
|
@@ -53,7 +54,7 @@
|
|
|
53
54
|
"@types/node": "^20.6.2",
|
|
54
55
|
"@types/prettier": "^3",
|
|
55
56
|
"chai": "^4.3.8",
|
|
56
|
-
"eslint": "^8.
|
|
57
|
+
"eslint": "^8.56.0",
|
|
57
58
|
"eslint-plugin-prettier": "^5.0.0",
|
|
58
59
|
"mocha": "^10.2.0",
|
|
59
60
|
"prettier": "3.0.3",
|