Skip to content

feat(nearintents/session): bind the funding quote to the session key (version 2) - #412

Draft
IkerAlus wants to merge 1 commit into
tempoxyz:mainfrom
IkerAlus:nearintents-session-v2
Draft

IkerAlus wants to merge 1 commit into
tempoxyz:mainfrom
IkerAlus:nearintents-session-v2

Conversation

@IkerAlus

Copy link
Copy Markdown
Contributor

Reworks the nearintents session draft into version 2 of its challenge and credential formats. It closes a weakness in the current spec: every 402 carried a live quote, and the client named its session key and refund destination only in open, after depositing. The deposit hash is public, so a copy of the challenge was enough to open the session with another key and take the deposit as the refund. This was found while building a prototype against the spec.

Only draft-nearintents-session-00 changes. The core draft, the charge draft and scripts/gen_problems.py are untouched.

Session: draft-nearintents-session-00, edited in place

  • Version. Challenges carry methodDetails.version: 2, as STYLE.md asks for a breaking method change. The single-step flow is withdrawn.
  • Two challenge forms. An unquoted challenge states the merchant's terms and limits and costs no 1Click call. A payable challenge carries the funding quote and one binding: a session key with its refund destination, or an existing session for a top-up.
  • quote action. New and unsigned. The client names its session key, refund destination, deposit asset, origin refund address and the value to fund. The server answers 402 with payment-action-required and the payable challenge.
  • Open and top-up. open no longer carries the key or the refund destination; they come from the challenge, and only the bound key can open. A top-up challenge is bound to its session, and the unauthenticated top-up path is removed.
  • Price per request. A session fixes its currency, recipient and stored terms. Each paid request is priced by the current challenge of the resource it calls, which the server checks.
  • Echoed challenge. A voucher echoes a current challenge of the requested resource, close any current session challenge. Their signatures do not cover it, so an expired challenge is replaced without signing again.
  • Expiry. funding.deadline is the deposit cutoff. The challenge expires at least 24 hours later, so no credential is ever presented for an expired challenge, as the core draft requires.
  • Unclaimed deposits. A deposit that never becomes a session or a credit is returned to the payer's origin refund address when its challenge expires. The 30-day hold and the merchant recovery address are gone.
  • Settlement. INCOMPLETE_DEPOSIT is pending, not terminal. The payable challenge, not the transaction hash, is the unit of settlement. Servers complete a detected top-up on their own.
  • Limits. minDeposit (required) and maxFunded (optional); the client chooses the deposit size within them.
  • Signing. New domain mpp-nearintents-session-v2. The five test vectors are regenerated from the published test seed.
  • Security Considerations. Rewritten section on deposit claims and challenge binding, a list of checks the client makes before depositing, denial of service (anonymous requests mint no quote, quote actions are rate limited), and a note on value passing through the merchant's account.
  • Registry and wording. session/insufficient-value is attributed to the session intent, matching gen_problems.py. The credential header follows the field selection of feat(core): define how Payment composes with other authentication #404. Session challenges do not carry digest.

Points worth a reviewer's attention

  • An accepted quote credential is answered with a 402 and a new challenge, not a receipt.
  • The quote action is unsigned. The protection is the binding in the payable challenge, which the client verifies before paying and the server enforces at open.
  • A payable challenge's expires is the end of the claim window, not the quote deadline as in the charge draft.
  • Three stated differences from draft-nearintents-charge-01: the origin refund address always comes from the payer, INCOMPLETE_DEPOSIT is not terminal, and no transaction hash is claimed as in-flight.

Compatibility

Breaking for implementations of the earlier text. None is known in production; the one prototype is being updated.

Still depends on #394 for the session intent this draft implements.

Significant AI assistance (Claude Code) was used in drafting and reviewing this change, including one independent adversarial review pass; all content was reviewed by the author.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant