Add comment detailing that `signSchnorr` without an `rng` is discouraged

This commit is contained in:
Gruruya 2023-04-04 15:32:05 -04:00
parent 8d8fa3864c
commit b35f4556f6
1 changed files with 4 additions and 0 deletions

View File

@ -487,12 +487,16 @@ template signSchnorrImpl(makeKeypair: untyped): untyped {.dirty.} =
func signSchnorr*(key: SkSecretKey, msg: SkMessage): SkSchnorrSignature =
## Sign message `msg` using private key `key` with the Schnorr signature algorithm and return signature object.
## You should not use this function unless you are unable to generate random numbers for whatever reason.
## Instead, use the variant of `signSchnorr` with an `Rng` or `FullproofRng`.
signSchnorrImpl(
secp256k1_schnorrsig_sign32(
getContext(), data.baseAddr, msg.baseAddr, addr kp, nil))
func signSchnorr*(key: SkSecretKey, msg: openArray[byte]): SkSchnorrSignature =
## Sign message `msg` using private key `key` with the Schnorr signature algorithm and return signature object.
## You should not use this function unless you are unable to generate random numbers for whatever reason.
## Instead, use the variant of `signSchnorr` with an `Rng` or `FullproofRng`.
signSchnorrImpl(
secp256k1_schnorrsig_sign_custom(
getContext(), data.baseAddr, msg.baseAddr, csize_t msg.len, addr kp, nil))