Newer
Older
/** Initialize
*/
export const initSecrets = (bits, rngType) => secrets.init(bits, rngType);
* Function generates a random bits length string, and output it in hexadecimal format
*
* @param {number} bits
export const generateRecoveryKey = bits => secrets.random(bits);
/**
* Divide a secret expressed in hexadecimal form into numShares number of shares, requiring that threshold number of shares be present for reconstructing the secret
*
* @param {string} secret
* @param {number} numShares
* @param {number} threshold
* @param {number} [padLength=128]
*/
export const divideSecretToShares = (
secret,
numShares,
threshold,
padLength = 128
) => secrets.share(secret, numShares, threshold, padLength);
/**
* Reconstructs a secret from shares
*
* @param {array} shares
*/
export const combineSecret = shares => secrets.combine(shares);
export const encryptShare = (share, publicKey) =>
encryptMessage(share, publicKey, "secretPart");