ddn.net.ssh.agent_client

Asynchronous ssh-agent client over a supplied byte transport.

The client drives the OpenSSH agent protocol (identity listing and signing) over any SshTransport: the Unix connector in this module, the EVE adapter, or scripted transports in tests. All operations are non-blocking: pump moves bytes and advances one step; callers poll progress afterwards.

The client never opens sockets itself and never blocks on user confirmation - an agent holding back a signature until the user approves simply surfaces as SshAgentProgress.waiting.

Types 4

Progress of an agent operation.

wouldBlockOperation is running and needs transport readiness
doneOperation completed successfully
errorThe operation failed with a typed error

An in-flight or completed agent operation.

Methods
SshAgentProgress progress() @property constReturns: current progress.
bool done() @property constReturns: whether the operation reached a terminal state.
string errorMessage() @property constReturns: the error message when progress is error.
const(SshAgentIdentitiesAnswer) identities() @property constReturns: the listed identities (valid when done and the operation was a listing).
const(SshAgentSignAnswer) signature() @property constReturns: the signature (valid when done and the operation was a sign request).
Constructors

Non-blocking ssh-agent client over a byte transport.

Ownership: the client references but does not own the transport; the caller keeps it alive and closes it.

Methods
void setOperationTimeout(Duration timeout) @safe pure nothrowSets a deadline applied to every operation started afterwards.
SshAgentOperation requestIdentities()Starts an identity listing.
SshAgentOperation sign(const(ubyte)[] keyBlob, const(ubyte)[] data, uint flags)Starts a signature request.
SshAgentProgress pump()Advances the active operation one step.
Constructors
this(SshTransport transport)Constructs a client over a transport.

An SshSigner backed by an SshAgentClient.

Signing is asynchronous: the first sign call starts the agent request and reports SshProgress.WAIT; later calls pump the agent client and continue the same operation until the agent confirms or fails. The application drives the agent transport independently of the SSH session, so a delayed confirmation (for example a hardware-token approval) never blocks the session pump.

Methods
SshPublicKeyInfo publicKey() @property constReturns: the public key offer, never null.
SshSignResult sign(scope const(ubyte)[] requestData, string signatureAlgorithm)Signs the request data through the agent, continuing a pending operation when called again.
bool signatureFlagsForTest(string keyAlgorithm, string signatureAlgorithm, out uint flags) static @safe pure nothrowExposes the flag mapping for unittest verification.
Constructors
this(SshAgentClient client, const(ubyte)[] keyBlob, SshPublicKeyInfo publicKey)Constructs a signer for one agent identity.

Functions 1

fnSshTransport connectUnixAgent(string path = null, Duration timeout = Duration.zero)Connects to the agent socket named by SSH_AUTH_SOCK.