@unirep/circuits
Version:
Client library for circuit related functions which are used in UniRep protocol.
67 lines (65 loc) • 2.23 kB
TypeScript
import { Prover } from './type';
import { Groth16Proof } from 'snarkjs';
import { BaseProof } from './BaseProof';
/**
* A class representing a [signup proof](https://developer.unirep.io/docs/circuits-api/classes/src.SignupProof). Each of the following properties are public signals for the proof.
*/
export declare class SignupProof extends BaseProof {
/**
* The index of the data in the public signals
*/
readonly idx: {
identityCommitment: number;
stateTreeLeaf: number;
control: number;
};
/**
* The [identity commitment](https://semaphore.pse.dev/docs/glossary#identity-commitment) for the user signing up.
*/
identityCommitment: bigint;
/**
* The new state tree leaf for the user. This leaf will contain values for [data](https://developer.unirep.io/docs/protocol/data.md).
*/
stateTreeLeaf: 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 attester id for the proof.
*/
attesterId: bigint;
/**
* The epoch the proof was made within.
*/
epoch: bigint;
/**
* The chain id for the proof.
*/
chainId: bigint;
/**
* @param publicSignals The public signals of the user sign up 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 { SignupProof } from '@unirep/circuits'
* const data = new SignupProof(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
* SignupProof.buildControl({
* epoch,
* attesterId,
* chainId
* })
* ```
*/
static buildControl({ attesterId, epoch, chainId }: any): bigint;
}