@primust/verifier 1.0.0 → 1.0.1

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.
Files changed (48) hide show
  1. package/dist/chunk-LTWQK3HT.js +432 -0
  2. package/dist/chunk-ZADQUKKN.js +2963 -0
  3. package/dist/cli.d.ts +3 -2
  4. package/dist/cli.js +309 -361
  5. package/dist/index.d.ts +335 -13
  6. package/dist/index.js +1181 -13
  7. package/dist/v29-envelope-GFVVA2S6.js +42 -0
  8. package/package.json +7 -8
  9. package/dist/bounded-trace.d.ts +0 -46
  10. package/dist/bounded-trace.d.ts.map +0 -1
  11. package/dist/bounded-trace.js +0 -558
  12. package/dist/bounded-trace.js.map +0 -1
  13. package/dist/cli.d.ts.map +0 -1
  14. package/dist/cli.js.map +0 -1
  15. package/dist/index.d.ts.map +0 -1
  16. package/dist/index.js.map +0 -1
  17. package/dist/key-cache.d.ts +0 -20
  18. package/dist/key-cache.d.ts.map +0 -1
  19. package/dist/key-cache.js +0 -68
  20. package/dist/key-cache.js.map +0 -1
  21. package/dist/scoped.d.ts +0 -35
  22. package/dist/scoped.d.ts.map +0 -1
  23. package/dist/scoped.js +0 -582
  24. package/dist/scoped.js.map +0 -1
  25. package/dist/types.d.ts +0 -60
  26. package/dist/types.d.ts.map +0 -1
  27. package/dist/types.js +0 -5
  28. package/dist/types.js.map +0 -1
  29. package/dist/upstream_resolver.d.ts +0 -60
  30. package/dist/upstream_resolver.d.ts.map +0 -1
  31. package/dist/upstream_resolver.js +0 -126
  32. package/dist/upstream_resolver.js.map +0 -1
  33. package/dist/v29-envelope.d.ts +0 -55
  34. package/dist/v29-envelope.d.ts.map +0 -1
  35. package/dist/v29-envelope.js +0 -450
  36. package/dist/v29-envelope.js.map +0 -1
  37. package/dist/verifier.d.ts +0 -36
  38. package/dist/verifier.d.ts.map +0 -1
  39. package/dist/verifier.js +0 -1235
  40. package/dist/verifier.js.map +0 -1
  41. package/dist/verifier.test.d.ts +0 -2
  42. package/dist/verifier.test.d.ts.map +0 -1
  43. package/dist/verifier.test.js +0 -395
  44. package/dist/verifier.test.js.map +0 -1
  45. package/dist/verify-html-template.d.ts +0 -45
  46. package/dist/verify-html-template.d.ts.map +0 -1
  47. package/dist/verify-html-template.js +0 -182
  48. package/dist/verify-html-template.js.map +0 -1
