Files: 786bbae243555dcf10819e786d535cd40788c12b / 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
intailizes the libary 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 signture
free
frees a pointer
Parameters
x
freeArray
frees an array of pointers
Parameters
a
idSetInt
creates an ID from an int to use in with threshold groups
Parameters
sk
number a pointer to the secret key, secret key stuct is used to hold the idn
number a int repsenting the ID. n cannot be zero.
idImportFromInt
creates an ID from an int and returns a pointer to it
Parameters
n
number a int repsenting 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 repsenting 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 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 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 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
write a secretKey to memory
Parameters
sk
number a pointer to a secret keyarray
TypedArray the secret key as a 32 byte TypedArray
secretKeyImport
write 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
write a publicKey to memory
Parameters
sk
number a pointer to a public keyarray
TypedArray the secret key as a 64 byte TypedArray
publicKeyImport
write 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
write a signature to memory
Parameters
sig
number a pointer to a signaturearray
TypedArray the signature as a 32 byte TypedArray
signatureImport
write a signature to memory and returns a pointer to it
Parameters
buf
array
TypedArray the signature as a 32 byte TypedArray
Returns Number
secretKeySetByCSPRNG
Initialize a secret key by a Cryptographically Secure Pseudo Random Number Generator
Parameters
array
TypedArray the secret key as a TypedArray
getPublicKey
Create 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 secket key share for a group member given the groups members id (which is a 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 threshould 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 threshould of the group.id
number the id of the member
publicKeyAdd
Take two publicKeys and adds them together. pubkey1 = pubkey1 + pubkey2
Parameters
secretKeyAdd
Take two secretKeys and adds them together. seckey1 = seckey1 + seckey2
Parameters
publicKeyIsEqual
Take two publicKeys and tests thier equality
Parameters
dhKeyExchange
Does Diffie–Hellman key exchange
Parameters
Built with git-ssb-web