User should also specify the attesterId and epochKeyNonce to generate an output epoch key.
constattesterID=awaitcontract.attesters(attester.address)constepkNonce=0constrep=userState.getRepByAttester(BigInt(attesterId))constminRep=Number(rep.posRep) -Number(rep.negRep)constproveGraffiti=0// 0 then it will not prove the pre-imageconstnonceList=0// 0 or [-1,..,-1] with length 'maxReputationBudget' means the proof will not generate reputation nullifiers.constproof=awaituserState.genProveReputationProof( attesterId, epkNonce, minRep, proveGraffiti, graffitiPreImage, nonceList)
constisGSTRootExisted=awaitunirepState.GSTRootExists(proof.globalStateTree,proof.epoch)console.log(isGSTRootExisted) // false then the proof will be invalid
Verify reputation nullifiers.
constrepNullifiers=proof.repNullifiers.map((i) =>i.toString())for (constnullifierof repNullifiers) {if (awaitunirepState.nullifierExist(nullifier)) {returnfalse// then the proof will be invalid }}