LockerReceipt format

Locker receipt format

This is the format of a Locker receipt, version 1 (schema locker.receipt/1): what is hashed, what is signed, and how to check one receipt or a chain of them with your own code. A change to any rule on this page is a new schema version, never an edit in place.

You do not need to write a verifier to trust a receipt. The receipt page checks one in your browser, and the export carries a verifier that runs offline. This page is for anyone who wants to check our work independently. For the same thing in plain words, read How a receipt works.

Test vectors: locker-receipt-vectors.json. FlurryPORT’s own writer and its verifiers are tested against this file, so an implementation that passes the vectors agrees with ours.

What a receipt proves

FlurryPORT recorded these bytes, at this position in this install’s chain, at this time, and signed that statement with the install’s key. An install is one connected workflow or connector; each has its own chain and its own key.

A receipt does not prove who posted the bytes: the install key is a bearer credential. It is not a timestamp authority: the time is the recorder’s clock. Anyone holding a receipt can verify it with no account and no server, because the public key is on the receipt.

Canonical JSON

RFC 8785 (JCS). Object members are sorted by UTF-16 code units, with no whitespace. Strings are escaped with the minimal set: ", \, \b \f \n \r \t, and other controls below U+0020 as lowercase \u00xx. Everything else is literal, including non-ASCII. Numbers are printed as ECMAScript Number::toString prints them.

The receipt core holds strings and one integer, so its canonical form needs none of the number rules.

Hashes and encodings

SHA-256 everywhere, written as lowercase hex (64 characters). Signatures and key coordinates are base64url without padding. Times are UTC with milliseconds: yyyy-MM-ddTHH:mm:ss.fffZ.

The receipt core

{
  "schema":      "locker.receipt/1",
  "receiptId":   <the run's id, base62>,
  "installId":   <the install's id, base62>,
  "chainIndex":  <integer, starting at 1>,
  "prevHash":    <hash of the previous receipt; "" for the first>,
  "bodySha256":  <SHA-256 of the stored bytes>,
  "leafRoot":    <see Salted leaves; "" when the body is not JSON>,
  "capturedAt":  <UTC time, see Hashes and encodings>,
  "keyId":       <see Keys>
}
  • hash is SHA-256 of the JCS form of the core. It is the next receipt’s prevHash.
  • signature is ECDSA P-256 with SHA-256 over the same JCS bytes, in IEEE P1363 form (r || s, 64 bytes), base64url.
  • A signed receipt is the core plus hash, signature and publicKey.

There is one chain per install, and two runs never share a position. Removing a field (see Redaction) is itself a receipt in the chain, of kind redaction.

Keys

One P-256 key pair per install, generated when the install is created. The private half is stored encrypted, under the same envelope encryption as captured data: AES-256-GCM, with the data key wrapped by a key in Azure Key Vault. The public half is a JWK with exactly crv, kty, x and y, serialized in that order, which is its JCS form:

{"crv":"P-256","kty":"EC","x":"<base64url, 32 bytes>","y":"<base64url, 32 bytes>"}

keyId is the RFC 7638 thumbprint: base64url of the SHA-256 of that string. A verifier that pins a key compares thumbprints. One that does not uses the key on the receipt and reports which key it was.

Salted leaves

This is what lets one field be removed later without breaking verification. The body is parsed as JSON. Every leaf (a string, number, boolean, null, empty object or empty array) is addressed by its JSON Pointer (RFC 6901: ~ as ~0, / as ~1; the root scalar is the empty string). A 32-byte random leafSecret is drawn per run and kept with the body.

leafSalt(path) = hex(HMAC-SHA256(leafSecret, utf8(path)))
leafHash(path) = hex(SHA-256(utf8(leafSalt + "\n" + path + "\n" + JCS(value))))
leafRoot       = hex(SHA-256(utf8(JCS({ path: leafHash, ... }))))

A disclosure document (locker.disclosure/1) is the body in a form that can be checked field by field:

{"leaves":[{"path":"/a","salt":"<hex>","value":<json>}, {"hash":"<hex>","path":"/b"}, ...],
 "schema":"locker.disclosure/1"}

It is in JCS form, with the leaves sorted by path. A disclosed leaf carries its salt and its value; a removed leaf carries its hash alone. The verifier recomputes the hash of every disclosed leaf, takes the removed hashes as given, and recomputes leafRoot. The salt is per leaf and per run, so a removed value cannot be found by hashing guesses.

A verifier with the original bytes checks bodySha256. One with a disclosure document checks leafRoot. A receipt alone still verifies its hash, its signature and its place in the chain.

Redaction

The owner names paths. The stored body is rewritten as the disclosure document with those leaves removed, and the leaf secret is dropped, since every remaining salt is in the document. The paths are recorded on the run, and a receipt of kind redaction is appended to the chain, whose body is:

{"paths":[...],"receiptId":"<the redacted run>","redactedAt":"...","schema":"locker.redaction/1"}

The original receipt is unchanged. Its bodySha256 now names bytes that no longer exist, and its leafRoot still verifies against the disclosure document.

What is kept

Receipts are kept while you subscribe, run data for fourteen months, and the export checks without us, so keep it as long as your rules require.

When run data ages out, the body and its leaf secret are removed. The run still verifies by its receipt and its place in the chain.

Verifying a run of receipts

Take the receipts oldest first. For each one:

  • prevHash equals the previous receipt’s hash, and the empty string before the first.
  • hash equals SHA-256 of the JCS form of the core.
  • The signature verifies under publicKey, whose thumbprint equals keyId.

The result names the first broken position, and whether every signature held.

The test vectors

locker-receipt-vectors.json holds what an implementation needs to prove itself against ours: canonical JSON samples, including the number cases; a key pair; a short signed chain; a receipt that has been altered and must fail; and the salted-leaf and redaction cases.

The private key in the file is a test key, made for the vectors.