bnb-chain / tss-lib

Threshold Signature Scheme, for ECDSA and EDDSA
MIT License
759 stars 261 forks source link

Exposed random sources #275

Closed balena closed 6 months ago

balena commented 10 months ago

Exposed the random sources, so that users can customize them according to their needs. The rand.Reader is used by default if the user does not specify a random source while creating the local party. At keygen the random sources are separated between "partial key random source" and regular random source, aiming to provide a deterministic random source when it's the case. Custom random sources are required when the app utilizes multiple entropy sources, frequently unsuitable to be set at the global rand.Reader.

In order to set random sources, do:

params := tss.NewParameters(...)
params.SetRand(rand)
params.SetPartialKeyRand(partialKeyRand)