provared 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -87,7 +87,7 @@ method was used. Because it is part of the signed bytes, a signature made
87
87
  for one kind of record can never pass as another kind.
88
88
 
89
89
  In this draft the protected header, once decoded, MUST be **exactly** one
90
- of these twenty-two texts, byte for byte. A checker compares the bytes and does
90
+ of these twenty-six texts, byte for byte. A checker compares the bytes and does
91
91
  not interpret anything else.
92
92
 
93
93
  | Record | Method | Protected header |
@@ -114,6 +114,10 @@ not interpret anything else.
114
114
  | Withdrawal | ML-DSA-87 | `{"typ":"vnd.provared.withdrawal.v0+json","alg":"ML-DSA-87"}` |
115
115
  | Pass | Ed25519 | `{"typ":"vnd.provared.pass.v0+json","alg":"Ed25519"}` |
116
116
  | Pass | ML-DSA-87 | `{"typ":"vnd.provared.pass.v0+json","alg":"ML-DSA-87"}` |
117
+ | Denial | Ed25519 | `{"typ":"vnd.provared.denial.v0+json","alg":"Ed25519"}` |
118
+ | Denial | ML-DSA-87 | `{"typ":"vnd.provared.denial.v0+json","alg":"ML-DSA-87"}` |
119
+ | Witness statement | Ed25519 | `{"typ":"vnd.provared.witness.v0+json","alg":"Ed25519"}` |
120
+ | Witness statement | ML-DSA-87 | `{"typ":"vnd.provared.witness.v0+json","alg":"ML-DSA-87"}` |
117
121
 
118
122
  `typ` is the media type of the record (RFC 7515, section 4.1.9), used as
119
123
  explicit typing (RFC 8725, section 3.11). `alg` names the signing method
@@ -204,7 +208,25 @@ written in only one way. RFC 8032 does not say to refuse such keys, and
204
208
  libraries differ in whether they do; a checker refuses them itself
205
209
  (`bad-key`), so that two checkers cannot disagree. For the same reason,
206
210
  an Ed25519 signature whose first 32 bytes (the point R) are such a point,
207
- or hold a y not less than p, is invalid, whatever the key.
211
+ or hold a y not less than p, is invalid, whatever the key; and so is one
212
+ whose last 32 bytes, read as a little-endian number S, are not less than
213
+ L = 2^252 + 27742317777372353535851937790883648493, the order of the
214
+ base point. RFC 8032, section 5.1.7, requires the check of S; libraries
215
+ differ in whether they make it, so a checker makes it itself. A key of
216
+ mixed order (a point of large order with a small-order part) is not
217
+ refused, and a signature under it is checked with the equation
218
+ S·B = R + k·A, without the cofactor, k being the SHA-512 hash of R, A and
219
+ the message, read as a little-endian number and reduced modulo L before
220
+ the multiplication. The cases of the paper "Taming the many EdDSAs"
221
+ (Chalkias, Garillot, Kondi and Nikolaenko, 2020) are in the shared test
222
+ files (`test-vectors/ed25519-signatures.json`), each with the answer
223
+ these rules give.
224
+
225
+ An ES256 key MUST be a point on the curve P-256: each half a number less
226
+ than the prime of the curve, and the two satisfying the curve's equation.
227
+ A checker refuses any other (`bad-key`) before it tries any signature
228
+ under it: such a key can check no signature, and libraries report it in
229
+ different ways.
208
230
 
209
231
  A key is named for people by its **thumbprint**: the JSON Web Key
210
232
  Thumbprint with SHA-256 (RFC 7638; for ML-DSA keys, RFC 9964 section 6).
@@ -417,6 +439,39 @@ it MUST also confirm that `issuer.key` is one of them. If it was given
417
439
  none, it MUST say that the issuer's key was not compared with a known
418
440
  key.
419
441
 
442
+ If the checker was given the addresses of the pages at which it expects
443
+ slips to have been signed (`issuerOrigins`), it MUST confirm that
444
+ `issuer.origin` is one of them, written exactly the same, and refuse the
445
+ slip otherwise (`issuer-origin-not-expected`). It MAY say, on a slip it
446
+ accepts, that the address is one the reader named. Each address given
447
+ MUST be in the form section 4.1 requires of `issuer.origin`; what is
448
+ given is otherwise a problem with the whole check (`bad-field`), never
449
+ set aside: an address with a capital letter or a path would match
450
+ nothing, and every slip would then read as signed elsewhere. At most 64
451
+ addresses may be given. An approval (section 17) and a cancellation
452
+ (section 22) are signed with the slip's passkey, and step 4 holds each to
453
+ the slip's `issuer.origin`, so the slip's address is the one compared.
454
+ Where no address was given, nothing is compared and nothing is said.
455
+
456
+ Why a reader names an address. A passkey signs whatever challenge a page
457
+ under its relying party (`issuer.rpId`) hands it: the browser lets any
458
+ page whose website name is that relying party, or a name under it, ask
459
+ the passkey to sign (W3C Web Authentication Level 3, sections 5.1.3 and
460
+ 5.1.4). The challenge for a slip, an approval or a cancellation is a
461
+ fingerprint, which the person cannot read on the device's prompt. So a
462
+ page served under that relying party, or a script running on one, can
463
+ have the passkey sign a record it wrote, by presenting the record's
464
+ fingerprint as an ordinary sign-in challenge: the client data then names
465
+ that page's address, the record written by the same party names the
466
+ same address, and steps 2 to 7 all pass. A passkey used to sign records
467
+ SHOULD therefore be made for a relying party name that serves nothing
468
+ but the signing page (such as `sign.example.org`, never `example.org`),
469
+ the signing page SHOULD show the record before it asks the passkey, and
470
+ a reader who knows where the person signs SHOULD name that address, so
471
+ that a slip signed under the same passkey anywhere else is refused. The
472
+ list of threats (`docs/threat-model.md`, section 3) states what this
473
+ closes and what it does not.
474
+
420
475
  The signature counter in the authenticator data is not used: an offline
421
476
  checker keeps no state.
422
477
 
@@ -535,18 +590,24 @@ in place of the narrowed content), and is one of:
535
590
  - `{"refusal": refusal record}`
536
591
  - `{"terms": terms record}`
537
592
  - `{"seal": seal record}`, which MAY also hold `"stamps": list of 1 to 4
538
- time-stamps` (section 21)
593
+ time-stamps` (section 21) and `"witnesses": list of 1 to 4 witness
594
+ statements` (section 29)
539
595
  - `{"cancellation": cancellation record}`, which MAY also hold `"stamps"`
540
596
  (section 22)
541
597
  - `{"acknowledgement": acknowledgement record}` (section 26)
542
598
  - `{"vouching": vouching record}` and `{"withdrawal": withdrawal record}`
543
599
  (section 23)
544
600
  - `{"pass": pass record}` (section 25)
601
+ - `{"denial": denial record}` (section 28)
545
602
 
546
603
  A slip MUST come before the entries that rely on it, and a set of terms
547
604
  before the stubs that rely on it. A book MUST NOT hold
548
605
  the same slip twice, nor more than 100,000 entries. A line MUST NOT be
549
- longer than 131,072 bytes.
606
+ longer than 131,072 bytes. Those two limits together allow a book of
607
+ about 13 gigabytes, so a checker SHOULD bound the total size of a book it
608
+ accepts (`too-large`), and MAY stop at the first problem it finds. This
609
+ library takes a book as one text, so it can check no book larger than one
610
+ text the device can hold.
550
611
 
551
612
  ## 10. The tree and the top fingerprint
552
613
 
@@ -586,7 +647,7 @@ of RFC 6962, section 2.1.1).
586
647
  ```
587
648
 
