Move 'CreateKeyPairConfig' closer to callers.
Per review feedback.
This commit is contained in:
parent
302828905d
commit
672b22bd13
|
@ -36,21 +36,6 @@ func (o KeyPairType) String() string {
|
||||||
return string(o)
|
return string(o)
|
||||||
}
|
}
|
||||||
|
|
||||||
// CreateKeyPairConfig describes how an SSH key pair should be created.
|
|
||||||
type CreateKeyPairConfig struct {
|
|
||||||
// Type describes the key pair's type.
|
|
||||||
Type KeyPairType
|
|
||||||
|
|
||||||
// Bits represents the key pair's bits of entropy. E.g., 4096 for
|
|
||||||
// a 4096 bit RSA key pair, or 521 for a ECDSA key pair with a
|
|
||||||
// 521-bit curve.
|
|
||||||
Bits int
|
|
||||||
|
|
||||||
// Name is the resulting key pair's name. This is used to identify
|
|
||||||
// the key pair in the SSH server's 'authorized_keys'.
|
|
||||||
Name string
|
|
||||||
}
|
|
||||||
|
|
||||||
// KeyPair represents an SSH key pair.
|
// KeyPair represents an SSH key pair.
|
||||||
type KeyPair struct {
|
type KeyPair struct {
|
||||||
// PrivateKeyPemBlock represents the key pair's private key in
|
// PrivateKeyPemBlock represents the key pair's private key in
|
||||||
|
@ -236,6 +221,21 @@ func newRsaKeyPair(config CreateKeyPairConfig) (KeyPair, error) {
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CreateKeyPairConfig describes how an SSH key pair should be created.
|
||||||
|
type CreateKeyPairConfig struct {
|
||||||
|
// Type describes the key pair's type.
|
||||||
|
Type KeyPairType
|
||||||
|
|
||||||
|
// Bits represents the key pair's bits of entropy. E.g., 4096 for
|
||||||
|
// a 4096 bit RSA key pair, or 521 for a ECDSA key pair with a
|
||||||
|
// 521-bit curve.
|
||||||
|
Bits int
|
||||||
|
|
||||||
|
// Name is the resulting key pair's name. This is used to identify
|
||||||
|
// the key pair in the SSH server's 'authorized_keys'.
|
||||||
|
Name string
|
||||||
|
}
|
||||||
|
|
||||||
// rawPemBlock encodes a pem.Block to a slice of bytes.
|
// rawPemBlock encodes a pem.Block to a slice of bytes.
|
||||||
func rawPemBlock(block *pem.Block) ([]byte, error) {
|
func rawPemBlock(block *pem.Block) ([]byte, error) {
|
||||||
buffer := bytes.NewBuffer(nil)
|
buffer := bytes.NewBuffer(nil)
|
||||||
|
|
Loading…
Reference in New Issue