Skip to main content

Module checkpoint

Module checkpoint 

Source
Expand description

The C2SP checkpoint (https://c2sp.org/tlog-checkpoint) as a signed note (https://c2sp.org/signed-note), and the witness cosignature (https://c2sp.org/tlog-cosignature) over it.

A checkpoint is three lines, the origin, the decimal size and the base64 root, plus optional extension lines. A note is that text, a blank line and signature lines — <name> base64(key id || signature). A log signs the note text with Ed25519 under key id SHA-256(name || 0x0A || 0x01 || public key)[:4]; a witness cosigns the lines cosignature/v1, time <posix seconds> and the checkpoint lines, under key id SHA-256(name || 0x0A || 0x04 || public key)[:4], with the eight-byte big-endian timestamp between key id and signature.

Structs§

Checkpoint
What a log publishes: its origin, its size and the root at that size.
Cosignature
A witness cosignature on a checkpoint.
Cosigner
A witness key that cosigns checkpoints; the counterpart of verify_cosignatures, for logs that also act as their own witness and for tests.
Note
A note: text, a blank line, signature lines.
NoteSignature
One signature line of a note.
Signer
A log’s signing key under its name (the origin, by the checkpoint spec).
Verifier
A public key under a name, with the id a verifier matches lines on.

Constants§

ED25519_COSIGNATURE
The signature type byte of an Ed25519 witness cosignature.
ED25519_LOG
The signature type byte of an Ed25519 log signature.

Functions§

cosignature_message
The message a cosignature/v1 signs over the checkpoint text at timestamp.
cosignature_payload
A cosignature line’s payload, after the key id: the eight-byte big-endian timestamp and the Ed25519 signature.
key_id
The key id of a key under a name: the first four bytes of SHA-256(name || 0x0A || type || public key).
verify
Checks a note’s log signatures against trusted log keys: a line whose name and key id match a trusted key has to verify, lines from unknown keys are ignored, and at least one trusted key has to have signed. Returns the trusted keys that verified, in note order.
verify_cosignatures
Checks the cosignature/v1 lines of note against witnesses: a line whose name and key id match a witness has to verify over cosignature/v1, time <t> and the note text. Returns each verified witness with its timestamp, in note order; lines from unknown keys are ignored. A trusted witness that signed nothing is not an error; a witness line that does not verify is.