sign

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyPair

type KeyPair struct {
	Public  ed25519.PublicKey
	Private ed25519.PrivateKey
}

func GenerateKeyPair

func GenerateKeyPair() (*KeyPair, error)

GenerateKeyPair creates a new random Ed25519 identity key.

func LoadPrivateKeyFromPEM

func LoadPrivateKeyFromPEM(pemBytes []byte) (*KeyPair, error)

LoadPrivateKeyFromPEM parses a PEM block back into a KeyPair. Derives the public key from the private key automatically.

func (*KeyPair) Bytes

func (k *KeyPair) Bytes() ([]byte, []byte)

Bytes returns the raw bytes.

func (*KeyPair) PrivateToPEM

func (k *KeyPair) PrivateToPEM() []byte

ToPEM encodes the private key to a PEM block.

func (*KeyPair) PublicToPEM

func (k *KeyPair) PublicToPEM() []byte

PublicToPEM encodes the public key to PEM.

type Signer

type Signer struct{}

func NewSigner

func NewSigner() *Signer

func (*Signer) Sign

func (s *Signer) Sign(message []byte, privateKey ed25519.PrivateKey) []byte

Sign creates a digital signature for the message.

func (*Signer) Verify

func (s *Signer) Verify(message []byte, signature []byte, publicKey ed25519.PublicKey) bool

Verify checks if the signature is valid for the given message and public key.

Jump to

Keyboard shortcuts

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