@@ -89,8 +89,25 @@ func decodeKey(data string, size int) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewPrivateKey() (PrivateKey, error)
|
||||||
|
|
||||||
|
func (PrivateKey) Public() PublicKey
|
||||||
|
|
||||||
// KeyPair holds a Key pair
|
// KeyPair holds a Key pair
|
||||||
type KeyPair struct {
|
type KeyPair struct {
|
||||||
PrivateKey PrivateKey
|
PrivateKey PrivateKey
|
||||||
PublicKey PublicKey
|
PublicKey PublicKey
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewKeyPair() (*KeyPair, error) {
|
||||||
|
key, err := NewPrivateKey()
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
out := &KeyPair{
|
||||||
|
PrivateKey: key,
|
||||||
|
PublicKey: key.Public(),
|
||||||
|
}
|
||||||
|
return out, nil
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user