@unirep/circuits
Version:
Client library for circuit related functions which are used in UniRep protocol.
92 lines (91 loc) • 2.96 kB
TypeScript
import { Prover, EpochKeyControl } from './type';
import { Groth16Proof } from 'snarkjs';
import { BaseProof } from './BaseProof';
/**
* A class representing a [scope nullifier proof](https://developer.unirep.io/docs/circuits-api/classes/src.ScopeNullifierProof). Each of the following properties are public signals for the proof.
*/
export declare class ScopeNullifierProof extends BaseProof {
/**
* The index of the data in the public signals
*/
readonly idx: {
epochKey: number;
stateTreeRoot: number;
control: number;
nullifier: number;
sigData: number;
scope: number;
};
/**
* The epoch key being proved.
*/
epochKey: bigint;
/**
* The state tree root the proof was made against.
* This should be verified to exist onchain when verifying the proof.
*/
stateTreeRoot: bigint;
/**
* The control field used for the proof. This field contains many signals binary encoded into a single 253 bit value. This value is automatically decoded into the other properties on this class.
*/
control: bigint;
/**
* The nullifier for the proof, which is computed by `hash(scope, identitySecret)` in circuit
*/
nullifier: bigint;
/**
* The 32 byte data endorsed by the proof.
*/
sigData: bigint;
/**
* The scope for the proof, which indicates the user will take action on which event/scope.
*/
scope: bigint;
/**
* The nonce used to generate the epoch key. To determine if this value is set check that `revealNonce == 1`.
*/
nonce: bigint;
/**
* The epoch the proof was made within.
*/
epoch: bigint;
/**
* The attester id for the proof.
*/
attesterId: bigint;
/**
* A number indicating whether the epoch key nonce was revealed in the proof. This value will be either `1` or `0`.
*/
revealNonce: bigint;
/**
* The chain id for the proof.
*/
chainId: bigint;
/**
* @param publicSignals The public signals of the prevent double action proof that can be verified by the prover
* @param proof The proof that can be verified by the prover
* @param prover The prover that can verify the public signals and the proof
* @example
* ```ts
* import { ScopeNullifierProof } from '@unirep/circuits'
* const data = new ScopeNullifierProof(publicSignals, proof)
* ```
*/
constructor(publicSignals: (bigint | string)[], proof: Groth16Proof, prover?: Prover);
/**
* Pack several variables into one `bigint` variable.
* @param config The variables that will be packed.
* @returns The control
* @example
* ```ts
* ScopeNullifierProof.buildControl({
* epoch,
* nonce,
* attesterId,
* revealNonce,
* chainId
* })
* ```
*/
static buildControl(config: EpochKeyControl): bigint;
}