ed25519

package
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

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

func StorePublicKey(file string, publicKey PublicKey, opts ...KeyOption) error

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.

func WritePublicKey

func WritePublicKey(writer io.Writer, publicKey PublicKey, opts ...KeyOption) error

WritePublicKey writes the public key to the writer.

Types

type Config

type Config struct {
	// contains filtered or unexported fields
}

func (*Config) Apply

func (c *Config) Apply(opts ...Option) *Config

type KeyConfig

type KeyConfig struct {
	// contains filtered or unexported fields
}

func (*KeyConfig) Apply

func (kc *KeyConfig) Apply(opts ...KeyOption) *KeyConfig

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

func WithKeyDecodePublic(decode func(data []byte) (ed25519.PublicKey, error)) KeyOption

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

func WithKeyEncodePublic(encode func(key ed25519.PublicKey) ([]byte, error)) KeyOption

WithKeyEncodePublic sets encode to key config.

func WithKeyRandom

func WithKeyRandom(random io.Reader) KeyOption

WithKeyRandom sets random to key config.

func WithKeySeed

func WithKeySeed(seed []byte) KeyOption

WithKeySeed sets seed to key config.

type Option

type Option func(conf *Config)

func WithBase64

func WithBase64() Option

WithBase64 sets base64 encoding to config.

func WithContext

func WithContext(context string) Option

WithContext sets context to config.

func WithCryptoHash

func WithCryptoHash(hash crypto.Hash) Option

WithCryptoHash sets crypto hash to config.

func WithHex

func WithHex() Option

WithHex sets hex encoding 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.

func (PrivateKey) Sign

func (pk PrivateKey) Sign(data []byte, opts ...Option) []byte

Sign signs data.

type PublicKey

type PublicKey struct {
	// contains filtered or unexported fields
}

func LoadPublicKey

func LoadPublicKey(file string, opts ...KeyOption) (PublicKey, error)

LoadPublicKey loads the public key from the file.

func ReadPublicKey

func ReadPublicKey(reader io.Reader, opts ...KeyOption) (PublicKey, error)

ReadPublicKey reads the public key from the reader.

func (PublicKey) Verify

func (pk PublicKey) Verify(data []byte, sign []byte, opts ...Option) error

Verify verifies data with sign.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL