@forestrie/forestrie-cli 0.8.0
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/LICENSE +21 -0
- package/README.md +425 -0
- package/TRUST-MODEL.md +8 -0
- package/dist/cli.js +33811 -0
- package/dist/decode-receipt.d.ts +19 -0
- package/dist/decode-receipt.d.ts.map +1 -0
- package/dist/decode-receipt.js +19 -0
- package/dist/decode-receipt.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/decode-receipt-cbor.d.ts +26 -0
- package/dist/lib/decode-receipt-cbor.d.ts.map +1 -0
- package/dist/lib/decode-receipt-cbor.js +182 -0
- package/dist/lib/decode-receipt-cbor.js.map +1 -0
- package/dist/lib/decode-receipt-decode.d.ts +103 -0
- package/dist/lib/decode-receipt-decode.d.ts.map +1 -0
- package/dist/lib/decode-receipt-decode.js +237 -0
- package/dist/lib/decode-receipt-decode.js.map +1 -0
- package/dist/lib/decode-receipt-labels.d.ts +54 -0
- package/dist/lib/decode-receipt-labels.d.ts.map +1 -0
- package/dist/lib/decode-receipt-labels.js +117 -0
- package/dist/lib/decode-receipt-labels.js.map +1 -0
- package/dist/lib/decode-receipt-render.d.ts +11 -0
- package/dist/lib/decode-receipt-render.d.ts.map +1 -0
- package/dist/lib/decode-receipt-render.js +242 -0
- package/dist/lib/decode-receipt-render.js.map +1 -0
- package/package.json +83 -0
- package/src/cli.ts +5 -0
- package/src/command.ts +51 -0
- package/src/commands/admin-onboard-token.ts +51 -0
- package/src/commands/admin.ts +20 -0
- package/src/commands/complete-grant.ts +41 -0
- package/src/commands/create-consistency-proof.ts +44 -0
- package/src/commands/create-log.ts +95 -0
- package/src/commands/decode-receipt.ts +20 -0
- package/src/commands/delegate.ts +55 -0
- package/src/commands/deploy.ts +72 -0
- package/src/commands/fetch-accumulator.ts +49 -0
- package/src/commands/onboard-genesis.ts +70 -0
- package/src/commands/onboard-request.ts +59 -0
- package/src/commands/register-grant.ts +74 -0
- package/src/commands/register.ts +54 -0
- package/src/commands/resolve-receipt.ts +101 -0
- package/src/commands/sign-statement.ts +53 -0
- package/src/commands/verify-grant.ts +89 -0
- package/src/commands/verify.ts +92 -0
- package/src/commoncli.ts +34 -0
- package/src/decode-receipt.ts +56 -0
- package/src/index.ts +10 -0
- package/src/lib/bytes.ts +7 -0
- package/src/lib/checkpoint-provider.ts +297 -0
- package/src/lib/complete-grant-derive.ts +237 -0
- package/src/lib/consistency-proof.ts +271 -0
- package/src/lib/create-log-build.ts +168 -0
- package/src/lib/create-log-prepare.ts +75 -0
- package/src/lib/create-receipt-chain-verify.ts +267 -0
- package/src/lib/create-receipt-derive.ts +208 -0
- package/src/lib/create-receipt-inputs.ts +79 -0
- package/src/lib/decode-checkpoint-calldata.ts +188 -0
- package/src/lib/decode-receipt-cbor.ts +202 -0
- package/src/lib/decode-receipt-decode.ts +333 -0
- package/src/lib/decode-receipt-labels.ts +132 -0
- package/src/lib/decode-receipt-render.ts +284 -0
- package/src/lib/delegate-flow.ts +289 -0
- package/src/lib/delegate-voucher.ts +122 -0
- package/src/lib/deploy-artifact.ts +79 -0
- package/src/lib/deploy-bootstrap.ts +100 -0
- package/src/lib/deploy-flow.ts +184 -0
- package/src/lib/deploy-genesis-log-id.ts +29 -0
- package/src/lib/deploy-rpc.ts +40 -0
- package/src/lib/deployment-record.ts +65 -0
- package/src/lib/fsio.ts +91 -0
- package/src/lib/grant-flags-local.ts +19 -0
- package/src/lib/onboard-attestation.ts +120 -0
- package/src/lib/onboard-genesis-body.ts +94 -0
- package/src/lib/openssl-error-queue.ts +56 -0
- package/src/lib/register-flow.ts +292 -0
- package/src/lib/register-grant-build.ts +173 -0
- package/src/lib/register-grant-complete.ts +47 -0
- package/src/lib/register-grant-flow.ts +258 -0
- package/src/lib/resolve-receipt-freshen.ts +221 -0
- package/src/lib/sign-statement-build.ts +117 -0
- package/src/lib/sign-statement-key.ts +145 -0
- package/src/lib/verify-anchored.ts +326 -0
- package/src/lib/verify-checkpoint-chain.ts +160 -0
- package/src/lib/verify-eventscan.ts +214 -0
- package/src/lib/verify-inputs.ts +143 -0
- package/src/lib/verify-known-accumulator.ts +161 -0
- package/src/lib/verify-report.ts +265 -0
- package/src/lib/x402-payment.ts +115 -0
- package/src/main/admin-onboard-token.ts +216 -0
- package/src/main/complete-grant.ts +265 -0
- package/src/main/create-consistency-proof.ts +83 -0
- package/src/main/create-log.ts +347 -0
- package/src/main/create-receipt.ts +763 -0
- package/src/main/decode-receipt.ts +72 -0
- package/src/main/delegate.ts +141 -0
- package/src/main/deploy.ts +273 -0
- package/src/main/fetch-accumulator.ts +181 -0
- package/src/main/not-implemented.ts +43 -0
- package/src/main/onboard-genesis.ts +192 -0
- package/src/main/onboard-request.ts +333 -0
- package/src/main/register-grant.ts +270 -0
- package/src/main/register.ts +243 -0
- package/src/main/sign-statement.ts +168 -0
- package/src/main/verify.ts +767 -0
- package/src/options/admin-onboard-token.ts +48 -0
- package/src/options/common.ts +69 -0
- package/src/options/complete-grant.ts +40 -0
- package/src/options/create-consistency-proof.ts +63 -0
- package/src/options/create-log.ts +99 -0
- package/src/options/create-receipt.ts +243 -0
- package/src/options/decode-receipt.ts +25 -0
- package/src/options/delegate.ts +93 -0
- package/src/options/deploy.ts +105 -0
- package/src/options/fetch-accumulator.ts +62 -0
- package/src/options/onboard-genesis.ts +74 -0
- package/src/options/onboard-request.ts +57 -0
- package/src/options/register-grant.ts +72 -0
- package/src/options/register.ts +71 -0
- package/src/options/sign-statement.ts +64 -0
- package/src/options/verify.ts +250 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { defineCommandRunner, defineForestrieCommand } from "../commoncli.js";
|
|
2
|
+
import { runAdminOnboardToken } from "../main/admin-onboard-token.js";
|
|
3
|
+
import { parseAdminOnboardTokenOptions } from "../options/admin-onboard-token.js";
|
|
4
|
+
|
|
5
|
+
export default defineForestrieCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "onboard-token",
|
|
8
|
+
description:
|
|
9
|
+
"Mint a forest onboard token under the operator credential; prints only the token so it composes into onboard-genesis --onboard-token [FOR-406]",
|
|
10
|
+
},
|
|
11
|
+
args: {
|
|
12
|
+
"base-url": {
|
|
13
|
+
type: "string",
|
|
14
|
+
description: "SCRAPI origin, no trailing slash (env FORESTRIE_BASE_URL)",
|
|
15
|
+
valueHint: "url",
|
|
16
|
+
},
|
|
17
|
+
"ops-token": {
|
|
18
|
+
type: "string",
|
|
19
|
+
description:
|
|
20
|
+
"Operator credential (env CANOPY_OPS_ADMIN_TOKEN); never logged",
|
|
21
|
+
valueHint: "token",
|
|
22
|
+
},
|
|
23
|
+
label: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "Token label recorded by the mint (default forestrie-cli)",
|
|
26
|
+
valueHint: "text",
|
|
27
|
+
},
|
|
28
|
+
deployment: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description:
|
|
31
|
+
"forestrie deploy --out artifact supplying the mandatory chain binding (ADR-0059 D7)",
|
|
32
|
+
valueHint: "path",
|
|
33
|
+
},
|
|
34
|
+
"chain-id": {
|
|
35
|
+
type: "string",
|
|
36
|
+
description: "Chain id for the binding (with --univocity; or use --deployment)",
|
|
37
|
+
valueHint: "id",
|
|
38
|
+
},
|
|
39
|
+
univocity: {
|
|
40
|
+
type: "string",
|
|
41
|
+
description: "Univocity contract address for the binding",
|
|
42
|
+
valueHint: "0xaddr",
|
|
43
|
+
},
|
|
44
|
+
out: {
|
|
45
|
+
type: "string",
|
|
46
|
+
description: "Write the minted token to this path instead of stdout",
|
|
47
|
+
valueHint: "path",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
run: defineCommandRunner(parseAdminOnboardTokenOptions, runAdminOnboardToken),
|
|
51
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineForestrieCommand } from "../commoncli.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `forestrie admin` — the operator-credential command family (ADR-0052).
|
|
5
|
+
*
|
|
6
|
+
* Participant commands never read operator secrets; anything requiring
|
|
7
|
+
* `CANOPY_OPS_ADMIN_TOKEN` (or future operator credentials) lives under
|
|
8
|
+
* this family so the split is enforced by the command tree itself.
|
|
9
|
+
*/
|
|
10
|
+
export default defineForestrieCommand({
|
|
11
|
+
meta: {
|
|
12
|
+
name: "admin",
|
|
13
|
+
description:
|
|
14
|
+
"Operator commands (require operator credentials, e.g. CANOPY_OPS_ADMIN_TOKEN)",
|
|
15
|
+
},
|
|
16
|
+
subCommands: {
|
|
17
|
+
"onboard-token": () =>
|
|
18
|
+
import("./admin-onboard-token.js").then((m) => m.default),
|
|
19
|
+
},
|
|
20
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { defineCommandRunner, defineForestrieCommand } from "../commoncli.js";
|
|
2
|
+
import { runCompleteGrant } from "../main/complete-grant.js";
|
|
3
|
+
import { parseCompleteGrantOptions } from "../options/complete-grant.js";
|
|
4
|
+
|
|
5
|
+
export default defineForestrieCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "complete-grant",
|
|
8
|
+
description:
|
|
9
|
+
"Self-create the Forestrie-Grant header content from a checkpoint — grants are derivable from log data [FOR-344]",
|
|
10
|
+
},
|
|
11
|
+
args: {
|
|
12
|
+
grant: {
|
|
13
|
+
type: "string",
|
|
14
|
+
description: "Registered (uncompleted) grant, base64 file",
|
|
15
|
+
valueHint: "path",
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
checkpoint: {
|
|
19
|
+
type: "string",
|
|
20
|
+
description: "Checkpoint (.sth) for the owner log",
|
|
21
|
+
valueHint: "path",
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
massif: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "Massif .log blob for local leaf/path recovery",
|
|
27
|
+
valueHint: "path",
|
|
28
|
+
},
|
|
29
|
+
idtimestamp: {
|
|
30
|
+
type: "string",
|
|
31
|
+
description: "Leaf idtimestamp when the grant lacks one",
|
|
32
|
+
valueHint: "hex|path",
|
|
33
|
+
},
|
|
34
|
+
"out-b64": {
|
|
35
|
+
type: "string",
|
|
36
|
+
description: "Completed grant base64 output path (default: stdout)",
|
|
37
|
+
valueHint: "path",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
run: defineCommandRunner(parseCompleteGrantOptions, runCompleteGrant),
|
|
41
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineCommandRunner, defineForestrieCommand } from "../commoncli.js";
|
|
2
|
+
import { runCreateConsistencyProof } from "../main/create-consistency-proof.js";
|
|
3
|
+
import { parseCreateConsistencyProofOptions } from "../options/create-consistency-proof.js";
|
|
4
|
+
|
|
5
|
+
export default defineForestrieCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "create-consistency-proof",
|
|
8
|
+
description:
|
|
9
|
+
"Build a portable top-up artifact from public massif tiles: the --from-size accumulator plus per-peak inclusion paths proven at --to-size (strict deterministic CBOR, unsigned). Any party with tiles can produce it; a holder then verifies an old receipt tile-free via `verify --known-accumulator ... --consistency-proof` — the artifact can only fail against the trusted snapshot, never mint trust [FOR-368]",
|
|
10
|
+
},
|
|
11
|
+
args: {
|
|
12
|
+
massif: {
|
|
13
|
+
type: "string",
|
|
14
|
+
description:
|
|
15
|
+
"Massif blob path(s), comma-separated — must cover the nodes from --from-size through --to-size (a spanning proof needs each massif in the range)",
|
|
16
|
+
valueHint: "path[,path...]",
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
"from-size": {
|
|
20
|
+
type: "string",
|
|
21
|
+
description:
|
|
22
|
+
"MMR size the proof extends FROM (the old receipt's era, e.g. an old checkpoint's tree-size-2)",
|
|
23
|
+
valueHint: "size",
|
|
24
|
+
required: true,
|
|
25
|
+
},
|
|
26
|
+
"to-size": {
|
|
27
|
+
type: "string",
|
|
28
|
+
description:
|
|
29
|
+
"MMR size the proof lands ON — must equal the holder's trusted snapshot size (fetch-accumulator anchoredSize)",
|
|
30
|
+
valueHint: "size",
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
out: {
|
|
34
|
+
type: "string",
|
|
35
|
+
description: "Output path for the consistency-proof CBOR",
|
|
36
|
+
valueHint: "path",
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
run: defineCommandRunner(
|
|
41
|
+
parseCreateConsistencyProofOptions,
|
|
42
|
+
runCreateConsistencyProof,
|
|
43
|
+
),
|
|
44
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { defineCommandRunner, defineForestrieCommand } from "../commoncli.js";
|
|
2
|
+
import { runCreateLog } from "../main/create-log.js";
|
|
3
|
+
import { parseCreateLogOptions } from "../options/create-log.js";
|
|
4
|
+
|
|
5
|
+
export default defineForestrieCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "create-log",
|
|
8
|
+
description:
|
|
9
|
+
"Create a log and set its owner (K(L)) — data, child auth, or self-referential root bootstrap [FOR-390]",
|
|
10
|
+
},
|
|
11
|
+
args: {
|
|
12
|
+
"base-url": {
|
|
13
|
+
type: "string",
|
|
14
|
+
description: "SCRAPI origin, no trailing slash (env FORESTRIE_BASE_URL)",
|
|
15
|
+
valueHint: "url",
|
|
16
|
+
},
|
|
17
|
+
"owner-log": {
|
|
18
|
+
type: "string",
|
|
19
|
+
description:
|
|
20
|
+
"Parent/auth log the create grant is sequenced into",
|
|
21
|
+
valueHint: "uuid",
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
"new-log": {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "The log being created",
|
|
27
|
+
valueHint: "uuid",
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
"auth-log": {
|
|
31
|
+
type: "boolean",
|
|
32
|
+
description: "Create a child auth log rather than a data log",
|
|
33
|
+
default: false,
|
|
34
|
+
},
|
|
35
|
+
"child-payment-required": {
|
|
36
|
+
type: "boolean",
|
|
37
|
+
description:
|
|
38
|
+
"Mark the creation grant GF_DERIVED|GF_CHILD_PAYMENT_REQUIRED: child grants registered under the new log's authority require an x402 payment (auth logs only) [adr-0062]",
|
|
39
|
+
default: false,
|
|
40
|
+
},
|
|
41
|
+
"self-referential": {
|
|
42
|
+
type: "boolean",
|
|
43
|
+
description:
|
|
44
|
+
"Root bootstrap grant (--new-log == --owner-log; binds --sign-with itself, forbids --signer-pem)",
|
|
45
|
+
default: false,
|
|
46
|
+
},
|
|
47
|
+
"signer-pem": {
|
|
48
|
+
type: "string",
|
|
49
|
+
description:
|
|
50
|
+
"PEM of the new log's owner (grantData = ES256 x||y); required unless --self-referential",
|
|
51
|
+
valueHint: "path",
|
|
52
|
+
},
|
|
53
|
+
"sign-with": {
|
|
54
|
+
type: "string",
|
|
55
|
+
description:
|
|
56
|
+
"Granting authority PEM (the parent log's K(L)) that signs the grant",
|
|
57
|
+
valueHint: "path",
|
|
58
|
+
required: true,
|
|
59
|
+
},
|
|
60
|
+
prepare: {
|
|
61
|
+
type: "boolean",
|
|
62
|
+
description:
|
|
63
|
+
"Pre-register the child's public root with the coordinator (parent-authorized, no operator token) WITHOUT sequencing, so you can `delegate` before the log exists; emits the create grant to --out-b64 [FOR-390]",
|
|
64
|
+
default: false,
|
|
65
|
+
},
|
|
66
|
+
"parent-grant-b64": {
|
|
67
|
+
type: "string",
|
|
68
|
+
description: "Parent grant credential authorizing this registration",
|
|
69
|
+
valueHint: "base64",
|
|
70
|
+
},
|
|
71
|
+
"out-b64": {
|
|
72
|
+
type: "string",
|
|
73
|
+
description: "Completed grant base64 output path (default: stdout)",
|
|
74
|
+
valueHint: "path",
|
|
75
|
+
},
|
|
76
|
+
"bootstrap-log": {
|
|
77
|
+
type: "string",
|
|
78
|
+
description:
|
|
79
|
+
"Forest bootstrap/root log id — first /register/ path segment (default: --owner-log)",
|
|
80
|
+
valueHint: "uuid",
|
|
81
|
+
},
|
|
82
|
+
timeout: {
|
|
83
|
+
type: "string",
|
|
84
|
+
description: "Overall receipt wait budget in seconds (default 60)",
|
|
85
|
+
valueHint: "seconds",
|
|
86
|
+
},
|
|
87
|
+
"poll-interval": {
|
|
88
|
+
type: "string",
|
|
89
|
+
description:
|
|
90
|
+
"Pacing between registration/receipt polls in seconds (default 1; Retry-After wins when longer)",
|
|
91
|
+
valueHint: "seconds",
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
run: defineCommandRunner(parseCreateLogOptions, runCreateLog),
|
|
95
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { defineCommandRunner, defineForestrieCommand } from "../commoncli.js";
|
|
2
|
+
import { runDecodeReceipt } from "../main/decode-receipt.js";
|
|
3
|
+
import { parseDecodeReceiptOptions } from "../options/decode-receipt.js";
|
|
4
|
+
|
|
5
|
+
export default defineForestrieCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "decode-receipt",
|
|
8
|
+
description:
|
|
9
|
+
"Decode a COSE receipt — see that it is just COSE: Sign1 + MMR inclusion [FOR-346]",
|
|
10
|
+
},
|
|
11
|
+
args: {
|
|
12
|
+
receipt: {
|
|
13
|
+
type: "positional",
|
|
14
|
+
description: "COSE receipt file (omit or use `-` to read stdin)",
|
|
15
|
+
valueHint: "path",
|
|
16
|
+
required: false,
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
run: defineCommandRunner(parseDecodeReceiptOptions, runDecodeReceipt),
|
|
20
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineCommandRunner, defineForestrieCommand } from "../commoncli.js";
|
|
2
|
+
import { runDelegate } from "../main/delegate.js";
|
|
3
|
+
import { parseDelegateOptions } from "../options/delegate.js";
|
|
4
|
+
|
|
5
|
+
export default defineForestrieCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "delegate",
|
|
8
|
+
description:
|
|
9
|
+
"Authorize a custodian-vouched sealer to publish checkpoints for a log you own (K(L)); public coordinator endpoints only [FOR-390]",
|
|
10
|
+
},
|
|
11
|
+
args: {
|
|
12
|
+
"coordinator-url": {
|
|
13
|
+
type: "string",
|
|
14
|
+
description:
|
|
15
|
+
"Delegation coordinator origin, no trailing slash (env DELEGATION_COORDINATOR_URL)",
|
|
16
|
+
valueHint: "url",
|
|
17
|
+
},
|
|
18
|
+
"log-id": {
|
|
19
|
+
type: "string",
|
|
20
|
+
description: "Target log id",
|
|
21
|
+
valueHint: "uuid",
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
"sign-with": {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "ES256 log-root PEM (K(L)) that authorizes the delegation",
|
|
27
|
+
valueHint: "path",
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
"known-sealer-key": {
|
|
31
|
+
type: "string",
|
|
32
|
+
description:
|
|
33
|
+
"The known key that vouches for the operator's sealer (the registrar's voucher-signing key), base64 x||y (64 bytes) (env KNOWN_SEALER_KEY)",
|
|
34
|
+
valueHint: "base64",
|
|
35
|
+
},
|
|
36
|
+
"horizon-mmr-end": {
|
|
37
|
+
type: "string",
|
|
38
|
+
description:
|
|
39
|
+
"Exclusive MMR end of the horizon lease (default 9007199254740991; mmrStart is fixed 0)",
|
|
40
|
+
valueHint: "number",
|
|
41
|
+
},
|
|
42
|
+
"ttl-seconds": {
|
|
43
|
+
type: "string",
|
|
44
|
+
description:
|
|
45
|
+
"Lease TTL in seconds (default: standing entry suggestedTtlSeconds)",
|
|
46
|
+
valueHint: "seconds",
|
|
47
|
+
},
|
|
48
|
+
"out-b64": {
|
|
49
|
+
type: "string",
|
|
50
|
+
description: "Write the submitted certificate base64 to this path",
|
|
51
|
+
valueHint: "path",
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
run: defineCommandRunner(parseDelegateOptions, runDelegate),
|
|
55
|
+
});
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { defineCommandRunner, defineForestrieCommand } from "../commoncli.js";
|
|
2
|
+
import { runDeploy } from "../main/deploy.js";
|
|
3
|
+
import { parseDeployOptions } from "../options/deploy.js";
|
|
4
|
+
|
|
5
|
+
export default defineForestrieCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "deploy",
|
|
8
|
+
description:
|
|
9
|
+
"Deploy a univocity instance (ES256 bootstrap is the paved path; KS256 only for the Safe/ERC-1271 aside) [FOR-340]",
|
|
10
|
+
},
|
|
11
|
+
args: {
|
|
12
|
+
"bootstrap-alg": {
|
|
13
|
+
type: "string",
|
|
14
|
+
description: "Bootstrap key algorithm: es256 (paved path) or ks256",
|
|
15
|
+
valueHint: "es256|ks256",
|
|
16
|
+
default: "es256",
|
|
17
|
+
},
|
|
18
|
+
"bootstrap-es256-generate": {
|
|
19
|
+
type: "boolean",
|
|
20
|
+
description:
|
|
21
|
+
"Generate a fresh ES256 P-256 bootstrap keypair (requires --bootstrap-es256-pem-out)",
|
|
22
|
+
default: false,
|
|
23
|
+
},
|
|
24
|
+
"bootstrap-es256-pem-out": {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "Write the generated ES256 PKCS#8 PEM to this path",
|
|
27
|
+
valueHint: "path",
|
|
28
|
+
},
|
|
29
|
+
"bootstrap-es256-pem": {
|
|
30
|
+
type: "string",
|
|
31
|
+
description:
|
|
32
|
+
"Use an existing ES256 bootstrap key PEM (PKCS#8/SEC1 private or SPKI public — only the public point is bound on-chain)",
|
|
33
|
+
valueHint: "path",
|
|
34
|
+
},
|
|
35
|
+
"owner-address": {
|
|
36
|
+
type: "string",
|
|
37
|
+
description:
|
|
38
|
+
"Deployer / owner address (env OWNER_ADDRESS); must match --deployer-key when both are given",
|
|
39
|
+
valueHint: "0x…",
|
|
40
|
+
},
|
|
41
|
+
"rpc-url": {
|
|
42
|
+
type: "string",
|
|
43
|
+
description: "JSON-RPC endpoint (env RPC_URL)",
|
|
44
|
+
valueHint: "url",
|
|
45
|
+
},
|
|
46
|
+
"deployer-key": {
|
|
47
|
+
type: "string",
|
|
48
|
+
description:
|
|
49
|
+
"Funded secp256k1 private key that pays gas for the deploy tx (env DEPLOYER_KEY). Gas-only — the ES256 bootstrap key is the trust root, not this key",
|
|
50
|
+
valueHint: "0x…",
|
|
51
|
+
},
|
|
52
|
+
"release-tag": {
|
|
53
|
+
type: "string",
|
|
54
|
+
description:
|
|
55
|
+
"Univocity contract release tag for the deploy manifest (default: latest)",
|
|
56
|
+
valueHint: "tag",
|
|
57
|
+
},
|
|
58
|
+
"release-manifest": {
|
|
59
|
+
type: "string",
|
|
60
|
+
description:
|
|
61
|
+
"Local deploy-manifest JSON (bytecode digests still verified) — skips the GitHub release fetch",
|
|
62
|
+
valueHint: "path",
|
|
63
|
+
},
|
|
64
|
+
out: {
|
|
65
|
+
type: "string",
|
|
66
|
+
description:
|
|
67
|
+
"Write the deployment record JSON here (default: stdout) — { imutableUnivocity, genesisLogId, bootstrapAlg, chainId, … }",
|
|
68
|
+
valueHint: "path",
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
run: defineCommandRunner(parseDeployOptions, runDeploy),
|
|
72
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { defineCommandRunner, defineForestrieCommand } from "../commoncli.js";
|
|
2
|
+
import { runFetchAccumulator } from "../main/fetch-accumulator.js";
|
|
3
|
+
import { parseFetchAccumulatorOptions } from "../options/fetch-accumulator.js";
|
|
4
|
+
|
|
5
|
+
export default defineForestrieCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "fetch-accumulator",
|
|
8
|
+
description:
|
|
9
|
+
"Read the log's on-chain logState and cache it as a --known-accumulator snapshot (CBOR binding chainId/univocity/logId/size/block) — verify runs chain-anchored fully offline against it. The snapshot is auditable: anyone with RPC can re-run the read at that block. Trust the party that fetched it as a chain reader; never take it unauthenticated from the log operator's tile store [FOR-297]",
|
|
10
|
+
},
|
|
11
|
+
args: {
|
|
12
|
+
univocity: {
|
|
13
|
+
type: "string",
|
|
14
|
+
description: "ImutableUnivocity contract address",
|
|
15
|
+
valueHint: "address",
|
|
16
|
+
required: true,
|
|
17
|
+
},
|
|
18
|
+
"log-id": {
|
|
19
|
+
type: "string",
|
|
20
|
+
description: "Log id (UUID or hex) for the on-chain accumulator read",
|
|
21
|
+
valueHint: "uuid",
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
"rpc-url": {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "JSON-RPC endpoint (default: ${env} → RPC_URL)",
|
|
27
|
+
valueHint: "url",
|
|
28
|
+
},
|
|
29
|
+
"at-block": {
|
|
30
|
+
type: "string",
|
|
31
|
+
description:
|
|
32
|
+
"Snapshot the latest anchored state at/before this block from CheckpointPublished events — historical states without an archive node [FOR-368]",
|
|
33
|
+
valueHint: "block",
|
|
34
|
+
},
|
|
35
|
+
"from-block": {
|
|
36
|
+
type: "string",
|
|
37
|
+
description:
|
|
38
|
+
"Lower bound for the --at-block event scan (the forest's deploy block; default earliest)",
|
|
39
|
+
valueHint: "block",
|
|
40
|
+
},
|
|
41
|
+
out: {
|
|
42
|
+
type: "string",
|
|
43
|
+
description: "Output path for the snapshot CBOR",
|
|
44
|
+
valueHint: "path",
|
|
45
|
+
required: true,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
run: defineCommandRunner(parseFetchAccumulatorOptions, runFetchAccumulator),
|
|
49
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { defineCommandRunner, defineForestrieCommand } from "../commoncli.js";
|
|
2
|
+
import { runOnboardGenesis } from "../main/onboard-genesis.js";
|
|
3
|
+
import { parseOnboardGenesisOptions } from "../options/onboard-genesis.js";
|
|
4
|
+
|
|
5
|
+
export default defineForestrieCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "onboard-genesis",
|
|
8
|
+
description:
|
|
9
|
+
"Operator genesis onboarding: POST the direct-sign ES256 genesis for a deployed forest under a pre-minted onboard token, wire sealing callbacks, and cache the public genesis [FOR-406]",
|
|
10
|
+
},
|
|
11
|
+
args: {
|
|
12
|
+
"base-url": {
|
|
13
|
+
type: "string",
|
|
14
|
+
description: "SCRAPI origin, no trailing slash (env FORESTRIE_BASE_URL)",
|
|
15
|
+
valueHint: "url",
|
|
16
|
+
},
|
|
17
|
+
deployment: {
|
|
18
|
+
type: "string",
|
|
19
|
+
description:
|
|
20
|
+
"deploy --out artifact (supplies imutableUnivocity + genesisLogId)",
|
|
21
|
+
valueHint: "path",
|
|
22
|
+
},
|
|
23
|
+
univocity: {
|
|
24
|
+
type: "string",
|
|
25
|
+
description: "ImutableUnivocity address (with --log-id, instead of --deployment)",
|
|
26
|
+
valueHint: "address",
|
|
27
|
+
},
|
|
28
|
+
"log-id": {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: "Forest (genesis) log id (with --univocity)",
|
|
31
|
+
valueHint: "uuid",
|
|
32
|
+
},
|
|
33
|
+
"bootstrap-pem": {
|
|
34
|
+
type: "string",
|
|
35
|
+
description:
|
|
36
|
+
"ES256 bootstrap key PEM from deploy (private or public; only the public key is sent)",
|
|
37
|
+
valueHint: "path",
|
|
38
|
+
required: true,
|
|
39
|
+
},
|
|
40
|
+
"chain-id": {
|
|
41
|
+
type: "string",
|
|
42
|
+
description: "Chain id recorded in the genesis (env CHAIN_ID; default 84532)",
|
|
43
|
+
valueHint: "id",
|
|
44
|
+
},
|
|
45
|
+
"coordinator-url": {
|
|
46
|
+
type: "string",
|
|
47
|
+
description:
|
|
48
|
+
"Delegation coordinator origin; the signing-route webhook is derived per log",
|
|
49
|
+
valueHint: "url",
|
|
50
|
+
},
|
|
51
|
+
"webhook-url": {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "Explicit sealing webhook (overrides --coordinator-url derivation)",
|
|
54
|
+
valueHint: "url",
|
|
55
|
+
},
|
|
56
|
+
"onboard-token": {
|
|
57
|
+
type: "string",
|
|
58
|
+
description:
|
|
59
|
+
"Pre-minted onboard token (env ONBOARD_TOKEN) — mint with 'forestrie admin onboard-token'; x402 settlement is the future public source",
|
|
60
|
+
valueHint: "token",
|
|
61
|
+
},
|
|
62
|
+
out: {
|
|
63
|
+
type: "string",
|
|
64
|
+
description:
|
|
65
|
+
"Fetch the public genesis back to this path (the offline trust root for verify --genesis)",
|
|
66
|
+
valueHint: "path",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
run: defineCommandRunner(parseOnboardGenesisOptions, runOnboardGenesis),
|
|
70
|
+
});
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { defineCommandRunner, defineForestrieCommand } from "../commoncli.js";
|
|
2
|
+
import { runOnboardRequest } from "../main/onboard-request.js";
|
|
3
|
+
import { parseOnboardRequestOptions } from "../options/onboard-request.js";
|
|
4
|
+
|
|
5
|
+
export default defineForestrieCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "onboard-request",
|
|
8
|
+
description:
|
|
9
|
+
"Create a bootstrap-key-attested onboard request and redeem it into an onboard token (paying the x402 challenge when asked); prints only the token so it composes into onboard-genesis --onboard-token [ADR-0059 D8]",
|
|
10
|
+
},
|
|
11
|
+
args: {
|
|
12
|
+
"base-url": {
|
|
13
|
+
type: "string",
|
|
14
|
+
description: "SCRAPI origin, no trailing slash (env FORESTRIE_BASE_URL)",
|
|
15
|
+
valueHint: "url",
|
|
16
|
+
},
|
|
17
|
+
deployment: {
|
|
18
|
+
type: "string",
|
|
19
|
+
description:
|
|
20
|
+
"forestrie deploy --out artifact (chain binding + bootstrap alg)",
|
|
21
|
+
valueHint: "path",
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
"bootstrap-pem": {
|
|
25
|
+
type: "string",
|
|
26
|
+
description:
|
|
27
|
+
"Bootstrap private key PEM (ES256) — signs the registrant attestation",
|
|
28
|
+
valueHint: "path",
|
|
29
|
+
},
|
|
30
|
+
"bootstrap-key-hex": {
|
|
31
|
+
type: "string",
|
|
32
|
+
description:
|
|
33
|
+
"Bootstrap private key hex (KS256) — signs the registrant attestation",
|
|
34
|
+
valueHint: "hex",
|
|
35
|
+
},
|
|
36
|
+
"contact-email": {
|
|
37
|
+
type: "string",
|
|
38
|
+
description: "Contact email for the request (env ONBOARD_CONTACT_EMAIL)",
|
|
39
|
+
valueHint: "email",
|
|
40
|
+
},
|
|
41
|
+
label: {
|
|
42
|
+
type: "string",
|
|
43
|
+
description: "Request label (default forestrie-cli)",
|
|
44
|
+
valueHint: "text",
|
|
45
|
+
},
|
|
46
|
+
"payer-key": {
|
|
47
|
+
type: "string",
|
|
48
|
+
description:
|
|
49
|
+
"x402 payer private key (env X402_PAYER_KEY); pays the redeem 402 challenge — real funds move on settlement",
|
|
50
|
+
valueHint: "hex",
|
|
51
|
+
},
|
|
52
|
+
out: {
|
|
53
|
+
type: "string",
|
|
54
|
+
description: "Write the redeemed token to this path instead of stdout",
|
|
55
|
+
valueHint: "path",
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
run: defineCommandRunner(parseOnboardRequestOptions, runOnboardRequest),
|
|
59
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { defineCommandRunner, defineForestrieCommand } from "../commoncli.js";
|
|
2
|
+
import { runRegisterGrant } from "../main/register-grant.js";
|
|
3
|
+
import { parseRegisterGrantOptions } from "../options/register-grant.js";
|
|
4
|
+
|
|
5
|
+
export default defineForestrieCommand({
|
|
6
|
+
meta: {
|
|
7
|
+
name: "register-grant",
|
|
8
|
+
description:
|
|
9
|
+
"Authorize a statement writer on a data log (extend-only; grant recorded in the parent auth log) [FOR-343]",
|
|
10
|
+
},
|
|
11
|
+
args: {
|
|
12
|
+
"base-url": {
|
|
13
|
+
type: "string",
|
|
14
|
+
description:
|
|
15
|
+
"SCRAPI origin, no trailing slash (env FORESTRIE_BASE_URL)",
|
|
16
|
+
valueHint: "url",
|
|
17
|
+
},
|
|
18
|
+
"owner-log": {
|
|
19
|
+
type: "string",
|
|
20
|
+
description: "Owner (auth) log the grant leaf is sequenced into",
|
|
21
|
+
valueHint: "uuid",
|
|
22
|
+
required: true,
|
|
23
|
+
},
|
|
24
|
+
"data-log": {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "Child/data log the grant authorizes",
|
|
27
|
+
valueHint: "uuid",
|
|
28
|
+
required: true,
|
|
29
|
+
},
|
|
30
|
+
"sign-with": {
|
|
31
|
+
type: "string",
|
|
32
|
+
description:
|
|
33
|
+
"PKCS#8 PEM key that signs the grant statement (the granting authority)",
|
|
34
|
+
valueHint: "path",
|
|
35
|
+
required: true,
|
|
36
|
+
},
|
|
37
|
+
"signer-pem": {
|
|
38
|
+
type: "string",
|
|
39
|
+
description:
|
|
40
|
+
"PEM of the signer being authorized (grantData = ES256 x||y)",
|
|
41
|
+
valueHint: "path",
|
|
42
|
+
required: true,
|
|
43
|
+
},
|
|
44
|
+
"parent-grant-b64": {
|
|
45
|
+
type: "string",
|
|
46
|
+
description: "Parent grant credential authorizing this registration",
|
|
47
|
+
valueHint: "base64",
|
|
48
|
+
required: true,
|
|
49
|
+
},
|
|
50
|
+
"out-b64": {
|
|
51
|
+
type: "string",
|
|
52
|
+
description: "Completed grant base64 output path (default: stdout)",
|
|
53
|
+
valueHint: "path",
|
|
54
|
+
},
|
|
55
|
+
"bootstrap-log": {
|
|
56
|
+
type: "string",
|
|
57
|
+
description:
|
|
58
|
+
"Forest bootstrap/root log id — first /register/ path segment (default: --owner-log)",
|
|
59
|
+
valueHint: "uuid",
|
|
60
|
+
},
|
|
61
|
+
timeout: {
|
|
62
|
+
type: "string",
|
|
63
|
+
description: "Overall receipt wait budget in seconds (default 60)",
|
|
64
|
+
valueHint: "seconds",
|
|
65
|
+
},
|
|
66
|
+
"poll-interval": {
|
|
67
|
+
type: "string",
|
|
68
|
+
description:
|
|
69
|
+
"Pacing between registration/receipt polls in seconds (default 1; Retry-After wins when longer)",
|
|
70
|
+
valueHint: "seconds",
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
run: defineCommandRunner(parseRegisterGrantOptions, runRegisterGrant),
|
|
74
|
+
});
|