@@ -1,182 +0,0 @@
1
- /**
2
- * verify.html template generator for Evidence Pack output.
3
- *
4
- * Generates a self-contained HTML file that:
5
- * 1. Embeds the Ed25519 public key
6
- * 2. Pre-loads the Evidence Pack summary
7
- * 3. Verifies using WebCrypto API on page load
8
- * 4. Works completely offline
9
- * 5. Shows chain of VPECs with verification status
10
- */
11
- export function generateVerifyHtml(options) {
12
- const { publicKeyB64, packData } = options;
13
- return `<!DOCTYPE html>
14
- <html lang="en">
15
- <head>
16
- <meta charset="UTF-8">
17
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
18
- <title>Primust Evidence Pack — Offline Verification</title>
19
- <style>
20
- * { box-sizing: border-box; margin: 0; padding: 0; }
21
- body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #fafafa; color: #1a1a1a; padding: 2rem; max-width: 900px; margin: 0 auto; }
22
- h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
23
- .subtitle { color: #666; font-size: 0.9rem; margin-bottom: 2rem; }
24
- .status { padding: 1rem; border-radius: 8px; margin-bottom: 1.5rem; font-weight: 600; font-size: 1.1rem; }
25
- .status.verified { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
26
- .status.failed { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
27
- .status.loading { background: #e2e3e5; color: #383d41; border: 1px solid #d6d8db; }
28
- .summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
29
- .stat { background: white; border: 1px solid #e0e0e0; border-radius: 8px; padding: 1rem; }
30
- .stat-label { font-size: 0.75rem; color: #888; text-transform: uppercase; }
31
- .stat-value { font-size: 1.5rem; font-weight: 700; margin-top: 0.25rem; }
32
- .vpec-table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; border: 1px solid #e0e0e0; }
33
- .vpec-table th, .vpec-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 0.85rem; }
34
- .vpec-table th { background: #f8f9fa; font-weight: 600; font-size: 0.75rem; text-transform: uppercase; color: #666; }
35
- .badge { display: inline-block; padding: 0.2rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; }
36
- .badge-pass { background: #d4edda; color: #155724; }
37
- .badge-fail { background: #f8d7da; color: #721c24; }
38
- .badge-pending { background: #fff3cd; color: #856404; }
39
- .chain { margin-top: 2rem; }
40
- .chain-node { border: 1px solid #e0e0e0; border-radius: 8px; padding: 1rem; margin-bottom: 0; background: white; }
41
- .chain-node.current { border-color: #007bff; background: #f0f7ff; }
42
- .chain-arrow { text-align: center; padding: 0.25rem 0; color: #ccc; font-size: 1.2rem; }
43
- .footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid #e0e0e0; font-size: 0.8rem; color: #888; }
44
- code { font-family: 'SF Mono', Monaco, monospace; font-size: 0.8rem; background: #f4f4f4; padding: 0.1rem 0.3rem; border-radius: 3px; }
45
- </style>
46
- </head>
47
- <body>
48
- <h1>Primust Evidence Pack Verification</h1>
49
- <div class="subtitle">Pack: ${packData.pack_id} &middot; Period: ${packData.period_start} to ${packData.period_end}</div>
50
-
51
- <div id="status" class="status loading">Verifying...</div>
52
-
53
- <div class="summary">
54
- <div class="stat">
55
- <div class="stat-label">VPECs</div>
56
- <div class="stat-value">${packData.vpec_count}</div>
57
- </div>
58
- <div class="stat">
59
- <div class="stat-label">Mathematical</div>
60
- <div class="stat-value">${packData.provable_surface_summary.mathematical}</div>
61
- </div>
62
- <div class="stat">
63
- <div class="stat-label">Execution</div>
64
- <div class="stat-value">${packData.provable_surface_summary.execution}</div>
65
- </div>
66
- <div class="stat">
67
- <div class="stat-label">Witnessed</div>
68
- <div class="stat-value">${packData.provable_surface_summary.witnessed}</div>
69
- </div>
70
- </div>
71
-
72
- <table class="vpec-table" id="vpec-table">
73
- <thead>
74
- <tr>
75
- <th>Status</th>
76
- <th>VPEC ID</th>
77
- <th>Proof Level</th>
78
- <th>Surface</th>
79
- <th>Gaps</th>
80
- <th>Issued</th>
81
- </tr>
82
- </thead>
83
- <tbody id="vpec-tbody"></tbody>
84
- </table>
85
-
86
- <div class="chain" id="chain-container"></div>
87
-
88
- <div class="footer">
89
- This file verifies offline. Nothing is sent to any server.<br>
90
- For CLI verification: <code>pip install primust-verify</code>
91
- </div>
92
-
93
- <script>
94
- const PRIMUST_PUBLIC_KEY_B64 = "${publicKeyB64}";
95
- const PACK_DATA = ${JSON.stringify(packData)};
96
-
97
- async function importKey(b64) {
98
- const raw = Uint8Array.from(atob(b64), c => c.charCodeAt(0));
99
- return crypto.subtle.importKey('raw', raw, { name: 'Ed25519' }, false, ['verify']);
100
- }
101
-
102
- async function verifySignature(key, signatureHex, payloadStr) {
103
- const sig = new Uint8Array(signatureHex.match(/.{2}/g).map(b => parseInt(b, 16)));
104
- const data = new TextEncoder().encode(payloadStr);
105
- return crypto.subtle.verify('Ed25519', key, sig, data);
106
- }
107
-
108
- async function main() {
109
- const statusEl = document.getElementById('status');
110
- const tbody = document.getElementById('vpec-tbody');
111
- let allValid = true;
112
-
113
- try {
114
- const key = await importKey(PRIMUST_PUBLIC_KEY_B64);
115
-
116
- for (const vpec of PACK_DATA.vpecs) {
117
- let valid = false;
118
- try {
119
- valid = await verifySignature(key, vpec.signature, vpec.signed_payload);
120
- } catch (e) {
121
- valid = false;
122
- }
123
-
124
- if (!valid) allValid = false;
125
-
126
- const row = document.createElement('tr');
127
- row.innerHTML =
128
- '<td><span class="badge ' + (valid ? 'badge-pass' : 'badge-fail') + '">' + (valid ? 'VERIFIED' : 'NOT VERIFIED') + '</span></td>' +
129
- '<td><code>' + vpec.vpec_id + '</code></td>' +
130
- '<td>' + vpec.proof_level_floor + '</td>' +
131
- '<td>' + (vpec.provable_surface * 100).toFixed(0) + '%</td>' +
132
- '<td>' + vpec.gap_count + '</td>' +
133
- '<td>' + vpec.issued_at + '</td>';
134
- tbody.appendChild(row);
135
- }
136
-
137
- // Render upstream chain if present
138
- if (PACK_DATA.upstream_vpecs && PACK_DATA.upstream_vpecs.length > 0) {
139
- const container = document.getElementById('chain-container');
140
- container.innerHTML = '<h2 style="font-size:1.1rem;margin-bottom:1rem;">Cross-Organization Chain</h2>';
141
-
142
- for (const uv of PACK_DATA.upstream_vpecs) {
143
- let uvValid = false;
144
- try {
145
- uvValid = await verifySignature(key, uv.signature, uv.signed_payload);
146
- } catch (e) { uvValid = false; }
147
-
148
- const node = document.createElement('div');
149
- node.className = 'chain-node';
150
- node.innerHTML =
151
- '<span class="badge ' + (uvValid ? 'badge-pass' : 'badge-fail') + '">' + (uvValid ? 'VERIFIED' : 'NOT VERIFIED') + '</span> ' +
152
- '<strong>' + uv.org_id + '</strong> &mdash; <code>' + uv.vpec_id + '</code> (' + uv.proof_level_floor + ')';
153
- container.appendChild(node);
154
-
155
- const arrow = document.createElement('div');
156
- arrow.className = 'chain-arrow';
157
- arrow.textContent = '\\u25BC';
158
- container.appendChild(arrow);
159
- }
160
-
161
- const currentNode = document.createElement('div');
162
- currentNode.className = 'chain-node current';
163
- currentNode.innerHTML = '<strong>This Pack</strong> &mdash; <code>' + PACK_DATA.pack_id + '</code>';
164
- container.appendChild(currentNode);
165
- }
166
-
167
- statusEl.className = 'status ' + (allValid ? 'verified' : 'failed');
168
- statusEl.textContent = allValid
169
- ? '\\u2713 VERIFIED — All ' + PACK_DATA.vpecs.length + ' credentials verified'
170
- : '\\u2717 NOT VERIFIED — Some credentials failed verification';
171
- } catch (e) {
172
- statusEl.className = 'status failed';
173
- statusEl.textContent = 'Verification error: ' + e.message;
174
- }
175
- }
176
-
177
- main();
178
- </script>
179
- </body>
180
- </html>`;
181
- }
182
- //# sourceMappingURL=verify-html-template.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"verify-html-template.js","sourceRoot":"","sources":["../src/verify-html-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAoCH,MAAM,UAAU,kBAAkB,CAAC,OAA0B;IAC3D,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC;IAE3C,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAoCuB,QAAQ,CAAC,OAAO,qBAAqB,QAAQ,CAAC,YAAY,OAAO,QAAQ,CAAC,UAAU;;;;;;;gCAOpF,QAAQ,CAAC,UAAU;;;;gCAInB,QAAQ,CAAC,wBAAwB,CAAC,YAAY;;;;gCAI9C,QAAQ,CAAC,wBAAwB,CAAC,SAAS;;;;gCAI3C,QAAQ,CAAC,wBAAwB,CAAC,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;sCA0BrC,YAAY;wBAC1B,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqFxC,CAAC;AACT,CAAC"}