localkeys

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package localkeys finds the SSH keys of this computer that a host asking for its password offers first: the IdentityFiles ~/.ssh/config names for it, else the default key files. It also keeps, beside the app's data, which key last logged in to each host and which keys have a remembered passphrase; neither is a secret, and neither belongs in a backup, since the key files stay on this computer.

Index

Constants

This section is empty.

Variables

View Source
var Defaults = []string{"id_ed25519", "id_ecdsa", "id_rsa"}

Defaults are the key files in ~/.ssh offered when the config names none for the host, as ssh does.

Functions

This section is empty.

Types

type Found

type Found struct {
	Keys []session.LocalKey
	// IdentitiesOnly is the config's option for the host.
	IdentitiesOnly bool
}

Found are the keys for one host.

func Find

func Find(home, localUser, name, address string) Found

Find returns the keys for the host at address, named name in SSHYard, from the home directory home of localUser. Files that are missing or unreadable are left out.

type Remembered

type Remembered struct {
	// ID is the key's session.KeyID.
	ID          string `json:"id"`
	Path        string `json:"path"`
	Fingerprint string `json:"fingerprint"`
}

Remembered is a key whose passphrase is in the encrypted store (keychain.LocalKeyPassphrase).

type State

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

State is what SSHYard keeps about the keys of this computer, in a JSON file. It is safe for concurrent use.

func Open

func Open(path string) *State

Open reads the state at path; a missing or unreadable file is an empty state. With path "" the state is never written.

func (*State) Forget

func (s *State) Forget(id string) error

Forget notes that the passphrase of the key id is no longer remembered.

func (*State) ForgetHost

func (s *State) ForgetHost(host string) error

ForgetHost drops what is kept for a deleted host.

func (*State) IsRemembered

func (s *State) IsRemembered(id string) bool

IsRemembered reports whether the passphrase of the key id is remembered.

func (*State) Last

func (s *State) Last(host string) string

Last is the KeyID that logged in to host last, "" for none.

func (*State) Remember

func (s *State) Remember(r Remembered) error

Remember notes that the passphrase of r is remembered.

func (*State) Remembered

func (s *State) Remembered() []Remembered

Remembered are the keys with a remembered passphrase.

func (*State) SetLast

func (s *State) SetLast(host, id string) error

SetLast notes that the key id logged in to host.

Jump to

Keyboard shortcuts

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