Minimal Anti Collusion Infrastructure (MACI) v2.4.0 / PubKey
Class: PubKey
Notice
A class representing a public key This is a MACI public key, which is not to be confused with an Ethereum public key. A serialized MACI public key is prefixed by 'macipk.' A raw MACI public key can be thought as a pair of BigIntegers (x, y) representing a point on the baby jubjub curve
Constructors
new PubKey()
new PubKey(
rawPubKey
,allowInvalid
):PubKey
Create a new instance of a public key
Parameters
• rawPubKey: PubKey
the raw public key
• allowInvalid: boolean
= false
whether to allow invalid public keys
Returns
Dev
You might want to allow an invalid raw key, as when decrypting invalid messages, the public key data will be random, and likely not be a point on the curve. However we need to match keys to the circuit which does not perform such checks
Defined in
publicKey.ts:30
Properties
rawPubKey
rawPubKey:
PubKey
Defined in
publicKey.ts:18
Methods
asArray()
asArray():
bigint
[]
Return this public key as an array of bigints
Returns
bigint
[]
the public key as an array of bigints
Defined in
publicKey.ts:66
asCircuitInputs()
asCircuitInputs():
string
[]
Return this public key as circuit inputs
Returns
string
[]
an array of strings
Defined in
publicKey.ts:60
asContractParam()
asContractParam():
IG1ContractParams
Return this public key as smart contract parameters
Returns
the public key as smart contract parameters
Defined in
publicKey.ts:47
copy()
copy():
PubKey
Create a copy of the public key
Returns
a copy of the public key
Defined in
publicKey.ts:41
equals()
equals(
p
):boolean
Check whether this public key equals to another public key
Parameters
• p: PubKey
the public key to compare with
Returns
boolean
whether they match
Defined in
publicKey.ts:93
hash()
hash():
bigint
Hash the two baby jubjub coordinates
Returns
bigint
the hash of this public key
Defined in
publicKey.ts:86
serialize()
serialize():
string
Generate a serialized public key from this public key object
Returns
string
the string representation of a serialized public key