Files
core/trust/README.md
T

49 lines
2.2 KiB
Markdown
Raw Normal View History

# yetano.dev/yetano/core/trust
The verifying half of the family's publisher signatures, shared by every
program that pulls signed content: yet (packages) and yacota (images)
check against the same files, so a host makes one trust decision.
```text
module yetano.dev/yetano/core/trust tags: trust/v0.1.0, ... go 1.25
```
A nested module of the core repository, like `core/tui`, so the main core
module stays free of minisign. Depends on `aead.dev/minisign` (MIT) and
core (`core/paths`, for `Home`). Moved from `yet/internal/trust`
(2026-11-12) without changing behavior or file formats; signing, key
storage, PEM and the registry side stay in yet.
## What it is
- **Signatures:** minisign (Ed25519) over the resolved OCI manifest
digest, as the JSON payload (`Signature`, media and artifact type
`application/vnd.yetano.signature.v1+json`) of an OCI 1.1 referrer
on that digest. `Verify(subjectDigest, payloads)` checks fetched
referrers (the caller fetches them with its own registry client);
valid signatures whose key IDs collide are made invalid.
- **Known keys** (`known-keys.json`, TOFU like SSH's known_hosts):
`Reconcile` pins a repository's first valid signer and refuses later
content signed only by other keys (an error that `errors.Is`
`ErrRefused`). A key is compared as the key (`SameKey`), never by its
ID alone.
- **Trust policy** (`trust-policy.json`, edited with `yet trust
policy`): rules per namespace pattern naming allowed keys,
`require_signatures`; `Evaluate`, `AllowsCapability`, `Curated`.
- **Where:** `Home(scope)` is yet's data directory (core/paths' DataDir
for "yet"), `DefaultPolicyPath(home)`, `DefaultKnownKeysPath(home)`.
## Use
```go
home, _ := trust.Home(core.UserScope)
verified := trust.Verify(manifestDigest, payloads) // fetched referrers
if err := trust.Reconcile(trust.DefaultKnownKeysPath(home), "registry/repo", verified); err != nil {
return err // errors.Is(err, trust.ErrRefused): the pinned key changed
}
policy, _ := trust.LoadPolicy(trust.DefaultPolicyPath(home))
if d := policy.Evaluate(name, kind, verified); !d.Trusted { ... }
```
`Warn` (a variable) reports warnings that are not errors, on standard
error by default.