588
649
  A Show MAY also hold `"seal"`: an entry of the form `{"seal": seal
589
- record}`, with or without `"stamps"`. The Show is then of the book as it
650
+ record}`, with or without `"stamps"` and `"witnesses"` (section 29). The Show is then of the book as it
590
651
  stood when that seal was made: the seal's `size` and `root` MUST equal the
591
652
  Show's (`seal-mismatch`), and a checker checks the seal and its
592
653
  time-stamps as section 21 sets out. Its `id` MUST NOT be that of a
@@ -625,6 +686,11 @@ block time-stamp where the whole book sets that time-stamp aside and
625
686
  passes. The last two need a block that states a time far behind the
626
687
  true time.
627
688
 
689
+ A checker does not use seals held elsewhere (section 21.5) with a Show,
690
+ and MUST say so where any are handed over: single pages cannot show what
691
+ the book holds at the place a seal states, nor that the book goes on to
692
+ it.
693
+
628
694
  Nothing fixes the time-stamps beside the seal that comes with a Show.
629
695
  They stand outside the tree and outside the seal's signatures, so
630
696
  whoever hands the Show over can put a later time-stamp in the place of
@@ -636,7 +702,7 @@ the seal's own date (section 21.1, rule 4).
636
702
 
637
703
  | Missing | What follows |
638
704
  |---|---|
639
- | A public place where seals are kept | The last seal of a book, with everything after it, can be removed unnoticed, unless someone else holds a copy of that seal or of its top fingerprint and number of entries |
705
+ | A public place where seals are kept, which gathers the seals of many books and proves it dropped none | The last seal of a book, with everything after it, can be removed unnoticed, unless someone else holds a copy of that seal, and hands it to the checker (section 21.5), or holds its top fingerprint and number of entries. A witness (section 29) holds the latest seal it signed for, and can be asked for it; nothing obliges a recorder to show its seals to a witness |
640
706
  | A quantum-safe time-stamp | Time-stamp services sign with methods of today's kind |
641
707
  | Covered fields outside a slip's names and purpose | Every other field of an entry is visible to whoever holds it |
642
708
  | A compact binary form | Records are JSON text only |
@@ -648,6 +714,9 @@ the seal's own date (section 21.1, rule 4).
648
714
  - A one-sided stub proves what the agent's side said, not what the other
649
715
  side did.
650
716
  - A refusal proves what the service's side said, not what the agent did.
717
+ - A denial proves what the agent's side said it did not do, and why. It
718
+ does not prove that the action was not taken some other way, and an
719
+ agent that writes no denial leaves no trace of the refusal.
651
720
  - A rule of conduct in a slip, such as "never claim to be a human being",
652
721
  is the person's signed instruction. No check can show that the agent
653
722
  kept it.
@@ -666,6 +735,11 @@ the seal's own date (section 21.1, rule 4).
666
735
  one call, not that the call did what either says. A matching
667
736
  fingerprint of a request, an answer, arguments or an error shows only
668
737
  that the content matches, not that it was the same call.
738
+ - A witness statement (section 29) shows that a witness saw a seal, by
739
+ the time it states, and undertook to sign for no seal of that book that
740
+ does not extend it. It does not show that the entries are true, when
741
+ the seal was made, or anything of a book, or the end of one, that was
742
+ never shown to the witness.
669
743
 
670
744
  ## 14. Standards used
671
745
 
@@ -682,9 +756,9 @@ the seal's own date (section 21.1, rule 4).
682
756
  | FIPS 186-5; RFC 7518; RFC 8017 | The signing methods passkeys use (ES256, RS256) |
683
757
  | RFC 4648, section 5 | Base64url |
684
758
  | RFC 3339 | Times |
685
- | RFC 6962, section 2.1; RFC 9162, section 2.1.3.2 | The tree and its proofs |
759
+ | RFC 6962, section 2.1; RFC 9162, sections 2.1.3.2 and 2.1.4 | The tree, the proof that one entry is in it, and the proof that one tree extends another (section 29.1) |
686
760
  | FIPS 205 | SLH-DSA-SHA2-256s, the third signature on a seal |
687
- | RFC 3161; RFC 5652; RFC 5280; ITU-T X.690 | Time-stamps: the statement, its signed wrapper, the certificate, and the byte layout (DER) |
761
+ | RFC 3161; RFC 5652; RFC 5035; RFC 5280; RFC 8419, section 3.1; ITU-T X.690 | Time-stamps: the statement, its signed wrapper, how it names the certificate that signed, the certificate, Ed25519 with SHA-512 in a time-stamp, and the byte layout (DER) |
688
762
  | The OpenTimestamps proof file, version 1 (an open format; not the work of a standards body) | Block time-stamps: the steps from a fingerprint to the Merkle root of a block |
689
763
  | RFC 9901 (Selective Disclosure for JSON Web Tokens) | Covered fields |
690
764
  | RFC 9421 (HTTP Message Signatures), section 2.5, only its way of writing a message as text; RFC 9530 (Digest Fields); RFC 9110, section 5.6.2 | The texts that the reserved document names `provared.http-request` and `provared.http-response` stand for (section 27). Nothing is signed with RFC 9421 |
@@ -751,6 +825,23 @@ is frozen.
751
825
  Content-Digest, and an absent body none; no header covered; SHA-256
752
826
  only; only the three identifiers may be named more than once; the
753
827
  form of a trace-id not checked.
828
+ 20. Seals held elsewhere, section 21.5: at most 64; compared with the
829
+ book by the seal's content, its signatures and time-stamps not;
830
+ counted only for a recorder the person named, and on a device
831
+ without SLH-DSA on its first two signatures; its time-stamps not used
832
+ for the entries of the book.
833
+ 21. The rules of section 3.8 that go beyond their standards: an Ed25519
834
+ key of small order, or written in more than one way, is refused as a
835
+ key, and a signature whose R is such a point is invalid under any key
836
+ (RFC 8032 leaves both to the implementation); an ES256 key that is
837
+ not a point on its curve is refused as a key. The check of S against
838
+ L restates RFC 8032, section 5.1.7, and is made by the checker
839
+ itself, whatever the library beneath it does.
840
+ 22. Where a time-stamp names the certificate that signed it in both
841
+ forms of RFC 5035 (section 21.2, item 3), the newer form names it
842
+ and the older is not compared with it. RFC 5035, section 7, lets a
843
+ reader refuse a time-stamp whose two forms disagree, and leaves the
844
+ choice to the reader.
754
845
 
755
846
  ## 16. The shared list: actions, kinds of action, rules of conduct
756
847
 
@@ -972,7 +1063,9 @@ record, with its approval and a countersignature, could be longer than a
972
1063
  line of a book may be (section 9) is not allowed either (`too-large`).
973
1064
 
974
1065
  This is a help to whoever runs the agent. It is not evidence: nothing in a
975
- record shows that the check was made.
1066
+ record shows that the check was made. Where the check refuses an action,
1067
+ the agent's side MAY write a denial (section 28): its own signed
1068
+ statement that the action was not taken, and why.
976
1069
 
977
1070
  ## 21. The Seal and the outside time-stamp
978
1071
 
@@ -991,7 +1084,8 @@ Content:
991
1084
  | `by` | The recorder | `{"keys": the recorder's three keys, "name": text}` |
992
1085
  | `size` | How many entries the book held | A whole number, 1 or more |
993
1086
  | `root` | The top fingerprint of those entries | A fingerprint (section 10) |
994
- | `previous` | The seal before this one in the book. Absent for the first | That seal's fingerprint |
1087
+ | `previous` | The seal before this one in the book. Absent for the first seal of the first book; for the first seal of a later book, the last seal of the book before (section 21.6) | That seal's fingerprint |
1088
+ | `book` | The book's number among the books its recorder keeps under one permission (section 21.6). Absent for the first book | A whole number, 2 or more |
995
1089
  | `when` | When it was made, as the recorder states | A time |
996
1090
 
997
1091
  It is signed with the three keys in `by`, with the seal labels of section
@@ -1006,7 +1100,11 @@ otherwise report a problem:
1006
1100
  2. `size` is the number of entries before the seal, and `root` is their
1007
1101
  top fingerprint (`seal-mismatch`).
1008
1102
  3. `previous` is the fingerprint of the seal before it in the book, and
1009
- is absent if there is none (`seal-chain-broken`).
1103
+ is absent if there is none (`seal-chain-broken`). The one exception is
1104
+ the first seal of a book that gives `book`: its `previous` names the
1105
+ last seal of the book before, which is not in this book, and is not
1106
+ compared (section 21.6). Every seal of a book gives the same `book`
1107
+ (`seal-chain-broken`).
1010
1108
  4. `when` is not earlier than the `when` of the seal before it
1011
1109
  (`time-went-backwards`). `when` is also not more than 300 seconds
1012
1110
  earlier than the latest time stated by an entry it covers that passed
@@ -1054,10 +1152,35 @@ signatures failed. For each time-stamp it MUST confirm all of these, and
1054
1152
  otherwise report a problem:
1055
1153
 
1056
1154
  1. It is laid out as RFC 3161 and RFC 5652 set out, in strict DER
1057
- (`stamp-bad-data`). Every part is read, including parts the checker
1058
- does not otherwise use: a whole number or an object identifier that is
1059
- not in its shortest form, a part that does not fill what holds it, or a
1060
- part the standards do not allow in that place, is refused. The signed
1155
+ (`stamp-bad-data`). Every part the checker can tell apart is read,
1156
+ including parts it does not otherwise use: a whole number or an object
1157
+ identifier that is not in its shortest form, a string of bits that
1158
+ counts more than seven unused bits or whose unused bits are not zero
1159
+ (X.690, section 11.2.1), a string of bits, bytes or characters, or a
1160
+ time, written in parts (the constructed form, which X.690, section
1161
+ 10.2, forbids in DER), a set whose items are not in the order of X.690,
1162
+ section 11.6 (their encodings compared as bytes, the shorter padded at
1163
+ its end with zeros; equal items may stand side by side), a part that
1164
+ does not fill what holds it, or a part the standards do not allow in
1165
+ that place, is refused. The order of a set is held only where a
1166
+ standard requires DER: the signed attributes, which RFC 5652, section
1167
+ 5.3, requires to be DER, and every set inside them; the statement
1168
+ (TSTInfo), which RFC 3161, section 2.4.2, requires to be DER, and
1169
+ every set inside it; and each certificate, which RFC 5280, section
1170
+ 4.1, requires to be DER, and every set inside it. The signed data's
1171
+ own sets (the list of fingerprint methods, the list of certificates,
1172
+ the list of withdrawn certificates and the list of signers), and the
1173
+ parts of a signer outside its signed attributes, may be in any order:
1174
+ CMS does not require DER of them, and services in use list their
1175
+ certificates in chain order, the signing certificate before its
1176
+ issuer. What a part holds as bytes (the value of an octet string, such
1177
+ as an extension's) is read as bytes only, so a string of bits inside
1178
+ one is not held to these rules; the statement, which sits in an octet
1179
+ string, is read in full as DER. A part under a tag that hides its kind
1180
+ (a context tag) that is written in parts has the parts inside it read
1181
+ like any other, but is itself neither refused as a string written in
1182
+ parts nor held to the order of a set, since its tag does not say which
1183
+ it is; written in one piece, its value is read as bytes only. The signed
1061
1184
  data is of version 3, with exactly one signer. The public key in the
1062
1185
  certificate that signed is written exactly as its own standard sets
1063
1186
  out, with no unused bits: RSA as RFC 3279, section 2.3.1 (the
@@ -1069,7 +1192,14 @@ otherwise report a problem:
1069
1192
  3. Its signed attributes name a time-stamp statement, hold the
1070
1193
  fingerprint of the statement, and name the certificate that signed, by
1071
1194
  the "signing certificate" attribute that RFC 3161, section 2.4.2,
1072
- requires (in the form of RFC 5035, or the older form of RFC 2634). The
1195
+ requires (in the form of RFC 5035, or the older form of RFC 2634). Each
1196
+ of the two forms appears at most once, as RFC 5035 requires (section 3
1197
+ for the newer form; section 5, which writes section 5.4.2 of RFC 2634,
1198
+ for the older): a time-stamp in which either form appears twice is
1199
+ refused (`stamp-invalid`). Where both forms appear once each, the
1200
+ newer form names the certificate and the older is not compared with it:
1201
+ a choice of this format (section 15, item 22), where RFC 5035, section
1202
+ 7, lets a reader refuse a time-stamp whose two forms disagree. The
1073
1203
  time-stamp carries that certificate, and the signature over the
1074
1204
  attributes fits its public key (`stamp-invalid`). A certificate with
1075
1205
  the same key and other contents is another certificate.
@@ -1079,8 +1209,15 @@ otherwise report a problem:
1079
1209
  The signing methods are RSA (PKCS #1 version 1.5; keys of 2,048 to
1080
1210
  8,192 bits, with an odd public number from 3 to 2^32 - 1: never 1,
1081
1211
  under which anyone can make a signature that checks), ECDSA on the
1082
- curves P-256 and P-384, and Ed25519 (not a key of small order, as
1083
- section 3.8 sets out). A key of any other kind, or on another curve,
1212
+ curves P-256 and P-384, and Ed25519 (not a key of small order, and
1213
+ not a signature whose S is not below L, as section 3.8 sets out; the
1214
+ signer MUST name SHA-512 as the fingerprint method, with no
1215
+ parameters, and MUST give the signing method no parameters, as RFC
1216
+ 8419, section 3.1, requires, so a time-stamp signed with Ed25519 that
1217
+ names SHA-256 or SHA-384, or gives either method parameters, is
1218
+ refused, `stamp-invalid`, in words that say so; the list of
1219
+ fingerprint methods in the signed data is read for its form only). A
1220
+ key of any other kind, or on another curve,
1084
1221
  is refused (`stamp-invalid`). The checker does not try to find out
1085
1222
  whether an RSA modulus can be factored: a service's key is the
1086
1223
  service's business, and a checker trusts a service only by the
@@ -1094,7 +1231,13 @@ otherwise report a problem:
1094
1231
  seconds after the time it states (`dated-after-stamp`). A block
1095
1232
  time-stamp that section 21.3 sets aside is the one exception.
1096
1233
 
1097
- The time a time-stamp states is taken to the second, rounded down.
1234
+ The time a time-stamp states is read to the millisecond: a fraction of a
1235
+ second, where it states one, is kept to three decimal places, rounded
1236
+ down, and the rest dropped. A checker shows the time to the second,
1237
+ rounded down, and compares it in milliseconds: with a record's `when`,
1238
+ which is whole seconds, and with the time of another time-stamp under
1239
+ section 21.3. So two time-stamps 300.5 seconds apart are more than 300
1240
+ seconds apart.
1098
1241
 
1099
1242
  **Whom to trust is the checker's choice.** The person checking gives the
1100
1243
  fingerprint (SHA-256, in base64url) of the certificate of each time-stamp
@@ -1150,7 +1293,8 @@ Show that comes with a seal (section 11).
1150
1293
 
1151
1294
  The earliest time that a counted time-stamp from a service gives a seal
1152
1295
  MUST NOT be more than 300 seconds earlier than the latest such time that
1153
- a service gave any seal before it (`time-went-backwards`). So the times
1296
+ a service gave any seal before it (`time-went-backwards`; both times in
1297
+ milliseconds, as section 21.2 sets out). So the times
1154
1298
  cannot step backwards a little at a time. A block time-stamp is never
1155
1299
  reported under this rule: it is made hours after its seal, and one that
1156
1300
  states an earlier time is set aside (the second case above).
@@ -1195,8 +1339,8 @@ entries after it are not time-stamped.
1195
1339
  What a seal and a time-stamp do not fix: the last seal of a book, with
1196
1340
  everything after it, can be removed, and what is left still checks. Only
1197
1341
  a copy of that seal, or of its top fingerprint and number of entries,
1198
- held by someone else shows it. And a time-stamp service signs with a
1199
- method of today's kind.
1342
+ held by someone else shows it (section 21.5). And a time-stamp service
1343
+ signs with a method of today's kind.
1200
1344
 
1201
1345
  ### 21.4 A block time-stamp
1202
1346
 
@@ -1320,6 +1464,258 @@ its fingerprint with sources they trust. A proof is complete only one to
1320
1464
  several hours after it is asked for, so it is an addition to a
1321
1465
  time-stamp from a service, not a replacement.
1322
1466
 
1467
+ ### 21.5 Seals held elsewhere
1468
+
1469
+ Whoever keeps a book can cut off its end, the last seal with it, and
1470
+ what is left still checks (section 21.3). A copy of a seal kept out of
1471
+ the recorder's reach shows it: by the person, an auditor, a second copy
1472
+ of the book, or any party the recorder handed the seal to.
1473
+
1474
+ A checker MAY be handed, beside a book, up to 64 seals held elsewhere,
1475
+ each as the entry it is in a book: `{"seal": seal record}`, with or
1476
+ without `"stamps"` and `"witnesses"` (sections 9 and 29.2). More than 64, or anything that is not a
1477
+ list, is refused (`bad-field`). An empty list is none. The same seal MUST
1478
+ NOT be handed over twice (`bad-field`).
1479
+
1480
+ Each seal handed over is checked as a seal in a book is: its three
1481
+ signatures (`signature-invalid`), its recorder against the recorders the
1482
+ person expects (`sealer-not-expected`, rule 5 of section 21.1), and its
1483
+ time-stamps as section 21.2 sets out. Its `size` and `root` are not
1484
+ worked out again here: the book's own seal at that place is (rule 2 of
1485
+ section 21.1). A seal handed over that does not pass its own check is a
1486
+ problem with the check as a whole: it is never set aside silently.
1487
+
1488
+ A seal handed over **counts** only where all of these hold:
1489
+
1490
+ 1. it passed its own check;
1491
+ 2. the person named the recorders they expect, and its recorder is one
1492
+ of them. Otherwise anyone could make a seal with keys of their own and
1493
+ have a sound book reported; a checker MUST say that it was not used;
1494
+ 3. the device checked its Ed25519 and ML-DSA-87 signatures. Where the
1495
+ device does not have SLH-DSA (the Python version, and browsers that
1496
+ have ML-DSA, such as Edge and Brave 155 when tested), the seal counts
1497
+ on those two, and a checker MUST say that its third signature was not
1498
+ checked. On a device without ML-DSA, or without Ed25519, it is not
1499
+ used. A seal held elsewhere can only show a problem with a book, never
1500
+ excuse one.
1501
+
1502
+ For a seal that counts, at entry n (its `size`), a checker MUST report a
1503
+ problem with the book:
1504
+
1505
+ - `book-cut-short`, where the book has n entries or fewer: it ends
1506
+ before the place where the seal stands, so its end was cut off after
1507
+ the seal was made;
1508
+ - `seal-not-in-book`, where the entry at n is not a seal with the same
1509
+ content: the same fingerprint (section 3.5), which fixes `size` and
1510
+ `root`, and so the entries before it. The book was changed after the
1511
+ seal was made, or the seal is of another book.
1512
+
1513
+ Nothing in a seal names its book. So a seal of another book by the same
1514
+ recorder (a book it kept before, when it started a new one) is reported
1515
+ as `seal-not-in-book` where it stands, or as `book-cut-short` where the
1516
+ other book was longer: hand over only seals of the book being checked.
1517
+ Where the seals give book numbers (section 21.6) and the book holds a
1518
+ seal, a seal handed over whose number is not the book's is not compared
1519
+ by its place: section 21.6 says what is done with it.
1520
+
1521
+ Where the book holds the seal at entry n, the checker MUST say so. Where
1522
+ that entry did not pass its own check, it MUST say that too. The same
1523
+ content with other signatures is the same seal: only someone who holds
1524
+ the recorder's keys can sign it again, and it fixes the same entries. It
1525
+ is not a fault of the book, and a checker MUST say that the signatures
1526
+ differ. (So a copy whose third signature was changed, on a device that
1527
+ cannot check that signature, agrees with the book; on a device that can,
1528
+ it does not pass its own check.) The time-stamps of the copy stand
1529
+ outside the seal's signatures (section 11), so they may differ from
1530
+ those beside the same seal in the book; a checker MUST say where they
1531
+ do. The copy's own time-stamps are shown,
1532
+ and are not used for the entries of the book: the time by which an entry
1533
+ existed (section 21.3) comes from the book alone.
1534
+
1535
+ A checker that is carried on (one that reads a book and then more lines)
1536
+ applies this to the book as it stands at each answer. What rests on a
1537
+ seal handed over alone (its signatures, its recorder, its time-stamps)
1538
+ it MAY check once and keep.
1539
+
1540
+ What this closes: the end of a book cut off after a seal that someone
1541
+ else holds, back to any place before that seal; and a second history of
1542
+ a book, shown to someone who holds a seal of the first, since the seal
1543
+ does not fit it. What it does not close: a book cut back after the
1544
+ latest seal anyone holds; a book, or the part of one, never shown to
1545
+ anyone who keeps a seal; and a recorder that hands its seals to nobody.
1546
+ Witnesses (section 29), which sign for each seal and keep the latest
1547
+ they signed for, narrow the last two: a seal a witness signed for is one
1548
+ anyone who names that witness can ask it for. Statements that witnesses
1549
+ signed for a seal MAY be handed over with it, as `{"seal": seal record,
1550
+ "witnesses": [...]}` (section 29.2).
1551
+
1552
+ ### 21.6 The books of one permission
1553
+
1554
+ A recorder may keep the record of one permission in several books, one
1555
+ after another: it seals a book, and starts a new one that begins with the
1556
+ same permission as its first line. A seal MAY say which book it is of, in
1557
+ `book`: 2 for the second book of that permission, 3 for the third, and so
1558
+ on. The first book carries no number, so every seal written before this
1559
+ member existed reads as the seal of a first book, exactly as before; `1`
1560
+ is not written (`bad-field`), so that there is one way to write each
1561
+ number. A seal that gives `book` MUST give `previous` (`bad-field`).
1562
+ A recorder numbers in one sequence all the books it keeps for one person
1563
+ and one agent, whichever of their permissions each book starts from, a
1564
+ renewal included: that is how a witness knows them (section 29.3).
1565
+
1566
+ The first seal of book n names, as `previous`, the last seal of book
1567
+ n − 1. A checker that holds only book n cannot see that seal: it MUST NOT
1568
+ report the `previous` of that first seal, MUST say that it was not
1569
+ compared, and keeps it. Every later seal of book n names the seal before
1570
+ it in book n, and gives the same `book` (rule 3 of section 21.1). Among
1571
+ the pages of a Show, seals that give different numbers cannot be of one
1572
+ book (`seal-chain-broken`).
1573
+
1574
+ Where a book holds a seal, its number is that of its first seal, and a
1575
+ seal held elsewhere (section 21.5) whose number is another is not
1576
+ compared with the book at all. It is not used, and a checker MUST NOT
1577
+ count it as compared: where any seal handed over was not compared, the
1578
+ check gives no pass, as where no recorder was named (section 21.5), even
1579
+ for an honest book: a reader who hands the seal of book n − 1 over
1580
+ beside book n gets no pass for book n, and should check book n − 1 with
1581
+ it instead. The
1582
+ number is the recorder's own word, so a book cut short could be sealed
1583
+ again under another number; the reader learns that the seal they hold
1584
+ was not compared, not that the book is whole. A checker MUST then say
1585
+ which of these the seal is:
1586
+
1587
+ - **the last seal of the book before**, which the first seal of this
1588
+ book names: where it is signed with the same key set as that first
1589
+ seal, and not dated after it, a checker says that this book follows on
1590
+ from it; where it is signed with another key set
1591
+ (`seal-chain-broken`), or dated after that first seal
1592
+ (`time-went-backwards`), it reports a problem;
1593
+ - **a seal of the book before that the first seal of this book does not
1594
+ name**: this book then does not show whether the book before was cut
1595
+ short, nor that this book follows on from it, and a checker MUST say so;
1596
+ - **a seal of the next book that names a seal of this book** as the seal
1597
+ before it: the next book follows on from this one there;
1598
+ - a seal of a later or an earlier book: this book does not show whether
1599
+ that book was cut short.
1600
+
1601
+ In every case it does not show whether the book of the seal held was
1602
+ cut short: check that book with it.
1603
+
1604
+ To compare book n − 1 with the seal that book n starts from, check book
1605
+ n − 1 with that seal handed over beside it: it must hold that seal at its
1606
+ place, as section 21.5 sets out.
1607
+
1608
+ What the numbers do not show: that a book is the whole of its number; a
1609
+ checker of one book cannot tell whether the seal the next book starts
1610
+ from is the last of this book, or a seal of the next book handed over is
1611
+ its first. Nor does a checker count a limit across books: it counts within the
1612
+ book it checks.
1613
+
1614
+ ### 21.7 A seal made by a sealer that sees only fingerprints
1615
+
1616
+ The recorder's keys need not sit beside the agent. A seal MAY be signed
1617
+ by a **central sealer**: a party that holds the recorder's keys and is
1618
+ sent, for each line of the book, only its leaf fingerprint (the SHA-256
1619
+ of the byte 0x00 and the line, without its line feed, as section 10
1620
+ sets out), never the line. From these it builds the same tree as a
1621
+ checker builds from the lines, and signs a seal over its own number of
1622
+ entries and its own top fingerprint. Nothing in any record changes: such
1623
+ a seal is the same record, byte for byte in its content, as one signed
1624
+ over the book itself, and it is checked exactly as section 21.1 sets
1625
+ out. A sealer sent a wrong fingerprint signs a seal the book does not
1626
+ pass (`seal-mismatch`).
1627
+
1628
+ A sealer SHOULD sign only over a tree it built itself from the
1629
+ fingerprints it was sent, never over a number of entries and a top
1630
+ fingerprint handed to it; SHOULD take each line's fingerprint once, at
1631
+ its place, so that no line it has sealed can be replaced; SHOULD name,
1632
+ as `previous`, the latest seal it signed of that book (for the first
1633
+ seal of a later book, the last seal of the book before, section 21.6);
1634
+ SHOULD treat every book that starts with the same first line as one
1635
+ chain, so that a book whose first line it already holds starts only as
1636
+ the next book after the latest book with that first line, following it;
1637
+ SHOULD, where it serves several recorders with one key set, keep one
1638
+ record of every book for all of them, each book, and every book after
1639
+ it, belonging to the recorder that started it; SHOULD, where it serves
1640
+ recorders that do not trust each other, start a book only from its
1641
+ first line itself, a permission (section 4) for an agent that the
1642
+ recorder was named for, each agent named for one recorder only, so that
1643
+ no recorder can start a book whose first line is a permission for
1644
+ another recorder's agent; SHOULD limit the books each recorder may hold;
1645
+ SHOULD keep, of a seal entry it is handed, only what it checks, the
1646
+ seal, and what is bounded, its time-stamps, read for their form only
1647
+ (sections 21.2 and 21.4: how many, how long, in base64url, none
1648
+ twice; a sealer that checks no time-stamp's signature vouches for
1649
+ none), and
1650
+ refuse an entry
1651
+ longer than a line of a book may be, so that no recorder can make its
1652
+ record too large to keep; and MUST keep what it has signed safely
1653
+ before it gives a seal out.
1654
+
1655
+ What such a sealer shows, and what it does not. With its record kept, it
1656
+ never signs two different histories of one first line: each line is
1657
+ taken once at its place, and the books of one first line follow one
1658
+ another. Where it starts books only from permissions for each
1659
+ recorder's own agents, one recorder cannot have a book sealed whose
1660
+ first line is a permission for another recorder's agent (a renewal that
1661
+ stands in that recorder's book, say), and so cannot hold that
1662
+ permission back from the recorder whose book it is; nor, with its
1663
+ record begun again, bring another recorder's book in first. It sees
1664
+ only fingerprints after the first line, so it cannot tell that a book
1665
+ which starts from another first line (another permission for the same
1666
+ agent, or, where it does not read first lines, any record the agent's
1667
+ side can sign) repeats lines of a book it has sealed; nor that a later
1668
+ book repeats lines of the book before (section 21.6).
1669
+
1670
+ In particular, a recorder, through its own calls alone, can start a book from a permission for one of its own agents and copy into
1671
+ it permissions and stubs of another recorder's agent, leaving out any
1672
+ it chooses, and the sealer seals it. Where one person's passkey signed
1673
+ the permissions for agents of both recorders, a reader who names that
1674
+ passkey and the sealer's key set finds that book intact and within its
1675
+ slips, and nothing reports the copy. A seal of the other recorder's own
1676
+ book held elsewhere (section 21.5), handed to the checker with the
1677
+ copied book, shows a problem with it (`book-cut-short` or
1678
+ `seal-not-in-book`); where the two books' numbers differ, it cannot be
1679
+ compared (sections 21.5 and 21.6), and a checker says so and gives no
1680
+ pass. A
1681
+ witness statement on such a seal is never
1682
+ counted, because the seal covers a permission for another agent than
1683
+ the first line's (section 29.2, "When a statement counts"), so the seal does not read as
1684
+ witnessed; but nothing reports why. Readers of books from a sealer that
1685
+ serves recorders which do not trust each other SHOULD hold each
1686
+ recorder's own seals elsewhere and hand them to the checker; an
1687
+ organisation MAY instead run a sealer, with a key set of its own, for
1688
+ each recorder.
1689
+
1690
+ A sealer that loses its record, or is put back to an older copy, can be
1691
+ made to sign a second history of a book, as a witness can (section
1692
+ 29.3), and two records kept with one key set are two sealers. Witnesses
1693
+ (section 29) are the outside check for these: a witness knows a
1694
+ sequence by the recorder's keys, the person's passkey and the agent, so
1695
+ a second history shown to it would need it to sign for it too, and a
1696
+ book that does not start from a permission of the passkey the reader
1697
+ named is never read as witnessed. A checker cannot tell whether a seal
1698
+ was made by a central sealer or beside the agent: who holds the
1699
+ recorder's keys is not in the record.
1700
+
1701
+ The library's `openSealer` is such a sealer. Its record keeps, for each
1702
+ book, the first line's leaf fingerprint, the book's number, the recorder
1703
+ it belongs to, the book it follows, whether a later book follows it, and
1704
+ its latest seal with the tree at that seal; a book with no seal yet is
1705
+ kept at its first line. Lines that no seal covers are not kept: a sealer
1706
+ opened again asks for them again. A recorder may be named with the
1707
+ fingerprints of the key sets of its agents (section 21.1 gives the
1708
+ form), and with the most books it may hold; where any recorder is named
1709
+ with agents, every book is started with its first line itself, which
1710
+ the sealer reads as a permission and does not check further (the
1711
+ passkey's signature is the book's own check), and the sealer so learns
1712
+ that permission. A book that holds no seal can be released: nothing was
1713
+ signed for it. It keeps at most 1,000 books, and its record is written
1714
+ whole at each change that must last, so its size grows with the number
1715
+ of books (about 52 KB for each sealed book, most of it the latest
1716
+ seal's three signatures).
1717
+
1718
+
1323
1719
  ## 22. Cancelling a slip
1324
1720
 
1325
1721
  The person who signed a slip can end it early, with the same passkey.
@@ -1743,8 +2139,9 @@ can then work out the fingerprint again and match the two records,
1743
2139
  without either side's help. Only an identifier is meant to pick out one
1744
2140
  call. A stub may also name fingerprints of some of what was sent and
1745
2141
  received (the arguments; an HTTP request's method, address and body; an
1746
- answer's status and body); those show that the content matches, not
1747
- that it was the same call.
2142
+ answer's status and body; the name of the tool that was called, and its
2143
+ result); those show that the content matches, not that it was the same
2144
+ call.
1748
2145
 
1749
2146
  So document names (section 5.1) that begin `provared.` are reserved. A
1750
2147
  document name that begins `provared.` and is not in this list MUST be
@@ -1767,9 +2164,33 @@ exactly this text, in UTF-8:
1767
2164
  | `provared.request-id` | An identifier that the agent's side chose and sent with the call, exactly as sent |
1768
2165
  | `provared.event-id` | An identifier that the platform gave for the call, exactly as it gave it |
1769
2166
  | `provared.error` | The error text that the agent's software was given, exactly as given |
1770
-
1771
- An identifier or an error text MUST be one character or more, and
1772
- well-formed Unicode.
2167
+ | `provared.tool-name` | The name of the tool, exactly as the agent's software called it: the name the tool server, the framework or the model knows it by, which is not the action name of the slip (several tools may be one action) |
2168
+ | `provared.tool-call-id` | The identifier that the model gave the tool call, exactly as the agent's software received it (such as the `id` of a tool call in the model's answer) |
2169
+ | `provared.tool-result` | The tool's result, written in the one form of RFC 8785, as the arguments are: the whole value the tool gave back to the agent's software. Never the result itself |
2170
+
2171
+ An identifier, an error text or a tool's name MUST be one character or
2172
+ more, and well-formed Unicode. A result that cannot be written in the
2173
+ one form of RFC 8785 (a value that is not JSON, text that is not
2174
+ well-formed Unicode, a whole number that form cannot write exactly) has
2175
+ no fingerprint,
2176
+ and the stub then names no result; whoever writes the stub MAY say so
2177
+ under `provared.error`.
2178
+
2179
+ **The tool's name, the model's identifier and the result.** These three
2180
+ names were added after version 0.6.0 of the libraries. A stub's `action`
2181
+ is a name from the slip's own vocabulary; `provared.tool-name` binds the
2182
+ stub to the tool that was called under it, which is the name that the
2183
+ tool server's or the framework's own log shows. `provared.tool-call-id`
2184
+ binds the stub to the model's request for the call: the identifier that
2185
+ the model's provider wrote into its answer, and so into the record of
2186
+ the conversation that the provider or the agent's software keeps. It is
2187
+ the model's identifier, not the platform's (`provared.event-id`) and not
2188
+ one the agent's side chose and sent (`provared.request-id`): where the
2189
+ agent's software calls the tool twice for one request of the model (a
2190
+ retry), two stubs name one identifier. `provared.tool-result` binds the
2191
+ stub to what came back, as `provared.arguments` binds it to what was
2192
+ asked; an investigator who holds the result can work the fingerprint out
2193
+ again. Each of the three MUST appear at most once in a record.
1773
2194
 
1774
2195
  **How a request or an answer is written.** As the signature base of RFC
1775
2196
  9421 (HTTP Message Signatures), section 2.5, with no signature
@@ -1824,21 +2245,334 @@ with the body `{"hello": "world"}` is written as these four lines:
1824
2245
  identifier shows that the two records speak of one call, not that the
1825
2246
  call did what either says.
1826
2247
  - Only `provared.trace-id`, `provared.request-id` and `provared.event-id`
1827
- are meant to pick out one call. `provared.arguments`,
1828
- `provared.http-request`, `provared.http-response` and `provared.error`
1829
- show only that the content matches: identical requests, and identical
1830
- answers (many a `200` with the body `{}`), share one fingerprint, so a
1831
- match with one of them does not show that it was the same call.
1832
- - A fingerprint of an identifier, or of arguments, that is short or easy
1833
- to guess can be guessed: it hides nothing from someone who can try
1834
- the likely values.
2248
+ are meant to pick out one call; `provared.tool-call-id` picks out one
2249
+ request of the model, which may be carried out more than once.
2250
+ `provared.arguments`, `provared.http-request`,
2251
+ `provared.http-response`, `provared.error`, `provared.tool-name` and
2252
+ `provared.tool-result` show only that the content matches: identical
2253
+ requests, and identical answers (many a `200` with the body `{}`, many
2254
+ a result `"ok"`), share one fingerprint, and every call of one tool
2255
+ shares its name's fingerprint, so a match with one of them does not
2256
+ show that it was the same call.
2257
+ - A fingerprint of an identifier, of arguments, of a tool's name or of a
2258
+ result that is short or easy to guess can be guessed: it hides nothing
2259
+ from someone who can try the likely values. A tool's name is the most
2260
+ guessable (a reader tries the names of the framework's or the server's
2261
+ tools), and a short result (`"ok"`, `{}`, `true`) is little better; so
2262
+ "never the result itself" keeps the result out of the record, and does
2263
+ not hide it.
1835
2264
  - A checker cannot see whether a fingerprint was made from the text this
1836
2265
  section names: only someone who holds that text can work it out again.
1837
2266
  - Records written before this section was added may use names that
1838
- begin `provared.` that are not in the list, or name one of the four
2267
+ begin `provared.` that are not in the list, or name one of the
1839
2268
  once-only names twice; such records are refused, so a book that holds
1840
2269
  one no longer passes its check. A checker that does not know this
1841
- section reads a reserved name as a label.
2270
+ section reads a reserved name as a label. A checker that knows the
2271
+ first seven names only (versions 0.5.0 and 0.6.0 of the libraries)
2272
+ refuses a record that names `provared.tool-name`,
2273
+ `provared.tool-call-id` or `provared.tool-result`, as it refuses any
2274
+ name it does not know.
2275
+
2276
+ ## 28. The denial
2277
+
2278
+ A record shows what the agent did, not how often it was stopped. A
2279
+ denial closes part of that gap from the agent's own side: the agent's
2280
+ software states that it did not take an action that was asked for, and
2281
+ who said no. It is the agent's side's own word, like a one-sided stub.
2282
+
2283
+ Content:
2284
+
2285
+ | Member | Meaning | Form |
2286
+ |---|---|---|
2287
+ | `type` | The kind of content | `provared.denial.v0` |
2288
+ | `id` | A unique number | Section 3.7 |
2289
+ | `slip` | The slip the agent acts under | A fingerprint |
2290
+ | `pass` | Optional. For a helper agent: the pass it acts under | A fingerprint |
2291
+ | `action` | What was asked for | Text in the form of an action name. As in a refusal (section 18), a name that begins `provared.` need not be on the shared list here: what was asked for is written down as it was asked |
2292
+ | `amount` | Optional | As in a stub (section 5.1) |
2293
+ | `with` | Optional. The service asked for, as asked | The form of a service's `id`; it need not be one the slip names |
2294
+ | `details` | Optional. Documents, by their fingerprints only | As in a stub, with the reserved names of section 27 |
2295
+ | `source` | Who said no | `check`, `person` or `rule`, as below |
2296
+ | `codes` | Why, where `source` is `check`; absent otherwise | A list of 1 to 16 finding codes from the list below, none repeated |
2297
+ | `when` | When the action was refused, as the agent's side states it | A time |
2298
+
2299
+ | Source | Meaning |
2300
+ |---|---|
2301
+ | `check` | The check before acting (section 20) did not allow the action. |
2302
+ | `person` | The person refused, or gave no approval when asked. |
2303
+ | `rule` | A rule of the software around the agent, outside the slip. |
2304
+
2305
+ The format's own list of finding codes, from which `codes` is drawn, is
2306
+ every code a checker or the check before acting gives: `not-json`, `bad-envelope`, `bad-base64url`, `too-large`, `unknown-type`, `bad-signatures-layout`, `payload-not-canonical`, `payload-type-mismatch`, `bad-field`, `bad-key`, `signature-invalid`, `passkey-wrong-type`, `passkey-challenge-mismatch`, `passkey-origin-mismatch`, `passkey-rpid-mismatch`, `passkey-user-not-present`, `passkey-user-not-verified`, `passkey-bad-data`, `issuer-not-expected`, `issuer-origin-not-expected`, `slip-missing`, `slip-unusable`, `chain-broken`, `time-went-backwards`, `duplicate-id`, `duplicate-slip`, `countersignature-invalid`, `countersignature-wrong-stub`, `countersignature-not-possible`, `line-not-canonical`, `unknown-entry`, `approval-mismatch`, `approval-reused`, `approval-invalid`, `approval-not-found`, `approval-dated-after-stub`, `terms-not-found`, `terms-unusable`, `terms-mismatch`, `pass-missing`, `pass-mismatch`, `pass-too-deep`, `cover-invalid`, `cancellation-invalid`, `cancellation-not-found`, `acknowledgement-mismatch`, `vouching-missing`, `seal-mismatch`, `seal-chain-broken`, `sealer-not-expected`, `book-cut-short`, `seal-not-in-book`, `witness-invalid`, `dated-after-stamp`, `stamp-bad-data`, `stamp-wrong-data`, `stamp-invalid`, `headers-invalid`, `record-not-sound`, `proof-invalid`, `root-mismatch`, `check-failed`, `action-not-allowed`, `party-not-allowed`, `outside-valid-time`, `amount-missing`, `over-limit`, `over-each-limit`, `over-count-limit`, `over-period-limit`, `countersignature-missing`, `approval-missing`, `prohibited`, `pass-not-allowed`, `pass-wider`, `after-cancellation`, `outside-terms`.
2307
+ A code not on this list MUST be refused (`bad-field`), as MUST `codes`
2308
+ where `source` is not `check`, and its absence where it is.
2309
+
2310
+ It is signed as a stub is (section 5.2), with the denial labels of
2311
+ section 3.2: with the two keys of the agent the slip names or, where it
2312
+ holds `pass`, with the `to.keys` of that pass (`signature-invalid`),
2313
+ exactly as an acknowledgement is (section 26). It speaks for one agent.
2314
+
2315
+ **In a book.** The slip MUST be earlier in the book (`slip-missing`),
2316
+ and so MUST the pass, under the same slip (`pass-missing`,
2317
+ `pass-mismatch`); among the pages of a Show, both MUST be among the
2318
+ pages. A denial is in no chain (section 7): it changes no stub's `seq`
2319
+ or `previous`, and adds to no running total, count or period. It is
2320
+ compared with nothing: no rule ties its `when` to the slip's time or to
2321
+ any stub, and a checker does not judge whether the refusal was right.
2322
+
2323
+ **What a checker says about it.** A checker MUST show a denial as the
2324
+ agent's side's own statement that it did not take the action, with who
2325
+ said no and the codes it gives, and MUST count it (`denials` among the
2326
+ counts). It MUST NOT count a denial against the agent, nor take it as
2327
+ evidence that the action was not taken in some other way. A denial
2328
+ whose signatures this device could not check, or under a slip it could
2329
+ not confirm, is not shown as fact.
2330
+
2331
+ **How it differs from a refusal.** A refusal (section 18) is signed by
2332
+ the service and is the other side's word; a denial is signed by the
2333
+ agent's own keys and is the agent's side's word. A book may hold both
2334
+ for one attempt: the agent's side asked, the service refused, and the
2335
+ agent's software then wrote a denial with `source` `rule`. A checker
2336
+ shows both and links neither.
2337
+
2338
+ **Whoever writes denials** SHOULD write one only for an action that was
2339
+ not taken, and never both a stub and a denial for one request. A
2340
+ denial names what was asked for: its action, its amount and its service
2341
+ are in clear, and its documents are fingerprints only; arguments and
2342
+ the contents of documents MUST NOT be written into it. A writer SHOULD
2343
+ keep to a set number of denials in any hour of its own clock, counting
2344
+ each it writes at the time it writes it, so that an agent that asks
2345
+ again and again cannot fill its book (section 9) quickly, and SHOULD say
2346
+ how many it did not write. At 600 an hour, a book's 100,000 entries
2347
+ still fill in about a week.
2348
+
2349
+ What a denial does not show: that the action was not taken some other
2350
+ way; that the agent was asked at all, beyond its own word; or how often
2351
+ an agent was stopped, where it wrote no denial. Nothing obliges an
2352
+ agent's side to write one: a book with no denial shows nothing about
2353
+ refusals. A checker that does not know this section refuses a book that
2354
+ holds a denial (`unknown-entry`).
2355
+
2356
+ ## 29. Witnesses
2357
+
2358
+ A seal fixes everything before it (section 21), but whoever keeps a book
2359
+ can show different histories to different readers, each sealed, since a
2360
+ reader who holds one copy cannot see another (a "split view"). A
2361
+ **witness** is a party, with a key set of its own, that keeps, for each
2362
+ recorder, person and agent, the latest seal it has signed for, and signs
2363
+ a statement for a new seal only where the new seal extends that one: in
2364
+ the same book, or as the first seal of the next book (section 21.6). A
2365
+ person and an agent are those the permission on a book's first line
2366
+ names: its passkey and the agent's key set.
2367
+
2368
+ What a witness can then show is narrow, and is said exactly here: to a
2369
+ reader who fixed the start of a book (the permission it starts from,
2370
+ signed by a passkey the reader named) and its recorder (a key set the
2371
+ reader named), a second history sealed by that same recorder and
2372
+ starting from any permission that passkey gave that agent, renewals
2373
+ included, would need the witness to sign for it too. It shows nothing
2374
+ about a history that is sealed with other keys, or that starts from a
2375
+ permission for another agent.
2376
+
2377
+ ### 29.1 Consistency proofs
2378
+
2379
+ The tree of section 10 is the tree of RFC 9162, section 2.1. The proof
2380
+ that the tree of the first m entries of a book is the first part of the
2381
+ tree of its first n entries (a **consistency proof**) is made as RFC
2382
+ 9162, section 2.1.4.1, sets out, and checked with the steps of section
2383
+ 2.1.4.2. Each value of a proof is 32 bytes.
2384
+
2385
+ RFC 9162 defines a proof for 0 < m < n. Where m is larger than n, the
2386
+ proof does not check. Where m equals n, the proof is empty and the two
2387
+ top fingerprints MUST be the same. Where m is 0 (no seal is), the proof
2388
+ is empty and the earlier top fingerprint MUST be that of the empty tree,
2389
+ the SHA-256 hash of nothing. Anything that is not a proof of the two
2390
+ sizes it is checked for, including an empty proof for 0 < m < n, does
2391
+ not check.
2392
+
2393
+ ### 29.2 The witness statement
2394
+
2395
+ Content:
2396
+
2397
+ | Member | Meaning | Form |
2398
+ |---|---|---|
2399
+ | `type` | The kind of content | `provared.witness.v0` |
2400
+ | `id` | A unique number | Section 3.7 |
2401
+ | `seal` | The seal it speaks of | That seal's fingerprint (section 3.5) |
2402
+ | `size`, `root` | Repeated from the seal, so that the statement stands alone | As in the seal (section 21.1) |
2403
+ | `by` | The witness | `{"keys": the witness's two keys, "name": text}`; the name is a label |
2404
+ | `when` | When the witness signed, as the witness states | A time |
2405
+
2406
+ It is signed with the two keys in `by`, with the witness labels of
2407
+ section 3.2. It means: "I saw this seal by this time; for the recorder
2408
+ that signed it, and the person and agent of the permission its book
2409
+ starts from, it extends every earlier seal I signed for; I will sign for
2410
+ no seal of that recorder, person and agent that does not extend it."
2411
+
2412
+ **Beside a seal.** An entry that holds a seal MAY hold, in `witnesses`,
2413
+ 1 to 4 statements, beside `stamps` (section 9). A line of a book is a
2414
+ leaf of its tree, so the statements on it are those the line held when
2415
+ it was written. Statements that came later MAY be handed to a checker
2416
+ with a copy of the seal, as a seal held elsewhere (section 21.5):
2417
+ `{"seal": seal record, "stamps": [...], "witnesses": [...]}`. A seal is
2418
+ about 52,000 bytes and a statement about 12,000, so a seal with four
2419
+ statements and four of the largest time-stamps would pass the longest a
2420
+ line may be (section 9): whoever writes such a line keeps fewer on it,
2421
+ and hands the others over beside the book.
2422
+
2423
+ A checker MUST confirm, for each statement, and otherwise report a
2424
+ problem:
2425
+
2426
+ 1. the list holds 1 to 4 statements (`bad-field`);
2427
+ 2. its envelope and content, as for any record (section 3);
2428
+ 3. both its signatures check against `by.keys` (`witness-invalid`);
2429
+ 4. its `seal`, `size` and `root` are the fingerprint, `size` and `root`
2430
+ of the seal it stands beside (`witness-invalid`);
2431
+ 5. its `when` is not more than 300 seconds earlier than the seal's own
2432
+ `when` (`witness-invalid`): a witness cannot have seen a seal before
2433
+ it was made;
2434
+ 6. no two statements beside one seal are signed with the same key set
2435
+ (`bad-field`);
2436
+ 7. on a line of a book, its `id` is that of no other record in the book
2437
+ (`duplicate-id`), as for every record (section 7).
2438
+
2439
+ A statement on a seal's line that does not pass is a problem with that
2440
+ entry. A statement handed over with a seal held elsewhere that does not
2441
+ pass is a problem with the check as a whole, and is not used; the seal
2442
+ is used all the same, as an acknowledgement is (section 26).
2443
+
2444
+ **When a statement counts.** A witness knows which books are one
2445
+ sequence only by the passkey and the agent of the permission on their
2446
+ first line and the keys of their recorder (section 29.3), and the
2447
+ recorder chooses both the first line and its keys. So a
2448
+ statement counts only where the reader fixed both. All of these must
2449
+ hold:
2450
+
2451
+ 1. it passed its check, and both its signatures were checked on this
2452
+ device;
2453
+ 2. the person checking named its witness among the witnesses they
2454
+ trust, by the fingerprint of its key set (section 21.1); a statement
2455
+ from any other witness is shown, with that fingerprint, and not
2456
+ counted;
2457
+ 3. the person named the passkeys they trust, and the book's first line
2458
+ (for a Show: its page 0) is a permission that passed its check,
2459
+ signed by one of them;
2460
+ 4. the person named the recorders they expect, so that a seal by any
2461
+ other recorder is a problem (rule 5 of section 21.1);
2462
+ 5. every permission among the entries the seal covers names the same
2463
+ passkey key and the same agent's key set as the permission on the
2464
+ first line. A witness keeps the books of each person and agent apart
2465
+ (section 29.3), so a book that starts with a permission for one agent
2466
+ and holds a permission for another, or from another passkey, further
2467
+ on could be the first book of a sequence the witness never saw, and so
2468
+ a fork of the other's. A renewal by the same person for the same agent
2469
+ meets this rule. Among the pages of a Show, the pages MUST hold every
2470
+ entry the seal covers: single pages cannot show that no other
2471
+ permission stands between them, and a Show never counts a statement
2472
+ that the whole book would not;
2473
+ 6. the seal it stands beside passed its own check, and its Ed25519 and
2474
+ ML-DSA-87 signatures were checked on this device. As for a seal held
2475
+ elsewhere (section 21.5), its third signature (SLH-DSA) may be one
2476
+ the device cannot check: the statement speaks of the seal's content,
2477
+ which its fingerprint fixes;
2478
+ 7. for a statement handed over with a seal held elsewhere: that seal
2479
+ counts (section 21.5), and the book holds the same seal at its place;
2480
+ the statement then counts for the book's seal there.
2481
+
2482
+ Where a statement from a witness the person trusts is not counted
2483
+ because of rule 3, 4 or 5, a checker MUST say why. A witness cannot
2484
+ apply rule 5 itself: it sees a book's first line, not its entries. A checker MUST say,
2485
+ for the book, the latest seal for which a statement counts, the entries
2486
+ it covers, the witnesses whose statements count for it, and every seal
2487
+ for which one counts; and where none does, that none does. Where a
2488
+ problem was found, nothing is said to be witnessed.
2489
+
2490
+ **What being witnessed changes in the answer: nothing else.** It never
2491
+ excuses a fault, never makes a record pass that does not, and is not
2492
+ needed for a pass. It gives no time: a statement's `when` is the
2493
+ witness's own word, and is not used as a time-stamp (section 21.2). A
2494
+ statement that does not pass is a problem like any other.
2495
+
2496
+ ### 29.3 What a witness SHOULD check before it signs
2497
+
2498
+ A checker cannot test how a witness behaved: a person names a witness
2499
+ they trust to do the following.
2500
+
2501
+ 1. **Know a sequence of books** by the fingerprint of the recorder's key
2502
+ set (section 21.1) with the thumbprint of the passkey key (RFC 7638)
2503
+ and the fingerprint of the agent's key set that the permission on the
2504
+ book's first line names. So every permission one person gives one
2505
+ agent, under one recorder, is one sequence, renewals included: a book
2506
+ that starts with a later permission must follow on from the seal the
2507
+ witness holds, as any new book. This is written into no record. A book
2508
+ whose first line is not a permission (an entry that holds only a slip)
2509
+ is not one a witness keeps. One recorder key set therefore keeps one
2510
+ sequence for each person and agent: books kept side by side for one
2511
+ agent need recorder keys of their own, and are then other sequences.
2512
+ 2. **Check the seal** as a seal that stands alone: its envelope, its
2513
+ content and all three of its signatures. A witness on a device that
2514
+ cannot check one of the three signs nothing.
2515
+ 3. Where it holds no seal of that sequence: confirm that the audit path
2516
+ of the book's first line, at place 0, leads to the new seal's top
2517
+ fingerprint (RFC 9162, section 2.1.3.2), so that the first line it was
2518
+ given is the book's.
2519
+ 4. Where it holds a seal of that sequence, of book k (section 21.6):
2520
+ - a seal of book k: confirm that it covers more entries; that its
2521
+ `previous` names the seal it holds (a seal it was not shown is shown
2522
+ to it first, in order); and that a consistency proof (section 29.1)
2523
+ from the size and top fingerprint of the seal it holds to those of
2524
+ the new seal checks;
2525
+ - a seal of book k + 1: confirm that its `previous` names the seal it
2526
+ holds, and that the audit path of the book's first line leads to its
2527
+ top fingerprint, as in item 3. From then on, book k is closed to it;
2528
+ - a seal of an earlier book than k, or of a book after k + 1: refuse
2529
+ it;
2530
+ - in every case, that its `when` is not earlier than that of the seal
2531
+ it holds.
2532
+ 5. **Never sign two different seals of one book at one size**, nor a
2533
+ seal that does not extend the one it holds. Shown the seal it holds
2534
+ again, give the same statement again.
2535
+ 6. Refuse a seal dated more than 300 seconds after its own clock, and
2536
+ date its statement by its own clock.
2537
+ 7. **Keep, before it gives a statement out, that it now holds the new
2538
+ seal.** A witness that loses what it holds, or is put back to an
2539
+ older copy of it, can be made to sign a fork. Opened again from what
2540
+ it kept, it SHOULD sign nothing new until it has been brought up to
2541
+ date from a copy, kept apart, of the statements it gave out.
2542
+
2543
+ ### 29.4 What a witness shows, and what it does not
2544
+
2545
+ For a book whose first line is a permission signed by a passkey the
2546
+ reader named, sealed by a recorder the reader named, whose every
2547
+ permission before the seal is from that passkey for the same agent: the
2548
+ witness saw the
2549
+ seal, and so the entries before it by their top fingerprint, by the time
2550
+ it states; and a second history of those entries, sealed by the same
2551
+ recorder and starting from any permission that passkey gave the same
2552
+ agent, shown to someone else, needs that witness to sign for it too,
2553
+ which a witness that keeps section 29.3 does not. That holds across the
2554
+ books of that person and agent: a new book cannot start from an earlier
2555
+ seal than the latest the witness holds. Two witnesses need two to fail. With the latest seal a witness
2556
+ holds, handed over beside the book it is of (section 21.5), the end of
2557
+ that book cannot be cut off back to before that seal unnoticed.
2558
+
2559
+ It does not show:
2560
+
2561
+ - anything about a history sealed with another key set, even one the
2562
+ reader also named (a reader who names two recorders should know that a
2563
+ fork sealed with the second reads as witnessed), or one that starts
2564
+ from a permission for another agent: to a witness, each is another
2565
+ sequence;
2566
+ - that a later book does not repeat or leave out what an earlier book
2567
+ holds: each book is checked on its own;
2568
+ - anything that was never shown to it: a book, or the end of a book
2569
+ after the latest seal it signed for. Nothing obliges a recorder to
2570
+ show its seals to a witness;
2571
+ - that the entries are true: a witness sees fingerprints, not entries;
2572
+ - when the seal was made: its `when` is its own word;
2573
+ - that what a witness keeps was not changed. Whoever can change it can
2574
+ make a witness forget a sequence, and it then signs again for that
2575
+ sequence from any seal.
1842
2576
 
1843
2577
  ---
1844
2578