multi: add tag option to SignMessageSchnorr

This commit is contained in:
Orbital
2023-10-21 17:05:53 -05:00
parent dd81edd817
commit ed373baed0
5 changed files with 23 additions and 13 deletions

View File

@@ -74,13 +74,17 @@ func (s *SecretKeyRing) SignMessageCompact(_ keychain.KeyLocator,
// SignMessageSchnorr signs the passed message and ignores the KeyDescriptor.
func (s *SecretKeyRing) SignMessageSchnorr(_ keychain.KeyLocator,
msg []byte, doubleHash bool, taprootTweak []byte) (*schnorr.Signature,
error) {
msg []byte, doubleHash bool, taprootTweak []byte,
tag []byte) (*schnorr.Signature, error) {
var digest []byte
if doubleHash {
switch {
case len(tag) > 0:
taggedHash := chainhash.TaggedHash(tag, msg)
digest = taggedHash[:]
case doubleHash:
digest = chainhash.DoubleHashB(msg)
} else {
default:
digest = chainhash.HashB(msg)
}