barrel_design_statement (barrel_design v0.1.0)
View SourceSigned publication statements: the exact wire form.
A statement says that design name at version is published (with this manifest and these modules) or withdrawn, for source database db, signed by key key_id. Its signed payload is a CBOR map in deterministic encoding (RFC 8949 section 4.2.1: definite lengths, shortest integer forms, keys sorted by their encoded bytes) with text keys:
ctx: the textbarrel_design/statement/v1;action:publishorwithdraw;name: text, the manifest name rule (never contains:);version: unsigned, 1 to 2^63 - 1;db: text, the publishing database;manifest: 32-byte byte string, SHA-256 of the manifest digest form, or null for a withdrawal;modules: array of 32-byte byte strings sorted bytewise, without duplicates; empty for a withdrawal;key_id: text.
The manifest digest form is the normalized manifest's canonical form (barrel_design_manifest:canonical/1: atoms, tuples and binaries tagged as text) in the same encoding. The signature is Ed25519 (RFC 8032, pure) over the payload, so the same payload always signs to the same bytes.
The document id is barrel_design:<name>:<version>:<action>:<hex SHA-256 of the payload> (decimal version, lowercase hex): each signed statement has its own document. The body holds the payload fields as JSON values (digests as lowercase hex), manifest_body (the manifest's JSON form) for a publication, and signature (lowercase hex); module bytes are attachments named sha256-<hex>.
Summary
Functions
A publication's manifest agrees with its statement: it normalizes to the statement's name and version, its digest form hashes to the signed digest, and it runs exactly the signed modules.
The statement document: payload fields, the signature and, for a publication, the manifest's JSON form.
The SHA-256 of a normalized manifest's digest form.
A statement document, checked on its own: its fields are well formed and rebuild a payload whose digest and fields are the ones its id names. The signature and the manifest are checked by the caller, which knows the keys (verify/3, check_manifest/2).
The signed bytes of a statement.
The public key of an Ed25519 private key (its 32-byte seed).
Types
Functions
A publication's manifest agrees with its statement: it normalizes to the statement's name and version, its digest form hashes to the signed digest, and it runs exactly the signed modules.
The statement document: payload fields, the signature and, for a publication, the manifest's JSON form.
The SHA-256 of a normalized manifest's digest form.
-spec max_version() -> pos_integer().
-spec parse(map()) -> {ok, #{statement := statement(), payload := binary(), signature := binary(), manifest_body := map() | none}} | {error, malformed}.
A statement document, checked on its own: its fields are well formed and rebuild a payload whose digest and fields are the ones its id names. The signature and the manifest are checked by the caller, which knows the keys (verify/3, check_manifest/2).
The signed bytes of a statement.
The public key of an Ed25519 private key (its 32-byte seed).