Documentation
¶
Overview ¶
Package keygen handles the creation of new SSH key pairs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMissingSSHKeys = errors.New("missing one or more keys; did something happen to them after they were generated?")
ErrMissingSSHKeys indicates we're missing some keys that we expected to have after generating. This should be an extreme edge case.
Functions ¶
This section is empty.
Types ¶
type FilesystemErr ¶
type FilesystemErr struct {
Err error
}
FilesystemErr is used to signal there was a problem creating keys at the filesystem-level. For example, when we're unable to create a directory to store new SSH keys in.
func (FilesystemErr) Error ¶
func (e FilesystemErr) Error() string
Error returns a human-readable string for the error. It implements the error interface.
func (FilesystemErr) Unwrap ¶
func (e FilesystemErr) Unwrap() error
Unwrap returne the underlying error.
type SSHKeyPair ¶
type SSHKeyPair struct { PrivateKeyPEM []byte PublicKey []byte KeyDir string Filename string // private key filename; public key will have .pub appended }
SSHKeyPair holds a pair of SSH keys and associated methods.
func New ¶ added in v0.1.1
func New(path, name string, passphrase []byte, keyType KeyType) (*SSHKeyPair, error)
New generates an SSHKeyPair, which contains a pair of SSH keys.
func NewWithWrite ¶ added in v0.1.1
func NewWithWrite(path, name string, passphrase []byte, keyType KeyType) (*SSHKeyPair, error)
NewWithWrite generates an SSHKeyPair and writes it to disk if not exist.
func (*SSHKeyPair) IsKeyPairExists ¶ added in v0.1.1
func (s *SSHKeyPair) IsKeyPairExists() bool
IsKeyPairExists checks if the SSH key pair exists on disk.
func (*SSHKeyPair) WriteKeys ¶
func (s *SSHKeyPair) WriteKeys() error
WriteKeys writes the SSH key pair to disk.
type SSHKeysAlreadyExistErr ¶
type SSHKeysAlreadyExistErr struct {
Path string
}
SSHKeysAlreadyExistErr indicates that files already exist at the location at which we're attempting to create SSH keys.
func (SSHKeysAlreadyExistErr) Error ¶
func (e SSHKeysAlreadyExistErr) Error() string
Error returns the a human-readable error message for SSHKeysAlreadyExistErr. It satisfies the error interface.