DraftVersion 1.0.0-draft · 21 Nov 2026 · format merkle-v1
Not yet normative. MakeWine has not switched these signatures on yet; until it does, this text and its test vectors can still change. Section 15 lists what is still open. The test vectors are illustrative, not normative.
Files
- vectors.json every test vector, its expected outcome and its exact bytes
- bundle.schema.json JSON Schema 2020-12, verification bundle
- proof.schema.json JSON Schema 2020-12, proof bundle
- bundle.cddl CDDL (RFC 8610), verification bundle
- proof.cddl CDDL (RFC 8610), proof bundle
- LICENSE.txt CC BY 4.0
- Changelog at the end of this page
MakeWine provenance signature, format merkle-v1
Version 1.0.0-draft (20 November 2026: dynamic certificates, then byte-level rules for an independent verifier; 21 November 2026: Mel's rulings on 14 open issues; see CHANGELOG). Status: DRAFT. Not yet normative. Section 15 lists what is still open and records what was decided.
Published at https://makewine.app/spec/provenance/v1 (OI-24). The JSON Schemas live under it:
https://makewine.app/spec/provenance/v1/bundle.schema.json and https://makewine.app/spec/provenance/v1/proof.schema.json.
Every signed bottle page links to this address.
Licence: CC BY 4.0 (see LICENSE).
1. Scope
A MakeWine bottle page shows the record of one wine: where it came from, how it was made, what went into it. The maker signs that record with a key that only the maker holds. This document says exactly what is signed and how anyone can check a signature without trusting MakeWine.
It covers:
- the signed record: 18 fixed leaves, each a group of fields shown or hidden together, and a certificate sub-tree with one leaf per certificate, padded to a size step (section 4);
- the exact text of a leaf (section 5) and its salt (section 6);
- how leaves are hashed into a Merkle tree, and the certificate sub-tree into the
certificatesleaf (section 7); - the signed message, the signature and the key (section 8);
- the chain of signings of one page (section 9);
- the two JSON files a verifier reads: the verification bundle and the proof bundle (section 10);
- the verification steps (section 11).
It does not cover how MakeWine stores records, how a bottle page is drawn, or who may ask for a proof.
2. Conventions and terms
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.
- Producer: the software that writes leaf texts and bundles (MakeWine's server).
- Signer: the maker's software that signs (the maker's browser). It holds the private key.
- Verifier: any software that checks a bundle.
- Leaf: one group of fields, written as a leaf text (section 5).
- Disclosed leaf: a leaf whose text is in the bundle. Hidden leaf: a leaf whose digest only is in the bundle.
- Digest: a leaf hash,
SHA-256(0x00 || leaf text), written as 64 lower-case hex characters. - Root: the Merkle tree hash over the 18 digests of the main tree.
- Certificate sub-tree: a second Merkle tree, one leaf per certificate plus padding; its root is written inside the
main tree's
certificatesleaf (section 4.2). - Padding leaf: a sub-tree leaf with no certificate: every field
z, with its own salt. - Bucket: the number of leaves of a certificate sub-tree: 8, 16, 32, 64, ... (section 4.2).
- Signing: one signature by a maker over one root. A page may be signed many times; each is kept.
- hex: lower-case hexadecimal, two characters per byte, characters
0-9a-fonly. - LF: the byte 0x0A. Strings are Unicode; "bytes" means their UTF-8 encoding [RFC3629].
3. Overview
- The producer writes one leaf text per certificate of the wine, adds padding leaves up to the bucket (8, 16, 32,
...), and hashes them into the certificate sub-tree. Then it writes the 18 leaf texts of the main tree; leaf 17,
certificates, carries the sub-tree's size and root. Every leaf starts with its name and a fresh random salt. - Each leaf is hashed. The 18 digests are combined into one root (RFC 6962 tree).
- The signer rebuilds both trees from the texts itself, then signs a short message that includes the root.
- A bottle page discloses some leaves in full and hides the others. A hidden leaf is sent as its digest only. A hidden certificate and a padding leaf look the same.
- A verifier hashes the disclosed leaves, takes the hidden digests as given, rebuilds the certificate sub-tree and
checks it against the
certificatesleaf, rebuilds the root and checks the signature. It never needs a hidden value or its salt. - Later, a hidden leaf (a section or a certificate) can be proved by giving its text: it must hash to the digest that was signed.
4. The signed record: 18 leaves and a certificate sub-tree
Every merkle-v1 record has exactly these 18 main leaves, in this order, whatever the wine has and whatever the page
shows, and one certificate sub-tree (4.2) whose size depends only on how many certificates the wine has.
A section with no data is still a leaf (an empty leaf, section 5.9). The order and names are part of the format;
changing them is a new format (section 12).
| Index | Leaf name | Disclosed on the page when | Fields, in order |
|---|---|---|---|
| 0 | core | always (in every bundle: step 4) | publicToken s, displayTitle s, createdAt t, wine.name s, wine.category s, wine.colour s, wine.primaryIngredient s, wine.year n, wine.originRegion s, wine.originCountry s, wine.designation s |
| 1 | bottling | bottling info shown | bottlingDate d, closureType s, bottleFormat s, caseCount n |
| 2 | bottling.lotNumber | bottling info and batch numbers shown | bottlingLotNumber s |
| 3 | vineyard | vineyard shown and the grower consents | vineyardSource.vineyardName s, vineyardSource.blockName s, vineyardSource.variety s, vineyardSource.harvestDate d, vineyardSource.quantityKg n, wine.harvestDate d |
| 4 | fermentation | fermentation shown | fermentation.startDate d, fermentation.endDate d, fermentation.yeastStrain s, fermentation.yeastManufacturer s, fermentation.vesselType s, fermentation.vesselName s, fermentation.vesselSizeL n, fermentation.skinContact b, fermentation.skinContactDays n, fermentation.phase s, fermentation.nutrientProtocol s, fermentation.targetTempC n |
| 5 | fermentation.gravity | fermentation and gravity readings shown | fermentation.startGravity n, fermentation.endGravity n |
| 6 | fermentation.abv | fermentation and ABV shown | fermentation.estimatedAbv n |
| 7 | fermentation.lotNumber | fermentation and batch numbers shown | fermentation.lotNumber s |
| 8 | fermentation.notes | fermentation and winemaker notes shown | fermentation.notes s |
| 9 | cellar | cellar history shown | lots c, then per lot i: lots[i].vesselName s, lots[i].phase s, lots[i].volumeL n, lots[i].startDate d, lots[i].endDate d, lots[i].pressFraction s, lots[i].rackingHistory c, then per racking j: lots[i].rackingHistory[j].date d, .destinationVessel s, .volumeL n, .reason s |
| 10 | cellar.gravity | cellar history and gravity readings shown | lots c, then lots[i].currentGravity n |
| 11 | cellar.abv | cellar history and ABV shown | lots c, then lots[i].estimatedAbv n |
| 12 | cellar.lotNumber | cellar history and batch numbers shown | lots c, then lots[i].lotNumber s |
| 13 | additions | additions shown | additions c, then per addition i: additions[i].date d, .friendlyType s, .productName s, .quantity n, .unit s |
| 14 | additions.technical | additions and technical additions shown | as leaf 13, for technical additions |
| 15 | officialTasting | official tasting shown (OI-7) | officialTasting.ratingSystem s, .ratingValue n, .ratingAsParker n, .ratingAsStars n, .aromaDescriptors c and [k] s, .tasteDescriptors c and [k] s, .body s, .acidityLevel s, .sweetnessLevel s, .tanninLevel s, .finishLength s, .freeformNotes s |
| 16 | nutrition | nutrition shown and the e-label published | nutrition.abv n, .netVolumeMl n, .sugarGPer100ml n, .acidGPer100ml n, .glycerolGPer100ml n, .energyKcalPer100ml n, .energyKjPer100ml n, .sparkling b, .ingredientsJson s |
| 17 | certificates | certifications shown | certificates.size n, certificates.root s (4.1) |
The letter after each field is its type tag (section 5.3). A field written .x repeats the prefix of the field before it.
The "disclosed when" column is informative. It describes MakeWine's page; a verifier does not need it. Every leaf is signed whatever the page shows. Showing or hiding a leaf never changes a signature.
The field lists are a draft, derived from the fields MakeWine signs today (format content-v2). They become normative
with the generated vectors (OI-1 to OI-4, OI-6).
- Leaf 0 is always disclosed. It names the page (
publicToken), so a bundle MUST carry itstext(section 11, step 4). - Technical additions (leaf 14): which additions are technical is the producer's own classification (OI-5). A verifier does not need it and does not check it.
wine.designationis written like every other field:wine.designation:z:when null (OI-7). (content-v2left the line out when null; that is out of scope here.)officialTastingis shown on the page only when the maker chooses to show it, like the other sections (OI-7). Whether it is shown is a page matter, not part of this format: the leaf is signed either way.
Not signed, on purpose: the maker's profile, community ratings, the back label, recall notices, certification notes, the view count, internal ids, and the signature fields themselves.
4.1 The certificates leaf
Leaf 17 does not hold certificates. It holds the size and the root of the certificate sub-tree, as exactly two field
lines after leaf and salt, in this order (certificates.size a number in the form of 5.5, certificates.root a
string of 64 hex characters):
leaf:s:12:certificates
salt:s:22:<salt>
certificates.size:n:<bucket>
certificates.root:s:64:<sub-tree root, 64 hex>
Because the root of the main tree covers this leaf, and this leaf carries the sub-tree's root, the signature covers every certificate leaf. Because it carries the size, a sub-tree sent with leaves added or removed does not match.
4.2 The certificate sub-tree
- One leaf per certificate, as many as the wine has. There is no limit in the format. Leaf k of the sub-tree is
named
certificates[k]and holds, in this order:officialCertifications[k].certTypes,.authoritys,.certificateNumbers,.issueDated,.expiryDated,.verificationUrls,.documentUrls. - Padding. After the certificates come padding leaves: the same seven field lines, every one
z. Each padding leaf has its own fresh salt, exactly like any other leaf, so its digest looks like any other digest. A hidden padding leaf and a hidden certificate cannot be told apart. - Bucket. The number of leaves (certificates plus padding) is the bucket: the smallest of 8, 16, 32, 64, ...
that holds every certificate. So 0 to 8 certificates give 8 leaves, 9 to 16 give 16, 17 to 32 give 32. The minimum
is 8 even for a wine with no certificate. The bucket is written in the
certificatesleaf ascertificates.size. - Order. Certificates first, in a stable order the producer chooses from data it does not publish (MakeWine: by the certificate's own id, oldest first), then padding. The order MUST NOT depend on which certificates are shown, so the position of a shown certificate says nothing about the hidden ones. Padding is always last.
- A certificate with no data. A certificate whose seven fields are all null would be written exactly like padding. A producer MUST leave such a certificate out of the sub-tree.
- Disclosure. Each certificate leaf is disclosed or hidden on its own (MakeWine: certifications shown, and that certificate's own "show" tick on). Padding leaves SHOULD always be hidden: a disclosed padding leaf shows where the certificates end. Every certificate leaf is signed whatever the page shows.
- The sub-tree is an RFC 6962 tree like the main one (section 7). Its sizes are powers of two, so it is a balanced tree.
- The largest sub-tree is 65536 leaves. A verifier MUST accept every bucket up to 65536 and MUST fail MALFORMED above it (section 11, steps 4 and 6.1), so every verifier gives the same outcome (OI-25).
5. Leaf text
5.1 Lines
A leaf text is a sequence of lines. Each line is <path>:<type>:<payload> followed by LF, including the last line. There
is no other separator, no carriage return, no byte order mark, and nothing after the last LF.
The first two lines are always:
leaf:s:<len>:<leaf name>
salt:s:22:<salt>
then the leaf's field lines in the order of section 4. The first line MUST have path leaf and tag s, the second
path salt and tag s; anything else is MALFORMED. The leaf name inside the text binds the text to its slot: a
verifier MUST reject a disclosed leaf whose name is not the name of its index. The paths leaf and salt MUST NOT
appear in a field line.
A verifier does not check the field lines against section 4: not their paths, their order, their number or their
tags, beyond the line grammar below. A signed leaf with a field section 4 does not list is VALID. The two exceptions
are leaf 17 (4.1, step 6.1) and the publicToken field of leaf 0 (step 5.4).
Reading a leaf text. A reader works on the bytes (10.4) from the start, one line at a time, until no byte is left:
- The path is the bytes up to the next
:(paths contain no:). It MUST match 5.2. - The type tag is the one byte after that
:, and the byte after the tag MUST be:. - For tag
s: the length is the bytes up to the next:and MUST match0|[1-9][0-9]*(no sign, no leading zeros). The string is exactly the nextlenbytes, whatever they contain. The byte after them MUST exist and MUST be LF. - For any other tag: the payload is the bytes up to the next LF, which MUST exist. It MUST match its pattern (5.3).
- The text MUST end right after a line's LF. A text with no line at all (the empty string) is not a leaf text.
Any failure means the text does not parse: MALFORMED (section 11, step 5.1). A reader MUST NOT split the text on LF first, MUST NOT accept CR as a line end, and MUST NOT skip or trim any byte.
5.2 Paths
A path is one or more of A-Z a-z 0-9 _ . [ ] (OI-14). Any other character is MALFORMED (5.1). List elements carry their zero-based index in brackets, as in
lots[0].phase.
5.3 Types
| Tag | Meaning | Payload | Example |
|---|---|---|---|
s | string | <len>:<text>; len is the number of UTF-8 bytes of text, decimal, no leading zeros | wine.name:s:13:Example Rosé |
n | number | canonical decimal (5.5) | fermentation.startGravity:n:1.09 |
b | boolean | true or false | fermentation.skinContact:b:true |
d | date | YYYY-MM-DD | bottlingDate:d:2026-09-30 |
t | timestamp | YYYY-MM-DDTHH:MM:SS, no fraction, no zone (5.6) | createdAt:t:2026-10-01T09:15:00 |
c | count of a list | decimal integer, no leading zeros; written before the list's elements | lots:c:2 |
z | null or absent | empty | wine.designation:z: |
A verifier MUST reject a line with any other type tag, and MUST reject a payload that does not match its pattern (OI-12; MakeWine's own verifiers and the reference verifier all do). The patterns a verifier checks, each matching the whole payload:
| Tag | Pattern |
|---|---|
n | -?(0|[1-9][0-9]*)(\.[0-9]*[1-9])? |
b | true|false |
d | [0-9]{4}-[0-9]{2}-[0-9]{2} |
t | [0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2} |
c | 0|[1-9][0-9]* |
z | the empty payload |
s | the length rule of 5.1, step 3; the text itself is not checked |
The patterns check the form only: a verifier does not check that a d or t is a real calendar date, nor that a
count c equals the number of elements that follow. The n pattern matches -0, which a producer never writes
(5.5); a verifier does not reject it for that.
5.4 Strings
- The producer MUST normalise every string to Unicode Normalization Form C [UAX15] before writing it, and
lencounts the bytes of the normalised text.étyped aseplus a combining accent is written as one character, 2 bytes. - A string may contain any character, including
:and LF. A reader MUST take exactlylenbytes and MUST NOT split the text on LF. This is what stops a value from forging another line. - The byte after the string MUST be LF.
- Leaf texts MUST be valid UTF-8. A string MUST NOT contain unpaired surrogates (OI-11).
- An empty string is
s:0:and is not the same as null (z).
5.5 Numbers
A number is written by value, as a plain decimal:
- no exponent, no leading
+, no leading zeros, no trailing zeros after the point, no point when there is no fraction; - zero is
0(never-0); a negative number starts with-.
So 1.090, 1.09 and 1.0900 are all 1.09; 12 and 12.0 are both 12. Precision is not signed: a value whose trailing
zeros matter must be a string. Form: -?(0|[1-9][0-9]*)(\.[0-9]*[1-9])?, excluding -0. A number that is not finite
(NaN, infinity) is written as z. See OI-10.
5.6 Dates and timestamps
dis a calendar date,YYYY-MM-DD.tis a date and time to the second,YYYY-MM-DDTHH:MM:SS, without a zone, and is always UTC (OI-8). The producer MUST normalise everytvalue when it writes the leaf: a stored value with an offset (+01:00) MUST be converted to UTC, a fraction of a second dropped, and a shorter value (no seconds) written in full. A producer MUST NOT pass a stored string through by cutting it to 19 characters. A verifier checks the form only (5.3).dvalues: see OI-9.
5.7 Null and absent
A null or absent value is <path>:z:. Null and absent are the same value. The empty string is s:0:, a different
value, so "lot number deleted" and "lot number blank" do not collide.
5.8 Lists
A list is its count (c), then each element's lines with the element's index in the path. A list with no elements is
its count 0 and nothing else. The count makes a shortened list a different text, not a prefix of the longer one.
5.9 Empty leaves
A leaf with no data has the same field lines as a full one, each z, with every count 0. Example, a padding leaf of
the certificate sub-tree:
leaf:s:15:certificates[3]
salt:s:22:<salt>
officialCertifications[3].certType:z:
...
officialCertifications[3].documentUrl:z:
The certificates leaf (4.1) is never empty: it always carries a size and a root.
See OI-2 (whether a whole absent section is one z line instead, as today's content-v2 writes it).
5.10 Who writes the text
Only the producer writes leaf texts. Signers and verifiers read and hash them as given. A verifier MUST hash the exact bytes it received and MUST NOT normalise, re-encode, re-order or rebuild a leaf text. The rules of 5.3 to 5.9 matter for producers, and for anyone who wants to reproduce a hidden leaf from the underlying data.
6. Salt
- Every leaf has its own salt: 16 bytes (128 bits) from a cryptographically secure random number generator, written in base64url without padding [RFC4648, section 5], which is always 22 characters. This follows the recommended minimum in [RFC9901], section 9.3 ("Entropy of the Salt").
- The producer MUST make new salts for every signing. The signer MUST NOT choose salts.
- A verifier MUST reject a disclosed leaf whose salt is not exactly 22 characters of
A-Z a-z 0-9 - _, or whose last character carries non-zero padding bits (OI-13). 22 base64url characters hold 132 bits, 4 more than the 16 bytes, and those 4 bits MUST be zero, so the last character MUST be one ofA,Q,g,w. Form for the whole salt:[A-Za-z0-9_-]{21}[AQgw]. Any other salt is MALFORMED (section 11, step 5.1, or 6.3 for a certificate leaf). A producer encoding 16 random bytes with a standard base64url encoder always writes a canonical salt. - The salt is what makes a hidden digest safe to publish: without it, a short hidden value (an ABV, a lot number) could be found by hashing every likely value.
7. Hashing and the tree
- Hash function: SHA-256 [FIPS180-4].
- Leaf hash:
digest = SHA-256(0x00 || UTF-8(leaf text)). - Node hash:
SHA-256(0x01 || left || right), whereleftandrightare 32-byte hashes. - The root is the Merkle Tree Hash of [RFC6962], section 2.1, over the 18 digests in index order: for a list of
n > 1hashes, letkbe the largest power of two less thann; the root is the node hash of the root of the firstkand the root of the remainingn - k. A list of one hash is that hash. - For 18 leaves: 18 = 16 + 2. Leaf 16 (
nutrition) is paired with leaf 17 (certificates), and that pair with the root of leaves 0 to 15. A tree that halves (9 + 9) is wrong. The vectors give every intermediate node. - The certificate sub-tree's root is the same Merkle Tree Hash over its leaves' digests, in position order. Its size is a power of two, so it halves at every level.
- The prefixes 0x00 and 0x01 stop a node hash being passed off as a leaf hash.
8. The signed message, signature and key
8.1 Message
The signed bytes are the UTF-8 encoding of nine fields joined by | (0x7C), with no spaces and no final newline:
mw-prov|merkle-v1|<publicToken>|<wineId>|<signerUserId>|<signedAt>|<keyId>|<previousRoot>|<root>
| Field | Encoding |
|---|---|
mw-prov | the literal text |
merkle-v1 | the format name, literal |
publicToken | the page's public token as in its link; A-Z a-z 0-9 _ -, 1 to 128 characters (OI-15). MUST NOT contain | |
wineId | the wine's id, decimal, no sign, no leading zeros, 1 to 19 digits: [1-9][0-9]{0,18} |
signerUserId | the signer's account id, in the same form as wineId |
signedAt | the signer's clock at signing, UTC, YYYY-MM-DDTHH:MM:SS (the ISO time with Z and the fraction removed). Form: the pattern of tag t (5.3), not calendar-checked |
keyId | hex SHA-256 of the signer's public key, SPKI DER bytes (8.3) |
previousRoot | hex root of the page's previous merkle-v1 signing, or the empty string for its first (section 9) |
root | hex root of this signing (section 7) |
Every field is ASCII by its form, so the message bytes are the ASCII bytes. The message is never sent to the verifier as the thing to check: the verifier builds it from the bundle's members (section 11, step 9).
The format name inside the message means a signature over an older MakeWine format can never be read as merkle-v1.
The publicToken of the message is also the first field of leaf 0 (core). Leaf 0 MUST be disclosed in every
bundle (section 11, step 4), and a verifier MUST check that the two tokens are the same (step 5.4), so a root whose
core leaf names one page cannot be signed under another page's token (OI-28).
8.2 Signature
ECDSA [FIPS186-5] on curve P-256 (secp256r1) with SHA-256, over the message bytes. The signature is the raw 64-byte
r || s form (each 32 bytes, big-endian, left-padded with zeros), as produced by WebCrypto, written as 128 hex
characters. It is not DER. To check it with tools that want DER (OpenSSL), convert r and s to an ASN.1
SEQUENCE { INTEGER r, INTEGER s } first.
Verification is standard ECDSA verification: SHA-256 of the message bytes, then the curve check with the key. r and
s are read as unsigned big-endian integers; a value of 0, or one not below the order of P-256, does not verify
(INVALID). A verifier MUST accept both (r, s) and (r, n - s) (section 13).
8.3 Key
- The public key is an EC P-256 public key, given in the bundle as a PEM
PUBLIC KEYblock (SubjectPublicKeyInfo, [RFC5280] section 4.1, [RFC5480]): algorithmid-ecPublicKey(1.2.840.10045.2.1), named curveprime256v1(1.2.840.10045.3.1.7). Signers' keys come from WebCrypto, which writes the point uncompressed (0x04 || X || Y), so the DER is 91 bytes: exactly the 26 bytes3059301306072a8648ce3d020106082a8648ce3d030107034200(hex), then04, then the 32-byte X and Y. This is the only accepted form: any other DER (a compressed point, explicit curve parameters, another length encoding, a byte after the end) is MALFORMED at step 8, whatever a crypto library would accept (OI-27). The point must also be on the curve: a library's refusal to import it is MALFORMED. - Producers write the PEM as
-----BEGIN PUBLIC KEY-----, LF, the standard base64 [RFC4648, section 4] of the DER with=padding in lines of 64 characters each followed by LF, then-----END PUBLIC KEY-----and a final LF. - Verifiers read the PEM as follows. In this rule whitespace means only space, tab, CR and LF (not form feed,
vertical tab, no-break space or any other Unicode space). The whole
publicKeyPemstring MUST be: optional whitespace,-----BEGIN PUBLIC KEY-----, at least one whitespace, the base64 text (at least one character) with whitespace anywhere inside it, optional whitespace,-----END PUBLIC KEY-----, optional whitespace. Nothing else may come before, between or after (no text, no second block). With the whitespace removed, the base64 MUST be canonical standard base64 [RFC4648, section 4]: alphabetA-Z a-z 0-9 + /, length a multiple of 4,=padding only as the last one or two characters and exactly as much as the length needs, and no non-zero padding bits. Otherwise: MALFORMED (section 11, step 8). Line ends and wrapping therefore never change the key or itskeyId(OI-27). keyIdis the SHA-256 of the DER bytes of that SubjectPublicKeyInfo, as 64 hex characters. A verifier MUST compute it from the key and MUST reject a bundle whosekeyIddiffers.- MakeWine also shows a 16-character fingerprint: the first 16 hex characters of
keyId. It is for display only. - The private key is made in the maker's browser and never reaches MakeWine. MakeWine never signs.
8.4 What the signer checks before signing
The signer MUST NOT sign a root it was merely given. Before signing it MUST parse each of the 18 leaf texts and each certificate sub-tree leaf text (section 5), check that each names its own slot and has a canonical 22-character salt (section 6), check the sub-tree as section 11 step 6 does (its size is a bucket and is the size in leaf 17, padding last, its root is the root in leaf 17), hash them, rebuild the root, and refuse to sign if that root differs from the producer's. It then signs the message built with its own root, and SHOULD show the maker the values it is signing, taken from the leaves it hashed.
9. The chain of signings
- Each
merkle-v1signing of a page carriespreviousRoot: therootof the same page's previousmerkle-v1signing, or the empty string for its firstmerkle-v1signing (including the first after an older-format signature, which has no root). - Because
previousRootis inside the signed message, an earlier signing cannot be removed from the sequence, or the sequence reordered, without breaking every later signature. - Chain check. Given bundles of one page, oldest first, a verifier MUST first verify each bundle (section 11), in
the order given; the first that is not VALID gives the chain its outcome. It then MUST check, for each bundle after
the first, in order, that its
publicTokenequals the first's and itspreviousRootequals therootof the bundle before it. Any failure there means the chain is INVALID. A signing left out of the list (a dropped link) fails this check, because the next signing names a root that is not the one before it. - Only those two members link signings.
wineId,signerUserId,keyIdandsignedAtmay differ between links (another member of the winery's team, a rotated key, a clock that went back). AsignedAtearlier than the previous signing's is not a failure, sincesignedAtis a claim (OI-17). - The first bundle's
previousRootis not checked. It may be""or the root of a signing not in the list, so a chain can be checked from any point of a page's history. Only a list that starts at the page's first signing proves there was nothing before it, and only if that bundle'spreviousRootis"". - An empty list is not a chain: MALFORMED (OI-29). A list of one bundle is that bundle's own outcome.
- A verifier SHOULD report which bundle (by its position in the list) or which link failed, and the step.
- A verifier given one bundle checks it alone; an empty
previousRootis not an error on its own. - The chain survives key rotation: each signing is checked with the key it carries.
- The chain gives order, not time (section 13).
10. Bundles
A bundle is a JSON document [RFC8259], UTF-8, describing one signing. The shapes are defined in
schema/bundle.schema.json and schema/proof.schema.json (JSON Schema 2020-12) and in cddl/bundle.cddl and
cddl/proof.cddl [RFC8610]. Those files and this section describe the same structure; a test keeps them in step.
10.1 Verification bundle
The file a visitor downloads from the "Check this record yourself" section of a signed bottle page.
| Member | Type | Meaning |
|---|---|---|
kind | "verification" | |
format | "merkle-v1" | the format, as in the message |
specVersion | string | the version of this document the producer followed, e.g. "1.0.0". Not signed; a verifier does not read it |
publicToken, signerUserId, wineId | string | as in 8.1. The ids are JSON strings of decimal digits (OI-15) |
signedAt | string | as in 8.1 |
signing | integer >= 1 | which signing of the page this is, counting from 1. Not signed; a verifier does not read it |
keyId | string | 64 hex |
publicKeyPem | string | the signer's public key, PEM PUBLIC KEY |
previousRoot | string | 64 hex, or "" |
root | string | 64 hex |
message | string | the signed message, for convenience. A verifier MUST rebuild it and MUST reject a mismatch; a verifier MUST NOT fail a bundle that lacks it |
signature | string | 128 hex |
leaves | array of 18 | { "index", "name", "digest", "text"? } in index order |
certificateLeaves | array of 8, 16, 32, ... | the certificate sub-tree, { "index", "name", "digest", "text"? } in position order. Present exactly when leaf 17 (certificates) has its text; absent otherwise |
Each leaf has index (0 to 17), name (section 4), digest (64 hex) and, when disclosed, text (the leaf text,
as a JSON string). A hidden leaf has no text. The digest is present on every leaf, disclosed or not. A certificate
leaf has the same members, with index its position in the sub-tree and name certificates[<index>].
When the certificates leaf is hidden, the bundle carries no certificate sub-tree at all: nothing about the
certificates, not even the bucket, is in the file.
Producers MUST write every member of the table, certificateLeaves under its rule, and MUST NOT add other members in
format merkle-v1 (OI-22). This set is closed for good: no later version of this document adds a member, signed
or unsigned, to a merkle-v1 bundle. A bundle with another member is a new format (section 12). The schemas describe exactly what a producer writes; a verifier follows section 11 and
10.4, which are more lenient where they say so, and does not need a schema validator.
10.2 Proof bundle
The same as a verification bundle, with kind "proof", the text of one or more leaves that were hidden on the page,
and one more member:
| Member | Type | Meaning |
|---|---|---|
proof.revealed | array of leaf names | the leaves this file reveals: main leaves and certificates[k] leaves |
proof.generatedAt | string | when the file was made, UTC, YYYY-MM-DDTHH:MM:SSZ. Not signed |
proof.generatedBy | string | who made it. Not signed |
A proof can be for any kept signing of a page, not only the latest; signing says which. Every leaf named in
proof.revealed MUST carry its text. A proof of a certificate MUST also carry the certificates leaf's text and the
whole sub-tree (certificateLeaves), hidden leaves as digests.
What a valid proof shows: the holder of the key signed a root that commits to this exact leaf text. It does not show when, or that the value is true (section 13).
10.3 Hidden and erased leaves
A hidden leaf and an erased leaf look the same: digest only. A leaf is erased when its stored text is deleted while the signature is kept (for example a grower withdrawing consent, or a value the maker asked to delete). An erased leaf can never be proved again. The page and signature stay valid.
10.4 Reading a bundle: JSON rules for verifiers
- The bytes of a leaf text.
textis a JSON string. The bytes that are parsed (5.1) and hashed (section 7) are the UTF-8 encoding of the string's value after JSON escapes are decoded:\nin the file is the byte LF,\u00e9isé(two bytes). A verifier MUST NOT apply Unicode normalisation, change line ends or trim anything. - Unpaired surrogates. A JSON string can spell an unpaired surrogate as an escape (
\ud800). Such a value has no UTF-8 encoding: atextholding one MUST fail MALFORMED. A verifier MUST NOT replace it (with U+FFFD or?) and hash the result. - Hidden means absent. A hidden leaf has no
textmember."text": null, a number or any other non-string is MALFORMED (step 4)."text": ""is a text that does not parse: MALFORMED (step 5). - Present means present. A member written with the value
nullis present. So"certificateLeaves": nullis present (MALFORMED at step 4 whether leaf 17 is shown or not), and"message": nullis present and is not the rebuilt message (INVALID at step 9). - Hex. Every hex member (
digest,root,previousRoot,keyId,signature, the root inside leaf 17) is lower case. Upper-case hex is MALFORMED, never folded. - Members a verifier does not know (OI-22): a producer never writes one (10.1), but a verifier MUST NOT fail a bundle for an unknown member,
at the top level or in a leaf entry, and MUST NOT show its value as signed. The same holds for a
proofmember in a bundle whosekindis"verification". - Repeated member names. A producer never writes a member name twice in one object [RFC8259, section 4]. A verifier MUST use the last occurrence of a repeated name, as the JSON parsers of JavaScript, Java (Jackson) and Python do; it MUST NOT fail the file for it or use the first.
- Numbers. Producers write
indexandsigningas plain JSON integers. A verifier comparesindexby its numeric value as an IEEE 754 binary64 double (the value JavaScript'sJSON.parsegives; RFC 8259 section 6), so1,1.0,1e0and1.0000000000000001are index 1 and-0is 0. A number with no finite double (1e400) is no index: MALFORMED at step 4.
11. Verification
A verifier takes one bundle and returns one of:
- VALID: every step passed.
- INVALID: the bundle is well formed but something does not match (a digest, the root, the key id, the message, the signature, a chain link).
- MALFORMED: the bundle does not have the form this document requires.
- UNSUPPORTED: the bundle is for a format this verifier does not know.
Only VALID means the signature holds. A verifier MUST NOT present INVALID, MALFORMED or UNSUPPORTED as a pass, and
SHOULD say which step failed. The steps run in the order below, and the first that fails decides the outcome, so two
conforming verifiers give the same outcome for the same file (the vectors in test-vectors/illustrative/edge/ check
the cases where a careless order or reading would differ).
Steps, in order. Each "fail" stops the verification with the outcome named.
-
Read the file's bytes. If they are not valid UTF-8, start with a byte order mark (EF BB BF), or are not one JSON value [RFC8259]: fail MALFORMED. If the value is not a JSON object: fail MALFORMED. (A verifier handed an already-parsed object, such as a web page's, starts at the object.)
-
If
formatis anything but the string"merkle-v1"(missing,null, a number, another string): fail UNSUPPORTED (section 12). Ifkindis not"verification"or"proof": fail MALFORMED. -
Check the form of
publicToken,wineId,signerUserId,signedAt,keyId,root,previousRootandsignature(sections 8 and 10.1; each a string matching its form, hex in lower case), and thatpublicKeyPemis a string. The PEM itself is decoded in step 8.message,specVersionandsigningare not checked here. On any failure: fail MALFORMED. -
leavesMUST be an array of exactly 18 entries; entry i MUST haveindexi, the name of index i (section 4) and a 64-hexdigest.certificateLeavesMUST be present if leaf 17 has atextand MUST be absent if it has none; when present it MUST be an array whose entry k hasindexk, the namecertificates[k]and a 64-hexdigest. Atext, where present, MUST be a string. Leaf 0 (core) MUST have atext(8.1, OI-28): a bundle that hides it is MALFORMED, whatever itskind. Otherwise: fail MALFORMED. IfcertificateLeaveshas more than 65536 entries: fail MALFORMED (4.2). -
For each main leaf with a
text, in index order, running 5.1 to 5.4 for that leaf before the next leaf:- take its bytes (10.4; an unpaired surrogate fails here) and parse them (section 5): lines, string lengths, LF
terminators, type tags and payloads, the
leafandsaltlines, a canonical 22-character salt (section 6). On any failure: fail MALFORMED; - if the name in its
leafline is not the name of its index: fail INVALID; - compute
SHA-256(0x00 || text bytes); if it differs fromdigest: fail INVALID; - for leaf 0 only (always disclosed, step 4): it MUST have exactly one field line with path
publicToken, that line MUST have tags, and its text MUST equal the bundle'spublicTokenmember. Otherwise (none, two or more, another tag, another value): fail INVALID (8.1).
So a wrong digest in leaf 1 and a text that does not parse in leaf 9 give INVALID: leaf 1 fails first.
- take its bytes (10.4; an unpaired surrogate fails here) and parse them (section 5): lines, string lengths, LF
terminators, type tags and payloads, the
-
If leaf 17 has a
text, check the certificate sub-tree:- read
certificates.sizeandcertificates.rootfrom leaf 17 (4.1). If its field lines are not exactly those two, the root is not 64 hex, or the size is not one of 8, 16, 32, ..., 65536 (4.2): fail MALFORMED; - if
certificateLeavesdoes not have exactlysizeentries: fail INVALID; - for each certificate leaf with a
text, in position order, running all of 6.3, 6.4 and 6.5 for that leaf before the next leaf is read: parse it as in 5.1 (MALFORMED on failure); if the name in itsleafline is notcertificates[k]for its own position k: fail INVALID; if its hash differs fromdigest: fail INVALID; then apply 6.4 and 6.5 to this leaf, given the leaves before it. So a padding leaf shown at 0, a certificate at 1 and an unreadable text at 2 give INVALID at leaf 1 (6.4), not MALFORMED at leaf 2; - padding last: a disclosed certificate leaf reads as padding when it has at least one field line after
leafandsaltand every field line has the tagz; any other disclosed certificate leaf reads as a certificate. If a leaf that reads as padding comes before one that reads as a certificate: fail INVALID; - smallest bucket: if
sizeis more than 8 and a disclosed leaf that reads as padding is in the first half (position belowsize / 2): fail INVALID, because a smaller bucket held every certificate; - compute the root over the
sizedigests (section 7). If it differs fromcertificates.root: fail INVALID.
- read
-
Compute the root over the 18 digests (section 7). If it differs from
root: fail INVALID. -
Decode
publicKeyPemto its DER bytes (8.3); if it is not in the PEM form of 8.3: fail MALFORMED. IfSHA-256(DER)in hex differs fromkeyId: fail INVALID. If the DER is not exactly the 91-byte form of 8.3, or the point is not on the curve: fail MALFORMED. -
Build the message (8.1) from the bundle's members. If
messageis present (with any value,nullincluded) and is not exactly the built message: fail INVALID. -
Verify the signature (8.2) over the message bytes with the key. If it does not verify: fail INVALID.
-
If
kindis"proof": ifproofis not an object, orproof.revealedis not a non-empty array: fail MALFORMED. If any entry ofproof.revealedis not the name of a leaf (main or certificate) that has atextin this bundle (a non-string entry is not a name): fail INVALID. A name may appear twice.proof.generatedAtandproof.generatedByare not signed and not checked. -
Return VALID, with the list of disclosed and hidden leaves, and the sub-tree's size when it was checked.
Steps 6.4 and 6.5 can only see disclosed leaves. A producer that discloses no padding (as 4.2 says it SHOULD) leaves nothing for them to check; a verifier cannot tell how many hidden leaves are certificates, and that is the point.
For several bundles of one page, also apply the chain check of section 9.
Anything a verifier shows as signed MUST come from a disclosed leaf that passed step 5. It MUST NOT show as signed a value taken from anywhere else in the page or the bundle.
12. Versioning
- The format name (
merkle-v1) is inside the signed message. Any change to the main leaves (names, order, number, fields in a leaf), the certificate sub-tree's rules (leaf fields, padding, buckets, order), the leaf text rules, the hashing, the tree, the message or the signature algorithm is a new format name. A record is never re-read under another format. The number of certificates is not part of the format: a wine with 40 certificates is amerkle-v1record with a 64-leaf sub-tree. - A bundle's members are part of the format too: adding a member to a bundle, signed or unsigned, is a new format
name, never a new version of
merkle-v1(OI-22). - A verifier MUST reject a bundle whose
formatit does not implement (UNSUPPORTED). It MUST NOT fall back to another format. specVersionis the version of this document (semantic versioning). Corrections that do not change a single byte of any validmerkle-v1record or bundle change the minor or patch number.specVersionis not signed and a verifier MUST NOT use it to choose the algorithm.- Earlier MakeWine formats (
content-v1,content-v2) are out of scope. They are checked by MakeWine's server only.
13. Security considerations
- Salt guessing. A hidden digest is safe to publish only because of its 128-bit random salt. A producer with a weak random source, or one that reuses salts, makes short hidden values guessable. Salts MUST NOT be logged or sent anywhere a hidden leaf's text would not be sent.
- Shown once, not secret again. A leaf disclosed once was public with its salt and may have been copied or archived. Hiding it later means "no longer shown", not "secret".
- What a signature proves. That the holder of the private key signed this root, so committed to these exact leaf texts. It does not prove that the values are true, or who the person is: the link between a key and a maker is MakeWine's account record and the key shown on the maker's MakeWine profile (OI-19).
- Time.
signedAtis the signer's own clock. Nothing in this format proves when a signing happened. There is no external time-stamp or anchoring, by design. The chain (section 9) proves order among one page's signings only. - Rotation and loss. A maker who rotates a key re-signs current records with the new key; earlier signings keep the key they were made with. A maker whose private key is stolen cannot, within this format, prove which signings came before the theft.
- Signature form. ECDSA signatures are malleable (for any valid
(r, s),(r, n - s)is also valid). A verifier MUST accept both and MUST NOT use the signature bytes as an identifier of a signing; useroot(OI-20). - Parsing. The length prefix is the only defence against a string forging a line. A reader that splits on LF can be made to read fields the maker never signed. Test with the vectors.
- Rendering. A page or tool that shows values as signed from anywhere but a verified leaf defeats the signature (section 11, last rule).
- Trusting the bundle's key. A bundle carries its own key, so a forger can make a self-consistent bundle with their
own key. A verifier SHOULD compare
keyId(or its fingerprint) with the key the maker publishes. At launch, MakeWine shows each maker's key fingerprint on the maker's MakeWine profile (OI-19). (Non-normative: other channels, such as the maker's own website or DNS, may be added later; none is defined by this version.)
14. Privacy considerations
- A hidden leaf reveals nothing of its value, and every record has the same 18 main leaves, so the bundle does not reveal how many sections are filled.
- Certificates: the bucket shows, the count does not. When the
certificatesleaf is disclosed, anyone can read the sub-tree's size, so they learn the range the number of certificates is in (0 to 8, 9 to 16, 17 to 32, ...), and that it is at least the number shown. They do not learn the exact number, because padding and hidden certificates look the same. Disclosing a padding leaf would show where the certificates end, so padding SHOULD stay hidden (OI-21). When thecertificatesleaf is hidden, nothing about the certificates is in the bundle. - A wine whose number of certificates crosses a step (8 to 9, 16 to 17) and is re-signed shows a new bucket. Anyone who saved both bundles learns that the number crossed that step.
- A disclosed leaf reveals its whole content, and its list counts (for example the number of lots).
- The grower's data in the
vineyardleaf belongs to the grower. When the grower withdraws consent, the leaf is hidden and its stored text erased (10.3). - Proof bundles reveal hidden values and are given out under MakeWine's own policy. Anyone holding one can share it.
- Bundles name an account id (
signerUserId) and a wine id. They contain no other personal data beyond what the maker disclosed.
15. Open issues and decisions
Each item was a detail the design left open or the code did not settle. The design references are to MakeWine's internal design notes for WINE-1564 (revision 4). Where this draft needed a choice for an item that is still open, it says "draft choice".
15.1 Still open
| # | Issue | Pointer |
|---|---|---|
| OI-1 | The exact fields and their order inside each leaf. The design lists groups, not lines; section 4 is derived from today's content-v2 field order. Normative once the server's generated vectors exist. | design 3.1 |
| OI-2 | Empty leaf form: one z line per field (draft choice, 5.9), or one z line for the whole section as content-v2 writes it (wine:z:, fermentation:z:). | design 3.1 |
| OI-3 | Certificate sub-tree (Mel, 20 Nov 2026: dynamic, replaces the 8 fixed slots). Draft choices: leaf 17 named certificates with the two fields of 4.1; sub-tree leaves named certificates[k] with paths officialCertifications[k].; buckets 8, 16, 32, ...; order by the producer's certificate id; the certificateLeaves bundle member. | design 3.3 (rev. 4) |
| OI-4 | Whether each per-lot leaf (9-12) and each additions leaf (13, 14) carries its own count line (draft choice: yes), and whether additions are numbered within each leaf (draft choice) or across both. | design 3.1 |
| OI-6 | wine.notes and wine.winemakerNotes: the design drops them as always-null; today's writer still writes their values. Confirm they are always null, or give them a leaf. | design 3.1 |
| OI-9 | d values: today's writer takes the first 10 characters of the stored value without checking its form. | design 3.4 |
| OI-10 | Numbers from binary floating point: today's writer goes through Java's shortest-decimal string; older Java runtimes did not always give the shortest. No digit limit is set. Matters only for reproducing a leaf from data. | design 3.4 |
| OI-11 | Unpaired surrogates: today's writer would replace them with ? when encoding. The draft forbids them; confirm the producer rejects or strips them before signing. | design 3.4 |
| OI-12 | Verifier strictness. Draft choice, now as MakeWine's verifiers (browser and server) and the reference verifier all behave: unknown tags and payloads not matching the patterns of 5.3 MUST fail MALFORMED; the patterns check form only (-0 passes). | design 3.4, 5.2 |
| OI-15 | publicToken character set and length (today 32 lower-case hex; draft allows A-Z a-z 0-9 _ -, 1 to 128), and ids as JSON strings rather than numbers in bundles (draft choice, so no language turns them into floats). | design 3.7, 6.2 |
| OI-16 | Bundle member names and layout. The design lists what a bundle holds, not its names; section 10 is a draft the server build must match, or this document changes before 1.0.0. | design 5.1, 6.2, 7.1 |
| OI-18 | Where a hidden leaf's digest is shown versus a missing leaf set: the design wants "not verifiable", never "mismatch", when MakeWine has lost the leaves. That is a page state, not a bundle outcome; confirm no bundle is ever produced for it. | design 8.3 |
| OI-20 | Whether producers or signers should normalise ECDSA signatures to low-S. WebCrypto does not; draft requires verifiers to accept both. | design 3.7 |
| OI-21 | Whether padding leaves are always hidden (draft: SHOULD; MakeWine never discloses one). If shown, they reveal where the certificates end. | design 3.3 |
| OI-23 | signing, specVersion and the proof member are not signed. Confirm that is intended (the chain and root identify a signing). Design rev. 4 section 3.7 signs exactly the nine fields of 8.1 and the build does the same. | design 3.7, 7.1 |
15.2 Decided
Kept as a record. Each decision is now in the text of the section named.
| # | Issue | Decision | Section |
|---|---|---|---|
| OI-5 | Which additions are technical (leaf 14). | Settled 21 Nov 2026 (Mel): The producer's own classification. Verifiers do not need it. | 4 |
| OI-7 | wine.designation when null; whether officialTasting gains a visibility gate. | Settled 21 Nov 2026 (Mel): Null designation is written wine.designation:z:. officialTasting is shown only when the maker chooses, like the other sections (a page matter; the leaf is signed either way). | 4 |
| OI-8 | t values passed through by cutting to 19 characters. | Settled 21 Nov 2026 (Mel): Every t is UTC and full length; the producer MUST normalise it when writing the leaf. | 5.6 |
| OI-13 | Salts whose last character carries non-zero padding bits. | Settled 21 Nov 2026 (Mel): Rejected: MALFORMED at step 5.1 (6.3 for a certificate leaf). The last character MUST be one of A Q g w. | 6, 11 |
| OI-14 | Path character set. | Settled 21 Nov 2026 (Mel): A-Z a-z 0-9 _ . [ ], confirmed. | 5.2 |
| OI-17 | A chain signedAt earlier than the previous signing's. | Settled 21 Nov 2026 (Mel): Not a failure: signedAt is a claim. | 9 |
| OI-19 | How a visitor confirms a key belongs to a maker. | Settled 21 Nov 2026 (Mel): At launch, the key fingerprint is shown on the maker's MakeWine profile. The maker's own site or DNS may come after launch (non-normative). | 13 |
| OI-22 | Whether merkle-v1 bundles may later gain unsigned members. | Settled 21 Nov 2026 (Mel): No, never. Any change to the members is a new format version. Verifiers still ignore unknown members. | 10.1, 10.4, 12 |
| OI-24 | The public URL of this document and the schemas' $id. | Settled 21 Nov 2026 (Mel): https://makewine.app/spec/provenance/v1, schemas under it (.../v1/bundle.schema.json, .../v1/proof.schema.json). | header, schema/ |
| OI-25 | The largest certificate sub-tree. | Settled 21 Nov 2026 (Mel): Exactly 65536: accepted up to it, MALFORMED above it. | 4.2 |
| OI-26 | Whether padding-last and smallest-bucket should be checkable beyond disclosed leaves. | Settled 21 Nov 2026 (Mel): No, by design (a check would need the hidden values). | 11 |
| OI-27 | Stricter key reading. | Settled 21 Nov 2026 (Mel): Confirmed: only space, tab, CR, LF as PEM whitespace; canonical base64 with padding; nothing outside the markers; only the 91-byte uncompressed SPKI. MakeWine's browser and server verifiers follow. | 8.3 |
| OI-28 | Leaf 0's publicToken; whether leaf 0 must be disclosed. | Settled 21 Nov 2026 (Mel): Confirmed: exactly one publicToken line, equal to the signed one (INVALID at step 5.4). And leaf 0 MUST be disclosed: a bundle without its text is MALFORMED at step 4, the step that checks what a bundle must carry (as for certificateLeaves). | 8.1, 11 |
| OI-29 | Chain edge cases. | Settled 21 Nov 2026 (Mel): Confirmed: an empty chain is MALFORMED; the first bundle's previousRoot is not checked; links compare publicToken and previousRoot only. | 9 |
16. References
- [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
- [RFC8174] Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, May 2017.
- [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO 10646", STD 63, RFC 3629, November 2003.
- [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data Encodings", RFC 4648, October 2006.
- [RFC5280] Cooper, D., et al., "Internet X.509 Public Key Infrastructure Certificate and CRL Profile", RFC 5280, May 2008.
- [RFC5480] Turner, S., et al., "Elliptic Curve Cryptography Subject Public Key Information", RFC 5480, March 2009.
- [RFC6962] Laurie, B., Langley, A., Kasper, E., "Certificate Transparency", RFC 6962, June 2013. Section 2.1.
- [RFC8259] Bray, T., "The JavaScript Object Notation (JSON) Data Interchange Format", STD 90, RFC 8259, December 2017.
- [RFC8610] Birkholz, H., Vigano, C., Bormann, C., "Concise Data Definition Language (CDDL)", RFC 8610, June 2019.
- [RFC9901] "Selective Disclosure for JSON Web Tokens" (SD-JWT), RFC 9901, https://www.rfc-editor.org/info/rfc9901. Section 9.3, "Entropy of the Salt". This format follows its idea (salted digests, the signer signs the digests), not its encoding.
- [FIPS180-4] NIST, "Secure Hash Standard (SHS)", FIPS PUB 180-4, August 2015.
- [FIPS186-5] NIST, "Digital Signature Standard (DSS)", FIPS PUB 186-5, February 2023.
- [UAX15] Unicode Standard Annex #15, "Unicode Normalization Forms".
- JSON Schema 2020-12, https://json-schema.org/draft/2020-12/schema.
Changelog
Versions follow semantic versioning on the SPECIFICATION. A change to any byte of a valid record or bundle is a new
format name (merkle-v2), not just a new version number (SPEC.md section 12).
1.0.0-draft, revised 2026-11-21 (third time): Mel's rulings on 14 open issues
Mel accepted every recommendation (WINE-1622, 21 Nov 2026). Section 15 now has a "still open" table (15 items) and a dated record of the 14 decisions. Two rules are stricter than before and can change an outcome:
- OI-13: a salt whose last character carries non-zero padding bits is MALFORMED (step 5.1; the last character is
one of
A Q g w). It was accepted before. - OI-28: leaf 0 (
core) MUST be disclosed; a bundle without itstextis MALFORMED at step 4, the step that checks what a bundle must carry. It was VALID before (step 5.4 was skipped).
Confirmed as written: OI-14 (path characters), OI-17 (an earlier signedAt is not a failure), OI-25 (65536), OI-26
(no further check), OI-27 (strict key reading), OI-28's exactly-one publicToken line, OI-29 (chain edge cases).
Producer and page rules, no verifier change: OI-5 (technical additions are the producer's classification), OI-7
(wine.designation:z: when null; officialTasting shown only when the maker chooses), OI-8 (every t is UTC, full
length, normalised by the producer), OI-19 (at launch the key is shown on the maker's MakeWine profile), OI-22 (the
bundle members are closed for good: any change is a new format; verifiers still ignore unknown members).
OI-24: the spec's address is https://makewine.app/spec/provenance/v1; the schemas' $id moved under it.
Vectors: 2 more edge cases (55): malformed-salt-padding-bits, malformed-core-hidden. The other edge files and the
illustrative and signed sets are byte-identical. The reference verifier follows both rules.
1.0.0-draft, revised again 2026-11-21: Mac's second verifier, round 2
Mac's Swift verifier agreed 67 of 67 on the round-1 vectors and found eight more open points (N1-N8). Settled as the reference and browser verifiers behave, or stricter where noted (OI-28, OI-29):
- Step 6.3 runs 6.3, 6.4 and 6.5 per certificate leaf before the next leaf is read (N1).
indexis compared as an IEEE 754 double;1e400is MALFORMED (N2).- The PEM must hold at least one base64 character (N3).
- Step 5.4: leaf 0 holds exactly one
publicTokenline (N4, stricter). - Chains: the first bundle's
previousRootis not checked; links comparepublicTokenandpreviousRootonly; an empty chain is MALFORMED (stricter); a verifier SHOULD report the failing bundle or link and the step (N5-N8). - 4 more edge cases (53), 1 more signed bundle and 3 more chains.
1.0.0-draft, revised 2026-11-21: what Mac's second verifier found
Mac wrote a second verifier in Swift from SPEC.md alone (36 of 36 vectors agreed) and listed 24 open points, 7 of which could make two conforming verifiers disagree. Settled as MakeWine's browser verifier and the reference verifier behave, or stricter where they were lenient or disagreed (OI-27, OI-28 for Mel). No byte of a valid record changes.
- Step 5 and step 6.3 run per leaf, in order; an unpaired surrogate fails at 5.1 of its leaf.
- The sub-tree limit is exactly 65536 (OI-25).
- Keys: only the 91-byte uncompressed P-256 SPKI; the PEM read strictly (whitespace is space, tab, CR, LF; canonical base64 with padding; nothing outside the markers) (OI-27).
- Repeated member names: the last wins.
indexcompared by value.nullmembers are present. A missing or non-stringformatis UNSUPPORTED. Step 1 reads the bytes: not UTF-8, a BOM or not JSON is MALFORMED. - New step 5.4: leaf 0's
publicTokenmust be the signedpublicToken(OI-28). - Stated outright: field lines are not checked against section 4; the
leaf/saltlines are tags;signedAthas thetpattern; a non-stringproof.revealedentry is INVALID; non-canonical salt bits are accepted (OI-13); how the chain check orders its failures. - 21 more edge cases (49 in all) and a new
signed/set (5 bundles, 5 chains) fromtools/make-signed-cases.mjs. The reference verifier gains the stricter key reading, step 5.4 and a byte-level reader (verifyBundleBytes).
1.0.0-draft, revised again 2026-11-20: byte-level rules for an independent verifier
No byte of any record or bundle changes; the illustrative vector is unchanged. A verifier was written from SPEC.md alone and run against MakeWine's browser verifier and the reference verifier; where it disagreed, the text was incomplete. Now stated:
- How to read a leaf text, byte by byte (5.1), and the exact payload patterns a verifier checks (5.3).
-0passes the pattern; producers never write it. - JSON rules for verifiers (new 10.4): the hashed bytes are the UTF-8 of the decoded JSON string; an unpaired
surrogate is MALFORMED; hidden means no
textmember; lower-case hex only; unknown members ignored (OI-22 draft). - PEM: what producers write and how verifiers decode it (8.3); the key algorithm and curve OIDs; the PEM is decoded in step 8, not step 3, so a bad key with a bad root is INVALID (step 7 first).
- ECDSA:
randsranges; both(r, s)and(r, n - s)accepted (8.2). message,specVersionandsigning: producers write them; a verifier does not require them (10.1).- What "reads as padding" means in step 6.4 (at least one field line, every one
z). - Step 11: a proof without a non-empty
revealedarray is MALFORMED; a revealed name with no text is INVALID. - Ids are 1 to 19 digits (8.1), as the schemas already said.
- 28 edge-case vectors (
test-vectors/illustrative/edge/,tools/make-edge-cases.mjs), checked by the reference verifier's tests.
1.0.0-draft, revised 2026-11-20: dynamic certificates
Mel's decision of 20 November 2026 (WINE-1564): no limit on certificates. Still draft, so the format name stays
merkle-v1.
- The 8 fixed certificate leaves (17-24) are gone. The main tree has 18 leaves; leaf 17,
certificates, carries the size and root of a certificate sub-tree (SPEC.md 4.1, 4.2). - The sub-tree: one leaf per certificate, in the producer's stable order, then salted padding leaves up to the bucket (8, 16, 32, ...). Only the bucket can be seen, never the exact count (section 14).
- Bundles gain
certificateLeaves, present exactly when thecertificatesleaf is shown (10.1). Proofs may reveal a certificate leaf (10.2). - Verification gains step 6 (the sub-tree: size is a bucket and the signed size, names, digests, padding last, smallest bucket, root); the later steps are renumbered (section 11).
- Schemas, CDDL, the illustrative vector (3 certificates, an 8-leaf sub-tree, one hidden) and six new MUST-fail cases.
- New open issues OI-25 (largest sub-tree) and OI-26 (what the padding checks can see); OI-3 and OI-21 rewritten.
1.0.0-draft — 2026-11-19
First draft of format merkle-v1. Not yet normative.
- SPEC.md: 25 fixed leaves, leaf text format, 128-bit salts, RFC 6962 tree, the signed message with
previousRoot, ECDSA P-256, the verification and proof bundles, verification steps, versioning, security and privacy notes. 24 open issues listed in section 15. - JSON Schema 2020-12 and CDDL for both bundles, with a test that keeps them naming the same members.
- One illustrative vector (not normative) and one MUST-fail case.
- Reference verifier for Node.js 18+, no dependencies.