Files: 9226bf29380d872b89fd19a7dbfbcab484dfac9e / docs / index.md
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
Table of Contents
- 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
onModuleInit
Takes a callback that is called once the module is setup
Parameters
cb
MCLBN_CURVE_FP254BNB
The FP254BNB curve
MCLBN_CURVE_FP382_1
The FP382_1 curve
MCLBN_CURVE_FP382_2
The FP382_2 curve
init
Initializes the library to use a given curve
Parameters
curve
number the curves that can be used are MCLBN_CURVE_FP254BNB, MCLBN_CURVE_FP382_1 or MCLBN_CURVE_FP382_2 (optional, defaultexports.MCLBN_CURVE_FP254BNB
)
secretKey
Allocates a secret key
Returns number the pointer to the key
publicKey
Allocates a secret key
Returns number the pointer to the key
signature
Allocates a signature
Returns number the pointer to the signature
free
Frees a pointer
Parameters
x
freeArray
Frees an array of pointers
Parameters
a
idSetInt
Creates an ID from an int to use with threshold groups
Parameters
sk
number a pointer to the secret key, secret key struct is used to hold the idn
number a int representing the ID. n cannot be zero.
idImportFromInt
Creates an ID from an int and returns a pointer to it
Parameters
n
number a int representing the ID. n cannot be zero.
Returns number
idImport
Creates an ID from an int and returns a pointer to it
Parameters
n
number a int representing the ID. n cannot be zero.
Returns number
sign
Signs a message
Parameters
sig
number a pointer to the a signaturesk
number a pointer to the secret keymsg
(TypedArray | String) the message to sign
verify
Verifies a signature
Parameters
sig
number a pointer to the a signaturepk
number a pointer to the secret keymsg
(TypedArray | String) the message that was signed
Returns Boolean
publicKeyExport
Given a pointer to a public key, this returns a 64 byte Int8Array containing the key
Parameters
pk
number a pointer to the secret key
Returns TypedArray
secretKeyExport
Given a pointer to a secret key, this returns a 32 byte Int8Array containing the key
Parameters
pk
number a pointer to the secret key
Returns TypedArray
signatureExport
Given a pointer to a signature, this returns a 32 byte Int8Array containing the signature
Parameters
pk
number a pointer to the secret key
Returns TypedArray
hashToSecretKey
Generates a secret key given a seed phrase
Parameters
sk
number a pointer to a secret keyseed
(String | TypedArray) the seed phrase
secretKeyDeserialize
Writes a secretKey to memory
Parameters
sk
number a pointer to a secret keyarray
TypedArray the secret key as a 32 byte TypedArray
secretKeyImport
Writes a secretKey to memory and returns a pointer to it
Parameters
buf
sk
number a pointer to a secret keyarray
TypedArray the secret key as a 32 byte TypedArray
Returns Number
publicKeyDeserialize
Writes a publicKey to memory
Parameters
sk
number a pointer to a public keyarray
TypedArray the secret key as a 64 byte TypedArray
publicKeyImport
Writes a publicKey to memory and returns a pointer to it
Parameters
buf
array
TypedArray the secret key as a 64 byte TypedArray
Returns Number
signatureDeserialize
Writes a signature to memory
Parameters
sig
number a pointer to a signaturearray
TypedArray the signature as a 32 byte TypedArray
signatureImport
Writes a signature to memory and returns a pointer to it
Parameters
buf
array
TypedArray the signature as a 32 byte TypedArray
Returns Number
secretKeySetByCSPRNG
Initializes a secret key by a Cryptographically Secure Pseudo Random Number Generator
Parameters
array
TypedArray the secret key as a TypedArray
getPublicKey
Creates a public key from the secret key
Parameters
array
TypedArray the public key as a TypedArrayarray
TypedArray the secret key as a TypedArray
secretKeyRecover
Recovers a secret key for a group given the groups secret keys shares and the groups ids
Parameters
sk
number a pointer to a secret key that will be generatedsksArray
Array<number> an array of pointers to the groups secret key shares. The length of the array should be the threshold number for the groupidArrah
Array<numbers> an array of pointers to ids in the groups. The length of the array should be the threshold number for the group
publicKeyRecover
Recovers a public key for a group given the groups public keys shares and the groups ids
Parameters
pk
number a pointer to a public key that will be generatedpksArray
Array<number> an array of pointers to the groups public key shares. The length of the array should be the threshold number for the groupidArrah
Array<numbers> an array of pointers to ids in the groups. The length of the array should be the threshold number for the group
signatureRecover
Recovers a signature for a group given the groups public keys shares and the groups ids
Parameters
sig
number a pointer to the signature that will be generatedsigArray
Array<number> an array of pointers to signature shares. The length of the array should be the threshold number for the groupidArrah
Array<numbers> an array of pointers to ids in the groups. The length of the array should be the threshold number for the group
secretKeyShare
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
skshare
number a pointer to a secret key that will be generatedmsk
Array<number> an array of master secret keys. The number of keys is the threshold of the group.id
number the id of the member
publicKeyShare
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
pkshare
number a pointer to a secret key that will be generatedmpk
Array<number> an array of master public keys. The number of keys is the threshold of the group.id
number the id of the member
publicKeyAdd
Takes two publicKeys and adds them together. pubkey1 = pubkey1 + pubkey2
Parameters
secretKeyAdd
Takes two secretKeys and adds them together. seckey1 = seckey1 + seckey2
Parameters
publicKeyIsEqual
Takes two publicKeys and tests their equality
Parameters
dhKeyExchange
Does Diffie–Hellman key exchange
Parameters
Built with git-ssb-web