Documentation
¶
Index ¶
- Constants
- func AddCache(alias string, keyMap map[string]*SSHKey, env *Environment) error
- func ClearKey(env *Environment)
- func CreateLink(alias string, keyMap map[string]*SSHKey, env *Environment)
- func DeleteCache(alias string, keyMap map[string]*SSHKey, env *Environment) error
- func DeleteKey(alias string, key *SSHKey, env *Environment, forTest ...bool)
- func Execute(workDir, script string, args ...string) bool
- func Fatalf(format string, args ...interface{})
- func GetBakFileName() string
- func IsEmpty(path string) (bool, error)
- func ListCache() error
- func LoadSSHKeys(env *Environment) map[string]*SSHKey
- func ParsePath(path string) string
- func RunHook(alias string, env *Environment)
- type Environment
- type KeyType
- type KeyTypeRegistry
- type SSHKey
Constants ¶
const ( // Name is the program name Name = "SKM" // Usage is for simple description Usage = "Manage your multiple SSH keys easily" // CheckSymbol is the code for check symbol CheckSymbol = "\u2714 " // CrossSymbol is the code for check symbol CrossSymbol = "\u2716 " // PublicKey is the default name of SSH public key PublicKey = "id_rsa.pub" // PrivateKey is the default name of SSH private key PrivateKey = "id_rsa" // DefaultKey is the default alias name of SSH key DefaultKey = "default" // HookName is the name of a hook that is called when present after using a key HookName = "hook" )
Variables ¶
This section is empty.
Functions ¶
func AddCache ¶
func AddCache(alias string, keyMap map[string]*SSHKey, env *Environment) error
AddCache adds SSH to ssh agent cache via key alias
func ClearKey ¶
func ClearKey(env *Environment)
ClearKey clears both private & public keys from SSH key path
func CreateLink ¶
func CreateLink(alias string, keyMap map[string]*SSHKey, env *Environment)
CreateLink creates symbol link for specified SSH key
func DeleteCache ¶
func DeleteCache(alias string, keyMap map[string]*SSHKey, env *Environment) error
DeleteCache removes SSH key from SSH agent cache via key alias
func DeleteKey ¶
func DeleteKey(alias string, key *SSHKey, env *Environment, forTest ...bool)
DeleteKey delete key by its alias name
func Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf output formatted fatal error info
func GetBakFileName ¶
func GetBakFileName() string
GetBakFileName generates a backup file name by current date and time
func LoadSSHKeys ¶
func LoadSSHKeys(env *Environment) map[string]*SSHKey
LoadSSHKeys loads all the SSH keys from key store
func RunHook ¶
func RunHook(alias string, env *Environment)
RunHook runs hook file after switching SSH key
Types ¶
type Environment ¶
Environment abstracts away things like the path the .skm and .ssh folder which allows us to simulate them for testing.
type KeyType ¶
KeyType abstracts configurations for various SSH key types like RSA and ED25519
func (KeyType) PrivateKey ¶
PrivateKey returns the filename used by a keytype for the private component.
type KeyTypeRegistry ¶
KeyTypeRegistry is used to store all the supported key types.
var SupportedKeyTypes KeyTypeRegistry
SupportedKeyTypes contains all key types supported by skm.
func (KeyTypeRegistry) GetByFilename ¶
func (r KeyTypeRegistry) GetByFilename(name string) (KeyType, bool)
GetByFilename returns a key type object given the name of the private key's file. If no matching key type could be found, then the second return value is false.


