nirium-cli 3.2.4 → 3.2.5

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 (2) hide show
  1. package/bin/nirium.js +11 -2
  2. package/package.json +1 -1
package/bin/nirium.js CHANGED
@@ -1686,7 +1686,7 @@ function verifyAuditDocument(doc, cid, { expectedHash } = {}) {
1686
1686
  const anyFailed = hashStatus === 'mismatch' || signatureStatus === 'invalid';
1687
1687
  const anyPassed = hashStatus === 'match' || signatureStatus === 'valid';
1688
1688
  const ok = !anyFailed && anyPassed;
1689
- return { ok, verified: ok, cid, mode, hashMatch: hashStatus === 'match', hashStatus, expectedHash: anchoredHash, computedHash, signatureStatus, signatureScheme, signerKey, statement, declaredStatement, agentId };
1689
+ return { ok, verified: ok, cid, mode, hashMatch: hashStatus === 'match', hashStatus, expectedHash: anchoredHash, computedHash, providedHash: expectedHash || '', signatureStatus, signatureScheme, signerKey, statement, declaredStatement, agentId };
1690
1690
  }
1691
1691
 
1692
1692
  // `gateways` may be a single URL string (back-compat for direct callers)
@@ -1778,7 +1778,16 @@ function formatVerifyOutput(result) {
1778
1778
  } else if (result.hashMatch) {
1779
1779
  lines.push(`✔ HASH: MATCH (${result.expectedHash.slice(0, 16)}...)${result.mode === 'hash-only' ? ' [hash-only]' : ''}`);
1780
1780
  } else {
1781
- lines.push(`❌ HASH: MISMATCH (Anchored: ${result.expectedHash}, Computed: ${result.computedHash})`);
1781
+ // Name each hash once: the anchored one, the one recomputed from the
1782
+ // record (only when it differs, i.e. the record itself was changed),
1783
+ // and the one passed with --hash/--evidence. Before, a record that was
1784
+ // intact but did not match --hash printed the anchored hash twice.
1785
+ const parts = [`Anchored: ${result.expectedHash}`];
1786
+ if (result.mode === 'record' && result.computedHash && result.computedHash !== result.expectedHash) {
1787
+ parts.push(`Recomputed from record: ${result.computedHash}`);
1788
+ }
1789
+ if (result.providedHash) parts.push(`Yours (--hash/--evidence): ${result.providedHash}`);
1790
+ lines.push(`❌ HASH: MISMATCH (${parts.join(', ')})`);
1782
1791
  }
1783
1792
  if (result.signatureStatus === 'valid') {
1784
1793
  lines.push(`✔ SIGNATURE: VALID${result.signatureScheme === 'sep53' ? ' (SEP-53)' : ''} (Signed by ${result.signerKey})`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nirium-cli",
3
- "version": "3.2.4",
3
+ "version": "3.2.5",
4
4
  "description": "Nirium from the terminal: pay or serve an x402 API on Stellar, anchor and verify receipts, check an agent and export reports.",
5
5
  "main": "bin/nirium.js",
6
6
  "type": "module",