Merge branch 'dev' into black-ui

This commit is contained in:
turnoffthiscomputer
2024-04-05 12:11:13 +02:00
committed by GitHub
2 changed files with 8 additions and 4 deletions

View File

@@ -61,15 +61,14 @@ export const prove = async ({
await generateProof(inputs, setProofTime, setProof, setGeneratingProof, setStep, path);
const end = Date.now();
console.log('Total proof time from frontend:', end - start);
} catch (error) {
} catch (error: any) {
console.error(error);
toast.show('Error', {
message: "Pubkey not found in the registry",
message: error.message,
customData: {
type: "error",
},
})
setStep(Steps.NFC_SCAN_COMPLETED);
setGeneratingProof(false);
}

View File

@@ -52,12 +52,17 @@ export function generateCircuitInputs(
const index = tree.indexOf(leaf) // this index is not the index in public_keys_parsed.json, but the index in the tree
console.log(`Index of pubkey in the registry: ${index}`)
if (index === -1) {
throw new Error("Pubkey not found in the registry");
throw new Error("Your public key was not found in the registry");
}
const proof = tree.createProof(index)
console.log("verifyProof", tree.verifyProof(proof))
if (passportData.dataGroupHashes.length > MAX_DATAHASHES_LEN) {
console.log(`Data hashes too long. Max length is ${MAX_DATAHASHES_LEN} bytes.`);
throw new Error(`This number of datagroups is currently unsupported. Please contact us so we add support!`);
}
const [messagePadded, messagePaddedLen] = sha256Pad(
new Uint8Array(passportData.dataGroupHashes),
MAX_DATAHASHES_LEN