Skip to main content
Version: v2.0_alpha

Minimal Anti Collusion Infrastructure (MACI) v2.0.0-alpha / PrivKey

Class: PrivKey

Notice

PrivKey is a TS Class representing a MACI PrivateKey which is a seed to be used to generate a public key (point on the curve) This is a MACI private key, which is not to be confused with an Ethereum private key. A serialized MACI private key is prefixed by 'macisk.'

Constructors

new PrivKey()

new PrivKey(rawPrivKey): PrivKey

Generate a new Private key object

Parameters

rawPrivKey: SnarkBigNumber

the raw private key (a bigint)

Returns

PrivKey

Defined in

privateKey.ts:21

Properties

rawPrivKey

rawPrivKey: SnarkBigNumber

Defined in

privateKey.ts:15

Methods

asCircuitInputs()

asCircuitInputs(): string

Return this Private key as a circuit input

Returns

string

the Private key as a circuit input

Defined in

privateKey.ts:35


copy()

copy(): PrivKey

Create a copy of this Private key

Returns

PrivKey

a copy of the Private key

Defined in

privateKey.ts:29


serialize()

serialize(): string

Serialize the private key

Returns

string

the serialized private key

Defined in

privateKey.ts:41


toJSON()

toJSON(): IJsonPrivateKey

Serialize this object

Returns

IJsonPrivateKey

Defined in

privateKey.ts:75


deserialize()

static deserialize(s): PrivKey

Deserialize the private key

Parameters

s: string

the serialized private key

Returns

PrivKey

the deserialized private key

Defined in

privateKey.ts:55


fromJSON()

static fromJSON(json): PrivKey

Deserialize this object from a JSON object

Parameters

json: IJsonPrivateKey

the json object

Returns

PrivKey

the deserialized object as a PrivKey instance

Defined in

privateKey.ts:86


isValidSerializedPrivKey()

static isValidSerializedPrivKey(s): boolean

Check if the serialized private key is valid

Parameters

s: string

the serialized private key

Returns

boolean

whether it is a valid serialized private key

Defined in

privateKey.ts:65