trust

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package trust is the trust store for package signing keys (ADR-0043): it answers "is this public key approved to sign this package id?" — nothing about whether a signature is cryptographically valid in the first place, that's internal/packaging.Verify's job. Trust is bound to the pair (package id, public key), not the key alone.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("trusted key not found")

ErrNotFound is returned by Remove when no trusted key matches the given id and public key.

View Source
var ErrSignatureRequired = errors.New("package requires a trusted signature")

ErrSignatureRequired is returned by CheckPolicy when requireSignature is true and the package is not signed by a key trusted for id.

Functions

func Add

func Add(ctx context.Context, db *sql.DB, id string, pub ed25519.PublicKey, label string) error

Add records pub as trusted for id. Re-adding the same (id, pub) pair updates its label and trusted_at instead of failing — approving a key twice is not an error.

func IsTrusted

func IsTrusted(ctx context.Context, db *sql.DB, id string, pub ed25519.PublicKey) (bool, error)

IsTrusted reports whether pub is recorded as trusted for id.

func Remove

func Remove(ctx context.Context, db *sql.DB, id string, pub ed25519.PublicKey) error

Remove revokes trust for the (id, pub) pair. It returns ErrNotFound if no such trusted key was recorded.

Types

type PolicyResult

type PolicyResult struct {
	Outcome packaging.VerificationOutcome
	Trusted bool
}

PolicyResult is what CheckPolicy found for one package install: its raw verification outcome (internal/packaging.Verify), plus whether its signer (if any) is trusted for its id. Callers (internal/apps, internal/plugins, internal/bundles InstallPackage) return this to their own caller so the CLI can print an accurate warning even when requireSignature is false and the install proceeds anyway.

func CheckPolicy

func CheckPolicy(ctx context.Context, db *sql.DB, id string, outcome packaging.VerificationOutcome, requireSignature bool) (PolicyResult, error)

CheckPolicy decides whether an InstallPackage call should proceed, given a package's already-computed verification outcome: it looks up whether outcome.PublicKey is trusted for id (only meaningful when the package is signed at all), then — if requireSignature is true — fails unless the package is both signed and trusted.

It never second-guesses outcome itself: a checksum mismatch or an invalid signature already aborted the install before CheckPolicy is ever called (see internal/packaging.Verify) — this function only decides what to do about a package that is cryptographically sound but possibly unsigned or signed by a key nobody has approved yet.

type TrustedKey

type TrustedKey struct {
	ID        string
	PublicKey ed25519.PublicKey
	Label     string
	TrustedAt time.Time
}

TrustedKey is one approved (package id, public key) pair, as recorded in the database.

func List

func List(ctx context.Context, db *sql.DB, id string) ([]TrustedKey, error)

List returns every trusted key recorded for id, most recently trusted first. An empty id lists every trusted key regardless of package id.

Jump to

Keyboard shortcuts

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