@toon-protocol/client 2.2.0 → 3.0.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/dist/cli/main.js CHANGED
@@ -542,7 +542,7 @@ function buildClientConfig(settings, keys) {
542
542
  };
543
543
  }
544
544
  async function defaultCreateClient(config) {
545
- const module = await import("../client-VA4727SQ.js");
545
+ const module = await import("../client-TEP26FMO.js");
546
546
  const factory = module.ToonClient;
547
547
  if (factory === void 0) {
548
548
  throw new Error(
@@ -30,7 +30,7 @@ import {
30
30
  send,
31
31
  settlementToTerms,
32
32
  toEnvelopeRequest
33
- } from "./chunk-A3JKQOWQ.js";
33
+ } from "./chunk-GDWZ736I.js";
34
34
  import "./chunk-7MPONJW5.js";
35
35
  import "./chunk-32MD3CXE.js";
36
36
  export {
@@ -66,4 +66,4 @@ export {
66
66
  settlementToTerms,
67
67
  toEnvelopeRequest
68
68
  };
69
- //# sourceMappingURL=client-VA4727SQ.js.map
69
+ //# sourceMappingURL=client-TEP26FMO.js.map
package/dist/index.d.ts CHANGED
@@ -237,16 +237,30 @@ interface ILPPreparePacket {
237
237
  type: typeof ILPPacketType.PREPARE;
238
238
  amount: bigint;
239
239
  destination: string;
240
- executionCondition: Uint8Array;
240
+ /**
241
+ * Whether this PREPARE declares itself a bootstrap/greeting probe rather
242
+ * than a real payment attempt (connector ADR 0069, issue #1269). One byte
243
+ * on the wire, where a 32-byte `executionCondition` used to sit.
244
+ *
245
+ * The connector's client edge consults it only when no claim rides with
246
+ * the packet: an unclaimed `greeting` PREPARE is never routed, never
247
+ * priced and never fulfilled — it is answered with the x402 terms instead
248
+ * (`client-edge-spec.md` §1.4). A claim header suppresses the greeting
249
+ * unconditionally, so setting this on a paid packet cannot make it free.
250
+ */
251
+ greeting: boolean;
241
252
  expiresAt: Date;
242
253
  data: Uint8Array;
243
254
  }
244
255
  interface ILPFulfillPacket {
245
256
  type: typeof ILPPacketType.FULFILL;
246
257
  /**
247
- * The 32-byte fulfillment preimage from the wire. All-zero on legacy
248
- * (zero-condition) packets; on sender-chosen conditions (toon-client#350)
249
- * the transport verifies `sha256(fulfillment) == executionCondition`.
258
+ * The 32-byte fulfillment preimage from the wire — the one thing ADR 0069
259
+ * left in the return direction untouched. A termination derives it from
260
+ * the shared secret sealed inside the request (ADR 0019), so a sender that
261
+ * kept that secret checks a delivery end to end by comparing these bytes
262
+ * against its own `deriveFulfillment(sharedSecret)`. There is no condition
263
+ * on the wire to check it against any more.
250
264
  */
251
265
  fulfillment: Uint8Array;
252
266
  data: Uint8Array;
@@ -260,6 +274,12 @@ interface ILPRejectPacket {
260
274
  data: Uint8Array;
261
275
  }
262
276
  type ILPResponsePacket = ILPFulfillPacket | ILPRejectPacket;
277
+ /**
278
+ * Encode a PREPARE. The `greeting` flag is a single `0x00`/`0x01` octet
279
+ * between `expiresAt` and `destination` — `connector-domain::Prepare::encode`
280
+ * writes `u8::from(self.greeting)` there, and writes nothing else in its
281
+ * place (connector ADR 0069).
282
+ */
263
283
  declare function serializeIlpPrepare(packet: ILPPreparePacket): Uint8Array;
264
284
  /**
265
285
  * Decode an inbound PREPARE — the server-role mirror of {@link serializeIlpPrepare}
@@ -300,27 +320,28 @@ declare function serializeBtpMessage(message: BTPMessage): Uint8Array;
300
320
  declare function parseBtpMessage(buf: Uint8Array): BTPMessage;
301
321
 
302
322
  /**
303
- * Shared sender-side plumbing for sender-chosen execution conditions
304
- * (toon-client#350; contract: connector `docs/local-delivery-fulfillment-contract.md`,
305
- * connector#309; spec: toon-meta `docs/rolling-swap.md` §3).
323
+ * Shared sender-side plumbing for both ILP carriages: how a PREPARE's
324
+ * non-routing fields are resolved, and how the answer is read.
325
+ *
326
+ * Connector ADR 0069 (issue #1269) removed the execution condition from the
327
+ * wire. Two things changed here and nothing else did:
306
328
  *
307
- * Both ILP transports (HTTP `POST /ilp` and BTP) take the SAME extended send
308
- * params and map FULFILL/REJECT responses through the SAME verifier so the
309
- * two paths cannot drift:
329
+ * - the PREPARE carries a one-byte `greeting` flag where a 32-byte
330
+ * condition used to sit — see {@link IlpSendParams.greeting};
331
+ * - the sender's delivery check compares a FULFILL's preimage directly
332
+ * against the fulfilment its own sealed secret derives
333
+ * ({@link IlpSendParams.expectedFulfillment}), rather than hashing it back
334
+ * to a condition that no longer exists.
310
335
  *
311
- * - absent/all-zero `executionCondition` → legacy class: today's behavior,
312
- * byte-for-byte (zero condition on the wire, no FULFILL verification);
313
- * - non-zero `executionCondition` → sender-chosen: the condition goes on
314
- * the PREPARE verbatim and the FULFILL's 32-byte fulfillment MUST hash
315
- * back to it — a missing/malformed/mismatching preimage is surfaced as a
316
- * FAILED result (never a silent accept, never retried).
336
+ * Both transports (HTTP `POST /ilp` and BTP) take the SAME params and map
337
+ * FULFILL/REJECT through the SAME verifier, so the two paths cannot drift.
338
+ * Omitting `expectedFulfillment` keeps a FULFILL unverified — the right shape
339
+ * for a caller that never sealed anything and so has nothing to compare
340
+ * against.
317
341
  */
318
342
 
319
343
  /**
320
- * Send parameters accepted by both ILP transports. Extends the
321
- * `@toon-protocol/core` `IlpClient` param shape with the sender-chosen
322
- * condition and an explicit expiry — plain `IlpClient` callers keep working
323
- * unchanged (both extras are optional; omitting them is the legacy path).
344
+ * Send parameters accepted by both ILP transports.
324
345
  */
325
346
  interface IlpSendParams {
326
347
  destination: string;
@@ -330,40 +351,48 @@ interface IlpSendParams {
330
351
  /** Transport timeout in ms; also the default expiry window. */
331
352
  timeout?: number;
332
353
  /**
333
- * Sender-chosen 32-byte execution condition `C = sha256(P)` (spec R2).
334
- * Absent or all-zero = legacy unverified packet (default — ordinary
335
- * publish/upload writes MUST keep this default).
354
+ * Declare this PREPARE a bootstrap/greeting probe (connector ADR 0069).
336
355
  *
337
- * Accepts the raw 32 bytes or their base64 encoding. Bytes are the native
338
- * form here — the whole condition/preimage subsystem in
339
- * `../utils/condition.js` is bytes-native, as is `@toon-protocol/core`'s
340
- * in-process `SendPacketParams.executionCondition`. The base64 form exists
341
- * because `@toon-protocol/core` ≥3.4.0's `IlpClient` port — the JSON-shaped
342
- * wire port — declares this field as a base64 `string`, exactly as it
343
- * already does for {@link expiresAt}. Normalize with
344
- * {@link resolveExecutionCondition} before touching the bytes.
356
+ * Defaults to `false`, which is what every real send wants: a greeting is
357
+ * never routed, never priced and never fulfilled — the connector answers
358
+ * the x402 terms instead. Set it only to ASK for those terms without a
359
+ * route match, the shape `ConnectorEdgeClient` uses for bootstrap. A claim
360
+ * riding with the packet suppresses the greeting either way, so this can
361
+ * never turn a paid packet into a free one.
362
+ */
363
+ greeting?: boolean;
364
+ /**
365
+ * The 32 bytes an honest FULFILL must carry: `deriveFulfillment(sharedSecret)`
366
+ * for the secret sealed inside this packet's gift wrap (ADR 0019), which
367
+ * `sealExchange` returns as `SealedExchange.fulfillment`.
368
+ *
369
+ * Present = verify; absent = accept a FULFILL unchecked, which is the only
370
+ * honest option for a caller that sealed nothing and therefore knows no
371
+ * secret. This is the sender's own end-to-end check and the ONLY fulfilment
372
+ * check left anywhere on the path (ADR 0069) — no hop performs one.
373
+ *
374
+ * Accepts the raw 32 bytes or their base64 encoding; normalize with
375
+ * {@link resolveExpectedFulfillment} before touching the bytes.
345
376
  */
346
- executionCondition?: Uint8Array | string;
377
+ expectedFulfillment?: Uint8Array | string;
347
378
  /**
348
- * Explicit PREPARE `expiresAt` (spec R7). Defaults to `now + timeout`,
349
- * preserving pre-#350 behavior. Accepts a `Date` or an ISO 8601 string —
350
- * `@toon-protocol/core` ≥2.1.0's `IlpClient` passes the string form.
379
+ * Explicit PREPARE `expiresAt`. Defaults to `now + timeout` plus
380
+ * {@link PACKET_EXPIRY_HEADROOM_MS}. Accepts a `Date` or an ISO 8601 string.
351
381
  */
352
382
  expiresAt?: Date | string;
353
383
  }
354
384
  /**
355
- * Normalize an `IlpSendParams.executionCondition` to raw bytes.
385
+ * Normalize an `IlpSendParams.expectedFulfillment` to raw bytes.
356
386
  *
357
387
  * The two representations are the two callers: this package's own senders
358
- * pass the bytes minted by `mintExecutionCondition`, while a caller typed
359
- * only against `@toon-protocol/core`'s `IlpClient` port passes the base64
360
- * string that port declares. Both mean the same 32 bytes.
388
+ * pass the bytes `sealExchange` derived, while a caller typed against the
389
+ * JSON-shaped port passes their base64 spelling. Both mean the same 32 bytes.
361
390
  *
362
- * Length is NOT validated here — that stays with `assertValidCondition` at
363
- * the transports, so a malformed condition fails with the same message on
364
- * both paths regardless of which representation it arrived in.
391
+ * Length is NOT validated here — that stays with `assertValidFulfillment` at
392
+ * the transports, so a malformed value fails with the same message on both
393
+ * paths regardless of which representation it arrived in.
365
394
  */
366
- declare function resolveExecutionCondition(condition: Uint8Array | string | undefined): Uint8Array | undefined;
395
+ declare function resolveExpectedFulfillment(fulfillment: Uint8Array | string | undefined): Uint8Array | undefined;
367
396
  /**
368
397
  * How much longer a packet lives on the wire than the sender is prepared to wait.
369
398
  *
@@ -392,12 +421,11 @@ declare const PACKET_EXPIRY_HEADROOM_MS = 15000;
392
421
  */
393
422
  declare function resolveExpiresAt(expiresAt: Date | string | undefined, timeoutMs: number): Date;
394
423
  /**
395
- * `IlpSendResult` plus the FULFILL preimage when a sender-chosen condition
396
- * was verified. Only populated on the sender-chosen path so legacy result
397
- * objects stay byte-identical.
424
+ * `IlpSendResult` plus the FULFILL preimage, populated only when the sender
425
+ * knew what to expect and the bytes matched.
398
426
  */
399
427
  interface IlpSendResultWithFulfillment extends IlpSendResult {
400
- /** Base64 32-byte fulfillment preimage (verified: sha256 == condition). */
428
+ /** Base64 32-byte fulfillment preimage (verified against the expected one). */
401
429
  fulfillment?: string;
402
430
  }
403
431
  /** ILP code used for a client-side fulfillment-verification failure. */
@@ -406,16 +434,20 @@ declare const FULFILLMENT_MISMATCH_CODE = "F99";
406
434
  declare const FULFILLMENT_MISMATCH_MESSAGE: string;
407
435
  /**
408
436
  * Map a parsed ILP response packet to an `IlpSendResult`, enforcing the
409
- * sender-chosen condition when one was sent.
437
+ * sender's end-to-end delivery check when it knows what to expect.
438
+ *
439
+ * Verification is fail-closed: when `expectedFulfillment` is given, a FULFILL
440
+ * whose preimage is absent, not exactly 32 bytes, or simply different yields
441
+ * `accepted: false` (code F99). The result shape — not a thrown error — is
442
+ * deliberate: transports only retry thrown `NetworkError`s, so a forged or
443
+ * wrong FULFILL is never retried, because re-sending would re-spend the
444
+ * attached claim.
410
445
  *
411
- * Verification is fail-closed: when `sentCondition` is non-zero, a FULFILL
412
- * whose fulfillment is absent, not exactly 32 bytes, or does not sha256-hash
413
- * to the condition yields `accepted: false` (code F99). The result shape —
414
- * not a thrown error — is deliberate: transports only retry thrown
415
- * `NetworkError`s, so a forged/wrong FULFILL is never retried — re-sending
416
- * would re-spend the attached claim.
446
+ * Since ADR 0069 this is the only fulfilment check anywhere on the path. A
447
+ * candidate FULFILL rides home through every hop unexamined, which is exactly
448
+ * why the sender must still make it.
417
449
  */
418
- declare function mapIlpResponse(packet: ILPResponsePacket, sentCondition?: Uint8Array): IlpSendResultWithFulfillment;
450
+ declare function mapIlpResponse(packet: ILPResponsePacket, expectedFulfillment?: Uint8Array): IlpSendResultWithFulfillment;
419
451
 
420
452
  /**
421
453
  * The ILP transport port: what a carriage must be able to do, and what it
@@ -4304,19 +4336,18 @@ declare class BtpRuntimeClient implements IlpClient {
4304
4336
  * Sends an ILP packet via BTP with auto-reconnect on connection errors.
4305
4337
  * Satisfies IlpClient interface.
4306
4338
  *
4307
- * `params` may carry a sender-chosen `executionCondition` and an explicit
4308
- * `expiresAt` (toon-client#350); omitting both is the legacy zero-condition
4309
- * path, unchanged. With a non-zero condition the FULFILL preimage is
4310
- * verified (`sha256(fulfillment) == condition`) and a mismatch is surfaced
4311
- * as a failed result — see `mapIlpResponse`.
4339
+ * `params` may carry an `expectedFulfillment` (the sender's end-to-end
4340
+ * check, ADR 0069), a `greeting` flag and an explicit `expiresAt`. With an
4341
+ * expected fulfilment the FULFILL preimage is compared against it and a
4342
+ * mismatch is surfaced as a failed result — see `mapIlpResponse`.
4312
4343
  */
4313
4344
  sendIlpPacket(params: IlpSendParams): Promise<IlpSendResult>;
4314
4345
  /**
4315
4346
  * Sends a balance proof claim via BTP protocol data, then sends an ILP packet.
4316
4347
  * Auto-reconnects on connection errors.
4317
4348
  *
4318
- * Sender-chosen `executionCondition` / explicit `expiresAt` semantics are
4319
- * identical to {@link sendIlpPacket}.
4349
+ * `expectedFulfillment` / `greeting` / `expiresAt` semantics are identical
4350
+ * to {@link sendIlpPacket}.
4320
4351
  */
4321
4352
  sendIlpPacketWithClaim(params: IlpSendParams, claim: Record<string, unknown>): Promise<IlpSendResult>;
4322
4353
  /**
@@ -4328,11 +4359,11 @@ declare class BtpRuntimeClient implements IlpClient {
4328
4359
  sendClaimMessage(claim: Record<string, unknown>): Promise<void>;
4329
4360
  private _sendClaimMessageOnce;
4330
4361
  /**
4331
- * Build the ILP PREPARE for a send, applying the sender-chosen condition /
4332
- * explicit expiry when provided (toon-client#350) and validating that a
4333
- * non-zero condition is exactly 32 bytes (the OER serializer would
4334
- * otherwise silently zero-fill it, downgrading the packet to the legacy
4335
- * unverified class).
4362
+ * Build the ILP PREPARE for a send, applying the
4363
+ * explicit expiry when provided, carrying the `greeting` flag ADR 0069 put
4364
+ * where the execution condition used to be, and validating that an expected
4365
+ * fulfilment is exactly 32 bytes (a wrong-length one could never match a
4366
+ * real FULFILL, so every delivery would be counted failed).
4336
4367
  */
4337
4368
  private buildPrepare;
4338
4369
  /**
@@ -4477,11 +4508,10 @@ declare class HttpIlpClient implements IlpClient {
4477
4508
  * this only on free/zero-amount routes; paid writes must use
4478
4509
  * {@link sendIlpPacketWithClaim}. Satisfies the IlpClient interface.
4479
4510
  *
4480
- * `params` may carry a sender-chosen `executionCondition` and an explicit
4481
- * `expiresAt` (toon-client#350); omitting both is the legacy zero-condition
4482
- * path, unchanged. With a non-zero condition the FULFILL preimage is
4483
- * verified (`sha256(fulfillment) == condition`) and a mismatch is surfaced
4484
- * as a failed result — see {@link mapIlpResponse}.
4511
+ * `params` may carry an `expectedFulfillment` (the sender's end-to-end
4512
+ * check, ADR 0069), a `greeting` flag and an explicit `expiresAt`. With an
4513
+ * expected fulfilment the FULFILL preimage is compared against it and a
4514
+ * mismatch is surfaced as a failed result — see {@link mapIlpResponse}.
4485
4515
  */
4486
4516
  sendIlpPacket(params: IlpSendParams): Promise<IlpSendResult>;
4487
4517
  /**
@@ -4490,8 +4520,8 @@ declare class HttpIlpClient implements IlpClient {
4490
4520
  * the BTP path attaches as the `payment-channel-claim` protocolData entry —
4491
4521
  * we base64(JSON.stringify(claim)) it, byte-for-byte identical to BTP.
4492
4522
  *
4493
- * Sender-chosen `executionCondition` / explicit `expiresAt` semantics are
4494
- * identical to {@link sendIlpPacket}.
4523
+ * `expectedFulfillment` / `greeting` / `expiresAt` semantics are identical
4524
+ * to {@link sendIlpPacket}.
4495
4525
  */
4496
4526
  sendIlpPacketWithClaim(params: IlpSendParams, claim: unknown): Promise<IlpSendResult>;
4497
4527
  /**
@@ -4546,9 +4576,9 @@ declare class HttpIlpClient implements IlpClient {
4546
4576
  * to a transport error. Per the wire contract, ILP-level rejects arrive as a
4547
4577
  * 200 + REJECT body — only HTTP non-2xx means a transport-layer failure.
4548
4578
  *
4549
- * When `sentCondition` is non-zero the FULFILL preimage is verified against
4550
- * it; a mismatch yields `accepted: false` (shared `mapIlpResponse` logic,
4551
- * identical to the BTP path).
4579
+ * When `expectedFulfillment` is given the FULFILL preimage is compared
4580
+ * against it; a mismatch yields `accepted: false` (shared `mapIlpResponse`
4581
+ * logic, identical to the BTP path).
4552
4582
  */
4553
4583
  private mapResponse;
4554
4584
  private mapTransportError;
@@ -4880,12 +4910,13 @@ declare function decodeVarOctetString(buf: Uint8Array, offset: number): Decoded<
4880
4910
  * - **Response framing.** `0x02 ‖ nonce(12) ‖ ciphertext`, the plaintext being
4881
4911
  * just the encoded envelope. Sealed directly with the request's shared
4882
4912
  * secret.
4883
- * - **Fulfilment and condition.** `fulfilment = HKDF-SHA256(shared_secret,
4884
- * "toon-giftwrap-fulfillment")`; the condition a sender mints is
4885
- * `sha256(fulfilment)` — `condition.rs`'s `derive_condition`. A sender knows
4886
- * the secret before it seals, so it can mint the condition first; the
4887
- * terminating connector recovers the secret by opening the wrap and derives
4888
- * the preimage without asking the app anything.
4913
+ * - **Fulfilment.** `fulfilment = HKDF-SHA256(shared_secret,
4914
+ * "toon-giftwrap-fulfillment")`. The terminating connector recovers the
4915
+ * secret by opening the wrap and derives the preimage without asking the
4916
+ * app anything; the sender, which drew that secret, derives the same bytes
4917
+ * and so can check a delivery end to end. Nothing is minted onto the
4918
+ * PREPARE from it — connector ADR 0069 took the execution condition off the
4919
+ * wire entirely.
4889
4920
  * - **Telling a sealed reject from a plaintext one.** The leading type byte,
4890
4921
  * and only that (`looks_like_sealed_response`). A reject raised short of the
4891
4922
  * termination shares no secret with the sender and carries empty `data`; an
@@ -5019,11 +5050,11 @@ declare function sealRequestWithRandomness(plaintext: Uint8Array, receiverPublic
5019
5050
  * so no two sealed requests — even to the same receiver, even with the same
5020
5051
  * plaintext — share any of the three.
5021
5052
  *
5022
- * Returns the wire bytes and the shared secret. Mint the packet's execution
5023
- * condition as {@link deriveCondition}({@link deriveFulfillment}(secret))
5024
- * before sending: the terminating connector recovers the same secret by
5025
- * opening this wrap, so the preimage it is paid against is one it derived, not
5026
- * one anybody handed it.
5053
+ * Returns the wire bytes and the shared secret. Keep that secret: the
5054
+ * terminating connector recovers the same one by opening this wrap, so
5055
+ * {@link deriveFulfillment} of it is the preimage an honest FULFILL will
5056
+ * carry — the sender's only way to check a delivery end to end now that no
5057
+ * condition rides on the wire (connector ADR 0069).
5027
5058
  */
5028
5059
  declare function sealRequest(plaintext: Uint8Array, receiverPublicKey: Uint8Array): SealedRequest;
5029
5060
  /**
@@ -5074,22 +5105,6 @@ declare function looksLikeSealedResponse(bytes: Uint8Array): boolean;
5074
5105
  * secret also derives, so it can never collide with either.
5075
5106
  */
5076
5107
  declare function deriveFulfillment(sharedSecret: Uint8Array): Uint8Array;
5077
- /**
5078
- * The condition a `fulfillment` satisfies: `sha256(fulfillment)` —
5079
- * `connector_domain::condition::derive_condition`. Hashing only ever runs in
5080
- * this direction; there is deliberately no function here that goes from a
5081
- * condition back to a fulfilment.
5082
- *
5083
- * The hash is the same one `utils/condition.ts` already uses; what ADR 0019
5084
- * changes is where the preimage comes from. `mintExecutionCondition` there
5085
- * draws a random preimage the sender must then carry to the FULFILL itself;
5086
- * here the preimage is DERIVED from the secret sealed inside the packet, so
5087
- * the terminating connector can produce it without the sender or the app
5088
- * handing it over. Checking a returned fulfilment against a condition is
5089
- * unchanged either way — use `fulfillmentMatchesCondition` from
5090
- * `utils/condition.ts` for that rather than a second copy of it here.
5091
- */
5092
- declare function deriveCondition(fulfillment: Uint8Array): Uint8Array;
5093
5108
 
5094
5109
  /**
5095
5110
  * One sealed request/answer exchange with a terminating connector (ADR 0018,
@@ -5101,11 +5116,11 @@ declare function deriveCondition(fulfillment: Uint8Array): Uint8Array;
5101
5116
  *
5102
5117
  * - The `data` is a gift wrap addressed to the connector that TERMINATES the
5103
5118
  * route, around an OER envelope — never HTTP text, never a bare payload.
5104
- * - The execution condition is `sha256` of the fulfilment DERIVED from the
5105
- * very secret that wrap carries. A random condition would never be
5106
- * fulfilled; an all-zero one is refused outright by the connector
5107
- * (`connector-domain`'s `condition_is_present`), which is why the publish
5108
- * path could not work against it at all before this module existed.
5119
+ * - The fulfilment an honest answer carries is DERIVED from the very secret
5120
+ * that wrap carries (ADR 0019). Since ADR 0069 took the execution condition
5121
+ * off the wire, comparing a returned preimage against that derivation is
5122
+ * the sender's only delivery check — and the only one made anywhere on the
5123
+ * path, since no hop verifies a FULFILL any more.
5109
5124
  * - The answer is sealed with that same secret, so opening it requires having
5110
5125
  * kept it from the seal.
5111
5126
  *
@@ -5133,23 +5148,16 @@ declare function deriveCondition(fulfillment: Uint8Array): Uint8Array;
5133
5148
  */
5134
5149
 
5135
5150
  /**
5136
- * A sealed request, ready to become a PREPARE: what goes in `data`, what goes
5137
- * on `executionCondition`, and the secret needed to read the answer.
5151
+ * A sealed request, ready to become a PREPARE: what goes in `data`, the secret
5152
+ * needed to read the answer, and the fulfilment that answer must carry.
5138
5153
  *
5139
- * The three are produced together and belong together. Sending `data` under a
5140
- * condition minted any other way produces a packet no honest connector can
5141
- * fulfil; opening the answer with any other secret fails.
5154
+ * The three are produced together and belong together: opening the answer with
5155
+ * any other secret fails, and checking a FULFILL against any other fulfilment
5156
+ * rejects a delivery that was genuine.
5142
5157
  */
5143
5158
  interface SealedExchange {
5144
5159
  /** The gift wrap to carry as the PREPARE's `data`. */
5145
5160
  readonly data: Uint8Array;
5146
- /**
5147
- * The PREPARE's `executionCondition`: `sha256(deriveFulfillment(secret))`.
5148
- * Derived, never random and never caller-supplied — the terminating
5149
- * connector recovers the same secret and derives the same fulfilment
5150
- * without the app participating (ADR 0019).
5151
- */
5152
- readonly condition: Uint8Array;
5153
5161
  /**
5154
5162
  * The 32-byte secret sealed inside the wrap. Keep it until the answer is
5155
5163
  * read; it is the only thing that opens the response. Never send it
@@ -5157,9 +5165,11 @@ interface SealedExchange {
5157
5165
  */
5158
5166
  readonly sharedSecret: Uint8Array;
5159
5167
  /**
5160
- * The fulfilment the terminating connector will return. Held so a caller
5161
- * can check the FULFILL preimage it actually got, rather than only that it
5162
- * hashes to the condition.
5168
+ * The fulfilment the terminating connector will return —
5169
+ * `deriveFulfillment(sharedSecret)`. Pass it to a transport as
5170
+ * `expectedFulfillment`: comparing a FULFILL's preimage against this is the
5171
+ * sender's end-to-end check, and since ADR 0069 the only fulfilment check
5172
+ * made anywhere on the path.
5163
5173
  */
5164
5174
  readonly fulfillment: Uint8Array;
5165
5175
  }
@@ -6684,4 +6694,4 @@ interface RetryOptions {
6684
6694
  */
6685
6695
  declare function withRetry<T>(operation: () => Promise<T>, options: RetryOptions): Promise<T>;
6686
6696
 
6687
- export { ACCUMULATED_COST_HEADER, ACCUMULATED_COST_PROTOCOL, ARNS_KIND, type AntSpawnOutcome, type AntSpawnParams, type AntSpawnRefused, type AntSpawnStep, type AntSpawned, type ArnsAntPrepareReceipt, type ArnsBuyOutcome, type ArnsBuyParams, type ArnsBuyReceipt, type ArnsNameType, type ArnsNameWithAntOutcome, type ArnsNetwork, type BTPMessage, BTPMessageType, type BTPProtocolData, type BalanceProofParams, BtpAuthError, type BtpChannelDeclaration, BtpConnectionError, type BtpPacketResponse, BtpPaidWriteTransport, type BtpPaidWriteTransportConfig, BtpRuntimeClient, type BtpRuntimeClientConfig, CLAIM_ACK_HEADER, CLAIM_ACK_PROTOCOL, CLAIM_REJECT_CODE, CLAIM_REJECT_REASONS, type ChainKind, type ChainMetadata, type ChainSigner, ChainUnavailableError, type ChannelBinding, type ChannelBindingContext, type ChannelClient, type ChannelFacade, type ChannelFacadeDeps, ChannelFundingError, ChannelManager, type ChannelManagerConfig, ChannelNotOpenError, ChannelResumeError, type ChannelState, type ChannelStatus, type ChannelStore, type ChannelStoreEntry, type ChannelTerms, type ClaimAck, type ClaimMessage, type ClaimSendingTransport$1 as ClaimSendingTransport, type ClaimStateFailed, type ClaimStateOk, type ClaimStateRequestEntry, type ClaimStateResult, type ClaimSummary, ClientChannelFacade, ClientWalletFacade, ConfigError, type ConnectorChainSettlementTerms, ConnectorEdgeClient, type ConnectorEdgeClientConfig, ConnectorEdgeError, type ConnectorEdgeErrorCode, ConnectorError, type ConnectorIdentity, type ConnectorRoutePrice, type ConnectorRouteTerms, type ConnectorSettlementTerms, type ConnectorSolanaSettlementTerms, type CounterpartyVerdict, DEFAULT_DEPOSIT, DEFAULT_SETTLEMENT_TIMEOUT, DEFAULT_TIMEOUT_MS, DEVNET, type Decoded, type DeriveIdentityOptions, type DerivedIdentity, type DevnetNode, ERC20_ABI, type EVMClaimMessage, type EdgeIdentity, type EncryptedKeystore, type EnsureChannelOptions, type Envelope, EnvelopeError, EnvelopeErrorKind, type EnvelopeHeader, type EnvelopeRequest, type EnvelopeResponse, type EvmChannelRecord, type EvmReadConsistencyConfig, EvmSigner, type ExchangeOutcome, FULFILLMENT_MISMATCH_CODE, FULFILLMENT_MISMATCH_MESSAGE, type FaucetChain, type FundWalletOptions, type FundWalletResult, GIFTWRAP_NONCE_LENGTH, GIFTWRAP_PUBLIC_KEY_LENGTH, GIFTWRAP_SECRET_LENGTH, GIFTWRAP_TYPE_REQUEST, GIFTWRAP_TYPE_RESPONSE, type GasStationExecuteReceipt, type GasStationFailureReason, type GasStationFailureReceipt, type GasStationQuoteReceipt, type GasStationReceipt, type GiftWrapEcdh, GiftWrapError, GiftWrapErrorKind, HS_HOSTNAME_MAX_LENGTH, HS_HOSTNAME_REGEX, HttpIlpClient, type HttpIlpClientConfig, type ILPFulfillPacket, ILPPacketType, type ILPPreparePacket, type ILPRejectPacket, type ILPResponsePacket, ILP_CLAIM_HEADER, ILP_PEER_ID_HEADER, type IlpClient, type IlpResponseMeta, type IlpSendParams, type IlpSendResult, type IlpSendResultWithFulfillment, InMemoryChannelStore, InsufficientBalanceError, InvalidAddressError, IsomorphicBtpClient, type JobAnswer, type JobEndpoint, type JobEvent, type JobEventParams, type JobSender, JsonFileChannelStore, KEYSTORE_VERSION, type KeyDerivationScheme, MIN_SETTLEMENT_TIMEOUT_SECONDS, NetworkError, type NodeSelfDescription, OerError, OerErrorKind, OnChainChannelClient, type OnChainChannelClientConfig, type OnChainChannelStatus, type OpenChannelOptions, type OpenChannelParams, type OpenChannelResult, type OpenOrAdoptParams, type OpenedKeystore, type OpenedRequest, PACKET_EXPIRY_HEADROOM_MS, PAYMENT_REQUIRED_HEADER, PAYMENT_REQUIRED_PROTOCOL, type PaidWriteTransport, type ParsedX402Challenge, PaymentRequiredError, type PaymentTerms, type RequiredTransport, type ResolvedConfig, type ResolvedIdentity, type ResponseHeaderSource, type RetryOptions, type RouteCharge, RouteNotPricedError, type RoutePrice, type RpcTransportOptions, SOLANA_GAS_KIND, type SealedExchange, type SealedRequest, SealedResponseError, type SealedResponseErrorKind, type SendContext, type SendFulfilled, type SendOptions, type SendRefused, type SendRequest, type SendResult, type SendTransferParams, type SendTransferResult, type SignedBalanceProof, type SolanaChannelConfig, type SolanaClaimMessage, type Signer as SolanaKeypair, type SolanaNetwork, SolanaSigner, type SolanaWireTransaction, StaleRpcReadError, TOKEN_NETWORK_ABI, TOKEN_NETWORK_REGISTRY_ABI, TokenNetworkClient, type TokenNetworkClientConfig, type ToonChannelAccept, ToonClient, type ToonClientConfig, ToonClientError, type ToonClientLike, type ToonIdentity, type TransferConfig, TransferNotDeliveredError, TransferUnsupportedError, type TransportChoice, type TransportPreference, TransportRequiredError, type TxRef, UnknownChainError, ValidationError, type WalletBalance, type WalletBalanceSources, type WalletChainBalances, type WalletFacade, type WalletFacadeDeps, type WalletTokenAmount, type WriteKeystoreOptions, type X402ChannelExtra, addressFor, assertRoutableHsHostname, buildJobEvent, buildResponseMeta, buyArnsName, buyArnsNameWithNewAnt, chainUnavailableMessage, chargeFor, connectorEdgeBaseUrl, counterpartyMatch, decodeAccumulatedCost, decodeBase64Text, decodeClaimAck, decodeEnvelope, decodeEnvelopeRequest, decodeEnvelopeResponse, decodePaymentRequired, decodeVarOctetString, decodeVarUint, decryptMnemonic, defaultDestinationFor, defaultFaucetTimeout, defaultRpcUrl, deriveCondition, deriveEvmChannelId, deriveFulfillment, deriveFullIdentity, deserializeIlpPacket, deserializeIlpPrepare, encodeEnvelope, encodeEnvelopeRequest, encodeEnvelopeResponse, encodeVarOctetString, encodeVarUint, encryptMnemonic, envelopeHeader, evmDerivationPath, evmIdentityFromKey, fundWallet, generateKeystore, generateMnemonic, generateRandomIdentity, generateSolanaKeypair, giftWrapPublicKey, httpEndpointToBtpUrl, importKeystore, isGasStationFailure, isHiddenServiceUrl, isInsufficientGasError, isRoutableHsHostname, isUnknownChannelReject, jobEventParam, keystoreDerivation, loadKeystore, localGiftWrapEcdh, looksLikeSealedResponse, mapIlpResponse, openKeystore, openRequest, openResponse, parseBtpMessage, parseEvmChainId, parsePaymentTerms, parseSelfDescription, parseSettlementEntry, parseSolanaWireTransaction, parseX402Body, parseX402Challenge, patchSolanaRecentBlockhash, readBaseUnits, readResponseMeta$1 as readBtpResponseMeta, readEvmNativeBalance, readEvmTokenBalance, readExchangeOutcome, readResponseMeta, readSolanaNativeBalance, readSolanaTokenBalance, readWalletBalances, rejectNamesChannel, resolveConfig, resolveExecutionCondition, resolveExpiresAt, routeFor, routePriceFor, rpcFetch, rpcTransport, sameSettlementAddress, sealExchange, sealRequest, sealRequestWithRandomness, sealResponse, sealResponseWithRandomness, selectTransport, send, sendJob, sendTransfer, serializeBtpMessage, serializeIlpFulfill, serializeIlpPrepare, serializeIlpReject, settlementToTerms, signSolanaWireTransaction, solanaKeypair, sortParticipants, spawnAnt, toEnvelopeRequest, trimTrailingSlashes, validateMnemonic, withRetry, writeKeystoreFile };
6697
+ export { ACCUMULATED_COST_HEADER, ACCUMULATED_COST_PROTOCOL, ARNS_KIND, type AntSpawnOutcome, type AntSpawnParams, type AntSpawnRefused, type AntSpawnStep, type AntSpawned, type ArnsAntPrepareReceipt, type ArnsBuyOutcome, type ArnsBuyParams, type ArnsBuyReceipt, type ArnsNameType, type ArnsNameWithAntOutcome, type ArnsNetwork, type BTPMessage, BTPMessageType, type BTPProtocolData, type BalanceProofParams, BtpAuthError, type BtpChannelDeclaration, BtpConnectionError, type BtpPacketResponse, BtpPaidWriteTransport, type BtpPaidWriteTransportConfig, BtpRuntimeClient, type BtpRuntimeClientConfig, CLAIM_ACK_HEADER, CLAIM_ACK_PROTOCOL, CLAIM_REJECT_CODE, CLAIM_REJECT_REASONS, type ChainKind, type ChainMetadata, type ChainSigner, ChainUnavailableError, type ChannelBinding, type ChannelBindingContext, type ChannelClient, type ChannelFacade, type ChannelFacadeDeps, ChannelFundingError, ChannelManager, type ChannelManagerConfig, ChannelNotOpenError, ChannelResumeError, type ChannelState, type ChannelStatus, type ChannelStore, type ChannelStoreEntry, type ChannelTerms, type ClaimAck, type ClaimMessage, type ClaimSendingTransport$1 as ClaimSendingTransport, type ClaimStateFailed, type ClaimStateOk, type ClaimStateRequestEntry, type ClaimStateResult, type ClaimSummary, ClientChannelFacade, ClientWalletFacade, ConfigError, type ConnectorChainSettlementTerms, ConnectorEdgeClient, type ConnectorEdgeClientConfig, ConnectorEdgeError, type ConnectorEdgeErrorCode, ConnectorError, type ConnectorIdentity, type ConnectorRoutePrice, type ConnectorRouteTerms, type ConnectorSettlementTerms, type ConnectorSolanaSettlementTerms, type CounterpartyVerdict, DEFAULT_DEPOSIT, DEFAULT_SETTLEMENT_TIMEOUT, DEFAULT_TIMEOUT_MS, DEVNET, type Decoded, type DeriveIdentityOptions, type DerivedIdentity, type DevnetNode, ERC20_ABI, type EVMClaimMessage, type EdgeIdentity, type EncryptedKeystore, type EnsureChannelOptions, type Envelope, EnvelopeError, EnvelopeErrorKind, type EnvelopeHeader, type EnvelopeRequest, type EnvelopeResponse, type EvmChannelRecord, type EvmReadConsistencyConfig, EvmSigner, type ExchangeOutcome, FULFILLMENT_MISMATCH_CODE, FULFILLMENT_MISMATCH_MESSAGE, type FaucetChain, type FundWalletOptions, type FundWalletResult, GIFTWRAP_NONCE_LENGTH, GIFTWRAP_PUBLIC_KEY_LENGTH, GIFTWRAP_SECRET_LENGTH, GIFTWRAP_TYPE_REQUEST, GIFTWRAP_TYPE_RESPONSE, type GasStationExecuteReceipt, type GasStationFailureReason, type GasStationFailureReceipt, type GasStationQuoteReceipt, type GasStationReceipt, type GiftWrapEcdh, GiftWrapError, GiftWrapErrorKind, HS_HOSTNAME_MAX_LENGTH, HS_HOSTNAME_REGEX, HttpIlpClient, type HttpIlpClientConfig, type ILPFulfillPacket, ILPPacketType, type ILPPreparePacket, type ILPRejectPacket, type ILPResponsePacket, ILP_CLAIM_HEADER, ILP_PEER_ID_HEADER, type IlpClient, type IlpResponseMeta, type IlpSendParams, type IlpSendResult, type IlpSendResultWithFulfillment, InMemoryChannelStore, InsufficientBalanceError, InvalidAddressError, IsomorphicBtpClient, type JobAnswer, type JobEndpoint, type JobEvent, type JobEventParams, type JobSender, JsonFileChannelStore, KEYSTORE_VERSION, type KeyDerivationScheme, MIN_SETTLEMENT_TIMEOUT_SECONDS, NetworkError, type NodeSelfDescription, OerError, OerErrorKind, OnChainChannelClient, type OnChainChannelClientConfig, type OnChainChannelStatus, type OpenChannelOptions, type OpenChannelParams, type OpenChannelResult, type OpenOrAdoptParams, type OpenedKeystore, type OpenedRequest, PACKET_EXPIRY_HEADROOM_MS, PAYMENT_REQUIRED_HEADER, PAYMENT_REQUIRED_PROTOCOL, type PaidWriteTransport, type ParsedX402Challenge, PaymentRequiredError, type PaymentTerms, type RequiredTransport, type ResolvedConfig, type ResolvedIdentity, type ResponseHeaderSource, type RetryOptions, type RouteCharge, RouteNotPricedError, type RoutePrice, type RpcTransportOptions, SOLANA_GAS_KIND, type SealedExchange, type SealedRequest, SealedResponseError, type SealedResponseErrorKind, type SendContext, type SendFulfilled, type SendOptions, type SendRefused, type SendRequest, type SendResult, type SendTransferParams, type SendTransferResult, type SignedBalanceProof, type SolanaChannelConfig, type SolanaClaimMessage, type Signer as SolanaKeypair, type SolanaNetwork, SolanaSigner, type SolanaWireTransaction, StaleRpcReadError, TOKEN_NETWORK_ABI, TOKEN_NETWORK_REGISTRY_ABI, TokenNetworkClient, type TokenNetworkClientConfig, type ToonChannelAccept, ToonClient, type ToonClientConfig, ToonClientError, type ToonClientLike, type ToonIdentity, type TransferConfig, TransferNotDeliveredError, TransferUnsupportedError, type TransportChoice, type TransportPreference, TransportRequiredError, type TxRef, UnknownChainError, ValidationError, type WalletBalance, type WalletBalanceSources, type WalletChainBalances, type WalletFacade, type WalletFacadeDeps, type WalletTokenAmount, type WriteKeystoreOptions, type X402ChannelExtra, addressFor, assertRoutableHsHostname, buildJobEvent, buildResponseMeta, buyArnsName, buyArnsNameWithNewAnt, chainUnavailableMessage, chargeFor, connectorEdgeBaseUrl, counterpartyMatch, decodeAccumulatedCost, decodeBase64Text, decodeClaimAck, decodeEnvelope, decodeEnvelopeRequest, decodeEnvelopeResponse, decodePaymentRequired, decodeVarOctetString, decodeVarUint, decryptMnemonic, defaultDestinationFor, defaultFaucetTimeout, defaultRpcUrl, deriveEvmChannelId, deriveFulfillment, deriveFullIdentity, deserializeIlpPacket, deserializeIlpPrepare, encodeEnvelope, encodeEnvelopeRequest, encodeEnvelopeResponse, encodeVarOctetString, encodeVarUint, encryptMnemonic, envelopeHeader, evmDerivationPath, evmIdentityFromKey, fundWallet, generateKeystore, generateMnemonic, generateRandomIdentity, generateSolanaKeypair, giftWrapPublicKey, httpEndpointToBtpUrl, importKeystore, isGasStationFailure, isHiddenServiceUrl, isInsufficientGasError, isRoutableHsHostname, isUnknownChannelReject, jobEventParam, keystoreDerivation, loadKeystore, localGiftWrapEcdh, looksLikeSealedResponse, mapIlpResponse, openKeystore, openRequest, openResponse, parseBtpMessage, parseEvmChainId, parsePaymentTerms, parseSelfDescription, parseSettlementEntry, parseSolanaWireTransaction, parseX402Body, parseX402Challenge, patchSolanaRecentBlockhash, readBaseUnits, readResponseMeta$1 as readBtpResponseMeta, readEvmNativeBalance, readEvmTokenBalance, readExchangeOutcome, readResponseMeta, readSolanaNativeBalance, readSolanaTokenBalance, readWalletBalances, rejectNamesChannel, resolveConfig, resolveExpectedFulfillment, resolveExpiresAt, routeFor, routePriceFor, rpcFetch, rpcTransport, sameSettlementAddress, sealExchange, sealRequest, sealRequestWithRandomness, sealResponse, sealResponseWithRandomness, selectTransport, send, sendJob, sendTransfer, serializeBtpMessage, serializeIlpFulfill, serializeIlpPrepare, serializeIlpReject, settlementToTerms, signSolanaWireTransaction, solanaKeypair, sortParticipants, spawnAnt, toEnvelopeRequest, trimTrailingSlashes, validateMnemonic, withRetry, writeKeystoreFile };
package/dist/index.js CHANGED
@@ -98,7 +98,6 @@ import {
98
98
  decodeVarUint,
99
99
  defaultDestinationFor,
100
100
  defaultFaucetTimeout,
101
- deriveCondition,
102
101
  deriveEvmChannelId,
103
102
  deriveFulfillment,
104
103
  deserializeIlpPacket,
@@ -139,7 +138,7 @@ import {
139
138
  readWalletBalances,
140
139
  rejectNamesChannel,
141
140
  resolveConfig,
142
- resolveExecutionCondition,
141
+ resolveExpectedFulfillment,
143
142
  resolveExpiresAt,
144
143
  routeFor,
145
144
  routePriceFor,
@@ -165,7 +164,7 @@ import {
165
164
  toHex,
166
165
  trimTrailingSlashes,
167
166
  withRetry
168
- } from "./chunk-A3JKQOWQ.js";
167
+ } from "./chunk-GDWZ736I.js";
169
168
  import {
170
169
  DEVNET,
171
170
  HS_HOSTNAME_MAX_LENGTH,
@@ -775,7 +774,6 @@ export {
775
774
  defaultDestinationFor,
776
775
  defaultFaucetTimeout,
777
776
  defaultRpcUrl,
778
- deriveCondition,
779
777
  deriveEvmChannelId,
780
778
  deriveFulfillment,
781
779
  deriveFullIdentity,
@@ -832,7 +830,7 @@ export {
832
830
  readWalletBalances,
833
831
  rejectNamesChannel,
834
832
  resolveConfig,
835
- resolveExecutionCondition,
833
+ resolveExpectedFulfillment,
836
834
  resolveExpiresAt,
837
835
  routeFor,
838
836
  routePriceFor,