Documentation
¶
Overview ¶
Package libtrust decides whether the device libraries and framework a build compiles are ones the user approved. The Volt IDE is the only approver: it holds the private half of a per-computer Ed25519 key, and each approval is a signed record of a library's exact bytes in ~/.volt/trust/approved.json. A library an AI agent (or anything else) writes or changes no longer matches its record, so `volt build` refuses it until the user reviews it in the IDE.
The store is tamper-evident, not tamper-proof: records can't be forged without the private key, but a same-user process could swap local.pub and re-sign. The IDE pins the key's fingerprint in the OS keychain and flags that.
Index ¶
- Constants
- func Approve(dir string, privPEM []byte, libs []Library, source, version string) error
- func BundledDigests(sdk fs.FS) map[string]string
- func Digest(fsys fs.FS, root string) (string, error)
- func Dir() (string, error)
- func Fingerprint(pub ed25519.PublicKey) string
- func Init(dir string, force bool) ([]byte, error)
- func Revoke(dir string, names []string) error
- type Entry
- type Library
- type Status
- type Store
Constants ¶
const Framework = "@framework"
Framework is the store name of the framework tree (device prefixes are C identifiers, so it can't collide with one).
Variables ¶
This section is empty.
Functions ¶
func Approve ¶
Approve signs the current digest of each library into the store, using the private key PEM (which must match local.pub).
func BundledDigests ¶
BundledDigests digests a built-in SDK tree (devices/, framework/).
func Digest ¶
Digest hashes every file under root in fsys: sorted slash paths relative to root, each as "path\0size\0bytes". Anything but a regular file or directory (a symlink could pull in code from outside) is an error.
func Fingerprint ¶
Fingerprint identifies a public key.
Types ¶
type Entry ¶
type Entry struct {
Hash string `json:"hash"`
Version string `json:"version,omitempty"`
Source string `json:"source"` // sdk-baseline | local | ai | registry:<keyId>
ApprovedAt string `json:"approvedAt"`
Sig string `json:"sig"`
}
Entry is one approval: the digest of a library's files when it was approved.
type Library ¶
type Library struct {
Name string // device prefix, or Framework
FS fs.FS
Root string
// Key is where its approvals are recorded; "" means Name. A project's own
// libraries are keyed by the project's folder, so two projects can each
// have a library of the same name without sharing approvals.
Key string
}
Library is one thing a build compiles: a device folder or the framework.
func Libraries ¶
Libraries lists the framework and every device folder (one holding a device.json) in sdkDir's layout: <framework>/, <devices>/<prefix>/.
func ProjectLibraries ¶
ProjectLibraries lists the project's own device libraries (<project>/devices/<prefix>/ holding a device.json). None is not an error.
type Status ¶
type Status struct {
Name string `json:"name"`
Hash string `json:"hash"`
State string `json:"state"` // approved | changed | unapproved | invalid | unreadable
Detail string `json:"detail,omitempty"`
Source string `json:"source,omitempty"`
Version string `json:"version,omitempty"`
ApprovedAt string `json:"approvedAt,omitempty"`
MatchesBundled bool `json:"matchesBundled"` // bytes equal this CLI's built-in copy
Bundled bool `json:"bundled"` // Volt ships a library by this name
// ApprovedHashes are the versions with a valid approval (newest last).
ApprovedHashes []string `json:"approvedHashes"`
}
Status of one library against the store.