Repository navigation
Expand file tree
/
Copy pathcheck.html
More file actions
1516 lines (1394 loc) · 87.8 KB
/
Copy pathcheck.html
File metadata and controls
1516 lines (1394 loc) · 87.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Check a decision attestation · Observer Protocol</title>
<meta name="description" data-shared-copy="offline-scope" content="Paste a decision attestation or an enforcement refusal record. It is checked in your browser, against a key recovered from the record's own identifier, and nothing you paste leaves the page." />
<!-- ==========================================================================
REVIEWER: THIS PAGE LOADS NOTHING FROM ANYWHERE. KEEP IT THAT WAY.
No webfont link, no stylesheet, no script src, no fetch, no form action,
no analytics, no favicon link. Every other page on this site pulls IBM
Plex from fonts.googleapis.com; this one uses the same family names with
a system fallback so a visitor who has the font gets it and a visitor who
does not costs no request. The page states that nothing a visitor pastes
leaves the browser, and a page making ANY request while saying so is the
one defect that would matter here: a person pasting an artifact about a
decision made against them is the reader this page is for.
If this page ever needs an asset, inline it. Do not add a link tag.
AND THIS FILE BEING CLEAN IS NOT THE CLAIM. On 2026-08-17 the CDN in front of this
origin was adding an analytics script to every HTML response on the zone, and this
page said it loaded nothing. The file was clean throughout. So was a plain curl of
the live URL, because the injection happened ONLY for requests carrying browser
headers, and so was this page in a browser on a laptop, because there was no CDN in
that path. Three instruments, three clean results, and the sentence was false for
every real visitor. The setting was disabled and the absence corroborated across two
runs an hour apart before the sentence was restored.
So: scripts/served-page-audit.mjs fetches this URL WITH browser headers, and the
register row on the homepage carries what that layer is able to add. Keep the audit
pointed at production. What this file contains has never been the question.
This comment deliberately names no vendor, product or endpoint. It is served to
every visitor, and while it did name them, a text search of this page for those
strings reported them present when nothing was loading them. The register row is
where the instance is recorded; a comment inside the subject is not the place to
write down what the subject is being checked for.
========================================================================== -->
<style>
:root {
--bg:#0a0a08; --bg2:#111110; --bg3:#1a1a18; --border:#2a2a26;
--amber:#f5a623; --amber-dim:#b8791a;
--green:#4ade80; --green-dim:#166534; --red:#f87171; --red-dim:#7f1d1d;
--text:#e8e8e0; --text-dim:#888880; --text-faint:#444440; --teal:#5eead4;
--mono:'IBM Plex Mono',ui-monospace,SFMono-Regular,Menlo,monospace;
--sans:'IBM Plex Sans',ui-sans-serif,system-ui,-apple-system,sans-serif;
}
*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; }
body { background:var(--bg); color:var(--text); font-family:var(--sans); font-size:16px; line-height:1.6; overflow-x:hidden; }
code { font-family:var(--mono); font-size:0.92em; color:var(--teal); word-break:break-word; }
nav { position:fixed; top:0; left:0; right:0; z-index:100; display:flex; align-items:center; justify-content:space-between; padding:0 2.5rem; height:56px; background:rgba(10,10,8,0.92); backdrop-filter:blur(12px); border-bottom:1px solid var(--border); }
.nav-logo { font-family:var(--mono); font-size:0.8rem; font-weight:500; color:var(--amber); letter-spacing:0.12em; text-transform:uppercase; text-decoration:none; }
.nav-links { display:flex; gap:2rem; list-style:none; }
.nav-links a { font-family:var(--mono); font-size:0.72rem; color:var(--text-dim); text-decoration:none; letter-spacing:0.06em; }
.nav-links a:hover { color:var(--text); }
.nav-links a.active { color:var(--amber); }
@media (max-width:900px) { .nav-links { display:none; } }
.page-header { padding:9rem 2.5rem 3rem; border-bottom:1px solid var(--border); }
.page-header-inner { max-width:900px; margin:0 auto; }
.breadcrumb { font-family:var(--mono); font-size:0.68rem; color:var(--text-faint); letter-spacing:0.1em; margin-bottom:1.5rem; }
.breadcrumb span { color:var(--amber); }
h1 { font-size:clamp(2rem,3.6vw,3rem); font-weight:600; line-height:1.1; letter-spacing:-0.02em; margin-bottom:1.25rem; }
.page-sub { font-size:1.02rem; color:var(--text-dim); max-width:700px; line-height:1.8; font-weight:300; }
.page-sub strong { color:var(--text); font-weight:400; }
section { padding:3.5rem 2.5rem; }
.section-inner { max-width:900px; margin:0 auto; }
.section-label { font-family:var(--mono); font-size:0.68rem; letter-spacing:0.16em; text-transform:uppercase; color:var(--amber); margin-bottom:1rem; }
h2 { font-size:1.4rem; font-weight:500; margin-bottom:1rem; letter-spacing:-0.01em; }
.body { font-size:0.94rem; color:var(--text-dim); line-height:1.85; font-weight:300; margin-bottom:1rem; }
.body strong { color:var(--text); font-weight:400; }
label { display:block; font-family:var(--mono); font-size:0.68rem; letter-spacing:0.1em; text-transform:uppercase; color:var(--text-dim); margin-bottom:0.5rem; }
textarea, input[type=text] {
width:100%; background:var(--bg2); color:var(--text); border:1px solid var(--border);
font-family:var(--mono); font-size:0.76rem; line-height:1.7; padding:0.9rem 1rem; resize:vertical;
}
textarea:focus, input[type=text]:focus { outline:none; border-color:var(--amber-dim); }
textarea { min-height:220px; }
.field { margin-bottom:1.25rem; }
.hint { font-size:0.78rem; color:var(--text-faint); margin-top:0.4rem; line-height:1.7; }
.controls { display:flex; gap:0.75rem; flex-wrap:wrap; align-items:center; }
button {
font-family:var(--mono); font-size:0.74rem; letter-spacing:0.08em; text-transform:uppercase;
padding:0.75rem 1.4rem; border:1px solid var(--amber-dim); background:transparent; color:var(--amber); cursor:pointer;
}
button:hover { background:#f5a6231a; }
button.secondary { border-color:var(--border); color:var(--text-dim); }
button.secondary:hover { background:var(--bg3); color:var(--text); }
.result { margin-top:2rem; border:1px solid var(--border); background:var(--bg2); display:none; }
.result.shown { display:block; }
.result-head { padding:1rem 1.25rem; border-bottom:1px solid var(--border); font-family:var(--mono); font-size:0.8rem; letter-spacing:0.06em; display:flex; justify-content:space-between; gap:1rem; flex-wrap:wrap; }
.result-head .state { font-weight:500; }
.result.ok .result-head { border-left:2px solid var(--green); }
.result.ok .state { color:var(--green); }
.result.bad .result-head { border-left:2px solid var(--red); }
.result.bad .state { color:var(--red); }
.result.info .result-head { border-left:2px solid var(--amber); }
.result.info .state { color:var(--amber); }
.result-body { padding:1.25rem; font-size:0.9rem; color:var(--text-dim); line-height:1.8; font-weight:300; }
.result-body p + p { margin-top:0.75rem; }
.checklist { list-style:none; margin-top:1rem; }
.checklist li { font-family:var(--mono); font-size:0.76rem; color:var(--text-dim); line-height:2; padding-left:1.4rem; position:relative; }
.checklist li::before { content:'✓'; position:absolute; left:0; color:var(--green); }
.fields { margin-top:1.25rem; border-top:1px solid var(--border); padding-top:1rem; }
.fields div { font-family:var(--mono); font-size:0.76rem; line-height:2; color:var(--text-dim); word-break:break-all; }
.fields b { color:var(--text-faint); font-weight:400; display:inline-block; min-width:11rem; }
.coverage { margin-top:1.5rem; border-top:1px solid var(--border); padding-top:1.25rem; }
.coverage h3 { font-family:var(--mono); font-size:0.72rem; letter-spacing:0.1em; text-transform:uppercase; color:var(--text); margin-bottom:0.75rem; font-weight:500; }
.coverage p + p { margin-top:0.75rem; }
.checklist.plain li { padding-left:0; }
.checklist.plain li::before { content:''; }
.checklist.plain code { color:var(--text-dim); }
.note { border-left:2px solid var(--border); background:var(--bg2); padding:1.25rem 1.5rem; margin-top:1.5rem; font-size:0.88rem; color:var(--text-dim); line-height:1.8; font-weight:300; }
.note h4 { font-family:var(--mono); font-size:0.7rem; letter-spacing:0.1em; text-transform:uppercase; color:var(--text); margin-bottom:0.6rem; font-weight:500; }
.next { border:1px solid var(--border); }
.next-row { display:grid; grid-template-columns:1fr auto; gap:1rem; padding:0.9rem 1.25rem; border-bottom:1px solid var(--border); font-family:var(--mono); font-size:0.76rem; color:var(--text-dim); align-items:center; }
.next-row:last-child { border-bottom:none; }
.next-row .tag { color:var(--amber); font-size:0.68rem; letter-spacing:0.08em; text-transform:uppercase; }
.next-row .tag.live { color:var(--green); }
footer { border-top:1px solid var(--border); padding:2.5rem; }
.footer-inner { max-width:900px; margin:0 auto; display:flex; justify-content:space-between; gap:2rem; flex-wrap:wrap; font-family:var(--mono); font-size:0.7rem; color:var(--text-faint); }
.footer-inner a { color:var(--text-dim); text-decoration:none; margin-right:1.5rem; }
</style>
</head>
<body>
<nav>
<a href="/" class="nav-logo">Observer Protocol</a>
<ul class="nav-links">
<li><a href="/architecture.html">Architecture</a></li>
<li><a href="/docs.html">Docs</a></li>
<li><a href="/verify.html">Verify</a></li>
<li><a href="/check.html" class="active">Check</a></li>
<li><a href="/supervisors.html">Supervisors</a></li>
</ul>
</nav>
<div class="page-header">
<div class="page-header-inner">
<div class="breadcrumb">OBSERVER PROTOCOL · <span>CHECK A DETERMINATION OR A REFUSAL</span></div>
<h1>Paste a decision attestation<br/>or an enforcement refusal record.<br/>Find out whether it holds.</h1>
<p class="page-sub" data-shared-copy="offline-scope">
<strong>Nothing you paste leaves this browser.</strong> The page loads no font, no script and no data from
anywhere, makes no request after it loads, sends nothing, stores nothing and logs nothing. <strong>Measured against
the page as it is served, not against the file:</strong> on 20 August 2026 it carried three scripts, all three its own and
nothing else, and pasting a record and checking it produced no network request at all. The check runs on your
machine, against a key recovered from the record's own identifier: the decider's for a
determination, the enforcement point's for a refusal. You do not need an account and you are not our
customer.
</p>
</div>
</div>
<section>
<div class="section-inner">
<div class="section-label">01 · The check</div>
<div class="field">
<label for="artifact">The record, or the attestation document</label>
<textarea id="artifact" spellcheck="false" autocomplete="off" placeholder="Paste JSON here."></textarea>
<div class="hint">A stored determination record and an enforcement refusal record each carry their signature inside them. A bare attestation document does not, so paste its signature below.</div>
</div>
<div class="field">
<label for="signature">Signature, base64 · only needed for a bare document</label>
<input type="text" id="signature" spellcheck="false" autocomplete="off" placeholder="Leave empty when the JSON above carries its own signature." />
</div>
<div class="controls">
<button id="run" type="button">Check it</button>
<button id="load-sample" class="secondary" type="button">Load the published example</button>
<button id="load-refusal" class="secondary" type="button">Load a refusal record</button>
<button id="clear" class="secondary" type="button">Clear</button>
</div>
<div class="result" id="result">
<div class="result-head"><span class="state" id="result-state"></span><span id="result-kind"></span></div>
<div class="result-body" id="result-body"></div>
</div>
<div class="note">
<h4>The example, and why it is this one</h4>
<p><strong>Load the published example</strong> fills the box with <code>ppp-determination-refused-outcome.json</code>, served from this domain
and checked in CI on every build. It is a refusal determination: an agent declining a claim, which is the case a
disputing party actually arrives with. Try the tool on it before you have an artifact of your own.</p>
<p><strong>Load a refusal record</strong> fills it with an enforcement refusal instead, from a card-dispute demonstration
against Banxico Circular 34/2010 numeral 3.6. A reversal of a credited amount was requested, the decider found it did not
proceed, and the mandate refused the payment because that outcome is not one it treats as authorising. The figures and the
parties are constructed and the regulation is real; nothing in it is a client record and it is an authorisation for
nothing.</p>
<p><strong>It is the record a service actually sent, not one written for this page.</strong> It was taken unmodified from
a <code>GET /v1/refusals</code> response, which is the shape a console's copy button puts on your clipboard, and it is
signed under <code>op.enforcement.refusal.v3</code>. So the example here is the same thing you would be holding, in the
same shape, under the construction the enforcement point issues today.</p>
<p><strong>The published engine reads v2 and v3 records.</strong> A v3 record
checks on this page and with <code>npm install</code>: <code>@observer-protocol/policy-engine</code> rebuilds a v3
store record with v3's fields, and reads the served row through <code>signableFromRefusalRow</code>.
<strong>Corrected 24 August 2026:</strong> this said the v3 construction was in no published release and did not check
with <code>npm install</code>. That held through 24 August 2026, until rc.22 was published; the publish makes it false.
Measured 24 August 2026 against the version <code>npm install</code> serves.</p>
<p><strong>It is signed by a demonstration key that no party stands behind.</strong> The key the record names belongs to the
demonstration service that issued it, the same key that signs the five v3 records this page carries as regression vectors. A
green result here establishes the construction and the key: that these bytes, rebuilt under the construction the record
states, were signed by the key the record names. It does not establish who held that key, and for this example nobody
does. The same limit is stated on the Lightning entry in the registry, where the issuer was a demonstration
<code>did:key</code> rather than a production one, and it applies here for the same reason.</p>
<p><strong>It cites a determination, which is what makes the panel below the verdict worth reading.</strong> The refusal's
signature covers four fields of that citation and not the rest of it, and the page derives that boundary by rebuilding the
payload without each field rather than by consulting a list.</p>
</div>
<div class="note">
<h4>What this runs</h4>
<p><strong>An attestation document</strong> runs the same sequence as <code>verifyDecisionAttestation</code>: the document is
canonicalised, the decider's key is recovered from its <code>did:key</code>, and an Ed25519 signature is checked over those
bytes with your browser's own WebCrypto.</p>
<p><strong>A refusal record</strong> runs the same sequence as <code>signableFromRefusal</code> and <code>refusalPayload</code>: the
signed payload is rebuilt from the record's own fields, under the construction <em>the record itself states</em> rather than
whichever version this page ships, and the signature is checked against the key the record names.</p>
<p>The attestation sequence and the v1, v2 and v3 refusal constructions are what <code>@observer-protocol/policy-engine</code> exports at
<span data-engine-version="current">1.0.0-rc.22</span>, the version npm's <code>latest</code> tag serves a reader today.
<strong>Corrected 24 August 2026:</strong> until rc.22 was published this paragraph said the v3 construction was in no
published release and this page carried it from an unpublished engine commit; the publish makes v3 the package's like v1 and
v2, and moved the version above from rc.21 to rc.22. This page loads nothing, so it cannot import the package; it carries its
own copy of those constructions and CI asserts, on every build, that the v1, v2 and v3 bytes it produces are identical to the
package's own over every such refusal this repository publishes, with the five v3 records the enforcement point signed kept as
regression vectors their own signatures verify.
A divergence turns the build red rather than turning a verdict here wrong.
<a href="/verify.html" style="color:var(--amber); text-decoration:none;">The same checks, run from npm on your own machine ↗</a></p>
</div>
</div>
</section>
<section style="background:var(--bg2); border-top:1px solid var(--border);">
<div class="section-inner">
<div class="section-label">02 · What this checker covers next</div>
<h2>Two artifact types today.</h2>
<p class="body">
This page checks a decision attestation and an enforcement refusal record. A delegation credential
<strong>verifies against the published engine already</strong>, on a reader's own machine, by the route
<a href="/verify.html" style="color:var(--amber); text-decoration:none;">/verify</a> sets out. What is not built is its box
on this page, and that is the only thing missing: a delegation credential resolves a <code>did:web</code> issuer over the
network, which is the one thing this page will not do.
</p>
<div class="next">
<div class="next-row"><span>Decision attestation</span><span class="tag live">On this page</span></div>
<div class="next-row"><span>Enforcement refusal record</span><span class="tag live">On this page</span></div>
<div class="next-row"><span>Delegation credential</span><span class="tag">Next</span></div>
</div>
</div>
</section>
<footer>
<div class="footer-inner">
<div>
<a href="/">Home</a>
<a href="/verify.html">Verify</a>
<a href="/docs.html">Docs</a>
<a href="/architecture.html">Architecture</a>
</div>
<div>Observer Protocol · AIP v0.9 · MIT · observerprotocol.org</div>
</div>
</footer>
<!-- The published example, embedded verbatim so that loading it costs no request.
scripts/check-public-checker.mjs asserts this block parses equal to
verify-samples/ppp-determination-refused-outcome.json and fails the build otherwise. -->
<!-- A refusal record, embedded verbatim so that loading it costs no request.
LIFTED UNMODIFIED FROM A RUNNING SERVICE, GET /v1/refusals, on 2026-08-20. It is the
SERVED shape a console copy button emits, not the store shape, and it is signed under
op.enforcement.refusal.v3 so the example a visitor loads is the construction the
enforcement point issues rather than the one it used to.
Constructed figures, constructed parties, a real regulation, an authorisation for
nothing. scripts/check-public-checker.mjs verifies this block with the page's own
verifier and asserts a one-character change to it stops verifying;
scripts/check-page-payload-parity.mjs holds the v3 construction to signatures the
enforcement point produced. -->
<script type="application/json" id="op-refusal-sample">
{
"refusalId": "refusal-1",
"at": "2026-08-20T17:51:23.382Z",
"observedAt": "2026-08-20T17:52:41.490Z",
"agentId": "did:web:emisor-demo.example:agents:disputas-0001",
"mandateId": "urn:uuid:card-dispute-demo-mandate",
"refusedBy": "mandate",
"code": "OUTCOME_NOT_AUTHORIZING",
"constraint": "actionScope.requiresDecisionAttestation",
"attempted": {
"amountRaw": "534598",
"decimals": 2,
"asset": "MXN",
"rail": "demo:emisor-demo:tarjetas",
"counterparty": "cuenta:emisor-demo-recuperaciones-0001"
},
"appliedBound": {
"state": "not-supplied",
"constraint": "actionScope.requiresDecisionAttestation",
"reason": "not-reached",
"note": "The mandate required a decision attestation; the one this payment cited verified, and its outcome is not one this mandate treats as authorising a payment. No spending bound was compared, because no mandate amount constraint was reached."
},
"credential": {
"state": "not-supplied",
"note": "The evaluator supplied no credentialDigest with this verdict, so this service cannot say which credential document the bound came from."
},
"attestation": {
"state": "attested",
"decisionId": "DICT-2026-1003",
"decider": "did:key:z6Mkj5deK1cmKEWgasaVX6gjjUNyRZZ9rA9cL3XW9sRy8ZVM",
"outcome": "no_procede_reverso_abono",
"policyRef": {
"id": "https://emisor-demo.example/policy/banxico-34-2010/numeral-3-6/v1",
"hash": "sha256:51ba8f7cf6300e6d71334954afccf740eae8effcf294016efb17ddd93f36537b",
"hashMethod": "sha256"
},
"vocabularyRef": {
"id": "https://emisor-demo.example/vocab/dictamen-34-2010",
"version": "1.0.0",
"hashMethod": "sha256",
"source": "client-defined",
"values": [
"procede_reverso_abono",
"no_acredita_elemento_36b",
"abono_firme_periodo_transcurrido",
"no_procede_reverso_abono"
],
"hash": "sha256:669c84a02eac537c2d02f27ef3867ca8c95d231dca7e283da822d1f94e178c76"
},
"decidedAt": "2026-08-18T17:51:23.382Z",
"inputsDigest": "sha256:2b3f9476dfd9ac146db99a7d8c783505f908a734f8487c0f0ec5f261207da005",
"deciderArtifactDigest": {
"state": "digest",
"value": "sha256:3f856973618843ccd7c6a8caa7cd9ef34e3f36d20d5b442a2c81180a35878d27"
},
"amount": {
"amountRaw": "534598",
"decimals": "2",
"asset": "MXN"
},
"counterparty": "cuenta:emisor-demo-recuperaciones-0001",
"rail": "demo:emisor-demo:tarjetas"
},
"network": "demo:emisor-demo:tarjetas",
"signature": {
"state": "signed",
"value": "+weFCe2Hs9NLWiZp5l2808P6DlM1svxzyPfzfmT6oNkFPB0R/b2/jLlMiyEfrqtM1B74DmFAFTH9NIoNnC5fDw==",
"signedBy": "did:key:z6MkfanQUxSYHy3xVWA2KJm6cKwrUSCHVJVQFr8mXWHD7o6s",
"payloadType": "op.enforcement.refusal.v3"
}
}
</script>
<script type="application/json" id="op-sample">
{
"k": "determination",
"admission": {
"path": "payment",
"grantRequired": false,
"decider": "did:key:z6MkoMCP6imN1HfKC1gVHDMffgP3af58VnGY621KRHrEsbDq",
"grant": {
"state": "held",
"grantId": "decider-grant-1",
"judgedAt": "2026-08-15T20:17:44.609Z"
}
},
"decisionId": "urn:ppp-cases:decision:MF-0001:APR",
"decisionIdSource": "signed-document",
"document": "eyJhc3N1cmFuY2UiOiAic2VsZi1kZWNsYXJlZCIsICJkZWNpZGVkQXQiOiAiMjAyNi0wOC0xNFQwMDowMDowMFoiLCAiZGVjaWRlciI6ICJkaWQ6a2V5Ono2TWtvTUNQNmltTjFIZktDMWdWSERNZmZnUDNhZjU4Vm5HWTYyMUtSSHJFc2JEcSIsICJkZWNpZGVyQXJ0aWZhY3REaWdlc3QiOiB7InN0YXRlIjogImRpZ2VzdCIsICJ2YWx1ZSI6ICJzaGEyNTY6ZDRiYjQxZTMwNGZlODFjNDM5MjRjOTgwMzQ4OGQxZGYwY2U0MjQ1OWZmMDc5MDY2MmQxZjBlMTBhMzQ3MDI3OCJ9LCAiZGVjaXNpb25JZCI6ICJ1cm46cHBwLWNhc2VzOmRlY2lzaW9uOk1GLTAwMDE6QVBSIiwgImRldGVybWluYXRpb24iOiB7ImNhc2VDYXRlZ29yeSI6ICJtYWxmb3JtZWQiLCAiY2FzZUlkIjogIk1GLTAwMDEiLCAiY2FzZVJlY29yZERpZ2VzdCI6ICI4ZjMzNDg3YmIwMDZhMmNiNDY4MTg2NDQ4MjVlZThlNmQ2MmU1NWIxODkyNjgyYmVkMzM2OTM2OTg5NDgyN2VlIiwgImNhc2VSZWNvcmREaWdlc3RNZXRob2QiOiAic2hhMjU2IG92ZXIgdGhlIFVURi04IGJ5dGVzIG9mIHRoZSBjYXNlJ3MgbGluZSBpbiBjYXNlcy9jYXNlcy5qc29ubCwgZXhjbHVkaW5nIHRoZSBuZXdsaW5lIiwgImNhc2VTZXQiOiAiY2FzZXMvY2FzZXMuanNvbmwiLCAiZGVjaWRlckFydGlmYWN0IjogInBwcC9lbmdpbmUucHksIHRoZSBkZXRlcm1pbmF0aW9uIGVuZ2luZSB3aG9zZSBkaWdlc3QgZGVjaWRlckFydGlmYWN0RGlnZXN0IGNhcnJpZXMiLCAicmVmdXNhbENsYXNzIjogIlNDSEVNQSIsICJyZWZ1c2FsQ29kZXMiOiBbIkVfUFJJTkNJUEFMX01JU1NJTkciXSwgInJlZnVzZWQiOiAidHJ1ZSIsICJydWxlQ2l0YXRpb24iOiAiODUgRlIgMjA4MTEiLCAicnVsZVZlcnNpb24iOiAiQVBSIn0sICJvdXRjb21lIjogImRldGVybWluYXRpb24tcmVmdXNlZC1zY2hlbWEiLCAicG9saWN5UmVmIjogeyJoYXNoIjogIjliN2M1NjFiYmNmMGFmYTc5YThkODI5NGUxMTRjY2YxOWM1Zjg1ZmQ2Yjc3OGE5NDAzNWI0NTM0MzI3MWJlOTYiLCAiaGFzaE1ldGhvZCI6ICJzaGEyNTYiLCAiaWQiOiAidXJuOnVzLWZyOmRvY3VtZW50OjIwMjAtMDc2NzIiLCAicHVibGlzaGVySWQiOiAiODUgRlIgMjA4MTEiLCAicmV0cmlldmVkRnJvbSI6ICJodHRwczovL3d3dy5nb3ZpbmZvLmdvdi9jb250ZW50L3BrZy9GUi0yMDIwLTA0LTE1L3BkZi8yMDIwLTA3NjcyLnBkZiIsICJ2ZXJzaW9uIjogIjIwMjAtMDQtMTUsIFJJTiAzMjQ1LUFIMzQifSwgInR5cGUiOiAiRGVjaXNpb25BdHRlc3RhdGlvbiIsICJ2b2NhYnVsYXJ5UmVmIjogeyJoYXNoIjogImU5NzcxZTM3ODZjMzkxOGE2MjRhNjkyYTI0M2FhM2NkZTkxNmMyYTM2NDI4N2JjOGU3MjJmZTk2ZmRkODRiNjQiLCAiaGFzaE1ldGhvZCI6ICJzaGEyNTYiLCAiaWQiOiAidXJuOnBwcC1jYXNlczp2b2NhYnVsYXJ5OmZvcmdpdmVuZXNzLW91dGNvbWVzIiwgInNvdXJjZSI6ICJjbGllbnQtZGVmaW5lZCIsICJ2YWx1ZXMiOiBbImZvcmdpdmVuZXNzLWZ1bGwiLCAiZm9yZ2l2ZW5lc3MtcGFydGlhbCIsICJmb3JnaXZlbmVzcy1ub25lIiwgImRldGVybWluYXRpb24tcmVmdXNlZC1zY2hlbWEiLCAiZGV0ZXJtaW5hdGlvbi1yZWZ1c2VkLXJ1bGUiXSwgInZlcnNpb24iOiAiMS4wLjAifX0=",
"documentEncoding": "base64",
"documentHash": "sha256:b6c0bdd0aa958567665e816a9aa9a589b6ecd368f1c012bcd2480c7c4951a4eb",
"signature": "PoSqP9d+pxyk4A/hxtpFpK42TRaUbRYYiq/XCxKAp7La8wnQ/d5Bx9Q737TJddPtNSpM/Z2/aYqNt4w4zg+UBA==",
"verification": {
"state": "attested",
"construction": "jcs-2022-over-parsed-document",
"note": "The signature was checked against JCS bytes re-derived from the parsed document, using the decider's key recovered from its own DID. The bytes stored here are the WIRE form and were not themselves the verified input; for a document whose wire form is already canonical they are the same sequence, and for one that is not they differ."
},
"decider": "did:key:z6MkoMCP6imN1HfKC1gVHDMffgP3af58VnGY621KRHrEsbDq",
"outcomeTerm": "determination-refused-schema",
"vocabularyRef": {
"hash": "e9771e3786c3918a624a692a243aa3cde916c2a364287bc8e722fe96fdd84b64",
"hashMethod": "sha256",
"id": "urn:ppp-cases:vocabulary:forgiveness-outcomes",
"source": "client-defined",
"values": [
"forgiveness-full",
"forgiveness-partial",
"forgiveness-none",
"determination-refused-schema",
"determination-refused-rule"
],
"version": "1.0.0"
},
"policyRef": {
"hash": "9b7c561bbcf0afa79a8d8294e114ccf19c5f85fd6b778a94035b45343271be96",
"hashMethod": "sha256",
"id": "urn:us-fr:document:2020-07672",
"publisherId": "85 FR 20811",
"retrievedFrom": "https://www.govinfo.gov/content/pkg/FR-2020-04-15/pdf/2020-07672.pdf",
"version": "2020-04-15, RIN 3245-AH34"
},
"documentOnly": {
"assurance": "self-declared",
"determination": {
"caseCategory": "malformed",
"caseId": "MF-0001",
"caseRecordDigest": "8f33487bb006a2cb46818644825ee8e6d62e55b1892682bed3369369894827ee",
"caseRecordDigestMethod": "sha256 over the UTF-8 bytes of the case's line in cases/cases.jsonl, excluding the newline",
"caseSet": "cases/cases.jsonl",
"deciderArtifact": "ppp/engine.py, the determination engine whose digest deciderArtifactDigest carries",
"refusalClass": "SCHEMA",
"refusalCodes": [
"E_PRINCIPAL_MISSING"
],
"refused": "true",
"ruleCitation": "85 FR 20811",
"ruleVersion": "APR"
},
"type": "DecisionAttestation"
},
"deciderArtifactDigest": {
"state": "digest",
"value": "sha256:d4bb41e304fe81c43924c9803488d1df0ce42459ff0790662d1f0e10a3470278"
},
"decidedAt": "2026-08-14T00:00:00Z",
"bound": {
"state": "not-read",
"note": "This build does not extract a bound from a decider's document. The document may state one; nothing here has looked. This is a statement about this reader, NOT about the decider — \"the decider supplied no bound\" is a different fact and is `not-supplied`."
},
"at": "2026-08-15T20:17:44.583Z",
"id": "determination-904",
"observedAt": "2026-08-15T20:17:44.609Z"
}</script>
<!-- ── OP_CHECK ── the verifier. Mirrors verifyDecisionAttestation's sequence and state
vocabulary. Exposed on globalThis so scripts/check-public-checker.mjs can drive it
in Node against the published artifact and against deliberately broken variants. ── -->
<script data-shared-copy="offline-scope">
(function () {
'use strict';
var ED25519_MULTICODEC = [0xed, 0x01];
var B58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
function base58Decode(s) {
var bytes = [0];
for (var i = 0; i < s.length; i++) {
var v = B58.indexOf(s[i]);
if (v < 0) throw new Error('not base58: ' + s[i]);
for (var j = 0; j < bytes.length; j++) bytes[j] *= 58;
bytes[0] += v;
var carry = 0;
for (var k = 0; k < bytes.length; k++) {
bytes[k] += carry;
carry = bytes[k] >> 8;
bytes[k] &= 0xff;
}
while (carry) { bytes.push(carry & 0xff); carry >>= 8; }
}
for (var z = 0; z < s.length && s[z] === '1'; z++) bytes.push(0);
return new Uint8Array(bytes.reverse());
}
// The engine's canonicaliser, not RFC 8785 in full: strings, arrays and objects only.
// A number, a boolean or a null is REFUSED rather than guessed at, because that is
// where two canonicalisers stop agreeing and produce bytes that look right.
function canonicalise(value, path) {
path = path || '$';
if (typeof value === 'string') return JSON.stringify(value);
if (Array.isArray(value)) {
return '[' + value.map(function (v, i) { return canonicalise(v, path + '[' + i + ']'); }).join(',') + ']';
}
if (value !== null && typeof value === 'object') {
var entries = Object.keys(value)
.filter(function (k) { return value[k] !== undefined; })
.sort(function (a, b) { return a < b ? -1 : a > b ? 1 : 0; });
return '{' + entries.map(function (k) {
return JSON.stringify(k) + ':' + canonicalise(value[k], path + '.' + k);
}).join(',') + '}';
}
var e = new Error('Cannot canonicalise ' + path + ': ' + (value === null ? 'null' : typeof value) +
'. This canonicaliser covers objects, arrays and strings, which is everything this estate signs.');
e.notCanonicalisable = true;
throw e;
}
var nonEmpty = function (v) { return typeof v === 'string' && v !== ''; };
function checkDecisionRefs(policyRef, vocabularyRef) {
var pairs = [['policyRef', policyRef], ['vocabularyRef', vocabularyRef]];
for (var i = 0; i < pairs.length; i++) {
var label = pairs[i][0], ref = pairs[i][1];
if (ref === undefined || ref === null) return 'The document carries no ' + label + '.';
var fields = ['id', 'hash', 'hashMethod'];
for (var j = 0; j < fields.length; j++) {
if (!nonEmpty(ref[fields[j]])) {
return label + '.' + fields[j] + ' is missing or empty, so the reference is named rather than fixed.';
}
}
}
if (!nonEmpty(vocabularyRef.version)) return 'vocabularyRef.version is missing, so nothing can be compared against it.';
if (vocabularyRef.source !== 'op-starter-set' && vocabularyRef.source !== 'client-defined') {
return 'vocabularyRef.source is ' + JSON.stringify(vocabularyRef.source) +
'. The two values are op-starter-set and client-defined.';
}
var values = vocabularyRef.values;
if (!Array.isArray(values) || values.length === 0) {
return 'vocabularyRef declares no values, so membership cannot be checked by anyone.';
}
for (var v = 0; v < values.length; v++) {
if (typeof values[v] !== 'string' || values[v] === '') return 'vocabularyRef.values carries a non-string or empty entry.';
}
if (new Set(values).size !== values.length) return 'vocabularyRef.values repeats a value.';
return null;
}
function checkDeciderArtifactRef(ref) {
if (ref === undefined || ref === null) {
return 'The document does not state whether the decider supplied an artifact of its own. An omitted field leaves an absent artifact indistinguishable from a dropped one.';
}
if (ref.state === 'digest') {
return nonEmpty(ref.value) ? null : 'deciderArtifactDigest says digest and carries no value.';
}
if (ref.state === 'not-supplied') {
return nonEmpty(ref.note) ? null : 'deciderArtifactDigest says not-supplied and carries no note.';
}
return 'deciderArtifactDigest.state is ' + JSON.stringify(ref.state) + '. The two states are digest and not-supplied.';
}
function checkOutcomeInVocabulary(outcome, vocabularyRef) {
if (vocabularyRef === undefined || !Array.isArray(vocabularyRef.values)) return null;
if (typeof outcome !== 'string' || outcome === '') return 'The document states no outcome.';
if (vocabularyRef.values.indexOf(outcome) !== -1) return null;
return 'The outcome ' + JSON.stringify(outcome) + ' is not a member of the vocabulary the document cites (' +
vocabularyRef.id + ' v' + vocabularyRef.version + '), so the document asserts a choice from a set that does not contain it.';
}
// ─── enforcement refusal records ────────────────────────────────────────────────
//
// signableFromRefusal and refusalPayload, rebuilt here because this page loads NOTHING
// and therefore cannot import the package. That is a SECOND REPRESENTATION of a signing
// construction, which is the defect this estate keeps finding, so it is not left to agree
// by inspection: scripts/check-page-payload-parity.mjs imports the real
// signableFromRefusal and refusalPayload from the pinned package and asserts the bytes
// built here are byte-identical, over every refusal this repository publishes. A
// divergence turns the build red instead of turning a verdict wrong.
var REFUSAL_PAYLOAD_TYPE_V1 = 'op.enforcement.refusal.v1';
var REFUSAL_PAYLOAD_TYPE_V2 = 'op.enforcement.refusal.v2';
var REFUSAL_PAYLOAD_TYPE_V3 = 'op.enforcement.refusal.v3';
// ─── SETS, NOT A FLOOR, AND THE REASON IS NOT STYLE ─────────────────────────────
//
// Mirrors the engine at 6f58fcb. These are OPAQUE TYPE TOKENS, not ordered versions: a lexical
// comparison ranks v10 BELOW v2, so the ordering is not total and quietly stops being one at the
// tenth version. And a floor would assert that every FUTURE version carries a citation, which is
// a claim about payloads nobody has designed. That is the same guess the old `=== V2` equality
// made, widened rather than removed.
//
// A SET MAKES THE NEXT VERSION A DECISION. Adding v4 means adding it here, which means somebody
// stating that v4 carries a citation.
var CITATION_BEARING = { 'op.enforcement.refusal.v2': 1, 'op.enforcement.refusal.v3': 1 };
// The versions whose appliedBound carries `reason`, and whose `recorded` arm signs its `note`.
var REASON_BEARING = { 'op.enforcement.refusal.v3': 1 };
// The reason vocabulary at run time. The closed union is a compiler fact and this page has no
// compiler, so the set is carried explicitly or it is a convention rather than a check.
var REASON_VALUES = { 'no-authority': 1, 'not-reached': 1, 'none-configured': 1 };
function cannotRebuild(message) {
var e = new Error(message);
e.cannotRebuild = true;
return e;
}
function requireRefusalFields(r, fields) {
for (var i = 0; i < fields.length; i++) {
if (!nonEmpty(r[fields[i]])) {
throw cannotRebuild('The record carries no ' + fields[i] + '. An absent field canonicalises to the same bytes as an omitted one, so a payload built without it would be a signature over a refusal that does not say what it stopped.');
}
}
}
function enumeratedSpend(s) {
if (!nonEmpty(s && s.amountRaw) || typeof (s && s.decimals) !== 'number' ||
!nonEmpty(s && s.rail) || !nonEmpty(s && s.asset)) {
throw cannotRebuild('The spend does not carry rail, asset, amountRaw and numeric decimals, so the signed payload cannot be rebuilt. A refusal that cannot say what it stopped, in units a reader can sum, does not answer the question a refusal log exists for.');
}
var out = { rail: s.rail, asset: s.asset, amountRaw: s.amountRaw, decimals: String(s.decimals) };
if (s.counterparty !== undefined) out.counterparty = s.counterparty;
return out;
}
// ─── VERSION-GATED, BECAUSE THE ONLY SAFE ASSUMPTION IS ABOUT RECORDS NOBODY HERE CAN SEE ──
//
// `reason` and the `recorded` arm's `note` are emitted only for REASON_BEARING types. NOT because
// older records are known to lack them, but because they are NOT KNOWN TO. The engine is deployed
// beyond any store anyone here can inspect, and a v1 or v2 record somewhere carrying a `recorded`
// note would, under an ungated rebuild, gain a field its signature never covered and flip to DOES
// NOT VERIFY. Gating makes "older records rebuild byte-identically" a property of this code rather
// than a belief about somebody's deployment.
function enumeratedBound(b, type) {
if (b && b.state === 'recorded') {
if (!nonEmpty(b.limit)) throw cannotRebuild('appliedBound is recorded and names no limit. The arithmetic is the substance of the claim; a bound naming no limit asserts only that some bound existed.');
var rec = { state: 'recorded', limit: b.limit };
if (b.unit !== undefined) rec.unit = b.unit;
if (b.observed !== undefined) rec.observed = b.observed;
if (b.headroom !== undefined) rec.headroom = b.headroom;
// S10, RULED AT THE ENGINE: the note joins the signed set rather than leaving the type. The
// not-supplied arm signs its note and refuses without one; the same field on the same object,
// signed on one arm and discarded on the other, was the inconsistency. A ceiling may be the
// credential's figure or a deployment's tighter one, and a signed note is the only place to
// say which.
if (REASON_BEARING[type] === 1 && b.note !== undefined) rec.note = b.note;
return rec;
}
if (b && b.state === 'not-supplied') {
if (!nonEmpty(b.note)) throw cannotRebuild('appliedBound is not-supplied and carries no note. The note is what makes the absence a claim rather than a silence.');
if (REASON_BEARING[type] === 1 && REASON_VALUES[b.reason] !== 1) {
throw cannotRebuild('This is a ' + type + ' refusal whose appliedBound reason is ' + JSON.stringify(b.reason) +
'. The reasons are no-authority, not-reached, none-configured; an unrecognised one is refused rather than omitted, because a bound whose absence this service cannot explain must not carry a signature saying it can.');
}
var ns = { state: 'not-supplied' };
if (b.constraint !== undefined) ns.constraint = b.constraint;
if (REASON_BEARING[type] === 1) ns.reason = b.reason;
ns.note = b.note;
return ns;
}
throw cannotRebuild('appliedBound.state is ' + JSON.stringify(b && b.state) + '. The two states are recorded and not-supplied, and an unrecognised one is refused rather than rebuilt.');
}
function enumeratedCredential(c) {
if (c && c.state === 'digest') {
if (!nonEmpty(c.value)) throw cannotRebuild('The credential state is digest with no value. A digest field with no digest in it is a placeholder wearing the name of the thing it stands for.');
return { state: 'digest', value: c.value };
}
if (c && c.state === 'not-supplied') {
if (!nonEmpty(c.note)) throw cannotRebuild('The credential is not-supplied and carries no note.');
return { state: 'not-supplied', note: c.note };
}
throw cannotRebuild('credential.state is ' + JSON.stringify(c && c.state) + '.');
}
// FOUR FIELDS. This is where the boundary the result panel reports comes from: an
// attested citation is signed as state, decisionId, decider and outcome, and everything
// else the attestation block carries stays outside the refusal's signature.
function citationOf(a) {
if (a === undefined) return undefined;
if (a.state !== 'attested') return { state: a.state };
return { state: a.state, decisionId: a.decisionId, decider: a.decider, outcome: a.outcome };
}
function refusalCredentialNote(r) {
if (r.authority !== 'deployment-guard') {
return 'The evaluator supplied no credentialDigest with this verdict, so this service cannot say which credential document the bound came from.';
}
return nonEmpty(r.attribution && r.attribution.agentId)
? 'A deployment guard refused this with a verdict present, and a guard reads no credential, so there is no digest to record. This describes the GUARD, not the evaluator.'
: 'A deployment guard refused this BEFORE any verdict existed, so no credential was evaluated and there is no digest to record.';
}
function signableFromRefusal(r) {
var digest = r.credentialDigest;
var attribution = r.attribution || {};
// ABSENT MEANS v1. A record written before the type was persisted rebuilds under the
// rules it was actually signed with, which is why an old refusal still verifies here.
var out = { payloadType: r.payloadType !== undefined ? r.payloadType : REFUSAL_PAYLOAD_TYPE_V1 };
if (r.attestation !== undefined) out.attestation = r.attestation;
out.refusalId = r.refusalId;
out.at = r.at;
out.authority = r.authority;
out.code = r.code;
out.agentId = nonEmpty(attribution.agentId) ? attribution.agentId : '';
out.mandateId = nonEmpty(attribution.mandateId) ? attribution.mandateId : '';
out.spend = r.spend;
out.credential = nonEmpty(digest)
? { state: 'digest', value: digest }
: { state: 'not-supplied', note: refusalCredentialNote(r) };
if (r.breachedConstraint !== undefined) out.breachedConstraint = r.breachedConstraint;
if (r.appliedBound !== undefined) out.appliedBound = r.appliedBound;
if (r.network !== undefined) out.network = r.network;
return out;
}
function refusalPayloadObject(r) {
requireRefusalFields(r, ['refusalId', 'at', 'code', 'agentId', 'mandateId']);
var type = r.payloadType !== undefined ? r.payloadType : REFUSAL_PAYLOAD_TYPE_V1;
var citation = CITATION_BEARING[type] === 1 ? citationOf(r.attestation) : undefined;
var base = {
type: type,
refusalId: r.refusalId,
at: r.at,
code: r.code,
agentId: r.agentId,
mandateId: r.mandateId,
spend: enumeratedSpend(r.spend),
credential: enumeratedCredential(r.credential)
};
if (citation !== undefined) base.citation = citation;
if (r.authority === 'mandate') {
if (!nonEmpty(r.breachedConstraint)) {
throw cannotRebuild('This is a mandate refusal naming no breachedConstraint. The claim is that a signed credential’s own constraint stopped the payment; without naming which, the signature asserts only that something did.');
}
if (r.appliedBound === undefined) {
throw cannotRebuild('This is a mandate refusal with no appliedBound. The bound arithmetic is what a third party checks the refusal against, and an unsupplied bound is recorded as not-supplied with a note, which is a claim, rather than omitted, which is a silence.');
}
base.authority = 'mandate';
base.breachedConstraint = r.breachedConstraint;
base.appliedBound = enumeratedBound(r.appliedBound, type);
return base;
}
if (r.authority === 'deployment-guard') {
if (r.breachedConstraint !== undefined) {
throw cannotRebuild('A deployment-guard refusal must not carry a breachedConstraint. It consulted no mandate, so naming one would attribute a deployment decision to a credential’s own rule.');
}
if (r.appliedBound !== undefined && r.appliedBound.state === 'recorded') {
throw cannotRebuild('A deployment-guard refusal must not carry a recorded appliedBound. It consulted no mandate, so a limit here would attribute a deployment decision to a credential’s own arithmetic.');
}
if (!nonEmpty(r.network)) {
throw cannotRebuild('This is a deployment-guard refusal with no network. The network is the guard’s whole subject.');
}
base.authority = 'deployment-guard';
base.network = r.network;
if (r.appliedBound !== undefined) base.appliedBound = enumeratedBound(r.appliedBound, type);
return base;
}
throw cannotRebuild('The refusal’s authority is ' + JSON.stringify(r.authority) + '. The two authorities are mandate and deployment-guard, and an unrecognised one is refused rather than rebuilt.');
}
function refusalPayload(r) { return canonicalise(refusalPayloadObject(r)); }
// ─── THE SERVED SHAPE ───────────────────────────────────────────────────────────
//
// A refusal reaches a reader in one of TWO shapes and they are not the same document.
//
// store shape what a store file holds: `k`, `authority`, `spend`, `attribution`,
// and the signature inline as `signature` + `signedBy`.
// served shape what GET /v1/refusals sends, and what a console's copy button puts on
// the clipboard: no `k`, `refusedBy` for authority, `attempted` for spend,
// `agentId`/`mandateId` at the top level, and the signature as an OBJECT,
// { state, value, signedBy, payloadType }.
//
// The copy-from-console, paste-into-this-page loop produces the SECOND, and this page used
// to answer "Not recognised" to it.
//
// THIS IS NOT A NEW MAPPING. It is signableFromRefusalRow, which lives in
// op-mcp-payment-server/src/http/reads.ts, is vendored into the console, and is held
// byte-identical to its source there by a cross-repo test that executes both. Ported here
// because this page loads nothing and can import neither.
//
// ─── NULL MEANS ABSENT, AND THIS IS THE LINE THAT WILL GET "SIMPLIFIED" ─────────────
//
// A served row NULLS a field that is absent, so a reader can tell "no constraint" from
// "not reported". That is right for a surface and WRONG for a canonicaliser: `{x: null}`
// and `{}` are different bytes, and this estate's canonicaliser refuses null outright
// rather than guessing. So every null here becomes an OMITTED KEY, never a null and never
// an empty string.
//
// THE INVERSE OF THIS DEFECT HAS ALREADY BEEN PAID FOR. The payment server's own
// `appliedBoundView` turned ABSENT keys into null. The field was then PRESENT, every
// "is the field there" check passed, and the bytes still differed, so the signature did not
// verify and nothing said why. A check that asks whether a field exists passes on exactly
// that defect. Do not replace `strip` with a spread, do not "tidy" it into a JSON
// round-trip, and do not let a null through on the grounds that the field is there.
function stripNulls(obj) {
var out = {};
for (var k in obj) {
if (!Object.prototype.hasOwnProperty.call(obj, k)) continue;
if (obj[k] === null || obj[k] === undefined) continue;
out[k] = obj[k];
}
return out;
}
function signableFromRefusalRow(row) {
var sig = row.signature;
var sigPayloadType = (sig !== null && typeof sig === 'object' && 'payloadType' in sig)
? sig.payloadType : undefined;
var bound = (row.appliedBound === null || row.appliedBound === undefined)
? undefined : stripNulls(row.appliedBound);
var att = row.attestation;
// `not-evaluated` IS THE SERVICE DESCRIBING ITSELF. It means the citation was never read,
// it was never part of any signed payload, and citationOf must never receive it. Mapping
// it back to absent is what keeps the rebuild honest; carrying it through would sign a
// projection state the signer never saw.
var attOut = (att === null || att === undefined || att.state === 'not-evaluated') ? undefined : att;
var attempted = row.attempted || {};
var out = {
refusalId: row.refusalId,
at: row.at,
authority: row.refusedBy,
code: row.code,
attribution: stripNulls({ agentId: row.agentId, mandateId: row.mandateId }),
spend: stripNulls({
rail: attempted.rail, asset: attempted.asset,
amountRaw: attempted.amountRaw, decimals: attempted.decimals,
counterparty: attempted.counterparty
})
};
if (row.credential && row.credential.state === 'digest' && nonEmpty(row.credential.value)) {
out.credentialDigest = row.credential.value;
}
if (row.constraint !== null && row.constraint !== undefined) out.breachedConstraint = row.constraint;
if (bound !== undefined) out.appliedBound = bound;
if (row.network !== null && row.network !== undefined) out.network = row.network;
if (sigPayloadType !== undefined) out.payloadType = sigPayloadType;
if (attOut !== undefined) out.attestation = attOut;
return out;
}
// ─── ONE ADAPTER PER SHAPE, AND A THIRD SHAPE NEEDS ITS OWN ─────────────────────
//
// Each adapter says how to get from what the reader pasted to the signed bytes, where the
// signature is, and which key signed it. TWO SHAPES ARE COVERED: store and served, and both
// are run against the signature oracle in scripts/check-page-payload-parity.mjs.
//
// IF A THIRD SHAPE APPEARS, IT NEEDS ITS OWN ORACLE RUN. Do not assume this mapping
// generalises to it. The two here differ in field NAMES, in nesting, in where the signature
// lives and in whether absence is spelled null or omitted; a third could differ again in a
// way that still rebuilds and still produces the wrong bytes. The signature is the only
// thing that can tell you, so add fixtures of the new shape to the parity population and
// let it refuse you.
var SHAPES = {
store: {
name: 'store',
toSignable: function (r) { return signableFromRefusal(r); },
signatureOf: function (r) { return r.signature; },
signerOf: function (r) { return r.signedBy; },
unsigned: function (r) { return !nonEmpty(r.signature); },
skip: { k: 1, signature: 1, signedBy: 1 },
nested: ['attribution', 'spend', 'appliedBound', 'attestation']
},
served: {
name: 'served',
toSignable: function (r) { return signableFromRefusal(signableFromRefusalRow(r)); },
signatureOf: function (r) { return r.signature && r.signature.value; },
signerOf: function (r) { return r.signature && r.signature.signedBy; },
// AN UNSIGNED ROW IS NOT A FAILED ONE. Refusals written before this deployment signed
// them are not backfilled, because a signature applied afterwards would attest to a
// moment that did not happen. There is nothing to check, which is a statement about the
// record and not a finding against it.
unsigned: function (r) {
return !r.signature || r.signature.state === 'unsigned' || !nonEmpty(r.signature.value);
},
skip: { signature: 1 },
nested: ['attempted', 'appliedBound', 'attestation', 'credential']
}
};
function payloadOfRecord(record, shape) { return refusalPayload((shape || SHAPES.store).toSignable(record)); }
// ─── WHAT THE SIGNATURE COVERS, DERIVED AND NOT LISTED ──────────────────────────
//
// A hand-written list of covered fields is a claim about a record shape somebody had in
// front of them once. This removes each field the record actually carries, rebuilds the
// payload, and compares bytes. A field whose removal leaves the payload identical is a
// field the signature does not reach. Nobody maintains the answer, so it cannot go stale
// against a record this page has not seen.
function coverageOf(record, shape) {
shape = shape || SHAPES.store;
var baseline;
try { baseline = payloadOfRecord(record, shape); } catch (e) { return null; }
var covered = [], uncovered = [];
var probe = function (label, mutate) {
var copy;
try { copy = JSON.parse(JSON.stringify(record)); } catch (e) { return; }
mutate(copy);
var got;
// A removal the rebuild REFUSES is a field the payload cannot be built without,
// which is coverage of the strongest kind.
try { got = payloadOfRecord(copy, shape); } catch (e) { covered.push(label); return; }
(got === baseline ? uncovered : covered).push(label);
};
// The field names reported are the ones on the document the READER pasted, not the ones
// the signable form uses. Someone holding a served row is told about `attempted.amountRaw`
// and `observedAt`, which is what they can see in front of them.
Object.keys(record).forEach(function (key) {
if (shape.skip[key]) return;
if (shape.nested.indexOf(key) !== -1) return;
probe(key, function (c) { delete c[key]; });
});
shape.nested.forEach(function (parent) {
var obj = record[parent];
if (obj === null || typeof obj !== 'object' || Array.isArray(obj)) return;
Object.keys(obj).forEach(function (sub) {
probe(parent + '.' + sub, function (c) { delete c[parent][sub]; });
});
});
var byName = function (a, b) { return a < b ? -1 : a > b ? 1 : 0; };
return { covered: covered.sort(byName), uncovered: uncovered.sort(byName) };
}
async function verifyRefusal(record, shape) {
shape = shape || SHAPES.store;
var passed = [];
var signedBy = shape.signerOf(record);
if (shape.unsigned(record)) {
return {
state: 'unsigned', passed: passed,
reason: 'This refusal carries no signature, so there is nothing to check. That is a statement about the record rather than a finding against it: refusals written before a deployment signed them are not backfilled, because a signature applied afterwards would attest to a moment that did not happen.'
};
}
if (typeof signedBy !== 'string' || signedBy === '') {
return { state: 'unrebuildable', passed: passed, reason: 'No signature check ran. The record names no signing key, so nothing identifies who signed it.' };
}
if (signedBy.indexOf('did:key:z') !== 0) {
// ─── A STATE OF ITS OWN, AND NOT unrebuildable ────────────────────────────────
//
// "We cannot reach the key from here" and "this record cannot be rebuilt by anyone"
// are different findings and they must not share a headline. The attestation path
// already draws this line as cited-unresolvable against cited-invalid; this mirrors it.
//
// THE IDENTIFIER IS NOT TRUNCATED. An earlier version cut it at 28 characters, so
// did:web:tesoreria.emisor-demo.example rendered as did:web:tesoreria.emisor-dem and
// read like a corrupted field. A reader looking for a reason their record is bad will
// find one in a mangled identifier.
return {
state: 'signer-unresolvable', passed: passed, signedBy: signedBy,
reason: 'NO SIGNATURE CHECK RAN, so nothing here is a statement about this record. It is signed by ' + signedBy + ', and resolving a did:web means fetching a document over the network. This page makes no network request, by design, so the key cannot be recovered here and the refusal is shown as unchecked rather than read as either good or bad. A did:key signer checks out here with nothing else. For this one, /verify sets out the same check run from npm, where a resolver can be supplied.'
};
}
var raw;
try { raw = base58Decode(signedBy.slice('did:key:z'.length)); } catch (e) { raw = undefined; }
if (raw === undefined || raw.length !== 34 || raw[0] !== ED25519_MULTICODEC[0] || raw[1] !== ED25519_MULTICODEC[1]) {
return { state: 'unrebuildable', passed: passed, reason: 'No signature check ran. signedBy is not a well-formed Ed25519 did:key, so no key can be recovered from it.' };
}
// ─── THE 32-VS-34 BYTE DISTINCTION, HANDLED HERE SO NO READER MEETS IT ──────────
//
// A did:key decodes to 34 bytes: the two-byte multicodec prefix 0xed 0x01, then the
// 32-byte Ed25519 key. verifyDecisionAttestation takes the 34-byte form and strips the
// prefix itself. A raw Ed25519 verify takes the 32. Handing the 34-byte form straight
// to a verify call fails with "Ed25519 public key must be 32 bytes", which reads like a
// damaged record and is a wrong call, and nothing on this site used to say so.
var publicKey = raw.slice(2);
passed.push('the signing key was recovered from the record’s own did:key, and its two-byte multicodec prefix stripped so that 32 bytes reach the signature check');
var payload;
try { payload = payloadOfRecord(record, shape); }
catch (e) {
return {
state: 'unrebuildable', passed: passed,
reason: (e && e.cannotRebuild) ? e.message
: (e && e.notCanonicalisable) ? e.message
: 'The signed payload could not be rebuilt from this record: ' + String(e && e.message ? e.message : e)
};
}
var signable = shape.toSignable(record);
var declaredType = signable.payloadType !== undefined ? signable.payloadType : REFUSAL_PAYLOAD_TYPE_V1;
passed.push('the payload was rebuilt under the construction the record itself states, ' + declaredType + ', rather than under whichever version this page happens to ship');
if (!ed25519Available()) {
return {
state: 'no-verdict', passed: passed,
reason: 'This browser does not expose Ed25519 through WebCrypto, so no signature check ran and no verdict was reached. Nothing here is a statement about the record. /verify sets out the same check run from npm.'
};
}
var ok;
try { ok = await ed25519Verify(publicKey, new TextEncoder().encode(payload), b64ToBytes(shape.signatureOf(record))); }
catch (e) {
return { state: 'unrebuildable', passed: passed, reason: 'The signature could not be checked: ' + String(e && e.message ? e.message : e) };
}
var coverage = coverageOf(record, shape);
// The affirmative branch below must be conditional on the signature check having RETURNED
// TRUE, not merely on it having returned something that is not falsy. A test for falsiness
// lets a verifier returning a truthy non-boolean through, and the page then prints a verdict
// the cryptography did not authorise. See #65 for the harness that measures this.
if (ok !== true) {
return {
state: 'does-not-verify', passed: passed, coverage: coverage, payload: payload, shape: shape.name,
reason: 'The signature does not verify over the payload this record states it was signed under. Either a field inside the signature has been altered since it was signed, or the signature has. This is not a missing record: it is a signed artifact failing its own check.'
};
}
passed.push('the signature verifies against the key the record names, over the payload rebuilt from the record’s own fields');
// Displayed from the SIGNABLE form, so a served row and a store record of the same
// refusal render the same values under the same labels.
return {
state: 'verifies', passed: passed, coverage: coverage, payload: payload, shape: shape.name,
refusalId: signable.refusalId, code: signable.code, authority: signable.authority,
breachedConstraint: signable.breachedConstraint, at: signable.at,
signedBy: signedBy, payloadType: declaredType,