@integraledger/lcp-verify 0.9.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/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # @integraledger/lcp-verify
2
+
3
+ ## 0.9.0
4
+
5
+ First public release.
6
+
7
+ `0.9.0` is deliberate: this is a release candidate for 1.0, not a preview. The implementation is complete
8
+ against LCP v1.38 and certified by the conformance corpus, and the remaining distance to 1.0 is the
9
+ specification's own — the standard is still moving through its steering committee, and this package will not
10
+ claim a stability its protocol has not yet promised.
11
+
12
+ Development before this release happened in a private repository and is not reproduced here; no earlier
13
+ version was ever available to install.
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,14 @@
1
+ Integra Protocol
2
+ Copyright 2026 Integra Ledger
3
+
4
+ This product includes software developed by Integra Ledger (https://integraledger.com).
5
+
6
+ "Integra", "Integra Ledger", and the Integra logo are trademarks of Integra Ledger.
7
+ Trademark use is not granted by the Apache License 2.0 (see Section 6).
8
+
9
+ The Legal Context Protocol is co-stewarded by Integra Ledger and AAA-ICDR. This repository is a
10
+ reference implementation of the standard's open layer; the specification itself is published at
11
+ https://legalcontextprotocol.org/standard and is not part of this distribution.
12
+
13
+ The vendored submodule under lib/commerce-payments is Coinbase's AuthCaptureEscrow and carries its own
14
+ MIT licence at lib/commerce-payments/LICENSE.md. It is not covered by the Apache License above.
package/README.md ADDED
@@ -0,0 +1,116 @@
1
+ # @integraledger/lcp-verify
2
+
3
+ The verification walk, and the canonical report it emits.
4
+
5
+ `verify` takes the pieces of a record and reports, step by step, what it was able to establish. It is
6
+ **pure over its supplied inputs** — it opens no sockets and fetches nothing. The imperative shell that
7
+ gathers those inputs over live ports belongs to the caller, which is what makes this function
8
+ deterministic and testable against fixed vectors.
9
+
10
+ ```bash
11
+ npm install @integraledger/lcp-verify
12
+ ```
13
+
14
+ Built on [`@integraledger/lcp-kernel`](../kernel#readme), [`@integraledger/lcp-binding-core`](../binding-core#readme) and [`@integraledger/lcp-authority`](../authority#readme). No chain SDK: the ports are yours to
15
+ supply, and [`@integraledger/lcp-binding-evm-common`](../binding-evm-common#readme) is the EVM implementation of the signature-verifier one.
16
+
17
+ ## Use
18
+
19
+ ```ts
20
+ import { verify, serializeReport } from "@integraledger/lcp-verify";
21
+
22
+ declare const atrBytes: Uint8Array; // the exact ATR bytes the record was hashed over
23
+ declare const settledAtrHash: string; // the atrHash recovered from the settlement
24
+
25
+ const report = await verify({
26
+ asOf: "2026-07-27T00:00:00Z",
27
+ coverage: { ports: [], bindings: ["evm-x402"] },
28
+ atrBytes,
29
+ settledAtrHash,
30
+ settlements: [{ txHash: "0x1111…" }],
31
+ });
32
+ ```
33
+
34
+ ```
35
+ verified: false | supportedClass: TC-2
36
+ atr-fingerprint proved
37
+ settlement-enumeration proved
38
+ buyer-acceptance not-attempted no-acceptance
39
+ authority-attenuation not-attempted no-authority-chain
40
+ commitment-vs-leaf not-attempted no-commitment
41
+ recourse-elections not-attempted no-elections-recorded
42
+ resolve-party not-attempted no-identity
43
+ ```
44
+
45
+ ## The four statuses, and why there are four
46
+
47
+ Most verifiers have two: pass and fail. That collapses two very different situations — *this is wrong*
48
+ and *I was not equipped to check this* — into one word, and a caller cannot tell them apart.
49
+
50
+ | Status | Meaning |
51
+ |---|---|
52
+ | `proved` | The step ran and held |
53
+ | `failed` | The step ran and did not hold — carries a halt class |
54
+ | `indeterminate` | The input exists but could not be retrieved |
55
+ | `not-attempted` | The input was never supplied — carries the reason |
56
+
57
+ **An absent input never becomes a pass.** An empty authority chain is `not-attempted`, never `proved`:
58
+ a record carrying no delegated authority at all must not clear the authority rung by supplying nothing.
59
+ A malformed chain is `not-attempted` too, with a different reason — unwalkable is a gap, not a
60
+ contradiction.
61
+
62
+ An acceptance presented without a signature verifier is `not-attempted("no-signature-verifier")`, because
63
+ a signature nobody checked is not evidence of a signature.
64
+
65
+ ## `verified` and `supportedClass` are readouts, not targets
66
+
67
+ At the default `depth: "structural"`, `verified` is **always** `false`. A structural walk is a
68
+ presence-and-absence readout; it cannot raise a verdict. Passing `depth: "mechanical"` — where the caller
69
+ has supplied live ports — lets `verified` become an honest function of the walk: true only when every
70
+ class-required step is `proved` and none `failed`.
71
+
72
+ `supportedClass` works the same way. The record is *shaped for* a claimed class, and the structural walk
73
+ can only confirm or impeach that shape: any failed step downgrades it to `TC-0`, and the walk never
74
+ raises it.
75
+
76
+ A forged input cannot produce a `proved`. Signature verification that throws deep in curve math over
77
+ corrupted bytes is reported as a failure, not propagated as a crash — a verifier that dies on a forgery
78
+ cannot report the forgery, which is the one case it exists for.
79
+
80
+ ## Byte-identical reports
81
+
82
+ ```ts
83
+ import { serializeReport, type VerificationReport } from "@integraledger/lcp-verify";
84
+
85
+ declare const report: VerificationReport;
86
+
87
+ serializeReport(report); // RFC 8785 (JCS) canonical JSON
88
+ ```
89
+
90
+ The protocol's promise is that independent verifiers holding the same inputs emit the same bytes. That
91
+ requires a canonical form, and RFC 8785 is precisely the multi-producer convergence case — including the
92
+ rule that integer-like keys sort by UTF-16 code unit rather than numerically.
93
+
94
+ ## Requirement ids
95
+
96
+ This package's source and its messages cite short ids — `ATA-3`, `RCS-5`, `CMP-6` and their kin.
97
+ **They are not LCP clause numbers.** LCP is cited by section (`§8.3.1`, `§C.2`); anything shaped `XXX-n`
98
+ comes from Integra's functional specification of what a complete agent transaction requires, the fourteen
99
+ families below. Nothing in this package's behaviour depends on them, and where an id and an LCP section
100
+ disagree the section governs.
101
+
102
+ | | | | |
103
+ |---|---|---|---|
104
+ | `IDN` identity | `ASP` authority to spend | `ATA` authority to accept terms | `TRM` the terms record |
105
+ | `RCS` recourse | `PAY` payment and settlement | `WLD` the transactional weld | `OFR` offer integrity |
106
+ | `FRC` fraud, risk, and compliance | `OPS` commercial operations | `DSC` discovery and reputation | `ORC` orchestration |
107
+ | `CMP` composition | `PRS` persistence and verification infrastructure | | |
108
+
109
+ ---
110
+
111
+ **Requires Node >= 24.** Part of the
112
+ [Legal Context Protocol open layer](https://github.com/IntegraLedger/integra-protocol) — see the
113
+ [documentation](https://github.com/IntegraLedger/integra-protocol/blob/main/docs/developer/index.md)
114
+ and the
115
+ [package index](https://github.com/IntegraLedger/integra-protocol/blob/main/docs/developer/reference.md).
116
+ Apache-2.0.
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The TC-4 **composition readout** — the pure step evaluators the walk appends when a
3
+ * `composition` slot is supplied. Each evaluator mirrors `fingerprintStep`: presence/absence over the
4
+ * supplied `CompositionInput` → a `StepOutcome`, no I/O, no fetch, no viem. TC-4 is a READOUT of a record
5
+ * complete enough to prove it was complete — these steps never gate; they only confirm or impeach.
6
+ *
7
+ * FRC is DELIBERATELY non-gating (FRC-1): `frcNonGatingStep` is impeachment-only — a signal that GATED is a
8
+ * `failed(risk-block)`, its ABSENCE never blocks TC-4 (it is not in `REQUIRED_STEPS["TC-4"]`).
9
+ */
10
+ import type { StepOutcome } from "./report.js";
11
+ /** What the caller can state about a record's composition. **Every field is optional, and absence is
12
+ * meaningful**: an omitted field is a gap the readout reports as unproved, never an assumed `false`.
13
+ * The values are the CALLER's assertions — this module performs no I/O and cannot check any of them. */
14
+ export interface CompositionInput {
15
+ readonly offerBound?: boolean;
16
+ readonly operations?: {
17
+ readonly orderStateRef?: boolean;
18
+ readonly reconciliationIds?: boolean;
19
+ };
20
+ readonly discoveryIntegrity?: "ok" | "mismatch" | "not-checked";
21
+ readonly proportionalityTier?: 1 | 2 | 3 | 4;
22
+ readonly frcSignals?: readonly {
23
+ readonly role: string;
24
+ readonly gated: boolean;
25
+ }[];
26
+ }
27
+ /** The flattened TC-4 readout. It is a READOUT, not a verdict: nothing here gates, and `frcGated: true`
28
+ * is an impeachment signal rather than a refusal. `proportionalityTier` stays `undefined` when the caller
29
+ * stated none, because an unstated tier is not tier 1. */
30
+ export interface CompositionReadout {
31
+ readonly offerBound: boolean;
32
+ readonly operationsBound: boolean;
33
+ readonly discoveryIntegrity: "ok" | "mismatch" | "not-checked";
34
+ readonly proportionalityTier: 1 | 2 | 3 | 4 | undefined;
35
+ readonly frcSignalCount: number;
36
+ readonly frcGated: boolean;
37
+ }
38
+ /** OFR — proved iff the offer slot is bound; an unbound offer is incompleteness (not-attempted), never a failure. */
39
+ export declare function offerBoundStep(c: CompositionInput | undefined): StepOutcome;
40
+ /** OPS core — the always-applicable OPS bindings (OPS-2 order/fulfillment ref AND OPS-5 reconciliation). */
41
+ export declare function operationsStep(c: CompositionInput | undefined): StepOutcome;
42
+ /** DSC-1/2 — "ok" proves; "mismatch" is a hard DSC-2 violation (verification-failure); else not-attempted. */
43
+ export declare function discoveryIntegrityStep(c: CompositionInput | undefined): StepOutcome;
44
+ /** CMP-6 — proved iff the proportionality tier is declared. */
45
+ export declare function proportionalityStep(c: CompositionInput | undefined): StepOutcome;
46
+ /** FRC-1 — impeachment-only: any signal that GATED is a `failed(risk-block)`; signals present but non-gating
47
+ * prove the stack recorded-not-gated; no signals is not-attempted (FRC is not a v1 requirement). */
48
+ export declare function frcNonGatingStep(c: CompositionInput | undefined): StepOutcome;
49
+ /** Flatten a {@link CompositionInput} into a {@link CompositionReadout}. Pure and total — an `undefined`
50
+ * input is legitimate and reads as "nothing stated" rather than throwing. `operationsBound` requires BOTH
51
+ * operations fields; either alone is a partially-composed record and reads `false`. */
52
+ export declare function readCompositionSlots(input: CompositionInput | undefined): CompositionReadout;
53
+ //# sourceMappingURL=composition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition.d.ts","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;yGAEyG;AACzG,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9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D;qGACqG;AACrG,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,gBAAgB,GAAG,SAAS,GAAG,WAAW,CAM7E;AAED;;wFAEwF;AACxF,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,gBAAgB,GAAG,SAAS,GAClC,kBAAkB,CAYpB"}
@@ -0,0 +1,54 @@
1
+ const na = (why) => ({
2
+ status: "not-attempted",
3
+ depth: why,
4
+ });
5
+ /** OFR — proved iff the offer slot is bound; an unbound offer is incompleteness (not-attempted), never a failure. */
6
+ export function offerBoundStep(c) {
7
+ return c?.offerBound ? { status: "proved" } : na("no-offer");
8
+ }
9
+ /** OPS core — the always-applicable OPS bindings (OPS-2 order/fulfillment ref AND OPS-5 reconciliation). */
10
+ export function operationsStep(c) {
11
+ return c?.operations?.orderStateRef && c.operations.reconciliationIds
12
+ ? { status: "proved" }
13
+ : na("ops-incomplete");
14
+ }
15
+ /** DSC-1/2 — "ok" proves; "mismatch" is a hard DSC-2 violation (verification-failure); else not-attempted. */
16
+ export function discoveryIntegrityStep(c) {
17
+ const d = c?.discoveryIntegrity;
18
+ if (d === undefined || d === "not-checked")
19
+ return na("no-discovery-check");
20
+ return d === "ok"
21
+ ? { status: "proved" }
22
+ : { status: "failed", haltClass: "verification-failure" };
23
+ }
24
+ /** CMP-6 — proved iff the proportionality tier is declared. */
25
+ export function proportionalityStep(c) {
26
+ return c?.proportionalityTier !== undefined
27
+ ? { status: "proved" }
28
+ : na("no-tier");
29
+ }
30
+ /** FRC-1 — impeachment-only: any signal that GATED is a `failed(risk-block)`; signals present but non-gating
31
+ * prove the stack recorded-not-gated; no signals is not-attempted (FRC is not a v1 requirement). */
32
+ export function frcNonGatingStep(c) {
33
+ const sigs = c?.frcSignals ?? [];
34
+ if (sigs.length === 0)
35
+ return na("no-frc-signals");
36
+ return sigs.some((s) => s.gated)
37
+ ? { status: "failed", haltClass: "risk-block" }
38
+ : { status: "proved" };
39
+ }
40
+ /** Flatten a {@link CompositionInput} into a {@link CompositionReadout}. Pure and total — an `undefined`
41
+ * input is legitimate and reads as "nothing stated" rather than throwing. `operationsBound` requires BOTH
42
+ * operations fields; either alone is a partially-composed record and reads `false`. */
43
+ export function readCompositionSlots(input) {
44
+ const sigs = input?.frcSignals ?? [];
45
+ return {
46
+ offerBound: !!input?.offerBound,
47
+ operationsBound: !!(input?.operations?.orderStateRef && input.operations.reconciliationIds),
48
+ discoveryIntegrity: input?.discoveryIntegrity ?? "not-checked",
49
+ proportionalityTier: input?.proportionalityTier,
50
+ frcSignalCount: sigs.length,
51
+ frcGated: sigs.some((s) => s.gated),
52
+ };
53
+ }
54
+ //# sourceMappingURL=composition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composition.js","sourceRoot":"","sources":["../src/composition.ts"],"names":[],"mappings":"AAuCA,MAAM,EAAE,GAAG,CAAC,GAAW,EAAe,EAAE,CAAC,CAAC;IACxC,MAAM,EAAE,eAAe;IACvB,KAAK,EAAE,GAAG;CACX,CAAC,CAAC;AAEH,qHAAqH;AACrH,MAAM,UAAU,cAAc,CAAC,CAA+B;IAC5D,OAAO,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC;AAC/D,CAAC;AACD,4GAA4G;AAC5G,MAAM,UAAU,cAAc,CAAC,CAA+B;IAC5D,OAAO,CAAC,EAAE,UAAU,EAAE,aAAa,IAAI,CAAC,CAAC,UAAU,CAAC,iBAAiB;QACnE,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE;QACtB,CAAC,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC;AAC3B,CAAC;AACD,8GAA8G;AAC9G,MAAM,UAAU,sBAAsB,CACpC,CAA+B;IAE/B,MAAM,CAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC;IAChC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,aAAa;QAAE,OAAO,EAAE,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cAAc,EAAE,IAAI,CAAC,MAAM;QAC3B,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;KACpC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,104 @@
1
+ /**
2
+ * `verify` — the walk at the caller-specified `depth` (default `"structural"`). Pure over
3
+ * its supplied inputs (the fetched ATR bytes, the enumerated settlements, the ATA chain, the acceptance)
4
+ * — the imperative shell that fetches them via live ports is the buyer gate's. The report is honest about
5
+ * coverage: a step whose inputs are absent is `not-attempted(<why>)`.
6
+ *
7
+ * At STRUCTURAL depth `verified` is always `false` (a presence/absence readout → class, not a verdict).
8
+ * At MECHANICAL depth `verified` is an honest function of the walk via `computeVerified` — raised `true`
9
+ * iff every class-required step is `proved` and no step `failed`.
10
+ *
11
+ * `supportedClass` is an HONEST READOUT, never a target: the record is *shaped for* `claimedClass`, and
12
+ * the structural walk can only CONFIRM-OR-IMPEACH that shape — any `failed` step downgrades it to `TC-0`;
13
+ * the walk never raises it (raising requires the mechanical verification `computeVerified` supplies).
14
+ */
15
+ import type { Bounds, ChainWalkResult, SignatureVerifier, SignedAcceptance } from "@integraledger/lcp-authority";
16
+ import { type CompositionInput } from "./composition.js";
17
+ import type { VerificationReport, VerifyDepth } from "./report.js";
18
+ import { type TransactionClass } from "./required.js";
19
+ import { type AuthorityLink, type PlacementInput, type RecordIdentity } from "./steps.js";
20
+ export { type CompositionInput, type CompositionReadout, discoveryIntegrityStep, frcNonGatingStep, offerBoundStep, operationsStep, proportionalityStep, readCompositionSlots, } from "./composition.js";
21
+ export { jcsCanonicalize, type StepOutcome, serializeReport, type VerificationReport, type VerificationStep, type VerifyDepth, } from "./report.js";
22
+ export { computeVerified, REQUIRED_STEPS, type StepName, type TransactionClass, } from "./required.js";
23
+ export { type AuthorityLink, acceptanceStep, authorityStep, authorityStepFromWalk, commitmentStep, fingerprintStep, type PlacementInput, RCS4_REQUIRED_ROLES, type RecordIdentity, recourseStep, referencePlacementStep, resolvePartyStep, settlementStep, } from "./steps.js";
24
+ /**
25
+ * Everything a verification walk is given. **The caller gathers the inputs; `verify()` opens no network
26
+ * connection of its own** — it takes `atrBytes`, not a reference to fetch, and takes `settlements` rather
27
+ * than enumerating them. That is what makes the walk pure and reproducible.
28
+ *
29
+ * Nearly every field is optional, and this is the type's central property: an absent input yields an
30
+ * `indeterminate` or `not-attempted` step, never a pass. `coverage` is how the report stays honest about
31
+ * that — it states which ports and bindings were actually supplied, so a thin walk cannot read as a
32
+ * thorough one.
33
+ */
34
+ export interface VerifyInput {
35
+ /** The settlement's chain-anchored time (every validity check is evaluated against it). */
36
+ asOf: string;
37
+ /** Which ports/bindings were supplied — coverage is honest depth. */
38
+ coverage: {
39
+ ports: string[];
40
+ bindings: string[];
41
+ };
42
+ /** The retrieved ATR bytes (absent ⇒ the fingerprint step is indeterminate). */
43
+ atrBytes?: Uint8Array;
44
+ /** The atrHash the settlement committed (nonce/salt) — the fingerprint is checked against it. */
45
+ settledAtrHash?: string;
46
+ /** Settlements found for the fingerprint across supplied forward-indexable bindings. */
47
+ settlements?: unknown[];
48
+ /** The buyer's presented signed acceptance over the fingerprint (TRM-6). */
49
+ acceptance?: SignedAcceptance;
50
+ /** The port that checks the acceptance's signature. Absent ⇒ the acceptance step cannot prove — a
51
+ * signature nobody checked is not evidence of a signature. The EVM impl is `binding-evm-common`'s. */
52
+ acceptanceVerifier?: SignatureVerifier;
53
+ /**
54
+ * The ATA chain to check for attenuation + as-of revocation/expiry, ALREADY FLATTENED.
55
+ *
56
+ * Whoever produced this array is a trusted oracle — every field on a link is a derived fact the step
57
+ * takes at face value. Prefer `authorityWalk`, which removes that trust. This door stays open because
58
+ * a foreign conformance subject may legitimately derive its links some other way.
59
+ */
60
+ authorityChain?: AuthorityLink[];
61
+ /**
62
+ * The custody walk's readout (`authority.walkChain`) — the PREFERRED authority input.
63
+ *
64
+ * `authorityChain` cannot express what the walk found: a spliced link, an issuer discontinuity, a root
65
+ * issued by someone other than the declared principal, a leaf granted to anyone but the acceptance
66
+ * signer. Flattening a `refused` walk throws those away and hands over links that then read as a clean
67
+ * `not-attempted`, so the report says the record simply did not carry a chain when in fact it carried
68
+ * a contradictory one. Supplied here, the refusal reaches the report WITH its halt class, and the
69
+ * walk's own gap depths pass through verbatim.
70
+ *
71
+ * Mutually exclusive with `authorityChain` — supplying both is a contradiction, not a precedence
72
+ * question, so it throws rather than silently picking one (the same ruling `makeProposalRecord` makes
73
+ * on its own exactly-one-of invariant).
74
+ */
75
+ authorityWalk?: ChainWalkResult;
76
+ /** The accepted commitment vs the leaf grant's bounds (ATA-4). */
77
+ commitment?: {
78
+ commitment: Bounds;
79
+ leafBounds: Bounds;
80
+ };
81
+ /** Both parties' resolutions, each at a stated assurance (IDN-1/IDN-3) — the record's `identity` slot. */
82
+ identity?: RecordIdentity;
83
+ /** The retained evidence package's manifest roles (RCS-4 completeness; `RCS4_REQUIRED_ROLES` is the floor). */
84
+ evidenceRoles?: readonly string[];
85
+ /** The class the record is shaped for (default TC-2). The taxonomy is closed (TC-0..TC-4); a caller
86
+ * at a trust boundary validates untyped input before calling (Zod there, not here). */
87
+ claimedClass?: TransactionClass;
88
+ /** Verification depth (default "structural"). Mechanical depth lets `verified` be raised honestly. */
89
+ depth?: VerifyDepth;
90
+ /** The TC-4 commerce-plane slots. Absent ⇒ the composition steps are NOT appended to the walk
91
+ * (TC-0..TC-3 reports are byte-identical). Present ⇒ the four required composition steps + the
92
+ * impeachment-only `frc-non-gating` step are appended and flow through the existing machinery. */
93
+ composition?: CompositionInput;
94
+ /** The reference recovered from a commerce protocol's own document. Absent ⇒ the
95
+ * `reference-placement` step is NOT appended and every existing report stays byte-identical. Present ⇒
96
+ * the step is appended and flows through the same machinery as every other: it impeaches when it FAILS
97
+ * and never blocks by its absence. REPORTED, never REQUIRED — no class lists it. */
98
+ placement?: PlacementInput;
99
+ }
100
+ /** Run the walk at the caller-specified `depth` (default `"structural"`) and emit the vector-anchored, JCS-serializable report. */
101
+ export declare function verify(input: VerifyInput): Promise<VerificationReport>;
102
+ /** Discriminant helper — did any step fail (the honest impeachment signal)? */
103
+ export declare function anyStepFailed(report: VerificationReport): boolean;
104
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EACV,MAAM,EACN,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,KAAK,gBAAgB,EAMtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAEV,kBAAkB,EAElB,WAAW,EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAGL,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,aAAa,EAMlB,KAAK,cAAc,EACnB,KAAK,cAAc,EAKpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACvB,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,eAAe,EACf,KAAK,WAAW,EAChB,eAAe,EACf,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EACf,cAAc,EACd,KAAK,QAAQ,EACb,KAAK,gBAAgB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,aAAa,EAClB,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,KAAK,cAAc,EACnB,mBAAmB,EACnB,KAAK,cAAc,EACnB,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,cAAc,GACf,MAAM,Y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