diff --git a/app/src/utils/prover.ts b/app/src/utils/prover.ts index cd506188c..ee0f03475 100644 --- a/app/src/utils/prover.ts +++ b/app/src/utils/prover.ts @@ -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); } diff --git a/common/src/utils/generateInputs.ts b/common/src/utils/generateInputs.ts index ce7afce7a..939c262e5 100644 --- a/common/src/utils/generateInputs.ts +++ b/common/src/utils/generateInputs.ts @@ -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