signing

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const AlgEd25519 = "ed25519"
View Source
const DevKeyWarning = "dev mode: ephemeral keypair generated; signatures will not verify across machines"

Variables

This section is empty.

Functions

func DigestJSON

func DigestJSON(input []byte) (string, error)

func KeyID

func KeyID(pub ed25519.PublicKey) string

func LoadPrivateKeyBase64

func LoadPrivateKeyBase64(path string) (ed25519.PrivateKey, error)

func LoadPublicKeyBase64

func LoadPublicKeyBase64(path string) (ed25519.PublicKey, error)

func LoadVerifyKey

func LoadVerifyKey(cfg KeyConfig) (ed25519.PublicKey, error)

func ParsePrivateKeyBase64

func ParsePrivateKeyBase64(encoded string) (ed25519.PrivateKey, error)

func ParsePublicKeyBase64

func ParsePublicKeyBase64(encoded string) (ed25519.PublicKey, error)

func VerifyBytes

func VerifyBytes(pub ed25519.PublicKey, sig Signature, data []byte) (bool, error)

func VerifyDigestHex

func VerifyDigestHex(pub ed25519.PublicKey, sig Signature) (bool, error)

func VerifyJSON

func VerifyJSON(pub ed25519.PublicKey, sig Signature, input []byte) (bool, error)

func VerifyManifestJSON

func VerifyManifestJSON(pub ed25519.PublicKey, sig Signature, manifestJSON []byte) (bool, error)

func VerifyTraceRecordJSON

func VerifyTraceRecordJSON(pub ed25519.PublicKey, sig Signature, traceJSON []byte) (bool, error)

Types

type KeyConfig

type KeyConfig struct {
	Mode           KeyMode
	PrivateKeyPath string
	PublicKeyPath  string
	PrivateKeyEnv  string
	PublicKeyEnv   string
}

type KeyMode

type KeyMode string
const (
	ModeDev  KeyMode = "dev"
	ModeProd KeyMode = "prod"
)

type KeyPair

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

func GenerateKeyPair

func GenerateKeyPair() (KeyPair, error)

func LoadSigningKey

func LoadSigningKey(cfg KeyConfig) (KeyPair, []string, error)

type Signature

type Signature struct {
	Alg          string `json:"alg"`
	KeyID        string `json:"key_id"`
	Sig          string `json:"sig"`
	SignedDigest string `json:"signed_digest,omitempty"`
}

func SignBytes

func SignBytes(priv ed25519.PrivateKey, data []byte) Signature

func SignDigestHex

func SignDigestHex(priv ed25519.PrivateKey, digestHex string) (Signature, error)

func SignJSON

func SignJSON(priv ed25519.PrivateKey, input []byte) (Signature, error)

func SignManifestJSON

func SignManifestJSON(priv ed25519.PrivateKey, manifestJSON []byte) (Signature, error)

func SignTraceRecordJSON

func SignTraceRecordJSON(priv ed25519.PrivateKey, traceJSON []byte) (Signature, error)

Jump to

Keyboard shortcuts

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