Expand description
The one canonical form an entitlement is signed over, and the verify side.
Signing lives in monetize (it has the key); verifying lives here because a product
must check a fact without linking the core (redb, vendors). Core depends on this
crate for fact_message so there is exactly one canonical form.
Canonical JSON: the fact’s fields minus signature, objects with keys sorted
bytewise, no whitespace. serde_json’s map is sorted by default but that is a cargo
feature (preserve_order) any crate in the build could flip, so the sort is done
here, explicitly, and does not depend on it.
Structs§
- GoAhead
- The go-ahead a data-set growth is started on, as gunnar’s
gunnar_server::grow::go_ahead::GoAheadparses it: - Snapshot
- A signed set of facts, the file monetize hands a product so it can start (or restart) with the full picture before any push arrives.
Enums§
Constants§
- GO_
AHEAD_ SIGNER_ MONETIZE - The signer word a monetize-minted go-ahead carries.
Functions§
- base64_
decode - The inverse;
Noneon anything that is not padded standard base64. - base64_
encode - Standard base64, padded — the alphabet
GoAhead.signatureis written in. Twenty lines here rather than a dependency the two crates that need it (this one andmonetize) would otherwise add for one field. - canonical_
json - Write
valueas canonical JSON: keys sorted, no whitespace. - fact_
message - The V1 form: every field except
signature,issued_unix_msandissued_signature. - fact_
message_ issued - The V2 form:
fact_messageplusissued_unix_ms. WhatEntitlementFact::issued_signaturecovers, and the reason the issue time cannot be added, moved or bumped by anyone but monetize. - go_
ahead_ message - The bytes a go-ahead’s signature covers: every field except
signature, canonical. - snapshot_
message - The bytes a snapshot’s envelope signature covers. The facts inside keep their own signatures (they are part of the message), so a snapshot vouches for the set.
- verify_
fact - Both halves. The V1 signature always, and the V2 signature whenever the fact carries an issue time.
- verify_
go_ ahead - Parse the bytes handed on the wire and verify the signature under
key. Structure first (so a refusal names what is wrong), then the signature. - verify_
snapshot - Envelope first, then every fact: one forged fact rejects the whole snapshot.