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:
Oliver Gugger
2021-09-23 16:54:29 +02:00
parent 8b7c88537c
commit afa03f22cc
6 changed files with 46 additions and 37 deletions

View File

@@ -457,17 +457,15 @@ func (s *Server) SignMessage(_ context.Context,
}
// Describe the private key we'll be using for signing.
keyDescriptor := keychain.KeyDescriptor{
KeyLocator: keychain.KeyLocator{
Family: keychain.KeyFamily(in.KeyLoc.KeyFamily),
Index: uint32(in.KeyLoc.KeyIndex),
},
keyLocator := keychain.KeyLocator{
Family: keychain.KeyFamily(in.KeyLoc.KeyFamily),
Index: uint32(in.KeyLoc.KeyIndex),
}
// Create the raw ECDSA signature first and convert it to the final wire
// format after.
sig, err := s.cfg.KeyRing.SignMessage(
keyDescriptor, in.Msg, in.DoubleHash,
keyLocator, in.Msg, in.DoubleHash,
)
if err != nil {
return nil, fmt.Errorf("can't sign the hash: %v", err)