At some point someone will need to rewrite HWI from scratch, because it's going into maintenance mode after MuSig2 support lands. See:
A drop-in replacement command-line utility is the easiest approach for that. We have good documentation (doc/external-signer.md) to describe how it should behave.
However, I think it's worth offering an IPC interface (in addition), for several reasons:
- its expected behavior can be more precisely defined
- calling an external command and parsing its JSON stdout and error messages is not elegant (and has been a struggle on Windows)
- we can't draw a clear security-trust boundary (though for now we fully trust IPC clients too)
- more user friendly: just launch HWI and it'll autodetect and connect over IPC (no need to find its path and configure
-signer)
Proof of concept:
It connects to us to register (or we spawn it), and then we call the commands it implements:
# External signing service (e.g. HWI).
interface ExternalSignerService $Proxy.wrap("interfaces::ExternalSignerService") {
enumerate [@0](/bitcoin-bitcoin/contributor/0/) (chain :Text) -> (result :List(SignerInfo));
getDescriptors [@1](/bitcoin-bitcoin/contributor/1/) (fingerprint :Text, chain :Text, account :Int32) -> (receive :List(Text), internal :List(Text), error :Text, result :Bool);
displayAddress [@2](/bitcoin-bitcoin/contributor/2/) (fingerprint :Text, chain :Text, descriptor :Text) -> (address :Text, error :Text, result :Bool);
signTransaction [@3](/bitcoin-bitcoin/contributor/3/) (fingerprint :Text, chain :Text, psbt :Data) -> (signedPsbt :Data, error :Text, result :Bool);
}
I don't think this is urgent, so I don't plan on opening a PR anytime soon. That is, unless someone actively wants to get rid of the current RunCommandParseJSON() approach.