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.'
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
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
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
Defined in
privateKey.ts:75
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
privateKey.ts:55
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
privateKey.ts:86
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
Defined in
privateKey.ts:65