trust: the signing half of publisher signatures
Moved from yet's internal/trust without changing behavior or file formats: KeyPair, GenerateKey, SaveKeyPair, LoadPrivateKey, ParsePrivateKey, LoadPublicKey, MarshalPublicKey, SignEd25519, VerifyEd25519, ExportPEM, ImportPEM, and the package signature as SignDigest. New: Sign and VerifyMessage, a detached minisign signature over any bytes and its check (returns the trusted comment; another key with a colliding ID fails), and KeyFromRef, a key pair from a core/secretref reference with error messages that never carry the secret. A golden vector (testdata/sign-vector.*) pins the output, and VerifySignature is tested against what SignDigest makes. For yabar's evidence signing (ADR-0037 there, owner decision Q-5 option A); yet keeps registry signing and its auto-sign key store. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9395fadbf7
commit
e1495430c5
10 files changed
+586
-7
No files matched your search
+35
-7
@@ -1,18 +1,22 @@
|
||||
# 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.
|
||||
The family's minisign (Ed25519) signatures: verifying, 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 -- and
|
||||
signing, shared by every program that signs: yet (packages,
|
||||
attestations) and yabar (evidence records, ADR-0037 there).
|
||||
|
||||
```text
|
||||
module yetano.dev/yetano/core/trust tags: trust/v0.1.0, ... go 1.25
|
||||
module yetano.dev/yetano/core/trust tags: trust/v0.1.0, trust/v0.2.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.
|
||||
core (`core/paths`, for `Home`; `core/secretref`, for `KeyFromRef`).
|
||||
Moved from `yet/internal/trust` without changing behavior or file
|
||||
formats: the verifying half on 2026-11-12 (trust/v0.1.0), the signing
|
||||
half on 2026-11-27 (trust/v0.2.0). Pushing signatures to a registry and
|
||||
where auto-sign keeps its keys stay in yet.
|
||||
|
||||
## What it is
|
||||
|
||||
@@ -33,6 +37,22 @@ storage, PEM and the registry side stay in yet.
|
||||
- **Where:** `Home(scope)` is yet's data directory (core/paths' DataDir
|
||||
for "yet"), `DefaultPolicyPath(home)`, `DefaultKnownKeysPath(home)`.
|
||||
|
||||
- **Keys:** `KeyPair`, `GenerateKey`, `SaveKeyPair(path, kp, password)`
|
||||
(private key owner-only, `<path>.pub` beside it; the minisign CLI's
|
||||
formats, scrypt-encrypted with a password), `LoadPrivateKey`,
|
||||
`ParsePrivateKey`, `LoadPublicKey`, `MarshalPublicKey`, and
|
||||
`KeyFromRef(ctx, resolver, keyRef, passwordRef)` for a key held as a
|
||||
secret reference (`secret://...` in yaseva, `env:`, `file:`).
|
||||
- **Signing:** `SignDigest(kp, digest)` makes the package signature
|
||||
`VerifySignature` checks; `Sign(kp, message, trustedComment,
|
||||
untrustedComment)` makes a detached `.minisig` over any bytes, and
|
||||
`VerifyMessage(pub, message, sig)` checks it and returns the trusted
|
||||
comment (`minisign -Vm` checks it too); `SignEd25519`/`VerifyEd25519`
|
||||
are plain Ed25519 for DSSE envelopes; `ExportPEM`/`ImportPEM` for
|
||||
cosign and openssl.
|
||||
- **Vector:** `testdata/sign-vector.*` -- a published test key, a
|
||||
message and its signature; every version must produce and accept it.
|
||||
|
||||
## Use
|
||||
|
||||
```go
|
||||
@@ -45,5 +65,13 @@ policy, _ := trust.LoadPolicy(trust.DefaultPolicyPath(home))
|
||||
if d := policy.Evaluate(name, kind, verified); !d.Trusted { ... }
|
||||
```
|
||||
|
||||
Signing:
|
||||
|
||||
```go
|
||||
kp, err := trust.KeyFromRef(ctx, secretref.New(""), "secret://yabar/evidence/minisign", "")
|
||||
sig, err := trust.Sign(kp, recordBytes, "yabar evidence <test_id> <repository_id>", "")
|
||||
comment, err := trust.VerifyMessage(pub, recordBytes, sig)
|
||||
```
|
||||
|
||||
`Warn` (a variable) reports warnings that are not errors, on standard
|
||||
error by default.
|
||||
Reference in new issue
Block a user