@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 @@
|
|
|
1
|
+
{"version":3,"file":"decode-receipt-decode.js","sourceRoot":"","sources":["../../src/lib/decode-receipt-decode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,oBAAo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,CAAC;IAC/C,MAAM,OAAO,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAE7E,OAAO;QACL,UAAU,EAAE,YAAY,CAAC,MAAM;QAC/B,GAAG;QACH,SAAS,EAAE;YACT,UAAU,EAAE,aAAa,CAAC,MAAM;YAChC,GAAG;YACH,GAAG;YACH,GAAG;YACH,SAAS;YACT,OAAO,EAAE,gBAAgB;SAC1B;QACD,WAAW,EAAE;YACX,OAAO,EAAE,kBAAkB;YAC3B,UAAU;YACV,YAAY;SACb;QACD,OAAO,EACL,OAAO,YAAY,UAAU;YAC3B,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,CAAC,OAAO,CAAC,EAAE;YAC3E,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE;QACxB,SAAS,EAAE,EAAE,UAAU,EAAE,SAAS,CAAC,MAAM,EAAE,GAAG,EAAE,UAAU,CAAC,SAAS,CAAC,EAAE;QACvE,SAAS,EAAE;YACT,8DAA8D;YAC9D,QAAQ,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;YACpD,UAAU,EAAE,IAAI,CAAC,MAAM;YACvB,IAAI;YACJ,OAAO;YACP,UAAU,EAAE,OAAO;gBACjB,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,2CAA2C;SAChD;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COSE / forestrie header label registry for `forestrie decode-receipt`
|
|
3
|
+
* (FOR-346). Naming only — decoding never requires a label to be known,
|
|
4
|
+
* and unknown labels are always shown raw, never dropped.
|
|
5
|
+
*
|
|
6
|
+
* Sources: RFC 9052 (COSE headers), RFC 9597 (CWT claims header 15),
|
|
7
|
+
* RFC 8392 (CWT claim keys), draft-ietf-cose-merkle-tree-proofs
|
|
8
|
+
* (395 vds / 396 verifiable proofs), and the forestrie private-use
|
|
9
|
+
* labels (canopy grants.md, ADR-0046, plan-0033 format v3,
|
|
10
|
+
* `@forestrie/receipt-verify` forest-genesis-labels).
|
|
11
|
+
*/
|
|
12
|
+
/** CBOR tag for COSE_Sign1 (RFC 9052 §2). */
|
|
13
|
+
export declare const COSE_SIGN1_TAG = 18;
|
|
14
|
+
/** Verifiable proofs unprotected header (draft-ietf-cose-merkle-tree-proofs). */
|
|
15
|
+
export declare const VERIFIABLE_PROOFS_LABEL = 396;
|
|
16
|
+
/** Verifiable data structure protected header (draft-ietf-cose-merkle-tree-proofs). */
|
|
17
|
+
export declare const VDS_LABEL = 395;
|
|
18
|
+
/** CWT claims in a COSE header (RFC 9597). */
|
|
19
|
+
export declare const CWT_CLAIMS_LABEL = 15;
|
|
20
|
+
/** Delegation certificate — Custodian per-log delegation, nested COSE_Sign1. */
|
|
21
|
+
export declare const DELEGATION_CERT_LABEL = 1000;
|
|
22
|
+
/** Pre-signed peak inclusion receipts on a checkpoint (`SealPeakReceiptsLabel`). */
|
|
23
|
+
export declare const SEAL_PEAK_RECEIPTS_LABEL = -65931;
|
|
24
|
+
/** Inclusion proofs key inside header 396. */
|
|
25
|
+
export declare const PROOFS_INCLUSION_KEY = -1;
|
|
26
|
+
/** Consistency proofs key inside header 396. */
|
|
27
|
+
export declare const PROOFS_CONSISTENCY_KEY = -2;
|
|
28
|
+
export type LabelInfo = {
|
|
29
|
+
name: string;
|
|
30
|
+
/** Short provenance / meaning note for human output. */
|
|
31
|
+
note?: string;
|
|
32
|
+
};
|
|
33
|
+
/** COSE header labels (protected and unprotected share the number space). */
|
|
34
|
+
export declare const HEADER_LABELS: ReadonlyMap<number, LabelInfo>;
|
|
35
|
+
/** COSE algorithm names (RFC 9053 + forestrie private-use). */
|
|
36
|
+
export declare const ALG_NAMES: ReadonlyMap<number, string>;
|
|
37
|
+
/**
|
|
38
|
+
* Verifiable data structure ids (draft-ietf-cose-merkle-tree-proofs
|
|
39
|
+
* registry). 3 is NOT a registered codepoint: draft-bryce-cose-merkle-
|
|
40
|
+
* mountain-range-proofs requests TBD_1 (registration pending), and 3 is
|
|
41
|
+
* only the value our test fixtures use — production emitters do not emit
|
|
42
|
+
* header 395 at all. Render it as the draft's unregistered codepoint,
|
|
43
|
+
* never as registry fact (F7, plan-2607-14 W1.5).
|
|
44
|
+
*/
|
|
45
|
+
export declare const VDS_NAMES: ReadonlyMap<number, string>;
|
|
46
|
+
/** CWT claim keys (RFC 8392 §3.1, cnf per RFC 8747). */
|
|
47
|
+
export declare const CWT_CLAIM_NAMES: ReadonlyMap<number, string>;
|
|
48
|
+
/** COSE_Key parameter names (RFC 9052 §7) — for cnf / ephemeral keys. */
|
|
49
|
+
export declare const COSE_KEY_PARAM_NAMES: ReadonlyMap<number, string>;
|
|
50
|
+
/** Keys inside header 396 (draft-ietf-cose-merkle-tree-proofs). */
|
|
51
|
+
export declare const PROOF_KIND_NAMES: ReadonlyMap<number, string>;
|
|
52
|
+
/** Look up a header label name; null when unknown (caller shows it raw). */
|
|
53
|
+
export declare function headerLabelInfo(label: number): LabelInfo | null;
|
|
54
|
+
//# sourceMappingURL=decode-receipt-labels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode-receipt-labels.d.ts","sourceRoot":"","sources":["../../src/lib/decode-receipt-labels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,6CAA6C;AAC7C,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC,iFAAiF;AACjF,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,uFAAuF;AACvF,eAAO,MAAM,SAAS,MAAM,CAAC;AAC7B,8CAA8C;AAC9C,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,gFAAgF;AAChF,eAAO,MAAM,qBAAqB,OAAO,CAAC;AAC1C,oFAAoF;AACpF,eAAO,MAAM,wBAAwB,SAAS,CAAC;AAE/C,8CAA8C;AAC9C,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,gDAAgD;AAChD,eAAO,MAAM,sBAAsB,KAAK,CAAC;AAEzC,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,CAqCvD,CAAC;AAEH,+DAA+D;AAC/D,eAAO,MAAM,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAMhD,CAAC;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAIhD,CAAC;AAEH,wDAAwD;AACxD,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAStD,CAAC;AAEH,yEAAyE;AACzE,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAO3D,CAAC;AAEH,mEAAmE;AACnE,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAGvD,CAAC;AAEH,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAE/D"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* COSE / forestrie header label registry for `forestrie decode-receipt`
|
|
3
|
+
* (FOR-346). Naming only — decoding never requires a label to be known,
|
|
4
|
+
* and unknown labels are always shown raw, never dropped.
|
|
5
|
+
*
|
|
6
|
+
* Sources: RFC 9052 (COSE headers), RFC 9597 (CWT claims header 15),
|
|
7
|
+
* RFC 8392 (CWT claim keys), draft-ietf-cose-merkle-tree-proofs
|
|
8
|
+
* (395 vds / 396 verifiable proofs), and the forestrie private-use
|
|
9
|
+
* labels (canopy grants.md, ADR-0046, plan-0033 format v3,
|
|
10
|
+
* `@forestrie/receipt-verify` forest-genesis-labels).
|
|
11
|
+
*/
|
|
12
|
+
/** CBOR tag for COSE_Sign1 (RFC 9052 §2). */
|
|
13
|
+
export const COSE_SIGN1_TAG = 18;
|
|
14
|
+
/** Verifiable proofs unprotected header (draft-ietf-cose-merkle-tree-proofs). */
|
|
15
|
+
export const VERIFIABLE_PROOFS_LABEL = 396;
|
|
16
|
+
/** Verifiable data structure protected header (draft-ietf-cose-merkle-tree-proofs). */
|
|
17
|
+
export const VDS_LABEL = 395;
|
|
18
|
+
/** CWT claims in a COSE header (RFC 9597). */
|
|
19
|
+
export const CWT_CLAIMS_LABEL = 15;
|
|
20
|
+
/** Delegation certificate — Custodian per-log delegation, nested COSE_Sign1. */
|
|
21
|
+
export const DELEGATION_CERT_LABEL = 1000;
|
|
22
|
+
/** Pre-signed peak inclusion receipts on a checkpoint (`SealPeakReceiptsLabel`). */
|
|
23
|
+
export const SEAL_PEAK_RECEIPTS_LABEL = -65931;
|
|
24
|
+
/** Inclusion proofs key inside header 396. */
|
|
25
|
+
export const PROOFS_INCLUSION_KEY = -1;
|
|
26
|
+
/** Consistency proofs key inside header 396. */
|
|
27
|
+
export const PROOFS_CONSISTENCY_KEY = -2;
|
|
28
|
+
/** COSE header labels (protected and unprotected share the number space). */
|
|
29
|
+
export const HEADER_LABELS = new Map([
|
|
30
|
+
[1, { name: "alg" }],
|
|
31
|
+
[2, { name: "crit" }],
|
|
32
|
+
[3, { name: "content type" }],
|
|
33
|
+
[4, { name: "kid" }],
|
|
34
|
+
[5, { name: "IV" }],
|
|
35
|
+
[6, { name: "partial IV" }],
|
|
36
|
+
[CWT_CLAIMS_LABEL, { name: "CWT claims", note: "RFC 9597" }],
|
|
37
|
+
[
|
|
38
|
+
VDS_LABEL,
|
|
39
|
+
{ name: "verifiable data structure", note: "COSE receipts (draft)" },
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
VERIFIABLE_PROOFS_LABEL,
|
|
43
|
+
{ name: "verifiable proofs", note: "COSE receipts (draft)" },
|
|
44
|
+
],
|
|
45
|
+
[
|
|
46
|
+
DELEGATION_CERT_LABEL,
|
|
47
|
+
{
|
|
48
|
+
name: "delegation certificate",
|
|
49
|
+
note: "forestrie: Custodian per-log delegation (nested COSE_Sign1)",
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
[-65537, { name: "idtimestamp", note: "forestrie private-use" }],
|
|
53
|
+
[-65538, { name: "forestrie grant v0", note: "forestrie private-use" }],
|
|
54
|
+
[
|
|
55
|
+
SEAL_PEAK_RECEIPTS_LABEL,
|
|
56
|
+
{
|
|
57
|
+
name: "pre-signed peak receipts",
|
|
58
|
+
note: "forestrie SealPeakReceiptsLabel (checkpoint header)",
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
[-68009, { name: "forest genesis version", note: "forestrie private-use" }],
|
|
62
|
+
[-68011, { name: "univocity address", note: "forestrie private-use" }],
|
|
63
|
+
[-68013, { name: "chain id", note: "forestrie private-use" }],
|
|
64
|
+
[-68014, { name: "forest genesis alg", note: "forestrie private-use" }],
|
|
65
|
+
[-68015, { name: "bootstrap key", note: "forestrie private-use" }],
|
|
66
|
+
]);
|
|
67
|
+
/** COSE algorithm names (RFC 9053 + forestrie private-use). */
|
|
68
|
+
export const ALG_NAMES = new Map([
|
|
69
|
+
[-7, "ES256 (ECDSA P-256 + SHA-256)"],
|
|
70
|
+
[-8, "EdDSA"],
|
|
71
|
+
[-35, "ES384"],
|
|
72
|
+
[-36, "ES512"],
|
|
73
|
+
[-65799, "KS256 (secp256k1 + Keccak-256, forestrie private-use)"],
|
|
74
|
+
]);
|
|
75
|
+
/**
|
|
76
|
+
* Verifiable data structure ids (draft-ietf-cose-merkle-tree-proofs
|
|
77
|
+
* registry). 3 is NOT a registered codepoint: draft-bryce-cose-merkle-
|
|
78
|
+
* mountain-range-proofs requests TBD_1 (registration pending), and 3 is
|
|
79
|
+
* only the value our test fixtures use — production emitters do not emit
|
|
80
|
+
* header 395 at all. Render it as the draft's unregistered codepoint,
|
|
81
|
+
* never as registry fact (F7, plan-2607-14 W1.5).
|
|
82
|
+
*/
|
|
83
|
+
export const VDS_NAMES = new Map([
|
|
84
|
+
[1, "RFC9162_SHA256 (Certificate Transparency)"],
|
|
85
|
+
[2, "CCF_LEDGER_SHA256"],
|
|
86
|
+
[3, "MMR profile (draft-bryce, codepoint TBD)"],
|
|
87
|
+
]);
|
|
88
|
+
/** CWT claim keys (RFC 8392 §3.1, cnf per RFC 8747). */
|
|
89
|
+
export const CWT_CLAIM_NAMES = new Map([
|
|
90
|
+
[1, "iss"],
|
|
91
|
+
[2, "sub"],
|
|
92
|
+
[3, "aud"],
|
|
93
|
+
[4, "exp"],
|
|
94
|
+
[5, "nbf"],
|
|
95
|
+
[6, "iat"],
|
|
96
|
+
[7, "cti"],
|
|
97
|
+
[8, "cnf (confirmation / ephemeral key)"],
|
|
98
|
+
]);
|
|
99
|
+
/** COSE_Key parameter names (RFC 9052 §7) — for cnf / ephemeral keys. */
|
|
100
|
+
export const COSE_KEY_PARAM_NAMES = new Map([
|
|
101
|
+
[1, "kty"],
|
|
102
|
+
[2, "kid"],
|
|
103
|
+
[3, "alg"],
|
|
104
|
+
[-1, "crv"],
|
|
105
|
+
[-2, "x"],
|
|
106
|
+
[-3, "y"],
|
|
107
|
+
]);
|
|
108
|
+
/** Keys inside header 396 (draft-ietf-cose-merkle-tree-proofs). */
|
|
109
|
+
export const PROOF_KIND_NAMES = new Map([
|
|
110
|
+
[PROOFS_INCLUSION_KEY, "inclusion proofs"],
|
|
111
|
+
[PROOFS_CONSISTENCY_KEY, "consistency proofs"],
|
|
112
|
+
]);
|
|
113
|
+
/** Look up a header label name; null when unknown (caller shows it raw). */
|
|
114
|
+
export function headerLabelInfo(label) {
|
|
115
|
+
return HEADER_LABELS.get(label) ?? null;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=decode-receipt-labels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode-receipt-labels.js","sourceRoot":"","sources":["../../src/lib/decode-receipt-labels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,6CAA6C;AAC7C,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC,iFAAiF;AACjF,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,CAAC;AAC3C,uFAAuF;AACvF,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAC;AAC7B,8CAA8C;AAC9C,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AACnC,gFAAgF;AAChF,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAC1C,oFAAoF;AACpF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAK,CAAC;AAE/C,8CAA8C;AAC9C,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,CAAC;AACvC,gDAAgD;AAChD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,CAAC;AAQzC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAmC,IAAI,GAAG,CAAC;IACnE,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACpB,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IACrB,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC;IAC7B,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACpB,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACnB,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;IAC3B,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI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eAAe,CAAC,KAAa;IAC3C,OAAO,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Human rendering for `forestrie decode-receipt` (FOR-346).
|
|
3
|
+
*
|
|
4
|
+
* The demo money-shot: an annotated tree that makes the receipt legible
|
|
5
|
+
* to an audience — it's just COSE (Sign1 + MMR inclusion). Works purely
|
|
6
|
+
* from the display model so `--json` and the tree always agree.
|
|
7
|
+
*/
|
|
8
|
+
import type { DecodedReceipt } from "./decode-receipt-decode.js";
|
|
9
|
+
/** Render the receipt as the annotated human tree. */
|
|
10
|
+
export declare function renderReceipt(receipt: DecodedReceipt): string;
|
|
11
|
+
//# sourceMappingURL=decode-receipt-render.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode-receipt-render.d.ts","sourceRoot":"","sources":["../../src/lib/decode-receipt-render.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAEV,cAAc,EAEf,MAAM,4BAA4B,CAAC;AA+MpC,sDAAsD;AACtD,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CA+D7D"}
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Human rendering for `forestrie decode-receipt` (FOR-346).
|
|
3
|
+
*
|
|
4
|
+
* The demo money-shot: an annotated tree that makes the receipt legible
|
|
5
|
+
* to an audience — it's just COSE (Sign1 + MMR inclusion). Works purely
|
|
6
|
+
* from the display model so `--json` and the tree always agree.
|
|
7
|
+
*/
|
|
8
|
+
import { CWT_CLAIMS_LABEL, DELEGATION_CERT_LABEL, PROOF_KIND_NAMES, SEAL_PEAK_RECEIPTS_LABEL, VDS_LABEL, VERIFIABLE_PROOFS_LABEL, } from "./decode-receipt-labels.js";
|
|
9
|
+
/** Shorten `h'…'` / hex strings for tree display; JSON keeps full bytes. */
|
|
10
|
+
function shortHex(hex, keepBytes = 8) {
|
|
11
|
+
const byteLength = hex.length / 2;
|
|
12
|
+
if (byteLength <= keepBytes * 2)
|
|
13
|
+
return hex;
|
|
14
|
+
return `${hex.slice(0, keepBytes * 2)}…${hex.slice(-4)}`;
|
|
15
|
+
}
|
|
16
|
+
function describeJson(value) {
|
|
17
|
+
if (typeof value === "string") {
|
|
18
|
+
const bytes = /^h'([0-9a-f]*)'$/.exec(value);
|
|
19
|
+
if (bytes) {
|
|
20
|
+
const hex = bytes[1] ?? "";
|
|
21
|
+
return `${shortHex(hex)} (${hex.length / 2} bytes)`;
|
|
22
|
+
}
|
|
23
|
+
return JSON.stringify(value);
|
|
24
|
+
}
|
|
25
|
+
if (value === null)
|
|
26
|
+
return "null";
|
|
27
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
28
|
+
return String(value);
|
|
29
|
+
}
|
|
30
|
+
if (Array.isArray(value)) {
|
|
31
|
+
if (value.length === 0)
|
|
32
|
+
return "[]";
|
|
33
|
+
return `array of ${value.length}`;
|
|
34
|
+
}
|
|
35
|
+
return `map of ${Object.keys(value).length}`;
|
|
36
|
+
}
|
|
37
|
+
function labelPrefix(entry) {
|
|
38
|
+
return entry.name !== null
|
|
39
|
+
? `${entry.label} (${entry.name})`
|
|
40
|
+
: `${entry.label} (unknown label)`;
|
|
41
|
+
}
|
|
42
|
+
/** Render one unprotected 396 verifiable-proofs map as sub-lines. */
|
|
43
|
+
function proofLines(value, receipt, depth) {
|
|
44
|
+
const lines = [];
|
|
45
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
46
|
+
lines.push({ depth, text: describeJson(value) });
|
|
47
|
+
return lines;
|
|
48
|
+
}
|
|
49
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
50
|
+
const kind = PROOF_KIND_NAMES.get(Number(key));
|
|
51
|
+
const head = kind ? `${key} (${kind})` : `${key} (unknown proof kind)`;
|
|
52
|
+
if (Number(key) === -1) {
|
|
53
|
+
// Inclusion proofs — expand from the verified summary.
|
|
54
|
+
lines.push({ depth, text: `${head}: 1 entry` });
|
|
55
|
+
lines.push({
|
|
56
|
+
depth: depth + 1,
|
|
57
|
+
text: `1 (mmr index): ${receipt.inclusion.mmrIndex}`,
|
|
58
|
+
});
|
|
59
|
+
lines.push({
|
|
60
|
+
depth: depth + 1,
|
|
61
|
+
text: `2 (path): ${receipt.inclusion.pathLength} × 32-byte hashes`,
|
|
62
|
+
});
|
|
63
|
+
for (const [i, hash] of receipt.inclusion.path.entries()) {
|
|
64
|
+
lines.push({ depth: depth + 2, text: `[${i}] ${shortHex(hash)}` });
|
|
65
|
+
}
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
lines.push({ depth, text: `${head}: ${describeJson(entry)}` });
|
|
69
|
+
}
|
|
70
|
+
return lines;
|
|
71
|
+
}
|
|
72
|
+
function unprotectedLines(entry, receipt, depth) {
|
|
73
|
+
if (entry.label === VERIFIABLE_PROOFS_LABEL) {
|
|
74
|
+
return [
|
|
75
|
+
{ depth, text: `${labelPrefix(entry)}:` },
|
|
76
|
+
...proofLines(entry.value, receipt, depth + 1),
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
if (entry.label === DELEGATION_CERT_LABEL &&
|
|
80
|
+
receipt.unprotected.delegation) {
|
|
81
|
+
const d = receipt.unprotected.delegation;
|
|
82
|
+
const nested = d.nestedCoseSign1
|
|
83
|
+
? " — parses as a nested COSE_Sign1"
|
|
84
|
+
: "";
|
|
85
|
+
return [
|
|
86
|
+
{
|
|
87
|
+
depth,
|
|
88
|
+
text: `${labelPrefix(entry)}: ${d.byteLength} bytes${nested}`,
|
|
89
|
+
},
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
if (entry.label === SEAL_PEAK_RECEIPTS_LABEL &&
|
|
93
|
+
receipt.unprotected.peakReceipts) {
|
|
94
|
+
return [
|
|
95
|
+
{
|
|
96
|
+
depth,
|
|
97
|
+
text: `${labelPrefix(entry)}: ${receipt.unprotected.peakReceipts.count} receipts`,
|
|
98
|
+
},
|
|
99
|
+
];
|
|
100
|
+
}
|
|
101
|
+
return [{ depth, text: `${labelPrefix(entry)}: ${describeJson(entry.value)}` }];
|
|
102
|
+
}
|
|
103
|
+
function protectedLines(entry, receipt, depth) {
|
|
104
|
+
const p = receipt.protected;
|
|
105
|
+
if (entry.label === 1 && p.alg) {
|
|
106
|
+
const name = p.alg.name ?? "unknown alg";
|
|
107
|
+
return [{ depth, text: `1 (alg): ${p.alg.value} — ${name}` }];
|
|
108
|
+
}
|
|
109
|
+
if (entry.label === 4 && p.kid) {
|
|
110
|
+
const text = "hex" in p.kid
|
|
111
|
+
? `${shortHex(p.kid.hex)} (${p.kid.byteLength} bytes)`
|
|
112
|
+
: JSON.stringify(p.kid.text);
|
|
113
|
+
return [{ depth, text: `4 (kid): ${text}` }];
|
|
114
|
+
}
|
|
115
|
+
if (entry.label === VDS_LABEL && p.vds) {
|
|
116
|
+
const name = p.vds.name ?? "unknown verifiable data structure";
|
|
117
|
+
return [
|
|
118
|
+
{
|
|
119
|
+
depth,
|
|
120
|
+
text: `${VDS_LABEL} (verifiable data structure): ${p.vds.value} — ${name}`,
|
|
121
|
+
},
|
|
122
|
+
];
|
|
123
|
+
}
|
|
124
|
+
if (entry.label === CWT_CLAIMS_LABEL && p.cwtClaims) {
|
|
125
|
+
const lines = [{ depth, text: `15 (CWT claims):` }];
|
|
126
|
+
for (const claim of p.cwtClaims) {
|
|
127
|
+
const head = claim.name ? `${claim.key} (${claim.name})` : `${claim.key}`;
|
|
128
|
+
lines.push({
|
|
129
|
+
depth: depth + 1,
|
|
130
|
+
text: `${head}: ${describeJson(claim.value)}`,
|
|
131
|
+
});
|
|
132
|
+
if (claim.value !== null &&
|
|
133
|
+
typeof claim.value === "object" &&
|
|
134
|
+
!Array.isArray(claim.value)) {
|
|
135
|
+
for (const [k, v] of Object.entries(claim.value)) {
|
|
136
|
+
lines.push({ depth: depth + 2, text: `${k}: ${describeJson(v)}` });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return lines;
|
|
141
|
+
}
|
|
142
|
+
return [{ depth, text: `${labelPrefix(entry)}: ${describeJson(entry.value)}` }];
|
|
143
|
+
}
|
|
144
|
+
/** Draw the annotated COSE tree with box-drawing connectors. */
|
|
145
|
+
function drawTree(lines) {
|
|
146
|
+
const out = [];
|
|
147
|
+
for (let i = 0; i < lines.length; i += 1) {
|
|
148
|
+
const line = lines[i];
|
|
149
|
+
if (line.depth === 0) {
|
|
150
|
+
out.push(line.text);
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
// A node is "last" among its siblings if no later line has its depth
|
|
154
|
+
// before a shallower one appears.
|
|
155
|
+
const isLast = (depth, from) => {
|
|
156
|
+
for (let j = from + 1; j < lines.length; j += 1) {
|
|
157
|
+
const d = lines[j].depth;
|
|
158
|
+
if (d < depth)
|
|
159
|
+
return true;
|
|
160
|
+
if (d === depth)
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
return true;
|
|
164
|
+
};
|
|
165
|
+
let prefix = "";
|
|
166
|
+
for (let depth = 1; depth < line.depth; depth += 1) {
|
|
167
|
+
// Find the nearest ancestor line at `depth` at or before i.
|
|
168
|
+
let ancestor = -1;
|
|
169
|
+
for (let j = i; j >= 0; j -= 1) {
|
|
170
|
+
if (lines[j].depth === depth) {
|
|
171
|
+
ancestor = j;
|
|
172
|
+
break;
|
|
173
|
+
}
|
|
174
|
+
if (lines[j].depth < depth)
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
prefix += ancestor >= 0 && isLast(depth, ancestor) ? " " : "│ ";
|
|
178
|
+
}
|
|
179
|
+
prefix += isLast(line.depth, i) ? "└─ " : "├─ ";
|
|
180
|
+
out.push(prefix + line.text);
|
|
181
|
+
}
|
|
182
|
+
return out;
|
|
183
|
+
}
|
|
184
|
+
/** Render the receipt as the annotated human tree. */
|
|
185
|
+
export function renderReceipt(receipt) {
|
|
186
|
+
const tagText = receipt.tag !== null
|
|
187
|
+
? `tagged ${receipt.tag} (COSE_Sign1)`
|
|
188
|
+
: "untagged (tag 18 omitted)";
|
|
189
|
+
const lines = [
|
|
190
|
+
{
|
|
191
|
+
depth: 0,
|
|
192
|
+
text: `COSE_Sign1 — ${tagText} — ${receipt.byteLength} bytes`,
|
|
193
|
+
},
|
|
194
|
+
];
|
|
195
|
+
lines.push({
|
|
196
|
+
depth: 1,
|
|
197
|
+
text: `protected: ${receipt.protected.byteLength} bytes (CBOR map, covered by the signature)`,
|
|
198
|
+
});
|
|
199
|
+
if (receipt.protected.entries.length === 0) {
|
|
200
|
+
lines.push({ depth: 2, text: "(empty)" });
|
|
201
|
+
}
|
|
202
|
+
for (const entry of receipt.protected.entries) {
|
|
203
|
+
lines.push(...protectedLines(entry, receipt, 2));
|
|
204
|
+
}
|
|
205
|
+
lines.push({ depth: 1, text: "unprotected: (not covered by the signature)" });
|
|
206
|
+
if (receipt.unprotected.entries.length === 0) {
|
|
207
|
+
lines.push({ depth: 2, text: "(empty)" });
|
|
208
|
+
}
|
|
209
|
+
for (const entry of receipt.unprotected.entries) {
|
|
210
|
+
lines.push(...unprotectedLines(entry, receipt, 2));
|
|
211
|
+
}
|
|
212
|
+
if (receipt.payload.detached) {
|
|
213
|
+
lines.push({
|
|
214
|
+
depth: 1,
|
|
215
|
+
text: "payload: detached (nil) — the verifier recomputes the MMR peak from the inclusion path",
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
lines.push({
|
|
220
|
+
depth: 1,
|
|
221
|
+
text: `payload: ${receipt.payload.byteLength} bytes — MMR peak hash ${shortHex(receipt.payload.hex)}`,
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
lines.push({
|
|
225
|
+
depth: 1,
|
|
226
|
+
text: `signature: ${receipt.signature.byteLength} bytes — ${shortHex(receipt.signature.hex)}`,
|
|
227
|
+
});
|
|
228
|
+
const tree = drawTree(lines);
|
|
229
|
+
const inclusion = receipt.inclusion;
|
|
230
|
+
const peak = inclusion.peakHex !== null
|
|
231
|
+
? `${shortHex(inclusion.peakHex)} (from payload)`
|
|
232
|
+
: inclusion.peakSource;
|
|
233
|
+
return [
|
|
234
|
+
...tree,
|
|
235
|
+
"",
|
|
236
|
+
"MMR inclusion",
|
|
237
|
+
` mmr index: ${inclusion.mmrIndex}`,
|
|
238
|
+
` path length: ${inclusion.pathLength}`,
|
|
239
|
+
` peak: ${peak}`,
|
|
240
|
+
].join("\n");
|
|
241
|
+
}
|
|
242
|
+
//# sourceMappingURL=decode-receipt-render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decode-receipt-render.js","sourceRoot":"","sources":["../../src/lib/decode-receipt-render.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,wBAAwB,EACxB,SAAS,EACT,uBAAuB,GACxB,MAAM,4BAA4B,CAAC;AAEpC,4EAA4E;AAC5E,SAAS,QAAQ,CAAC,GAAW,EAAE,SAAS,GAAG,CAAC;IAC1C,MAAM,UAAU,GAAG,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;IAClC,IAAI,UAAU,IAAI,SAAS,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC;IAC5C,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3D,CAAC;AAED,SAAS,YAAY,CAAC,KAAW;IAC/B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI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AmB,SAAS,CAAC,UAAU,EAAE;QACzC,mBAAmB,IAAI,EAAE;KAC1B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@forestrie/forestrie-cli",
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "forestrie — participant CLI for forestrie transparency logs (SCITT / COSE receipts)",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"forestrie",
|
|
7
|
+
"scitt",
|
|
8
|
+
"cose",
|
|
9
|
+
"receipt",
|
|
10
|
+
"transparency-log",
|
|
11
|
+
"merkle",
|
|
12
|
+
"cli"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"homepage": "https://github.com/forestrie/forestrie-cli#readme",
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "git+https://github.com/forestrie/forestrie-cli.git"
|
|
19
|
+
},
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://github.com/forestrie/forestrie-cli/issues"
|
|
22
|
+
},
|
|
23
|
+
"type": "module",
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=20.10.0"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public",
|
|
29
|
+
"provenance": true
|
|
30
|
+
},
|
|
31
|
+
"bin": {
|
|
32
|
+
"forestrie": "dist/cli.js"
|
|
33
|
+
},
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"types": "./dist/index.d.ts",
|
|
37
|
+
"import": "./dist/index.js"
|
|
38
|
+
},
|
|
39
|
+
"./decode-receipt": {
|
|
40
|
+
"types": "./dist/decode-receipt.d.ts",
|
|
41
|
+
"import": "./dist/decode-receipt.js"
|
|
42
|
+
},
|
|
43
|
+
"./package.json": "./package.json"
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"dist",
|
|
47
|
+
"src",
|
|
48
|
+
"LICENSE",
|
|
49
|
+
"README.md",
|
|
50
|
+
"TRUST-MODEL.md"
|
|
51
|
+
],
|
|
52
|
+
"scripts": {
|
|
53
|
+
"dev": "bun run ./src/cli.ts",
|
|
54
|
+
"clean": "rm -rf dist",
|
|
55
|
+
"build": "bun run clean && bun run build:lib && bun run build:cli",
|
|
56
|
+
"build:cli": "bun build ./src/cli.ts --outdir dist --target node",
|
|
57
|
+
"build:lib": "tsc -p tsconfig.lib.json",
|
|
58
|
+
"build:binary": "bun scripts/build-binary.ts",
|
|
59
|
+
"build:binary:linux-x64": "bun scripts/build-binary.ts --target bun-linux-x64",
|
|
60
|
+
"build:binary:darwin-arm64": "bun scripts/build-binary.ts --target bun-darwin-arm64",
|
|
61
|
+
"typecheck": "tsc --noEmit",
|
|
62
|
+
"check:cbor": "bun scripts/check-cbor-codec.ts",
|
|
63
|
+
"test": "bun test",
|
|
64
|
+
"prepack": "bun run build"
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"@forestrie/chain-rpc": "^0.2.0",
|
|
68
|
+
"@forestrie/cli-kit": "^0.1.1",
|
|
69
|
+
"@forestrie/delegation-cose": "^0.3.1",
|
|
70
|
+
"@forestrie/deploy-core": "^0.7.1",
|
|
71
|
+
"@forestrie/encoding": "^0.7.0",
|
|
72
|
+
"@forestrie/grant-builder": "^0.4.1",
|
|
73
|
+
"@forestrie/merklelog": "^0.3.0",
|
|
74
|
+
"@forestrie/receipt-verify": "^1.0.0",
|
|
75
|
+
"@forestrie/scrapi-client": "^0.1.4",
|
|
76
|
+
"citty": "^0.2.2",
|
|
77
|
+
"viem": "^2.31.0"
|
|
78
|
+
},
|
|
79
|
+
"devDependencies": {
|
|
80
|
+
"@types/bun": "latest",
|
|
81
|
+
"typescript": "^5.9.2"
|
|
82
|
+
}
|
|
83
|
+
}
|
package/src/cli.ts
ADDED
package/src/command.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import pkg from "../package.json" with { type: "json" };
|
|
2
|
+
import { defineForestrieCommand } from "./commoncli.js";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Root `forestrie` command. Subcommands are lazy-loaded citty modules;
|
|
6
|
+
* argument parsing lives in `src/options/`, behaviour in `src/main/`
|
|
7
|
+
* (parse/execute split — see AGENTS.md).
|
|
8
|
+
*/
|
|
9
|
+
export default defineForestrieCommand({
|
|
10
|
+
meta: {
|
|
11
|
+
name: "forestrie",
|
|
12
|
+
// Single source of truth: release.yml's assert-tag-version checks
|
|
13
|
+
// package.json, so deriving here keeps `forestrie --version` honest
|
|
14
|
+
// (the v0.3.0 binary self-reported 0.2.0 from a stale literal).
|
|
15
|
+
version: pkg.version,
|
|
16
|
+
description:
|
|
17
|
+
"Participant CLI for forestrie transparency logs (SCITT / COSE receipts; ES256 is the paved path)",
|
|
18
|
+
},
|
|
19
|
+
subCommands: {
|
|
20
|
+
admin: () => import("./commands/admin.js").then((m) => m.default),
|
|
21
|
+
deploy: () => import("./commands/deploy.js").then((m) => m.default),
|
|
22
|
+
"sign-statement": () =>
|
|
23
|
+
import("./commands/sign-statement.js").then((m) => m.default),
|
|
24
|
+
register: () => import("./commands/register.js").then((m) => m.default),
|
|
25
|
+
"create-log": () =>
|
|
26
|
+
import("./commands/create-log.js").then((m) => m.default),
|
|
27
|
+
"register-grant": () =>
|
|
28
|
+
import("./commands/register-grant.js").then((m) => m.default),
|
|
29
|
+
delegate: () => import("./commands/delegate.js").then((m) => m.default),
|
|
30
|
+
"onboard-genesis": () =>
|
|
31
|
+
import("./commands/onboard-genesis.js").then((m) => m.default),
|
|
32
|
+
"onboard-request": () =>
|
|
33
|
+
import("./commands/onboard-request.js").then((m) => m.default),
|
|
34
|
+
"complete-grant": () =>
|
|
35
|
+
import("./commands/complete-grant.js").then((m) => m.default),
|
|
36
|
+
"resolve-receipt": () =>
|
|
37
|
+
import("./commands/resolve-receipt.js").then((m) => m.default),
|
|
38
|
+
// Non-breaking alias for the pre-FOR-418 name (plan-2607-32 D5).
|
|
39
|
+
"create-receipt": () =>
|
|
40
|
+
import("./commands/resolve-receipt.js").then((m) => m.default),
|
|
41
|
+
"decode-receipt": () =>
|
|
42
|
+
import("./commands/decode-receipt.js").then((m) => m.default),
|
|
43
|
+
verify: () => import("./commands/verify.js").then((m) => m.default),
|
|
44
|
+
"verify-grant": () =>
|
|
45
|
+
import("./commands/verify-grant.js").then((m) => m.default),
|
|
46
|
+
"fetch-accumulator": () =>
|
|
47
|
+
import("./commands/fetch-accumulator.js").then((m) => m.default),
|
|
48
|
+
"create-consistency-proof": () =>
|
|
49
|
+
import("./commands/create-consistency-proof.js").then((m) => m.default),
|
|
50
|
+
},
|
|
51
|
+
});
|