Expand description
Signed objects (specification §4.1–4.6).
Each object has a canonical encoding (§3.1) starting with its format byte (0x01), a
fixed signature context (§3.5) and per-field rules checked on both encode and decode, so an
object that encodes also decodes. A Signed<T> only exists after signing or after
verifying the signature before decoding (§3.6).
The pure validity rules take the verifier’s state and now_ms as parameters:
validate_descriptor / validate_pair (§4.3), verify_chain (§4.6),
MemberKeyRegistration::verify_for_host (§4.4) and
HostSessionProof::verify_for_client (§4.5).
Structs§
- Accepted
State - What a verifier stores per community for anti-rollback (rule 5).
- Admission
Summary AdmissionSummary = mode u8 ‖ level u8: the owner’s public claim; the host’s policy is authoritative for enforcement.- BotPackage
- The signed header of a bot package (§4.9), signed by the publisher key inside it.
- Chain
Head - Every root key of a verified chain,
K₀(genesis) toKₙ(current). Onlysuper::verify_chaincreates one. - Community
Descriptor - The community’s public, owner-signed statement. Signed by the current root key.
- Delegation
Ref DelegationRef = epoch u64 ‖ delegation_hash bytes[32], wheredelegation_hashisSHA3-256of the delegation’s canonical bytes (not its signature).- Export
Manifest - Signed by the exporting host’s key (and, in a later version, the root key when the owner exports). The key is inside the bytes: an importer trusts it only once it matches a host delegation signed by the community’s root (ADR-0013).
- Host
Delegation - The root key’s authorisation of one host to operate the community.
- Host
Session Proof - The host’s proof of key possession in
session.welcome. Signed by the host key. - Manifest
Entry - One chunk: what it is, its length and its
SHA3-256. - Member
KeyRegistration - Proves that the client holds the private key of the member key it registers. Signed by that key.
- Member
Reauth - Signed by the member key. Binds the challenge to the community, the new host and the delegation epoch it operates under, so a proof made for one host or epoch is useless at another.
- Parsed
Package - The parts of a
.zbotfile, not yet verified. - Reauth
Expectation - What the host expects of a reauthentication: the envelope’s community, this host, the epoch it operates under and the connection’s current challenge.
- Registration
Expectation - What the host expects of a registration: the command’s fields and the connection’s current challenge (§4.4).
- Root
Rotation - The replacement of the community’s root key, signed by the old and the new key.
- Scopes
- Delegation scopes (field 6). Unknown bits are kept for re-encoding, are ignored and grant nothing.
- Signed
- A signed object whose signature has been made or verified, with its exact bytes.
- Signed
Root Rotation - A rotation with both signatures, unverified (verify with
super::verify_chain). - Valid
Descriptor - A descriptor that passed rule 1 and the descriptor parts of rule 5.
- Valid
Pair - A (descriptor, delegation) pair valid at the time it was checked, with the state to store.
Only
validate_paircreates one. - Verified
Package - A package whose signature (unless unsigned was allowed), hashes and manifest ids were checked.
Enums§
- Admission
Mode AdmissionSummary.mode.- Discovery
discovery(field 17).- Package
Error - A
.zbotfile that does not verify. - Purpose
- Why a member key is registered (field 2). Other values are reserved and rejected.
- Registration
Error - A
MemberKeyRegistrationis not acceptable to the host (specification §4.4). - Rotation
Error - The rotation chain does not verify (specification §4.6).
indexis 1-based. - Session
Proof Error - A
HostSessionProofis not acceptable to the client (specification §4.5). - Signed
Error - Signing, verifying, encoding or decoding one signed object failed.
- Validity
Error - A (descriptor, delegation) pair is not valid (specification §4.3).
- Verification
Level AdmissionSummary.level: verification level None … Highest (governance.md).
Constants§
- APP_
ID_ MAX - Bytes of
app_id(3–64). - CLOCK_
SKEW_ MS - Clock-skew allowance on delegation validity windows (rule 4), in milliseconds.
- ENTRY_
NAME_ MAX - Bytes per chunk name.
- EXPORT_
FORMAT - The bundle format this manifest describes.
- FORMAT_
V1 - The
formatbyte of every v1 signed object. - MANIFEST_
ENTRIES_ MAX - At most this many chunks.
- PACKAGE_
FORMAT - The package format this header describes.
- PACKAGE_
MAGIC - The file’s first four bytes.
- PACKAGE_
VERSION - The container version byte after the magic.
- SUPPORTED_
WORLDS - The
zaun:botworlds a host built from this crate runs; a package for any other is refused at install and update (it could never load). Kept equal to the bot runtime’s list. - VERSION_
MAX - Bytes of
version. - WORLD_
MAX - Bytes of
world.
Traits§
- Signed
Object - A signed object type: its canonical encoding (format byte first) and its context.
Functions§
- claimed_
genesis - The claimed genesis key: the first rotation’s
old_root, or the descriptor’sroot_public_keywhen the chain is empty (§4.6). - compare_
versions - Semantic Versioning precedence of two versions;
Nonewhen either is invalid. An update must beOrdering::Greaterthan the installed version (§8.13). - parse_
package - Splits a
.zbotfile into its parts, checking every limit and that nothing trails. - valid_
app_ id - Lowercase reverse-DNS:
[a-z0-9-]+(\.[a-z0-9-]+)+, 3–64 bytes. - valid_
version - Semantic Versioning 2.0.0 without build metadata, ≤ 64 bytes.
- valid_
world zaun:bot/bot@<semver>, ≤ 64 bytes.- validate_
descriptor - Rule 1 and the descriptor parts of rule 5:
chainis the full rotation chain from the genesis key (community.rotations),acceptedthe verifier’s stored state, if any. - validate_
pair - Whether a (descriptor, delegation) pair is valid at
now_ms(§4.3 rules 1–5).chainis the full rotation chain from the genesis key;acceptedis the verifier’s stored state for the community, if any. On success the returned pair carries the state to store. - verify_
chain - Verifies a rotation chain from the genesis key (§4.6):
genesismust derivecommunity_id; for rotationi(1-based, list order)sig_oldverifies underKᵢ₋₁before decoding, thencommunity_id,rotation_seq = i,old_root = Kᵢ₋₁,new_suite ≥the previous suite andsig_newundernew_rootare checked. - verify_
package - Verifies the signature under the header’s publisher key (
min_suite1) before anything else, then both hashes and the manifest’sapp_idandversion. An all-zero signature is accepted only withallow_unsigned. - write_
package - Writes a
.zbotfile from a signed header and its parts. The caller computed the header’s hashes from these exactmanifestandcomponentbytes. - write_
unsigned_ package - Writes an unsigned development
.zbotfile (all-zero signature, §4.9).