@ledgerhq/agent-intent-sdk 0.2.0 → 0.3.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/README.md CHANGED
@@ -305,9 +305,21 @@ await candidate.deliver(completion); // resolves after the host acknowledges
305
305
  was lost (for example, the relay dropped the socket during device approval).
306
306
  If a delivery fails, for example because `authenticate` rejected it or the
307
307
  acknowledgement timed out, `deliver()` may be retried on the same candidate. Each
308
- retry opens a fresh session with a new ephemeral key, and a newly connecting
309
- candidate replaces one that has not delivered yet. A retry fails once the host has
310
- finished, closed, or timed out.
308
+ retry opens a fresh session with a new ephemeral key. A retry fails once the host
309
+ has finished, closed, or timed out.
310
+
311
+ As observed (this is not a documented relay contract), the Trustchain relay runs
312
+ a channel as one host and one candidate: it refuses a third socket and, when
313
+ either side leaves, closes the other about a second later. Except while a
314
+ completion is being authenticated or persisted, the host then reopens its socket
315
+ on the same key, at once after the first drop and with a backoff after later
316
+ ones (see [Security and timeouts](#security-and-timeouts)), so a reviewer who
317
+ leaves the page can come back while the request is unexpired. A candidate that
318
+ connects before the host is back is rejected by the relay with "The enrollment
319
+ relay rejected the session."; a `connect()` or `deliver()` retry succeeds once
320
+ the host has reconnected. After repeated quick drops the host can be away for up
321
+ to 5 seconds of backoff plus the relay's close delay of about 1.5 seconds, so
322
+ retry for at least 7 seconds.
311
323
 
312
324
  ### Recovery
313
325
 
@@ -339,6 +351,137 @@ request it accepts only a version-2 completion. `serializeAgentRecoveryCompletio
339
351
  frontend. The channel binding is optional and signed; an unbound recovery
340
352
  request keeps its earlier canonical bytes.
341
353
 
354
+ ### Rejection
355
+
356
+ When the user rejects an enrollment or recovery request, the frontend tells the
357
+ agent instead of leaving it to wait until the request expires:
358
+
359
+ ```ts
360
+ await candidate.reject(); // resolves after the host acknowledges the rejection
361
+ ```
362
+
363
+ On the host, `waitForCompletion` then rejects with
364
+ `AgentEnrollmentRejectedError`, whose `kind` is `"enrollment"` or `"recovery"`.
365
+ Nothing was authenticated or persisted. `isAgentEnrollmentRejectedError` checks
366
+ for an `Error` with that `name` and a valid `kind` rather than using
367
+ `instanceof`, so it also matches an error from another realm of the same process
368
+ or another copy of the SDK. An error that went through a structured clone, such
369
+ as `postMessage` to a worker, keeps neither its `name` nor its `kind`, so it no
370
+ longer matches:
371
+
372
+ ```ts
373
+ try {
374
+ await host.waitForCompletion({ request, authenticate, persist });
375
+ } catch (error) {
376
+ if (!isAgentEnrollmentRejectedError(error)) throw error;
377
+ console.log(`The user rejected this ${error.kind} request.`);
378
+ }
379
+ ```
380
+
381
+ `reject()` connects first when no session is open, completes the
382
+ key-confirmation handshake like `deliver()`, and waits for the acknowledgement.
383
+ The handshake is bounded by `handshakeTimeoutMs`, the acknowledgement by
384
+ `acknowledgementTimeoutMs`, and both by `completionTimeoutMs` and the request
385
+ expiry. Its promise reports its own errors, never a delivery's: "Enrollment
386
+ rejection acknowledgement timed out.", "Enrollment rejection timed out."
387
+ (`completionTimeoutMs` or the request expiry), "Enrollment relay closed before
388
+ the rejection was sent." (during the handshake), and "Enrollment relay closed
389
+ before the rejection was acknowledged.". Once the host acknowledges, the
390
+ candidate is done: `connect()`, `deliver()` and `reject()` throw "This
391
+ enrollment request has already been rejected.". Like `deliver()`, `reject()`
392
+ throws synchronously when the candidate was closed, a delivery or rejection is
393
+ already running, or the request has expired.
394
+
395
+ After any other failure, `reject()` may be retried on a fresh session, for
396
+ example after the relay refused a candidate that arrived before the host
397
+ reconnected. A failed `reject()` does not prove the host kept waiting: when the
398
+ relay drops the host just as the rejection arrives, the host still honors it but
399
+ its acknowledgement is lost, and a retry then finds no host. A host that never
400
+ got the rejection waits until its timeouts or the request expiry.
401
+
402
+ Never call `reject()` once the device has committed the enrollment to the
403
+ Trustchain (the AddMember step): a rejection cannot undo that commit. The SDK
404
+ cannot see the device step, so the caller must enforce this rule, and keep
405
+ enforcing it across page reloads: a new candidate does not know that an earlier
406
+ one committed. As a safety net, `reject()` throws once `deliver()` has been
407
+ called on that candidate, even if the delivery failed, and the host refuses a
408
+ rejection, from any candidate, once it has received a well-formed completion
409
+ for this request. A completion that never reached the host leaves it accepting
410
+ rejections. The host counts a completion as received once it parses, before
411
+ `authenticate` runs, so a completion that then fails authentication, even
412
+ transiently, still makes it refuse later rejections. Parsing does not prove the
413
+ device committed, since anyone holding the link can build a well-formed
414
+ completion, but the host cannot tell a forged completion from a committed one
415
+ that failed to authenticate. Refusing costs at most a wait until the request
416
+ expires; a rejection honored after a commit would leave a Trustchain member
417
+ that its agent treats as rejected. That refusal is final: `reject()` fails with "The
418
+ enrollment host already received a completion for this request; it can no
419
+ longer be rejected." and later calls throw the same error, so retries do not
420
+ keep making the relay drop the host, each drop delaying its next reopening.
421
+
422
+ The relay forwards only the messages of its own protocol, in the order that
423
+ protocol expects, and refuses anything else, so a rejection travels like a
424
+ completion: the candidate sends it as `TrustchainShareCredential` and the host
425
+ acknowledges it with `TrustchainAddedMember`. Both carry `{"encrypted":…}` and are bound to the
426
+ signed request like every other channel message. Only a rejection and its
427
+ acknowledgement carry a `reason`; a completion carries `completion`, and its
428
+ acknowledgement `acknowledged` and `digest`. Each side accepts only the body it
429
+ waits for, so neither takes a rejection for a completion or the reverse.
430
+
431
+ The host turns a rejection or a completion down with a `Failure`. The relay
432
+ reads a `Failure` as `{"type":…,"message":…}`, with a `type` from its own list,
433
+ so the host's `Failure` has the type `UNEXPECTED_SHARE_CREDENTIAL` and carries
434
+ its ciphertext in `message`, which the relay forwards untouched. As observed, the
435
+ relay then closes both sides, so nothing follows a `Failure` on that socket.
436
+
437
+ | Direction | Message | Payload | Encrypted body | Meaning |
438
+ | ---------------- | --------------------------- | --------------------------------------------------------- | ------------------------------------- | ------------------------------------------------------------------------------------- |
439
+ | candidate → host | `TrustchainShareCredential` | `{"encrypted":…}` | `{"reason":"user-rejected"}` | The user rejected the request. |
440
+ | host → candidate | `TrustchainAddedMember` | `{"encrypted":…}` | `{"reason":"rejection-acknowledged"}` | The host accepted the rejection and ended its session. |
441
+ | host → candidate | `Failure` | `{"type":"UNEXPECTED_SHARE_CREDENTIAL","message":…}` | `{"reason":"completion-received"}` | The host refused the rejection: it already received a completion. |
442
+ | host → candidate | `Failure` | `{"type":"UNEXPECTED_SHARE_CREDENTIAL","message":…}` | `{"reason":"reset"}` | The host turned down a completion or an unexpected frame, and dropped this candidate. |
443
+ | relay → either | `Failure` | `{"type":"…","message":"…"}`, from the all-zero publisher | none | The relay refused the session. |
444
+
445
+ The candidate reads a `Failure` as the host's only when it comes from the host
446
+ key, has the type `UNEXPECTED_SHARE_CREDENTIAL`, and decrypts. Any other
447
+ `Failure` is the relay's own and fails the session with "The enrollment relay
448
+ rejected the session.". Because the relay closes right after a `Failure`, the
449
+ candidate reads the frames it already received before it reports the close.
450
+ While rejecting, the candidate treats only `rejection-acknowledged` as success
451
+ and `completion-received` as the final refusal. Any other host `Failure`, such
452
+ as `reset`, makes `reject()` fail with "The enrollment host reset this
453
+ session.", which a retry on a fresh session may overcome.
454
+
455
+ A host whose SDK predates rejection reads the rejection as a malformed
456
+ completion and answers with a `Failure` the relay refuses, so `reject()` fails
457
+ with a relay error and that host keeps waiting within its usual
458
+ `candidateTimeoutMs`, `completionTimeoutMs` and the request expiry. Callers that
459
+ must not wait, such as a page the user is leaving, bound `reject()` themselves.
460
+
461
+ The host accepts a rejection only from the candidate that completed key
462
+ confirmation on its current socket, and only while it has received no
463
+ well-formed completion for this request. A rejection that does not decrypt,
464
+ comes from another key, arrives before key confirmation, carries another reason,
465
+ or carries anything besides its `reason` is handled like any unexpected frame:
466
+ it never ends the host session, but the host drops its current candidate, even a
467
+ confirmed one, and waits for another. So is any `Failure` the host receives,
468
+ which is always the relay's. A forged frame can therefore interrupt a reviewer,
469
+ who then rejects again on a fresh session, but cannot reject the request. A
470
+ rejection that arrives while a completion is being authenticated or persisted
471
+ waits behind it and has no effect. Frames from the confirmed candidate that the
472
+ host reads after the relay dropped its socket get no answer, but still count: a
473
+ rejection ends the session, and a well-formed completion, which the host then
474
+ neither authenticates nor persists, makes it refuse later rejections. After
475
+ accepting a rejection, the host acknowledges it, stops its timers and keepalive,
476
+ closes its socket, and does not reconnect; the relay closing the host afterwards
477
+ does not change the error.
478
+
479
+ Anyone who holds the signed link can complete the key-confirmation handshake, so
480
+ anyone who holds it can also reject the request, or send a well-formed
481
+ completion that makes the host refuse rejections. The link already grants that
482
+ much: it is what lets its holder reach the agent at all. The relay cannot forge
483
+ a rejection, because it never holds the channel key.
484
+
342
485
  ### Security and timeouts
343
486
 
344
487
  The channel key and every encrypted envelope are bound to the exact signed
@@ -352,11 +495,37 @@ handshake and the delivered completion (device approval) is bounded only by
352
495
  the candidate. Applications may override these with the `timeouts` option.
353
496
  While a session is open, both sides send the relay a text `ping` every 60
354
497
  seconds, because the Trustchain relay drops a client after 5 minutes without a
355
- frame sent to it. A failed `authenticate` call rejects only that delivery, so
356
- the same or a later candidate can complete the same bounded host session. A
357
- persistence failure closes the session without acknowledging. If enrollment was
358
- committed before delivery failed, re-enroll the agent with a channel-bound
359
- recovery request.
498
+ frame sent to it. The host also expects a frame back within 10 seconds of each
499
+ ping, normally the relay's `pong`; otherwise it treats the socket as dropped,
500
+ closes it, and reconnects as described below. A failed `authenticate` call
501
+ rejects only that delivery, so the same or a later candidate can complete the
502
+ same bounded host session. A persistence failure closes the session without
503
+ acknowledging. If enrollment was committed before delivery failed, re-enroll the
504
+ agent with a channel-bound recovery request.
505
+
506
+ The host does not limit how often it reopens its relay socket. It reopens at
507
+ once after the first drop, then after 1, 2 and 4 seconds, then every 5 seconds.
508
+ A reopened socket that fails before connecting, a handshake timeout, and a
509
+ missed ping reply follow the same backoff. A socket that stayed open for at
510
+ least 60 seconds before it was lost restarts the backoff; a missed ping reply is
511
+ detected at least 70 seconds after the socket opened, so the host reopens at
512
+ once after one. That window uses a monotonic clock, so a wall-clock change does
513
+ not move it. A candidate that does not finish the handshake within
514
+ `handshakeTimeoutMs` no longer fails the host: the host closes that socket and
515
+ reopens it like a relay drop, with a fresh wait for the next candidate.
516
+ Reconnecting never extends `completionTimeoutMs` or the request expiry. The host
517
+ stops and fails the session when:
518
+
519
+ - the request expires or `completionTimeoutMs` elapses;
520
+ - no candidate connects within `candidateTimeoutMs`, a wait that restarts on
521
+ each reconnect after a candidate had connected;
522
+ - `close()` is called;
523
+ - the initial socket fails before it opens;
524
+ - persistence fails, or a socket is lost while a completion is being
525
+ authenticated or persisted.
526
+
527
+ Before each reopen the host also checks the signed request expiry against the
528
+ wall clock, so it does not reconnect after a laptop slept past the expiry.
360
529
 
361
530
  The channel sends only the agent public key, App-18 Trustchain ID, and safe
362
531
  App-16 environment/root/path references. It must never carry a serialized
@@ -1,3 +1,4 @@
1
+ import { AgentIntentSdkError } from "./bytes.ts";
1
2
  import { type AgentEnrollmentCompletionV2 } from "./completion.ts";
2
3
  import { type AgentEnrollmentChannelBinding, type AgentEnrollmentRequestV2 } from "./enrollment.ts";
3
4
  import { type AgentRecoveryChannelRequest, type AgentRecoveryCompletion, type AgentRecoveryRequest } from "./recovery.ts";
@@ -50,17 +51,43 @@ export type AgentEnrollmentChannelCandidate = {
50
51
  /**
51
52
  * Opens the relay session and completes the key-confirmation handshake, then
52
53
  * keeps the session open for a later `deliver()`. Resolves once the host is
53
- * reachable. Repeated calls share the open session.
54
+ * reachable. Repeated calls share the open session, and a call made while
55
+ * `deliver()` or `reject()` runs reports on that call's session.
54
56
  */
55
57
  connect(): Promise<void>;
56
58
  /**
57
59
  * Sends the serialized completion and resolves once the host acknowledges it.
58
- * Connects first when no session is open. After a rejection the candidate may
59
- * retry on a fresh session while the signed request is unexpired.
60
+ * Connects first when no session is open. After the host turns a delivery down
61
+ * the candidate may retry on a fresh session while the signed request is unexpired.
60
62
  */
61
63
  deliver(completionPayload: string): Promise<void>;
64
+ /**
65
+ * Tells the host that the user rejected the signed request and resolves once
66
+ * the host acknowledges it; the candidate is then unusable. Connects first
67
+ * when no session is open. Never call it once the device has committed the
68
+ * enrollment to the Trustchain: a rejection cannot undo that commit. The caller
69
+ * must remember that commit across page reloads, because a new candidate cannot
70
+ * know it. It throws once `deliver()` has been called, and fails for good once
71
+ * the host answers that it already received a completion for this request.
72
+ * After any other failure the host may still have honored the rejection, and
73
+ * `reject()` may be retried on a fresh session.
74
+ */
75
+ reject(): Promise<void>;
62
76
  close(): void;
63
77
  };
78
+ /** The user rejected the signed enrollment or recovery request in the frontend. */
79
+ export declare class AgentEnrollmentRejectedError extends AgentIntentSdkError {
80
+ readonly kind: "enrollment" | "recovery";
81
+ constructor(kind: "enrollment" | "recovery");
82
+ }
83
+ /**
84
+ * Checked by shape rather than `instanceof`, so an error from another copy of the SDK or another
85
+ * realm of the same process still matches. It must still be a real `Error`, which `Error.isError`
86
+ * tells across realms. Where it is missing, `Object.prototype.toString` stands in, which an object
87
+ * can fool through `Symbol.toStringTag`. A structured clone, such as `postMessage` to a worker,
88
+ * keeps neither the name nor `kind`, so a cloned error does not match.
89
+ */
90
+ export declare function isAgentEnrollmentRejectedError(error: unknown): error is AgentEnrollmentRejectedError;
64
91
  export declare function createAgentEnrollmentChannelHost(input: {
65
92
  environment: AgentEnrollmentChannelBinding["environment"];
66
93
  relayBaseUrl: string;
@@ -80,6 +107,8 @@ export declare const enrollmentChannelCryptoVectors: {
80
107
  deriveKey: (sharedSecret: Uint8Array, request: AgentEnrollmentChannelRequest) => string;
81
108
  aad: (request: AgentEnrollmentChannelRequest, envelope: Pick<RelayEnvelope, "version" | "publisher" | "message">) => string;
82
109
  encrypt: (sharedSecret: Uint8Array, request: AgentEnrollmentChannelRequest, envelope: Pick<RelayEnvelope, "version" | "publisher" | "message">, payload: object, nonce: Uint8Array) => Promise<string>;
110
+ /** The whole relay frame, as the channel sends it. */
111
+ envelope: (sharedSecret: Uint8Array, request: AgentEnrollmentChannelRequest, envelope: Pick<RelayEnvelope, "version" | "publisher" | "message">, payload: object, nonce: Uint8Array) => Promise<string>;
83
112
  };
84
113
  export {};
85
114
  //# sourceMappingURL=enrollmentChannel.d.ts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