AgentProvider

Provider interface for SSH agent forwarding.

Implement this interface to handle agent requests from remote servers when agent forwarding is enabled. The library will call these methods when a remote server requests identities or signatures. Implementations should return AgentResult.Failure instead of throwing when a backend operation fails.

Functions

Link copied to clipboard
open suspend fun addIdentity(keyPair: KeyPair, comment: String, confirmUse: Boolean, lifetimeSeconds: Long?): AgentResult<Boolean>

Optional agent management operations. Providers deny mutations by default.

Link copied to clipboard
abstract suspend fun getIdentities(): AgentResult<List<AgentIdentity>>

Return the list of identities available for forwarding.

Link copied to clipboard
open suspend fun isLocked(): Boolean

Lock state is shared by all forwarded channels using this provider.

Link copied to clipboard
open suspend fun lock(passphrase: String): AgentResult<Boolean>
Link copied to clipboard
Link copied to clipboard
open suspend fun removeIdentity(publicKeyBlob: ByteArray): AgentResult<Boolean>
Link copied to clipboard
abstract suspend fun signData(context: AgentSigningContext): AgentResult<ByteArray?>

Sign data with the specified key.

Link copied to clipboard
open suspend fun unlock(passphrase: String): AgentResult<Boolean>