mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-30 15:40:59 +02:00
multi: use key locator only for signing messages
To simplify the API surface of a remote signer even more, we refactor the SignMessage and SignMessageCompact calls to only accept a key locator as we always know what key we're using for signing anyway.
This commit is contained in:
@@ -392,13 +392,15 @@ func (b *BtcWalletKeyRing) ECDH(keyDesc KeyDescriptor,
|
||||
}
|
||||
|
||||
// SignMessage signs the given message, single or double SHA256 hashing it
|
||||
// first, with the private key described in the key descriptor.
|
||||
// first, with the private key described in the key locator.
|
||||
//
|
||||
// NOTE: This is part of the keychain.MessageSignerRing interface.
|
||||
func (b *BtcWalletKeyRing) SignMessage(keyDesc KeyDescriptor,
|
||||
func (b *BtcWalletKeyRing) SignMessage(keyLoc KeyLocator,
|
||||
msg []byte, doubleHash bool) (*btcec.Signature, error) {
|
||||
|
||||
privKey, err := b.DerivePrivKey(keyDesc)
|
||||
privKey, err := b.DerivePrivKey(KeyDescriptor{
|
||||
KeyLocator: keyLoc,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -413,14 +415,16 @@ func (b *BtcWalletKeyRing) SignMessage(keyDesc KeyDescriptor,
|
||||
}
|
||||
|
||||
// SignMessageCompact signs the given message, single or double SHA256 hashing
|
||||
// it first, with the private key described in the key descriptor and returns
|
||||
// it first, with the private key described in the key locator and returns
|
||||
// the signature in the compact, public key recoverable format.
|
||||
//
|
||||
// NOTE: This is part of the keychain.MessageSignerRing interface.
|
||||
func (b *BtcWalletKeyRing) SignMessageCompact(keyDesc KeyDescriptor,
|
||||
func (b *BtcWalletKeyRing) SignMessageCompact(keyLoc KeyLocator,
|
||||
msg []byte, doubleHash bool) ([]byte, error) {
|
||||
|
||||
privKey, err := b.DerivePrivKey(keyDesc)
|
||||
privKey, err := b.DerivePrivKey(KeyDescriptor{
|
||||
KeyLocator: keyLoc,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user