@ftptech/canton-agent-wallet 0.7.4 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/canton-hash.d.ts +8 -57
- package/dist/canton-hash.d.ts.map +1 -1
- package/dist/canton-hash.js +8 -104
- package/dist/canton-hash.js.map +1 -1
- package/dist/cli-args.d.ts +64 -2
- package/dist/cli-args.d.ts.map +1 -1
- package/dist/cli-args.js +87 -2
- package/dist/cli-args.js.map +1 -1
- package/dist/cli.js +41 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/quest-fund.d.ts +64 -1
- package/dist/quest-fund.d.ts.map +1 -1
- package/dist/quest-fund.js +164 -17
- package/dist/quest-fund.js.map +1 -1
- package/dist/relay-client.d.ts +4 -0
- package/dist/relay-client.d.ts.map +1 -1
- package/dist/relay-client.js.map +1 -1
- package/dist/relay-signer.d.ts +28 -8
- package/dist/relay-signer.d.ts.map +1 -1
- package/dist/relay-signer.js +23 -2
- package/dist/relay-signer.js.map +1 -1
- package/dist/tx.d.ts +22 -1
- package/dist/tx.d.ts.map +1 -1
- package/dist/tx.js +49 -2
- package/dist/tx.js.map +1 -1
- package/dist/verify-prepared.d.ts +13 -254
- package/dist/verify-prepared.d.ts.map +1 -1
- package/dist/verify-prepared.js +48 -1992
- package/dist/verify-prepared.js.map +1 -1
- package/package.json +4 -3
package/dist/tx.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { signHashB64 } from "./keys.js";
|
|
9
9
|
import { resolveHashBinding } from "./hash-binding.js";
|
|
10
|
-
import { assertHashBinding, assertPreparedTransferMatches, assertPreparedSelfPreapproval, assertPreparedAcceptMatches, } from "./verify-prepared.js";
|
|
10
|
+
import { assertHashBinding, assertPreparedTransferMatches, assertPreparedSelfPreapproval, PreparedTransferMismatchError, assertPreparedAcceptMatches, } from "./verify-prepared.js";
|
|
11
11
|
const TI_IFACE = "#splice-api-token-transfer-instruction-v1:Splice.Api.Token.TransferInstructionV1:TransferInstruction";
|
|
12
12
|
/**
|
|
13
13
|
* The instrument id the agent's self-custody wallet pays in: Canton Coin is the
|
|
@@ -194,6 +194,7 @@ export async function payViaTransferFactory(relay, wallet, opts) {
|
|
|
194
194
|
? { executeBeforeSeconds: opts.executeBeforeSeconds }
|
|
195
195
|
: {}),
|
|
196
196
|
...(opts.memo !== undefined ? { memo: opts.memo } : {}),
|
|
197
|
+
...(opts.inline === true ? { inline: true } : {}),
|
|
197
198
|
});
|
|
198
199
|
const preparedTransaction = prep.preparedTransaction;
|
|
199
200
|
// VERIFY-BEFORE-SIGN: never sign a relay-prepared transfer we didn't intend.
|
|
@@ -210,6 +211,24 @@ export async function payViaTransferFactory(relay, wallet, opts) {
|
|
|
210
211
|
// Hash binding: the hash we sign MUST be the hash of the validated bytes.
|
|
211
212
|
await assertHashBinding(preparedTransaction, prep.txHash, opts.hashBinding ?? {});
|
|
212
213
|
const signature = signHashB64(prep.txHash, wallet.privateKeyPkcs8Pem);
|
|
214
|
+
// INLINE: hand the caller the signed bytes. Nothing is sent back to the relay
|
|
215
|
+
// — it stored nothing, and the payment payload carries the transaction. Both
|
|
216
|
+
// legs of verify-before-sign already ran above, so what is returned here is
|
|
217
|
+
// bytes this wallet validated and a signature over the hash OF those bytes.
|
|
218
|
+
if (opts.inline === true) {
|
|
219
|
+
return {
|
|
220
|
+
payerParty: wallet.party,
|
|
221
|
+
submissionRef: "",
|
|
222
|
+
txHash: prep.txHash,
|
|
223
|
+
preparedTransactionBytes: Buffer.from(preparedTransaction, "base64"),
|
|
224
|
+
// Canton hands us the hash BASE64; the scheme's wire form is hex. The
|
|
225
|
+
// conversion is explicit here rather than guessed by the encoder, because
|
|
226
|
+
// a value that is valid in both alphabets must never be auto-detected.
|
|
227
|
+
preparedTxHashHex: Buffer.from(prep.txHash, "base64").toString("hex"),
|
|
228
|
+
signatureB64: signature,
|
|
229
|
+
hashingSchemeVersion: "HASHING_SCHEME_VERSION_V2",
|
|
230
|
+
};
|
|
231
|
+
}
|
|
213
232
|
await relay.payCommit({
|
|
214
233
|
party: wallet.party,
|
|
215
234
|
submissionRef: prep.submissionRef,
|
|
@@ -398,7 +417,35 @@ export async function selfProvisionPreapproval(relay, wallet, opts, sleep = (ms)
|
|
|
398
417
|
const attempt = async () => {
|
|
399
418
|
const prep = await relay.preapprovalSelfPrepare(wallet.party, opts?.expiresAt);
|
|
400
419
|
// Never sign a relay tx that does anything other than create OUR preapproval.
|
|
401
|
-
|
|
420
|
+
// `prep.expiresAt` is the relay's OWN statement of the horizon it built.
|
|
421
|
+
// Passing it back binds the bytes to that statement: a relay that says 90
|
|
422
|
+
// days and encodes ten years is caught, and a caller who asked for a
|
|
423
|
+
// specific date gets it checked below.
|
|
424
|
+
assertPreparedSelfPreapproval(prep.preparedTransaction, wallet.party, prep.expiresAt);
|
|
425
|
+
if (opts?.expiresAt !== undefined && prep.expiresAt !== opts.expiresAt) {
|
|
426
|
+
throw new PreparedTransferMismatchError(`self-preapproval: asked for expiresAt ${JSON.stringify(opts.expiresAt)} but the relay ` +
|
|
427
|
+
`built ${JSON.stringify(prep.expiresAt)} — refusing to sign`);
|
|
428
|
+
}
|
|
429
|
+
// ...and never sign a hash that is not the hash OF THOSE BYTES.
|
|
430
|
+
//
|
|
431
|
+
// Validating the bytes and then signing the relay's `txHash` is two
|
|
432
|
+
// unconnected acts: a lying relay sends honest bytes — which pass the
|
|
433
|
+
// assertion above — together with the hash of a completely different
|
|
434
|
+
// transaction, and the wallet signs that other transaction. Every other
|
|
435
|
+
// signing path in this file binds the two (lines 120 and 336); this was
|
|
436
|
+
// the one that did not, which made the structural check above decorative
|
|
437
|
+
// on exactly the path where the wallet signs with its own key and no
|
|
438
|
+
// facilitator delegation stands in the way.
|
|
439
|
+
// `?? resolveHashBinding()`, NOT `?? {}`. The `{}` form is correct only for
|
|
440
|
+
// the INNER helpers (prepareSignExecute, the transfer-factory pay path),
|
|
441
|
+
// whose public entry points — claimAll, makeRelaySigner, withdraw — have
|
|
442
|
+
// already resolved a real recompute before calling down. This function IS a
|
|
443
|
+
// public entry point: every caller (the `preapproval` CLI command and all
|
|
444
|
+
// the e2e drivers) passes no hashBinding, so `{}` here means "no recompute
|
|
445
|
+
// available" and the binding assert fails closed on the honest path —
|
|
446
|
+
// turning a silent blind-sign into a hard-broken command. resolveHashBinding
|
|
447
|
+
// supplies the participant-conformant V2 recompute by default.
|
|
448
|
+
await assertHashBinding(prep.preparedTransaction, prep.txHash, opts?.hashBinding ?? resolveHashBinding());
|
|
402
449
|
const signature = signHashB64(prep.txHash, wallet.privateKeyPkcs8Pem);
|
|
403
450
|
return relay.preapprovalSelfCommit({
|
|
404
451
|
party: wallet.party,
|
package/dist/tx.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tx.js","sourceRoot":"","sources":["../src/tx.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAGvD,OAAO,EACL,iBAAiB,EACjB,6BAA6B,EAC7B,6BAA6B,EAC7B,2BAA2B,GAI5B,MAAM,sBAAsB,CAAC;AAE9B,MAAM,QAAQ,GACZ,sGAAsG,CAAC;AAEzG;;;;;;;;;GASG;AACH,MAAM,sBAAsB,GAAG,QAAQ,CAAC;AAExC,SAAS,GAAG,CAAC,MAAc;IACzB,OAAO,GAAG,MAAM,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;AAC7E,CAAC;AAgBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,KAAK,UAAU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;wBACE,KAAK,EAAE,MAAM,CAAC,KAAK;wBACnB,UAAU,EAAE;4BACV;gCACE,MAAM,EAAE,yBAAyB;gCACjC,SAAS;gCACT,oBAAoB,EAAE,gCAAgC;gCACtD,QAAQ,EAAE,MAAM,CAAC,oBAAoB;6BACtC;yBACF;qBACF;iBACF;aACF;SACF,CAAC,CAAC;IACL,CAAC,CAAC;IACF,8EAA8E;IAC9E,2EAA2E;IAC3E,uEAAuE;IACvE,yEAAyE;IACzE,wDAAwD;IACxD,KAAK,IAAI,CAAC,GAAG,CAAC,GAAI,CAAC,EAAE,EAAE,CAAC;QACtB,IAAI,CAAC;YACH,OAAO,MAAM,OAAO,EAAE,CAAC;QACzB,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IACE,CAAC,GAAG,iCAAiC,CAAC,MAAM;gBAC5C,wBAAwB,CAAC,GAAG,CAAC,EAC7B,CAAC;gBACD,MAAM,KAAK,CAAC,iCAAiC,CAAC,CAAC,CAAE,CAAC,CAAC;gBACnD,SAAS;YACX,CAAC;YACD,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,250 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
chosenValue: Uint8Array;
|
|
4
|
-
/** The exercised contract id (Exercise.contract_id, field 2), UTF-8 decoded.
|
|
5
|
-
* Pinned by the arms ONLY when the caller supplies an expected value
|
|
6
|
-
* (defense-in-depth: closes the resolve→prepare TOCTOU where a relay points
|
|
7
|
-
* the choice at a contract other than the one it resolved to the agent).
|
|
8
|
-
* undefined if the node carried no decodable contract_id. */
|
|
9
|
-
contractId?: string | undefined;
|
|
10
|
-
/** The exercised contract's template, as a `module:entity` qualified name (the
|
|
11
|
-
* package id is dropped because it changes across package upgrades). Used to
|
|
12
|
-
* pin WHICH template the validated choice runs against, so a relay cannot
|
|
13
|
-
* point a same-named choice at a confusable/attacker template. undefined if
|
|
14
|
-
* the node carried no decodable template_id. */
|
|
15
|
-
templateQualifiedName?: string | undefined;
|
|
16
|
-
}
|
|
17
|
-
/** The recognized `transaction.v1.Node` node-type oneof members. Anything not
|
|
18
|
-
* in this set is treated as PRESENT-AND-UNVALIDATED (reject), never skipped. */
|
|
19
|
-
type NodeKind = "create" | "fetch" | "exercise" | "rollback" | "query_by_key";
|
|
20
|
-
/**
|
|
21
|
-
* One fully-accounted node of the prepared transaction. EVERY entry in
|
|
22
|
-
* DamlTransaction.nodes produces exactly one of these — a node we cannot fully
|
|
23
|
-
* recognize is recorded with `recognized=false` rather than silently dropped, so
|
|
24
|
-
* the invariant layer can fail closed on it (this is the fix for the bypass
|
|
25
|
-
* where a sibling node carried under a non-1000 node version, or as a
|
|
26
|
-
* non-exercise node type, was invisible to verify).
|
|
27
|
-
*/
|
|
28
|
-
interface DecodedNode {
|
|
29
|
-
/** DamlTransaction.Node.node_id (the id `roots`/`children` reference). */
|
|
30
|
-
nodeId: string;
|
|
31
|
-
/** False ⇒ the node version was not the known `v1` (1000) oneof member, or it
|
|
32
|
-
* set an unknown/extra versioned_node member. Such a node is opaque: a
|
|
33
|
-
* participant understanding that version could execute it under our signature,
|
|
34
|
-
* so we must refuse to sign. */
|
|
35
|
-
recognizedVersion: boolean;
|
|
36
|
-
/** The v1 node-type oneof member, or undefined if !recognizedVersion or the
|
|
37
|
-
* inner node set no/unknown node_type member. undefined ⇒ reject. */
|
|
38
|
-
kind?: NodeKind | undefined;
|
|
39
|
-
/** For exercise nodes: the choice id + chosen value (money-critical args). */
|
|
40
|
-
exercise?: DecodedExercise | undefined;
|
|
41
|
-
/** For create nodes: the created template's `module:entity` qualified name
|
|
42
|
-
* (package-id dropped — it changes across upgrades) + the raw `Create.argument`
|
|
43
|
-
* Value bytes. Lets an arm pin a NUMERIC (non-party) field of a CONSEQUENCE
|
|
44
|
-
* create — e.g. the `amount` recorded on a created `X402Escrow` — which the
|
|
45
|
-
* party-leaf backstop cannot see. undefined for non-create nodes / a create
|
|
46
|
-
* carrying no decodable template / argument. */
|
|
47
|
-
create?: {
|
|
48
|
-
templateQualifiedName?: string | undefined;
|
|
49
|
-
argument?: Uint8Array | undefined;
|
|
50
|
-
} | undefined;
|
|
51
|
-
/** node_id references this node declares as its children (Exercise.children /
|
|
52
|
-
* Rollback.children). Used to prove reachability from the single root so no
|
|
53
|
-
* orphan (extra-leg) node can hide in DamlTransaction.nodes. */
|
|
54
|
-
children: string[];
|
|
55
|
-
/** Every `Value`-typed payload this node introduces (exercise chosen_value &
|
|
56
|
-
* exercise_result, create argument). The foreign-party backstop scans the
|
|
57
|
-
* UNION of these across ALL nodes, not just the matched root exercise — so a
|
|
58
|
-
* party/recipient introduced by ANY sibling/consequence node surfaces. */
|
|
59
|
-
values: Uint8Array[];
|
|
60
|
-
/** Node-level `repeated string party` fields that are NOT carried inside a
|
|
61
|
-
* Daml `Value` tree: Create.signatories/stakeholders,
|
|
62
|
-
* Exercise.signatories/stakeholders/acting_parties/choice_observers,
|
|
63
|
-
* Fetch.signatories/stakeholders/acting_parties, and a QueryByKey's key
|
|
64
|
-
* maintainers. The foreign-party backstop scans these too, so an attacker
|
|
65
|
-
* party placed as e.g. a consequence contract's stakeholder/observer (a
|
|
66
|
-
* position invisible to the Value-leaf walk) still surfaces. */
|
|
67
|
-
partyMeta: string[];
|
|
68
|
-
}
|
|
69
|
-
interface DecodedPrepared {
|
|
70
|
-
/** `act_as` parties from Metadata.submitter_info (authoritative submitter). */
|
|
71
|
-
actAs: string[];
|
|
72
|
-
/** DamlTransaction.roots — node_ids declared as transaction roots. */
|
|
73
|
-
roots: string[];
|
|
74
|
-
/** EVERY node in DamlTransaction.nodes, fully accounted (recognized or not). */
|
|
75
|
-
nodes: DecodedNode[];
|
|
76
|
-
/** Convenience view: every recognized Exercise node's choice id + chosen value
|
|
77
|
-
* (backwards-compatible with callers that only inspected exercises). */
|
|
78
|
-
exercises: DecodedExercise[];
|
|
79
|
-
/** Metadata.synchronizer_id (proto field 3, in the SIGNED block). undefined if
|
|
80
|
-
* absent. Pinned to caller intent by the arms when supplied. */
|
|
81
|
-
synchronizerId?: string | undefined;
|
|
82
|
-
/** SIGNED Metadata timing fields, microseconds since the Unix epoch, as
|
|
83
|
-
* BigInts (undefined if absent). All in the proto's "needs to be signed"
|
|
84
|
-
* block, so the agent's signature covers them; the arms sanity-bound them. */
|
|
85
|
-
preparationTime?: bigint | undefined;
|
|
86
|
-
minLedgerEffectiveTime?: bigint | undefined;
|
|
87
|
-
maxLedgerEffectiveTime?: bigint | undefined;
|
|
88
|
-
maxRecordTime?: bigint | undefined;
|
|
89
|
-
/** Every Create `argument` Value carried in Metadata.input_contracts (proto
|
|
90
|
-
* field 7, SIGNED): the authenticated input-contract set. Scanned by the
|
|
91
|
-
* foreign-party backstop so a party that appears ONLY inside an input
|
|
92
|
-
* contract's payload (never in a transaction node) still surfaces. */
|
|
93
|
-
inputContractValues: Uint8Array[];
|
|
94
|
-
/** The node-level `repeated string party` fields of each Metadata.input_contracts
|
|
95
|
-
* Create — signatories (field 6) + stakeholders (field 7) + any contract-key
|
|
96
|
-
* parties (field 8). The V2 metadata hasher binds disclosed/input contracts via
|
|
97
|
-
* `hashNode(toCreateNode)` → addCreateNode, which hashes argument + signatories
|
|
98
|
-
* + stakeholders, so these party fields ARE covered by the agent's signature;
|
|
99
|
-
* the backstop scans them so a foreign party placed ONLY as an input-contract
|
|
100
|
-
* signatory/stakeholder (not in its argument) still surfaces. */
|
|
101
|
-
inputContractPartyMeta: string[];
|
|
102
|
-
/** The SAME authenticated input contracts, GROUPED and carrying identity +
|
|
103
|
-
* template. The flattened lists above are unchanged and remain the generic
|
|
104
|
-
* backstop's input; this grouped view exists so a party occurrence can be
|
|
105
|
-
* related to the contract that explains it (provenance) instead of being
|
|
106
|
-
* accepted by value. */
|
|
107
|
-
inputContracts: DecodedInputContract[];
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Decode a base64 `PreparedTransaction` into the bits we validate.
|
|
111
|
-
*
|
|
112
|
-
* Enumerates EVERY node in DamlTransaction.nodes — every node-version member and
|
|
113
|
-
* every node-type oneof member — recording unrecognized ones as
|
|
114
|
-
* present-but-unvalidated (never silently skipping them). The single allowed
|
|
115
|
-
* root exercise, no-orphan reachability, and the all-nodes value backstop are
|
|
116
|
-
* enforced by the per-arm invariant (`assertSingleAllowedRootExercise`).
|
|
117
|
-
*/
|
|
118
|
-
export declare function decodePrepared(preparedTransactionB64: string): DecodedPrepared;
|
|
119
|
-
/**
|
|
120
|
-
* Party leaves split by WHERE they appear, for the position-aware foreign-party
|
|
121
|
-
* backstop (the fix for the unpinned-admin/dso neutralization bypass):
|
|
122
|
-
* - `rootArg` : party leaves inside the validated root exercise's
|
|
123
|
-
* chosen_value (where the admin/dso legitimately sits, at a
|
|
124
|
-
* known field position).
|
|
125
|
-
* - `elsewhere` : EVERY other party occurrence anywhere else in the signed
|
|
126
|
-
* message — sibling/consequence node Value payloads, the
|
|
127
|
-
* node-level `repeated string party` metadata
|
|
128
|
-
* (signatories/stakeholders/acting_parties/choice_observers/
|
|
129
|
-
* key-maintainers) of ANY node, and the Create arguments of
|
|
130
|
-
* Metadata.input_contracts. The admin/dso is NOT auto-allowed
|
|
131
|
-
* here just because it equals the relay-supplied value at its
|
|
132
|
-
* root position (that value-global exemption is exactly the
|
|
133
|
-
* neutralization hole); it is allowed here ONLY if pinned to
|
|
134
|
-
* an independently-trusted value. Without a trusted pin a
|
|
135
|
-
* relay-controlled admin/dso appearing here is FOREIGN (fail
|
|
136
|
-
* closed) — a value-moving caller must plumb a trusted pin.
|
|
137
|
-
*/
|
|
138
|
-
/** One authenticated `Metadata.input_contracts` entry, grouped (see
|
|
139
|
-
* {@link DecodedPrepared.inputContracts}). */
|
|
140
|
-
export interface DecodedInputContract {
|
|
141
|
-
contractId?: string;
|
|
142
|
-
templateQualifiedName?: string;
|
|
143
|
-
argument?: Uint8Array;
|
|
144
|
-
signatories: string[];
|
|
145
|
-
stakeholders: string[];
|
|
146
|
-
}
|
|
147
|
-
interface ExtractedTransfer {
|
|
148
|
-
sender: string;
|
|
149
|
-
receiver: string;
|
|
150
|
-
amount: string;
|
|
151
|
-
instrumentAdmin: string;
|
|
152
|
-
instrumentId: string;
|
|
153
|
-
}
|
|
154
|
-
/**
|
|
155
|
-
* Extract the transfer body (sender/receiver/amount/instrument) from a
|
|
156
|
-
* TransferFactory_Transfer choice argument, BY TYPE at its structural position.
|
|
157
|
-
*/
|
|
158
|
-
export declare function extractTransfer(chosenValue: Uint8Array): ExtractedTransfer;
|
|
159
|
-
export interface PreparedTransferExpectation {
|
|
160
|
-
/** The agent's own party — must be the transfer sender (caller intent). */
|
|
161
|
-
sender: string;
|
|
162
|
-
/** The intended recipient (merchant payTo / withdraw target) — caller intent. */
|
|
163
|
-
receiver: string;
|
|
164
|
-
/** The EXACT amount string the agent asked to transfer — caller intent. */
|
|
165
|
-
amount: string;
|
|
166
|
-
/**
|
|
167
|
-
* The instrument id the agent expects (e.g. "Amulet"). Caller intent — the
|
|
168
|
-
* agent chooses what asset to pay in. The instrument ADMIN (DSO party) is
|
|
169
|
-
* resolved by the relay and is deliberately NOT used as a trust anchor: we
|
|
170
|
-
* never whitelist a relay-supplied party. Pass it only if you have an
|
|
171
|
-
* independently-trusted value to additionally pin.
|
|
172
|
-
*/
|
|
173
|
-
instrumentId: string;
|
|
174
|
-
/** Optional, independently-trusted instrument admin (the DSO party) to pin. When
|
|
175
|
-
* supplied it is pinned by exact equality AND becomes the ONLY admin/dso value
|
|
176
|
-
* the foreign-party backstop excludes outside its root position — closing the
|
|
177
|
-
* "alias the unpinned admin to the attacker and inject it as a consequence
|
|
178
|
-
* recipient" neutralization. Pass it whenever you have an out-of-band DSO. */
|
|
179
|
-
instrumentAdmin?: string;
|
|
180
|
-
/** Optional, caller-intent synchronizer id (the merchant-advertised domain).
|
|
181
|
-
* When supplied, the SIGNED Metadata.synchronizer_id is pinned to it (fail-
|
|
182
|
-
* closed if absent/different) so a relay cannot land the agent's signature on a
|
|
183
|
-
* domain of its choosing. */
|
|
184
|
-
synchronizerId?: string;
|
|
185
|
-
/** Optional, caller-intent template `module:entity` qualified name of the
|
|
186
|
-
* TransferFactory the choice runs against (e.g. the token-standard transfer
|
|
187
|
-
* factory). When supplied, the exercise's template_id is pinned, closing the
|
|
188
|
-
* template/contract-confusion surface. */
|
|
189
|
-
templateQualifiedName?: string;
|
|
190
|
-
/** Optional, caller-intent contract id of the factory the exercise targets.
|
|
191
|
-
* When supplied, Exercise.contract_id is pinned by exact equality (fail-closed
|
|
192
|
-
* on divergence) — defense-in-depth closing the resolve→prepare TOCTOU. No-op
|
|
193
|
-
* when omitted (the all-nodes party backstop still contains any redirect). */
|
|
194
|
-
expectedContractId?: string;
|
|
195
|
-
/** Inject Date.now() for testability of the timing sanity checks. */
|
|
196
|
-
nowMs?: number;
|
|
197
|
-
}
|
|
198
|
-
export declare class PreparedDecodeError extends Error {
|
|
199
|
-
constructor(message: string);
|
|
200
|
-
}
|
|
201
|
-
export declare class PreparedTransferMismatchError extends Error {
|
|
202
|
-
constructor(message: string);
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Canonicalize a CC amount decimal string to a fixed 10-fractional-digit form
|
|
206
|
-
* for VALUE-equality comparison. Canton encodes amounts at 10 decimals
|
|
207
|
-
* ("0.0200000000"); a caller (e.g. `withdraw --amount 0.02`) may pass a short
|
|
208
|
-
* form, so comparing the raw strings would spuriously fail verify-before-sign
|
|
209
|
-
* even though the numeric value is identical. Pure string math (no float) so
|
|
210
|
-
* large amounts keep full precision. A non-numeric input is returned as-is, so
|
|
211
|
-
* it still mismatches (fail-closed).
|
|
212
|
-
*
|
|
213
|
-
* UNIT-BY-SCHEME invariant: BOTH sides of every amount compare here are
|
|
214
|
-
* on-ledger Daml **Decimals** — `t.amount` is decoded from the prepared tx's
|
|
215
|
-
* `Value.numeric` (always a ledger Decimal) and `expect.amount` is the caller's
|
|
216
|
-
* INTENDED ledger Decimal (the relay/agent path sources `opts.amount` as the
|
|
217
|
-
* Decimal, never the x402 wire atomic value). `canonicalAmount` therefore only
|
|
218
|
-
* pads Decimals; it must NEVER be fed an atomic integer (an atomic "1" would
|
|
219
|
-
* canonicalize to "1.0000000000" and silently mis-compare against the ledger
|
|
220
|
-
* "0.0000000001"). If a future caller ever sources `expect.amount` from an
|
|
221
|
-
* atomic-scheme wire, it MUST first convert via
|
|
222
|
-
* `wireAmountToLedgerDecimal(scheme, amount)` from @ftptech/x402-canton-core.
|
|
223
|
-
*/
|
|
224
|
-
export declare function canonicalAmount(raw: string): string;
|
|
225
|
-
export declare function assertPreparedTransferMatches(preparedTransactionB64: string, expect: PreparedTransferExpectation): void;
|
|
226
|
-
/** Caller-intent expectation for a `TransferInstruction_Accept` (claim) prepare. */
|
|
227
|
-
export interface PreparedAcceptExpectation {
|
|
228
|
-
/** The agent's own party — must be the authoritative submitter (act_as). */
|
|
229
|
-
selfParty: string;
|
|
230
|
-
/** Inject Date.now() for testability of the timing sanity checks. */
|
|
231
|
-
nowMs?: number;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Assert the relay-returned `preparedTransaction` for the claim path encodes
|
|
235
|
-
* EXACTLY a single `TransferInstruction_Accept` exercise submitted by the agent —
|
|
236
|
-
* and is NOT an outbound transfer/create-transfer-command drain. Throws
|
|
237
|
-
* `PreparedTransferMismatchError` on any mismatch and `PreparedDecodeError` if
|
|
238
|
-
* the bytes are not a decodable PreparedTransaction. Call BEFORE signing the
|
|
239
|
-
* hash. Fail-closed: anything not positively proven to be an inbound accept by
|
|
240
|
-
* the agent throws.
|
|
241
|
-
*/
|
|
242
|
-
export declare function assertPreparedAcceptMatches(preparedTransactionB64: string, expect: PreparedAcceptExpectation): void;
|
|
243
|
-
/**
|
|
244
|
-
* How to bind the relay-returned `hash` to the `preparedTransaction` bytes the
|
|
245
|
-
* agent just structurally validated. Exactly one of these must hold for a
|
|
246
|
-
* value-moving transfer, or we refuse to sign (fail-closed).
|
|
247
|
-
*/
|
|
1
|
+
export { decodePrepared, extractTransfer, extractSelfPreapproval, canonicalAmount, assertPreparedTransferMatches, assertPreparedAcceptMatches, PreparedDecodeError, PreparedTransferMismatchError, } from "@ftptech/x402-canton-core";
|
|
2
|
+
export type { DecodedPrepared, DecodedNode, DecodedExercise, DecodedInputContract, PreparedTransferExpectation, PreparedAcceptExpectation, } from "@ftptech/x402-canton-core";
|
|
248
3
|
export interface HashBindingOptions {
|
|
249
4
|
/**
|
|
250
5
|
* A function that recomputes the signing hash from the prepared-transaction
|
|
@@ -359,12 +114,16 @@ export declare function assertOnboardingTopologyBindsKey(onboardingTransactionsB
|
|
|
359
114
|
* and are fixed by the public, audited Splice choice body — the signature
|
|
360
115
|
* authorizes the ROOT choice, whose effects are not relay-controlled.
|
|
361
116
|
*
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
*
|
|
117
|
+
* 3. `receiver` and `provider` in the choice argument are BOTH `party`. Without
|
|
118
|
+
* this a hostile relay made the merchant pay to create a preapproval naming
|
|
119
|
+
* somebody else — the merchant burns the fee, ends up without the
|
|
120
|
+
* preapproval it believes it has, and every payment to it keeps failing
|
|
121
|
+
* while each retry burns another fee. Read positionally against a REAL
|
|
122
|
+
* MainNet capture (see `extractSelfPreapproval`), not an invented fixture.
|
|
123
|
+
* 4. `expiresAt` equals `expectedExpiresAt` when the caller supplies one. The
|
|
124
|
+
* relay chooses this value (defaulting to 90 days) and echoes it in the
|
|
125
|
+
* prepare response; passing that echo back here is what binds the bytes to
|
|
126
|
+
* the terms the relay stated. Omitted → unchecked, exactly as before.
|
|
367
127
|
*/
|
|
368
|
-
export declare function assertPreparedSelfPreapproval(preparedTransactionB64: string, party: string): void;
|
|
369
|
-
export {};
|
|
128
|
+
export declare function assertPreparedSelfPreapproval(preparedTransactionB64: string, party: string, expectedExpiresAt?: string): void;
|
|
370
129
|
//# sourceMappingURL=verify-prepared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"verify-prepared.d.ts","sourceRoot":"","sources":["../src/verify-prepared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"verify-prepared.d.ts","sourceRoot":"","sources":["../src/verify-prepared.ts"],"names":[],"mappings":"AAmHA,OAAO,EACL,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,6BAA6B,EAC7B,2BAA2B,EAC3B,mBAAmB,EACnB,6BAA6B,GAC9B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EACV,eAAe,EACf,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,2BAA2B,EAC3B,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AAMnC,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;;;;;;;;;OAiBG;IACH,aAAa,CAAC,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;IAC7E;;;;;;;;;;;;OAYG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,iFAAiF;AACjF,qBAAa,4BAA6B,SAAQ,KAAK;gBACzC,OAAO,EAAE,MAAM;CAI5B;AAgBD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAsB,iBAAiB,CACrC,sBAAsB,EAAE,MAAM,EAC9B,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,kBAAuB,GAC5B,OAAO,CAAC,IAAI,CAAC,CA4Df;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,sBAAsB,EAAE,MAAM,EAC9B,OAAO,EAAE,MAAM,GACd,OAAO,CAIT;AAoDD;6EAC6E;AAC7E,qBAAa,+BAAgC,SAAQ,KAAK;gBAC5C,OAAO,EAAE,MAAM;CAI5B;AAED,uEAAuE;AACvE,MAAM,WAAW,6BAA6B;IAC5C,+EAA+E;IAC/E,gBAAgB,EAAE,MAAM,CAAC;IACzB,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd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