mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-31 08:02:25 +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:
@@ -12,8 +12,8 @@ type SecretKeyRing struct {
|
||||
}
|
||||
|
||||
// DeriveNextKey currently returns dummy values.
|
||||
func (s *SecretKeyRing) DeriveNextKey(keyFam keychain.KeyFamily) (
|
||||
keychain.KeyDescriptor, error) {
|
||||
func (s *SecretKeyRing) DeriveNextKey(
|
||||
_ keychain.KeyFamily) (keychain.KeyDescriptor, error) {
|
||||
|
||||
return keychain.KeyDescriptor{
|
||||
PubKey: s.RootKey.PubKey(),
|
||||
@@ -21,28 +21,30 @@ func (s *SecretKeyRing) DeriveNextKey(keyFam keychain.KeyFamily) (
|
||||
}
|
||||
|
||||
// DeriveKey currently returns dummy values.
|
||||
func (s *SecretKeyRing) DeriveKey(keyLoc keychain.KeyLocator) (keychain.KeyDescriptor,
|
||||
error) {
|
||||
func (s *SecretKeyRing) DeriveKey(
|
||||
_ keychain.KeyLocator) (keychain.KeyDescriptor, error) {
|
||||
|
||||
return keychain.KeyDescriptor{
|
||||
PubKey: s.RootKey.PubKey(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// DerivePrivKey currently returns dummy values.
|
||||
func (s *SecretKeyRing) DerivePrivKey(keyDesc keychain.KeyDescriptor) (*btcec.PrivateKey,
|
||||
error) {
|
||||
func (s *SecretKeyRing) DerivePrivKey(
|
||||
_ keychain.KeyDescriptor) (*btcec.PrivateKey, error) {
|
||||
|
||||
return s.RootKey, nil
|
||||
}
|
||||
|
||||
// ECDH currently returns dummy values.
|
||||
func (s *SecretKeyRing) ECDH(_ keychain.KeyDescriptor, pubKey *btcec.PublicKey) ([32]byte,
|
||||
error) {
|
||||
func (s *SecretKeyRing) ECDH(_ keychain.KeyDescriptor,
|
||||
_ *btcec.PublicKey) ([32]byte, error) {
|
||||
|
||||
return [32]byte{}, nil
|
||||
}
|
||||
|
||||
// SignMessage signs the passed message and ignores the KeyDescriptor.
|
||||
func (s *SecretKeyRing) SignMessage(_ keychain.KeyDescriptor,
|
||||
func (s *SecretKeyRing) SignMessage(_ keychain.KeyLocator,
|
||||
msg []byte, doubleHash bool) (*btcec.Signature, error) {
|
||||
|
||||
var digest []byte
|
||||
@@ -55,7 +57,7 @@ func (s *SecretKeyRing) SignMessage(_ keychain.KeyDescriptor,
|
||||
}
|
||||
|
||||
// SignMessageCompact signs the passed message.
|
||||
func (s *SecretKeyRing) SignMessageCompact(_ keychain.KeyDescriptor,
|
||||
func (s *SecretKeyRing) SignMessageCompact(_ keychain.KeyLocator,
|
||||
msg []byte, doubleHash bool) ([]byte, error) {
|
||||
|
||||
var digest []byte
|
||||
|
Reference in New Issue
Block a user