nirium-cli 3.0.0 → 3.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.
- package/README.md +3 -3
- package/bin/nirium.js +12 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -138,15 +138,15 @@ carry a value when the agent reports one: the Nirium testnet agent's
|
|
|
138
138
|
lines are omitted rather than shown as `undefined`. `--url` points to the
|
|
139
139
|
agent you want to check; `https://nirium-agent.fly.dev` is the Nirium
|
|
140
140
|
testnet agent. Without `--url` it looks for an agent on your own machine at
|
|
141
|
-
`http://localhost:
|
|
142
|
-
one.
|
|
141
|
+
`http://localhost:3002` - the port `pnpm dev` runs the agent API on in this
|
|
142
|
+
monorepo - so it reports "unreachable" if you are not running one there.
|
|
143
143
|
|
|
144
144
|
Exits 0 only when `/health` answers 2xx; exits 1 if the agent is
|
|
145
145
|
unreachable, times out, or answers with anything else.
|
|
146
146
|
|
|
147
147
|
| Option | Purpose | Default |
|
|
148
148
|
|---|---|---|
|
|
149
|
-
| `-u, --url <url>` | Agent to check | `http://localhost:
|
|
149
|
+
| `-u, --url <url>` | Agent to check | `http://localhost:3002` |
|
|
150
150
|
| `--json` | The raw `/health` fields plus `ok` | off |
|
|
151
151
|
| `--timeout <ms>` | Give up after this many milliseconds instead of hanging | `5000` |
|
|
152
152
|
|
package/bin/nirium.js
CHANGED
|
@@ -94,7 +94,7 @@ program
|
|
|
94
94
|
program
|
|
95
95
|
.command('status')
|
|
96
96
|
.description('Check agent connection status')
|
|
97
|
-
.option('-u, --url <url>', 'Agent URL', 'http://localhost:
|
|
97
|
+
.option('-u, --url <url>', 'Agent URL', 'http://localhost:3002')
|
|
98
98
|
.option('--json', 'Output the raw /health fields plus ok, as JSON')
|
|
99
99
|
.option('--timeout <ms>', 'Give up after this many milliseconds', '5000')
|
|
100
100
|
.action(async (options) => {
|
|
@@ -1566,11 +1566,18 @@ function verifyAuditDocument(doc, cid, { expectedHash } = {}) {
|
|
|
1566
1566
|
// when given, otherwise report the hash as unchecked (not as a mismatch).
|
|
1567
1567
|
const mode = doc.record ? 'record' : 'hash-only';
|
|
1568
1568
|
let computedHash = '';
|
|
1569
|
+
let recordHash = '';
|
|
1569
1570
|
let hashStatus;
|
|
1570
1571
|
if (mode === 'record') {
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1572
|
+
recordHash = crypto.createHash('sha256').update(JSON.stringify(doc.record)).digest('hex');
|
|
1573
|
+
computedHash = recordHash;
|
|
1574
|
+
hashStatus = recordHash === anchoredHash ? 'match' : 'mismatch';
|
|
1575
|
+
// --hash/--evidence that disagrees with the anchor is what the user is
|
|
1576
|
+
// asking about: report its hash, not the record's (which can equal the anchor).
|
|
1577
|
+
if (expectedHash && expectedHash !== anchoredHash) {
|
|
1578
|
+
hashStatus = 'mismatch';
|
|
1579
|
+
computedHash = expectedHash;
|
|
1580
|
+
}
|
|
1574
1581
|
} else if (expectedHash) {
|
|
1575
1582
|
computedHash = expectedHash;
|
|
1576
1583
|
hashStatus = expectedHash === anchoredHash ? 'match' : 'mismatch';
|
|
@@ -1586,7 +1593,7 @@ function verifyAuditDocument(doc, cid, { expectedHash } = {}) {
|
|
|
1586
1593
|
// Never trust the document's own statement field. In record mode the
|
|
1587
1594
|
// statement is built from the recomputed record hash; in hash-only mode
|
|
1588
1595
|
// from content_sha256 (a swapped content_sha256 breaks the signature).
|
|
1589
|
-
statement = `nirium-audit-v1:${mode === 'record' ?
|
|
1596
|
+
statement = `nirium-audit-v1:${mode === 'record' ? recordHash : anchoredHash}`;
|
|
1590
1597
|
declaredStatement = doc.agent.statement;
|
|
1591
1598
|
signatureScheme = verifyEd25519Signature(signerKey, statement, doc.agent.signature) || undefined;
|
|
1592
1599
|
signatureStatus = signatureScheme ? 'valid' : 'invalid';
|