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
keyPair.ts:26
Properties
privKey
• privKey: PrivKey
Defined in
keyPair.ts:17
pubKey
• pubKey: PubKey
Defined in
keyPair.ts:19
Methods
copy
▸ copy(): Keypair
Create a deep clone of this Keypair
Returns
a copy of the Keypair
Defined in
keyPair.ts:41
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
keyPair.ts:58
toJSON
▸ toJSON(): IJsonKeyPair
Serialize into a JSON object
Returns
Defined in
keyPair.ts:75
fromJSON
▸ fromJSON(json
): Keypair
Deserialize into a Keypair instance
Parameters
Name | Type |
---|---|
json | IJsonKeyPair |
Returns
a keypair instance
Defined in
keyPair.ts:87
genEcdhSharedKey
▸ genEcdhSharedKey(privKey
, pubKey
): EcdhSharedKey
Generate a shared key
Parameters
Name | Type |
---|---|
privKey | PrivKey |
pubKey | PubKey |
Returns
EcdhSharedKey
Defined in
keyPair.ts:49