Skip to content

Commit

Permalink
Merge pull request #30 from hypersign-protocol/nullifier
Browse files Browse the repository at this point in the history
feat: new zkKeys
  • Loading branch information
Pratap2018 authored Nov 5, 2024
2 parents a02278d + 4ce5870 commit f3fa3f4
Show file tree
Hide file tree
Showing 12 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@digitalbazaar/x25519-key-agreement-key-2020": "^2.1.0",
"@facephi/selphi-widget-web": "./lib/facephi-selphi-widget-web-5.35.0.tgz",
"@facephi/selphid-widget-web": "./lib/facephi-selphid-widget-web-4.21.0.tgz",
"@hypersign-protocol/hypersign-kyc-chains-metadata": "github:hypersign-protocol/hypersign-kyc-chains-metadata#zk-proof-new-contract",
"@hypersign-protocol/hypersign-kyc-chains-metadata": "github:hypersign-protocol/hypersign-kyc-chains-metadata",
"@hypersign-protocol/hypersign-vault-client": "github:hypersign-protocol/hypersign-edv-client#deleteByDocumentId",
"@iden3/binfileutils": "^0.0.12",
"@iden3/js-crypto": "^1.1.0",
Expand Down
Binary file modified public/circuits/zkProofOfAge/zkProofOfAge_circuit.wasm
Binary file not shown.
Binary file modified public/circuits/zkProofOfAge/zkProofOfAge_final.zkey
Binary file not shown.
Binary file not shown.
Binary file removed public/circuits/zkProofOfDOB/zkProofOfDOB_final.zkey
Binary file not shown.
Binary file modified public/circuits/zkProofOfKYC/zkProofOfKYC_circuit.wasm
Binary file not shown.
Binary file modified public/circuits/zkProofOfKYC/zkProofOfKYC_final.zkey
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
22 changes: 16 additions & 6 deletions src/components/e-kyc/ZKProofs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
</template>

<script>
import { v4 as uuidv4 } from 'uuid';
import { mapMutations, mapActions, mapGetters, mapState } from "vuex";
import { smartContractExecuteRPC } from '@hypersign-protocol/hypersign-kyc-chains-metadata/cosmos/contract/execute'
import { smartContractQueryRPC } from '@hypersign-protocol/hypersign-kyc-chains-metadata/cosmos/contract/query'
Expand Down Expand Up @@ -605,8 +606,8 @@ export default {
// eslint-disable-next-line no-undef
const currentTimestamp = BigInt(new Date().valueOf())
const nullifier = 1235235n
// eslint-disable-next-line no-undef
const nullifier = BigInt('0x'+Buffer.from(uuidv4(),'utf-8').toString('hex'))
const circomProofs = []
// Generate Circuit compatible proofs and prepate the circuit input
Expand Down Expand Up @@ -722,7 +723,7 @@ export default {
}
);
if (publicSignals[0] !== "1") {
if (publicSignals[1] !== "1") {
throw new Error("Age criteria " + parseInt((new Date() - new Date(parseInt(dateOfBirth))) / (1000 * 60 * 60 * 24 * 30 * 12)) + " > " + ageCriteria + " not fulfilled")
}
return {
Expand Down Expand Up @@ -944,10 +945,13 @@ export default {
// eslint-disable-next-line no-undef
const nullifier = BigInt('0x'+Buffer.from(uuidv4(),'utf-8').toString('hex'))
const {
proof, publicSignals, uncompressed_proof
} = await utils.groth16FullProve({
nullifier,
issuer_pk, issuer_signature,
credentialRoot,
issuerId,
Expand Down Expand Up @@ -1167,11 +1171,13 @@ export default {
})
}
// eslint-disable-next-line no-undef
const nullifier = BigInt('0x'+Buffer.from(uuidv4(),'utf-8').toString('hex'))
const {
proof, publicSignals, uncompressed_proof
} = await utils.groth16FullProve({
nullifier,
issuer_pk, issuer_signature,
credentialRoot,
issuerId,
Expand Down Expand Up @@ -1566,6 +1572,8 @@ export default {
issuerSignature.S
]
const enabled = 1n
// eslint-disable-next-line no-undef
const nullifier = BigInt('0x'+Buffer.from(uuidv4(),'utf-8').toString('hex'))
let issuer_siblings;
let issuer_oldKey;
Expand Down Expand Up @@ -1659,12 +1667,14 @@ export default {
type_siblings,
type_oldKey, type_oldValue,
type_isOld0,
type_key, type_fnc
type_key, type_fnc,
nullifier
});
const {
proof, publicSignals, uncompressed_proof
} = await utils.groth16FullProve({
nullifier,
issuer_pk, issuer_signature,
credentialRoot,
issuerId,
Expand Down Expand Up @@ -1800,7 +1810,7 @@ export default {
const chainConfig = this.getChainConfig
const chainCoinDenom = chainConfig["feeCurrencies"][0]["coinMinimalDenom"]
const gasPriceAvg = chainConfig["gasPriceStep"]["average"]
const fee = calculateFee(650_000, (gasPriceAvg + chainCoinDenom).toString())
const fee = calculateFee(700_000, (gasPriceAvg + chainCoinDenom).toString())
console.log(smartContractMsg);
// throw new Error("hello")
Expand Down

0 comments on commit f3fa3f4

Please sign in to comment.