Skip to content

Commit

Permalink
checked the flow writtein in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
motemotech committed Oct 10, 2024
1 parent 3077e9a commit ac6e8fb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 22 deletions.
23 changes: 4 additions & 19 deletions contracts/test/integrationTest/OneTimeVerification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,35 +379,20 @@ describe("Test one time verification flow", async function () {
user_identifier,
user_identifier_type
);
const proof_prove_result = await groth16.fullProve(
const proof_prove = await groth16.fullProve(
prove,
prove_circuits["prove_rsa_65537_sha256"].wasm,
prove_circuits["prove_rsa_65537_sha256"].zkey
);

const jsonString = JSON.stringify(proof_prove_result);
fs.writeFileSync("./test/integrationTest/proof_prove_result.json", jsonString);

const proof_prove_result_json = fs.readFileSync("./test/integrationTest/proof_prove_result.json", "utf-8");
const proof_prove_result_obj = JSON.parse(proof_prove_result_json);
console.log(proof_prove_result_obj.proof);
console.log(proof_prove_result_obj.publicSignals);

const proof_prove = proof_prove_result_obj.proof;
const publicSignals_prove = proof_prove_result.publicSignals;
console.log("proof_prove: ", proof_prove);
console.log("publicSignals_prove: ", publicSignals_prove);

const vKey_prove = JSON.parse(fs.readFileSync(prove_circuits["prove_rsa_65537_sha256"].vkey) as unknown as string);
const verified_prove = await groth16.verify(
vKey_prove,
publicSignals_prove,
proof_prove
proof_prove.publicSignals,
proof_prove.proof
)
// assert(verified_csca == true, 'Should verify')
console.log("verified_prove: ", verified_prove);
const rawCallData_prove = await groth16.exportSolidityCallData(proof_prove, publicSignals_prove);
console.log(rawCallData_prove);
const rawCallData_prove = await groth16.exportSolidityCallData(proof_prove.proof, proof_prove.publicSignals);
let prove_proof = JSON.parse("[" + rawCallData_prove + "]");
fs.writeFileSync("./test/integrationTest/proof_prove.json", JSON.stringify(prove_proof));
return prove_proof;
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/integrationTest/proof_dsc.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[["0x0120659c66b80b91feb00b1fd7520dc308ffb677d5699f04daa3e5f0559a0137","0x0a34201a6ef724848bb229bbcdaeca648d94912e668816fc8d098eb7b3a1eda9"],[["0x100052a855324460908535ac28ea239b0f418bdb7cdd9701371e8e901bd1e65b","0x1a833379bfc97848c03aad346fdc78d2306556e95f51262831c2a4b42d924214"],["0x2d1113d8271fb870771e0d524e07efba4f1a114ed5f2900dd72f36ab590e9d40","0x2d633aa0206e307fa08c3b7ae11896d455694210b563febb0243f76e0cd875b6"]],["0x2ffd821b061473b90b6798fd73121f625019d5b8c9a34a01514ab6a24eedc856","0x27e0dd2ed262abacd03468f8f04a010b65a4b55fea0a1084fbd28dc96f3839dd"],["0x0030186e34532bd2527db97cb8452c23620434945a2a41faf060e74a5ca9aceb"]]
[["0x24ba9d649f5a06f94d80bcba2aecd0b884bfcb0158901d515274c05b844efeaa","0x03f065fafc622d89e0dde18bd2a8cb2a09dbbe3c92b3843c9304e3e46bca60c3"],[["0x0a925f4feeb60ccd6f0ccb89ae1fe8302fcae46fbd0f0444acac67ad1135179c","0x211b5cc5e162b0c28f741157ac2009ceb0e0319334c7fcc1a8126635276350f1"],["0x2a071d0a53b804fb7225c369d4204a724076e783d9b41e4ebefacf6f32dbf618","0x0b4ab3d3ecba9dcc49792680127c48ed7f4ab02cf0939b19072bc92d96c7323b"]],["0x238d17933d790f5c734e29c315b1abe58e0aac32a3dedad40c0b251e1dcc949b","0x30225ca0dcafbb405edbf7e05483193341c7c12640410a84ec960a2b0f6afdfb"],["0x0030186e34532bd2527db97cb8452c23620434945a2a41faf060e74a5ca9aceb"]]
2 changes: 1 addition & 1 deletion contracts/test/integrationTest/proof_prove.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[["0x088e2018ce1ddf45dc6a2959328a70b96cb7ccdd82a02451b81cf104e4ca412d","0x22c753b61eb15d9abcf0250ca00d3be8e1b2148c2142d4775758d1157f7260a0"],[["0x1b8bd9cd095850954ff12801d5855d3232775f271b744393c56744f814199f06","0x2d7907e6841b82b4c53a1f127551782ddb260b37bbfe24f91c2f138aae6bf0a6"],["0x1d5560b6c4537f2861b1167cd9c21286098ec0a641c76b421dbe7919e0d22552","0x28e247d9ade45264b22a54c5707fdf8637d48ecfd39f9310998cbd2172274fd6"]],["0x01f27b78d40461239b648f950ce8c569d861038f84c81e8dd432fed135de15a2","0x1e8ac6044a9e9f9cb37744c7d08c5c61bd6228fd6e32209adb5fa898bf326f1f"],["0x01e6e73285d61a967d0c3edd701303b575b66e589bba3b3c11d2457bd131b6c9","0x00413c534555484755483c45534e4f48504c413c3c544e4f5055444152463c50","0x003331303439415246343433323138414135313c3c3c3c3c3c3c3c545245424c","0x00000000000032303c3c3c3c3c3c3c3c3c3c3c3c3c3c353133303130344d3131","0x0000000000000000000000000000000000000000000000000000000000000032","0x0000000000000000000000000000000000000000000000000000000000000030","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0041414141414141414141414141414141414141414141414141414141414141","0x0000000000004141414141414141414141414141414141414141414141414141","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0030186e34532bd2527db97cb8452c23620434945a2a41faf060e74a5ca9aceb","0x0000000000000000000000000000000000000000000000000000000000000002","0x0000000000000000000000000000000000000000000000000000000000000004","0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000070997970c51812dc3a010c7d01b50e0d17dc79c8","0x0000000000000000000000000000000000000000000000000000000000000419"]]
[["0x00e15e942224cabd624ce1a1950b21c6a7542f971b0b517e4ddbe798eb413276","0x020c43e89f6f32d18240f412ce6ff23c91f73f2ef1add62e3287de47cc9c1934"],[["0x1665c66a2fb763ee20439ac7b220ee6d6ad6665f177f235870a51fd027556fe1","0x2244b0c039ff2175fddfef1d3e5148ad111d18979f023ba2ece28bf597fa593e"],["0x18bc5c9767ee3c146e8d0e38ffb2960d5c4e57ed92a95737bad979f14cdff323","0x08b3de25aa44d2cefd78b46ac89098a0d4f7cc38791a3c849a97a38e9725e9ae"]],["0x166ba6cb8f85bc3d95d56996dd3e5e047324ccfdf041a58a7fe39f147d758bf2","0x1a02f81f700fc1594fcae70e5e46f73afea1a97512eae74753e20600e72b9d86"],["0x15338daadd18ce0c3bf1e04b835f33aed04f8d7f113e708f73056cb628414baa","0x00413c534555484755483c45534e4f48504c413c3c544e4f5055444152463c50","0x003331303439415246343433323138414135313c3c3c3c3c3c3c3c545245424c","0x00000000000032303c3c3c3c3c3c3c3c3c3c3c3c3c3c353133303130344d3131","0x0000000000000000000000000000000000000000000000000000000000000032","0x0000000000000000000000000000000000000000000000000000000000000030","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0041414141414141414141414141414141414141414141414141414141414141","0x0000000000004141414141414141414141414141414141414141414141414141","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000000","0x0030186e34532bd2527db97cb8452c23620434945a2a41faf060e74a5ca9aceb","0x0000000000000000000000000000000000000000000000000000000000000002","0x0000000000000000000000000000000000000000000000000000000000000004","0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000000","0x00000000000000000000000070997970c51812dc3a010c7d01b50e0d17dc79c8","0x0000000000000000000000000000000000000000000000000000000000000419"]]
2 changes: 1 addition & 1 deletion contracts/test/integrationTest/smt.json

Large diffs are not rendered by default.

0 comments on commit ac6e8fb

Please sign in to comment.