@@ -105,6 +105,22 @@ func (d *DummySigner) MuSig2Cleanup(input.MuSig2SessionID) error {
105105type SingleSigner struct {
106106 Privkey * btcec.PrivateKey
107107 KeyLoc keychain.KeyLocator
108+
109+ * input.MusigSessionManager
110+ }
111+
112+ func NewSingleSigner (privkey * btcec.PrivateKey ) * SingleSigner {
113+ signer := & SingleSigner {
114+ Privkey : privkey ,
115+ KeyLoc : idKeyLoc ,
116+ }
117+
118+ keyFetcher := func (* keychain.KeyDescriptor ) (* btcec.PrivateKey , error ) {
119+ return signer .Privkey , nil
120+ }
121+ signer .MusigSessionManager = input .NewMusigSessionManager (keyFetcher )
122+
123+ return signer
108124}
109125
110126// SignOutputRaw generates a signature for the passed transaction using the
@@ -189,53 +205,3 @@ func (s *SingleSigner) SignMessage(keyLoc keychain.KeyLocator,
189205 }
190206 return ecdsa .Sign (s .Privkey , digest ), nil
191207}
192-
193- // MuSig2CreateSession creates a new MuSig2 signing session using the local
194- // key identified by the key locator. The complete list of all public keys of
195- // all signing parties must be provided, including the public key of the local
196- // signing key. If nonces of other parties are already known, they can be
197- // submitted as well to reduce the number of method calls necessary later on.
198- func (s * SingleSigner ) MuSig2CreateSession (input.MuSig2Version ,
199- keychain.KeyLocator , []* btcec.PublicKey , * input.MuSig2Tweaks ,
200- [][musig2 .PubNonceSize ]byte ,
201- ... musig2.SessionOption ) (* input.MuSig2SessionInfo , error ) {
202-
203- return nil , nil
204- }
205-
206- // MuSig2RegisterNonces registers one or more public nonces of other signing
207- // participants for a session identified by its ID. This method returns true
208- // once we have all nonces for all other signing participants.
209- func (s * SingleSigner ) MuSig2RegisterNonces (input.MuSig2SessionID ,
210- [][musig2 .PubNonceSize ]byte ) (bool , error ) {
211-
212- return false , nil
213- }
214-
215- // MuSig2Sign creates a partial signature using the local signing key
216- // that was specified when the session was created. This can only be
217- // called when all public nonces of all participants are known and have
218- // been registered with the session. If this node isn't responsible for
219- // combining all the partial signatures, then the cleanup parameter
220- // should be set, indicating that the session can be removed from memory
221- // once the signature was produced.
222- func (s * SingleSigner ) MuSig2Sign (input.MuSig2SessionID ,
223- [sha256 .Size ]byte , bool ) (* musig2.PartialSignature , error ) {
224-
225- return nil , nil
226- }
227-
228- // MuSig2CombineSig combines the given partial signature(s) with the
229- // local one, if it already exists. Once a partial signature of all
230- // participants is registered, the final signature will be combined and
231- // returned.
232- func (s * SingleSigner ) MuSig2CombineSig (input.MuSig2SessionID ,
233- []* musig2.PartialSignature ) (* schnorr.Signature , bool , error ) {
234-
235- return nil , false , nil
236- }
237-
238- // MuSig2Cleanup removes a session from memory to free up resources.
239- func (s * SingleSigner ) MuSig2Cleanup (input.MuSig2SessionID ) error {
240- return nil
241- }
0 commit comments