Skip to content

Commit d0f735f

Browse files
test: merged ofac constrain
1 parent 6fdf6df commit d0f735f

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

circuits/tests/disclose/vc_and_disclose_aadhaar.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ const privateKeyPem = fs.readFileSync(
2525

2626
// Create SMTs at module level
2727
const nameAndDob_smt = new SMT(poseidon2, true);
28-
nameAndDob_smt.import(nameAndDobAadhaarjson);
28+
nameAndDob_smt.import(nameAndDobAadhaarjson as any);
2929

3030
const nameAndYob_smt = new SMT(poseidon2, true);
31-
nameAndYob_smt.import(nameAndYobAadhaarjson);
31+
nameAndYob_smt.import(nameAndYobAadhaarjson as any);
3232

3333
// Create Merkle tree at module level
3434
const tree: any = new LeanIMT((a, b) => poseidon2([a, b]), []);
@@ -232,8 +232,8 @@ describe(' VC and Disclose Aadhaar Circuit Tests', function () {
232232
}
233233

234234
// Verify OFAC checks show person is in OFAC list
235-
assert(ofacNameYobCheck === 1, 'OFAC Name YOB should be 0 (in OFAC list)');
236-
assert(ofacNameDobCheck === 1, 'OFAC Name DOB should be 0 (in OFAC list)');
235+
assert(ofacNameYobCheck === 0, 'OFAC Name YOB should be 0 (in OFAC list)');
236+
assert(ofacNameDobCheck === 0, 'OFAC Name DOB should be 0 (in OFAC list)');
237237
assert(minimumAge.toString() === '0', 'Minimum Age should be 0');
238238
});
239239
it('ofac_check_result should be 0 if exists in ofac_name_dob_reverse_smt and ofac_name_yob_reverse_smt', async function () {
@@ -286,8 +286,8 @@ describe(' VC and Disclose Aadhaar Circuit Tests', function () {
286286
}
287287

288288
// Verify OFAC checks show person is in OFAC list
289-
assert(ofacNameYobCheck === 1, 'OFAC Name YOB should be 0 (in OFAC list)');
290-
assert(ofacNameDobCheck === 1, 'OFAC Name DOB should be 0 (in OFAC list)');
289+
assert(ofacNameYobCheck === 0, 'OFAC Name YOB should be 0 (in OFAC list)');
290+
assert(ofacNameDobCheck === 0, 'OFAC Name DOB should be 0 (in OFAC list)');
291291
assert(minimumAge.toString() === '0', 'Minimum Age should be 0');
292292
});
293293
});

common/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -665,6 +665,7 @@
665665
"elliptic": "^6.5.5",
666666
"ethers": "^6.14.4",
667667
"fs": "^0.0.1-security",
668+
"hash.js": "^1.1.7",
668669
"i18n-iso-countries": "^7.13.0",
669670
"js-sha1": "^0.7.0",
670671
"js-sha256": "^0.11.0",

common/src/utils/attest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,11 @@ export const verifyAttestation = async (attestation: Array<number>) => {
329329
const cert = derToPem(attestationDoc.certificate);
330330
const isPCR0Set = await checkPCR0Mapping(attestation);
331331
console.log('isPCR0Set', isPCR0Set);
332+
//@ts-ignore
332333
if (!isPCR0Set && !__DEV__) {
333334
throw new Error('Invalid image hash');
334335
}
336+
//@ts-ignore
335337
if (__DEV__ && !isPCR0Set) {
336338
console.warn('\x1b[31m%s\x1b[0m', '⚠️ WARNING: PCR0 CHECK SKIPPED ⚠️');
337339
}

yarn.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4959,6 +4959,7 @@ __metadata:
49594959
eslint-plugin-sort-exports: "npm:^0.9.1"
49604960
ethers: "npm:^6.14.4"
49614961
fs: "npm:^0.0.1-security"
4962+
hash.js: "npm:^1.1.7"
49624963
i18n-iso-countries: "npm:^7.13.0"
49634964
js-sha1: "npm:^0.7.0"
49644965
js-sha256: "npm:^0.11.0"

0 commit comments

Comments
 (0)