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

@@ -12,7 +12,6 @@
},
"dependencies": {
"@amplitude/analytics-react-native": "^1.4.7",
"@ashpect/smt": "https://github.com/ashpect/smt#main",
"@babel/plugin-transform-private-methods": "^7.23.3",
"@ethersproject/shims": "^5.7.0",
"@react-native-async-storage/async-storage": "^1.23.1",
@@ -26,7 +25,9 @@
"@tamagui/types": "1.105.0",
"@types/msgpack-lite": "^0.1.11",
"@types/pako": "^2.0.3",
"@zk-kit/imt": "https://gitpkg.now.sh/0xturboblitz/zk-kit/packages/imt?6d417675",
"@openpassport/zk-kit-imt": "^0.0.1",
"@openpassport/zk-kit-lean-imt": "^0.0.1",
"@openpassport/zk-kit-smt": "^0.0.1",
"axios": "^1.6.3",
"buffer": "^6.0.3",
"burnt": "^0.12.2",

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);