sshclient

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyNotFound = errors.New("key file not found")
)

Sentinel errors.

Functions

func FormatPublicKey

func FormatPublicKey(key *SSHKey) (formatted string)

FormatPublicKey formats an SSH public key in authorized_keys format.

Types

type Config

type Config struct {
	SSHKeyPaths    []string // Custom SSH key paths
	UseAgent       bool     // Whether to use ssh-agent
	IdentitiesOnly bool     // Only use specified keys
}

Config represents SSH client configuration.

type SSHKey

type SSHKey struct {
	PublicKey   ssh.PublicKey
	Blob        []byte // Public key bytes
	Comment     string
	Signer      ssh.Signer // For filesystem keys
	AgentKey    *agent.Key // For agent keys (may be nil)
	Source      string     // "agent" or filesystem path
	Fingerprint string     // SHA256 fingerprint
}

SSHKey represents a unified SSH key structure for both agent and filesystem keys.

type UnifiedSSHClient

type UnifiedSSHClient struct {
	// contains filtered or unexported fields
}

UnifiedSSHClient provides access to both SSH agent and filesystem keys.

func NewUnifiedSSHClient

func NewUnifiedSSHClient(config *Config) (client *UnifiedSSHClient, err error)

NewUnifiedSSHClient creates a new unified SSH client that supports both agent and filesystem keys.

func (*UnifiedSSHClient) GetKeys

func (c *UnifiedSSHClient) GetKeys() (keys []*SSHKey, err error)

GetKeys returns all SSH keys from both agent and filesystem following SSH client behavior.

func (*UnifiedSSHClient) SignWithKey

func (c *UnifiedSSHClient) SignWithKey(key *SSHKey, data []byte) (signature *ssh.Signature, pubKey ssh.PublicKey, err error)

SignWithKey signs data with the specified SSH key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL