Keypair
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
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• new Keypair(privKey?
): Keypair
Create a new instance of a Keypair
Parameters
Name | Type | Description |
---|---|---|
privKey? | PrivKey | the private key (optional) |
Returns
Notice
if no privKey is passed, it will automatically generate a new private key
Defined in
Properties
privKey
• privKey: PrivKey
Defined in
pubKey
• pubKey: PubKey
Defined in
Methods
copy
▸ copy(): Keypair
Create a deep clone of this Keypair
Returns
a copy of the Keypair
Defined in
equals
▸ equals(keypair
): boolean
Check whether two Keypairs are equal
Parameters
Name | Type | Description |
---|---|---|
keypair | Keypair | the keypair to compare with |
Returns
boolean
whether they are equal or not
Defined in
toJSON
▸ toJSON(): IJsonKeyPair
Serialize into a JSON object
Returns
Defined in
fromJSON
▸ fromJSON(json
): Keypair
Deserialize into a Keypair instance
Parameters
Name | Type |
---|---|
json | IJsonKeyPair |
Returns
a keypair instance
Defined in
genEcdhSharedKey
▸ genEcdhSharedKey(privKey
, pubKey
): EcdhSharedKey
Generate a shared key
Parameters
Name | Type |
---|---|
privKey | PrivKey |
pubKey | PubKey |
Returns
EcdhSharedKey