Minimal Anti Collusion Infrastructure (MACI) / Keypair
Class: Keypair
Defined in: keyPair.ts:16
Notice
A KeyPair is a pair of public and private keys This is a MACI keypair, which is not to be confused with an Ethereum public and private keypair. A MACI keypair is comprised of a MACI public key and a MACI private key
Constructors
new Keypair()
new Keypair(
privKey
?):Keypair
Defined in: keyPair.ts:26
Create a new instance of a Keypair
Parameters
privKey?
the private key (optional)
Returns
Notice
if no privKey is passed, it will automatically generate a new private key
Properties
privKey
privKey:
PrivKey
Defined in: keyPair.ts:17
pubKey
pubKey:
PubKey
Defined in: keyPair.ts:19
Methods
copy()
copy():
Keypair
Defined in: keyPair.ts:41
Create a deep clone of this Keypair
Returns
a copy of the Keypair
equals()
equals(
keypair
):boolean
Defined in: keyPair.ts:58
Check whether two Keypairs are equal
Parameters
keypair
the keypair to compare with
Returns
boolean
whether they are equal or not
toJSON()
toJSON():
IJsonKeyPair
Defined in: keyPair.ts:75
Serialize into a JSON object
Returns
fromJSON()
static
fromJSON(json
):Keypair
Defined in: keyPair.ts:87
Deserialize into a Keypair instance
Parameters
json
Returns
a keypair instance
genEcdhSharedKey()
static
genEcdhSharedKey(privKey
,pubKey
):EcdhSharedKey
Defined in: keyPair.ts:49
Generate a shared key
Parameters
privKey
pubKey
Returns
EcdhSharedKey