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 5
Progress of an agent operation.
An in-flight or completed agent operation.
private SshAgentProgress progress_private string errorMessage_private SshAgentIdentitiesAnswer identities_private SshAgentSignAnswer signature_private bool isSign_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).this()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.
private SshTransport transport_private ubyte[] writeQueue_private size_t writePos_private ubyte[] readBuffer_private SshAgentOperation current_private const(ubyte)[] signKeyBlob_private const(ubyte)[] signData_private uint signFlags_private Duration operationTimeout_private MonoTime operationDeadline_private bool unusable_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.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.
private SshAgentClient client_private const(ubyte)[] keyBlob_private SshPublicKeyInfo publicKey_private SshAgentOperation pending_private string pendingAlgorithm_SshSignResult sign(scope const(ubyte)[] requestData,
string signatureAlgorithm)Signs the request data through the agent, continuing a pending operation when called again.SshSignResult signChecked(scope const(ubyte)[] requestData,
string signatureAlgorithm)bool signatureFlagsForTest(string keyAlgorithm,
string signatureAlgorithm, out uint flags) static @safe pure nothrowExposes the flag mapping for unittest verification.bool signatureFlags(string keyAlgorithm,
string signatureAlgorithm, out uint flags) static @safe pure nothrowthis(SshAgentClient client, const(ubyte)[] keyBlob,
SshPublicKeyInfo publicKey)Constructs a signer for one agent identity.Functions 3
SshTransport connectUnixAgent(string path = null, Duration timeout = Duration.zero)Connects to the agent socket named by SSH_AUTH_SOCK.