Skip to content

fakesshagent wish sans-io

Wish details: fakesshagent should be a Sans-I/O implementation of the SSH agent protocol

ClasswishThis is a request for an enhancement.
PriorityhighThis should be fixed in the next release.
DifficultyfunJust needs tuits, and not many of them.
Requested-in0.1

The fake/stub SSH agent in version 0.1 of fakesshagent is almost a Sans-I/O protocol parser.1 However, it currently neither has separate business logic—the “stub” part is intertwined with the “parser” part—nor does it implement a Sans-I/O-style “stream of events” interface (because the business logic is not yet separate). It should have/do both.

Actually separating the business logic from the parser, Sans-I/O-style, would also enable porting the remaining SSH test double of derivepassphrase: the AgentRequestResponseQueue, which maps protocol requests to a list of protocol responses.2 The queue thus already operates on (a primitive version of) the event-based interface.


Therefore, rewrite the fake/stub agent into a parser and a (proper) stub agent, and have the parser expose a Sans-I/O-style “stream of events” interface.


  1. In a Sans-I/O network protocol parser, the parser and the network I/O machinery are completely separate, enabling the parser to be used under all kinds of different I/O paradigms. Porting I/O paradigms is usually practically infeasible, and if the protocol parser were intertwined with the I/O, then the parser would likely need to be rewritten from scratch. 

  2. The AgentRequestResponseQueue differs from the fake/stub agent in that the queue only understands the protocol framing, not the protocol contents. The queue requires and enforces well-formed requests and responses, and will always answer the same request in the same way, irrespective of session state. It is thus less flexible, but also easier to set up.