Skip to main content

Module shared

Module shared 

Source
Expand description

The shared tier (charter rule 9, ADR 0017).

A shared store is a directory of content-addressed, signed entry files that teams and CI share (a local path, an NFS mount, a synced folder). Nothing in it is trusted because of where it is: an entry is used only if it carries a valid ed25519 signature from a key the reader trusts, and the signature binds everything the reader relies on.

Layout. <store>/v2/<platform>/<solver binary sha256>/<k0k1>/<key>, so entries are scoped by solver binary and platform class (ADR 0010, item 6). The path is only a lookup hint: every field it encodes is also in the signed header and checked there.

Entry file. One JSON header line, then the exact reply bytes, like the local disk tier. The header holds the v2 key, the reply’s SHA-256, the command, the mode, the solver identity (name, version, binary SHA-256, platform), the effort (ADR 0009), the format version, the publication time, the signer’s key id and the signature. The signature covers a length-prefixed encoding of every one of those fields (see Header::signed_bytes), never the JSON text, so no JSON canonicalization is involved.

Keys. SecretKey and PublicKey are stored as one line of text: sail-ed25519-secret-v1 <hex> and sail-ed25519-public-v1 <hex>. A key id is the first 16 hex digits of the SHA-256 of the public key. Readers trust the public keys in <cache root>/trust/*.pub (TrustedKeys::load_dir).

Structs§

Header
The header line of a shared entry file.
PublicKey
An ed25519 public key that verifies shared entries.
PublishOptions
What publish exports.
PublishReport
What publish did.
SecretKey
An ed25519 signing key. Its bytes are wiped when it is dropped, and Debug never prints them.
SharedStore
A shared store: a directory reachable as a path.
Solver
The identity of the solver an entry was produced by: the fields of sail_key::SolverIdentity, with the binary hash as hex.
TrustedKeys
Public keys whose signatures a reader accepts.
Verified
A shared entry that passed every check.

Enums§

Rejection
Why a shared entry was not used. Every rejection is a miss.

Constants§

FORMAT
The format field of every shared entry header.
MAX_ENTRY_BYTES
Largest shared entry file read, in bytes. Larger files are rejected without being read.
MODE_DEFAULT
The only mode shared entries exist for today. Opt-in modes have keys of their own (charter rule 8) and would need their own trust decision.
PINNED_SOLVER
The provenance of replies the local daemon recorded from the pinned solver: the only ones publish exports.
PROVENANCE_PREFIX
Prefix of the provenance of every local entry copied from the shared tier. Such entries are never published again.
SHARED_VERSION
Version of the shared entry format. It is signed, so an entry can never be read under another version’s rules.

Functions§

add_trusted
Trusts key for the cache at root: writes <root>/trust/<id>.pub atomically, and returns its path.
publish
Exports disk’s entries to store, signed with secret.
sign_entry
Builds a signed shared entry file for reply, the reply of command under key, produced by solver.
trust_dir
The trust directory of a cache root: <root>/trust.
verify_entry
Checks a shared entry file’s contents for key, in this order: the header parses and has this format and version; it names key; its signer is trusted and the signature verifies over every header field; the reply hashes to the signed hash; the signed solver is local’s (name, version and binary), on local’s platform class; the mode is default; and the reply has the shape its command requires.
verify_entry_ref
Applies every check of verify_entry while borrowing the reply bytes. Servers can validate a large upload without allocating a second reply buffer.