# GUESTBOOK — publish a signed record

Send `GUESTBOOK` or `HELP GUESTBOOK` for this guide. Use verified TLS or WSS for data commands.
The command and signed bytes follow JMPKit's format; this HELLO/1 server replies with one JSON object.

    GUESTBOOK POST <base64-signature> <exact-json-object>
    GUESTBOOK GET <base64-public-key> "string key"
    GUESTBOOK BROWSE {"limit":20}
    GUESTBOOK BROWSE {"since":1795824000,"limit":20}
    GUESTBOOK BROWSE {"page":"<next>"}
    GUESTBOOK FOLLOW {"after":"<cursor>","limit":20}

BROWSE lists current non-deleted entries newest first. Save the first page's
cursor, finish paging with `next`, then FOLLOW from that cursor. FOLLOW retains
4,096 changes, including deletes; on `resync:true` restart BROWSE. Use GET
with a listed public key and key to verify the exact signed record. Historical
records accepted before indexing remain accessible by GET without republishing.

Sign the UTF-8 bytes of `JMPKit GUESTBOOK v1`, one LF, then the exact JSON object.
Use Ed25519 and standard padded Base64 for the signature and the raw 32-byte public key.
Required fields: `public_key`, `key` (JSON string), `guid` (UUID), `precedence`
(integer 0 through 9007199254740991) and `op`. For `SET`, include `payload`
(Base64, at most 65,536 decoded bytes). For `DELETE`, omit `payload`.

Example in Python (`cryptography`); `signer` is your Ed25519 private key:

```python
import base64, json, uuid
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat
b64 = lambda b: base64.b64encode(b).decode("ascii")
pub = b64(signer.public_key().public_bytes(Encoding.Raw, PublicFormat.Raw))
record = dict(public_key=pub, key="greeting", guid=str(uuid.uuid4()),
              precedence=1, op="SET", payload=b64(b"Hello"))
body = json.dumps(record, separators=(",", ":"))
sig = b64(signer.sign(b"JMPKit GUESTBOOK v1\n" + body.encode("utf-8")))
command = f"GUESTBOOK POST {sig} {body}"
```

Anyone may relay a signed packet or read a known signer/key pair. The current
packet can be retried unchanged; replacing it requires higher precedence.
GET returns `signature` and `signed_json` (a string: verify its UTF-8 bytes
without reserializing). DELETE leaves a readable signed marker that prevents
stale packets from restoring a record. A precedence conflict returns
`guestbook_precedence` with the current `precedence` and `guid`.

Local limits: 128 KiB per command, 512 distinct signer/key slots including
delete markers. At capacity existing slots can still be updated. Records persist
across service restarts; the public source kit contains no live records.
