Skip to main content
Version: v2.x

Minimal Anti Collusion Infrastructure (MACI) v2.5.0 / Keypair

Class: 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

Constructors

new Keypair()

new Keypair(privKey?): Keypair

Create a new instance of a Keypair

Parameters

privKey?: PrivKey

the private key (optional)

Returns

Keypair

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

Keypair

a copy of the Keypair

Defined in

keyPair.ts:41


equals()

equals(keypair): boolean

Check whether two Keypairs are equal

Parameters

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

IJsonKeyPair

Defined in

keyPair.ts:75


fromJSON()

static fromJSON(json): Keypair

Deserialize into a Keypair instance

Parameters

json: IJsonKeyPair

Returns

Keypair

a keypair instance

Defined in

keyPair.ts:87


genEcdhSharedKey()

static genEcdhSharedKey(privKey, pubKey): EcdhSharedKey

Generate a shared key

Parameters

privKey: PrivKey

pubKey: PubKey

Returns

EcdhSharedKey

Defined in

keyPair.ts:49