@integraledger/lcp-binding-evm-mpp 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 +13 -0
- package/LICENSE +202 -0
- package/NOTICE +14 -0
- package/README.md +198 -0
- package/dist/adapter.d.ts +59 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +76 -0
- package/dist/adapter.js.map +1 -0
- package/dist/credential-type.d.ts +42 -0
- package/dist/credential-type.d.ts.map +1 -0
- package/dist/credential-type.js +17 -0
- package/dist/credential-type.js.map +1 -0
- package/dist/id-reuse.d.ts +130 -0
- package/dist/id-reuse.d.ts.map +1 -0
- package/dist/id-reuse.js +166 -0
- package/dist/id-reuse.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +66 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +83 -0
- package/dist/manifest.js.map +1 -0
- package/package.json +63 -0
- package/src/adapter.ts +192 -0
- package/src/credential-type.ts +49 -0
- package/src/id-reuse.ts +210 -0
- package/src/index.ts +18 -0
- package/src/manifest.ts +84 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @integraledger/lcp-binding-evm-mpp
|
|
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,198 @@
|
|
|
1
|
+
# @integraledger/lcp-binding-evm-mpp
|
|
2
|
+
|
|
3
|
+
Welds an LCP record to an [MPP](https://paymentauth.org) settlement on EVM, by **Id-Reuse** (LCP §8.3.5): the seller
|
|
4
|
+
sets `challenge.id = atrHash`, and MPP's own required derivation carries it into the transaction.
|
|
5
|
+
|
|
6
|
+
**This is the one binding in the family that differs at the weld.** On MPP's EVM charge method there is no
|
|
7
|
+
field for us to occupy — the EIP-3009 nonce is a derivation MUST and the Permit2 witness type string is
|
|
8
|
+
fixed. So nothing is placed; an input is supplied, and the host protocol does the binding.
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @integraledger/lcp-binding-evm-mpp
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
| | |
|
|
15
|
+
|---|---|
|
|
16
|
+
| **Rail** | `evm:mpp` |
|
|
17
|
+
| **Protocol** | `mpp` |
|
|
18
|
+
| **Pattern** | `id-reuse` (LCP §8.3.5, Tier A) |
|
|
19
|
+
| **Weld** | `nonce = keccak256(abi.encodePacked(challenge.id, challenge.realm))`, with `challenge.id = atrHash` |
|
|
20
|
+
| **Credential-type scope** | MPP's **`authorization`** type only (§5.3) — see below; the other three are out of scope by construction |
|
|
21
|
+
| **On-chain artifact** | `AuthorizationUsed(address indexed authorizer, bytes32 indexed nonce)` |
|
|
22
|
+
| **Recovery triple** | *within that scope* — on-chain **yes**; zero-party recoverable **no**; forward-indexable **no** |
|
|
23
|
+
| **Weld grade** | `weldGrades: { authorization: "signature" }` — the payer's EIP-3009 message covers the nonce |
|
|
24
|
+
| **Surface** | `createMppEvmAdapter` returning [`@integraledger/lcp-binding-core`](../binding-core#readme)'s `WeldAdapter` over a `ChainReader`, built on [`@integraledger/lcp-binding-evm-common`](../binding-evm-common#readme) |
|
|
25
|
+
| **Spec** | `draft-evm-charge-00` + the core `Payment` scheme, gate discharged **2026-07-30** |
|
|
26
|
+
|
|
27
|
+
## Use
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { createMppEvmAdapter } from "@integraledger/lcp-binding-evm-mpp";
|
|
31
|
+
import type { VerifierPorts } from "@integraledger/lcp-binding-core";
|
|
32
|
+
|
|
33
|
+
declare const USDC: `0x${string}`; // the settlement token address on this chain
|
|
34
|
+
declare const atrHash: `0x${string}`; // the record's atrHash
|
|
35
|
+
declare const txHash: `0x${string}`; // the settlement transaction
|
|
36
|
+
declare const ports: VerifierPorts; // caller-supplied chain access
|
|
37
|
+
|
|
38
|
+
const adapter = createMppEvmAdapter({ chainId: 84532, asset: USDC, realm: "api.example.com" });
|
|
39
|
+
|
|
40
|
+
// SELLER, at proposal: challenge.id IS the atrHash; the nonce follows by MPP's rule.
|
|
41
|
+
// `propose` returns an Outcome — a refusal is a RETURNED VALUE, never a thrown exception, which is this
|
|
42
|
+
// family's central contract. Narrow before reading; destructuring `.value` straight off the union is the
|
|
43
|
+
// one handling of this type that does not compile.
|
|
44
|
+
const proposed = await adapter.propose(atrHash);
|
|
45
|
+
if ("refused" in proposed) throw new Error(proposed.detail); // or route on proposed.code
|
|
46
|
+
const binding = proposed.value; // { challengeId, realm, nonce }
|
|
47
|
+
|
|
48
|
+
// AUDITOR, after settlement: bring the atrHash, the chain confirms it.
|
|
49
|
+
await adapter.verifyCandidate(atrHash, { chainId: 84532, txHash }, ports);
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Specification provenance — verified against the live host, 2026-07-30
|
|
53
|
+
|
|
54
|
+
Read against the host protocol's own live specifications, not LCP's Appendix C.
|
|
55
|
+
|
|
56
|
+
**EVM charge method — `draft-evm-charge-00` (paymentauth.org, read 2026-07-30).**
|
|
57
|
+
|
|
58
|
+
1. **§5.3.1 — the derivation.** `nonce = keccak256(abi.encodePacked(challenge.id, challenge.realm))`, with
|
|
59
|
+
"This specification requires the nonce to be set to the `challengeHash`" and "This provides cryptographic
|
|
60
|
+
challenge binding equivalent to the Permit2 witness mechanism." The nonce is a **derivation, not a slot**.
|
|
61
|
+
2. **§5.2.3 — Permit2 is closed too.** The witness type string is given literally
|
|
62
|
+
(`PaymentWitness witness)PaymentWitness(bytes32 challengeHash, string externalId)…`) with
|
|
63
|
+
"Implementations MUST use the exact type string above when constructing the EIP-712 typed data." There is
|
|
64
|
+
no room for an LCP field on the Permit2 path either.
|
|
65
|
+
3. **§4.2 / Table 2 — `methodDetails` is constrained**, not an open map: `chainId` and `permit2Address`
|
|
66
|
+
REQUIRED, `credentialTypes`, `decimals` and `splits` OPTIONAL, and the document states no allowance for
|
|
67
|
+
arbitrary keys. This is why the EVM method gets a *binding* and the open-map placement lives in
|
|
68
|
+
`placement-mpp` instead.
|
|
69
|
+
4. **§8 — replay protection is the token's.** "The nonce is consumed on-chain by the token contract itself";
|
|
70
|
+
a consumed nonce cannot be reused. Our binding adds no replay machinery and must not appear to.
|
|
71
|
+
|
|
72
|
+
**Core scheme — the `Payment` HTTP authentication scheme (read 2026-07-30).**
|
|
73
|
+
|
|
74
|
+
5. **§5.1.1 — `id` is required to be unique** ("Unique challenge identifier. Servers MUST bind this value to
|
|
75
|
+
the challenge parameters… Clients MUST include this value unchanged in the credential"), and `realm` is a
|
|
76
|
+
MUST ("Protection space identifier per [RFC9110]"). The uniqueness requirement is satisfied the way
|
|
77
|
+
LCP §8.3.5 prescribes: each ATR is unique per transaction, so each `challenge.id` is too.
|
|
78
|
+
6. **§5.1.1 — `id` has no declared format.** Its examples are opaque strings (`"aB3cDeF4gHiJkLmN"`), so an
|
|
79
|
+
`0x`-prefixed 32-byte atrHash is a conformant id. Nothing about Id-Reuse asks MPP to accommodate us.
|
|
80
|
+
7. **§5.1.2.1.1 Table 2 — the seven-slot canonicalization** is `realm, method, intent, request, expires,
|
|
81
|
+
digest, opaque`. `id` is *not* a slot; it is bound by the server per §5.1.1 and by the EVM method's
|
|
82
|
+
derivation, which is what makes the weld hold without touching the canonicalization.
|
|
83
|
+
|
|
84
|
+
**Two drifts found, recorded rather than smoothed over.**
|
|
85
|
+
|
|
86
|
+
- **The core draft's identifier.** LCP v1.37 §C.1 and the completion plan both cite
|
|
87
|
+
`draft-ryan-httpauth-payment-01` (the IETF individual submission). paymentauth.org's own document index
|
|
88
|
+
publishes the core scheme as **`draft-httpauth-payment-00.html`**. Both were read for this gate; they agree
|
|
89
|
+
on §5.1.1 and on the seven slots. Treat the paymentauth.org copy as the live one — it is the family's own
|
|
90
|
+
publication point — and the datatracker submission as its IETF mirror.
|
|
91
|
+
- **`challenge.id` uniqueness is a CORE requirement, not an EVM-method one.** `draft-evm-charge-00` states no
|
|
92
|
+
uniqueness rule of its own; §8's replay protection is the token contract's. An implementer reading only the
|
|
93
|
+
method spec would not find the constraint that makes Id-Reuse safe.
|
|
94
|
+
|
|
95
|
+
**Per-method scope.** MPP is a specification *family*, and this gate covers the **EVM** charge method only.
|
|
96
|
+
Tempo's TIP-20 memo is a different and much stronger realization and gets its own package and its own gate.
|
|
97
|
+
|
|
98
|
+
## Credential-type scope — read this before trusting `recovery.onChain`
|
|
99
|
+
|
|
100
|
+
MPP's EVM method defines **four** credential types (§5), and the derived `challengeHash` reaches the chain in
|
|
101
|
+
**exactly one** of them. Everything this profile declares is scoped to that one, and both the machine-readable
|
|
102
|
+
declaration and the runtime behaviour say so.
|
|
103
|
+
|
|
104
|
+
| Credential type | Where the `challengeHash` lives | Readable from a settlement? |
|
|
105
|
+
|---|---|---|
|
|
106
|
+
| **`authorization`** (§5.3) — opt-in, EIP-3009 tokens only | the **on-chain** EIP-3009 nonce (§5.3.1) | **yes** — this binding's whole surface |
|
|
107
|
+
| `permit2` (§5.2) — **RECOMMENDED** | the EIP-712 `PaymentWitness` the client signs (§5.2.3, §10.4) | no — signed, never in calldata or a log |
|
|
108
|
+
| `transaction` (§5.4) | nowhere — no challenge binding (§10.4) | no |
|
|
109
|
+
| `hash` (§5.5) | nowhere — no challenge binding (§10.4) | no |
|
|
110
|
+
|
|
111
|
+
Two consequences, both deliberate:
|
|
112
|
+
|
|
113
|
+
- **`weldGrades` is keyed by MPP's own credential-type name** — `{ authorization: "signature" }`, not a coinage
|
|
114
|
+
like `derived`. The key *is* the scope, machine-readably, and `finality.note` repeats it in prose for a
|
|
115
|
+
consumer who reads only the published profile JSON. Grading `permit2` would be declaring from the
|
|
116
|
+
specification rather than from this binding: the package constructs no witness. `transaction` and `hash` have
|
|
117
|
+
no weld to grade at all.
|
|
118
|
+
- **The adapter enforces the same scope at runtime.** A settlement that moved the configured token but emitted
|
|
119
|
+
no `AuthorizationUsed` really did settle — under one of the other three types — so `verifyCandidate` and
|
|
120
|
+
`observe` both refuse `mpp-evm/not-authorization-credential-type` rather than report an absence. Reporting
|
|
121
|
+
`{ ok: true, value: [] }` there would be a silent wrong answer at a verification boundary. Only when the
|
|
122
|
+
token did not move either is the honest answer "this transaction settled none of this asset"
|
|
123
|
+
(`mpp-evm/no-settlement-event` / an empty transition list, reached without reading a block).
|
|
124
|
+
|
|
125
|
+
**`recovery.onChain: true` is still declared from the specification, not yet from a live settlement.** Two of
|
|
126
|
+
the triple's three members are observable without a chain — `zeroPartyRecoverable: false` because no code path
|
|
127
|
+
maps a settlement to an atrHash (`recover` refuses and takes no arguments), `forwardIndexable: false` because no
|
|
128
|
+
`enumerate` exists — but the on-chain member needs a real `AuthorizationUsed`. `test/integration.onchain.test.ts`
|
|
129
|
+
reads exactly that and is **skipped until `MPP_EVM_SETTLEMENT_TX` names one**. Until it runs, treat that single
|
|
130
|
+
member as owed.
|
|
131
|
+
|
|
132
|
+
## The weld, and the only check it permits
|
|
133
|
+
|
|
134
|
+
`verifyCandidate` is the primary surface, and it is a **confirmation**, not a lookup. The on-chain value is
|
|
135
|
+
keccak-256 over the atrHash and the realm, so:
|
|
136
|
+
|
|
137
|
+
- **`recover` refuses, always**, with `mpp-evm/not-recoverable-by-construction`. It is present because a
|
|
138
|
+
generic `WeldAdapter` consumer will reach for it and must be told loudly; it is typed `Promise<Refusal>` so
|
|
139
|
+
the impossibility is visible before the call, and it takes **no arguments** because there is no input a
|
|
140
|
+
recovery could read.
|
|
141
|
+
- **There is no `enumerate`.** Absence is the declaration, matching `forwardIndexable: false`.
|
|
142
|
+
- **Re-deriving from a stored challenge would be a defect, not a feature.** That is the service's own records
|
|
143
|
+
re-labelled; it would falsify `zeroPartyRecoverable: false`, and it is the one edit this package must never
|
|
144
|
+
accept.
|
|
145
|
+
|
|
146
|
+
### Why `forwardIndexable: false` when the nonce is an indexed topic
|
|
147
|
+
|
|
148
|
+
§8.3's criterion is enumeration of every settlement bound to **a given `atrHash`**, and §8.3.5 answers it
|
|
149
|
+
directly: "Not forward-indexable by `atrHash` alone — the on-chain value is a hash over `atrHash` and other
|
|
150
|
+
inputs." An auditor who *also* knows the realm can derive the nonce and topic-filter it — but that is
|
|
151
|
+
realm-scoped, and it is degenerate anyway: §8.3.5's uniqueness satisfaction makes each ATR unique per
|
|
152
|
+
transaction, so there is at most one settlement per atrHash to find. Hence `indexing: "none"`.
|
|
153
|
+
|
|
154
|
+
## Do not reconcile this manifest with `binding-evm-x402`'s
|
|
155
|
+
|
|
156
|
+
They bind the *same* EIP-3009 nonce field and they legitimately disagree. x402 leaves the nonce unconstrained,
|
|
157
|
+
so the atrHash rides it directly — off-canonical Native Field, zero-party recoverable. MPP-EVM *derives* the
|
|
158
|
+
nonce, so the same field carries a hash of the atrHash — Id-Reuse, confirmation only. `binding-evm-x402`'s
|
|
159
|
+
manifest carries a KNOWN-BAD note about an archived declaration that read MPP's derivation-MUST onto the x402
|
|
160
|
+
path; **this package is where that reading is correct.** Making either manifest resemble the other
|
|
161
|
+
reintroduces the bug.
|
|
162
|
+
|
|
163
|
+
The same rule holds down to the error messages. `binding-evm-common`'s `assertBytes32` enforces the right 32
|
|
164
|
+
bytes but explains them as the value that will "ride as the EIP-3009 nonce" — true on x402, false here — so
|
|
165
|
+
`bindAtrHash` carries **its own guard**: on this rail the atrHash rides `challenge.id`, and the nonce is derived
|
|
166
|
+
from it, never occupied by it.
|
|
167
|
+
|
|
168
|
+
## Provenance
|
|
169
|
+
|
|
170
|
+
Cut against `draft-evm-charge-00` and the core `Payment` scheme at paymentauth.org, gate discharged
|
|
171
|
+
2026-07-30, and reconciled against LCP v1.37 §C.1 and §8.3.5 the same day. The derivation oracles in
|
|
172
|
+
`vectors/binding/mpp-evm-id-reuse.json` were produced by two independent keccak-256 implementations
|
|
173
|
+
(pycryptodome and Foundry `cast keccak`), and `abi.encodePacked`'s string semantics were confirmed against
|
|
174
|
+
Foundry's own encoder — neither of them the implementation under test.
|
|
175
|
+
|
|
176
|
+
## Requirement ids
|
|
177
|
+
|
|
178
|
+
This package's source and its messages cite short ids — `ATA-3`, `RCS-5`, `CMP-6` and their kin.
|
|
179
|
+
**They are not LCP clause numbers.** LCP is cited by section (`§8.3.1`, `§C.2`); anything shaped `XXX-n`
|
|
180
|
+
comes from Integra's functional specification of what a complete agent transaction requires, the fourteen
|
|
181
|
+
families below. Nothing in this package's behaviour depends on them, and where an id and an LCP section
|
|
182
|
+
disagree the section governs.
|
|
183
|
+
|
|
184
|
+
| | | | |
|
|
185
|
+
|---|---|---|---|
|
|
186
|
+
| `IDN` identity | `ASP` authority to spend | `ATA` authority to accept terms | `TRM` the terms record |
|
|
187
|
+
| `RCS` recourse | `PAY` payment and settlement | `WLD` the transactional weld | `OFR` offer integrity |
|
|
188
|
+
| `FRC` fraud, risk, and compliance | `OPS` commercial operations | `DSC` discovery and reputation | `ORC` orchestration |
|
|
189
|
+
| `CMP` composition | `PRS` persistence and verification infrastructure | | |
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
**Requires Node >= 24.** Part of the
|
|
194
|
+
[Legal Context Protocol open layer](https://github.com/IntegraLedger/integra-protocol) — see the
|
|
195
|
+
[documentation](https://github.com/IntegraLedger/integra-protocol/blob/main/docs/developer/index.md)
|
|
196
|
+
and the
|
|
197
|
+
[package index](https://github.com/IntegraLedger/integra-protocol/blob/main/docs/developer/reference.md).
|
|
198
|
+
Apache-2.0.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The MPP-EVM Id-Reuse WeldAdapter — the one member of the ten that differs at the weld.
|
|
3
|
+
*
|
|
4
|
+
* - `propose` — `challenge.id = atrHash`, and the EIP-3009 nonce MPP's derivation then requires.
|
|
5
|
+
* - `verifyCandidate` — THE PRIMARY VERIFY SURFACE: confirm a KNOWN atrHash against one settlement's
|
|
6
|
+
* on-chain nonce. You bring the hash; the chain confirms it.
|
|
7
|
+
* - `observe` — a settlement's `AuthorizationUsed` events → `settled` lifecycle transitions.
|
|
8
|
+
*
|
|
9
|
+
* **Both read paths are scoped to MPP's `authorization` credential type, and both say so when they are out of
|
|
10
|
+
* scope.** Only §5.3 puts the derived `challengeHash` on-chain; the RECOMMENDED `permit2` type signs the same
|
|
11
|
+
* value into an off-chain EIP-712 witness and `transaction`/`hash` bind no challenge at all. A settlement in
|
|
12
|
+
* any of those three moves the token and emits no `AuthorizationUsed`, so answering "no transitions" about it
|
|
13
|
+
* would be a wrong answer, not an absence — see `credential-type.ts` for the specification reading and the
|
|
14
|
+
* refusal both members return instead.
|
|
15
|
+
* - `recover` — REFUSES, always, `mpp-evm/not-recoverable-by-construction`. Present because a
|
|
16
|
+
* generic `WeldAdapter` consumer will reach for it and must be told, loudly, that this
|
|
17
|
+
* rail has no recovery; typed `Promise<Refusal>` so the impossibility is visible before
|
|
18
|
+
* the call. It takes no arguments: there is no input a recovery could read.
|
|
19
|
+
* - `enumerate` — ABSENT. The port makes it optional and the manifest declares
|
|
20
|
+
* `forwardIndexable: false`; absence is the declaration.
|
|
21
|
+
*
|
|
22
|
+
* **Why `verifyCandidate` and not a `recover` that re-derives.** A stored challenge would let this package
|
|
23
|
+
* look up an atrHash by settlement and call the answer recovery. That is the service's own records
|
|
24
|
+
* re-labelled, it would falsify `zeroPartyRecoverable: false`, and it is the single edit this package must
|
|
25
|
+
* never accept. Verification needs no such store: the auditor supplies the candidate.
|
|
26
|
+
*
|
|
27
|
+
* viem appears here only through the `Log[]` the injected `ChainReader` hands back and the shared
|
|
28
|
+
* `AuthorizationUsed` decoder in `binding-evm-common` — the same seam `binding-evm-x402` uses, so the event
|
|
29
|
+
* ABI is known in exactly one place.
|
|
30
|
+
*/
|
|
31
|
+
import type { BindingManifest, Outcome, Refusal, SettlementRef, VerifierPorts, WeldAdapter } from "@integraledger/lcp-binding-core";
|
|
32
|
+
import { type MppEvmCandidateConfirmation, type MppEvmChallengeBinding } from "./id-reuse.js";
|
|
33
|
+
/** One chain + token + protection space this adapter binds. */
|
|
34
|
+
export interface MppEvmAdapterConfig {
|
|
35
|
+
chainId: number;
|
|
36
|
+
/** The payment token — the `AuthorizationUsed` emitter whose nonce carries the derivation. */
|
|
37
|
+
asset: `0x${string}`;
|
|
38
|
+
/**
|
|
39
|
+
* `challenge.realm`, MPP's protection space. Not optional and not inferable: it is half the nonce
|
|
40
|
+
* preimage, so an adapter without it cannot derive or confirm anything.
|
|
41
|
+
*/
|
|
42
|
+
realm: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The MPP-EVM surface. It IS a `WeldAdapter` on the EVM-shaped port — the rail is EVM and the types fit —
|
|
46
|
+
* with two members narrowed to say what this rail can and cannot do, and `enumerate` left off.
|
|
47
|
+
*/
|
|
48
|
+
export interface MppEvmAdapter extends WeldAdapter {
|
|
49
|
+
readonly manifest: BindingManifest;
|
|
50
|
+
/** `ctx` is accepted for port compatibility and unused: the realm lives in the adapter config. */
|
|
51
|
+
propose(atrHash: `0x${string}`, ctx?: unknown): Promise<Outcome<MppEvmChallengeBinding>>;
|
|
52
|
+
/** Confirm a candidate atrHash against ONE settlement's on-chain nonce. */
|
|
53
|
+
verifyCandidate(atrHash: string, ref: SettlementRef, ports: VerifierPorts): Promise<Outcome<MppEvmCandidateConfirmation>>;
|
|
54
|
+
/** Always a refusal — see the module docblock. */
|
|
55
|
+
recover(): Promise<Refusal>;
|
|
56
|
+
}
|
|
57
|
+
/** Construct the MPP-EVM adapter for one chain, token and realm. */
|
|
58
|
+
export declare function createMppEvmAdapter(config: MppEvmAdapterConfig): MppEvmAdapter;
|
|
59
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,KAAK,EACV,eAAe,EAEf,OAAO,EACP,OAAO,EACP,aAAa,EACb,aAAa,EACb,WAAW,EACZ,MAAM,iCAAiC,CAAC;AAQzC,OAAO,EAGL,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAE5B,MAAM,eAAe,CAAC;AAGvB,+DAA+D;AAC/D,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,8FAA8F;IAC9F,KAAK,EAAE,KAAK,MAAM,EAAE,CAAC;IACrB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,kGAAkG;IAClG,OAAO,CACL,OAAO,EAAE,KAAK,MAAM,EAAE,EACtB,GAAG,CAAC,EAAE,OAAO,GACZ,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAC5C,2EAA2E;IAC3E,eAAe,CACb,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,aAAa,EAClB,KAAK,EAAE,aAAa,GACnB,OAAO,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC,CAAC;IACjD,kDAAkD;IAClD,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7B;AAED,oEAAoE;AACpE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,mBAAmB,GAC1B,aAAa,CAoGf"}
|
package/dist/adapter.js
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { assetWasTransferred, readAuthorizationUsed, refOf, } from "@integraledger/lcp-binding-evm-common";
|
|
2
|
+
import { notAuthorizationCredentialType } from "./credential-type.js";
|
|
3
|
+
import { bindAtrHash, checkCandidate, notRecoverableByConstruction, } from "./id-reuse.js";
|
|
4
|
+
import { MPP_EVM_MANIFEST } from "./manifest.js";
|
|
5
|
+
/** Construct the MPP-EVM adapter for one chain, token and realm. */
|
|
6
|
+
export function createMppEvmAdapter(config) {
|
|
7
|
+
if (config.realm === "")
|
|
8
|
+
throw new Error("MppEvmAdapterConfig.realm must be non-empty — challenge.realm is half the EIP-3009 nonce preimage (draft-evm-charge-00 §5.3.1)");
|
|
9
|
+
/**
|
|
10
|
+
* One settlement's logs, and the `AuthorizationUsed` events the configured token emitted among them.
|
|
11
|
+
*
|
|
12
|
+
* The raw logs travel alongside the decoded events because an EMPTY event set is ambiguous on this rail:
|
|
13
|
+
* only the logs distinguish "this transaction moved none of the asset" from "it settled under a credential
|
|
14
|
+
* type whose challengeHash is not on-chain". Both read members need that distinction, so both read it here.
|
|
15
|
+
*/
|
|
16
|
+
async function settlement(ref, ports) {
|
|
17
|
+
const logs = (await ports.chain.getTransactionLogs(ref));
|
|
18
|
+
return { logs, events: readAuthorizationUsed(logs, config.asset) };
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
manifest: MPP_EVM_MANIFEST,
|
|
22
|
+
async propose(atrHash) {
|
|
23
|
+
// bindAtrHash throws (fail-fast) on a malformed atrHash — a seller-side wiring defect, not a policy
|
|
24
|
+
// outcome. There is no value-level refusal on this path: MPP constrains nothing we are choosing here.
|
|
25
|
+
return { ok: true, value: bindAtrHash(atrHash, config.realm) };
|
|
26
|
+
},
|
|
27
|
+
async verifyCandidate(atrHash, ref, ports) {
|
|
28
|
+
const { logs, events } = await settlement(ref, ports);
|
|
29
|
+
// Out of scope BEFORE out of luck: a settlement that moved the token under any of MPP's other three
|
|
30
|
+
// credential types is answered by naming that type, never by the pinned-index or absence refusals below.
|
|
31
|
+
if (events.length === 0 && assetWasTransferred(logs, config.asset))
|
|
32
|
+
return notAuthorizationCredentialType(config.asset);
|
|
33
|
+
// An empty set reaches checkCandidate, which owns the `no-settlement-event` refusal — one place, so a
|
|
34
|
+
// caller holding nonces from its own indexer gets the identical answer.
|
|
35
|
+
if (ref.logIndex === undefined || events.length === 0)
|
|
36
|
+
return checkCandidate(atrHash, config.realm, events.map((e) => e.nonce));
|
|
37
|
+
// A pinned logIndex that matches NO event is a failure, never a silent fall back to another event in
|
|
38
|
+
// the same transaction — that could confirm a candidate against a different settlement leg.
|
|
39
|
+
const pinned = events.filter((e) => e.logIndex === ref.logIndex);
|
|
40
|
+
if (pinned.length === 0)
|
|
41
|
+
return {
|
|
42
|
+
refused: true,
|
|
43
|
+
haltClass: "verification-failure",
|
|
44
|
+
code: "mpp-evm/log-index-not-found",
|
|
45
|
+
detail: `no AuthorizationUsed at logIndex ${ref.logIndex} for asset ${config.asset}`,
|
|
46
|
+
};
|
|
47
|
+
return checkCandidate(atrHash, config.realm, pinned.map((e) => e.nonce));
|
|
48
|
+
},
|
|
49
|
+
async observe(ref, ports) {
|
|
50
|
+
const { logs, events } = await settlement(ref, ports);
|
|
51
|
+
// Settlement is the only on-chain state MPP-EVM exposes; `proposed` is off-chain and pre-settlement.
|
|
52
|
+
if (events.length === 0) {
|
|
53
|
+
// The token moved and no authorization accompanied it: the transaction DID settle, under a credential
|
|
54
|
+
// type this binding cannot read. An empty transition list would assert the opposite.
|
|
55
|
+
if (assetWasTransferred(logs, config.asset))
|
|
56
|
+
return notAuthorizationCredentialType(config.asset);
|
|
57
|
+
// The token did not move either, so there is no settlement of this asset to report — an answer, not
|
|
58
|
+
// a refusal, and one reached without reading a block.
|
|
59
|
+
return { ok: true, value: [] };
|
|
60
|
+
}
|
|
61
|
+
const at = await ports.chain.blockTime(ref);
|
|
62
|
+
return {
|
|
63
|
+
ok: true,
|
|
64
|
+
value: events.map((e) => ({
|
|
65
|
+
state: "settled",
|
|
66
|
+
at,
|
|
67
|
+
ref: refOf(ref.chainId, ref.txHash, e.logIndex),
|
|
68
|
+
})),
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
async recover() {
|
|
72
|
+
return notRecoverableByConstruction();
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MPP's EVM method offers FOUR credential types, and this binding can read exactly one of them off a chain.
|
|
3
|
+
* That asymmetry is what this module exists to say out loud, because the alternative is a wrong answer.
|
|
4
|
+
*
|
|
5
|
+
* `draft-evm-charge-00` (paymentauth.org, read 2026-07-30), §5:
|
|
6
|
+
*
|
|
7
|
+
* - **§5.3 `authorization`** — the client signs an EIP-3009 `transferWithAuthorization` message whose `nonce`
|
|
8
|
+
* §5.3.1 REQUIRES to be the `challengeHash`. The derived value is therefore *on-chain*: the token emits
|
|
9
|
+
* `AuthorizationUsed(authorizer, indexed nonce)` and §8 consumes it ("The nonce is consumed on-chain by the
|
|
10
|
+
* token contract itself"). **This is the only credential type this binding can confirm against.**
|
|
11
|
+
* - **§5.2 `permit2`** — the RECOMMENDED type (§5.2: "The RECOMMENDED credential type"). It carries the SAME
|
|
12
|
+
* `challengeHash`, but inside the EIP-712 `PaymentWitness` struct the client signs; §10.4 places it "in the
|
|
13
|
+
* EIP-712 witness data (Permit2)". It never reaches calldata or a log, so a verifier holding only the
|
|
14
|
+
* transaction cannot read it. Settlement goes through Permit2's `permitWitnessTransferFrom`, which moves the
|
|
15
|
+
* token — an ERC-20 `Transfer` and no `AuthorizationUsed`.
|
|
16
|
+
* - **§5.4 `transaction`** and **§5.5 `hash`** — plain ERC-20 transfers with no challenge binding at all;
|
|
17
|
+
* §10.4 says they "provide weaker challenge binding than Permit2 credentials" and that the server "cannot
|
|
18
|
+
* prove the payment was created for a specific challenge instance". Again a `Transfer`, no `AuthorizationUsed`.
|
|
19
|
+
*
|
|
20
|
+
* **So the absence of `AuthorizationUsed` has two possible meanings, and they are not the same answer.** If
|
|
21
|
+
* the configured token did not move either, the transaction settled none of this asset — a true and useful
|
|
22
|
+
* report. If the token DID move, the transaction settled and this binding simply cannot read its credential
|
|
23
|
+
* binding; reporting that as an absence would be a silent wrong answer at a verification boundary. Hence the
|
|
24
|
+
* refusal below, which names the credential type rather than the missing event.
|
|
25
|
+
*
|
|
26
|
+
* The `did the asset move` predicate itself is NOT here — it is `assetWasTransferred` in
|
|
27
|
+
* `binding-evm-common`, because binding-evm-x402 asks the identical question about its own unreadable path
|
|
28
|
+
* (the Permit2 fallback) and two copies of one predicate is how the two rails drift apart. What stays here
|
|
29
|
+
* is the part that is genuinely MPP's: which of MPP's four credential types the caller is looking at, and
|
|
30
|
+
* the refusal that says so.
|
|
31
|
+
*/
|
|
32
|
+
import type { Refusal } from "@integraledger/lcp-binding-core";
|
|
33
|
+
/**
|
|
34
|
+
* The refusal for a settlement this binding cannot read: the token moved, and no EIP-3009 authorization
|
|
35
|
+
* accompanied it.
|
|
36
|
+
*
|
|
37
|
+
* Stated as a refusal rather than a throw because it is a fact about data under audit, not a wiring defect —
|
|
38
|
+
* a seller choosing MPP's RECOMMENDED credential type has done nothing wrong, and the verifier needs to be
|
|
39
|
+
* told which of MPP's four modes it is looking at, not handed an exception.
|
|
40
|
+
*/
|
|
41
|
+
export declare function notAuthorizationCredentialType(asset: string): Refusal;
|
|
42
|
+
//# sourceMappingURL=credential-type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"credential-type.d.ts","sourceRoot":"","sources":["../src/credential-type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAE/D;;;;;;;GAOG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAOrE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The refusal for a settlement this binding cannot read: the token moved, and no EIP-3009 authorization
|
|
3
|
+
* accompanied it.
|
|
4
|
+
*
|
|
5
|
+
* Stated as a refusal rather than a throw because it is a fact about data under audit, not a wiring defect —
|
|
6
|
+
* a seller choosing MPP's RECOMMENDED credential type has done nothing wrong, and the verifier needs to be
|
|
7
|
+
* told which of MPP's four modes it is looking at, not handed an exception.
|
|
8
|
+
*/
|
|
9
|
+
export function notAuthorizationCredentialType(asset) {
|
|
10
|
+
return {
|
|
11
|
+
refused: true,
|
|
12
|
+
haltClass: "verification-failure",
|
|
13
|
+
code: "mpp-evm/not-authorization-credential-type",
|
|
14
|
+
detail: `token ${asset} was transferred by this settlement but it emitted no EIP-3009 AuthorizationUsed — MPP's permit2 (§5.2, the RECOMMENDED type), transaction (§5.4) and hash (§5.5) credential types keep the challengeHash off-chain or bind no challenge at all, and only the opt-in authorization type (§5.3) puts it in the on-chain nonce, so this settlement carries no on-chain value a candidate atrHash could be confirmed against`,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=credential-type.js.map
|