Documentation
¶
Index ¶
- func GenerateKeys(opts ...KeyOption) (PrivateKey, PublicKey, error)
- func StorePrivateKey(file string, privateKey PrivateKey, opts ...KeyOption) error
- func StorePublicKey(file string, publicKey PublicKey, opts ...KeyOption) error
- func WritePrivateKey(writer io.Writer, privateKey PrivateKey, opts ...KeyOption) error
- func WritePublicKey(writer io.Writer, publicKey PublicKey, opts ...KeyOption) error
- type Config
- type KeyConfig
- type KeyOption
- func WithKeyDecodePrivate(decode func(data []byte) (ed25519.PrivateKey, error)) KeyOption
- func WithKeyDecodePublic(decode func(data []byte) (ed25519.PublicKey, error)) KeyOption
- func WithKeyEncodePrivate(encode func(key ed25519.PrivateKey) ([]byte, error)) KeyOption
- func WithKeyEncodePublic(encode func(key ed25519.PublicKey) ([]byte, error)) KeyOption
- func WithKeyRandom(random io.Reader) KeyOption
- func WithKeySeed(seed []byte) KeyOption
- type Option
- type PrivateKey
- type PublicKey
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateKeys ¶
func GenerateKeys(opts ...KeyOption) (PrivateKey, PublicKey, error)
GenerateKeys generates a private key and a public key.
func StorePrivateKey ¶
func StorePrivateKey(file string, privateKey PrivateKey, opts ...KeyOption) error
StorePrivateKey stores the private key to the file.
func StorePublicKey ¶
StorePublicKey stores the public key to the file.
func WritePrivateKey ¶
func WritePrivateKey(writer io.Writer, privateKey PrivateKey, opts ...KeyOption) error
WritePrivateKey writes the private key to the writer.
Types ¶
type KeyOption ¶
type KeyOption func(conf *KeyConfig)
func WithKeyDecodePrivate ¶
func WithKeyDecodePrivate(decode func(data []byte) (ed25519.PrivateKey, error)) KeyOption
WithKeyDecodePrivate sets decode to key config.
func WithKeyDecodePublic ¶
WithKeyDecodePublic sets decode to key config.
func WithKeyEncodePrivate ¶
func WithKeyEncodePrivate(encode func(key ed25519.PrivateKey) ([]byte, error)) KeyOption
WithKeyEncodePrivate sets encode to key config.
func WithKeyEncodePublic ¶
WithKeyEncodePublic sets encode to key config.
func WithKeyRandom ¶
WithKeyRandom sets random to key config.
type Option ¶
type Option func(conf *Config)
func WithCryptoHash ¶
WithCryptoHash sets crypto hash to config.
type PrivateKey ¶
type PrivateKey struct {
// contains filtered or unexported fields
}
func LoadPrivateKey ¶
func LoadPrivateKey(file string, opts ...KeyOption) (PrivateKey, error)
LoadPrivateKey loads the private key from the file.
func ReadPrivateKey ¶
func ReadPrivateKey(reader io.Reader, opts ...KeyOption) (PrivateKey, error)
ReadPrivateKey reads the private key from the reader.
type PublicKey ¶
type PublicKey struct {
// contains filtered or unexported fields
}
func LoadPublicKey ¶
LoadPublicKey loads the public key from the file.
func ReadPublicKey ¶
ReadPublicKey reads the public key from the reader.