Documentation
¶
Overview ¶
Package signing manages Ed25519 key pairs used to sign and verify packages (.patchcord-plugin, .patchcord-app, .patchcord-bundle). It only deals with key material on disk — computing checksums, signing them, and verifying a signature against a package's content is internal/packaging's job; deciding whether a given public key is legitimate for a given package id is internal/trust's.
Index ¶
- Constants
- func Fingerprint(pub ed25519.PublicKey) string
- func GenerateKeyPair() (ed25519.PublicKey, ed25519.PrivateKey, error)
- func LoadPrivateKey(path string) (ed25519.PrivateKey, error)
- func LoadPublicKey(path string) (ed25519.PublicKey, error)
- func WriteKeyPair(path string, pub ed25519.PublicKey, priv ed25519.PrivateKey) error
Constants ¶
const PublicKeyExtension = ".pub"
PublicKeyExtension is appended to a private key's path to name its public counterpart (e.g. "my-key" -> "my-key.pub"), the same convention ssh-keygen uses.
Variables ¶
This section is empty.
Functions ¶
func Fingerprint ¶
Fingerprint returns a short, human-comparable digest of pub for CLI output (e.g. "warn: signed by untrusted key <fingerprint>"). It is purely cosmetic — every actual trust decision (internal/trust.IsTrusted) compares the full public key, never this truncated form.
func GenerateKeyPair ¶
func GenerateKeyPair() (ed25519.PublicKey, ed25519.PrivateKey, error)
GenerateKeyPair returns a new random Ed25519 key pair.
func LoadPrivateKey ¶
func LoadPrivateKey(path string) (ed25519.PrivateKey, error)
LoadPrivateKey reads and decodes a private key file produced by WriteKeyPair.
func LoadPublicKey ¶
LoadPublicKey reads and decodes a public key file produced by WriteKeyPair (path+PublicKeyExtension).
func WriteKeyPair ¶
WriteKeyPair writes priv to path (base64, 0o600) and pub to path+PublicKeyExtension (base64, 0o644). The private key is written through a temp file + rename, so a reader never observes a partially written key file — same pattern as secrets.FileStore's vault writes.
Types ¶
This section is empty.