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
Name | Type | Description |
---|---|---|
rawPrivKey | SnarkBigNumber | the raw private key (a bigint) |
Returns
Defined in
Properties
rawPrivKey
• rawPrivKey: SnarkBigNumber
Defined in
Methods
asCircuitInputs
▸ asCircuitInputs(): string
Return this Private key as a circuit input
Returns
string
the Private key as a circuit input
Defined in
copy
▸ copy(): PrivKey
Create a copy of this Private key
Returns
a copy of the Private key
Defined in
serialize
▸ serialize(): string
Serialize the private key
Returns
string
the serialized private key
Defined in
toJSON
▸ toJSON(): IJsonPrivateKey
Serialize this object
Returns
Defined in
deserialize
▸ deserialize(s
): PrivKey
Deserialize the private key
Parameters
Name | Type | Description |
---|---|---|
s | string | the serialized private key |
Returns
the deserialized private key
Defined in
fromJSON
▸ fromJSON(json
): PrivKey
Deserialize this object from a JSON object
Parameters
Name | Type | Description |
---|---|---|
json | IJsonPrivateKey | the json object |
Returns
the deserialized object as a PrivKey instance
Defined in
isValidSerializedPrivKey
▸ isValidSerializedPrivKey(s
): boolean
Check if the serialized private key is valid
Parameters
Name | Type | Description |
---|---|---|
s | string | the serialized private key |
Returns
boolean
whether it is a valid serialized private key