Skip to content

Commit

Permalink
Add explicit check for fields in Exp.
Browse files Browse the repository at this point in the history
  • Loading branch information
armfazh committed Nov 1, 2022
1 parent 4afcd74 commit 7a8a32d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 155 deletions.
142 changes: 0 additions & 142 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"license": "Apache-2.0",
"private": false,
"devDependencies": {
"@peculiar/webcrypto": "1.3.3",
"@types/benchmark": "2.1.2",
"@typescript-eslint/eslint-plugin": "5.42.0",
"@typescript-eslint/parser": "5.42.0",
Expand Down
21 changes: 9 additions & 12 deletions src/exp/exp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,11 @@ export async function verifyExp(
//const { commitment, response } = pi[i]

if (challengeBits[i as number]) {
const resp = {
alpha: pi[i as number].alpha!,
beta1: pi[i as number].beta1!,
beta2: pi[i as number].beta2!,
beta3: pi[i as number].beta3!,
},
const { alpha, beta1, beta2, beta3 } = pi[i as number]
if (!(alpha && beta1 && beta2 && beta3)) {
throw new Error('params not found')
}
const resp = { alpha, beta1, beta2, beta3 },
T = paramsNIST.g.mul(resp.alpha),
relA = new Relation(paramsNIST.c)
relA.insertM(
Expand Down Expand Up @@ -298,13 +297,11 @@ export async function verifyExp(
relTx.drain(multiW)
relTy.drain(multiW)
} else {
const resp = {
z: pi[i as number].z,
z2: pi[i as number].z2,
proof: pi[i as number].proof,
r1: pi[i as number].r1,
r2: pi[i as number].r2,
const { z, z2, proof, r1, r2 } = pi[i as number]
if (!(z && z2 && proof && r1 && r2)) {
throw new Error('params not found')
}
const resp = { z, z2, proof, r1, r2 }
let T1 = paramsNIST.g.mul(resp.z)
const relA = new Relation(paramsNIST.c)
relA.insertM(
Expand Down

0 comments on commit 7a8a32d

Please sign in to comment.