fix ofac tests

This commit is contained in:
0xturboblitz
2024-09-14 15:04:37 +09:00
parent 9d33ae84a3
commit 12d42800bc
3 changed files with 8 additions and 6 deletions

View File

@@ -18,9 +18,9 @@ import { genMockPassportData } from '../../../common/src/utils/genMockPassportDa
let circuit: any;
// Mock passport added in ofac list to test circuits
const passportData = genMockPassportData('rsa_sha256', 'FRA', '000101', '300101');
const passportData = genMockPassportData('rsa_sha256', 'FRA', '040211', '300101');
// Mock passport not added in ofac list to test circuits
const passportData2 = genMockPassportData('rsa_sha256', 'FRA', '000101', '300101');
const passportData2 = genMockPassportData('rsa_sha256', 'FRA', '000102', '300101', "24HB81833", "CLAQUE");
// Calculating common validity inputs for all 3 circuits
function getPassportInputs(passportData: PassportData) {
@@ -31,7 +31,7 @@ function getPassportInputs(passportData: PassportData) {
const bitmap = Array(90).fill('1');
const scope = '@coboyApp';
const pubkey_leaf = getLeaf(passportData).toString();
const pubkey_leaf = getLeaf(passportData);
const mrz_bytes = packBytes(formatMrz(passportData.mrz));
const commitment = poseidon6([
secret,

View File

@@ -18,7 +18,7 @@ A ballpark number of 6917 individuals (at the time of writing this document) ent
- For individuals, we parse:
- full name (first name, last name), dob(day, month, year) in names.json
- passports and passport issuing country in passport.json
- The jsons are stored at ofacdata/inputes to be used by SMT's.
- The jsons are stored at ofacdata/inputs to be used by SMT's.
## Data Usage
These jsons are later used to create sparse merkle trees for non-membership proofs. We provide 3 levels of proofs.

View File

@@ -32,13 +32,15 @@ export function genMockPassportData(
signatureType: 'rsa_sha1' | 'rsa_sha256' | 'rsapss_sha256' | 'ecdsa_sha256' | 'ecdsa_sha1' | 'ecdsa_sha384',
nationality: keyof typeof countryCodes,
birthDate: string,
expiryDate: string
expiryDate: string,
passportNumber: string = "24HB81832",
lastName: string = "DUPONT"
): PassportData {
if (birthDate.length !== 6 || expiryDate.length !== 6) {
throw new Error('birthdate and expiry date have to be in the "YYMMDD" format');
}
const mrz = `P<${nationality}DUPONT<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<24HB818324${nationality}${birthDate}1M${expiryDate}5<<<<<<<<<<<<<<02`;
const mrz = `P<${nationality}${lastName}<<ALPHONSE<HUGUES<ALBERT<<<<<<<<<${passportNumber}4${nationality}${birthDate}1M${expiryDate}5<<<<<<<<<<<<<<02`;
let privateKeyPem: string;
let dsc: string;