Skip to main content
Version: v1.2

PrivKey

Notice

PrivKey is a TS Class representing a MACI PrivateKey (on the jubjub 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.' A raw MACI private key can be thought as a point on the baby jubjub curve

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new PrivKey(rawPrivKey): PrivKey

Generate a new Private key object

Parameters

NameTypeDescription
rawPrivKeySnarkBigNumberthe 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

deserialize(s): PrivKey

Deserialize the private key

Parameters

NameTypeDescription
sstringthe serialized private key

Returns

PrivKey

the deserialized private key

Defined in

privateKey.ts:55


fromJSON

fromJSON(json): PrivKey

Deserialize this object from a JSON object

Parameters

NameTypeDescription
jsonIJsonPrivateKeythe json object

Returns

PrivKey

the deserialized object as a PrivKey instance

Defined in

privateKey.ts:86


isValidSerializedPrivKey

isValidSerializedPrivKey(s): boolean

Check if the serialized private key is valid

Parameters

NameTypeDescription
sstringthe serialized private key

Returns

boolean

whether it is a valid serialized private key

Defined in

privateKey.ts:65