@atcn/verify-cli 1.3.2 → 1.4.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 +1 -0
- package/dist/cli.js +10 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@ Options:
|
|
|
16
16
|
- **`--previous`:** checks the chain link to the previous revision.
|
|
17
17
|
- **`--operator-keys` and `--require-operator-signature`:** check operator countersignatures.
|
|
18
18
|
- **`--obligation-package`:** cross-checks a closure's linked obligations against their closure packages. You can repeat it.
|
|
19
|
+
- **`--at <ISO-8601 time>`:** checks a provider receipt's `expires_at` against that time instead of now, for example the time you received it.
|
|
19
20
|
- **`--json`:** prints the report as JSON.
|
|
20
21
|
|
|
21
22
|
Exit codes:
|
package/dist/cli.js
CHANGED
|
@@ -5,7 +5,7 @@ import { PublicKeyRecordSchema } from "@atcn/schema";
|
|
|
5
5
|
import { OperatorKeyRecordSchema, SUBLEDGER_VERIFIER_VERSION, SUPPORTED_SUBLEDGER_SCHEMA_VERSIONS, verifySubledgerDocument, } from "@atcn/subledger";
|
|
6
6
|
const USAGE = `usage: atcn-verify <document.json> --keys <published-keys.json> [--previous <previous-revision.json>]
|
|
7
7
|
[--operator-keys <operator-keys.json>] [--require-operator-signature]
|
|
8
|
-
[--obligation-package <closure-package.json> ...] [--json]
|
|
8
|
+
[--obligation-package <closure-package.json> ...] [--at <ISO-8601 time>] [--json]
|
|
9
9
|
|
|
10
10
|
Verifies offline, without contacting the service:
|
|
11
11
|
- ATCN closure packages (obligations): signatures, key validity, event references,
|
|
@@ -14,7 +14,7 @@ Verifies offline, without contacting the service:
|
|
|
14
14
|
delegation lineage, reversals, allocation sums and versions, roll-up totals,
|
|
15
15
|
provider response signatures, and the version chain.
|
|
16
16
|
- Subledger provider receipts (atcn.subledger.receipt): signature, schema, reversals,
|
|
17
|
-
totals, field disclosure,
|
|
17
|
+
totals, field disclosure, the revision chain, and expiry.
|
|
18
18
|
--keys accepts a JSON array of public key records or the /v1/service/keys response ({"items": [...]}).
|
|
19
19
|
--previous checks the chain link to the prior receipt revision or closure version.
|
|
20
20
|
--operator-keys checks countersignatures made with the operator's own keys
|
|
@@ -22,6 +22,7 @@ Verifies offline, without contacting the service:
|
|
|
22
22
|
--obligation-package (repeatable) cross-checks a task closure's obligation-backed delegations against
|
|
23
23
|
the obligations' closure packages (GET /v1/exports/{obligation_id}): each package must verify, and its
|
|
24
24
|
journal must produce exactly the costs the closure recorded from the clearing network.
|
|
25
|
+
--at checks a provider receipt's expires_at against that time instead of now.
|
|
25
26
|
Subledger schema versions supported: ${SUPPORTED_SUBLEDGER_SCHEMA_VERSIONS.join(", ")} (atcn-verify ${SUBLEDGER_VERIFIER_VERSION}).
|
|
26
27
|
Exit code 0 = valid, 1 = invalid, 2 = usage or input error, 3 = unsupported schema version (upgrade atcn-verify).`;
|
|
27
28
|
function readJson(path) {
|
|
@@ -55,6 +56,7 @@ function main() {
|
|
|
55
56
|
"operator-keys": { type: "string" },
|
|
56
57
|
"require-operator-signature": { type: "boolean" },
|
|
57
58
|
"obligation-package": { type: "string", multiple: true },
|
|
59
|
+
at: { type: "string" },
|
|
58
60
|
json: { type: "boolean" },
|
|
59
61
|
help: { type: "boolean" },
|
|
60
62
|
},
|
|
@@ -68,6 +70,11 @@ function main() {
|
|
|
68
70
|
console.error(USAGE);
|
|
69
71
|
return 2;
|
|
70
72
|
}
|
|
73
|
+
const at = parsed.values.at;
|
|
74
|
+
if (at !== undefined && Number.isNaN(Date.parse(at))) {
|
|
75
|
+
console.error(`--at must be an ISO 8601 time, got ${at}\n\n${USAGE}`);
|
|
76
|
+
return 2;
|
|
77
|
+
}
|
|
71
78
|
let report;
|
|
72
79
|
let label;
|
|
73
80
|
try {
|
|
@@ -84,6 +91,7 @@ function main() {
|
|
|
84
91
|
operatorKeys,
|
|
85
92
|
requireOperatorSignature: parsed.values["require-operator-signature"],
|
|
86
93
|
obligationPackages,
|
|
94
|
+
at: at === undefined ? undefined : new Date(at).toISOString(),
|
|
87
95
|
});
|
|
88
96
|
report = result;
|
|
89
97
|
label = result.document_type === "atcn.subledger.receipt" ? "provider receipt" : "task closure";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atcn/verify-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Offline verifier for ATCN closure packages, subledger task closures, and provider receipts: atcn-verify <document.json> --keys <keys.json>",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"build": "tsc -p tsconfig.build.json"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@atcn/core": "1.
|
|
31
|
-
"@atcn/schema": "1.
|
|
32
|
-
"@atcn/subledger": "1.
|
|
30
|
+
"@atcn/core": "1.4.1",
|
|
31
|
+
"@atcn/schema": "1.4.1",
|
|
32
|
+
"@atcn/subledger": "1.4.1"
|
|
33
33
|
}
|
|
34
34
|
}
|