From b226edf96e850ab455a776565a55bcdbce703ea6 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Fri, 14 Apr 2017 10:59:13 -0700 Subject: [PATCH] lnwallet: introduce the MessageSigner interface This commit introduces the MessageSigner interface which is an abstract object capable of signing arbitrary messages with a target public key. This interface will be used within the daemon for: signing channel authentication proofs, signing node/channel announcements, and also to possibly sign arbitrary messages in the future. --- lnwallet/interface.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lnwallet/interface.go b/lnwallet/interface.go index 476d068a..38abac62 100644 --- a/lnwallet/interface.go +++ b/lnwallet/interface.go @@ -287,6 +287,18 @@ type Signer interface { ComputeInputScript(tx *wire.MsgTx, signDesc *SignDescriptor) (*InputScript, error) } +// MessageSigner represents an abstract object capable of signing arbitrary +// messages. The capabilities of this interface are used to sign announcements +// to the network, or just arbitrary messages that leverage the wallet's keys +// to attest to some message. +type MessageSigner interface { + // SignMessage attempts to sign a target message with the private key + // that corresponds to the passed public key. If the target private key + // is unable to be found, then an error will be returned. The actual + // digest signed is the double SHA-256 of the passed message. + SignMessage(pubKey *btcec.PublicKey, msg []byte) (*btcec.Signature, error) +} + // WalletDriver represents a "driver" for a particular concrete // WalletController implementation. A driver is identified by a globally unique // string identifier along with a 'New()' method which is responsible for