import @openpassport/zk-kit in other repos

This commit is contained in:
turnoffthiscomputer
2024-10-27 14:17:35 +01:00
parent 648969f668
commit 75dd587456
10 changed files with 23 additions and 22 deletions

View File

@@ -5,9 +5,9 @@ import { circuitToSelectorMode, DEFAULT_MAJORITY, getCountryCode, PASSPORT_ATTES
import { revealBitmapFromAttributes } from '../../../common/src/utils/revealBitmap';
import useUserStore from '../stores/userStore';
import namejson from '../../../common/ofacdata/outputs/nameSMT.json';
import { SMT } from '@ashpect/smt';
import { SMT } from '@openpassport/zk-kit-smt';
import { poseidon2 } from 'poseidon-lite';
import { LeanIMT } from '@zk-kit/imt';
import { LeanIMT } from '@openpassport/zk-kit-lean-imt';
import { fetchTreeFromUrl } from '../../../common/src/utils/pubkeyTree';
export const generateCircuitInputsInApp = async (

View File

@@ -1,6 +1,6 @@
import axios from "axios";
import { COMMITMENT_TREE_TRACKER_URL, PASSPORT_ATTESTATION_ID } from "../../../common/src/constants/constants";
import { LeanIMT } from "@zk-kit/imt";
import { LeanIMT, LeanIMTHashFunction } from "@openpassport/zk-kit-lean-imt";
import { poseidon2, poseidon6 } from "poseidon-lite";
import { PassportData } from "../../../common/src/utils/types";
import { generateCommitment, getLeaf } from "../../../common/src/utils/pubkeyTree";
@@ -20,12 +20,8 @@ export async function isCommitmentRegistered(secret: string, passportData: Passp
}
console.log('response.data:', response.data);
const imt = new LeanIMT(
(a: bigint, b: bigint) => poseidon2([a, b]),
[]
);
imt.import(response.data);
const hashFunction: LeanIMTHashFunction = (a: bigint, b: bigint) => poseidon2([a, b]);
const imt = LeanIMT.import(hashFunction, response.data);
const pubkey_leaf = getLeaf(passportData.dsc);