identity

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package identity manages Ed25519 keypairs for verified-mode nodes. A node's identity is SHA-256(public_key) — the ID is derived from and bound to the keypair, making it cryptographically unforgeable without the private key.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NodeIDFrom

func NodeIDFrom(pub ed25519.PublicKey) string

func VerifySignature

func VerifySignature(pub ed25519.PublicKey, data, sig []byte) bool

Types

type Keypair

type Keypair struct {
	PublicKey  ed25519.PublicKey
	PrivateKey ed25519.PrivateKey
	NodeID     string
	TLSCert    tls.Certificate
}

Keypair holds an Ed25519 identity. NodeID is SHA-256(PublicKey). TLSCert CN equals NodeID.

func Generate

func Generate() (*Keypair, error)

func LoadOrGenerate

func LoadOrGenerate(path string) (*Keypair, error)

LoadOrGenerate reads a keypair from path, generating and persisting one if absent (mode 0600).

func (*Keypair) Sign

func (kp *Keypair) Sign(data []byte) []byte

Jump to

Keyboard shortcuts

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