Documentation ¶
Overview ¶
prover package abstracts the logic and types of go-rapidsnark (https://github.com/iden3/go-rapidsnark) to support basic operations for the rest of vocdoni-node project. It returns custom errors with some more information, trying to clarify the original workflow and standardizing the inputs/outputs types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrPublicSignalFormat = fmt.Errorf("invalid proof public signals format") ErrParsingWeight = fmt.Errorf("error parsing proof weight string to big.Int") ErrParsingNullifier = fmt.Errorf("error parsing proof nullifier string to big.Int") ErrParsingWitness = fmt.Errorf("error parsing provided circuit inputs, it must be a not empty marshalled bytes of a json") ErrInitWitnessCalc = fmt.Errorf("error parsing circuit wasm during calculator instance") ErrWitnessCalc = fmt.Errorf("error during witness calculation") ErrProofGen = fmt.Errorf("error during zksnark proof generation") ErrParseProofData = fmt.Errorf("error parsing the proof provided, it must be a valid json, check https://github.com/iden3/go-rapidsnark/blob/73d5784d2aa791dd6646142b0017dbef97240f57/types/proof.go") ErrParsePubSignals = fmt.Errorf("error during zksnark public signals proof generation, it must be a json with array of strings") ErrEncodingProof = fmt.Errorf("error encoding prove result into a proof struct") ErrDecodingProof = fmt.Errorf("error decoding prove as []byte") ErrVerifyProof = fmt.Errorf("error during zksnark verification") )
TODO: Refactor the error handling to include the trace of the original error into the error returned.
Functions ¶
This section is empty.
Types ¶
type Proof ¶
Proof struct wraps the ProofData struct and its associated public signals. Contains all the required information to perform a proof verification.
func ParseProof ¶
ParseProof encodes the provided proof data and public signals into a Proof struct, performing an unmarshal operation over them. Returns an error if something is wrong.
func Prove ¶
Prove generates a verifiable proof of the execution of the circuit for the input signals using the proving key provided. All the arguments are slices of bytes with the data read from the generated files by Circom (wasm circuit) and SnarkJS (proving zkey). It returns the verifiable proof of the execution with the public signals associated or an error if something fails.
func (*Proof) Bytes ¶
Bytes returns the current Proof struct parameters Data and PubSignals as []byte. It returns an error if something fails.
func (*Proof) Nullifier ¶
Nullifier decodes the vote nullifier value from the current proof public signals and return it as a big.Int