- onModuleInit
- MCLBN_CURVE_FP254BNB
- MCLBN_CURVE_FP382_1
- MCLBN_CURVE_FP382_2
- init
- secretKey
- publicKey
- signature
- free
- freeArray
- idSetInt
- idImportFromInt
- idImport
- sign
- verify
- publicKeyExport
- secretKeyExport
- signatureExport
- hashToSecretKey
- secretKeyDeserialize
- secretKeyImport
- publicKeyDeserialize
- publicKeyImport
- signatureDeserialize
- signatureImport
- secretKeySetByCSPRNG
- getPublicKey
- secretKeyRecover
- publicKeyRecover
- signatureRecover
- secretKeyShare
- publicKeyShare
- publicKeyAdd
- secretKeyAdd
- publicKeyIsEqual
- dhKeyExchange
Takes a callback that is called once the module is setup
Parameters
cb
The FP254BNB curve
The FP382_1 curve
The FP382_2 curve
Initializes the library to use a given curve
Parameters
curvenumber the curves that can be used are MCLBN_CURVE_FP254BNB, MCLBN_CURVE_FP382_1 or MCLBN_CURVE_FP382_2 (optional, defaultexports.MCLBN_CURVE_FP254BNB)
Allocates a secret key
Returns number the pointer to the key
Allocates a secret key
Returns number the pointer to the key
Allocates a signature
Returns number the pointer to the signature
Frees a pointer
Parameters
x
Frees an array of pointers
Parameters
a
Creates an ID from an int to use with threshold groups
Parameters
sknumber a pointer to the secret key, secret key struct is used to hold the idnnumber a int representing the ID. n cannot be zero.
Creates an ID from an int and returns a pointer to it
Parameters
nnumber a int representing the ID. n cannot be zero.
Returns number
Creates an ID from an int and returns a pointer to it
Parameters
nnumber a int representing the ID. n cannot be zero.
Returns number
Signs a message
Parameters
signumber a pointer to the a signaturesknumber a pointer to the secret keymsg(TypedArray | String) the message to sign
Verifies a signature
Parameters
signumber a pointer to the a signaturepknumber a pointer to the secret keymsg(TypedArray | String) the message that was signed
Returns Boolean
Given a pointer to a public key, this returns a 64 byte Int8Array containing the key
Parameters
pknumber a pointer to the secret key
Returns TypedArray
Given a pointer to a secret key, this returns a 32 byte Int8Array containing the key
Parameters
pknumber a pointer to the secret key
Returns TypedArray
Given a pointer to a signature, this returns a 32 byte Int8Array containing the signature
Parameters
pknumber a pointer to the secret key
Returns TypedArray
Generates a secret key given a seed phrase
Parameters
sknumber a pointer to a secret keyseed(String | TypedArray) the seed phrase
Writes a secretKey to memory
Parameters
sknumber a pointer to a secret keyarrayTypedArray the secret key as a 32 byte TypedArray
Writes a secretKey to memory and returns a pointer to it
Parameters
bufsknumber a pointer to a secret keyarrayTypedArray the secret key as a 32 byte TypedArray
Returns Number
Writes a publicKey to memory
Parameters
sknumber a pointer to a public keyarrayTypedArray the secret key as a 64 byte TypedArray
Writes a publicKey to memory and returns a pointer to it
Parameters
bufarrayTypedArray the secret key as a 64 byte TypedArray
Returns Number
Writes a signature to memory
Parameters
signumber a pointer to a signaturearrayTypedArray the signature as a 32 byte TypedArray
Writes a signature to memory and returns a pointer to it
Parameters
bufarrayTypedArray the signature as a 32 byte TypedArray
Returns Number
Initializes a secret key by a Cryptographically Secure Pseudo Random Number Generator
Parameters
arrayTypedArray the secret key as a TypedArray
Creates a public key from the secret key
Parameters
arrayTypedArray the public key as a TypedArrayarrayTypedArray the secret key as a TypedArray
Recovers a secret key for a group given the groups secret keys shares and the groups ids
Parameters
sknumber a pointer to a secret key that will be generatedsksArrayArray<number> an array of pointers to the groups secret key shares. The length of the array should be the threshold number for the groupidArrahArray<numbers> an array of pointers to ids in the groups. The length of the array should be the threshold number for the group
Recovers a public key for a group given the groups public keys shares and the groups ids
Parameters
pknumber a pointer to a public key that will be generatedpksArrayArray<number> an array of pointers to the groups public key shares. The length of the array should be the threshold number for the groupidArrahArray<numbers> an array of pointers to ids in the groups. The length of the array should be the threshold number for the group
Recovers a signature for a group given the groups public keys shares and the groups ids
Parameters
signumber a pointer to the signature that will be generatedsigArrayArray<number> an array of pointers to signature shares. The length of the array should be the threshold number for the groupidArrahArray<numbers> an array of pointers to ids in the groups. The length of the array should be the threshold number for the group
Creates a secret key share for a group member given the groups members id (which is the secret key) and array of master secret keys
Parameters
sksharenumber a pointer to a secret key that will be generatedmskArray<number> an array of master secret keys. The number of keys is the threshold of the group.idnumber the id of the member
Creates a public key share for a group member given the groups members id (which is a the secret key) and array of master public keys
Parameters
pksharenumber a pointer to a secret key that will be generatedmpkArray<number> an array of master public keys. The number of keys is the threshold of the group.idnumber the id of the member
Takes two publicKeys and adds them together. pubkey1 = pubkey1 + pubkey2
Parameters
Takes two secretKeys and adds them together. seckey1 = seckey1 + seckey2
Parameters
Takes two publicKeys and tests their equality
Parameters
Does Diffie–Hellman key exchange
Parameters