uvd-x402-sdk 2.87.0 → 2.89.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.
Files changed (73) hide show
  1. package/README.md +235 -0
  2. package/dist/adapters/index.d.mts +1 -1
  3. package/dist/adapters/index.d.ts +1 -1
  4. package/dist/adapters/index.js.map +1 -1
  5. package/dist/adapters/index.mjs.map +1 -1
  6. package/dist/backend/index.d.mts +2 -2
  7. package/dist/backend/index.d.ts +2 -2
  8. package/dist/backend/index.js +138 -0
  9. package/dist/backend/index.js.map +1 -1
  10. package/dist/backend/index.mjs +137 -1
  11. package/dist/backend/index.mjs.map +1 -1
  12. package/dist/erc8128/index.js.map +1 -1
  13. package/dist/erc8128/index.mjs.map +1 -1
  14. package/dist/{index-D8buGZWY.d.mts → index-13ZUDF7c.d.mts} +32 -2
  15. package/dist/{index-CWZUj5mz.d.ts → index-B5B9EK3x.d.ts} +32 -2
  16. package/dist/{index-DOBhTF-j.d.mts → index-BWN0Haa0.d.mts} +476 -2
  17. package/dist/{index-DOBhTF-j.d.ts → index-BWN0Haa0.d.ts} +476 -2
  18. package/dist/{index-BHfYxpzI.d.mts → index-CAJg-_cr.d.mts} +181 -2
  19. package/dist/{index-D67eNxY8.d.ts → index-Cd1Mpznb.d.ts} +181 -2
  20. package/dist/index.d.mts +4 -4
  21. package/dist/index.d.ts +4 -4
  22. package/dist/index.js +472 -8
  23. package/dist/index.js.map +1 -1
  24. package/dist/index.mjs +464 -9
  25. package/dist/index.mjs.map +1 -1
  26. package/dist/providers/algorand/index.d.mts +1 -1
  27. package/dist/providers/algorand/index.d.ts +1 -1
  28. package/dist/providers/algorand/index.js.map +1 -1
  29. package/dist/providers/algorand/index.mjs.map +1 -1
  30. package/dist/providers/evm/index.d.mts +1 -1
  31. package/dist/providers/evm/index.d.ts +1 -1
  32. package/dist/providers/evm/index.js.map +1 -1
  33. package/dist/providers/evm/index.mjs.map +1 -1
  34. package/dist/providers/near/index.d.mts +1 -1
  35. package/dist/providers/near/index.d.ts +1 -1
  36. package/dist/providers/near/index.js.map +1 -1
  37. package/dist/providers/near/index.mjs.map +1 -1
  38. package/dist/providers/solana/index.d.mts +1 -1
  39. package/dist/providers/solana/index.d.ts +1 -1
  40. package/dist/providers/solana/index.js.map +1 -1
  41. package/dist/providers/solana/index.mjs.map +1 -1
  42. package/dist/providers/stellar/index.d.mts +1 -1
  43. package/dist/providers/stellar/index.d.ts +1 -1
  44. package/dist/providers/stellar/index.js.map +1 -1
  45. package/dist/providers/stellar/index.mjs.map +1 -1
  46. package/dist/providers/sui/index.d.mts +1 -1
  47. package/dist/providers/sui/index.d.ts +1 -1
  48. package/dist/providers/sui/index.js.map +1 -1
  49. package/dist/providers/sui/index.mjs.map +1 -1
  50. package/dist/providers/xrpl/index.d.mts +1 -1
  51. package/dist/providers/xrpl/index.d.ts +1 -1
  52. package/dist/providers/xrpl/index.js.map +1 -1
  53. package/dist/providers/xrpl/index.mjs.map +1 -1
  54. package/dist/react/index.d.mts +3 -3
  55. package/dist/react/index.d.ts +3 -3
  56. package/dist/react/index.js +463 -8
  57. package/dist/react/index.js.map +1 -1
  58. package/dist/react/index.mjs +463 -8
  59. package/dist/react/index.mjs.map +1 -1
  60. package/dist/react/picker/index.d.mts +1 -1
  61. package/dist/react/picker/index.d.ts +1 -1
  62. package/dist/utils/index.d.mts +2 -2
  63. package/dist/utils/index.d.ts +2 -2
  64. package/dist/utils/index.js.map +1 -1
  65. package/dist/utils/index.mjs.map +1 -1
  66. package/dist/{validation-mSLW4tcO.d.mts → validation-B95g0MqC.d.mts} +1 -1
  67. package/dist/{validation-C7p3a6Ep.d.ts → validation-_Tcjm2gu.d.ts} +1 -1
  68. package/package.json +1 -1
  69. package/src/backend/index.ts +260 -0
  70. package/src/client/X402Client.ts +232 -9
  71. package/src/index.ts +28 -0
  72. package/src/policy.ts +804 -0
  73. package/src/types/index.ts +41 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/erc8128/core.ts","../../src/erc8128/errors.ts","../../src/types/index.ts","../../src/erc8128/signer.ts","../../src/erc8128/verifier.ts","../../src/erc8128/presets.ts","../../src/erc8128/vectors.generated.ts","../../src/erc8128/vectors.ts","../../src/erc8128/conformance.ts"],"names":["ethers","privateKey"],"mappings":";;;;;AAkCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,aAAA,GAAgB;AAGtB,IAAM,UAAA,GAAa;AAGnB,IAAM,oBAAA,GAAuB;AAG7B,IAAM,gBAAA,GAAmB;AAGzB,IAAM,QAAA,GAAW;AAExB,IAAM,SAAA,GAAY,kBAAA;AAGX,IAAM,wBAAA,GAA8C,CAAC,SAAA,EAAW,YAAA,EAAc,OAAO;AAMrF,IAAM,iBAAA,GAAN,cAAgC,KAAA,CAAM;AAAA,EAC3C,WAAA,CACkB,MAChB,OAAA,EACA;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAHG,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAIhB,IAAA,IAAA,CAAK,IAAA,GAAO,mBAAA;AAAA,EACd;AACF;AAgEA,SAAS,YAAY,KAAA,EAAyB;AAC5C,EAAA,OAAO,OAAO,KAAA,CAAM,KAAA,KAAU,QAAA,GAC1B,CAAA,EAAG,MAAM,IAAI,CAAA,CAAA,EAAI,KAAA,CAAM,KAAK,KAC5B,CAAA,EAAG,KAAA,CAAM,IAAI,CAAA,EAAA,EAAK,MAAM,KAAK,CAAA,CAAA,CAAA;AACnC;AAQO,SAAS,qBACd,OAAA,EACQ;AACR,EAAA,IAAI,OAAO,OAAA,CAAQ,MAAA,KAAW,QAAA,SAAiB,OAAA,CAAQ,MAAA;AACvD,EAAA,MAAM,OAAA,GAAU,OAAA,CAAQ,OAAA,CAAQ,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,CAAA,EAAI,CAAC,CAAA,CAAA,CAAG,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AAC7D,EAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,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AA;AAAA,IACrB,MAAA,EAAQ,kBAAA;AAAA,IACR,OAAO,OAAA,CAAQ,MAAA;AAAA,IACf,MAAA,EAAQ,OAAA,CAAQ,MAAA,GAAS,MAAA,CAAO,MAAA;AAAA,IAChC,MAAA;AAAA,IACA,KAAA,EAAO;AAAA,GACT;AACF","file":"index.js","sourcesContent":["/**\n * uvd-x402-sdk/erc8128 — L0, the pure layer.\n *\n * Everything here is deterministic: no clock, no network, no nonce store, no\n * private key. Only `ethers` is imported, and only for hashing/base64 (the\n * package already depends on it, and it works identically in Node and the\n * browser).\n *\n * THE LOAD-BEARING RULE OF THIS FILE:\n *\n * The verifier must NEVER re-serialise `@signature-params`.\n *\n * `parseSignatureInput()` keeps the parameter substring VERBATIM from the\n * `Signature-Input` header (`paramsRaw`) and `buildSignatureBase()` accepts\n * that substring in place of a parameter list. That single byte path is what\n * makes `alg`-present, `alg`-absent, checksummed keyids, unusual parameter\n * ordering and any future RFC 9421 parameter verify with no flags at all.\n * An anchored regex that enumerates the allowed parameters is exactly the bug\n * this module exists to delete — do not reintroduce one.\n *\n * Wire contract: F3-1 pinned format + F3-3 additive cases. See\n * `erc8128.f3-1.json` / `erc8128.f3-3.json`, shipped inside this package.\n *\n * Reference:\n * - ERC-8128: https://eip.tools/eip/8128\n * - RFC 9421: https://www.rfc-editor.org/rfc/rfc9421\n * - RFC 9530 (Content-Digest): https://www.rfc-editor.org/rfc/rfc9530\n */\n\nimport { ethers } from 'ethers';\n\nimport type { Erc8128Code } from './errors';\n\n/** Generation of the wire contract this module implements. */\nexport const WIRE_CONTRACT_VERSION = 'F3-3';\n\n/** Default signature label (F3-1). */\nexport const DEFAULT_LABEL = 'eth';\n\n/** The only algorithm this module signs with or verifies. */\nexport const ALG_EIP191 = 'eip191';\n\n/** Default validity window in seconds; server policy caps at the same value. */\nexport const DEFAULT_VALIDITY_SEC = 300;\n\n/** Default EVM chain id for the keyid (Base mainnet). */\nexport const DEFAULT_CHAIN_ID = 8453;\n\n/** `erc8128:<decimal chain id>:<0x + 40 hex>` — chain id is bare decimal. */\nexport const KEYID_RE = /^erc8128:(\\d+):(0x[0-9a-fA-F]{40})$/;\n\nconst WALLET_RE = /^0x[0-9a-f]{40}$/;\n\n/** Components that make a signature request-bound rather than class-bound. */\nexport const REQUEST_BOUND_COMPONENTS: readonly string[] = ['@method', '@authority', '@path'];\n\n/**\n * Parse failure of a wire value. Thrown by the pure parsers; `verifyRequest`\n * catches it and turns it into a `VerifyResult` — it never escapes there.\n */\nexport class Erc8128ParseError extends Error {\n constructor(\n public readonly code: Erc8128Code,\n message: string\n ) {\n super(message);\n this.name = 'Erc8128ParseError';\n }\n}\n\n/** One `@signature-params` parameter. Numbers go bare, strings get quoted. */\nexport interface SigParam {\n readonly name: string;\n readonly value: string | number;\n}\n\n/**\n * Everything needed to build one RFC 9421 signature base.\n *\n * `params` is either a parameter LIST (the signer builds one) or the VERBATIM\n * parameter substring taken off the wire (the verifier passes one). Both feed\n * the same builder — that is the whole design.\n */\nexport interface CanonicalMessage {\n /** HTTP method; upper-cased by the builder. */\n readonly method: string;\n /** host[:port]. Never a URL, never derived from a client-controlled header. */\n readonly authority: string;\n /** Origin-form path; `/` when empty. */\n readonly path: string;\n /** Query string INCLUDING the leading `?`. Omit when there is none. */\n readonly query?: string;\n /** Full `sha-256=:…:` value, verbatim as it appears on the wire. */\n readonly contentDigest?: string;\n /** Covered component ids, in signing order. The order is load-bearing. */\n readonly covered: readonly string[];\n /** Parameter list (signer) or verbatim parameter substring (verifier). */\n readonly params: readonly SigParam[] | string;\n /**\n * Values for covered components that are plain header fields (anything that\n * is not a `@`-component or `content-digest`). Keys must be lowercase.\n * A covered header that is absent here resolves to the empty string, which\n * is what EM's verifier does.\n */\n readonly headers?: Readonly<Record<string, string>>;\n}\n\n/** Wire generation an emitter produced, as observed by the verifier. */\nexport type ObservedProfile = 'canonical' | 'legacy_no_alg' | 'legacy_alg_checksum_keyid';\n\n/** A parsed `Signature-Input` value. `paramsRaw` is the byte path. */\nexport interface ParsedSignatureInput {\n readonly label: string;\n readonly covered: readonly string[];\n /** VERBATIM parameter substring, `(…);created=…`. Never re-serialised. */\n readonly paramsRaw: string;\n readonly created: number;\n readonly expires: number;\n readonly nonce?: string;\n /** Original case — it is re-emitted into the signed base as-is. */\n readonly keyid: string;\n readonly chainId: number;\n /** Address from the keyid, lowercased for comparison. */\n readonly wallet: string;\n readonly alg?: string;\n readonly observedProfile: ObservedProfile;\n}\n\n// ---------------------------------------------------------------------------\n// Signature base construction\n// ---------------------------------------------------------------------------\n\nfunction formatParam(param: SigParam): string {\n return typeof param.value === 'number'\n ? `${param.name}=${param.value}`\n : `${param.name}=\"${param.value}\"`;\n}\n\n/**\n * Build the `@signature-params` value.\n *\n * When `params` is a string it is the verbatim substring off the wire and is\n * returned untouched — it already contains its own covered-component list.\n */\nexport function buildSignatureParams(\n message: Pick<CanonicalMessage, 'covered' | 'params'>\n): string {\n if (typeof message.params === 'string') return message.params;\n const compStr = message.covered.map((c) => `\"${c}\"`).join(' ');\n const parts = [`(${compStr})`, ...message.params.map(formatParam)];\n return parts.join(';');\n}\n\n/**\n * Build the RFC 9421 signature base — the exact string that is EIP-191\n * personal_signed. Lines are joined with a single LF, with no trailing\n * newline; each line is `\"<id>\": <value>` with exactly one space.\n */\nexport function buildSignatureBase(message: CanonicalMessage): string {\n const lines: string[] = [];\n\n for (const component of message.covered) {\n switch (component) {\n case '@method':\n lines.push(`\"@method\": ${message.method.toUpperCase()}`);\n break;\n case '@authority':\n lines.push(`\"@authority\": ${message.authority}`);\n break;\n case '@path':\n lines.push(`\"@path\": ${message.path}`);\n break;\n case '@query':\n // `?` is the present-but-empty fallback. Only a verifier reaches it —\n // canonical signers omit @query entirely when there is no query\n // string (spec §3.3) — but EM emits it, so it stays for bug-compat.\n lines.push(`\"@query\": ${message.query || '?'}`);\n break;\n case 'content-digest':\n lines.push(`\"content-digest\": ${message.contentDigest || ''}`);\n break;\n default:\n lines.push(`\"${component}\": ${message.headers?.[component.toLowerCase()] ?? ''}`);\n break;\n }\n }\n\n lines.push(`\"@signature-params\": ${buildSignatureParams(message)}`);\n return lines.join('\\n');\n}\n\n/**\n * The covered-component list a canonical signer emits for a request.\n * `@query` only when the URL carries one, `content-digest` only when the\n * request carries a body.\n */\nexport function selectCovered(input: { url: string; hasBody: boolean }): string[] {\n const covered = [...REQUEST_BOUND_COMPONENTS];\n const { query } = splitRequestTarget(input.url);\n if (query) covered.push('@query');\n if (input.hasBody) covered.push('content-digest');\n return covered;\n}\n\n/**\n * The pinned parameter list: `created;expires;nonce?;keyid;alg`.\n * `alg` is ALWAYS last (em_plugin_sdk/erc8128.py:262-278); pass `alg: null`\n * to emit the legacy generation that omits it.\n */\nexport function canonicalParams(input: {\n created: number;\n expires: number;\n keyid: string;\n nonce?: string;\n alg?: string | null;\n}): SigParam[] {\n const params: SigParam[] = [\n { name: 'created', value: input.created },\n { name: 'expires', value: input.expires },\n ];\n if (input.nonce) params.push({ name: 'nonce', value: input.nonce });\n params.push({ name: 'keyid', value: input.keyid });\n const alg = input.alg === undefined ? ALG_EIP191 : input.alg;\n if (alg) params.push({ name: 'alg', value: alg });\n return params;\n}\n\n/** RFC 9530 `Content-Digest` value over the exact body bytes. */\nexport function computeContentDigest(body: string | Uint8Array): string {\n const bytes = typeof body === 'string' ? ethers.toUtf8Bytes(body) : body;\n const b64 = ethers.encodeBase64(ethers.getBytes(ethers.sha256(bytes)));\n return `sha-256=:${b64}:`;\n}\n\n/**\n * `erc8128:<chainId>:<address>` with the address ALWAYS lowercased — a\n * checksummed keyid caused the v9.x silent-auth incident.\n */\nexport function canonicalKeyid(chainId: number, address: string): string {\n return `erc8128:${chainId}:${address.toLowerCase()}`;\n}\n\n/**\n * Length of the EIP-191 prefix counter for a signature base: the length in\n * UTF-8 BYTES, never UTF-16 code units.\n *\n * Named on purpose. EM's ERC-1271 path computes it with `len(message)` on a\n * Python `str` (code points), so its EOA and contract paths hash different\n * messages the moment a base carries one non-ASCII byte. This module uses\n * bytes on every path.\n */\nexport function eip191ByteLength(base: string): number {\n return ethers.toUtf8Bytes(base).length;\n}\n\n/** The exact bytes EIP-191 (version 0x45) hashes for a signature base. */\nexport function eip191Message(base: string): Uint8Array {\n const body = ethers.toUtf8Bytes(base);\n const prefix = ethers.toUtf8Bytes(`\\x19Ethereum Signed Message:\\n${body.length}`);\n const out = new Uint8Array(prefix.length + body.length);\n out.set(prefix, 0);\n out.set(body, prefix.length);\n return out;\n}\n\n// ---------------------------------------------------------------------------\n// Request target\n// ---------------------------------------------------------------------------\n\nconst DEFAULT_PORTS: Readonly<Record<string, string>> = { http: '80', https: '443', ws: '80', wss: '443' };\n\n/**\n * RFC 9421 §2.2.3 `@authority`: lowercase, and OMIT the port when it is the\n * default FOR THAT SCHEME (443 for https/wss, 80 for http/ws). A non-default\n * port is part of the authority and is kept — including `:80` under https and\n * `:443` under http, which are ordinary ports there.\n *\n * The transform is IDEMPOTENT — an authority that is already in this form\n * comes back unchanged — which is why applying it to live traffic changes no\n * signature. The alternative, replaying `netloc` verbatim, makes the SAME\n * request written two ways (`https://host/x` and `https://host:443/x`) sign\n * two different bases.\n *\n * `scheme` is REQUIRED, and deliberately so. This is the URL-derived path and\n * nothing else: the signer has the request URL, the verifier derives the\n * authority from the incoming request, so a scheme is always in hand. The\n * verifier's CONFIGURED authority does NOT come through here — it carries no\n * scheme, so \"the default port\" has no unique answer for it, and guessing one\n * breaks two real deployment shapes (`https` on `:80`, `http` on `:443`).\n * That value goes through `policyAuthority()` in the verifier, which never\n * touches ports at all.\n */\nexport function canonicalAuthority(authority: string, scheme: string): string {\n const lower = String(authority ?? '')\n .trim()\n .toLowerCase();\n const portAt = lower.lastIndexOf(':');\n // No port at all, or a bracketed IPv6 host whose colons are inside it.\n if (portAt <= lower.lastIndexOf(']')) return lower;\n\n const port = lower.slice(portAt + 1);\n const isDefault = port === DEFAULT_PORTS[String(scheme ?? '').trim().toLowerCase()];\n return isDefault ? lower.slice(0, portAt) : lower;\n}\n\n/**\n * Split a URL (absolute or origin-relative) into the `@authority`, `@path`\n * and `@query` values.\n *\n * The path and query are taken RAW: `new URL()` is deliberately avoided\n * because it percent-encodes and normalises them, which would change the\n * bytes relative to what the client signed. A lone `?` counts as no query,\n * matching every emitter in the fleet.\n *\n * The authority IS normalised, per RFC 9421 §2.2.3: lowercased, with the\n * scheme's default port removed. That is what a server sees in `Host` and\n * what every verifier compares against — `urlparse().netloc` keeps an\n * explicit `:443`, so a URL written with the default port would otherwise\n * sign an authority no verifier ever reproduces.\n */\nexport function splitRequestTarget(url: string): {\n authority?: string;\n path: string;\n query?: string;\n} {\n let rest = url;\n let authority: string | undefined;\n\n const absolute = /^([A-Za-z][A-Za-z0-9+.-]*):\\/\\/([^/?#]*)/.exec(url);\n if (absolute) {\n authority = canonicalAuthority(absolute[2], absolute[1]);\n rest = url.slice(absolute[0].length);\n }\n\n const hash = rest.indexOf('#');\n if (hash >= 0) rest = rest.slice(0, hash);\n\n const mark = rest.indexOf('?');\n const path = (mark >= 0 ? rest.slice(0, mark) : rest) || '/';\n const query = mark >= 0 ? rest.slice(mark) : '';\n\n return { authority, path, query: query.length > 1 ? query : undefined };\n}\n\n// ---------------------------------------------------------------------------\n// RFC 8941 structured-field parsing (the subset ERC-8128 needs)\n// ---------------------------------------------------------------------------\n\ninterface DictMember {\n label: string;\n /** Verbatim member value, trimmed of surrounding whitespace. */\n value: string;\n}\n\n/**\n * Split a structured dictionary into ordered members, respecting quoted\n * strings and parentheses so a comma inside either does not split a member.\n */\nfunction splitDictMembers(raw: string): DictMember[] {\n const members: DictMember[] = [];\n let i = 0;\n\n while (i < raw.length) {\n while (i < raw.length && (raw[i] === ' ' || raw[i] === '\\t' || raw[i] === ',')) i++;\n if (i >= raw.length) break;\n\n const eq = raw.indexOf('=', i);\n if (eq < 0) break;\n const label = raw.slice(i, eq).trim();\n\n let j = eq + 1;\n let depth = 0;\n let inQuotes = false;\n for (; j < raw.length; j++) {\n const ch = raw[j];\n if (inQuotes) {\n if (ch === '\\\\') j++;\n else if (ch === '\"') inQuotes = false;\n continue;\n }\n if (ch === '\"') inQuotes = true;\n else if (ch === '(') depth++;\n else if (ch === ')') depth--;\n else if (ch === ',' && depth <= 0) break;\n }\n\n members.push({ label, value: raw.slice(eq + 1, j).trim() });\n i = j + 1;\n }\n\n return members;\n}\n\n/** Pick the member a policy label selects. `'any'` prefers `eth`, else first. */\nfunction selectMember(members: DictMember[], label: string): DictMember | undefined {\n if (label === 'any') {\n return members.find((m) => m.label === DEFAULT_LABEL) ?? members[0];\n }\n return members.find((m) => m.label === label);\n}\n\nfunction unquote(value: string): string {\n return value.slice(1, -1).replace(/\\\\([\"\\\\])/g, '$1');\n}\n\n/** Split `;a=1;b=\"x\"` respecting quotes. Returns raw `name=value` chunks. */\nfunction splitParamChunks(rest: string): string[] {\n const chunks: string[] = [];\n let current = '';\n let inQuotes = false;\n\n for (let i = 0; i < rest.length; i++) {\n const ch = rest[i];\n if (inQuotes) {\n current += ch;\n if (ch === '\\\\' && i + 1 < rest.length) {\n current += rest[++i];\n } else if (ch === '\"') {\n inQuotes = false;\n }\n continue;\n }\n if (ch === '\"') {\n inQuotes = true;\n current += ch;\n continue;\n }\n if (ch === ';') {\n if (current.trim()) chunks.push(current.trim());\n current = '';\n continue;\n }\n current += ch;\n }\n if (current.trim()) chunks.push(current.trim());\n return chunks;\n}\n\n/**\n * Parse a `Signature-Input` value.\n *\n * Deliberately NOT an anchored regex over a fixed parameter list: unknown and\n * reordered parameters must survive, because the verifier replays the whole\n * substring into the signed base. Only the parameters this module needs for\n * POLICY (`created`, `expires`, `nonce`, `keyid`, `alg`) are extracted.\n *\n * @param value - raw header value\n * @param label - `'eth'` (default), a specific label, or `'any'`\n * @throws {Erc8128ParseError} on a malformed value\n */\nexport function parseSignatureInput(value: string, label = DEFAULT_LABEL): ParsedSignatureInput {\n if (typeof value !== 'string' || !value.trim()) {\n throw new Erc8128ParseError('signature_input_invalid', 'Missing Signature-Input header');\n }\n\n const member = selectMember(splitDictMembers(value), label);\n if (!member || !member.label) {\n throw new Erc8128ParseError('signature_input_invalid', 'Invalid Signature-Input format');\n }\n\n const paramsRaw = member.value;\n if (!paramsRaw.startsWith('(')) {\n throw new Erc8128ParseError('signature_input_invalid', 'Invalid Signature-Input format');\n }\n const close = paramsRaw.indexOf(')');\n if (close < 0) {\n throw new Erc8128ParseError('signature_input_invalid', 'Invalid covered component list');\n }\n\n const inner = paramsRaw.slice(1, close).trim();\n const covered = [...inner.matchAll(/\"([^\"]*)\"/g)].map((m) => m[1]);\n // Reject anything that is not a plain list of quoted tokens: an unquoted\n // token, or a per-component parameter, would resolve to bytes we do not\n // reproduce.\n if (covered.map((c) => `\"${c}\"`).join(' ') !== inner) {\n throw new Erc8128ParseError('signature_input_invalid', 'Invalid covered component list');\n }\n\n const params = new Map<string, string | number | boolean>();\n for (const chunk of splitParamChunks(paramsRaw.slice(close + 1))) {\n const eq = chunk.indexOf('=');\n if (eq < 0) {\n params.set(chunk, true);\n continue;\n }\n const name = chunk.slice(0, eq).trim();\n const raw = chunk.slice(eq + 1).trim();\n if (raw.startsWith('\"') && raw.endsWith('\"') && raw.length >= 2) {\n params.set(name, unquote(raw));\n } else if (/^-?\\d+$/.test(raw)) {\n params.set(name, Number(raw));\n } else {\n params.set(name, raw);\n }\n }\n\n const created = params.get('created');\n const expires = params.get('expires');\n if (typeof created !== 'number' || typeof expires !== 'number') {\n throw new Erc8128ParseError(\n 'signature_input_invalid',\n 'Missing or non-integer created/expires parameter'\n );\n }\n\n const keyidValue = params.get('keyid');\n if (typeof keyidValue !== 'string') {\n throw new Erc8128ParseError('signature_input_invalid', 'Missing keyid parameter');\n }\n const keyidMatch = KEYID_RE.exec(keyidValue);\n if (!keyidMatch) {\n throw new Erc8128ParseError(\n 'signature_input_invalid',\n `Invalid keyid format: ${keyidValue}`\n );\n }\n\n const nonceValue = params.get('nonce');\n const algValue = params.get('alg');\n if (algValue !== undefined && typeof algValue !== 'string') {\n throw new Erc8128ParseError('signature_input_invalid', 'Invalid alg parameter');\n }\n\n const address = keyidMatch[2];\n const wallet = address.toLowerCase();\n if (!WALLET_RE.test(wallet)) {\n throw new Erc8128ParseError('wallet_invalid', 'Invalid wallet in ERC-8128 keyid');\n }\n\n return {\n label: member.label,\n covered,\n paramsRaw,\n created,\n expires,\n nonce: typeof nonceValue === 'string' ? nonceValue : undefined,\n keyid: keyidValue,\n chainId: Number(keyidMatch[1]),\n wallet,\n alg: algValue,\n observedProfile: classifyProfile(algValue, address),\n };\n}\n\n/**\n * Which wire generation produced this signature. `alg` absence wins over a\n * checksummed keyid: it is the older split and the one the deprecation ladder\n * counts.\n */\nfunction classifyProfile(alg: string | undefined, address: string): ObservedProfile {\n if (alg === undefined) return 'legacy_no_alg';\n if (address !== address.toLowerCase()) return 'legacy_alg_checksum_keyid';\n return 'canonical';\n}\n\n/**\n * Parse a `Signature` header into the raw 65 bytes (r‖s‖v, v = 27/28).\n *\n * Standard base64 alphabet with padding — base64url is NOT accepted (spec\n * §3.6).\n *\n * @throws {Erc8128ParseError} when the header, the label or the length is wrong\n */\nexport function parseSignatureHeader(value: string, label = DEFAULT_LABEL): Uint8Array {\n if (typeof value !== 'string' || !value.trim()) {\n throw new Erc8128ParseError('signature_invalid', 'Missing Signature header');\n }\n\n const member = selectMember(splitDictMembers(value), label);\n if (!member) {\n throw new Erc8128ParseError('signature_invalid', `No signature found for label '${label}'`);\n }\n\n const match = /^:([A-Za-z0-9+/]+={0,2}):$/.exec(member.value);\n if (!match) {\n throw new Erc8128ParseError('signature_invalid', 'Invalid Signature header');\n }\n\n let bytes: Uint8Array;\n try {\n bytes = ethers.decodeBase64(match[1]);\n } catch {\n throw new Erc8128ParseError('signature_invalid', 'Invalid Signature base64 encoding');\n }\n if (bytes.length !== 65) {\n throw new Erc8128ParseError('signature_invalid', 'Ethereum signature must be 65 bytes');\n }\n return bytes;\n}\n\n/**\n * Lowercase wallet address from a `Signature-Input` value, or `null` when it\n * cannot be parsed. Never throws — this is the primitive a rate-limit\n * middleware needs BEFORE any signature work, so it must not be able to break\n * the request path.\n */\nexport function extractKeyidWallet(signatureInput: string): string | null {\n try {\n return parseSignatureInput(signatureInput, 'any').wallet;\n } catch {\n return null;\n }\n}\n","/**\n * uvd-x402-sdk/erc8128 — error taxonomy.\n *\n * The union is the SUPERSET of MeshRelay's 19 public HTTP error codes (a\n * published contract: `{ error, code }` with a per-code status) and the one\n * stable string EM's auth layer switches on (`nonce_store_unavailable` →\n * 503 + Retry-After). Adopting the SDK must not change either product's\n * response bodies, so nothing here is renamed or merged.\n *\n * These are VALUES, not exceptions: `verifyRequest` returns them. Exceptions\n * are reserved for programmer error (a policy without an authority, a signer\n * without a key).\n */\n\nexport type Erc8128Code =\n // wire / signature\n | 'signature_input_invalid'\n | 'signature_invalid'\n | 'alg_unsupported'\n | 'alg_missing'\n | 'keyid_not_lowercase'\n // nonce\n | 'nonce_invalid'\n | 'nonce_unknown'\n | 'nonce_replayed'\n | 'nonce_expired'\n | 'nonce_required'\n | 'nonce_rate_limited'\n | 'nonce_capacity'\n | 'nonce_limits_invalid'\n | 'nonce_ttl_invalid'\n | 'nonce_store_unavailable'\n // body\n | 'content_digest_required'\n | 'content_digest_invalid'\n | 'content_digest_mismatch'\n // components / binding\n | 'components_invalid'\n | 'class_bound_rejected'\n // freshness / identity\n | 'signature_stale'\n | 'chain_not_allowed'\n | 'wallet_invalid'\n | 'wallet_mismatch'\n | 'authority_invalid';\n\n/**\n * HTTP status per code. 401 unless the failure is not the caller's signature:\n * a replayed nonce is a conflict (409), issuance pressure is 429, and a store\n * or config failure is 503.\n */\nexport const ERC8128_ERROR_STATUS: Readonly<Record<Erc8128Code, number>> = Object.freeze({\n signature_input_invalid: 401,\n signature_invalid: 401,\n alg_unsupported: 401,\n alg_missing: 401,\n keyid_not_lowercase: 401,\n nonce_invalid: 401,\n nonce_unknown: 401,\n nonce_replayed: 409,\n nonce_expired: 401,\n nonce_required: 401,\n nonce_rate_limited: 429,\n nonce_capacity: 429,\n nonce_limits_invalid: 503,\n nonce_ttl_invalid: 503,\n nonce_store_unavailable: 503,\n content_digest_required: 401,\n content_digest_invalid: 401,\n content_digest_mismatch: 401,\n components_invalid: 401,\n class_bound_rejected: 401,\n signature_stale: 401,\n chain_not_allowed: 401,\n wallet_invalid: 401,\n wallet_mismatch: 401,\n authority_invalid: 503,\n});\n\n/**\n * Whether the SAME request may be retried unchanged.\n *\n * Only infrastructure pressure qualifies. A stale signature or a burnt nonce\n * is recoverable by re-signing, not by retrying — and a misconfigured\n * authority or nonce limit will not fix itself. This turns EM's\n * `reason == \"nonce_store_unavailable\"` string compare into a lookup.\n */\nexport const ERC8128_ERROR_RETRYABLE: Readonly<Record<Erc8128Code, boolean>> = Object.freeze({\n signature_input_invalid: false,\n signature_invalid: false,\n alg_unsupported: false,\n alg_missing: false,\n keyid_not_lowercase: false,\n nonce_invalid: false,\n nonce_unknown: false,\n nonce_replayed: false,\n nonce_expired: false,\n nonce_required: false,\n nonce_rate_limited: true,\n nonce_capacity: true,\n nonce_limits_invalid: false,\n nonce_ttl_invalid: false,\n nonce_store_unavailable: true,\n content_digest_required: false,\n content_digest_invalid: false,\n content_digest_mismatch: false,\n components_invalid: false,\n class_bound_rejected: false,\n signature_stale: false,\n chain_not_allowed: false,\n wallet_invalid: false,\n wallet_mismatch: false,\n authority_invalid: false,\n});\n\n/** Default human-readable message per code. Callers may override. */\nexport const ERC8128_ERROR_MESSAGE: Readonly<Record<Erc8128Code, string>> = Object.freeze({\n signature_input_invalid: 'Invalid Signature-Input format',\n signature_invalid: 'Invalid Signature header',\n alg_unsupported: 'Unsupported ERC-8128 alg: only eip191 is verified',\n alg_missing: 'ERC-8128 alg=\"eip191\" is required by this policy',\n keyid_not_lowercase: 'ERC-8128 keyid address must be lowercase',\n nonce_invalid: 'Invalid ERC-8128 nonce format',\n nonce_unknown: 'Nonce was not issued by this server',\n nonce_replayed: 'Nonce has already been used',\n nonce_expired: 'Nonce has expired',\n nonce_required: 'ERC-8128 signature must carry a nonce',\n nonce_rate_limited: 'ERC-8128 nonce issuance is temporarily rate limited',\n nonce_capacity: 'ERC-8128 nonce capacity is temporarily exhausted',\n nonce_limits_invalid: 'ERC-8128 nonce limits are invalid',\n nonce_ttl_invalid: 'ERC-8128 nonce TTL is invalid',\n nonce_store_unavailable: 'ERC-8128 nonce store is unavailable',\n content_digest_required: 'Signed request with a body requires Content-Digest',\n content_digest_invalid: 'Invalid or missing Content-Digest header',\n content_digest_mismatch: 'Content-Digest does not match request body',\n components_invalid:\n 'ERC-8128 must cover method, authority, path, and query when present',\n class_bound_rejected: 'Class-bound signatures not accepted (missing required components)',\n signature_stale: 'ERC-8128 signature is expired or outside the freshness window',\n chain_not_allowed: 'ERC-8128 chain id is not allowed',\n wallet_invalid: 'Invalid wallet in ERC-8128 keyid',\n wallet_mismatch: 'Recovered wallet does not match ERC-8128 keyid',\n authority_invalid: 'ERC-8128 authority is not configured safely',\n});\n","/**\n * uvd-x402-sdk - Type Definitions\n *\n * Core TypeScript interfaces for the x402 payment SDK.\n * These types define the contract between the SDK and consuming applications.\n */\n\n// ============================================================================\n// CHAIN CONFIGURATION TYPES\n// ============================================================================\n\n/**\n * Network type categorization\n * - 'evm': Ethereum Virtual Machine compatible chains (use EIP-712)\n * - 'svm': Solana Virtual Machine chains (Solana, Fogo) (use SPL tokens)\n * - 'stellar': Stellar network (use Soroban)\n * - 'near': NEAR Protocol (use NEP-366)\n * - 'algorand': Algorand network (use ASA transfers with atomic transactions)\n * - 'sui': Sui blockchain (use sponsored transactions)\n * - 'xrpl': XRP Ledger (use pre-signed Payment transaction blobs)\n *\n * @deprecated 'solana' type is deprecated, use 'svm' instead\n */\nexport type NetworkType = 'evm' | 'svm' | 'solana' | 'stellar' | 'near' | 'algorand' | 'sui' | 'xrpl';\n\n/**\n * Supported x402 payment schemes\n * - 'exact': Standard one-shot payment (default)\n * - 'escrow': Escrow-based payment with verify/settle/refund\n * - 'commerce': Commerce alias for escrow (marketplace integrations)\n */\nexport type X402Scheme = 'exact' | 'escrow' | 'commerce';\n\n/**\n * Supported stablecoin token types\n * - usdc: USD Coin (Circle) - 6 decimals\n * - eurc: Euro Coin (Circle) - 6 decimals\n * - ausd: Agora USD (Agora Finance) - 6 decimals\n * - pyusd: PayPal USD (PayPal/Paxos) - 6 decimals\n * - usdt: Tether USD (USDT0 omnichain via LayerZero) - 6 decimals\n * - usdg: Global Dollar (Paxos) - 6 decimals; settlement stablecoin on Robinhood Chain\n */\nexport type TokenType = 'usdc' | 'eurc' | 'ausd' | 'pyusd' | 'usdt' | 'usdg';\n\n/**\n * Token configuration for EIP-712 signing and transfers\n */\nexport interface TokenConfig {\n /** Contract/mint address */\n address: string;\n /** Token decimals (6 for all supported stablecoins) */\n decimals: number;\n /** Token name for EIP-712 domain (e.g., \"USD Coin\" or \"USDC\") */\n name: string;\n /** Token version for EIP-712 domain */\n version: string;\n /**\n * Whether one whole unit of this token IS one dollar.\n *\n * Absent means yes, so every stablecoin entry in the registry keeps the\n * behaviour it had. It is `false` for exactly one thing today: the native\n * XRP that XRPL settles in.\n *\n * **The distinction is unit, not scale.** `decimals` already handles scale --\n * BSC USDC has 18 of them and prices correctly. But scaling a price by the\n * decimals only turns dollars into base units when one whole unit is one\n * dollar. XRP has six real decimals and is still not a dollar, so\n * `$1.00 -> 10**6` charges **1 XRP**, which is whatever XRP happens to cost.\n * Six decimals of XRP are still XRP.\n *\n * The SDK refuses to price in USD against a token carrying `false` rather\n * than converting at a rate nobody agreed to. Mirrors `NetworkConfig\n * .usd_pegged` in the Python SDK (`networks/base.py:129`, 0.77.0).\n */\n usdPegged?: boolean;\n}\n\n/**\n * USDC token configuration for a specific chain\n * @deprecated Use TokenConfig instead. This is kept for backward compatibility.\n */\nexport interface USDCConfig {\n /** Contract/mint address */\n address: string;\n /** Token decimals (6 for most chains, 7 for Stellar) */\n decimals: number;\n /** Token name for EIP-712 domain (e.g., \"USD Coin\" or \"USDC\") */\n name: string;\n /** Token version for EIP-712 domain */\n version: string;\n /**\n * Whether one whole unit of this token IS one dollar. Absent means yes.\n *\n * See {@link TokenConfig.usdPegged}. It matters here because this field is\n * also where a chain that settles in its own native asset describes that\n * asset -- XRPL keeps native XRP under the key `usdc`, so the key promises a\n * dollar the value does not deliver.\n */\n usdPegged?: boolean;\n}\n\n/**\n * Native currency configuration\n */\nexport interface NativeCurrency {\n name: string;\n symbol: string;\n decimals: number;\n}\n\n/**\n * Complete chain configuration\n */\nexport interface ChainConfig {\n /** Numeric chain ID (0 for non-EVM chains) */\n chainId: number;\n /** Hex-encoded chain ID for wallet_switchEthereumChain */\n chainIdHex: string;\n /** Internal chain identifier (e.g., 'base', 'solana') */\n name: string;\n /** Human-readable display name */\n displayName: string;\n /** Network type for routing */\n networkType: NetworkType;\n /** Primary RPC endpoint URL */\n rpcUrl: string;\n /** Block explorer base URL */\n explorerUrl: string;\n /** Native currency info */\n nativeCurrency: NativeCurrency;\n /** USDC token configuration */\n usdc: USDCConfig;\n /**\n * Multi-token configurations (EVM chains only)\n * Maps token type to its configuration for this chain.\n * Not all tokens are available on all chains.\n */\n tokens?: Partial<Record<TokenType, TokenConfig>>;\n /** x402 facilitator configuration */\n x402: {\n facilitatorUrl: string;\n enabled: boolean;\n };\n}\n\n// ============================================================================\n// WALLET TYPES\n// ============================================================================\n\n/**\n * Current wallet connection state\n */\nexport interface WalletState {\n /** Whether a wallet is currently connected */\n connected: boolean;\n /** Connected wallet address (null if not connected) */\n address: string | null;\n /** Current chain ID (null for non-EVM or disconnected) */\n chainId: number | null;\n /** Current network name */\n network: string | null;\n /** Network type of connected wallet */\n networkType: NetworkType | null;\n /** USDC balance on current chain (null if unknown) */\n balance: string | null;\n}\n\n/**\n * Wallet adapter interface for different wallet types\n */\nexport interface WalletAdapter {\n /** Unique identifier for this wallet type */\n readonly id: string;\n /** Display name */\n readonly name: string;\n /** Network type this adapter supports */\n readonly networkType: NetworkType;\n\n /** Check if this wallet is available/installed */\n isAvailable(): boolean;\n\n /** Connect to the wallet */\n connect(chainName?: string): Promise<string>;\n\n /** Disconnect from the wallet */\n disconnect(): Promise<void>;\n\n /** Switch to a different chain (EVM only) */\n switchChain?(chainName: string): Promise<void>;\n\n /**\n * Sign a payment payload\n * For EVM chains, supports multi-token via paymentInfo.tokenType\n */\n signPayment(paymentInfo: PaymentInfo, chainConfig: ChainConfig): Promise<string>;\n\n /**\n * Check token balance (defaults to USDC for backward compatibility)\n * EVM providers may accept optional tokenType parameter\n */\n getBalance(chainConfig: ChainConfig, tokenType?: TokenType): Promise<string>;\n\n /** Get current address */\n getAddress(): string | null;\n\n /** Get current chain ID (EVM only) */\n getChainId?(): number | null;\n}\n\n/**\n * EIP-712 domain for typed data signing\n */\nexport interface EIP712Domain {\n name: string;\n version: string;\n chainId: number;\n verifyingContract: string;\n}\n\n/**\n * EIP-712 type definitions\n */\nexport interface EIP712Types {\n [typeName: string]: Array<{ name: string; type: string }>;\n}\n\n// ============================================================================\n// PAYMENT TYPES\n// ============================================================================\n\n/**\n * Payment information returned by backend on 402 response\n */\nexport interface PaymentInfo {\n /** Default recipient address */\n recipient: string;\n /** Network-specific recipient addresses */\n recipients?: {\n evm?: string;\n solana?: string;\n near?: string;\n stellar?: string;\n algorand?: string;\n sui?: string;\n xrpl?: string;\n };\n /** Facilitator address (for Solana fee payer) */\n facilitator?: string;\n /**\n * Amount in whole units of the settlement asset (e.g., \"10.00\").\n *\n * For every dollar-pegged token that is dollars, which is all of them but\n * one. On XRPL it is **XRP**, because XRPL settles in its own native asset:\n * the provider spends this through `xrpToDrops` and bills whole XRP\n * (`src/providers/xrpl/index.ts`). This used to be documented as USD, which\n * made the type and its only XRPL consumer disagree about the unit -- and the\n * consumer won, so a \"10.00\" written as ten dollars left as ten XRP. The SDK\n * now refuses to build a dollar price for an asset with no dollar peg rather\n * than let the two readings meet on the wire; see\n * {@link TokenConfig.usdPegged}.\n */\n amount: string;\n /** Token symbol (usually \"USDC\") */\n token?: string;\n /**\n * Token type for multi-token support\n * Defaults to 'usdc' if not specified for backward compatibility\n */\n tokenType?: TokenType;\n /** Network hint from backend */\n network?: string;\n /** Supported chain IDs */\n supportedChains?: number[];\n /**\n * Envelope version the resource asked for, as read off its own 402.\n *\n * This is what makes the client's `x402Version: 'auto'` mean something: the\n * buyer loop reads the version out of the challenge and hands it down here,\n * so the header is built in the shape the server said it accepts. Left\n * undefined by callers who build a payment by hand -- then the client config\n * decides, exactly as before.\n */\n x402Version?: X402Version;\n}\n\n/**\n * One payment option read off a resource's `402`, normalised.\n *\n * The 402 body speaks two dialects -- v1 spells the price `maxAmountRequired`\n * and names the chain `base`, v2 spells it `amount` and names it `eip155:8453`\n * -- and a buyer that only learned one of them silently ignores half the\n * offers. This is the shape after both have been read.\n */\nexport interface X402PaymentOffer {\n /** Network exactly as the 402 wrote it (plain name or CAIP-2). */\n network: string;\n /** SDK chain name the network resolved to, or null when unknown. */\n chainName: string | null;\n /** Token contract address the resource wants paid, when it named one. */\n asset?: string;\n /** Price in the token's own atomic units. */\n amount: string;\n /** Decimals used to read `amount`. */\n decimals: number;\n /** Recipient of the payment. */\n payTo: string;\n /** The accept object verbatim -- echoed back for v2. */\n raw: Record<string, unknown>;\n}\n\n/**\n * Options for {@link X402Client.fetch} -- the buyer loop.\n */\nexport interface X402FetchOptions {\n /** HTTP method for both the probe and the paid retry (default `GET`). */\n method?: string;\n /**\n * Hard ceiling in token units (e.g. `'0.05'`). A 402 that asks for more\n * throws instead of signing. Undefined = no ceiling, which means paying\n * whatever an untrusted resource asks: discouraged.\n */\n maxAmount?: string;\n /** Token to pay with (default `usdc`). */\n tokenType?: TokenType;\n /** Override the default cheapest-offer selection. */\n select?: (offers: X402PaymentOffer[]) => X402PaymentOffer | null | undefined;\n /** Passed through to both requests (`headers`, `body`, `signal`, ...). */\n init?: RequestInit;\n /** Injectable `fetch` (tests, or a runtime without a global one). */\n fetchImpl?: typeof globalThis.fetch;\n}\n\n/**\n * Simple payment request from application\n */\nexport interface PaymentRequest {\n /** Amount in USDC (e.g., \"10.00\") */\n amount: string;\n /** Override recipient address (optional) */\n recipient?: string;\n /** Application-specific metadata */\n metadata?: Record<string, unknown>;\n}\n\n/**\n * x402 payment header names\n *\n * - 'X-PAYMENT': v1 header name (default, most compatible)\n * - 'PAYMENT-SIGNATURE': v2 header name (newer standard)\n *\n * Both headers use the same base64-encoded JSON payload format.\n * The facilitator accepts both headers.\n */\nexport type X402HeaderName = 'X-PAYMENT' | 'PAYMENT-SIGNATURE';\n\n/**\n * Payment headers object containing both v1 and v2 header formats\n */\nexport interface PaymentHeaders {\n /** v1 header: X-PAYMENT */\n 'X-PAYMENT': string;\n /** v2 header: PAYMENT-SIGNATURE (same value, different header name) */\n 'PAYMENT-SIGNATURE': string;\n}\n\n/**\n * Result of a payment operation\n */\nexport interface PaymentResult {\n /** Whether payment was successful */\n success: boolean;\n /** Base64-encoded X-PAYMENT header value */\n paymentHeader: string;\n /**\n * Payment headers object for easy use with fetch/axios\n *\n * @example\n * ```ts\n * // Use v1 header\n * fetch(url, { headers: { 'X-PAYMENT': result.headers['X-PAYMENT'] } });\n *\n * // Use v2 header\n * fetch(url, { headers: { 'PAYMENT-SIGNATURE': result.headers['PAYMENT-SIGNATURE'] } });\n * ```\n */\n headers: PaymentHeaders;\n /** Transaction hash (if available) */\n transactionHash?: string;\n /** Network where payment was made */\n network: string;\n /** Payer address */\n payer?: string;\n /** Error message (if success is false) */\n error?: string;\n}\n\n// ============================================================================\n// PAYLOAD TYPES (Internal)\n// ============================================================================\n\n/**\n * EVM payment payload (ERC-3009 TransferWithAuthorization)\n */\nexport interface EVMPaymentPayload {\n from: string;\n to: string;\n value: string;\n validAfter: number;\n validBefore: number;\n nonce: string;\n v: number;\n r: string;\n s: string;\n chainId: number;\n token: string;\n}\n\n/**\n * Token info for non-USDC stablecoins (e.g., Token2022 like AUSD)\n * Required in payload for facilitator to verify Token2022 transfers correctly.\n */\nexport interface TokenInfo {\n /** Token mint address */\n address: string;\n /** Token symbol (e.g., 'AUSD') */\n symbol: string;\n /** Token decimals (e.g., 6) */\n decimals: number;\n}\n\n/**\n * Solana payment payload (partially-signed transaction)\n */\nexport interface SolanaPaymentPayload {\n /** Base64-encoded serialized transaction */\n transaction: string;\n /**\n * Token info for non-USDC tokens (e.g., Token2022 like AUSD)\n * CRITICAL: Must be included for Token2022 tokens for facilitator verification\n */\n token?: TokenInfo;\n}\n\n/**\n * Stellar payment payload (Soroban authorization)\n */\nexport interface StellarPaymentPayload {\n /** Sender G... public key */\n from: string;\n /** Recipient G... public key */\n to: string;\n /** Amount in stroops (7 decimals) */\n amount: string;\n /** USDC SAC contract address */\n tokenContract: string;\n /** Base64 XDR-encoded SorobanAuthorizationEntry */\n authorizationEntryXdr: string;\n /** Random 64-bit nonce */\n nonce: number;\n /** Ledger when authorization expires */\n signatureExpirationLedger: number;\n}\n\n/**\n * NEAR payment payload (NEP-366 meta-transaction)\n */\nexport interface NEARPaymentPayload {\n /** Base64 Borsh-encoded SignedDelegateAction */\n signedDelegateAction: string;\n network: 'near';\n}\n\n/**\n * Algorand payment payload (atomic transaction group)\n *\n * Follows the GoPlausible x402-avm spec for atomic groups:\n * - Transaction 0: Fee payment (UNSIGNED) - facilitator -> facilitator, covers all fees\n * - Transaction 1: ASA transfer (SIGNED) - client -> merchant\n *\n * The facilitator signs transaction 0 and submits the complete atomic group.\n */\nexport interface AlgorandPaymentPayload {\n /** Index of the payment transaction in the group (always 1) */\n paymentIndex: number;\n /**\n * Array of base64-encoded msgpack transactions forming the atomic group:\n * - [0]: Unsigned fee transaction (facilitator signs)\n * - [1]: Signed ASA transfer (client signed)\n */\n paymentGroup: string[];\n}\n\n/**\n * Sui payment payload (sponsored transaction)\n *\n * Uses Sui sponsored transactions where:\n * - User creates a programmable transaction for USDC transfer\n * - User signs the transaction\n * - Facilitator sponsors (pays gas in SUI) and submits\n *\n * User pays: ZERO SUI\n */\nexport interface SuiPaymentPayload {\n /** Base64-encoded BCS serialized TransactionData */\n transactionBytes: string;\n /** Base64-encoded user signature */\n senderSignature: string;\n /** Sender address (0x + 64 hex chars) */\n from: string;\n /** Recipient address (0x + 64 hex chars) */\n to: string;\n /** Amount in base units (string to handle large numbers) */\n amount: string;\n /** Coin object ID used for the transfer (REQUIRED by facilitator) */\n coinObjectId: string;\n}\n\n/**\n * XRPL payment payload (pre-signed Payment transaction blob)\n *\n * Uses the t54 \"pre-signed Payment blob\" scheme on the XRP Ledger:\n * - The client builds and FULLY signs a Payment transaction off-chain,\n * paying its own XRP network fee.\n * - The single `signedTxBlob` field (hex-encoded fully-signed XRPL tx blob)\n * is sent to the facilitator, which decodes it to re-derive payer/amount/\n * destination and submits it.\n *\n * All payment-level fields (destination, amount, InvoiceID, SourceTag, etc.)\n * come from PaymentRequirements/extra, NOT from this payload.\n *\n * XRP is the native asset (6 decimals / drops). There is no token contract.\n *\n * The JSON field name is EXACTLY `signedTxBlob` (camelCase).\n */\nexport interface XRPLPaymentPayload {\n /** Hex-encoded fully-signed XRPL Payment transaction blob (tx_blob) */\n signedTxBlob: string;\n}\n\n/**\n * Union type for all payment payloads\n */\nexport type PaymentPayload =\n | EVMPaymentPayload\n | SolanaPaymentPayload\n | StellarPaymentPayload\n | NEARPaymentPayload\n | AlgorandPaymentPayload\n | SuiPaymentPayload\n | XRPLPaymentPayload;\n\n// ============================================================================\n// X402 HEADER TYPES (v1 and v2)\n// ============================================================================\n\n/**\n * x402 protocol version\n */\nexport type X402Version = 1 | 2;\n\n/**\n * CAIP-2 chain identifiers for x402 v2\n * @see https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md\n */\nexport const CAIP2_IDENTIFIERS: Record<string, string> = {\n // EVM chains\n base: 'eip155:8453',\n ethereum: 'eip155:1',\n polygon: 'eip155:137',\n arbitrum: 'eip155:42161',\n optimism: 'eip155:10',\n avalanche: 'eip155:43114',\n celo: 'eip155:42220',\n hyperevm: 'eip155:999',\n unichain: 'eip155:130',\n monad: 'eip155:143',\n bsc: 'eip155:56',\n scroll: 'eip155:534352',\n 'skale-base': 'eip155:1187947933',\n 'skale-base-sepolia': 'eip155:324705682',\n robinhood: 'eip155:4663',\n 'robinhood-testnet': 'eip155:46630',\n // SVM chains\n solana: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',\n fogo: 'svm:fogo',\n // Stellar\n stellar: 'stellar:pubnet',\n // NEAR\n near: 'near:mainnet',\n // Algorand\n algorand: 'algorand:mainnet',\n 'algorand-testnet': 'algorand:testnet',\n // Sui\n sui: 'sui:mainnet',\n 'sui-testnet': 'sui:testnet',\n // XRPL (XRP Ledger)\n xrpl: 'xrpl',\n 'xrpl-testnet': 'xrpl-testnet',\n};\n\n/**\n * Reverse mapping from CAIP-2 to chain name\n */\nexport const CAIP2_TO_CHAIN: Record<string, string> = Object.fromEntries(\n Object.entries(CAIP2_IDENTIFIERS).map(([k, v]) => [v, k])\n);\n\n/**\n * x402 v1 header structure (network as string)\n */\nexport interface X402HeaderV1 {\n x402Version: 1;\n scheme: X402Scheme;\n network: string;\n payload: X402PayloadData;\n}\n\n/**\n * x402 v2 payment option\n */\nexport interface X402PaymentOption {\n network: string; // CAIP-2 format\n asset: string;\n amount: string;\n facilitator?: string;\n}\n\n/**\n * x402 v2 header structure (CAIP-2 network, accepts array)\n */\nexport interface X402HeaderV2 {\n x402Version: 2;\n scheme: X402Scheme;\n network: string; // CAIP-2 format\n payload: X402PayloadData;\n accepts?: X402PaymentOption[];\n}\n\n/**\n * Union type for both v1 and v2 headers\n */\nexport type X402Header = X402HeaderV1 | X402HeaderV2;\n\n/**\n * EVM-specific payload in x402 header\n */\nexport interface X402EVMPayload {\n signature: string;\n authorization: {\n from: string;\n to: string;\n value: string;\n validAfter: string;\n validBefore: string;\n nonce: string;\n };\n /**\n * Which token was actually paid.\n *\n * Only present when the payment is created with `includeTokenMetadata`. The\n * signature alone does not say which stablecoin it authorizes — a server that\n * accepts several tokens on the same chain cannot rebuild the payment\n * requirements without this. Omitted by default so existing v1 wire formats\n * stay byte-identical.\n */\n token?: PaymentTokenMetadata;\n}\n\n/**\n * Token identification carried inside an x402 payload.\n *\n * Mirrors what a resource server needs to build `paymentRequirements`: the\n * `asset` it must charge and the `extra` EIP-712 domain the facilitator needs\n * to recover the signature.\n */\nexport interface PaymentTokenMetadata {\n /** Token contract address (the `asset` of the payment requirements) */\n address: string;\n /** Uppercase token symbol, e.g. `USDC`, `EURC`, `USDT` */\n symbol: string;\n /** Token decimals — the amount in the authorization is in these units */\n decimals: number;\n /** EIP-712 domain of the token contract (the `extra` of the requirements) */\n eip712: {\n name: string;\n version: string;\n };\n}\n\n/**\n * Solana-specific payload in x402 header\n */\nexport interface X402SolanaPayload {\n transaction: string;\n}\n\n/**\n * Settlement account payload for Crossmint and other custodial wallets\n * that can only sendTransaction (not signTransaction).\n *\n * In this mode, the client already submitted the transaction on-chain.\n * The facilitator verifies the on-chain tx, then sweeps USDC from the\n * settlement account to the payTo address.\n *\n * Used by: Crossmint smart wallets via @faremeter/wallet-crossmint\n */\nexport interface X402SettlementAccountPayload {\n /** On-chain transaction signature (already submitted) */\n transactionSignature: string;\n /** Base58 secret key for sweeping settlement account (optional) */\n settleSecretKey?: string;\n /** Address to receive rent from closed settlement ATA (optional) */\n settlementRentDestination?: string;\n}\n\n/**\n * Stellar-specific payload in x402 header\n */\nexport interface X402StellarPayload {\n from: string;\n to: string;\n amount: string;\n tokenContract: string;\n authorizationEntryXdr: string;\n nonce: number;\n signatureExpirationLedger: number;\n}\n\n/**\n * NEAR-specific payload in x402 header\n */\nexport interface X402NEARPayload {\n signedDelegateAction: string;\n}\n\n/**\n * Algorand-specific payload in x402 header (atomic group format)\n */\nexport interface X402AlgorandPayload {\n /** Index of the payment transaction in the group (always 1) */\n paymentIndex: number;\n /** Array of base64-encoded msgpack transactions */\n paymentGroup: string[];\n}\n\n/**\n * Sui-specific payload in x402 header (sponsored transaction)\n */\nexport interface X402SuiPayload {\n /** BCS-encoded transaction bytes (base64) */\n transactionBytes: string;\n /** User's signature on the transaction (base64) */\n senderSignature: string;\n /** Sender's Sui address (0x...) */\n from: string;\n /** Recipient's Sui address (0x...) */\n to: string;\n /** Amount in smallest unit (string to avoid precision issues) */\n amount: string;\n /** Coin object ID used for the transfer (REQUIRED by facilitator) */\n coinObjectId: string;\n}\n\n/**\n * XRPL-specific payload in x402 header (t54 pre-signed Payment blob)\n *\n * The JSON field name is EXACTLY `signedTxBlob` (camelCase). The facilitator\n * decodes the blob to re-derive payer/amount/destination; no other fields are\n * carried in the payload.\n */\nexport interface X402XRPLPayload {\n /** Hex-encoded fully-signed XRPL Payment transaction blob (tx_blob) */\n signedTxBlob: string;\n}\n\n/**\n * Union of all x402 payload types\n */\nexport type X402PayloadData =\n | X402EVMPayload\n | X402SolanaPayload\n | X402SettlementAccountPayload\n | X402StellarPayload\n | X402NEARPayload\n | X402AlgorandPayload\n | X402SuiPayload\n | X402XRPLPayload;\n\n// ============================================================================\n// CLIENT CONFIGURATION\n// ============================================================================\n\n/**\n * Multi-payment configuration for supporting multiple networks\n */\nexport interface MultiPaymentConfig {\n /** Networks to support (e.g., ['base', 'solana', 'stellar', 'near']) */\n networks: string[];\n /** Default network if user hasn't selected one */\n defaultNetwork?: string;\n /** Whether to auto-detect user's preferred network based on wallet */\n autoDetect?: boolean;\n}\n\n/**\n * SDK client configuration options\n */\nexport interface X402ClientConfig {\n /** Facilitator URL (default: https://facilitator.ultravioletadao.xyz) */\n facilitatorUrl?: string;\n /** Default chain to connect to */\n defaultChain?: string;\n /** Auto-connect on initialization */\n autoConnect?: boolean;\n /** Enable debug logging */\n debug?: boolean;\n /** Custom chain configurations (override defaults) */\n customChains?: Record<string, Partial<ChainConfig>>;\n /** Wallet preference order */\n walletPreference?: string[];\n /** Custom RPC URLs (override defaults) */\n rpcOverrides?: Record<string, string>;\n /**\n * x402 protocol version to use\n * - 1: Classic format with network as string (e.g., \"base\")\n * - 2: CAIP-2 format with accepts array (e.g., \"eip155:8453\")\n * - 'auto': Auto-detect from 402 response (default)\n */\n x402Version?: X402Version | 'auto';\n /** Multi-payment configuration for supporting multiple networks */\n multiPayment?: MultiPaymentConfig;\n /**\n * Include a `token` block in the payload naming the asset, its decimals and\n * its EIP-712 domain.\n *\n * Needed when the resource accepts more than one stablecoin on the same\n * chain: the signature alone does not say which one was paid, so the server\n * cannot rebuild `paymentRequirements`. Off by default — the emitted header\n * stays byte-identical to previous versions.\n */\n includeTokenMetadata?: boolean;\n}\n\n/**\n * Default configuration values\n */\nexport const DEFAULT_CONFIG: Required<Pick<X402ClientConfig, 'facilitatorUrl' | 'defaultChain' | 'autoConnect' | 'debug' | 'x402Version'>> = {\n facilitatorUrl: 'https://facilitator.ultravioletadao.xyz',\n defaultChain: 'base',\n autoConnect: false,\n debug: false,\n x402Version: 'auto',\n};\n\n// ============================================================================\n// BALANCE TYPES\n// ============================================================================\n\n/**\n * Balance information for a single network\n */\nexport interface NetworkBalance {\n /** Chain name */\n chainName: string;\n /** Human-readable display name */\n displayName: string;\n /** Formatted balance (e.g., \"15.50\") or null if loading/error */\n balance: string | null;\n /** Whether balance is currently being fetched */\n isLoading: boolean;\n /** Error message if fetch failed */\n error: string | null;\n}\n\n// ============================================================================\n// EVENT TYPES\n// ============================================================================\n\n/**\n * Events emitted by the SDK client\n */\nexport type X402Event =\n | 'connect'\n | 'disconnect'\n | 'chainChanged'\n | 'accountChanged'\n | 'balanceChanged'\n | 'paymentStarted'\n | 'paymentSigned'\n | 'paymentCompleted'\n | 'paymentFailed';\n\n/**\n * Event data types\n */\nexport interface X402EventData {\n connect: WalletState;\n disconnect: void;\n chainChanged: { chainId: number; chainName: string };\n accountChanged: { address: string };\n balanceChanged: { balance: string };\n paymentStarted: { amount: string; network: string };\n paymentSigned: { paymentHeader: string };\n paymentCompleted: PaymentResult;\n paymentFailed: { error: string; code: X402ErrorCode };\n}\n\n/**\n * Event handler type\n */\nexport type X402EventHandler<E extends X402Event> = (data: X402EventData[E]) => void;\n\n// ============================================================================\n// ERROR TYPES\n// ============================================================================\n\n/**\n * Error codes for categorizing errors\n */\nexport type X402ErrorCode =\n | 'WALLET_NOT_FOUND'\n | 'WALLET_NOT_CONNECTED'\n | 'WALLET_NOT_SUPPORTED'\n | 'WALLET_CONNECTION_FAILED'\n | 'WALLET_CONNECTION_REJECTED'\n | 'WALLET_CONNECTION_TIMEOUT'\n | 'CHAIN_NOT_SUPPORTED'\n | 'CHAIN_SWITCH_REJECTED'\n | 'INSUFFICIENT_BALANCE'\n | 'SIGNATURE_REJECTED'\n | 'PAYMENT_FAILED'\n | 'PAYMENT_TIMEOUT'\n | 'NETWORK_ERROR'\n | 'INVALID_CONFIG'\n | 'INVALID_AMOUNT'\n | 'INVALID_RECIPIENT'\n | 'PAYMENT_EXCEEDS_MAX'\n | 'NO_ACCEPTABLE_PAYMENT'\n | 'UNKNOWN_ERROR';\n\n/**\n * SDK-specific error class\n */\nexport class X402Error extends Error {\n public readonly code: X402ErrorCode;\n public readonly details?: unknown;\n\n constructor(message: string, code: X402ErrorCode, details?: unknown) {\n super(message);\n this.name = 'X402Error';\n this.code = code;\n this.details = details;\n\n // Maintains proper stack trace for where error was thrown (V8 engines)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, X402Error);\n }\n }\n}\n","/**\n * uvd-x402-sdk/erc8128 — the signer.\n *\n * Emits the F3-1 pinned wire format: covered components in the order\n * `@method @authority @path [@query] [content-digest]`, parameters in the\n * order `created;expires;nonce;keyid;alg`, `alg=\"eip191\"` ALWAYS LAST, keyid\n * address ALWAYS lowercase (a checksummed keyid caused the v9.x silent-auth\n * incident), base joined with single LF and no trailing newline.\n *\n * Everything the fleet's 13 copies disagreed about is a value here, not a\n * branch: `profile` (emit `alg` or not), `contentDigest` (body-present vs\n * body-truthy), `headerCase` (Title-Case vs lowercase), `now` (injectable\n * clock, so tests never monkeypatch a module's globals).\n *\n * The nonce is REQUIRED and never invented. A silent local fallback makes a\n * server outage look like an auth bug; `createSignedFetch` exposes it as an\n * explicit `onNonceUnavailable` escape hatch instead.\n *\n * Private keys: `signRequest` takes one only as a convenience for scripts.\n * It must come from `process.env` / AWS Secrets Manager — never a literal.\n * The SDK does not read it from the environment, log it or persist it.\n */\n\nimport { ethers } from 'ethers';\n\nimport { X402Error } from '../types';\nimport type { SigningWalletAdapter } from '../wallet';\nimport {\n buildSignatureBase,\n buildSignatureParams,\n canonicalKeyid,\n canonicalParams,\n computeContentDigest,\n DEFAULT_CHAIN_ID,\n DEFAULT_LABEL,\n DEFAULT_VALIDITY_SEC,\n splitRequestTarget,\n} from './core';\n\n/** Wire generation to emit. `legacy-no-alg` exists only for byte-identical\n * migration commits; a checksummed keyid is verify-only and never emitted. */\nexport type WireProfile = 'canonical' | 'legacy-no-alg';\n\n/** When to attach a `Content-Digest`. */\nexport type ContentDigestEmit = 'body-present' | 'body-truthy';\n\nexport type HeaderCase = 'title' | 'lower';\n\nexport interface SignOptions {\n method: string;\n /** Full URL. `@authority`, `@path` and `@query` come from it. */\n url: string;\n /** Single-use nonce from the server. Required — the SDK never mints one. */\n nonce: string;\n /** Exact body bytes that will go on the wire, or null/undefined for none. */\n body?: string | Uint8Array | null;\n /** Default 8453 (Base). */\n chainId?: number;\n /** Default `'eth'`. */\n label?: string;\n /** Default 300; clamped to 300, the window every verifier caps at. */\n validitySec?: number;\n /** Default `'canonical'`. */\n profile?: WireProfile;\n /** Default `'body-present'`: an empty-string body still gets a digest. */\n contentDigest?: ContentDigestEmit;\n /** Default `'title'`. `'lower'` is for callers that merge into a lowercase\n * header dict, where mixed casing silently loses keys. */\n headerCase?: HeaderCase;\n /** Injectable clock, seconds. */\n now?: () => number;\n}\n\nexport interface Erc8128Headers {\n Signature: string;\n 'Signature-Input': string;\n 'Content-Digest'?: string;\n}\n\nexport interface Erc8128LowerHeaders {\n signature: string;\n 'signature-input': string;\n 'content-digest'?: string;\n}\n\nexport type Erc8128SignedHeaders = Erc8128Headers | Erc8128LowerHeaders;\n\nexport interface SignWithSignerOptions extends SignOptions {\n /** Signer address, any case — lowercased for the keyid. */\n address: string;\n /** EIP-191 personal_sign over the signature base; returns 0x + 130 hex. */\n signMessage(signatureBase: string): string | Promise<string>;\n}\n\nexport interface SignWithWalletOptions extends SignOptions {\n wallet: SigningWalletAdapter;\n}\n\nexport interface SignWithPrivateKeyOptions extends SignOptions {\n /** From process.env / Secrets Manager. Never a literal, never logged. */\n privateKey: string;\n}\n\nfunction hasBodyFor(body: SignOptions['body'], rule: ContentDigestEmit): boolean {\n if (body === undefined || body === null) return false;\n if (rule === 'body-present') return true;\n return typeof body === 'string' ? body.length > 0 : body.length > 0;\n}\n\nfunction toHeaders(\n headerCase: HeaderCase,\n signature: string,\n signatureInput: string,\n contentDigest?: string\n): Erc8128SignedHeaders {\n if (headerCase === 'lower') {\n const lower: Erc8128LowerHeaders = {\n signature,\n 'signature-input': signatureInput,\n };\n if (contentDigest) lower['content-digest'] = contentDigest;\n return lower;\n }\n const title: Erc8128Headers = {\n Signature: signature,\n 'Signature-Input': signatureInput,\n };\n if (contentDigest) title['Content-Digest'] = contentDigest;\n return title;\n}\n\nexport function signRequestWithSigner(\n options: SignWithSignerOptions & { headerCase: 'lower' }\n): Promise<Erc8128LowerHeaders>;\nexport function signRequestWithSigner(\n options: SignWithSignerOptions & { headerCase?: 'title' }\n): Promise<Erc8128Headers>;\nexport function signRequestWithSigner(\n options: SignWithSignerOptions\n): Promise<Erc8128SignedHeaders>;\n/**\n * Sign with a bare EIP-191 callback — for browser wallets, OWS vaults and any\n * out-of-process signer. The key never reaches this module.\n */\nexport async function signRequestWithSigner(\n options: SignWithSignerOptions\n): Promise<Erc8128SignedHeaders> {\n const {\n address,\n signMessage,\n method,\n url,\n nonce,\n body,\n chainId = DEFAULT_CHAIN_ID,\n label = DEFAULT_LABEL,\n validitySec = DEFAULT_VALIDITY_SEC,\n profile = 'canonical',\n contentDigest: digestRule = 'body-present',\n headerCase = 'title',\n now,\n } = options;\n\n if (typeof nonce !== 'string' || !nonce) {\n throw new X402Error(\n 'ERC-8128 signing requires a server-issued nonce; the SDK never mints one.',\n 'INVALID_CONFIG'\n );\n }\n\n const { authority, path, query } = splitRequestTarget(url);\n if (!authority) {\n throw new X402Error('ERC-8128 signing requires an absolute URL.', 'INVALID_CONFIG');\n }\n\n const created = now ? now() : Math.floor(Date.now() / 1000);\n const expires = created + Math.min(Math.max(validitySec, 1), DEFAULT_VALIDITY_SEC);\n\n const covered = ['@method', '@authority', '@path'];\n if (query) covered.push('@query');\n\n let digest: string | undefined;\n if (hasBodyFor(body, digestRule)) {\n digest = computeContentDigest(body as string | Uint8Array);\n covered.push('content-digest');\n }\n\n const params = canonicalParams({\n created,\n expires,\n nonce,\n keyid: canonicalKeyid(chainId, address),\n alg: profile === 'legacy-no-alg' ? null : undefined,\n });\n\n const message = {\n method,\n authority,\n path,\n query,\n contentDigest: digest,\n covered,\n params,\n };\n const signatureBase = buildSignatureBase(message);\n\n const sigHex = await signMessage(signatureBase);\n const sigBytes = ethers.getBytes(sigHex.startsWith('0x') ? sigHex : `0x${sigHex}`);\n const sigB64 = ethers.encodeBase64(sigBytes);\n\n // Same builder the base's last line used, so the header and the signed bytes\n // cannot drift apart.\n const sigParams = buildSignatureParams(message);\n\n return toHeaders(headerCase, `${label}=:${sigB64}:`, `${label}=${sigParams}`, digest);\n}\n\nexport function signRequestWithWallet(\n options: SignWithWalletOptions & { headerCase: 'lower' }\n): Promise<Erc8128LowerHeaders>;\nexport function signRequestWithWallet(\n options: SignWithWalletOptions & { headerCase?: 'title' }\n): Promise<Erc8128Headers>;\nexport function signRequestWithWallet(\n options: SignWithWalletOptions\n): Promise<Erc8128SignedHeaders>;\n/**\n * Sign with a {@link SigningWalletAdapter}. Only `getAddress()` and\n * `signMessage()` are used, so the key stays inside the adapter.\n */\nexport function signRequestWithWallet(\n options: SignWithWalletOptions\n): Promise<Erc8128SignedHeaders> {\n const { wallet, ...rest } = options;\n return signRequestWithSigner({\n ...rest,\n address: wallet.getAddress(),\n signMessage: (signatureBase) => wallet.signMessage(signatureBase),\n });\n}\n\nexport function signRequest(\n options: SignWithPrivateKeyOptions & { headerCase: 'lower' }\n): Promise<Erc8128LowerHeaders>;\nexport function signRequest(\n options: SignWithPrivateKeyOptions & { headerCase?: 'title' }\n): Promise<Erc8128Headers>;\nexport function signRequest(\n options: SignWithPrivateKeyOptions\n): Promise<Erc8128SignedHeaders>;\n/**\n * Sign with a raw private key. Convenience for scripts and bots that already\n * hold the key in the environment — prefer {@link signRequestWithWallet}.\n */\nexport function signRequest(options: SignWithPrivateKeyOptions): Promise<Erc8128SignedHeaders> {\n const { privateKey, ...rest } = options;\n const key = privateKey.startsWith('0x') ? privateKey : `0x${privateKey}`;\n const wallet = new ethers.Wallet(key);\n return signRequestWithSigner({\n ...rest,\n address: wallet.address,\n signMessage: (signatureBase) => wallet.signMessage(signatureBase),\n });\n}\n\n/**\n * Fetch a fresh single-use nonce.\n *\n * Throws on failure and never falls back to a locally minted value: a local\n * nonce authenticates against a first-use-wins store and is rejected by an\n * issuer-bound one, which turns a server blip into an auth mystery.\n */\nexport async function fetchNonce(apiBase: string, timeoutMs = 10000): Promise<string> {\n const url = `${apiBase.replace(/\\/$/, '')}/api/v1/auth/erc8128/nonce`;\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), timeoutMs);\n\n try {\n const resp = await fetch(url, { signal: controller.signal });\n if (!resp.ok) {\n throw new Error(`Failed to fetch nonce: ${resp.status} ${resp.statusText}`);\n }\n const data = (await resp.json()) as { nonce: string };\n if (!data || typeof data.nonce !== 'string' || !data.nonce) {\n throw new Error('Nonce endpoint returned no nonce');\n }\n return data.nonce;\n } finally {\n clearTimeout(timer);\n }\n}\n\nexport interface CreateSignedFetchConfig {\n /** API origin, e.g. `https://api.execution.market`. */\n apiBase: string;\n chainId?: number;\n /** From process.env / Secrets Manager. Never a literal. */\n privateKey?: string;\n wallet?: SigningWalletAdapter;\n profile?: WireProfile;\n contentDigest?: ContentDigestEmit;\n headerCase?: HeaderCase;\n /**\n * EXPLICIT escape hatch for a nonce-endpoint outage. The SDK never mints a\n * local nonce on its own; a caller that opts in owns the consequence (an\n * issuer-bound store will reject it).\n */\n onNonceUnavailable?: (error: unknown) => string | Promise<string>;\n}\n\n/**\n * A `fetch` wrapper that fetches a nonce and signs every call.\n *\n * Takes an origin-relative path; `apiBase` supplies the origin.\n */\nexport function createSignedFetch(\n config: CreateSignedFetchConfig\n): (path: string, init?: RequestInit) => Promise<Response> {\n const { apiBase, chainId, privateKey, wallet, profile, contentDigest, headerCase } = config;\n\n if (!privateKey && !wallet) {\n throw new X402Error(\n 'createSignedFetch requires a signer: pass privateKey or wallet.',\n 'WALLET_NOT_CONNECTED'\n );\n }\n\n return async (path: string, init?: RequestInit): Promise<Response> => {\n const url = `${apiBase.replace(/\\/$/, '')}${path}`;\n const method = (init?.method || 'GET').toUpperCase();\n const body = init?.body === undefined || init?.body === null ? undefined : String(init.body);\n\n let nonce: string;\n try {\n nonce = await fetchNonce(apiBase);\n } catch (error) {\n if (!config.onNonceUnavailable) throw error;\n nonce = await config.onNonceUnavailable(error);\n }\n\n const options: SignOptions = {\n method,\n url,\n nonce,\n body,\n chainId,\n profile,\n contentDigest,\n headerCase,\n };\n const signed = wallet\n ? await signRequestWithWallet({ ...options, wallet })\n : await signRequest({ ...options, privateKey: privateKey as string });\n\n const headers = new Headers(init?.headers);\n for (const [name, value] of Object.entries(signed)) {\n if (typeof value === 'string') headers.set(name, value);\n }\n if (body !== undefined) {\n headers.set('Content-Type', headers.get('Content-Type') || 'application/json');\n }\n\n return fetch(url, { ...init, headers, method });\n };\n}\n","/**\n * uvd-x402-sdk/erc8128 — the verifier.\n *\n * ONE pipeline, driven by a policy object:\n *\n * parse → alg gate → signature bytes → freshness → chain → binding\n * → [nonce?] → content-digest → components → base → recover → [nonce?]\n *\n * `meshrelay-strict` and `em-lenient` are records of knobs over that pipeline,\n * not branches — see `presets.ts`. Strict and lenient differ in POLICY, never\n * in how bytes are rebuilt.\n *\n * The rebuild takes the `@signature-params` substring VERBATIM off the wire\n * (`ParsedSignatureInput.paramsRaw`) and feeds it to the same\n * `buildSignatureBase()` the signer uses. That is why `alg` present, `alg`\n * absent, a checksummed keyid, a different parameter order and any future\n * RFC 9421 parameter all verify through one byte path with no flags. Parsing\n * exists only to make POLICY decisions.\n *\n * Content-Digest follows Execution Market's body-presence rule, which the\n * owner made canonical (spec §10 Q1): a digest is required — and must be in\n * the signed component list — if and only if the request carries a body; a\n * bodyless request may cover it voluntarily and is still verified.\n * MeshRelay's method-driven rule stays available as\n * `contentDigest: 'non-idempotent-methods'`.\n */\n\nimport { ethers } from 'ethers';\n\nimport { X402Error } from '../types';\nimport {\n buildSignatureBase,\n Erc8128ParseError,\n eip191Message,\n parseSignatureHeader,\n parseSignatureInput,\n REQUEST_BOUND_COMPONENTS,\n splitRequestTarget,\n} from './core';\nimport type { ObservedProfile, ParsedSignatureInput } from './core';\nimport {\n ERC8128_ERROR_MESSAGE,\n ERC8128_ERROR_RETRYABLE,\n ERC8128_ERROR_STATUS,\n} from './errors';\nimport type { Erc8128Code } from './errors';\nimport type { NoncePolicy } from './nonce';\n\n/** Which wire generations a verifier accepts. */\nexport type AcceptProfile = 'canonical' | 'legacy' | 'accept-both';\n\n/** How the covered-component list is checked. */\nexport type ComponentsRule = 'exact-ordered' | 'request-bound-subset';\n\n/** When a `Content-Digest` is mandatory. */\nexport type ContentDigestRule = 'body-present' | 'non-idempotent-methods';\n\n/** ERC-1271 hook. The SDK never opens an RPC connection itself. */\nexport interface ContractVerifierInput {\n address: string;\n chainId: number;\n /** keccak256 of the EIP-191 message, using the UTF-8 BYTE length prefix. */\n messageHash: Uint8Array;\n signature: Uint8Array;\n}\n\nexport interface VerifyPolicy {\n /**\n * A VALUE, never derived inside the SDK.\n *\n * MeshRelay passes its pinned `config.erc8128Auth.publicAuthority`; EM's\n * REST/MCP wrapper passes `_resolve_authority(request)`; EM's WebSocket path\n * MUST keep passing `url.netloc` — deriving it from `X-Forwarded-Host`\n * there let a caller rebuild the base over an authority they chose\n * (websocket/server.py:199-213).\n *\n * WRITE IT THE WAY IT IS SIGNED. The value goes through\n * `policyAuthority()`, which lowercases and validates it and NEVER touches\n * ports: it is the expected OUTPUT of the signer's `canonicalAuthority()`,\n * so `:443` under https and `:80` under http are already gone by the time\n * they get here, and any other port is part of the authority and is kept.\n * Configuring a default port is misconfiguration and answers 503 with a\n * message that says so — re-normalising it under a scheme this value does\n * not carry is what broke `https` on `:80`.\n */\n authority: string;\n /** Default `'accept-both'`. */\n accept?: AcceptProfile;\n /** Default `'exact-ordered'`. */\n components?: ComponentsRule;\n /** Default `'body-present'` (EM's rule, canonical per the owner's Q1 call). */\n contentDigest?: ContentDigestRule;\n nonce?: NoncePolicy;\n /** `undefined` accepts any chain id (EM's posture). */\n allowedChainIds?: readonly number[];\n /** Default 300. */\n maxValiditySec?: number;\n /**\n * Default `{ future: 30, pastExpiry: 0 }` (MeshRelay). EM uses 30/30.\n *\n * `pastExpiry` is inclusive: a signature is rejected once\n * `now >= expires + pastExpiry`. EM's Python compares strictly, so it\n * accepts the single instant `now == expires + 30` that this rejects — a\n * one-second difference in the stricter direction.\n */\n clockSkew?: { future?: number; pastExpiry?: number };\n /** `'eth'` by default; `'any'` takes `eth` when present, else the first. */\n label?: 'any' | string;\n contractVerifier?(input: ContractVerifierInput): Promise<boolean>;\n /** Injectable clock (seconds). */\n now?: () => number;\n /**\n * Deprecation census. Fires on SUCCESSFUL **and FAILED** verifications,\n * tagged with the outcome — a legacy emitter that is already failing for\n * another reason must not make the census look clean, or the S3 flip turns\n * a recoverable outage into a permanent one.\n *\n * Aggregate by `profile` (3 values), never by keyid: keyid is per-wallet\n * cardinality.\n */\n onObservedProfile?(\n profile: ObservedProfile,\n ctx: { wallet: string; chainId: number; keyid: string; outcome: 'ok' | Erc8128Code }\n ): void;\n}\n\nexport interface VerifiableRequest {\n method: string;\n /** Absolute or origin-relative. Never normalised — raw bytes matter. */\n url: string;\n headers: Readonly<Record<string, string | string[] | undefined>>;\n /** Exact body bytes off the wire, or `undefined` when there is no body. */\n rawBody?: Uint8Array;\n}\n\nexport type VerifyResult =\n | {\n ok: true;\n wallet: string;\n chainId: number;\n keyid: string;\n label: string;\n nonce?: string;\n created: number;\n expires: number;\n signatureBase: string;\n observedProfile: ObservedProfile;\n via: 'eoa' | 'erc1271';\n }\n | {\n ok: false;\n code: Erc8128Code;\n message: string;\n status: number;\n retryable: boolean;\n observedProfile?: ObservedProfile;\n };\n\n/** Internal control flow. Never escapes `verifyRequest`. */\nclass VerifyFailure extends Error {\n constructor(\n public readonly code: Erc8128Code,\n message?: string\n ) {\n super(message ?? ERC8128_ERROR_MESSAGE[code]);\n this.name = 'VerifyFailure';\n }\n}\n\nconst CONTENT_DIGEST_RE = /^sha-256=:([A-Za-z0-9+/]+={0,2}):$/;\nconst IDEMPOTENT_METHODS = ['GET', 'HEAD'];\n\nfunction headerLookup(\n headers: Readonly<Record<string, string | string[] | undefined>>\n): (name: string) => string | undefined {\n const map = new Map<string, string>();\n for (const [key, value] of Object.entries(headers ?? {})) {\n if (value === undefined) continue;\n const flat = Array.isArray(value) ? value[0] : value;\n if (typeof flat !== 'string' || !flat) continue;\n const lower = key.toLowerCase();\n if (!map.has(lower)) map.set(lower, flat);\n }\n return (name: string) => map.get(name.toLowerCase());\n}\n\n/**\n * Characters that can never appear inside a configured authority: every\n * whitespace character the rule names, plus the four delimiters that mark a\n * value as a URL, a path, a query or a userinfo prefix rather than a bare\n * `host[:port]`.\n *\n * The class is ENUMERATED rather than written `\\s`, because the Python side\n * must reject the byte-for-byte same input set and the two languages disagree\n * about which exotic code points `\\s` covers. `\\n`, `\\r`, `\\v`, `\\f` and NBSP\n * are here on purpose: they used to slip through and get embedded into the\n * rebuilt signature base.\n */\nconst AUTHORITY_FORBIDDEN_RE = /[ \\t\\n\\r\\v\\f\\u00a0/@?#]/;\n\n/**\n * The CONFIGURED authority: lowercased and validated. IT NEVER TOUCHES PORTS.\n *\n * This is the counterpart of `canonicalAuthority()`, not a second application\n * of it. The configured value is the EXPECTED RESULT of that function, so it\n * must already be written in its output form; normalising it a second time,\n * under a scheme it does not carry, is exactly what made the two SDKs diverge.\n * A port present here is preserved verbatim, whatever it is — which is what\n * makes `https` on `:80` (signed `host:80`) and a non-default port like\n * `host:8443` both work.\n *\n * Everything below is misconfiguration — the operator's typo, never the\n * caller's signature — so it answers 503 `authority_invalid`, never 401:\n * - empty, or empty once trimmed\n * - longer than 253 characters\n * - any whitespace, or any of `/ @ ? #` (which is also how a pasted URL, a\n * scheme prefix and a path component are caught)\n * - a port that is the default for EITHER scheme (`:443` / `:80`), which\n * gets its own message: the signer omits that port, so a config carrying\n * it can never match. Silently stripping it is what broke https-on-:80.\n */\nexport function policyAuthority(value: string): string {\n const authority = String(value ?? '')\n .trim()\n .toLowerCase();\n\n if (!authority || authority.length > 253 || AUTHORITY_FORBIDDEN_RE.test(authority)) {\n throw new VerifyFailure('authority_invalid');\n }\n\n const portAt = authority.lastIndexOf(':');\n // No port at all, or a bracketed IPv6 host whose colons are inside it.\n if (portAt > authority.lastIndexOf(']')) {\n const port = authority.slice(portAt + 1);\n if (port === '443' || port === '80') {\n throw new VerifyFailure(\n 'authority_invalid',\n `ERC-8128 authority must be configured the way it is signed, with the default port omitted: ` +\n `write \"${authority.slice(0, portAt)}\", not \"${authority}\"`\n );\n }\n }\n\n return authority;\n}\n\nfunction constantTimeEqual(a: Uint8Array, b: Uint8Array): boolean {\n if (a.length !== b.length) return false;\n let diff = 0;\n for (let i = 0; i < a.length; i++) diff |= a[i] ^ b[i];\n return diff === 0;\n}\n\n/**\n * Verify the `Content-Digest` header against the body bytes.\n *\n * The header value is replayed into the signature base VERBATIM (EM's\n * behaviour), not re-encoded: a signer that emitted non-canonical base64\n * padding signed its own bytes, and re-encoding would rebuild a base it never\n * signed.\n */\nfunction verifyContentDigest(headerValue: string | undefined, rawBody: Uint8Array): void {\n if (!headerValue) throw new VerifyFailure('content_digest_required');\n const match = CONTENT_DIGEST_RE.exec(headerValue);\n if (!match) throw new VerifyFailure('content_digest_invalid');\n\n let provided: Uint8Array;\n try {\n provided = ethers.decodeBase64(match[1]);\n } catch {\n throw new VerifyFailure('content_digest_invalid');\n }\n const expected = ethers.getBytes(ethers.sha256(rawBody));\n if (!constantTimeEqual(provided, expected)) {\n throw new VerifyFailure('content_digest_mismatch');\n }\n}\n\nasync function consumeNonce(\n noncePolicy: NoncePolicy,\n parsed: ParsedSignatureInput,\n wallet: string,\n skewFuture: number\n): Promise<void> {\n if (!parsed.nonce) return;\n let outcome;\n try {\n outcome = await noncePolicy.store.consume(parsed.nonce, {\n wallet,\n chainId: parsed.chainId,\n ttlSeconds: parsed.expires - parsed.created + skewFuture,\n created: parsed.created,\n expires: parsed.expires,\n });\n } catch {\n // Store infrastructure failure is NOT a bad signature: it must answer\n // 503 + retry, never a terminal 401.\n throw new VerifyFailure('nonce_store_unavailable');\n }\n switch (outcome) {\n case 'ok':\n return;\n case 'unknown':\n throw new VerifyFailure('nonce_unknown');\n case 'replayed':\n throw new VerifyFailure('nonce_replayed');\n case 'expired':\n throw new VerifyFailure('nonce_expired');\n case 'unavailable':\n throw new VerifyFailure('nonce_store_unavailable');\n default:\n throw new VerifyFailure('nonce_store_unavailable', 'Nonce store returned an unknown outcome');\n }\n}\n\n/**\n * Verify an ERC-8128 signed HTTP request.\n *\n * Expected authentication failures come back as `{ ok: false, code, status,\n * retryable }` — they are values, not exceptions. Exceptions are reserved for\n * programmer error (e.g. a policy with no authority).\n */\nexport async function verifyRequest(\n req: VerifiableRequest,\n policy: VerifyPolicy\n): Promise<VerifyResult> {\n if (!policy || typeof policy.authority !== 'string') {\n throw new X402Error(\n 'verifyRequest requires policy.authority — a value, never derived from a client-controlled header.',\n 'INVALID_CONFIG'\n );\n }\n\n const accept = policy.accept ?? 'accept-both';\n const componentsRule = policy.components ?? 'exact-ordered';\n const digestRule = policy.contentDigest ?? 'body-present';\n const maxValiditySec = policy.maxValiditySec ?? 300;\n const skewFuture = policy.clockSkew?.future ?? 30;\n const skewPastExpiry = policy.clockSkew?.pastExpiry ?? 0;\n const label = policy.label ?? 'eth';\n const now = policy.now ? policy.now() : Math.floor(Date.now() / 1000);\n\n let parsed: ParsedSignatureInput | undefined;\n\n const census = (outcome: 'ok' | Erc8128Code) => {\n if (!policy.onObservedProfile || !parsed) return;\n policy.onObservedProfile(parsed.observedProfile, {\n wallet: parsed.wallet,\n chainId: parsed.chainId,\n keyid: parsed.keyid,\n outcome,\n });\n };\n\n try {\n const header = headerLookup(req.headers);\n const authority = policyAuthority(policy.authority);\n\n // 1. Wire parsing. paramsRaw is kept verbatim from here on.\n parsed = parseSignatureInput(header('signature-input') ?? '', label);\n\n // 2. alg gate. Accepting a scheme we do not verify with would let a\n // signature declare one algorithm and be checked under another.\n if (parsed.alg !== undefined && parsed.alg !== 'eip191') {\n throw new VerifyFailure('alg_unsupported');\n }\n if (accept === 'canonical') {\n if (parsed.alg === undefined) throw new VerifyFailure('alg_missing');\n if (parsed.keyid !== parsed.keyid.toLowerCase()) {\n throw new VerifyFailure('keyid_not_lowercase');\n }\n }\n if (accept === 'legacy' && parsed.alg !== undefined) {\n throw new VerifyFailure('alg_unsupported', 'This policy accepts only the legacy (no alg) profile');\n }\n\n // 3. Signature bytes for this label.\n const signature = parseSignatureHeader(header('signature') ?? '', parsed.label);\n\n // 4. Freshness.\n if (\n !Number.isSafeInteger(parsed.created) ||\n !Number.isSafeInteger(parsed.expires) ||\n parsed.expires <= parsed.created ||\n parsed.expires - parsed.created > maxValiditySec ||\n parsed.created > now + skewFuture ||\n now >= parsed.expires + skewPastExpiry\n ) {\n throw new VerifyFailure('signature_stale');\n }\n\n // 5. Chain allowlist (undefined ⇒ any chain, EM's posture).\n if (policy.allowedChainIds && !policy.allowedChainIds.includes(parsed.chainId)) {\n throw new VerifyFailure('chain_not_allowed');\n }\n\n const { path, query } = splitRequestTarget(req.url);\n const covered = parsed.covered;\n\n // 6. Nonce presence.\n const nonceMode = policy.nonce?.mode ?? 'required';\n if (policy.nonce && nonceMode === 'required' && !parsed.nonce) {\n throw new VerifyFailure('nonce_required');\n }\n\n // 7. Binding, for the lenient posture. The strict posture checks the\n // exact list further down (it needs the digest decision first).\n if (componentsRule === 'request-bound-subset') {\n const missing = REQUEST_BOUND_COMPONENTS.some((c) => !covered.includes(c));\n if (missing || (query && !covered.includes('@query'))) {\n throw new VerifyFailure('class_bound_rejected');\n }\n }\n\n // 8. Nonce consumption, EM's order: before the expensive crypto, so two\n // concurrent requests cannot both pass.\n const consumeOrder = policy.nonce?.consume ?? 'before-verify';\n if (policy.nonce && consumeOrder === 'before-verify') {\n await consumeNonce(policy.nonce, parsed, parsed.wallet, skewFuture);\n }\n\n // 9. Content-Digest.\n const digestHeader = header('content-digest');\n const rawBody = req.rawBody;\n let digestVerified = false;\n\n if (digestRule === 'non-idempotent-methods') {\n // MeshRelay's rule: every write must carry a raw body AND a digest.\n const requiresDigest = !IDEMPOTENT_METHODS.includes(req.method.toUpperCase());\n if (requiresDigest) {\n if (rawBody === undefined || digestHeader === undefined) {\n throw new VerifyFailure('content_digest_required');\n }\n verifyContentDigest(digestHeader, rawBody);\n digestVerified = true;\n }\n } else {\n // EM's rule, body-presence driven.\n //\n // `hasBody` is derived from the wire headers exactly as EM derives it,\n // PLUS a byte-level term. EM's header-only heuristic is sound only under\n // HTTP/1.1 framing, where a body cannot exist without content-length or\n // transfer-encoding; that is an environmental invariant of its uvicorn\n // deployment, not something the rule enforces. A shared SDK cannot\n // inherit an unstated precondition, so a non-empty body always counts as\n // a body here. The extra term never fires for HTTP/1.1 traffic.\n const contentLength = header('content-length');\n const headerSaysBody =\n (contentLength !== undefined && contentLength !== '0') ||\n header('transfer-encoding') !== undefined;\n const bytesSayBody = rawBody !== undefined && rawBody.length > 0;\n const hasBody = headerSaysBody || bytesSayBody;\n\n if (hasBody) {\n // CRY-001: the test is on the SIGNED list, not on header presence, so\n // an unsigned Content-Digest header can never satisfy it — and a body\n // attached to a bodyless-signed request is rejected here, before any\n // signature work.\n if (!covered.includes('content-digest')) {\n throw new VerifyFailure(\n 'content_digest_required',\n 'Bodied request MUST include content-digest in signed components'\n );\n }\n verifyContentDigest(digestHeader, rawBody ?? new Uint8Array(0));\n digestVerified = true;\n } else if (covered.includes('content-digest')) {\n // Bodyless request that covers the digest voluntarily — still verified.\n verifyContentDigest(digestHeader, rawBody ?? new Uint8Array(0));\n digestVerified = true;\n }\n }\n\n // 10. Exact covered list, for the strict posture.\n if (componentsRule === 'exact-ordered') {\n const expected = [...REQUEST_BOUND_COMPONENTS];\n if (query) expected.push('@query');\n if (digestVerified) expected.push('content-digest');\n if (\n covered.length !== expected.length ||\n covered.some((component, index) => component !== expected[index])\n ) {\n throw new VerifyFailure('components_invalid');\n }\n }\n\n // 11. Rebuild the base. The parameter substring is replayed VERBATIM.\n const signatureBase = buildSignatureBase({\n method: req.method,\n authority,\n path,\n query,\n contentDigest: digestHeader,\n covered,\n params: parsed.paramsRaw,\n headers: Object.fromEntries(\n covered\n .filter((c) => !c.startsWith('@') && c !== 'content-digest')\n .map((c) => [c.toLowerCase(), header(c) ?? ''])\n ),\n });\n\n // 12. EIP-191 recovery.\n let recovered: string | undefined;\n try {\n recovered = ethers.verifyMessage(signatureBase, ethers.hexlify(signature)).toLowerCase();\n } catch {\n recovered = undefined;\n }\n\n let via: 'eoa' | 'erc1271' = 'eoa';\n if (recovered !== parsed.wallet) {\n if (!policy.contractVerifier) {\n throw new VerifyFailure(\n recovered === undefined ? 'signature_invalid' : 'wallet_mismatch'\n );\n }\n let valid = false;\n try {\n valid = await policy.contractVerifier({\n address: parsed.wallet,\n chainId: parsed.chainId,\n messageHash: ethers.getBytes(ethers.keccak256(eip191Message(signatureBase))),\n signature,\n });\n } catch {\n valid = false;\n }\n if (!valid) {\n throw new VerifyFailure(\n recovered === undefined ? 'signature_invalid' : 'wallet_mismatch'\n );\n }\n via = 'erc1271';\n }\n\n // 13. Nonce consumption, MeshRelay's order: only after every\n // cryptographic and freshness check has passed.\n if (policy.nonce && consumeOrder === 'after-verify') {\n await consumeNonce(policy.nonce, parsed, parsed.wallet, skewFuture);\n }\n\n census('ok');\n return {\n ok: true,\n wallet: parsed.wallet,\n chainId: parsed.chainId,\n keyid: parsed.keyid,\n label: parsed.label,\n nonce: parsed.nonce,\n created: parsed.created,\n expires: parsed.expires,\n signatureBase,\n observedProfile: parsed.observedProfile,\n via,\n };\n } catch (error) {\n if (error instanceof VerifyFailure || error instanceof Erc8128ParseError) {\n census(error.code);\n return {\n ok: false,\n code: error.code,\n message: error.message,\n status: ERC8128_ERROR_STATUS[error.code],\n retryable: ERC8128_ERROR_RETRYABLE[error.code],\n observedProfile: parsed?.observedProfile,\n };\n }\n // Anything else is an SDK bug, not an authentication outcome. External\n // callbacks (nonce store, contract verifier) are already contained above.\n throw error;\n }\n}\n","/**\n * uvd-x402-sdk/erc8128 — the live postures, as data.\n *\n * `meshrelay-strict` and `em-lenient` reproduce what each product does today,\n * knob for knob, so adopting the SDK changes neither one's behaviour.\n * `canonical-strict` is the S3 posture: pre-written, unused until the\n * deprecation census is clean.\n *\n * These objects are pinned in the shipped vectors (`erc8128.f3-3.json`, block\n * `policies`) and `conformance.test.ts` asserts `presetAsData()` is deep-equal\n * to it — a preset edited without a matching vector edit fails the suite. That\n * block is snake_case because the SAME file is read by the Python SDK; see\n * {@link presetAsData}.\n *\n * They are PARTIAL on purpose: `authority` and `nonce` are per-deployment and\n * must be supplied by the caller. Spreading a preset and then overriding a\n * knob silently changes posture with no type error — use\n * {@link policyFromPreset}, which also carries the nonce ordering.\n *\n * One deliberate non-knob: no nonce charset/length rule. MeshRelay's\n * `^[A-Za-z0-9_-]{32,128}$` lives in its store, where issuance policy belongs;\n * the SDK never issues or formats a nonce.\n *\n * The nonce CONSUME ORDER is not inside the preset object — the store is the\n * caller's — but it belongs to the preset all the same, so it lives beside it\n * in {@link PRESET_NONCE_CONSUME} and `policyFromPreset()` stitches the two\n * together. Adopting `em-lenient` therefore gets EM's before-verify ordering\n * rather than a silently different one.\n */\n\nimport { X402Error } from '../types';\nimport type { NonceConsumeOrder, NonceStore } from './nonce';\nimport type { VerifyPolicy } from './verifier';\n\nexport type PolicyPresetName = 'meshrelay-strict' | 'em-lenient' | 'canonical-strict';\n\nexport type PolicyPreset = Omit<VerifyPolicy, 'authority' | 'nonce'>;\n\nexport const POLICY_PRESETS: Readonly<Record<PolicyPresetName, PolicyPreset>> = Object.freeze({\n /** MeshRelay today: order-locked components, method-driven digest, chain\n * allowlist, no grace after expiry, `eth` label only. */\n 'meshrelay-strict': Object.freeze({\n accept: 'accept-both',\n components: 'exact-ordered',\n contentDigest: 'non-idempotent-methods',\n allowedChainIds: Object.freeze([8453]),\n maxValiditySec: 300,\n clockSkew: Object.freeze({ future: 30, pastExpiry: 0 }),\n label: 'eth',\n }) as PolicyPreset,\n\n /** Execution Market today: superset components in any order, body-presence\n * digest, any chain id, ±30s skew, any label. */\n 'em-lenient': Object.freeze({\n accept: 'accept-both',\n components: 'request-bound-subset',\n contentDigest: 'body-present',\n maxValiditySec: 300,\n clockSkew: Object.freeze({ future: 30, pastExpiry: 30 }),\n label: 'any',\n }) as PolicyPreset,\n\n /** S3 target: legacy emitters start failing with `alg_missing` /\n * `keyid_not_lowercase`. Not used until the census is clean.\n *\n * The chain allowlist is PINNED to 8453, the production auth chain of both\n * products: a preset named \"strict\" that accepts any chain is not strict. A\n * verifier that already ran a wider allowlist overrides it explicitly. */\n 'canonical-strict': Object.freeze({\n accept: 'canonical',\n components: 'exact-ordered',\n contentDigest: 'body-present',\n allowedChainIds: Object.freeze([8453]),\n maxValiditySec: 300,\n clockSkew: Object.freeze({ future: 30, pastExpiry: 0 }),\n label: 'eth',\n }) as PolicyPreset,\n});\n\n/**\n * Preset → the nonce-consumption order that belongs to it. Kept beside the\n * presets (rather than inside them) because the store itself is the caller's:\n * MeshRelay consumes AFTER the crypto, EM BEFORE it, and neither can be\n * migrated to the other without changing a live product's behaviour.\n */\nexport const PRESET_NONCE_CONSUME: Readonly<Record<PolicyPresetName, NonceConsumeOrder>> =\n Object.freeze({\n 'meshrelay-strict': 'after-verify',\n 'em-lenient': 'before-verify',\n 'canonical-strict': 'after-verify',\n });\n\n/** Every preset rejects a nonce-less (replayable) signature. */\nexport const PRESET_NONCE_MODE = 'required' as const;\n\n/** The preset's knobs are all overridable; `authority` is required. */\nexport interface PolicyFromPresetOptions extends Partial<PolicyPreset> {\n /** A VALUE, never derived from a client-controlled header. */\n authority: string;\n /** The caller's store. Omitted ⇒ no nonce policy at all. */\n nonceStore?: NonceStore;\n /** Default `'required'`. */\n nonceMode?: 'required' | 'optional';\n}\n\n/**\n * Specialise a preset with the two things it cannot carry: the authority VALUE\n * and the caller's nonce store. The consume order comes from\n * {@link PRESET_NONCE_CONSUME}, so adopting `meshrelay-strict` cannot\n * accidentally flip MeshRelay to EM's ordering.\n */\nexport function policyFromPreset(\n name: PolicyPresetName,\n options: PolicyFromPresetOptions\n): VerifyPolicy {\n const preset = POLICY_PRESETS[name];\n if (!preset) {\n throw new X402Error(`Unknown ERC-8128 policy preset: ${name}`, 'INVALID_CONFIG');\n }\n const { authority, nonceStore, nonceMode = PRESET_NONCE_MODE, ...overrides } = options;\n return {\n ...preset,\n authority,\n ...(nonceStore\n ? { nonce: { store: nonceStore, mode: nonceMode, consume: PRESET_NONCE_CONSUME[name] } }\n : {}),\n ...overrides,\n };\n}\n\n/**\n * The JSON-shaped view of a preset — what the vectors' `policies` block pins\n * and what the conformance suite compares against, nonce ordering included.\n *\n * SNAKE_CASE AND FLAT, deliberately. This is the WIRE projection, not the\n * TypeScript object: the same block is read by the Python SDK, which spells\n * these fields `content_digest` / `clock_skew_future_sec`, and the rest of the\n * vector document (`chain_id`, `observed_profile`, `signature_base`) is\n * snake_case too. Emitting `contentDigest` here meant the shared vectors could\n * never be one file — each language would have had to ship its own casing.\n * Python's `preset_as_data()` returns exactly this, field for field, so\n * `presetAsData(n) === preset_as_data(n) === vectors.policies[n]` holds across\n * both runtimes and is asserted by the cross-language harness.\n */\nexport function presetAsData(name: PolicyPresetName): Record<string, unknown> {\n const preset = POLICY_PRESETS[name];\n return {\n accept: preset.accept,\n components: preset.components,\n content_digest: preset.contentDigest,\n allowed_chain_ids: preset.allowedChainIds ? [...preset.allowedChainIds] : null,\n max_validity_sec: preset.maxValiditySec,\n clock_skew_future_sec: preset.clockSkew?.future,\n clock_skew_past_expiry_sec: preset.clockSkew?.pastExpiry,\n label: preset.label,\n nonce_mode: PRESET_NONCE_MODE,\n nonce_consume: PRESET_NONCE_CONSUME[name],\n };\n}\n","/**\n * AUTO-GENERATED — DO NOT EDIT.\n *\n * Source: src/erc8128/erc8128.f3-1.json (byte-identical copy of\n * execution-market/shared/test-vectors/erc8128.json)\n * src/erc8128/erc8128.f3-3.json (additive, derived by\n * scripts/derive-erc8128-f3-3.mjs)\n * Regenerate: npm run vectors:gen\n * Verify: npm run vectors:check (fails when this file is stale)\n *\n * The JSON is embedded verbatim so the hashes below cover the exact bytes the\n * package ships, in both the CJS and the ESM chunk.\n */\n\n/* eslint-disable */\n\n/** Raw F3-1 vector document (LF-normalised). */\nexport const F3_1_VECTORS_JSON: string = \"{\\n \\\"_note\\\": [\\n \\\"F3-1 golden vectors: the PINNED ERC-8128 wire format plus the two\\\",\\n \\\"legacy variants the verifier stays tolerant of. Single source for the\\\",\\n \\\"conformance suites: mcp_server (pytest, tests/test_erc8128_conformance.py),\\\",\\n \\\"em-plugin-sdk (tests/test_erc8128.py), sdk/python (tests/test_signer.py),\\\",\\n \\\"sdk/typescript (src/__tests__/erc8128.conformance.test.ts) and\\\",\\n \\\"ows-mcp-server (src/erc8128-base.test.ts) — the TS runtimes joined in F3-2.\\\",\\n \\\"Signatures are deterministic (RFC 6979): the same key + signature base\\\",\\n \\\"produces the same 65 bytes in eth_account and ethers, so every\\\",\\n \\\"implementation of a given variant must reproduce these headers exactly.\\\",\\n \\\"private_key is stored WITHOUT the 0x prefix (the pre-commit secret\\\",\\n \\\"scanner blocks any literal 0x + 64 hex chars); loaders re-prefix it.\\\",\\n \\\"It is a synthetic test key (0x42 * 32) that never held funds.\\\"\\n ],\\n \\\"policy\\\": {\\n \\\"pinned_wire_format\\\": {\\n \\\"decided\\\": \\\"2026-08-01 (F3-1)\\\",\\n \\\"alg\\\": \\\"eip191\\\",\\n \\\"alg_required\\\": true,\\n \\\"keyid_lowercase\\\": true,\\n \\\"keyid_format\\\": \\\"erc8128:{chain_id}:{address_lowercase}\\\",\\n \\\"label\\\": \\\"eth\\\",\\n \\\"signature_params_order\\\": [\\n \\\"created\\\",\\n \\\"expires\\\",\\n \\\"nonce\\\",\\n \\\"keyid\\\",\\n \\\"alg\\\"\\n ],\\n \\\"covered_components_order\\\": [\\n \\\"@method\\\",\\n \\\"@authority\\\",\\n \\\"@path\\\",\\n \\\"@query (only when the URL has a query string)\\\",\\n \\\"content-digest (only when the request has a body)\\\"\\n ],\\n \\\"signature_encoding\\\": \\\"base64(r||s||v, 65 bytes) wrapped in RFC 8941 byte sequence\\\",\\n \\\"content_digest\\\": \\\"sha-256 (RFC 9530)\\\",\\n \\\"signing\\\": \\\"EIP-191 personal_sign over the RFC 9421 signature base\\\",\\n \\\"rationale\\\": [\\n \\\"alg=eip191 + lowercase keyid is what the canonical skill\\\",\\n \\\"(dashboard/public/skill.md v10.0.0 EM8128Client) documents and what\\\",\\n \\\"the external fleet already emits \\\\u2014 the copies we cannot migrate by\\\",\\n \\\"PR. F3-2 converged the 5 client copies to canonical; the backend\\\",\\n \\\"reference signer (server-side test helper) still emits\\\",\\n \\\"legacy_no_alg \\\\u2014 see the implementations map.\\\",\\n \\\"Lowercase keyid is mandatory: the checksummed-keyid drift caused\\\",\\n \\\"the v9.x silent-auth-failure INC (sdk/python/_signer.py:210-213).\\\"\\n ]\\n },\\n \\\"verifier_tolerance\\\": {\\n \\\"accepts_missing_alg\\\": true,\\n \\\"accepts_checksummed_keyid\\\": true,\\n \\\"note\\\": [\\n \\\"The backend verifier deliberately stays tolerant of both legacy\\\",\\n \\\"variants (it rebuilds the byte-exact base the client signed and\\\",\\n \\\"lowercases both sides of the address comparison). Do NOT harden\\\",\\n \\\"acceptance until every emitter passes the canonical vector; a\\\",\\n \\\"hardening is a contract change: update these vectors, the\\\",\\n \\\"conformance suite, and bump skill.md.\\\"\\n ]\\n }\\n },\\n \\\"frozen\\\": {\\n \\\"private_key\\\": \\\"4242424242424242424242424242424242424242424242424242424242424242\\\",\\n \\\"address\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"address_checksummed\\\": \\\"0x17c5185167401eD00cF5F5b2fc97D9BBfDb7D025\\\",\\n \\\"chain_id\\\": 8453,\\n \\\"created\\\": 1754006400,\\n \\\"expires\\\": 1754006700,\\n \\\"nonce\\\": \\\"f3-1-conformance-nonce-0001\\\"\\n },\\n \\\"requests\\\": {\\n \\\"get_query\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"https://api.execution.market/api/v1/tasks?status=published&limit=5\\\",\\n \\\"body\\\": null\\n },\\n \\\"post_body\\\": {\\n \\\"method\\\": \\\"POST\\\",\\n \\\"url\\\": \\\"https://api.execution.market/api/v1/tasks\\\",\\n \\\"body\\\": \\\"{\\\\\\\"title\\\\\\\":\\\\\\\"F3-1 conformance\\\\\\\",\\\\\\\"bounty_usd\\\\\\\":0.1}\\\"\\n }\\n },\\n \\\"vectors\\\": {\\n \\\"canonical\\\": {\\n \\\"get_query\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@query\\\\\\\": ?status=published&limit=5\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:0v4mJbn6JjlDOq3AyO16MhXlhoOkI4uxnd9tJitVBqkN20kNglL07U2HznZcdmUjS+QZqSCP4rLqWIE3SgsJUxs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"post_body\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": POST\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"content-digest\\\\\\\": sha-256=:yitNmn9roYfKVZJpvmRDFucegbyS2nDuvVoE4zuzu7g=:\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:+AIbVIIbugueMUZU1L7Nn5NAulvb0L4I0o7KMig1Dv12qHR7pX9OfotNig8mHnM5MByu9ZGXVGj/wYC8pbs52xw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"Content-Digest\\\": \\\"sha-256=:yitNmn9roYfKVZJpvmRDFucegbyS2nDuvVoE4zuzu7g=:\\\"\\n }\\n }\\n },\\n \\\"legacy_no_alg\\\": {\\n \\\"get_query\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@query\\\\\\\": ?status=published&limit=5\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:hcrt/D26EPTizJGHeR0dvscl9atj7vnd+ixZbR3bpJFDGefTECAEgkLatLMI/NuNtV7siMxjkzrxnx9ww6biqBs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"post_body\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": POST\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"content-digest\\\\\\\": sha-256=:yitNmn9roYfKVZJpvmRDFucegbyS2nDuvVoE4zuzu7g=:\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:RK5sZyChzoBccdqogrTT/HINSc7XCJUTqaKUR+eEptx5FhHCe2C8jbRYhpCs1N/zgnwsD1urZN5m60qX48h6kxw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"Content-Digest\\\": \\\"sha-256=:yitNmn9roYfKVZJpvmRDFucegbyS2nDuvVoE4zuzu7g=:\\\"\\n }\\n }\\n },\\n \\\"legacy_alg_checksum_keyid\\\": {\\n \\\"get_query\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@query\\\\\\\": ?status=published&limit=5\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401eD00cF5F5b2fc97D9BBfDb7D025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:gNNfGRgF5+W2MYZymiEMTSgX1o0hlwVENdprnldY6qlgDEcdqOeimoj835V40avsmKK2jjvPPzXP9sobPwCO2Bw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401eD00cF5F5b2fc97D9BBfDb7D025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"post_body\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": POST\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"content-digest\\\\\\\": sha-256=:yitNmn9roYfKVZJpvmRDFucegbyS2nDuvVoE4zuzu7g=:\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401eD00cF5F5b2fc97D9BBfDb7D025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:o/VaEKYjPrafAKLaeMQT7clsTQ3I2WaySRQuYinxv24fCUHKLCimmQsXb/XsRyP+CGhMScrUwKtKs7kUQcf80hw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401eD00cF5F5b2fc97D9BBfDb7D025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"Content-Digest\\\": \\\"sha-256=:yitNmn9roYfKVZJpvmRDFucegbyS2nDuvVoE4zuzu7g=:\\\"\\n }\\n }\\n }\\n },\\n \\\"implementations\\\": {\\n \\\"mcp_server/integrations/erc8128/signer.py\\\": \\\"legacy_no_alg\\\",\\n \\\"em-plugin-sdk/em_plugin_sdk/erc8128.py\\\": \\\"canonical\\\",\\n \\\"sdk/typescript/src/erc8128.ts\\\": \\\"canonical\\\",\\n \\\"sdk/python/execution_market/_signer.py\\\": \\\"canonical\\\",\\n \\\"ows-mcp-server/src/server.ts\\\": \\\"canonical\\\",\\n \\\"scripts/em_monitor.py\\\": \\\"canonical\\\"\\n }\\n}\\n\";\n\n/** Raw F3-3 vector document (LF-normalised). */\nexport const F3_3_VECTORS_JSON: string = \"{\\n \\\"_note\\\": [\\n \\\"F3-3 ADDITIVE conformance vectors for ERC-8128. F3-1 stays the pinned\\\",\\n \\\"wire format; this file only adds cases F3-1 has no vector for — a\\\",\\n \\\"bodyless POST, a bodyless DELETE, a POST with an empty-string body, a\\\",\\n \\\"query-less GET and a non-ASCII path that pins the EIP-191 UTF-8 BYTE\\\",\\n \\\"length — plus their legacy_no_alg twins, the policy presets as data,\\\",\\n \\\"and the verify matrix that turns accept/reject into data instead of two\\\",\\n \\\"hand-written suites.\\\",\\n \\\"THIS FILE IS ONE ARTEFACT. It must stay BYTE-IDENTICAL in uvd-x402-sdk\\\",\\n \\\"(npm) src/erc8128/, uvd-x402-sdk (PyPI) src/uvd_x402_sdk/erc8128/ and\\\",\\n \\\"execution-market shared/test-vectors/. It is stored LF and read as\\\",\\n \\\"BYTES; every repo pins it to LF in .gitattributes so a Windows checkout\\\",\\n \\\"cannot change its hash. Never hand-edit a copy: run\\\",\\n \\\"`npm run vectors:gen` in the TypeScript SDK and commit all three.\\\",\\n \\\"Generated by scripts/derive-erc8128-f3-3.mjs with the SAME synthetic\\\",\\n \\\"public test key already published in erc8128.f3-1.json (frozen.\\\",\\n \\\"private_key — a key that never held funds). It is NOT duplicated here;\\\",\\n \\\"both SDKs read it from F3-1. Signatures are deterministic (RFC 6979),\\\",\\n \\\"so the derivation is reproducible.\\\",\\n \\\"Four of these signatures (canonical/get_noquery, canonical/post_nobody,\\\",\\n \\\"canonical/delete_nobody, canonical/post_emptybody) are pinned\\\",\\n \\\"independently as V1/V4/V5/V7 in the design spec and asserted as literal\\\",\\n \\\"strings in src/erc8128/conformance.test.ts.\\\",\\n \\\"The authority_* requests and the verify_cases that carry their own\\\",\\n \\\"`authority` exist because NOTHING ELSE HERE COULD SEE THE AUTHORITY\\\",\\n \\\"RULE: every other pinned URL is lowercase with no explicit port, so the\\\",\\n \\\"per-scheme rule and the scheme-blind one produce the same bytes for all\\\",\\n \\\"of them. Reverting either SDK to the scheme-blind rule left the whole\\\",\\n \\\"cross-language run green. A guard that cannot fail is not a guard.\\\",\\n \\\"Two of these vectors carry a control character or a U+00A0 NBSP inside a\\\",\\n \\\"CONFIGURED authority; they are written as \\\\\\\\uXXXX escapes so the bytes\\\",\\n \\\"are visible in an editor and survive a copy-paste between the three\\\",\\n \\\"repos.\\\"\\n ],\\n \\\"generation\\\": \\\"F3-3\\\",\\n \\\"extends\\\": \\\"F3-1\\\",\\n \\\"frozen\\\": {\\n \\\"address\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"address_checksummed\\\": \\\"0x17c5185167401eD00cF5F5b2fc97D9BBfDb7D025\\\",\\n \\\"chain_id\\\": 8453,\\n \\\"created\\\": 1754006400,\\n \\\"expires\\\": 1754006700,\\n \\\"nonce\\\": \\\"f3-1-conformance-nonce-0001\\\",\\n \\\"authority\\\": \\\"api.execution.market\\\",\\n \\\"label\\\": \\\"eth\\\"\\n },\\n \\\"policy\\\": {\\n \\\"authority\\\": {\\n \\\"decided\\\": \\\"2026-08-06 (owner, R1/R2/R3)\\\",\\n \\\"url_rule\\\": \\\"rfc9421-2.2.3, default port of THAT scheme only\\\",\\n \\\"configured_rule\\\": \\\"lowercase + trim, ports NEVER touched\\\",\\n \\\"shapes\\\": [\\n {\\n \\\"deployment\\\": \\\"https on :443\\\",\\n \\\"url_authority\\\": \\\"host:443\\\",\\n \\\"signs\\\": \\\"host\\\",\\n \\\"configure\\\": \\\"host\\\"\\n },\\n {\\n \\\"deployment\\\": \\\"http on :80\\\",\\n \\\"url_authority\\\": \\\"host:80\\\",\\n \\\"signs\\\": \\\"host\\\",\\n \\\"configure\\\": \\\"host\\\"\\n },\\n {\\n \\\"deployment\\\": \\\"https on :8443\\\",\\n \\\"url_authority\\\": \\\"host:8443\\\",\\n \\\"signs\\\": \\\"host:8443\\\",\\n \\\"configure\\\": \\\"host:8443\\\"\\n },\\n {\\n \\\"deployment\\\": \\\"https on :80\\\",\\n \\\"url_authority\\\": \\\"host:80\\\",\\n \\\"signs\\\": \\\"host:80\\\",\\n \\\"configure\\\": null\\n },\\n {\\n \\\"deployment\\\": \\\"http on :443\\\",\\n \\\"url_authority\\\": \\\"host:443\\\",\\n \\\"signs\\\": \\\"host:443\\\",\\n \\\"configure\\\": null\\n }\\n ],\\n \\\"note\\\": [\\n \\\"A CONFIGURED authority is the EXPECTED OUTPUT of the URL rule, not\\\",\\n \\\"another input to it: it carries no scheme, so \\\\\\\"the default port\\\\\\\"\\\",\\n \\\"has no answer for it and every guess breaks a real deployment.\\\",\\n \\\"Hence `configure: null` on the last two rows — they sign a default\\\",\\n \\\"port, and a config carrying one is answered 503 authority_invalid\\\",\\n \\\"with a message naming the fix. 503 and not 401: the operator made\\\",\\n \\\"the mistake, and a client cannot see, let alone fix, it.\\\"\\n ]\\n },\\n \\\"content_digest\\\": {\\n \\\"decided\\\": \\\"2026-08-03 (owner, spec §10 Q1)\\\",\\n \\\"rule\\\": \\\"body-present\\\",\\n \\\"note\\\": [\\n \\\"Execution Market's body-presence rule is canonical for the SDK: a\\\",\\n \\\"Content-Digest is REQUIRED, and MUST be in the signed component\\\",\\n \\\"list, if and only if the request carries a body. A bodyless request\\\",\\n \\\"may cover it voluntarily, in which case it is still verified.\\\",\\n \\\"MeshRelay keeps its method-driven rule via the\\\",\\n \\\"'non-idempotent-methods' knob, so adopting the SDK changes none of\\\",\\n \\\"its behaviour.\\\"\\n ]\\n }\\n },\\n \\\"requests\\\": {\\n \\\"get_noquery\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"https://api.execution.market/api/v1/tasks\\\",\\n \\\"body\\\": null\\n },\\n \\\"post_nobody\\\": {\\n \\\"method\\\": \\\"POST\\\",\\n \\\"url\\\": \\\"https://api.execution.market/api/v1/tasks/abc/cancel\\\",\\n \\\"body\\\": null\\n },\\n \\\"delete_nobody\\\": {\\n \\\"method\\\": \\\"DELETE\\\",\\n \\\"url\\\": \\\"https://api.execution.market/api/v1/tasks/abc\\\",\\n \\\"body\\\": null\\n },\\n \\\"post_emptybody\\\": {\\n \\\"method\\\": \\\"POST\\\",\\n \\\"url\\\": \\\"https://api.execution.market/api/v1/tasks/abc/cancel\\\",\\n \\\"body\\\": \\\"\\\"\\n },\\n \\\"utf8_path\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"https://api.execution.market/api/v1/tareas/ñandú?buscar=café\\\",\\n \\\"body\\\": null\\n },\\n \\\"authority_uppercase_host\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"https://API.EXECUTION.MARKET/api/v1/tasks\\\",\\n \\\"body\\\": null\\n },\\n \\\"authority_https_on_443\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"https://api.execution.market:443/api/v1/tasks\\\",\\n \\\"body\\\": null\\n },\\n \\\"authority_http_on_80\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"http://api.execution.market:80/api/v1/tasks\\\",\\n \\\"body\\\": null\\n },\\n \\\"authority_https_on_8443\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"https://api.execution.market:8443/api/v1/tasks\\\",\\n \\\"body\\\": null\\n },\\n \\\"authority_http_on_443\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"http://api.execution.market:443/api/v1/tasks\\\",\\n \\\"body\\\": null\\n },\\n \\\"authority_https_on_80\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"https://api.execution.market:80/api/v1/tasks\\\",\\n \\\"body\\\": null\\n }\\n },\\n \\\"vectors\\\": {\\n \\\"canonical\\\": {\\n \\\"get_noquery\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:1GRZMnGfUfo23Y9qNIYdsqQz2Q9Mvp3hvIgj+1AapXhKrnYi9zNG9Ilks2n9/rtzTiozLSB4yQs+vrx6TWmOyhw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"post_nobody\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": POST\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks/abc/cancel\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:VueO6hM652wp8ZRtTyI49lrnQtDtqsCJ3qbMdGRIXdwuiCnBl/T7oHefcmvcP88MpXi3s+Lj723PNMzED9uJXhw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"delete_nobody\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": DELETE\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks/abc\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:SlH4Ev68FarWf/JZ282/jF5LhE72AQKmrc+WTOph5UtoNqMx/D0AQxzYWks3jhURBZt3rjSHhL9x3r7k+HhP7Rs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"post_emptybody\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": POST\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks/abc/cancel\\\\n\\\\\\\"content-digest\\\\\\\": sha-256=:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=:\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:2ODpBTt4ci8Tg03GPmLSLxf4nK3Htt0GfXs2hgVN/elABjQAYbFQR9WqVuGJ+BNDQEPUTHgIWiIj6PGfRSe4nRs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"Content-Digest\\\": \\\"sha-256=:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=:\\\"\\n }\\n },\\n \\\"utf8_path\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tareas/ñandú\\\\n\\\\\\\"@query\\\\\\\": ?buscar=café\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:abKEk17W7q6SoK2qmsXpD7GTws4fuQDTTRgSKdJ2u0J88Ln8EVaeNg52yHnPxjzUtvPKXqOiyuDn/bbcCNvcRRs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_uppercase_host\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:1GRZMnGfUfo23Y9qNIYdsqQz2Q9Mvp3hvIgj+1AapXhKrnYi9zNG9Ilks2n9/rtzTiozLSB4yQs+vrx6TWmOyhw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_https_on_443\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:1GRZMnGfUfo23Y9qNIYdsqQz2Q9Mvp3hvIgj+1AapXhKrnYi9zNG9Ilks2n9/rtzTiozLSB4yQs+vrx6TWmOyhw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_http_on_80\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:1GRZMnGfUfo23Y9qNIYdsqQz2Q9Mvp3hvIgj+1AapXhKrnYi9zNG9Ilks2n9/rtzTiozLSB4yQs+vrx6TWmOyhw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_https_on_8443\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market:8443\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:g+MrSDxYDud9kHNY5zs7qzdlsJgK49FVvNIEms1yld1KXH4LHytQsWBXXabZzOrMRphNvGz9LHlUGnco83I9/Bs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_http_on_443\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market:443\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:L35ltzQT+ufKF/UUQp1SVSw3tVSSgJzBM2CJ6vGt4TMr7HVW4C7s1f6keoQCGJFUgIjpGA8G3pr7XNQeneOF1xw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_https_on_80\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market:80\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:7To493TypQD2yvflxc+lOtE8QATFZPNidC0DHazVXxovc6a41lbqebFQLY9VYJsAcKIXow97QhKSsEEq/iORnRw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n }\\n },\\n \\\"legacy_no_alg\\\": {\\n \\\"get_noquery\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:TjGV6W0YvVwoZ9lIRJ37edgp7QOkJ2fdgwK54DpjZV8hLhdJ8EtLTHkmwdErzMrFLZf25ojaI1/Ve4Avp4imlBs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"post_nobody\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": POST\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks/abc/cancel\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:oxixnLWX5wkQNxRdYPcmG+MiHOic2g8gMw8Bm6XpTt1Gae+5m61Os0JMWsb/RaZ0mNMuyEmRlt2G7YBqYWVvURs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"delete_nobody\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": DELETE\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks/abc\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:DM6OgtBKTYW0hJNRspUkFs7HgJLqchvjbf9yszz1hPh+oUNRTXEs6JY5Pu1dX1dpa2UEjoXp1e/9V5d7aCxXdRs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"post_emptybody\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": POST\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks/abc/cancel\\\\n\\\\\\\"content-digest\\\\\\\": sha-256=:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=:\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:1gckyAsWy4DB4tQyQ1L/y5nmllrcxylQ+83UwQiM00oZjYld2JeoP7TUFr+8nUrRCPJ/XWAj/IPgYyfNZoQL7xs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"Content-Digest\\\": \\\"sha-256=:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=:\\\"\\n }\\n },\\n \\\"utf8_path\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tareas/ñandú\\\\n\\\\\\\"@query\\\\\\\": ?buscar=café\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:0kp6yoU/4T0q3DtA1agJSutzkJV11nqWRU3BWj2psn1YAzTSFrpOuOhit4nO7LYVIXd4vfNRBw4xntqcf+0k0hw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_uppercase_host\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:TjGV6W0YvVwoZ9lIRJ37edgp7QOkJ2fdgwK54DpjZV8hLhdJ8EtLTHkmwdErzMrFLZf25ojaI1/Ve4Avp4imlBs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_https_on_443\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:TjGV6W0YvVwoZ9lIRJ37edgp7QOkJ2fdgwK54DpjZV8hLhdJ8EtLTHkmwdErzMrFLZf25ojaI1/Ve4Avp4imlBs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_http_on_80\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:TjGV6W0YvVwoZ9lIRJ37edgp7QOkJ2fdgwK54DpjZV8hLhdJ8EtLTHkmwdErzMrFLZf25ojaI1/Ve4Avp4imlBs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_https_on_8443\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market:8443\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:YPCUotlu74EOXayMzMmnImSiDHV9EynGmjwduvV3X558l4AIsZvEH1G8FkyHhpJUgztlZlIqNle/SI1YAZCXNxw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_http_on_443\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market:443\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:pD3X7KQbCpw4BjxK19iCqBFaVAJ7BfYHMoTNDJAO/IoeGSdsaWR2kk/uNJSOgho5cWwdDGogar8HAik52T/YPhs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_https_on_80\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market:80\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:PgnuQ8H+Ty/bBRkuJYqHS3H3ctafk66R4HrsuSJacHRX2JX1Ed2y9LkIhF0ot71G6P3IqA5NHbgUASLmcdfoGhs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n }\\n }\\n },\\n \\\"policies\\\": {\\n \\\"meshrelay-strict\\\": {\\n \\\"accept\\\": \\\"accept-both\\\",\\n \\\"components\\\": \\\"exact-ordered\\\",\\n \\\"content_digest\\\": \\\"non-idempotent-methods\\\",\\n \\\"allowed_chain_ids\\\": [\\n 8453\\n ],\\n \\\"max_validity_sec\\\": 300,\\n \\\"clock_skew_future_sec\\\": 30,\\n \\\"clock_skew_past_expiry_sec\\\": 0,\\n \\\"label\\\": \\\"eth\\\",\\n \\\"nonce_mode\\\": \\\"required\\\",\\n \\\"nonce_consume\\\": \\\"after-verify\\\"\\n },\\n \\\"em-lenient\\\": {\\n \\\"accept\\\": \\\"accept-both\\\",\\n \\\"components\\\": \\\"request-bound-subset\\\",\\n \\\"content_digest\\\": \\\"body-present\\\",\\n \\\"allowed_chain_ids\\\": null,\\n \\\"max_validity_sec\\\": 300,\\n \\\"clock_skew_future_sec\\\": 30,\\n \\\"clock_skew_past_expiry_sec\\\": 30,\\n \\\"label\\\": \\\"any\\\",\\n \\\"nonce_mode\\\": \\\"required\\\",\\n \\\"nonce_consume\\\": \\\"before-verify\\\"\\n },\\n \\\"canonical-strict\\\": {\\n \\\"accept\\\": \\\"canonical\\\",\\n \\\"components\\\": \\\"exact-ordered\\\",\\n \\\"content_digest\\\": \\\"body-present\\\",\\n \\\"allowed_chain_ids\\\": [\\n 8453\\n ],\\n \\\"max_validity_sec\\\": 300,\\n \\\"clock_skew_future_sec\\\": 30,\\n \\\"clock_skew_past_expiry_sec\\\": 0,\\n \\\"label\\\": \\\"eth\\\",\\n \\\"nonce_mode\\\": \\\"required\\\",\\n \\\"nonce_consume\\\": \\\"after-verify\\\"\\n }\\n },\\n \\\"verify_cases\\\": [\\n {\\n \\\"vector_id\\\": \\\"canonical/get_query\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_query\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_query\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_body\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_body\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_body\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_emptybody\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_emptybody\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_emptybody\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/utf8_path\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/utf8_path\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/utf8_path\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_nobody\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"content_digest_required\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_nobody\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_nobody\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/delete_nobody\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"content_digest_required\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/delete_nobody\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/delete_nobody\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/get_query\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/get_query\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/get_query\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"alg_missing\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_body\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_body\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_body\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"alg_missing\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/get_noquery\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/get_noquery\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"alg_missing\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_emptybody\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_emptybody\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_emptybody\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"alg_missing\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/utf8_path\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/utf8_path\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/utf8_path\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"alg_missing\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_nobody\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"content_digest_required\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_nobody\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_nobody\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"alg_missing\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/delete_nobody\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"content_digest_required\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/delete_nobody\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/delete_nobody\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"alg_missing\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_alg_checksum_keyid/get_query\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_alg_checksum_keyid\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_alg_checksum_keyid/get_query\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_alg_checksum_keyid\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_alg_checksum_keyid/get_query\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"keyid_not_lowercase\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_alg_checksum_keyid\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_alg_checksum_keyid/post_body\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_alg_checksum_keyid\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_alg_checksum_keyid/post_body\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_alg_checksum_keyid\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_alg_checksum_keyid/post_body\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"keyid_not_lowercase\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_alg_checksum_keyid\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_uppercase_host\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_uppercase_host\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_uppercase_host\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_443\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_443\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_443\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_http_on_80\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_http_on_80\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_http_on_80\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_8443\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\",\\n \\\"authority\\\": \\\"api.execution.market:8443\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_8443\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\",\\n \\\"authority\\\": \\\"api.execution.market:8443\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_8443\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\",\\n \\\"authority\\\": \\\"api.execution.market:8443\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_8443\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"wallet_mismatch\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"canonical\\\",\\n \\\"authority\\\": \\\"api.execution.market\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_http_on_443\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"wallet_mismatch\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"canonical\\\",\\n \\\"authority\\\": \\\"api.execution.market\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_80\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"wallet_mismatch\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"canonical\\\",\\n \\\"authority\\\": \\\"api.execution.market\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_http_on_443\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"authority_invalid\\\",\\n \\\"status\\\": 503,\\n \\\"observed_profile\\\": null,\\n \\\"authority\\\": \\\"api.execution.market:443\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_80\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"authority_invalid\\\",\\n \\\"status\\\": 503,\\n \\\"observed_profile\\\": null,\\n \\\"authority\\\": \\\"api.execution.market:80\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\",\\n \\\"authority\\\": \\\"API.Execution.Market\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\",\\n \\\"authority\\\": \\\" api.execution.market\\\\t\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"authority_invalid\\\",\\n \\\"status\\\": 503,\\n \\\"observed_profile\\\": null,\\n \\\"authority\\\": \\\"api.execution\\\\nmarket\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"authority_invalid\\\",\\n \\\"status\\\": 503,\\n \\\"observed_profile\\\": null,\\n \\\"authority\\\": \\\"api.execution\\\\rmarket\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"authority_invalid\\\",\\n \\\"status\\\": 503,\\n \\\"observed_profile\\\": null,\\n \\\"authority\\\": \\\"api.execution\\\\u000bmarket\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"authority_invalid\\\",\\n \\\"status\\\": 503,\\n \\\"observed_profile\\\": null,\\n \\\"authority\\\": \\\"api.execution\\\\fmarket\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"authority_invalid\\\",\\n \\\"status\\\": 503,\\n \\\"observed_profile\\\": null,\\n \\\"authority\\\": \\\"api.execution\\\\u00a0market\\\"\\n }\\n ]\\n}\\n\";\n\n/**\n * sha256 of the embedded documents. Pinned; both SDKs must report the same map,\n * KEY FOR KEY. The keys are the generation ids as spelled everywhere else —\n * the file names (`erc8128.f3-1.json`), Python's `_RESOURCES`, the documents'\n * own `generation` field. A JS-flavoured `f3_1` here made the spec's\n * cross-language hash-equality check impossible to pass as written.\n */\nexport const CONFORMANCE_SHA256 = {\n 'f3-1': '3c82d81f66cc95c452dbb2892c4aee97c688dc5fe03b721d06c92ba98e4f9bfd',\n 'f3-3': '154ef31dc3e704c376e282ca5ca5dccde00877328cbab250001dbb20ba2e91ac',\n} as const;\n","/**\n * uvd-x402-sdk/erc8128 — the conformance vectors, shipped INSIDE the package.\n *\n * They travel as an inlined string (see `vectors.generated.ts`) rather than a\n * file read, because the package is dual CJS+ESM: `__dirname` does not exist\n * in the `.mjs` chunk and `import.meta.url` is a syntax error in the `.js`\n * one. Build-time inlining is the only form that works in both, and it is the\n * only way a consumer's CI can run `runConformance()` against the SDK version\n * it actually installed.\n *\n * `CONFORMANCE_SHA256` covers the embedded bytes, so hand-editing either copy\n * fails the suite before a single signature is produced.\n */\n\nimport {\n CONFORMANCE_SHA256,\n F3_1_VECTORS_JSON,\n F3_3_VECTORS_JSON,\n} from './vectors.generated';\n\nexport interface Erc8128VectorCase {\n signature_base: string;\n headers: {\n Signature: string;\n 'Signature-Input': string;\n 'Content-Digest'?: string;\n };\n}\n\nexport interface Erc8128RequestSpec {\n method: string;\n url: string;\n /** `null` = no body at all; `\"\"` = a zero-byte body (they differ on the wire). */\n body: string | null;\n}\n\nexport interface Erc8128VerifyCase {\n /** `<family>/<request>`, resolved against F3-3 first, then F3-1. */\n vector_id: string;\n policy: string;\n expect: 'accept' | 'reject';\n code?: string;\n /** Pinned on every reject row: the authority rule turns on 401-vs-503. */\n status?: number;\n wallet?: string;\n /** `null` when the request is refused before `Signature-Input` is parsed. */\n observed_profile?: string | null;\n /**\n * The value CONFIGURED into `VerifyPolicy.authority`. Omitted ⇒\n * `frozen.authority`.\n *\n * It is a per-case field because the configured authority is NOT derivable\n * from the request — that is the whole content of the rule. A runner that\n * derived it from the URL and a runner that read it from `frozen` were\n * testing two different things off one file.\n */\n authority?: string;\n}\n\nexport interface Erc8128Frozen {\n /** Synthetic public test key, stored WITHOUT the `0x` prefix. F3-1 only. */\n private_key?: string;\n address: string;\n address_checksummed: string;\n chain_id: number;\n created: number;\n expires: number;\n nonce: string;\n authority?: string;\n label?: string;\n}\n\nexport interface Erc8128Vectors {\n frozen: Erc8128Frozen;\n requests: Record<string, Erc8128RequestSpec>;\n vectors: Record<string, Record<string, Erc8128VectorCase>>;\n policies?: Record<string, Record<string, unknown>>;\n verify_cases?: Erc8128VerifyCase[];\n [key: string]: unknown;\n}\n\n/** F3-1: byte-identical copy of the fleet's source of truth. */\nexport const CONFORMANCE_VECTORS_F3_1: Erc8128Vectors = JSON.parse(\n F3_1_VECTORS_JSON\n) as Erc8128Vectors;\n\n/** F3-3: additive — bodyless POST/DELETE, empty-body POST, presets, matrix. */\nexport const CONFORMANCE_VECTORS_F3_3: Erc8128Vectors = JSON.parse(\n F3_3_VECTORS_JSON\n) as Erc8128Vectors;\n\nexport { CONFORMANCE_SHA256, F3_1_VECTORS_JSON, F3_3_VECTORS_JSON };\n","/**\n * uvd-x402-sdk/erc8128 — `runConformance()`.\n *\n * Public on purpose: it is the only mechanism by which a consumer's CI can\n * check the SDK build it ACTUALLY INSTALLED, rather than the source tree of\n * this repo. Wire it into MeshRelay's api tests, EM's mcp_server tests, the\n * KarmaKadabra bundle build and Sentinel's image build; fail the job when\n * `report.failed.length > 0`.\n *\n * Three sections — the SAME three the Python package runs, in the same order\n * and with the same count, so one green condition (`report.ok`) and one\n * `passed === total` mean the same thing in both languages:\n * - integrity — the shipped vector bytes hash to `CONFORMANCE_SHA256`, and\n * every policy preset still equals the `policies` block pinned in\n * those bytes. ALWAYS RUNS, even under `only`: a sign-only run\n * against a hand-edited artefact is not a pass. This section is\n * the one TypeScript was missing, which is why the two runners\n * reported 62 and 67 checks off one byte-identical file.\n * - sign — every emittable vector is re-signed and compared BYTE for byte\n * (signatures are deterministic, RFC 6979).\n * - verify — the `verify_cases` matrix: each (vector, policy) pair must\n * produce the pinned accept/reject verdict, error code, HTTP\n * status and observed profile, under the authority that case\n * CONFIGURES. Turning acceptance into DATA is what keeps the\n * TypeScript and Python verifiers from drifting apart.\n *\n * The key used is the synthetic public test key already published in the F3-1\n * fixture (documented there as a key that never held funds). It is read from\n * the vector document, never inlined.\n */\n\nimport { ethers } from 'ethers';\n\nimport { signRequest } from './signer';\nimport type { WireProfile } from './signer';\nimport { policyFromPreset, presetAsData } from './presets';\nimport type { PolicyPresetName } from './presets';\nimport { verifyRequest } from './verifier';\nimport type { VerifyPolicy } from './verifier';\nimport type { NonceContext, NonceOutcome, NonceStore } from './nonce';\nimport { WIRE_CONTRACT_VERSION } from './core';\nimport {\n CONFORMANCE_SHA256,\n CONFORMANCE_VECTORS_F3_1,\n CONFORMANCE_VECTORS_F3_3,\n F3_1_VECTORS_JSON,\n F3_3_VECTORS_JSON,\n} from './vectors';\nimport type { Erc8128RequestSpec, Erc8128VectorCase, Erc8128Vectors } from './vectors';\n\nexport interface ConformanceCaseResult {\n /** Mirrors Python's `failed[].section`. */\n id: string;\n kind: 'integrity' | 'policy' | 'sign' | 'verify';\n ok: boolean;\n detail?: string;\n}\n\nexport interface ConformanceReport {\n /**\n * THE green condition, spelled the same in both languages: `report.ok` in\n * TypeScript and `report.ok` in Python. `passed`, `total` and `failed` carry\n * the same names on both sides too, so `report.passed === report.total`\n * transliterates as well. Each side keeps its own extra fields (`cases`,\n * `sha256`, `wireContractVersion` here; `generations`,\n * `wire_contract_version` there).\n */\n ok: boolean;\n wireContractVersion: string;\n sha256: typeof CONFORMANCE_SHA256;\n total: number;\n passed: number;\n failed: ConformanceCaseResult[];\n cases: ConformanceCaseResult[];\n}\n\n/**\n * First-use-wins, in process. NOT exported: as a production default it would\n * give zero replay protection across tasks or restarts. It exists here only\n * so the matrix can exercise the nonce path deterministically.\n */\nclass ConformanceNonceStore implements NonceStore {\n private readonly seen = new Set<string>();\n\n consume(nonce: string, ctx: NonceContext): NonceOutcome {\n const key = `erc8128:${ctx.chainId}:${ctx.wallet}:${nonce}`;\n if (this.seen.has(key)) return 'replayed';\n this.seen.add(key);\n return 'ok';\n }\n}\n\nconst GENERATIONS: Array<{ name: string; doc: Erc8128Vectors }> = [\n { name: 'f3-1', doc: CONFORMANCE_VECTORS_F3_1 },\n { name: 'f3-3', doc: CONFORMANCE_VECTORS_F3_3 },\n];\n\n/** Families a signer can emit. A checksummed keyid is verify-only. */\nconst EMITTABLE: Record<string, WireProfile> = {\n canonical: 'canonical',\n legacy_no_alg: 'legacy-no-alg',\n};\n\n/**\n * The signing key for the `sign` section.\n *\n * This is 0x42 repeated 32 times — a synthetic constant, not a secret. It is\n * the same value the Python package and execution-market's shared vectors use,\n * and it has to stay identical in all three or the pinned signatures stop\n * being comparable, which is the entire point of a conformance vector.\n *\n * It is stored in the JSON without the `0x` prefix. That is worth knowing and\n * worth changing: the stated reason is that the pre-commit secret scanner\n * blocks `0x` + 64 hex, so the prefix was dropped to get past it. Hiding a\n * known-public constant FROM the scanner teaches the scanner nothing and makes\n * every future reader do the derivation to find out whether it is real. An\n * explicit allow-list entry for this one value would say the same thing out\n * loud.\n */\nfunction privateKey(): string {\n const raw = CONFORMANCE_VECTORS_F3_1.frozen.private_key;\n if (!raw) throw new Error('F3-1 vectors are missing frozen.private_key');\n return `0x${raw}`;\n}\n\n/** Resolve `<family>/<request>` across generations, newest first. */\nfunction resolveVector(\n vectorId: string\n): { vector: Erc8128VectorCase; request: Erc8128RequestSpec; doc: Erc8128Vectors } | undefined {\n const [family, name] = vectorId.split('/');\n for (const generation of [...GENERATIONS].reverse()) {\n const vector = generation.doc.vectors?.[family]?.[name];\n const request = generation.doc.requests?.[name];\n if (vector && request) return { vector, request, doc: generation.doc };\n }\n return undefined;\n}\n\n/** Key-order-insensitive structural equality, for comparing a preset object to\n * the JSON block that pins it. */\nfunction sameShape(a: unknown, b: unknown): boolean {\n const stable = (value: unknown): unknown => {\n if (Array.isArray(value)) return value.map(stable);\n if (value && typeof value === 'object') {\n return Object.fromEntries(\n Object.keys(value as Record<string, unknown>)\n .sort()\n .map((key) => [key, stable((value as Record<string, unknown>)[key])])\n );\n }\n return value;\n };\n return JSON.stringify(stable(a)) === JSON.stringify(stable(b));\n}\n\n/**\n * The section that has to run FIRST and has to run ALWAYS.\n *\n * A sign-only or verify-only pass against a hand-edited artefact is not a\n * pass, and the pinned presets are half of what the artefact pins: the\n * `policies` block is the only thing stopping a preset from being retuned in\n * one language and not the other. `sha256` is taken with ethers rather than\n * `node:crypto` because this module ships in the browser bundle too.\n */\nfunction runIntegrityCases(results: ConformanceCaseResult[]): void {\n const shipped: Array<[keyof typeof CONFORMANCE_SHA256, string]> = [\n ['f3-1', F3_1_VECTORS_JSON],\n ['f3-3', F3_3_VECTORS_JSON],\n ];\n for (const [generation, text] of shipped) {\n const actual = ethers.sha256(ethers.toUtf8Bytes(text)).slice(2);\n const expected = CONFORMANCE_SHA256[generation];\n results.push({\n id: `integrity:${generation}`,\n kind: 'integrity',\n ok: actual === expected,\n detail: actual === expected ? undefined : `sha256 ${actual} != ${expected}`,\n });\n }\n\n for (const [name, pinned] of Object.entries(CONFORMANCE_VECTORS_F3_3.policies ?? {})) {\n let actual: Record<string, unknown> | undefined;\n let detail: string | undefined;\n try {\n actual = presetAsData(name as PolicyPresetName);\n } catch (error) {\n detail = String(error);\n }\n const ok = actual !== undefined && sameShape(actual, pinned);\n results.push({\n id: `policy:${name}`,\n kind: 'policy',\n ok,\n detail: ok\n ? undefined\n : (detail ?? `runtime=${JSON.stringify(actual)} pinned=${JSON.stringify(pinned)}`),\n });\n }\n}\n\nasync function runSignCases(results: ConformanceCaseResult[]): Promise<void> {\n const key = privateKey();\n\n for (const generation of GENERATIONS) {\n const frozen = generation.doc.frozen;\n for (const [family, cases] of Object.entries(generation.doc.vectors ?? {})) {\n const profile = EMITTABLE[family];\n if (!profile) continue;\n\n for (const [name, vector] of Object.entries(cases)) {\n const id = `${generation.name}:sign:${family}/${name}`;\n const request = generation.doc.requests?.[name];\n if (!request) {\n results.push({ id, kind: 'sign', ok: false, detail: `no request spec for ${name}` });\n continue;\n }\n try {\n const headers = await signRequest({\n privateKey: key,\n method: request.method,\n url: request.url,\n body: request.body,\n nonce: frozen.nonce,\n chainId: frozen.chain_id,\n profile,\n now: () => frozen.created,\n });\n const mismatches: string[] = [];\n if (headers.Signature !== vector.headers.Signature) mismatches.push('Signature');\n if (headers['Signature-Input'] !== vector.headers['Signature-Input']) {\n mismatches.push('Signature-Input');\n }\n if ((headers['Content-Digest'] ?? undefined) !== vector.headers['Content-Digest']) {\n mismatches.push('Content-Digest');\n }\n results.push({\n id,\n kind: 'sign',\n ok: mismatches.length === 0,\n detail: mismatches.length ? `byte mismatch: ${mismatches.join(', ')}` : undefined,\n });\n } catch (error) {\n results.push({ id, kind: 'sign', ok: false, detail: String(error) });\n }\n }\n }\n }\n}\n\n/**\n * Build the request the way an HTTP server would present it: content-length is\n * set only when the fixture body is non-null, which is exactly how a zero-byte\n * body ends up classified as \"no body\" by the body-presence rule.\n */\nexport function verifiableRequestFromVector(\n vector: Erc8128VectorCase,\n request: Erc8128RequestSpec\n): { method: string; url: string; headers: Record<string, string>; rawBody?: Uint8Array } {\n const headers: Record<string, string> = {\n signature: vector.headers.Signature,\n 'signature-input': vector.headers['Signature-Input'],\n };\n if (vector.headers['Content-Digest']) {\n headers['content-digest'] = vector.headers['Content-Digest'];\n }\n\n let rawBody: Uint8Array | undefined;\n if (request.body !== null && request.body !== undefined) {\n rawBody = ethers.toUtf8Bytes(request.body);\n headers['content-length'] = String(rawBody.length);\n }\n\n return { method: request.method, url: request.url, headers, rawBody };\n}\n\n/**\n * The preset plus the two per-deployment values it deliberately omits. The\n * consume order is NOT re-decided here: it comes from the preset's own\n * `PRESET_NONCE_CONSUME` entry (EM before the crypto, MeshRelay after).\n */\nexport function conformancePolicy(\n name: PolicyPresetName,\n authority: string,\n now: number\n): VerifyPolicy {\n return policyFromPreset(name, {\n authority,\n nonceStore: new ConformanceNonceStore(),\n now: () => now,\n });\n}\n\nasync function runVerifyCases(results: ConformanceCaseResult[]): Promise<void> {\n const cases = CONFORMANCE_VECTORS_F3_3.verify_cases ?? [];\n const frozen = CONFORMANCE_VECTORS_F3_3.frozen;\n const defaultAuthority = frozen.authority ?? 'api.execution.market';\n\n for (const [index, testCase] of cases.entries()) {\n // The index disambiguates the rows that reuse one (vector, policy) pair\n // with a different CONFIGURED authority — the whole point of those rows.\n const id = `verify:${index}:${testCase.vector_id}:${testCase.policy}`;\n const resolved = resolveVector(testCase.vector_id);\n if (!resolved) {\n results.push({ id, kind: 'verify', ok: false, detail: 'vector not found' });\n continue;\n }\n\n const req = verifiableRequestFromVector(resolved.vector, resolved.request);\n const policy = conformancePolicy(\n testCase.policy as PolicyPresetName,\n // A case that names an authority is testing the CONFIGURED value; the\n // rest run against the one the fleet actually deploys.\n testCase.authority ?? defaultAuthority,\n frozen.created\n );\n\n try {\n const result = await verifyRequest(req, policy);\n const problems: string[] = [];\n // `observed_profile` is pinned on accept AND reject rows, `null`\n // included: what a verifier reports for a REJECTED signature is part of\n // the contract, and skipping the check on rejects is how the two suites\n // ended up pinning different things.\n const observed = result.observedProfile ?? null;\n if (observed !== (testCase.observed_profile ?? null)) {\n problems.push(`profile ${observed} != ${testCase.observed_profile ?? null}`);\n }\n\n if (testCase.expect === 'accept') {\n if (!result.ok) {\n results.push({ id, kind: 'verify', ok: false, detail: `rejected: ${result.code}` });\n continue;\n }\n if (testCase.wallet && result.wallet !== testCase.wallet) {\n problems.push(`wallet ${result.wallet} != ${testCase.wallet}`);\n }\n } else {\n if (result.ok) {\n results.push({ id, kind: 'verify', ok: false, detail: 'accepted, expected reject' });\n continue;\n }\n if (testCase.code && result.code !== testCase.code) {\n problems.push(`code ${result.code} != ${testCase.code}`);\n }\n // 401 blames the client, 503 blames the operator. A misconfigured\n // authority answering 401 is the failure this pin exists to catch.\n if (testCase.status !== undefined && result.status !== testCase.status) {\n problems.push(`status ${result.status} != ${testCase.status}`);\n }\n }\n\n results.push({\n id,\n kind: 'verify',\n ok: problems.length === 0,\n detail: problems.length ? problems.join('; ') : undefined,\n });\n } catch (error) {\n results.push({ id, kind: 'verify', ok: false, detail: String(error) });\n }\n }\n}\n\n/**\n * Run the shipped conformance suite against this build of the SDK.\n *\n * @param options.only - restrict to the `sign` or the `verify` section. The\n * integrity section always runs — same as Python's `run_conformance(only=…)`\n * — because \"the signer is byte-correct against an artefact I did not check\"\n * is not a statement anyone wants to act on.\n */\nexport async function runConformance(options?: {\n only?: 'sign' | 'verify';\n}): Promise<ConformanceReport> {\n const results: ConformanceCaseResult[] = [];\n\n runIntegrityCases(results);\n if (options?.only !== 'verify') await runSignCases(results);\n if (options?.only !== 'sign') await runVerifyCases(results);\n\n const failed = results.filter((r) => !r.ok);\n return {\n ok: failed.length === 0,\n wireContractVersion: WIRE_CONTRACT_VERSION,\n sha256: CONFORMANCE_SHA256,\n total: results.length,\n passed: results.length - failed.length,\n failed,\n cases: results,\n };\n}\n"]}
1
+ {"version":3,"sources":["../../src/erc8128/core.ts","../../src/erc8128/errors.ts","../../src/types/index.ts","../../src/erc8128/signer.ts","../../src/erc8128/verifier.ts","../../src/erc8128/presets.ts","../../src/erc8128/vectors.generated.ts","../../src/erc8128/vectors.ts","../../src/erc8128/conformance.ts"],"names":["ethers","privateKey"],"mappings":";;;;;AAkCO,IAAM,qBAAA,GAAwB;AAG9B,IAAM,aAAA,GAAgB;AAGtB,IAAM,UAAA,GAAa;AAGnB,IAAM,oBAAA,GAAuB;AAG7B,IAAM,gBAAA,GAAmB;AAGzB,IAAM,QAAA,GAAW;AAExB,IAAM,SAAA,GAAY,kBAAA;AAGX,IAAM,wBAAA,GAA8C,CAAC,SAAA,EAAW,YAAA,EAAc,OAAO;AAMrF,IAAM,iBAAA,GAAN,cAAgC,KAAA,CAAM;AAAA,EAC3C,WAAA,CACkB,MAChB,OAAA,EACA;AACA,IAAA,KAAA,CAAM,OAAO,CAAA;AAHG,IAAA,IAAA,CAAA,IAAA,GAAA,IAAA;AAIhB,IAAA,IAAA,CAAK,IAAA,GAAO,mBAAA;AAAA,EACd;AACF;AAgEA,SAAS,YAAY,KAAA,EAAyB;AAC5C,EAAA,OAAO,OAAO,KAAA,CAAM,KAAA,KAAU,QAAA,GAC1B,CAAA,EAAG,MAAM,IAAI,CAAA,CAAA,EAAI,KAAA,CAAM,KAAK,KAC5B,CAAA,EAAG,KAAA,CAAM,IAAI,CAAA,EAAA,EAAK,MAAM,KAAK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zB,EAAA,IAAI,OAAA,EAAS,IAAA,KAAS,QAAA,EAAU,MAAM,aAAa,OAAO,CAAA;AAC1D,EAAA,IAAI,OAAA,EAAS,IAAA,KAAS,MAAA,EAAQ,MAAM,eAAe,OAAO,CAAA;AAE1D,EAAA,MAAM,SAAS,OAAA,CAAQ,MAAA,CAAO,CAAC,CAAA,KAAM,CAAC,EAAE,EAAE,CAAA;AAC1C,EAAA,OAAO;AAAA,IACL,EAAA,EAAI,OAAO,MAAA,KAAW,CAAA;AAAA,IACtB,mBAAA,EAAqB,qBAAA;AAAA,IACrB,MAAA,EAAQ,kBAAA;AAAA,IACR,OAAO,OAAA,CAAQ,MAAA;AAAA,IACf,MAAA,EAAQ,OAAA,CAAQ,MAAA,GAAS,MAAA,CAAO,MAAA;AAAA,IAChC,MAAA;AAAA,IACA,KAAA,EAAO;AAAA,GACT;AACF","file":"index.js","sourcesContent":["/**\n * uvd-x402-sdk/erc8128 — L0, the pure layer.\n *\n * Everything here is deterministic: no clock, no network, no nonce store, no\n * private key. Only `ethers` is imported, and only for hashing/base64 (the\n * package already depends on it, and it works identically in Node and the\n * browser).\n *\n * THE LOAD-BEARING RULE OF THIS FILE:\n *\n * The verifier must NEVER re-serialise `@signature-params`.\n *\n * `parseSignatureInput()` keeps the parameter substring VERBATIM from the\n * `Signature-Input` header (`paramsRaw`) and `buildSignatureBase()` accepts\n * that substring in place of a parameter list. That single byte path is what\n * makes `alg`-present, `alg`-absent, checksummed keyids, unusual parameter\n * ordering and any future RFC 9421 parameter verify with no flags at all.\n * An anchored regex that enumerates the allowed parameters is exactly the bug\n * this module exists to delete — do not reintroduce one.\n *\n * Wire contract: F3-1 pinned format + F3-3 additive cases. See\n * `erc8128.f3-1.json` / `erc8128.f3-3.json`, shipped inside this package.\n *\n * Reference:\n * - ERC-8128: https://eip.tools/eip/8128\n * - RFC 9421: https://www.rfc-editor.org/rfc/rfc9421\n * - RFC 9530 (Content-Digest): https://www.rfc-editor.org/rfc/rfc9530\n */\n\nimport { ethers } from 'ethers';\n\nimport type { Erc8128Code } from './errors';\n\n/** Generation of the wire contract this module implements. */\nexport const WIRE_CONTRACT_VERSION = 'F3-3';\n\n/** Default signature label (F3-1). */\nexport const DEFAULT_LABEL = 'eth';\n\n/** The only algorithm this module signs with or verifies. */\nexport const ALG_EIP191 = 'eip191';\n\n/** Default validity window in seconds; server policy caps at the same value. */\nexport const DEFAULT_VALIDITY_SEC = 300;\n\n/** Default EVM chain id for the keyid (Base mainnet). */\nexport const DEFAULT_CHAIN_ID = 8453;\n\n/** `erc8128:<decimal chain id>:<0x + 40 hex>` — chain id is bare decimal. */\nexport const KEYID_RE = /^erc8128:(\\d+):(0x[0-9a-fA-F]{40})$/;\n\nconst WALLET_RE = /^0x[0-9a-f]{40}$/;\n\n/** Components that make a signature request-bound rather than class-bound. */\nexport const REQUEST_BOUND_COMPONENTS: readonly string[] = ['@method', '@authority', '@path'];\n\n/**\n * Parse failure of a wire value. Thrown by the pure parsers; `verifyRequest`\n * catches it and turns it into a `VerifyResult` — it never escapes there.\n */\nexport class Erc8128ParseError extends Error {\n constructor(\n public readonly code: Erc8128Code,\n message: string\n ) {\n super(message);\n this.name = 'Erc8128ParseError';\n }\n}\n\n/** One `@signature-params` parameter. Numbers go bare, strings get quoted. */\nexport interface SigParam {\n readonly name: string;\n readonly value: string | number;\n}\n\n/**\n * Everything needed to build one RFC 9421 signature base.\n *\n * `params` is either a parameter LIST (the signer builds one) or the VERBATIM\n * parameter substring taken off the wire (the verifier passes one). Both feed\n * the same builder — that is the whole design.\n */\nexport interface CanonicalMessage {\n /** HTTP method; upper-cased by the builder. */\n readonly method: string;\n /** host[:port]. Never a URL, never derived from a client-controlled header. */\n readonly authority: string;\n /** Origin-form path; `/` when empty. */\n readonly path: string;\n /** Query string INCLUDING the leading `?`. Omit when there is none. */\n readonly query?: string;\n /** Full `sha-256=:…:` value, verbatim as it appears on the wire. */\n readonly contentDigest?: string;\n /** Covered component ids, in signing order. The order is load-bearing. */\n readonly covered: readonly string[];\n /** Parameter list (signer) or verbatim parameter substring (verifier). */\n readonly params: readonly SigParam[] | string;\n /**\n * Values for covered components that are plain header fields (anything that\n * is not a `@`-component or `content-digest`). Keys must be lowercase.\n * A covered header that is absent here resolves to the empty string, which\n * is what EM's verifier does.\n */\n readonly headers?: Readonly<Record<string, string>>;\n}\n\n/** Wire generation an emitter produced, as observed by the verifier. */\nexport type ObservedProfile = 'canonical' | 'legacy_no_alg' | 'legacy_alg_checksum_keyid';\n\n/** A parsed `Signature-Input` value. `paramsRaw` is the byte path. */\nexport interface ParsedSignatureInput {\n readonly label: string;\n readonly covered: readonly string[];\n /** VERBATIM parameter substring, `(…);created=…`. Never re-serialised. */\n readonly paramsRaw: string;\n readonly created: number;\n readonly expires: number;\n readonly nonce?: string;\n /** Original case — it is re-emitted into the signed base as-is. */\n readonly keyid: string;\n readonly chainId: number;\n /** Address from the keyid, lowercased for comparison. */\n readonly wallet: string;\n readonly alg?: string;\n readonly observedProfile: ObservedProfile;\n}\n\n// ---------------------------------------------------------------------------\n// Signature base construction\n// ---------------------------------------------------------------------------\n\nfunction formatParam(param: SigParam): string {\n return typeof param.value === 'number'\n ? `${param.name}=${param.value}`\n : `${param.name}=\"${param.value}\"`;\n}\n\n/**\n * Build the `@signature-params` value.\n *\n * When `params` is a string it is the verbatim substring off the wire and is\n * returned untouched — it already contains its own covered-component list.\n */\nexport function buildSignatureParams(\n message: Pick<CanonicalMessage, 'covered' | 'params'>\n): string {\n if (typeof message.params === 'string') return message.params;\n const compStr = message.covered.map((c) => `\"${c}\"`).join(' ');\n const parts = [`(${compStr})`, ...message.params.map(formatParam)];\n return parts.join(';');\n}\n\n/**\n * Build the RFC 9421 signature base — the exact string that is EIP-191\n * personal_signed. Lines are joined with a single LF, with no trailing\n * newline; each line is `\"<id>\": <value>` with exactly one space.\n */\nexport function buildSignatureBase(message: CanonicalMessage): string {\n const lines: string[] = [];\n\n for (const component of message.covered) {\n switch (component) {\n case '@method':\n lines.push(`\"@method\": ${message.method.toUpperCase()}`);\n break;\n case '@authority':\n lines.push(`\"@authority\": ${message.authority}`);\n break;\n case '@path':\n lines.push(`\"@path\": ${message.path}`);\n break;\n case '@query':\n // `?` is the present-but-empty fallback. Only a verifier reaches it —\n // canonical signers omit @query entirely when there is no query\n // string (spec §3.3) — but EM emits it, so it stays for bug-compat.\n lines.push(`\"@query\": ${message.query || '?'}`);\n break;\n case 'content-digest':\n lines.push(`\"content-digest\": ${message.contentDigest || ''}`);\n break;\n default:\n lines.push(`\"${component}\": ${message.headers?.[component.toLowerCase()] ?? ''}`);\n break;\n }\n }\n\n lines.push(`\"@signature-params\": ${buildSignatureParams(message)}`);\n return lines.join('\\n');\n}\n\n/**\n * The covered-component list a canonical signer emits for a request.\n * `@query` only when the URL carries one, `content-digest` only when the\n * request carries a body.\n */\nexport function selectCovered(input: { url: string; hasBody: boolean }): string[] {\n const covered = [...REQUEST_BOUND_COMPONENTS];\n const { query } = splitRequestTarget(input.url);\n if (query) covered.push('@query');\n if (input.hasBody) covered.push('content-digest');\n return covered;\n}\n\n/**\n * The pinned parameter list: `created;expires;nonce?;keyid;alg`.\n * `alg` is ALWAYS last (em_plugin_sdk/erc8128.py:262-278); pass `alg: null`\n * to emit the legacy generation that omits it.\n */\nexport function canonicalParams(input: {\n created: number;\n expires: number;\n keyid: string;\n nonce?: string;\n alg?: string | null;\n}): SigParam[] {\n const params: SigParam[] = [\n { name: 'created', value: input.created },\n { name: 'expires', value: input.expires },\n ];\n if (input.nonce) params.push({ name: 'nonce', value: input.nonce });\n params.push({ name: 'keyid', value: input.keyid });\n const alg = input.alg === undefined ? ALG_EIP191 : input.alg;\n if (alg) params.push({ name: 'alg', value: alg });\n return params;\n}\n\n/** RFC 9530 `Content-Digest` value over the exact body bytes. */\nexport function computeContentDigest(body: string | Uint8Array): string {\n const bytes = typeof body === 'string' ? ethers.toUtf8Bytes(body) : body;\n const b64 = ethers.encodeBase64(ethers.getBytes(ethers.sha256(bytes)));\n return `sha-256=:${b64}:`;\n}\n\n/**\n * `erc8128:<chainId>:<address>` with the address ALWAYS lowercased — a\n * checksummed keyid caused the v9.x silent-auth incident.\n */\nexport function canonicalKeyid(chainId: number, address: string): string {\n return `erc8128:${chainId}:${address.toLowerCase()}`;\n}\n\n/**\n * Length of the EIP-191 prefix counter for a signature base: the length in\n * UTF-8 BYTES, never UTF-16 code units.\n *\n * Named on purpose. EM's ERC-1271 path computes it with `len(message)` on a\n * Python `str` (code points), so its EOA and contract paths hash different\n * messages the moment a base carries one non-ASCII byte. This module uses\n * bytes on every path.\n */\nexport function eip191ByteLength(base: string): number {\n return ethers.toUtf8Bytes(base).length;\n}\n\n/** The exact bytes EIP-191 (version 0x45) hashes for a signature base. */\nexport function eip191Message(base: string): Uint8Array {\n const body = ethers.toUtf8Bytes(base);\n const prefix = ethers.toUtf8Bytes(`\\x19Ethereum Signed Message:\\n${body.length}`);\n const out = new Uint8Array(prefix.length + body.length);\n out.set(prefix, 0);\n out.set(body, prefix.length);\n return out;\n}\n\n// ---------------------------------------------------------------------------\n// Request target\n// ---------------------------------------------------------------------------\n\nconst DEFAULT_PORTS: Readonly<Record<string, string>> = { http: '80', https: '443', ws: '80', wss: '443' };\n\n/**\n * RFC 9421 §2.2.3 `@authority`: lowercase, and OMIT the port when it is the\n * default FOR THAT SCHEME (443 for https/wss, 80 for http/ws). A non-default\n * port is part of the authority and is kept — including `:80` under https and\n * `:443` under http, which are ordinary ports there.\n *\n * The transform is IDEMPOTENT — an authority that is already in this form\n * comes back unchanged — which is why applying it to live traffic changes no\n * signature. The alternative, replaying `netloc` verbatim, makes the SAME\n * request written two ways (`https://host/x` and `https://host:443/x`) sign\n * two different bases.\n *\n * `scheme` is REQUIRED, and deliberately so. This is the URL-derived path and\n * nothing else: the signer has the request URL, the verifier derives the\n * authority from the incoming request, so a scheme is always in hand. The\n * verifier's CONFIGURED authority does NOT come through here — it carries no\n * scheme, so \"the default port\" has no unique answer for it, and guessing one\n * breaks two real deployment shapes (`https` on `:80`, `http` on `:443`).\n * That value goes through `policyAuthority()` in the verifier, which never\n * touches ports at all.\n */\nexport function canonicalAuthority(authority: string, scheme: string): string {\n const lower = String(authority ?? '')\n .trim()\n .toLowerCase();\n const portAt = lower.lastIndexOf(':');\n // No port at all, or a bracketed IPv6 host whose colons are inside it.\n if (portAt <= lower.lastIndexOf(']')) return lower;\n\n const port = lower.slice(portAt + 1);\n const isDefault = port === DEFAULT_PORTS[String(scheme ?? '').trim().toLowerCase()];\n return isDefault ? lower.slice(0, portAt) : lower;\n}\n\n/**\n * Split a URL (absolute or origin-relative) into the `@authority`, `@path`\n * and `@query` values.\n *\n * The path and query are taken RAW: `new URL()` is deliberately avoided\n * because it percent-encodes and normalises them, which would change the\n * bytes relative to what the client signed. A lone `?` counts as no query,\n * matching every emitter in the fleet.\n *\n * The authority IS normalised, per RFC 9421 §2.2.3: lowercased, with the\n * scheme's default port removed. That is what a server sees in `Host` and\n * what every verifier compares against — `urlparse().netloc` keeps an\n * explicit `:443`, so a URL written with the default port would otherwise\n * sign an authority no verifier ever reproduces.\n */\nexport function splitRequestTarget(url: string): {\n authority?: string;\n path: string;\n query?: string;\n} {\n let rest = url;\n let authority: string | undefined;\n\n const absolute = /^([A-Za-z][A-Za-z0-9+.-]*):\\/\\/([^/?#]*)/.exec(url);\n if (absolute) {\n authority = canonicalAuthority(absolute[2], absolute[1]);\n rest = url.slice(absolute[0].length);\n }\n\n const hash = rest.indexOf('#');\n if (hash >= 0) rest = rest.slice(0, hash);\n\n const mark = rest.indexOf('?');\n const path = (mark >= 0 ? rest.slice(0, mark) : rest) || '/';\n const query = mark >= 0 ? rest.slice(mark) : '';\n\n return { authority, path, query: query.length > 1 ? query : undefined };\n}\n\n// ---------------------------------------------------------------------------\n// RFC 8941 structured-field parsing (the subset ERC-8128 needs)\n// ---------------------------------------------------------------------------\n\ninterface DictMember {\n label: string;\n /** Verbatim member value, trimmed of surrounding whitespace. */\n value: string;\n}\n\n/**\n * Split a structured dictionary into ordered members, respecting quoted\n * strings and parentheses so a comma inside either does not split a member.\n */\nfunction splitDictMembers(raw: string): DictMember[] {\n const members: DictMember[] = [];\n let i = 0;\n\n while (i < raw.length) {\n while (i < raw.length && (raw[i] === ' ' || raw[i] === '\\t' || raw[i] === ',')) i++;\n if (i >= raw.length) break;\n\n const eq = raw.indexOf('=', i);\n if (eq < 0) break;\n const label = raw.slice(i, eq).trim();\n\n let j = eq + 1;\n let depth = 0;\n let inQuotes = false;\n for (; j < raw.length; j++) {\n const ch = raw[j];\n if (inQuotes) {\n if (ch === '\\\\') j++;\n else if (ch === '\"') inQuotes = false;\n continue;\n }\n if (ch === '\"') inQuotes = true;\n else if (ch === '(') depth++;\n else if (ch === ')') depth--;\n else if (ch === ',' && depth <= 0) break;\n }\n\n members.push({ label, value: raw.slice(eq + 1, j).trim() });\n i = j + 1;\n }\n\n return members;\n}\n\n/** Pick the member a policy label selects. `'any'` prefers `eth`, else first. */\nfunction selectMember(members: DictMember[], label: string): DictMember | undefined {\n if (label === 'any') {\n return members.find((m) => m.label === DEFAULT_LABEL) ?? members[0];\n }\n return members.find((m) => m.label === label);\n}\n\nfunction unquote(value: string): string {\n return value.slice(1, -1).replace(/\\\\([\"\\\\])/g, '$1');\n}\n\n/** Split `;a=1;b=\"x\"` respecting quotes. Returns raw `name=value` chunks. */\nfunction splitParamChunks(rest: string): string[] {\n const chunks: string[] = [];\n let current = '';\n let inQuotes = false;\n\n for (let i = 0; i < rest.length; i++) {\n const ch = rest[i];\n if (inQuotes) {\n current += ch;\n if (ch === '\\\\' && i + 1 < rest.length) {\n current += rest[++i];\n } else if (ch === '\"') {\n inQuotes = false;\n }\n continue;\n }\n if (ch === '\"') {\n inQuotes = true;\n current += ch;\n continue;\n }\n if (ch === ';') {\n if (current.trim()) chunks.push(current.trim());\n current = '';\n continue;\n }\n current += ch;\n }\n if (current.trim()) chunks.push(current.trim());\n return chunks;\n}\n\n/**\n * Parse a `Signature-Input` value.\n *\n * Deliberately NOT an anchored regex over a fixed parameter list: unknown and\n * reordered parameters must survive, because the verifier replays the whole\n * substring into the signed base. Only the parameters this module needs for\n * POLICY (`created`, `expires`, `nonce`, `keyid`, `alg`) are extracted.\n *\n * @param value - raw header value\n * @param label - `'eth'` (default), a specific label, or `'any'`\n * @throws {Erc8128ParseError} on a malformed value\n */\nexport function parseSignatureInput(value: string, label = DEFAULT_LABEL): ParsedSignatureInput {\n if (typeof value !== 'string' || !value.trim()) {\n throw new Erc8128ParseError('signature_input_invalid', 'Missing Signature-Input header');\n }\n\n const member = selectMember(splitDictMembers(value), label);\n if (!member || !member.label) {\n throw new Erc8128ParseError('signature_input_invalid', 'Invalid Signature-Input format');\n }\n\n const paramsRaw = member.value;\n if (!paramsRaw.startsWith('(')) {\n throw new Erc8128ParseError('signature_input_invalid', 'Invalid Signature-Input format');\n }\n const close = paramsRaw.indexOf(')');\n if (close < 0) {\n throw new Erc8128ParseError('signature_input_invalid', 'Invalid covered component list');\n }\n\n const inner = paramsRaw.slice(1, close).trim();\n const covered = [...inner.matchAll(/\"([^\"]*)\"/g)].map((m) => m[1]);\n // Reject anything that is not a plain list of quoted tokens: an unquoted\n // token, or a per-component parameter, would resolve to bytes we do not\n // reproduce.\n if (covered.map((c) => `\"${c}\"`).join(' ') !== inner) {\n throw new Erc8128ParseError('signature_input_invalid', 'Invalid covered component list');\n }\n\n const params = new Map<string, string | number | boolean>();\n for (const chunk of splitParamChunks(paramsRaw.slice(close + 1))) {\n const eq = chunk.indexOf('=');\n if (eq < 0) {\n params.set(chunk, true);\n continue;\n }\n const name = chunk.slice(0, eq).trim();\n const raw = chunk.slice(eq + 1).trim();\n if (raw.startsWith('\"') && raw.endsWith('\"') && raw.length >= 2) {\n params.set(name, unquote(raw));\n } else if (/^-?\\d+$/.test(raw)) {\n params.set(name, Number(raw));\n } else {\n params.set(name, raw);\n }\n }\n\n const created = params.get('created');\n const expires = params.get('expires');\n if (typeof created !== 'number' || typeof expires !== 'number') {\n throw new Erc8128ParseError(\n 'signature_input_invalid',\n 'Missing or non-integer created/expires parameter'\n );\n }\n\n const keyidValue = params.get('keyid');\n if (typeof keyidValue !== 'string') {\n throw new Erc8128ParseError('signature_input_invalid', 'Missing keyid parameter');\n }\n const keyidMatch = KEYID_RE.exec(keyidValue);\n if (!keyidMatch) {\n throw new Erc8128ParseError(\n 'signature_input_invalid',\n `Invalid keyid format: ${keyidValue}`\n );\n }\n\n const nonceValue = params.get('nonce');\n const algValue = params.get('alg');\n if (algValue !== undefined && typeof algValue !== 'string') {\n throw new Erc8128ParseError('signature_input_invalid', 'Invalid alg parameter');\n }\n\n const address = keyidMatch[2];\n const wallet = address.toLowerCase();\n if (!WALLET_RE.test(wallet)) {\n throw new Erc8128ParseError('wallet_invalid', 'Invalid wallet in ERC-8128 keyid');\n }\n\n return {\n label: member.label,\n covered,\n paramsRaw,\n created,\n expires,\n nonce: typeof nonceValue === 'string' ? nonceValue : undefined,\n keyid: keyidValue,\n chainId: Number(keyidMatch[1]),\n wallet,\n alg: algValue,\n observedProfile: classifyProfile(algValue, address),\n };\n}\n\n/**\n * Which wire generation produced this signature. `alg` absence wins over a\n * checksummed keyid: it is the older split and the one the deprecation ladder\n * counts.\n */\nfunction classifyProfile(alg: string | undefined, address: string): ObservedProfile {\n if (alg === undefined) return 'legacy_no_alg';\n if (address !== address.toLowerCase()) return 'legacy_alg_checksum_keyid';\n return 'canonical';\n}\n\n/**\n * Parse a `Signature` header into the raw 65 bytes (r‖s‖v, v = 27/28).\n *\n * Standard base64 alphabet with padding — base64url is NOT accepted (spec\n * §3.6).\n *\n * @throws {Erc8128ParseError} when the header, the label or the length is wrong\n */\nexport function parseSignatureHeader(value: string, label = DEFAULT_LABEL): Uint8Array {\n if (typeof value !== 'string' || !value.trim()) {\n throw new Erc8128ParseError('signature_invalid', 'Missing Signature header');\n }\n\n const member = selectMember(splitDictMembers(value), label);\n if (!member) {\n throw new Erc8128ParseError('signature_invalid', `No signature found for label '${label}'`);\n }\n\n const match = /^:([A-Za-z0-9+/]+={0,2}):$/.exec(member.value);\n if (!match) {\n throw new Erc8128ParseError('signature_invalid', 'Invalid Signature header');\n }\n\n let bytes: Uint8Array;\n try {\n bytes = ethers.decodeBase64(match[1]);\n } catch {\n throw new Erc8128ParseError('signature_invalid', 'Invalid Signature base64 encoding');\n }\n if (bytes.length !== 65) {\n throw new Erc8128ParseError('signature_invalid', 'Ethereum signature must be 65 bytes');\n }\n return bytes;\n}\n\n/**\n * Lowercase wallet address from a `Signature-Input` value, or `null` when it\n * cannot be parsed. Never throws — this is the primitive a rate-limit\n * middleware needs BEFORE any signature work, so it must not be able to break\n * the request path.\n */\nexport function extractKeyidWallet(signatureInput: string): string | null {\n try {\n return parseSignatureInput(signatureInput, 'any').wallet;\n } catch {\n return null;\n }\n}\n","/**\n * uvd-x402-sdk/erc8128 — error taxonomy.\n *\n * The union is the SUPERSET of MeshRelay's 19 public HTTP error codes (a\n * published contract: `{ error, code }` with a per-code status) and the one\n * stable string EM's auth layer switches on (`nonce_store_unavailable` →\n * 503 + Retry-After). Adopting the SDK must not change either product's\n * response bodies, so nothing here is renamed or merged.\n *\n * These are VALUES, not exceptions: `verifyRequest` returns them. Exceptions\n * are reserved for programmer error (a policy without an authority, a signer\n * without a key).\n */\n\nexport type Erc8128Code =\n // wire / signature\n | 'signature_input_invalid'\n | 'signature_invalid'\n | 'alg_unsupported'\n | 'alg_missing'\n | 'keyid_not_lowercase'\n // nonce\n | 'nonce_invalid'\n | 'nonce_unknown'\n | 'nonce_replayed'\n | 'nonce_expired'\n | 'nonce_required'\n | 'nonce_rate_limited'\n | 'nonce_capacity'\n | 'nonce_limits_invalid'\n | 'nonce_ttl_invalid'\n | 'nonce_store_unavailable'\n // body\n | 'content_digest_required'\n | 'content_digest_invalid'\n | 'content_digest_mismatch'\n // components / binding\n | 'components_invalid'\n | 'class_bound_rejected'\n // freshness / identity\n | 'signature_stale'\n | 'chain_not_allowed'\n | 'wallet_invalid'\n | 'wallet_mismatch'\n | 'authority_invalid';\n\n/**\n * HTTP status per code. 401 unless the failure is not the caller's signature:\n * a replayed nonce is a conflict (409), issuance pressure is 429, and a store\n * or config failure is 503.\n */\nexport const ERC8128_ERROR_STATUS: Readonly<Record<Erc8128Code, number>> = Object.freeze({\n signature_input_invalid: 401,\n signature_invalid: 401,\n alg_unsupported: 401,\n alg_missing: 401,\n keyid_not_lowercase: 401,\n nonce_invalid: 401,\n nonce_unknown: 401,\n nonce_replayed: 409,\n nonce_expired: 401,\n nonce_required: 401,\n nonce_rate_limited: 429,\n nonce_capacity: 429,\n nonce_limits_invalid: 503,\n nonce_ttl_invalid: 503,\n nonce_store_unavailable: 503,\n content_digest_required: 401,\n content_digest_invalid: 401,\n content_digest_mismatch: 401,\n components_invalid: 401,\n class_bound_rejected: 401,\n signature_stale: 401,\n chain_not_allowed: 401,\n wallet_invalid: 401,\n wallet_mismatch: 401,\n authority_invalid: 503,\n});\n\n/**\n * Whether the SAME request may be retried unchanged.\n *\n * Only infrastructure pressure qualifies. A stale signature or a burnt nonce\n * is recoverable by re-signing, not by retrying — and a misconfigured\n * authority or nonce limit will not fix itself. This turns EM's\n * `reason == \"nonce_store_unavailable\"` string compare into a lookup.\n */\nexport const ERC8128_ERROR_RETRYABLE: Readonly<Record<Erc8128Code, boolean>> = Object.freeze({\n signature_input_invalid: false,\n signature_invalid: false,\n alg_unsupported: false,\n alg_missing: false,\n keyid_not_lowercase: false,\n nonce_invalid: false,\n nonce_unknown: false,\n nonce_replayed: false,\n nonce_expired: false,\n nonce_required: false,\n nonce_rate_limited: true,\n nonce_capacity: true,\n nonce_limits_invalid: false,\n nonce_ttl_invalid: false,\n nonce_store_unavailable: true,\n content_digest_required: false,\n content_digest_invalid: false,\n content_digest_mismatch: false,\n components_invalid: false,\n class_bound_rejected: false,\n signature_stale: false,\n chain_not_allowed: false,\n wallet_invalid: false,\n wallet_mismatch: false,\n authority_invalid: false,\n});\n\n/** Default human-readable message per code. Callers may override. */\nexport const ERC8128_ERROR_MESSAGE: Readonly<Record<Erc8128Code, string>> = Object.freeze({\n signature_input_invalid: 'Invalid Signature-Input format',\n signature_invalid: 'Invalid Signature header',\n alg_unsupported: 'Unsupported ERC-8128 alg: only eip191 is verified',\n alg_missing: 'ERC-8128 alg=\"eip191\" is required by this policy',\n keyid_not_lowercase: 'ERC-8128 keyid address must be lowercase',\n nonce_invalid: 'Invalid ERC-8128 nonce format',\n nonce_unknown: 'Nonce was not issued by this server',\n nonce_replayed: 'Nonce has already been used',\n nonce_expired: 'Nonce has expired',\n nonce_required: 'ERC-8128 signature must carry a nonce',\n nonce_rate_limited: 'ERC-8128 nonce issuance is temporarily rate limited',\n nonce_capacity: 'ERC-8128 nonce capacity is temporarily exhausted',\n nonce_limits_invalid: 'ERC-8128 nonce limits are invalid',\n nonce_ttl_invalid: 'ERC-8128 nonce TTL is invalid',\n nonce_store_unavailable: 'ERC-8128 nonce store is unavailable',\n content_digest_required: 'Signed request with a body requires Content-Digest',\n content_digest_invalid: 'Invalid or missing Content-Digest header',\n content_digest_mismatch: 'Content-Digest does not match request body',\n components_invalid:\n 'ERC-8128 must cover method, authority, path, and query when present',\n class_bound_rejected: 'Class-bound signatures not accepted (missing required components)',\n signature_stale: 'ERC-8128 signature is expired or outside the freshness window',\n chain_not_allowed: 'ERC-8128 chain id is not allowed',\n wallet_invalid: 'Invalid wallet in ERC-8128 keyid',\n wallet_mismatch: 'Recovered wallet does not match ERC-8128 keyid',\n authority_invalid: 'ERC-8128 authority is not configured safely',\n});\n","/**\n * uvd-x402-sdk - Type Definitions\n *\n * Core TypeScript interfaces for the x402 payment SDK.\n * These types define the contract between the SDK and consuming applications.\n */\n\n// Type-only, so it is erased at compile time and no runtime cycle exists between\n// this module and `policy.ts` (which imports `X402Error` from here as a value).\nimport type { AdvertisedQuote, PolicyApproval, PurchasePolicy } from '../policy';\n\n// ============================================================================\n// CHAIN CONFIGURATION TYPES\n// ============================================================================\n\n/**\n * Network type categorization\n * - 'evm': Ethereum Virtual Machine compatible chains (use EIP-712)\n * - 'svm': Solana Virtual Machine chains (Solana, Fogo) (use SPL tokens)\n * - 'stellar': Stellar network (use Soroban)\n * - 'near': NEAR Protocol (use NEP-366)\n * - 'algorand': Algorand network (use ASA transfers with atomic transactions)\n * - 'sui': Sui blockchain (use sponsored transactions)\n * - 'xrpl': XRP Ledger (use pre-signed Payment transaction blobs)\n *\n * @deprecated 'solana' type is deprecated, use 'svm' instead\n */\nexport type NetworkType = 'evm' | 'svm' | 'solana' | 'stellar' | 'near' | 'algorand' | 'sui' | 'xrpl';\n\n/**\n * Supported x402 payment schemes\n * - 'exact': Standard one-shot payment (default)\n * - 'escrow': Escrow-based payment with verify/settle/refund\n * - 'commerce': Commerce alias for escrow (marketplace integrations)\n */\nexport type X402Scheme = 'exact' | 'escrow' | 'commerce';\n\n/**\n * Supported stablecoin token types\n * - usdc: USD Coin (Circle) - 6 decimals\n * - eurc: Euro Coin (Circle) - 6 decimals\n * - ausd: Agora USD (Agora Finance) - 6 decimals\n * - pyusd: PayPal USD (PayPal/Paxos) - 6 decimals\n * - usdt: Tether USD (USDT0 omnichain via LayerZero) - 6 decimals\n * - usdg: Global Dollar (Paxos) - 6 decimals; settlement stablecoin on Robinhood Chain\n */\nexport type TokenType = 'usdc' | 'eurc' | 'ausd' | 'pyusd' | 'usdt' | 'usdg';\n\n/**\n * Token configuration for EIP-712 signing and transfers\n */\nexport interface TokenConfig {\n /** Contract/mint address */\n address: string;\n /** Token decimals (6 for all supported stablecoins) */\n decimals: number;\n /** Token name for EIP-712 domain (e.g., \"USD Coin\" or \"USDC\") */\n name: string;\n /** Token version for EIP-712 domain */\n version: string;\n /**\n * Whether one whole unit of this token IS one dollar.\n *\n * Absent means yes, so every stablecoin entry in the registry keeps the\n * behaviour it had. It is `false` for exactly one thing today: the native\n * XRP that XRPL settles in.\n *\n * **The distinction is unit, not scale.** `decimals` already handles scale --\n * BSC USDC has 18 of them and prices correctly. But scaling a price by the\n * decimals only turns dollars into base units when one whole unit is one\n * dollar. XRP has six real decimals and is still not a dollar, so\n * `$1.00 -> 10**6` charges **1 XRP**, which is whatever XRP happens to cost.\n * Six decimals of XRP are still XRP.\n *\n * The SDK refuses to price in USD against a token carrying `false` rather\n * than converting at a rate nobody agreed to. Mirrors `NetworkConfig\n * .usd_pegged` in the Python SDK (`networks/base.py:129`, 0.77.0).\n */\n usdPegged?: boolean;\n}\n\n/**\n * USDC token configuration for a specific chain\n * @deprecated Use TokenConfig instead. This is kept for backward compatibility.\n */\nexport interface USDCConfig {\n /** Contract/mint address */\n address: string;\n /** Token decimals (6 for most chains, 7 for Stellar) */\n decimals: number;\n /** Token name for EIP-712 domain (e.g., \"USD Coin\" or \"USDC\") */\n name: string;\n /** Token version for EIP-712 domain */\n version: string;\n /**\n * Whether one whole unit of this token IS one dollar. Absent means yes.\n *\n * See {@link TokenConfig.usdPegged}. It matters here because this field is\n * also where a chain that settles in its own native asset describes that\n * asset -- XRPL keeps native XRP under the key `usdc`, so the key promises a\n * dollar the value does not deliver.\n */\n usdPegged?: boolean;\n}\n\n/**\n * Native currency configuration\n */\nexport interface NativeCurrency {\n name: string;\n symbol: string;\n decimals: number;\n}\n\n/**\n * Complete chain configuration\n */\nexport interface ChainConfig {\n /** Numeric chain ID (0 for non-EVM chains) */\n chainId: number;\n /** Hex-encoded chain ID for wallet_switchEthereumChain */\n chainIdHex: string;\n /** Internal chain identifier (e.g., 'base', 'solana') */\n name: string;\n /** Human-readable display name */\n displayName: string;\n /** Network type for routing */\n networkType: NetworkType;\n /** Primary RPC endpoint URL */\n rpcUrl: string;\n /** Block explorer base URL */\n explorerUrl: string;\n /** Native currency info */\n nativeCurrency: NativeCurrency;\n /** USDC token configuration */\n usdc: USDCConfig;\n /**\n * Multi-token configurations (EVM chains only)\n * Maps token type to its configuration for this chain.\n * Not all tokens are available on all chains.\n */\n tokens?: Partial<Record<TokenType, TokenConfig>>;\n /** x402 facilitator configuration */\n x402: {\n facilitatorUrl: string;\n enabled: boolean;\n };\n}\n\n// ============================================================================\n// WALLET TYPES\n// ============================================================================\n\n/**\n * Current wallet connection state\n */\nexport interface WalletState {\n /** Whether a wallet is currently connected */\n connected: boolean;\n /** Connected wallet address (null if not connected) */\n address: string | null;\n /** Current chain ID (null for non-EVM or disconnected) */\n chainId: number | null;\n /** Current network name */\n network: string | null;\n /** Network type of connected wallet */\n networkType: NetworkType | null;\n /** USDC balance on current chain (null if unknown) */\n balance: string | null;\n}\n\n/**\n * Wallet adapter interface for different wallet types\n */\nexport interface WalletAdapter {\n /** Unique identifier for this wallet type */\n readonly id: string;\n /** Display name */\n readonly name: string;\n /** Network type this adapter supports */\n readonly networkType: NetworkType;\n\n /** Check if this wallet is available/installed */\n isAvailable(): boolean;\n\n /** Connect to the wallet */\n connect(chainName?: string): Promise<string>;\n\n /** Disconnect from the wallet */\n disconnect(): Promise<void>;\n\n /** Switch to a different chain (EVM only) */\n switchChain?(chainName: string): Promise<void>;\n\n /**\n * Sign a payment payload\n * For EVM chains, supports multi-token via paymentInfo.tokenType\n */\n signPayment(paymentInfo: PaymentInfo, chainConfig: ChainConfig): Promise<string>;\n\n /**\n * Check token balance (defaults to USDC for backward compatibility)\n * EVM providers may accept optional tokenType parameter\n */\n getBalance(chainConfig: ChainConfig, tokenType?: TokenType): Promise<string>;\n\n /** Get current address */\n getAddress(): string | null;\n\n /** Get current chain ID (EVM only) */\n getChainId?(): number | null;\n}\n\n/**\n * EIP-712 domain for typed data signing\n */\nexport interface EIP712Domain {\n name: string;\n version: string;\n chainId: number;\n verifyingContract: string;\n}\n\n/**\n * EIP-712 type definitions\n */\nexport interface EIP712Types {\n [typeName: string]: Array<{ name: string; type: string }>;\n}\n\n// ============================================================================\n// PAYMENT TYPES\n// ============================================================================\n\n/**\n * Payment information returned by backend on 402 response\n */\nexport interface PaymentInfo {\n /** Default recipient address */\n recipient: string;\n /** Network-specific recipient addresses */\n recipients?: {\n evm?: string;\n solana?: string;\n near?: string;\n stellar?: string;\n algorand?: string;\n sui?: string;\n xrpl?: string;\n };\n /** Facilitator address (for Solana fee payer) */\n facilitator?: string;\n /**\n * Amount in whole units of the settlement asset (e.g., \"10.00\").\n *\n * For every dollar-pegged token that is dollars, which is all of them but\n * one. On XRPL it is **XRP**, because XRPL settles in its own native asset:\n * the provider spends this through `xrpToDrops` and bills whole XRP\n * (`src/providers/xrpl/index.ts`). This used to be documented as USD, which\n * made the type and its only XRPL consumer disagree about the unit -- and the\n * consumer won, so a \"10.00\" written as ten dollars left as ten XRP. The SDK\n * now refuses to build a dollar price for an asset with no dollar peg rather\n * than let the two readings meet on the wire; see\n * {@link TokenConfig.usdPegged}.\n */\n amount: string;\n /** Token symbol (usually \"USDC\") */\n token?: string;\n /**\n * Token type for multi-token support\n * Defaults to 'usdc' if not specified for backward compatibility\n */\n tokenType?: TokenType;\n /** Network hint from backend */\n network?: string;\n /** Supported chain IDs */\n supportedChains?: number[];\n /**\n * Envelope version the resource asked for, as read off its own 402.\n *\n * This is what makes the client's `x402Version: 'auto'` mean something: the\n * buyer loop reads the version out of the challenge and hands it down here,\n * so the header is built in the shape the server said it accepts. Left\n * undefined by callers who build a payment by hand -- then the client config\n * decides, exactly as before.\n */\n x402Version?: X402Version;\n}\n\n/**\n * One payment option read off a resource's `402`, normalised.\n *\n * The 402 body speaks two dialects -- v1 spells the price `maxAmountRequired`\n * and names the chain `base`, v2 spells it `amount` and names it `eip155:8453`\n * -- and a buyer that only learned one of them silently ignores half the\n * offers. This is the shape after both have been read.\n */\nexport interface X402PaymentOffer {\n /** Network exactly as the 402 wrote it (plain name or CAIP-2). */\n network: string;\n /** SDK chain name the network resolved to, or null when unknown. */\n chainName: string | null;\n /** Token contract address the resource wants paid, when it named one. */\n asset?: string;\n /** Price in the token's own atomic units. */\n amount: string;\n /** Decimals used to read `amount`. */\n decimals: number;\n /** Recipient of the payment. */\n payTo: string;\n /** The accept object verbatim -- echoed back for v2. */\n raw: Record<string, unknown>;\n}\n\n/**\n * Options for {@link X402Client.fetch} -- the buyer loop.\n */\nexport interface X402FetchOptions {\n /** HTTP method for both the probe and the paid retry (default `GET`). */\n method?: string;\n /**\n * Hard ceiling in token units (e.g. `'0.05'`). A 402 that asks for more\n * throws instead of signing. Undefined = no ceiling, which means paying\n * whatever an untrusted resource asks: discouraged.\n */\n maxAmount?: string;\n /** Token to pay with (default `usdc`). */\n tokenType?: TokenType;\n /** Override the default cheapest-offer selection. */\n select?: (offers: X402PaymentOffer[]) => X402PaymentOffer | null | undefined;\n /** Passed through to both requests (`headers`, `body`, `signal`, ...). */\n init?: RequestInit;\n /** Injectable `fetch` (tests, or a runtime without a global one). */\n fetchImpl?: typeof globalThis.fetch;\n /**\n * What a catalog listing advertised, when the caller read one.\n *\n * The comparison NEVER decides anything -- a seller repricing inside a policy\n * the operator already authorised is ordinary commerce -- but handing it over\n * gets the divergence reported on the approval instead of having to diff the\n * two by hand. See `PolicyApproval.versusQuote`.\n */\n advertised?: AdvertisedQuote;\n /**\n * Called once the paid retry came back with something other than a 402, i.e.\n * the seller accepted the payment.\n *\n * This is where a caller calls `client.policy.recordSpend(...)`. Evaluating\n * deliberately does not spend: signing can fail and a settlement can be\n * refused, and a cumulative limit that counted attempts would lock a caller\n * out of money it never spent. Nothing here is automatic, so a caller that\n * wants a cumulative limit to mean something has to say so.\n */\n onPaid?: (approval: PolicyApproval) => void;\n}\n\n/**\n * Simple payment request from application\n */\nexport interface PaymentRequest {\n /** Amount in USDC (e.g., \"10.00\") */\n amount: string;\n /** Override recipient address (optional) */\n recipient?: string;\n /** Application-specific metadata */\n metadata?: Record<string, unknown>;\n}\n\n/**\n * x402 payment header names\n *\n * - 'X-PAYMENT': v1 header name (default, most compatible)\n * - 'PAYMENT-SIGNATURE': v2 header name (newer standard)\n *\n * Both headers use the same base64-encoded JSON payload format.\n * The facilitator accepts both headers.\n */\nexport type X402HeaderName = 'X-PAYMENT' | 'PAYMENT-SIGNATURE';\n\n/**\n * Payment headers object containing both v1 and v2 header formats\n */\nexport interface PaymentHeaders {\n /** v1 header: X-PAYMENT */\n 'X-PAYMENT': string;\n /** v2 header: PAYMENT-SIGNATURE (same value, different header name) */\n 'PAYMENT-SIGNATURE': string;\n}\n\n/**\n * Result of a payment operation\n */\nexport interface PaymentResult {\n /** Whether payment was successful */\n success: boolean;\n /** Base64-encoded X-PAYMENT header value */\n paymentHeader: string;\n /**\n * Payment headers object for easy use with fetch/axios\n *\n * @example\n * ```ts\n * // Use v1 header\n * fetch(url, { headers: { 'X-PAYMENT': result.headers['X-PAYMENT'] } });\n *\n * // Use v2 header\n * fetch(url, { headers: { 'PAYMENT-SIGNATURE': result.headers['PAYMENT-SIGNATURE'] } });\n * ```\n */\n headers: PaymentHeaders;\n /** Transaction hash (if available) */\n transactionHash?: string;\n /** Network where payment was made */\n network: string;\n /** Payer address */\n payer?: string;\n /** Error message (if success is false) */\n error?: string;\n}\n\n// ============================================================================\n// PAYLOAD TYPES (Internal)\n// ============================================================================\n\n/**\n * EVM payment payload (ERC-3009 TransferWithAuthorization)\n */\nexport interface EVMPaymentPayload {\n from: string;\n to: string;\n value: string;\n validAfter: number;\n validBefore: number;\n nonce: string;\n v: number;\n r: string;\n s: string;\n chainId: number;\n token: string;\n}\n\n/**\n * Token info for non-USDC stablecoins (e.g., Token2022 like AUSD)\n * Required in payload for facilitator to verify Token2022 transfers correctly.\n */\nexport interface TokenInfo {\n /** Token mint address */\n address: string;\n /** Token symbol (e.g., 'AUSD') */\n symbol: string;\n /** Token decimals (e.g., 6) */\n decimals: number;\n}\n\n/**\n * Solana payment payload (partially-signed transaction)\n */\nexport interface SolanaPaymentPayload {\n /** Base64-encoded serialized transaction */\n transaction: string;\n /**\n * Token info for non-USDC tokens (e.g., Token2022 like AUSD)\n * CRITICAL: Must be included for Token2022 tokens for facilitator verification\n */\n token?: TokenInfo;\n}\n\n/**\n * Stellar payment payload (Soroban authorization)\n */\nexport interface StellarPaymentPayload {\n /** Sender G... public key */\n from: string;\n /** Recipient G... public key */\n to: string;\n /** Amount in stroops (7 decimals) */\n amount: string;\n /** USDC SAC contract address */\n tokenContract: string;\n /** Base64 XDR-encoded SorobanAuthorizationEntry */\n authorizationEntryXdr: string;\n /** Random 64-bit nonce */\n nonce: number;\n /** Ledger when authorization expires */\n signatureExpirationLedger: number;\n}\n\n/**\n * NEAR payment payload (NEP-366 meta-transaction)\n */\nexport interface NEARPaymentPayload {\n /** Base64 Borsh-encoded SignedDelegateAction */\n signedDelegateAction: string;\n network: 'near';\n}\n\n/**\n * Algorand payment payload (atomic transaction group)\n *\n * Follows the GoPlausible x402-avm spec for atomic groups:\n * - Transaction 0: Fee payment (UNSIGNED) - facilitator -> facilitator, covers all fees\n * - Transaction 1: ASA transfer (SIGNED) - client -> merchant\n *\n * The facilitator signs transaction 0 and submits the complete atomic group.\n */\nexport interface AlgorandPaymentPayload {\n /** Index of the payment transaction in the group (always 1) */\n paymentIndex: number;\n /**\n * Array of base64-encoded msgpack transactions forming the atomic group:\n * - [0]: Unsigned fee transaction (facilitator signs)\n * - [1]: Signed ASA transfer (client signed)\n */\n paymentGroup: string[];\n}\n\n/**\n * Sui payment payload (sponsored transaction)\n *\n * Uses Sui sponsored transactions where:\n * - User creates a programmable transaction for USDC transfer\n * - User signs the transaction\n * - Facilitator sponsors (pays gas in SUI) and submits\n *\n * User pays: ZERO SUI\n */\nexport interface SuiPaymentPayload {\n /** Base64-encoded BCS serialized TransactionData */\n transactionBytes: string;\n /** Base64-encoded user signature */\n senderSignature: string;\n /** Sender address (0x + 64 hex chars) */\n from: string;\n /** Recipient address (0x + 64 hex chars) */\n to: string;\n /** Amount in base units (string to handle large numbers) */\n amount: string;\n /** Coin object ID used for the transfer (REQUIRED by facilitator) */\n coinObjectId: string;\n}\n\n/**\n * XRPL payment payload (pre-signed Payment transaction blob)\n *\n * Uses the t54 \"pre-signed Payment blob\" scheme on the XRP Ledger:\n * - The client builds and FULLY signs a Payment transaction off-chain,\n * paying its own XRP network fee.\n * - The single `signedTxBlob` field (hex-encoded fully-signed XRPL tx blob)\n * is sent to the facilitator, which decodes it to re-derive payer/amount/\n * destination and submits it.\n *\n * All payment-level fields (destination, amount, InvoiceID, SourceTag, etc.)\n * come from PaymentRequirements/extra, NOT from this payload.\n *\n * XRP is the native asset (6 decimals / drops). There is no token contract.\n *\n * The JSON field name is EXACTLY `signedTxBlob` (camelCase).\n */\nexport interface XRPLPaymentPayload {\n /** Hex-encoded fully-signed XRPL Payment transaction blob (tx_blob) */\n signedTxBlob: string;\n}\n\n/**\n * Union type for all payment payloads\n */\nexport type PaymentPayload =\n | EVMPaymentPayload\n | SolanaPaymentPayload\n | StellarPaymentPayload\n | NEARPaymentPayload\n | AlgorandPaymentPayload\n | SuiPaymentPayload\n | XRPLPaymentPayload;\n\n// ============================================================================\n// X402 HEADER TYPES (v1 and v2)\n// ============================================================================\n\n/**\n * x402 protocol version\n */\nexport type X402Version = 1 | 2;\n\n/**\n * CAIP-2 chain identifiers for x402 v2\n * @see https://github.com/ChainAgnostic/CAIPs/blob/master/CAIPs/caip-2.md\n */\nexport const CAIP2_IDENTIFIERS: Record<string, string> = {\n // EVM chains\n base: 'eip155:8453',\n ethereum: 'eip155:1',\n polygon: 'eip155:137',\n arbitrum: 'eip155:42161',\n optimism: 'eip155:10',\n avalanche: 'eip155:43114',\n celo: 'eip155:42220',\n hyperevm: 'eip155:999',\n unichain: 'eip155:130',\n monad: 'eip155:143',\n bsc: 'eip155:56',\n scroll: 'eip155:534352',\n 'skale-base': 'eip155:1187947933',\n 'skale-base-sepolia': 'eip155:324705682',\n robinhood: 'eip155:4663',\n 'robinhood-testnet': 'eip155:46630',\n // SVM chains\n solana: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',\n fogo: 'svm:fogo',\n // Stellar\n stellar: 'stellar:pubnet',\n // NEAR\n near: 'near:mainnet',\n // Algorand\n algorand: 'algorand:mainnet',\n 'algorand-testnet': 'algorand:testnet',\n // Sui\n sui: 'sui:mainnet',\n 'sui-testnet': 'sui:testnet',\n // XRPL (XRP Ledger)\n xrpl: 'xrpl',\n 'xrpl-testnet': 'xrpl-testnet',\n};\n\n/**\n * Reverse mapping from CAIP-2 to chain name\n */\nexport const CAIP2_TO_CHAIN: Record<string, string> = Object.fromEntries(\n Object.entries(CAIP2_IDENTIFIERS).map(([k, v]) => [v, k])\n);\n\n/**\n * x402 v1 header structure (network as string)\n */\nexport interface X402HeaderV1 {\n x402Version: 1;\n scheme: X402Scheme;\n network: string;\n payload: X402PayloadData;\n}\n\n/**\n * x402 v2 payment option\n */\nexport interface X402PaymentOption {\n network: string; // CAIP-2 format\n asset: string;\n amount: string;\n facilitator?: string;\n}\n\n/**\n * x402 v2 header structure (CAIP-2 network, accepts array)\n */\nexport interface X402HeaderV2 {\n x402Version: 2;\n scheme: X402Scheme;\n network: string; // CAIP-2 format\n payload: X402PayloadData;\n accepts?: X402PaymentOption[];\n}\n\n/**\n * Union type for both v1 and v2 headers\n */\nexport type X402Header = X402HeaderV1 | X402HeaderV2;\n\n/**\n * EVM-specific payload in x402 header\n */\nexport interface X402EVMPayload {\n signature: string;\n authorization: {\n from: string;\n to: string;\n value: string;\n validAfter: string;\n validBefore: string;\n nonce: string;\n };\n /**\n * Which token was actually paid.\n *\n * Only present when the payment is created with `includeTokenMetadata`. The\n * signature alone does not say which stablecoin it authorizes — a server that\n * accepts several tokens on the same chain cannot rebuild the payment\n * requirements without this. Omitted by default so existing v1 wire formats\n * stay byte-identical.\n */\n token?: PaymentTokenMetadata;\n}\n\n/**\n * Token identification carried inside an x402 payload.\n *\n * Mirrors what a resource server needs to build `paymentRequirements`: the\n * `asset` it must charge and the `extra` EIP-712 domain the facilitator needs\n * to recover the signature.\n */\nexport interface PaymentTokenMetadata {\n /** Token contract address (the `asset` of the payment requirements) */\n address: string;\n /** Uppercase token symbol, e.g. `USDC`, `EURC`, `USDT` */\n symbol: string;\n /** Token decimals — the amount in the authorization is in these units */\n decimals: number;\n /** EIP-712 domain of the token contract (the `extra` of the requirements) */\n eip712: {\n name: string;\n version: string;\n };\n}\n\n/**\n * Solana-specific payload in x402 header\n */\nexport interface X402SolanaPayload {\n transaction: string;\n}\n\n/**\n * Settlement account payload for Crossmint and other custodial wallets\n * that can only sendTransaction (not signTransaction).\n *\n * In this mode, the client already submitted the transaction on-chain.\n * The facilitator verifies the on-chain tx, then sweeps USDC from the\n * settlement account to the payTo address.\n *\n * Used by: Crossmint smart wallets via @faremeter/wallet-crossmint\n */\nexport interface X402SettlementAccountPayload {\n /** On-chain transaction signature (already submitted) */\n transactionSignature: string;\n /** Base58 secret key for sweeping settlement account (optional) */\n settleSecretKey?: string;\n /** Address to receive rent from closed settlement ATA (optional) */\n settlementRentDestination?: string;\n}\n\n/**\n * Stellar-specific payload in x402 header\n */\nexport interface X402StellarPayload {\n from: string;\n to: string;\n amount: string;\n tokenContract: string;\n authorizationEntryXdr: string;\n nonce: number;\n signatureExpirationLedger: number;\n}\n\n/**\n * NEAR-specific payload in x402 header\n */\nexport interface X402NEARPayload {\n signedDelegateAction: string;\n}\n\n/**\n * Algorand-specific payload in x402 header (atomic group format)\n */\nexport interface X402AlgorandPayload {\n /** Index of the payment transaction in the group (always 1) */\n paymentIndex: number;\n /** Array of base64-encoded msgpack transactions */\n paymentGroup: string[];\n}\n\n/**\n * Sui-specific payload in x402 header (sponsored transaction)\n */\nexport interface X402SuiPayload {\n /** BCS-encoded transaction bytes (base64) */\n transactionBytes: string;\n /** User's signature on the transaction (base64) */\n senderSignature: string;\n /** Sender's Sui address (0x...) */\n from: string;\n /** Recipient's Sui address (0x...) */\n to: string;\n /** Amount in smallest unit (string to avoid precision issues) */\n amount: string;\n /** Coin object ID used for the transfer (REQUIRED by facilitator) */\n coinObjectId: string;\n}\n\n/**\n * XRPL-specific payload in x402 header (t54 pre-signed Payment blob)\n *\n * The JSON field name is EXACTLY `signedTxBlob` (camelCase). The facilitator\n * decodes the blob to re-derive payer/amount/destination; no other fields are\n * carried in the payload.\n */\nexport interface X402XRPLPayload {\n /** Hex-encoded fully-signed XRPL Payment transaction blob (tx_blob) */\n signedTxBlob: string;\n}\n\n/**\n * Union of all x402 payload types\n */\nexport type X402PayloadData =\n | X402EVMPayload\n | X402SolanaPayload\n | X402SettlementAccountPayload\n | X402StellarPayload\n | X402NEARPayload\n | X402AlgorandPayload\n | X402SuiPayload\n | X402XRPLPayload;\n\n// ============================================================================\n// CLIENT CONFIGURATION\n// ============================================================================\n\n/**\n * Multi-payment configuration for supporting multiple networks\n */\nexport interface MultiPaymentConfig {\n /** Networks to support (e.g., ['base', 'solana', 'stellar', 'near']) */\n networks: string[];\n /** Default network if user hasn't selected one */\n defaultNetwork?: string;\n /** Whether to auto-detect user's preferred network based on wallet */\n autoDetect?: boolean;\n}\n\n/**\n * SDK client configuration options\n */\nexport interface X402ClientConfig {\n /** Facilitator URL (default: https://facilitator.ultravioletadao.xyz) */\n facilitatorUrl?: string;\n /** Default chain to connect to */\n defaultChain?: string;\n /** Auto-connect on initialization */\n autoConnect?: boolean;\n /** Enable debug logging */\n debug?: boolean;\n /** Custom chain configurations (override defaults) */\n customChains?: Record<string, Partial<ChainConfig>>;\n /** Wallet preference order */\n walletPreference?: string[];\n /** Custom RPC URLs (override defaults) */\n rpcOverrides?: Record<string, string>;\n /**\n * x402 protocol version to use\n * - 1: Classic format with network as string (e.g., \"base\")\n * - 2: CAIP-2 format with accepts array (e.g., \"eip155:8453\")\n * - 'auto': Auto-detect from 402 response (default)\n */\n x402Version?: X402Version | 'auto';\n /** Multi-payment configuration for supporting multiple networks */\n multiPayment?: MultiPaymentConfig;\n /**\n * What this buyer is allowed to sign, decided before it signs.\n *\n * Left undefined, the client holds `PurchasePolicy.permissive()`: this SDK had\n * no budget before 2.89.0 and turning one on silently would refuse payments\n * callers are making today. A policy built with `PurchasePolicy.create()`\n * denies any asset it was not given a ceiling for.\n *\n * @see {@link PurchasePolicy}\n */\n policy?: PurchasePolicy;\n /**\n * Include a `token` block in the payload naming the asset, its decimals and\n * its EIP-712 domain.\n *\n * Needed when the resource accepts more than one stablecoin on the same\n * chain: the signature alone does not say which one was paid, so the server\n * cannot rebuild `paymentRequirements`. Off by default — the emitted header\n * stays byte-identical to previous versions.\n */\n includeTokenMetadata?: boolean;\n}\n\n/**\n * Default configuration values\n */\nexport const DEFAULT_CONFIG: Required<Pick<X402ClientConfig, 'facilitatorUrl' | 'defaultChain' | 'autoConnect' | 'debug' | 'x402Version'>> = {\n facilitatorUrl: 'https://facilitator.ultravioletadao.xyz',\n defaultChain: 'base',\n autoConnect: false,\n debug: false,\n x402Version: 'auto',\n};\n\n// ============================================================================\n// BALANCE TYPES\n// ============================================================================\n\n/**\n * Balance information for a single network\n */\nexport interface NetworkBalance {\n /** Chain name */\n chainName: string;\n /** Human-readable display name */\n displayName: string;\n /** Formatted balance (e.g., \"15.50\") or null if loading/error */\n balance: string | null;\n /** Whether balance is currently being fetched */\n isLoading: boolean;\n /** Error message if fetch failed */\n error: string | null;\n}\n\n// ============================================================================\n// EVENT TYPES\n// ============================================================================\n\n/**\n * Events emitted by the SDK client\n */\nexport type X402Event =\n | 'connect'\n | 'disconnect'\n | 'chainChanged'\n | 'accountChanged'\n | 'balanceChanged'\n | 'paymentStarted'\n | 'paymentSigned'\n | 'paymentCompleted'\n | 'paymentFailed';\n\n/**\n * Event data types\n */\nexport interface X402EventData {\n connect: WalletState;\n disconnect: void;\n chainChanged: { chainId: number; chainName: string };\n accountChanged: { address: string };\n balanceChanged: { balance: string };\n paymentStarted: { amount: string; network: string };\n paymentSigned: { paymentHeader: string };\n paymentCompleted: PaymentResult;\n paymentFailed: { error: string; code: X402ErrorCode };\n}\n\n/**\n * Event handler type\n */\nexport type X402EventHandler<E extends X402Event> = (data: X402EventData[E]) => void;\n\n// ============================================================================\n// ERROR TYPES\n// ============================================================================\n\n/**\n * Error codes for categorizing errors\n */\nexport type X402ErrorCode =\n | 'WALLET_NOT_FOUND'\n | 'WALLET_NOT_CONNECTED'\n | 'WALLET_NOT_SUPPORTED'\n | 'WALLET_CONNECTION_FAILED'\n | 'WALLET_CONNECTION_REJECTED'\n | 'WALLET_CONNECTION_TIMEOUT'\n | 'CHAIN_NOT_SUPPORTED'\n | 'CHAIN_SWITCH_REJECTED'\n | 'INSUFFICIENT_BALANCE'\n | 'SIGNATURE_REJECTED'\n | 'PAYMENT_FAILED'\n | 'PAYMENT_TIMEOUT'\n | 'NETWORK_ERROR'\n | 'INVALID_CONFIG'\n | 'INVALID_AMOUNT'\n | 'INVALID_RECIPIENT'\n | 'PAYMENT_EXCEEDS_MAX'\n | 'NO_ACCEPTABLE_PAYMENT'\n /**\n * The buyer's own policy refused the offer before anything was signed. The\n * concrete cause is on `PolicyRefusedError.refusal.code` -- see\n * {@link PurchasePolicy}.\n */\n | 'POLICY_REFUSED'\n | 'UNKNOWN_ERROR';\n\n/**\n * SDK-specific error class\n */\nexport class X402Error extends Error {\n public readonly code: X402ErrorCode;\n public readonly details?: unknown;\n\n constructor(message: string, code: X402ErrorCode, details?: unknown) {\n super(message);\n this.name = 'X402Error';\n this.code = code;\n this.details = details;\n\n // Maintains proper stack trace for where error was thrown (V8 engines)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, X402Error);\n }\n }\n}\n","/**\n * uvd-x402-sdk/erc8128 — the signer.\n *\n * Emits the F3-1 pinned wire format: covered components in the order\n * `@method @authority @path [@query] [content-digest]`, parameters in the\n * order `created;expires;nonce;keyid;alg`, `alg=\"eip191\"` ALWAYS LAST, keyid\n * address ALWAYS lowercase (a checksummed keyid caused the v9.x silent-auth\n * incident), base joined with single LF and no trailing newline.\n *\n * Everything the fleet's 13 copies disagreed about is a value here, not a\n * branch: `profile` (emit `alg` or not), `contentDigest` (body-present vs\n * body-truthy), `headerCase` (Title-Case vs lowercase), `now` (injectable\n * clock, so tests never monkeypatch a module's globals).\n *\n * The nonce is REQUIRED and never invented. A silent local fallback makes a\n * server outage look like an auth bug; `createSignedFetch` exposes it as an\n * explicit `onNonceUnavailable` escape hatch instead.\n *\n * Private keys: `signRequest` takes one only as a convenience for scripts.\n * It must come from `process.env` / AWS Secrets Manager — never a literal.\n * The SDK does not read it from the environment, log it or persist it.\n */\n\nimport { ethers } from 'ethers';\n\nimport { X402Error } from '../types';\nimport type { SigningWalletAdapter } from '../wallet';\nimport {\n buildSignatureBase,\n buildSignatureParams,\n canonicalKeyid,\n canonicalParams,\n computeContentDigest,\n DEFAULT_CHAIN_ID,\n DEFAULT_LABEL,\n DEFAULT_VALIDITY_SEC,\n splitRequestTarget,\n} from './core';\n\n/** Wire generation to emit. `legacy-no-alg` exists only for byte-identical\n * migration commits; a checksummed keyid is verify-only and never emitted. */\nexport type WireProfile = 'canonical' | 'legacy-no-alg';\n\n/** When to attach a `Content-Digest`. */\nexport type ContentDigestEmit = 'body-present' | 'body-truthy';\n\nexport type HeaderCase = 'title' | 'lower';\n\nexport interface SignOptions {\n method: string;\n /** Full URL. `@authority`, `@path` and `@query` come from it. */\n url: string;\n /** Single-use nonce from the server. Required — the SDK never mints one. */\n nonce: string;\n /** Exact body bytes that will go on the wire, or null/undefined for none. */\n body?: string | Uint8Array | null;\n /** Default 8453 (Base). */\n chainId?: number;\n /** Default `'eth'`. */\n label?: string;\n /** Default 300; clamped to 300, the window every verifier caps at. */\n validitySec?: number;\n /** Default `'canonical'`. */\n profile?: WireProfile;\n /** Default `'body-present'`: an empty-string body still gets a digest. */\n contentDigest?: ContentDigestEmit;\n /** Default `'title'`. `'lower'` is for callers that merge into a lowercase\n * header dict, where mixed casing silently loses keys. */\n headerCase?: HeaderCase;\n /** Injectable clock, seconds. */\n now?: () => number;\n}\n\nexport interface Erc8128Headers {\n Signature: string;\n 'Signature-Input': string;\n 'Content-Digest'?: string;\n}\n\nexport interface Erc8128LowerHeaders {\n signature: string;\n 'signature-input': string;\n 'content-digest'?: string;\n}\n\nexport type Erc8128SignedHeaders = Erc8128Headers | Erc8128LowerHeaders;\n\nexport interface SignWithSignerOptions extends SignOptions {\n /** Signer address, any case — lowercased for the keyid. */\n address: string;\n /** EIP-191 personal_sign over the signature base; returns 0x + 130 hex. */\n signMessage(signatureBase: string): string | Promise<string>;\n}\n\nexport interface SignWithWalletOptions extends SignOptions {\n wallet: SigningWalletAdapter;\n}\n\nexport interface SignWithPrivateKeyOptions extends SignOptions {\n /** From process.env / Secrets Manager. Never a literal, never logged. */\n privateKey: string;\n}\n\nfunction hasBodyFor(body: SignOptions['body'], rule: ContentDigestEmit): boolean {\n if (body === undefined || body === null) return false;\n if (rule === 'body-present') return true;\n return typeof body === 'string' ? body.length > 0 : body.length > 0;\n}\n\nfunction toHeaders(\n headerCase: HeaderCase,\n signature: string,\n signatureInput: string,\n contentDigest?: string\n): Erc8128SignedHeaders {\n if (headerCase === 'lower') {\n const lower: Erc8128LowerHeaders = {\n signature,\n 'signature-input': signatureInput,\n };\n if (contentDigest) lower['content-digest'] = contentDigest;\n return lower;\n }\n const title: Erc8128Headers = {\n Signature: signature,\n 'Signature-Input': signatureInput,\n };\n if (contentDigest) title['Content-Digest'] = contentDigest;\n return title;\n}\n\nexport function signRequestWithSigner(\n options: SignWithSignerOptions & { headerCase: 'lower' }\n): Promise<Erc8128LowerHeaders>;\nexport function signRequestWithSigner(\n options: SignWithSignerOptions & { headerCase?: 'title' }\n): Promise<Erc8128Headers>;\nexport function signRequestWithSigner(\n options: SignWithSignerOptions\n): Promise<Erc8128SignedHeaders>;\n/**\n * Sign with a bare EIP-191 callback — for browser wallets, OWS vaults and any\n * out-of-process signer. The key never reaches this module.\n */\nexport async function signRequestWithSigner(\n options: SignWithSignerOptions\n): Promise<Erc8128SignedHeaders> {\n const {\n address,\n signMessage,\n method,\n url,\n nonce,\n body,\n chainId = DEFAULT_CHAIN_ID,\n label = DEFAULT_LABEL,\n validitySec = DEFAULT_VALIDITY_SEC,\n profile = 'canonical',\n contentDigest: digestRule = 'body-present',\n headerCase = 'title',\n now,\n } = options;\n\n if (typeof nonce !== 'string' || !nonce) {\n throw new X402Error(\n 'ERC-8128 signing requires a server-issued nonce; the SDK never mints one.',\n 'INVALID_CONFIG'\n );\n }\n\n const { authority, path, query } = splitRequestTarget(url);\n if (!authority) {\n throw new X402Error('ERC-8128 signing requires an absolute URL.', 'INVALID_CONFIG');\n }\n\n const created = now ? now() : Math.floor(Date.now() / 1000);\n const expires = created + Math.min(Math.max(validitySec, 1), DEFAULT_VALIDITY_SEC);\n\n const covered = ['@method', '@authority', '@path'];\n if (query) covered.push('@query');\n\n let digest: string | undefined;\n if (hasBodyFor(body, digestRule)) {\n digest = computeContentDigest(body as string | Uint8Array);\n covered.push('content-digest');\n }\n\n const params = canonicalParams({\n created,\n expires,\n nonce,\n keyid: canonicalKeyid(chainId, address),\n alg: profile === 'legacy-no-alg' ? null : undefined,\n });\n\n const message = {\n method,\n authority,\n path,\n query,\n contentDigest: digest,\n covered,\n params,\n };\n const signatureBase = buildSignatureBase(message);\n\n const sigHex = await signMessage(signatureBase);\n const sigBytes = ethers.getBytes(sigHex.startsWith('0x') ? sigHex : `0x${sigHex}`);\n const sigB64 = ethers.encodeBase64(sigBytes);\n\n // Same builder the base's last line used, so the header and the signed bytes\n // cannot drift apart.\n const sigParams = buildSignatureParams(message);\n\n return toHeaders(headerCase, `${label}=:${sigB64}:`, `${label}=${sigParams}`, digest);\n}\n\nexport function signRequestWithWallet(\n options: SignWithWalletOptions & { headerCase: 'lower' }\n): Promise<Erc8128LowerHeaders>;\nexport function signRequestWithWallet(\n options: SignWithWalletOptions & { headerCase?: 'title' }\n): Promise<Erc8128Headers>;\nexport function signRequestWithWallet(\n options: SignWithWalletOptions\n): Promise<Erc8128SignedHeaders>;\n/**\n * Sign with a {@link SigningWalletAdapter}. Only `getAddress()` and\n * `signMessage()` are used, so the key stays inside the adapter.\n */\nexport function signRequestWithWallet(\n options: SignWithWalletOptions\n): Promise<Erc8128SignedHeaders> {\n const { wallet, ...rest } = options;\n return signRequestWithSigner({\n ...rest,\n address: wallet.getAddress(),\n signMessage: (signatureBase) => wallet.signMessage(signatureBase),\n });\n}\n\nexport function signRequest(\n options: SignWithPrivateKeyOptions & { headerCase: 'lower' }\n): Promise<Erc8128LowerHeaders>;\nexport function signRequest(\n options: SignWithPrivateKeyOptions & { headerCase?: 'title' }\n): Promise<Erc8128Headers>;\nexport function signRequest(\n options: SignWithPrivateKeyOptions\n): Promise<Erc8128SignedHeaders>;\n/**\n * Sign with a raw private key. Convenience for scripts and bots that already\n * hold the key in the environment — prefer {@link signRequestWithWallet}.\n */\nexport function signRequest(options: SignWithPrivateKeyOptions): Promise<Erc8128SignedHeaders> {\n const { privateKey, ...rest } = options;\n const key = privateKey.startsWith('0x') ? privateKey : `0x${privateKey}`;\n const wallet = new ethers.Wallet(key);\n return signRequestWithSigner({\n ...rest,\n address: wallet.address,\n signMessage: (signatureBase) => wallet.signMessage(signatureBase),\n });\n}\n\n/**\n * Fetch a fresh single-use nonce.\n *\n * Throws on failure and never falls back to a locally minted value: a local\n * nonce authenticates against a first-use-wins store and is rejected by an\n * issuer-bound one, which turns a server blip into an auth mystery.\n */\nexport async function fetchNonce(apiBase: string, timeoutMs = 10000): Promise<string> {\n const url = `${apiBase.replace(/\\/$/, '')}/api/v1/auth/erc8128/nonce`;\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), timeoutMs);\n\n try {\n const resp = await fetch(url, { signal: controller.signal });\n if (!resp.ok) {\n throw new Error(`Failed to fetch nonce: ${resp.status} ${resp.statusText}`);\n }\n const data = (await resp.json()) as { nonce: string };\n if (!data || typeof data.nonce !== 'string' || !data.nonce) {\n throw new Error('Nonce endpoint returned no nonce');\n }\n return data.nonce;\n } finally {\n clearTimeout(timer);\n }\n}\n\nexport interface CreateSignedFetchConfig {\n /** API origin, e.g. `https://api.execution.market`. */\n apiBase: string;\n chainId?: number;\n /** From process.env / Secrets Manager. Never a literal. */\n privateKey?: string;\n wallet?: SigningWalletAdapter;\n profile?: WireProfile;\n contentDigest?: ContentDigestEmit;\n headerCase?: HeaderCase;\n /**\n * EXPLICIT escape hatch for a nonce-endpoint outage. The SDK never mints a\n * local nonce on its own; a caller that opts in owns the consequence (an\n * issuer-bound store will reject it).\n */\n onNonceUnavailable?: (error: unknown) => string | Promise<string>;\n}\n\n/**\n * A `fetch` wrapper that fetches a nonce and signs every call.\n *\n * Takes an origin-relative path; `apiBase` supplies the origin.\n */\nexport function createSignedFetch(\n config: CreateSignedFetchConfig\n): (path: string, init?: RequestInit) => Promise<Response> {\n const { apiBase, chainId, privateKey, wallet, profile, contentDigest, headerCase } = config;\n\n if (!privateKey && !wallet) {\n throw new X402Error(\n 'createSignedFetch requires a signer: pass privateKey or wallet.',\n 'WALLET_NOT_CONNECTED'\n );\n }\n\n return async (path: string, init?: RequestInit): Promise<Response> => {\n const url = `${apiBase.replace(/\\/$/, '')}${path}`;\n const method = (init?.method || 'GET').toUpperCase();\n const body = init?.body === undefined || init?.body === null ? undefined : String(init.body);\n\n let nonce: string;\n try {\n nonce = await fetchNonce(apiBase);\n } catch (error) {\n if (!config.onNonceUnavailable) throw error;\n nonce = await config.onNonceUnavailable(error);\n }\n\n const options: SignOptions = {\n method,\n url,\n nonce,\n body,\n chainId,\n profile,\n contentDigest,\n headerCase,\n };\n const signed = wallet\n ? await signRequestWithWallet({ ...options, wallet })\n : await signRequest({ ...options, privateKey: privateKey as string });\n\n const headers = new Headers(init?.headers);\n for (const [name, value] of Object.entries(signed)) {\n if (typeof value === 'string') headers.set(name, value);\n }\n if (body !== undefined) {\n headers.set('Content-Type', headers.get('Content-Type') || 'application/json');\n }\n\n return fetch(url, { ...init, headers, method });\n };\n}\n","/**\n * uvd-x402-sdk/erc8128 — the verifier.\n *\n * ONE pipeline, driven by a policy object:\n *\n * parse → alg gate → signature bytes → freshness → chain → binding\n * → [nonce?] → content-digest → components → base → recover → [nonce?]\n *\n * `meshrelay-strict` and `em-lenient` are records of knobs over that pipeline,\n * not branches — see `presets.ts`. Strict and lenient differ in POLICY, never\n * in how bytes are rebuilt.\n *\n * The rebuild takes the `@signature-params` substring VERBATIM off the wire\n * (`ParsedSignatureInput.paramsRaw`) and feeds it to the same\n * `buildSignatureBase()` the signer uses. That is why `alg` present, `alg`\n * absent, a checksummed keyid, a different parameter order and any future\n * RFC 9421 parameter all verify through one byte path with no flags. Parsing\n * exists only to make POLICY decisions.\n *\n * Content-Digest follows Execution Market's body-presence rule, which the\n * owner made canonical (spec §10 Q1): a digest is required — and must be in\n * the signed component list — if and only if the request carries a body; a\n * bodyless request may cover it voluntarily and is still verified.\n * MeshRelay's method-driven rule stays available as\n * `contentDigest: 'non-idempotent-methods'`.\n */\n\nimport { ethers } from 'ethers';\n\nimport { X402Error } from '../types';\nimport {\n buildSignatureBase,\n Erc8128ParseError,\n eip191Message,\n parseSignatureHeader,\n parseSignatureInput,\n REQUEST_BOUND_COMPONENTS,\n splitRequestTarget,\n} from './core';\nimport type { ObservedProfile, ParsedSignatureInput } from './core';\nimport {\n ERC8128_ERROR_MESSAGE,\n ERC8128_ERROR_RETRYABLE,\n ERC8128_ERROR_STATUS,\n} from './errors';\nimport type { Erc8128Code } from './errors';\nimport type { NoncePolicy } from './nonce';\n\n/** Which wire generations a verifier accepts. */\nexport type AcceptProfile = 'canonical' | 'legacy' | 'accept-both';\n\n/** How the covered-component list is checked. */\nexport type ComponentsRule = 'exact-ordered' | 'request-bound-subset';\n\n/** When a `Content-Digest` is mandatory. */\nexport type ContentDigestRule = 'body-present' | 'non-idempotent-methods';\n\n/** ERC-1271 hook. The SDK never opens an RPC connection itself. */\nexport interface ContractVerifierInput {\n address: string;\n chainId: number;\n /** keccak256 of the EIP-191 message, using the UTF-8 BYTE length prefix. */\n messageHash: Uint8Array;\n signature: Uint8Array;\n}\n\nexport interface VerifyPolicy {\n /**\n * A VALUE, never derived inside the SDK.\n *\n * MeshRelay passes its pinned `config.erc8128Auth.publicAuthority`; EM's\n * REST/MCP wrapper passes `_resolve_authority(request)`; EM's WebSocket path\n * MUST keep passing `url.netloc` — deriving it from `X-Forwarded-Host`\n * there let a caller rebuild the base over an authority they chose\n * (websocket/server.py:199-213).\n *\n * WRITE IT THE WAY IT IS SIGNED. The value goes through\n * `policyAuthority()`, which lowercases and validates it and NEVER touches\n * ports: it is the expected OUTPUT of the signer's `canonicalAuthority()`,\n * so `:443` under https and `:80` under http are already gone by the time\n * they get here, and any other port is part of the authority and is kept.\n * Configuring a default port is misconfiguration and answers 503 with a\n * message that says so — re-normalising it under a scheme this value does\n * not carry is what broke `https` on `:80`.\n */\n authority: string;\n /** Default `'accept-both'`. */\n accept?: AcceptProfile;\n /** Default `'exact-ordered'`. */\n components?: ComponentsRule;\n /** Default `'body-present'` (EM's rule, canonical per the owner's Q1 call). */\n contentDigest?: ContentDigestRule;\n nonce?: NoncePolicy;\n /** `undefined` accepts any chain id (EM's posture). */\n allowedChainIds?: readonly number[];\n /** Default 300. */\n maxValiditySec?: number;\n /**\n * Default `{ future: 30, pastExpiry: 0 }` (MeshRelay). EM uses 30/30.\n *\n * `pastExpiry` is inclusive: a signature is rejected once\n * `now >= expires + pastExpiry`. EM's Python compares strictly, so it\n * accepts the single instant `now == expires + 30` that this rejects — a\n * one-second difference in the stricter direction.\n */\n clockSkew?: { future?: number; pastExpiry?: number };\n /** `'eth'` by default; `'any'` takes `eth` when present, else the first. */\n label?: 'any' | string;\n contractVerifier?(input: ContractVerifierInput): Promise<boolean>;\n /** Injectable clock (seconds). */\n now?: () => number;\n /**\n * Deprecation census. Fires on SUCCESSFUL **and FAILED** verifications,\n * tagged with the outcome — a legacy emitter that is already failing for\n * another reason must not make the census look clean, or the S3 flip turns\n * a recoverable outage into a permanent one.\n *\n * Aggregate by `profile` (3 values), never by keyid: keyid is per-wallet\n * cardinality.\n */\n onObservedProfile?(\n profile: ObservedProfile,\n ctx: { wallet: string; chainId: number; keyid: string; outcome: 'ok' | Erc8128Code }\n ): void;\n}\n\nexport interface VerifiableRequest {\n method: string;\n /** Absolute or origin-relative. Never normalised — raw bytes matter. */\n url: string;\n headers: Readonly<Record<string, string | string[] | undefined>>;\n /** Exact body bytes off the wire, or `undefined` when there is no body. */\n rawBody?: Uint8Array;\n}\n\nexport type VerifyResult =\n | {\n ok: true;\n wallet: string;\n chainId: number;\n keyid: string;\n label: string;\n nonce?: string;\n created: number;\n expires: number;\n signatureBase: string;\n observedProfile: ObservedProfile;\n via: 'eoa' | 'erc1271';\n }\n | {\n ok: false;\n code: Erc8128Code;\n message: string;\n status: number;\n retryable: boolean;\n observedProfile?: ObservedProfile;\n };\n\n/** Internal control flow. Never escapes `verifyRequest`. */\nclass VerifyFailure extends Error {\n constructor(\n public readonly code: Erc8128Code,\n message?: string\n ) {\n super(message ?? ERC8128_ERROR_MESSAGE[code]);\n this.name = 'VerifyFailure';\n }\n}\n\nconst CONTENT_DIGEST_RE = /^sha-256=:([A-Za-z0-9+/]+={0,2}):$/;\nconst IDEMPOTENT_METHODS = ['GET', 'HEAD'];\n\nfunction headerLookup(\n headers: Readonly<Record<string, string | string[] | undefined>>\n): (name: string) => string | undefined {\n const map = new Map<string, string>();\n for (const [key, value] of Object.entries(headers ?? {})) {\n if (value === undefined) continue;\n const flat = Array.isArray(value) ? value[0] : value;\n if (typeof flat !== 'string' || !flat) continue;\n const lower = key.toLowerCase();\n if (!map.has(lower)) map.set(lower, flat);\n }\n return (name: string) => map.get(name.toLowerCase());\n}\n\n/**\n * Characters that can never appear inside a configured authority: every\n * whitespace character the rule names, plus the four delimiters that mark a\n * value as a URL, a path, a query or a userinfo prefix rather than a bare\n * `host[:port]`.\n *\n * The class is ENUMERATED rather than written `\\s`, because the Python side\n * must reject the byte-for-byte same input set and the two languages disagree\n * about which exotic code points `\\s` covers. `\\n`, `\\r`, `\\v`, `\\f` and NBSP\n * are here on purpose: they used to slip through and get embedded into the\n * rebuilt signature base.\n */\nconst AUTHORITY_FORBIDDEN_RE = /[ \\t\\n\\r\\v\\f\\u00a0/@?#]/;\n\n/**\n * The CONFIGURED authority: lowercased and validated. IT NEVER TOUCHES PORTS.\n *\n * This is the counterpart of `canonicalAuthority()`, not a second application\n * of it. The configured value is the EXPECTED RESULT of that function, so it\n * must already be written in its output form; normalising it a second time,\n * under a scheme it does not carry, is exactly what made the two SDKs diverge.\n * A port present here is preserved verbatim, whatever it is — which is what\n * makes `https` on `:80` (signed `host:80`) and a non-default port like\n * `host:8443` both work.\n *\n * Everything below is misconfiguration — the operator's typo, never the\n * caller's signature — so it answers 503 `authority_invalid`, never 401:\n * - empty, or empty once trimmed\n * - longer than 253 characters\n * - any whitespace, or any of `/ @ ? #` (which is also how a pasted URL, a\n * scheme prefix and a path component are caught)\n * - a port that is the default for EITHER scheme (`:443` / `:80`), which\n * gets its own message: the signer omits that port, so a config carrying\n * it can never match. Silently stripping it is what broke https-on-:80.\n */\nexport function policyAuthority(value: string): string {\n const authority = String(value ?? '')\n .trim()\n .toLowerCase();\n\n if (!authority || authority.length > 253 || AUTHORITY_FORBIDDEN_RE.test(authority)) {\n throw new VerifyFailure('authority_invalid');\n }\n\n const portAt = authority.lastIndexOf(':');\n // No port at all, or a bracketed IPv6 host whose colons are inside it.\n if (portAt > authority.lastIndexOf(']')) {\n const port = authority.slice(portAt + 1);\n if (port === '443' || port === '80') {\n throw new VerifyFailure(\n 'authority_invalid',\n `ERC-8128 authority must be configured the way it is signed, with the default port omitted: ` +\n `write \"${authority.slice(0, portAt)}\", not \"${authority}\"`\n );\n }\n }\n\n return authority;\n}\n\nfunction constantTimeEqual(a: Uint8Array, b: Uint8Array): boolean {\n if (a.length !== b.length) return false;\n let diff = 0;\n for (let i = 0; i < a.length; i++) diff |= a[i] ^ b[i];\n return diff === 0;\n}\n\n/**\n * Verify the `Content-Digest` header against the body bytes.\n *\n * The header value is replayed into the signature base VERBATIM (EM's\n * behaviour), not re-encoded: a signer that emitted non-canonical base64\n * padding signed its own bytes, and re-encoding would rebuild a base it never\n * signed.\n */\nfunction verifyContentDigest(headerValue: string | undefined, rawBody: Uint8Array): void {\n if (!headerValue) throw new VerifyFailure('content_digest_required');\n const match = CONTENT_DIGEST_RE.exec(headerValue);\n if (!match) throw new VerifyFailure('content_digest_invalid');\n\n let provided: Uint8Array;\n try {\n provided = ethers.decodeBase64(match[1]);\n } catch {\n throw new VerifyFailure('content_digest_invalid');\n }\n const expected = ethers.getBytes(ethers.sha256(rawBody));\n if (!constantTimeEqual(provided, expected)) {\n throw new VerifyFailure('content_digest_mismatch');\n }\n}\n\nasync function consumeNonce(\n noncePolicy: NoncePolicy,\n parsed: ParsedSignatureInput,\n wallet: string,\n skewFuture: number\n): Promise<void> {\n if (!parsed.nonce) return;\n let outcome;\n try {\n outcome = await noncePolicy.store.consume(parsed.nonce, {\n wallet,\n chainId: parsed.chainId,\n ttlSeconds: parsed.expires - parsed.created + skewFuture,\n created: parsed.created,\n expires: parsed.expires,\n });\n } catch {\n // Store infrastructure failure is NOT a bad signature: it must answer\n // 503 + retry, never a terminal 401.\n throw new VerifyFailure('nonce_store_unavailable');\n }\n switch (outcome) {\n case 'ok':\n return;\n case 'unknown':\n throw new VerifyFailure('nonce_unknown');\n case 'replayed':\n throw new VerifyFailure('nonce_replayed');\n case 'expired':\n throw new VerifyFailure('nonce_expired');\n case 'unavailable':\n throw new VerifyFailure('nonce_store_unavailable');\n default:\n throw new VerifyFailure('nonce_store_unavailable', 'Nonce store returned an unknown outcome');\n }\n}\n\n/**\n * Verify an ERC-8128 signed HTTP request.\n *\n * Expected authentication failures come back as `{ ok: false, code, status,\n * retryable }` — they are values, not exceptions. Exceptions are reserved for\n * programmer error (e.g. a policy with no authority).\n */\nexport async function verifyRequest(\n req: VerifiableRequest,\n policy: VerifyPolicy\n): Promise<VerifyResult> {\n if (!policy || typeof policy.authority !== 'string') {\n throw new X402Error(\n 'verifyRequest requires policy.authority — a value, never derived from a client-controlled header.',\n 'INVALID_CONFIG'\n );\n }\n\n const accept = policy.accept ?? 'accept-both';\n const componentsRule = policy.components ?? 'exact-ordered';\n const digestRule = policy.contentDigest ?? 'body-present';\n const maxValiditySec = policy.maxValiditySec ?? 300;\n const skewFuture = policy.clockSkew?.future ?? 30;\n const skewPastExpiry = policy.clockSkew?.pastExpiry ?? 0;\n const label = policy.label ?? 'eth';\n const now = policy.now ? policy.now() : Math.floor(Date.now() / 1000);\n\n let parsed: ParsedSignatureInput | undefined;\n\n const census = (outcome: 'ok' | Erc8128Code) => {\n if (!policy.onObservedProfile || !parsed) return;\n policy.onObservedProfile(parsed.observedProfile, {\n wallet: parsed.wallet,\n chainId: parsed.chainId,\n keyid: parsed.keyid,\n outcome,\n });\n };\n\n try {\n const header = headerLookup(req.headers);\n const authority = policyAuthority(policy.authority);\n\n // 1. Wire parsing. paramsRaw is kept verbatim from here on.\n parsed = parseSignatureInput(header('signature-input') ?? '', label);\n\n // 2. alg gate. Accepting a scheme we do not verify with would let a\n // signature declare one algorithm and be checked under another.\n if (parsed.alg !== undefined && parsed.alg !== 'eip191') {\n throw new VerifyFailure('alg_unsupported');\n }\n if (accept === 'canonical') {\n if (parsed.alg === undefined) throw new VerifyFailure('alg_missing');\n if (parsed.keyid !== parsed.keyid.toLowerCase()) {\n throw new VerifyFailure('keyid_not_lowercase');\n }\n }\n if (accept === 'legacy' && parsed.alg !== undefined) {\n throw new VerifyFailure('alg_unsupported', 'This policy accepts only the legacy (no alg) profile');\n }\n\n // 3. Signature bytes for this label.\n const signature = parseSignatureHeader(header('signature') ?? '', parsed.label);\n\n // 4. Freshness.\n if (\n !Number.isSafeInteger(parsed.created) ||\n !Number.isSafeInteger(parsed.expires) ||\n parsed.expires <= parsed.created ||\n parsed.expires - parsed.created > maxValiditySec ||\n parsed.created > now + skewFuture ||\n now >= parsed.expires + skewPastExpiry\n ) {\n throw new VerifyFailure('signature_stale');\n }\n\n // 5. Chain allowlist (undefined ⇒ any chain, EM's posture).\n if (policy.allowedChainIds && !policy.allowedChainIds.includes(parsed.chainId)) {\n throw new VerifyFailure('chain_not_allowed');\n }\n\n const { path, query } = splitRequestTarget(req.url);\n const covered = parsed.covered;\n\n // 6. Nonce presence.\n const nonceMode = policy.nonce?.mode ?? 'required';\n if (policy.nonce && nonceMode === 'required' && !parsed.nonce) {\n throw new VerifyFailure('nonce_required');\n }\n\n // 7. Binding, for the lenient posture. The strict posture checks the\n // exact list further down (it needs the digest decision first).\n if (componentsRule === 'request-bound-subset') {\n const missing = REQUEST_BOUND_COMPONENTS.some((c) => !covered.includes(c));\n if (missing || (query && !covered.includes('@query'))) {\n throw new VerifyFailure('class_bound_rejected');\n }\n }\n\n // 8. Nonce consumption, EM's order: before the expensive crypto, so two\n // concurrent requests cannot both pass.\n const consumeOrder = policy.nonce?.consume ?? 'before-verify';\n if (policy.nonce && consumeOrder === 'before-verify') {\n await consumeNonce(policy.nonce, parsed, parsed.wallet, skewFuture);\n }\n\n // 9. Content-Digest.\n const digestHeader = header('content-digest');\n const rawBody = req.rawBody;\n let digestVerified = false;\n\n if (digestRule === 'non-idempotent-methods') {\n // MeshRelay's rule: every write must carry a raw body AND a digest.\n const requiresDigest = !IDEMPOTENT_METHODS.includes(req.method.toUpperCase());\n if (requiresDigest) {\n if (rawBody === undefined || digestHeader === undefined) {\n throw new VerifyFailure('content_digest_required');\n }\n verifyContentDigest(digestHeader, rawBody);\n digestVerified = true;\n }\n } else {\n // EM's rule, body-presence driven.\n //\n // `hasBody` is derived from the wire headers exactly as EM derives it,\n // PLUS a byte-level term. EM's header-only heuristic is sound only under\n // HTTP/1.1 framing, where a body cannot exist without content-length or\n // transfer-encoding; that is an environmental invariant of its uvicorn\n // deployment, not something the rule enforces. A shared SDK cannot\n // inherit an unstated precondition, so a non-empty body always counts as\n // a body here. The extra term never fires for HTTP/1.1 traffic.\n const contentLength = header('content-length');\n const headerSaysBody =\n (contentLength !== undefined && contentLength !== '0') ||\n header('transfer-encoding') !== undefined;\n const bytesSayBody = rawBody !== undefined && rawBody.length > 0;\n const hasBody = headerSaysBody || bytesSayBody;\n\n if (hasBody) {\n // CRY-001: the test is on the SIGNED list, not on header presence, so\n // an unsigned Content-Digest header can never satisfy it — and a body\n // attached to a bodyless-signed request is rejected here, before any\n // signature work.\n if (!covered.includes('content-digest')) {\n throw new VerifyFailure(\n 'content_digest_required',\n 'Bodied request MUST include content-digest in signed components'\n );\n }\n verifyContentDigest(digestHeader, rawBody ?? new Uint8Array(0));\n digestVerified = true;\n } else if (covered.includes('content-digest')) {\n // Bodyless request that covers the digest voluntarily — still verified.\n verifyContentDigest(digestHeader, rawBody ?? new Uint8Array(0));\n digestVerified = true;\n }\n }\n\n // 10. Exact covered list, for the strict posture.\n if (componentsRule === 'exact-ordered') {\n const expected = [...REQUEST_BOUND_COMPONENTS];\n if (query) expected.push('@query');\n if (digestVerified) expected.push('content-digest');\n if (\n covered.length !== expected.length ||\n covered.some((component, index) => component !== expected[index])\n ) {\n throw new VerifyFailure('components_invalid');\n }\n }\n\n // 11. Rebuild the base. The parameter substring is replayed VERBATIM.\n const signatureBase = buildSignatureBase({\n method: req.method,\n authority,\n path,\n query,\n contentDigest: digestHeader,\n covered,\n params: parsed.paramsRaw,\n headers: Object.fromEntries(\n covered\n .filter((c) => !c.startsWith('@') && c !== 'content-digest')\n .map((c) => [c.toLowerCase(), header(c) ?? ''])\n ),\n });\n\n // 12. EIP-191 recovery.\n let recovered: string | undefined;\n try {\n recovered = ethers.verifyMessage(signatureBase, ethers.hexlify(signature)).toLowerCase();\n } catch {\n recovered = undefined;\n }\n\n let via: 'eoa' | 'erc1271' = 'eoa';\n if (recovered !== parsed.wallet) {\n if (!policy.contractVerifier) {\n throw new VerifyFailure(\n recovered === undefined ? 'signature_invalid' : 'wallet_mismatch'\n );\n }\n let valid = false;\n try {\n valid = await policy.contractVerifier({\n address: parsed.wallet,\n chainId: parsed.chainId,\n messageHash: ethers.getBytes(ethers.keccak256(eip191Message(signatureBase))),\n signature,\n });\n } catch {\n valid = false;\n }\n if (!valid) {\n throw new VerifyFailure(\n recovered === undefined ? 'signature_invalid' : 'wallet_mismatch'\n );\n }\n via = 'erc1271';\n }\n\n // 13. Nonce consumption, MeshRelay's order: only after every\n // cryptographic and freshness check has passed.\n if (policy.nonce && consumeOrder === 'after-verify') {\n await consumeNonce(policy.nonce, parsed, parsed.wallet, skewFuture);\n }\n\n census('ok');\n return {\n ok: true,\n wallet: parsed.wallet,\n chainId: parsed.chainId,\n keyid: parsed.keyid,\n label: parsed.label,\n nonce: parsed.nonce,\n created: parsed.created,\n expires: parsed.expires,\n signatureBase,\n observedProfile: parsed.observedProfile,\n via,\n };\n } catch (error) {\n if (error instanceof VerifyFailure || error instanceof Erc8128ParseError) {\n census(error.code);\n return {\n ok: false,\n code: error.code,\n message: error.message,\n status: ERC8128_ERROR_STATUS[error.code],\n retryable: ERC8128_ERROR_RETRYABLE[error.code],\n observedProfile: parsed?.observedProfile,\n };\n }\n // Anything else is an SDK bug, not an authentication outcome. External\n // callbacks (nonce store, contract verifier) are already contained above.\n throw error;\n }\n}\n","/**\n * uvd-x402-sdk/erc8128 — the live postures, as data.\n *\n * `meshrelay-strict` and `em-lenient` reproduce what each product does today,\n * knob for knob, so adopting the SDK changes neither one's behaviour.\n * `canonical-strict` is the S3 posture: pre-written, unused until the\n * deprecation census is clean.\n *\n * These objects are pinned in the shipped vectors (`erc8128.f3-3.json`, block\n * `policies`) and `conformance.test.ts` asserts `presetAsData()` is deep-equal\n * to it — a preset edited without a matching vector edit fails the suite. That\n * block is snake_case because the SAME file is read by the Python SDK; see\n * {@link presetAsData}.\n *\n * They are PARTIAL on purpose: `authority` and `nonce` are per-deployment and\n * must be supplied by the caller. Spreading a preset and then overriding a\n * knob silently changes posture with no type error — use\n * {@link policyFromPreset}, which also carries the nonce ordering.\n *\n * One deliberate non-knob: no nonce charset/length rule. MeshRelay's\n * `^[A-Za-z0-9_-]{32,128}$` lives in its store, where issuance policy belongs;\n * the SDK never issues or formats a nonce.\n *\n * The nonce CONSUME ORDER is not inside the preset object — the store is the\n * caller's — but it belongs to the preset all the same, so it lives beside it\n * in {@link PRESET_NONCE_CONSUME} and `policyFromPreset()` stitches the two\n * together. Adopting `em-lenient` therefore gets EM's before-verify ordering\n * rather than a silently different one.\n */\n\nimport { X402Error } from '../types';\nimport type { NonceConsumeOrder, NonceStore } from './nonce';\nimport type { VerifyPolicy } from './verifier';\n\nexport type PolicyPresetName = 'meshrelay-strict' | 'em-lenient' | 'canonical-strict';\n\nexport type PolicyPreset = Omit<VerifyPolicy, 'authority' | 'nonce'>;\n\nexport const POLICY_PRESETS: Readonly<Record<PolicyPresetName, PolicyPreset>> = Object.freeze({\n /** MeshRelay today: order-locked components, method-driven digest, chain\n * allowlist, no grace after expiry, `eth` label only. */\n 'meshrelay-strict': Object.freeze({\n accept: 'accept-both',\n components: 'exact-ordered',\n contentDigest: 'non-idempotent-methods',\n allowedChainIds: Object.freeze([8453]),\n maxValiditySec: 300,\n clockSkew: Object.freeze({ future: 30, pastExpiry: 0 }),\n label: 'eth',\n }) as PolicyPreset,\n\n /** Execution Market today: superset components in any order, body-presence\n * digest, any chain id, ±30s skew, any label. */\n 'em-lenient': Object.freeze({\n accept: 'accept-both',\n components: 'request-bound-subset',\n contentDigest: 'body-present',\n maxValiditySec: 300,\n clockSkew: Object.freeze({ future: 30, pastExpiry: 30 }),\n label: 'any',\n }) as PolicyPreset,\n\n /** S3 target: legacy emitters start failing with `alg_missing` /\n * `keyid_not_lowercase`. Not used until the census is clean.\n *\n * The chain allowlist is PINNED to 8453, the production auth chain of both\n * products: a preset named \"strict\" that accepts any chain is not strict. A\n * verifier that already ran a wider allowlist overrides it explicitly. */\n 'canonical-strict': Object.freeze({\n accept: 'canonical',\n components: 'exact-ordered',\n contentDigest: 'body-present',\n allowedChainIds: Object.freeze([8453]),\n maxValiditySec: 300,\n clockSkew: Object.freeze({ future: 30, pastExpiry: 0 }),\n label: 'eth',\n }) as PolicyPreset,\n});\n\n/**\n * Preset → the nonce-consumption order that belongs to it. Kept beside the\n * presets (rather than inside them) because the store itself is the caller's:\n * MeshRelay consumes AFTER the crypto, EM BEFORE it, and neither can be\n * migrated to the other without changing a live product's behaviour.\n */\nexport const PRESET_NONCE_CONSUME: Readonly<Record<PolicyPresetName, NonceConsumeOrder>> =\n Object.freeze({\n 'meshrelay-strict': 'after-verify',\n 'em-lenient': 'before-verify',\n 'canonical-strict': 'after-verify',\n });\n\n/** Every preset rejects a nonce-less (replayable) signature. */\nexport const PRESET_NONCE_MODE = 'required' as const;\n\n/** The preset's knobs are all overridable; `authority` is required. */\nexport interface PolicyFromPresetOptions extends Partial<PolicyPreset> {\n /** A VALUE, never derived from a client-controlled header. */\n authority: string;\n /** The caller's store. Omitted ⇒ no nonce policy at all. */\n nonceStore?: NonceStore;\n /** Default `'required'`. */\n nonceMode?: 'required' | 'optional';\n}\n\n/**\n * Specialise a preset with the two things it cannot carry: the authority VALUE\n * and the caller's nonce store. The consume order comes from\n * {@link PRESET_NONCE_CONSUME}, so adopting `meshrelay-strict` cannot\n * accidentally flip MeshRelay to EM's ordering.\n */\nexport function policyFromPreset(\n name: PolicyPresetName,\n options: PolicyFromPresetOptions\n): VerifyPolicy {\n const preset = POLICY_PRESETS[name];\n if (!preset) {\n throw new X402Error(`Unknown ERC-8128 policy preset: ${name}`, 'INVALID_CONFIG');\n }\n const { authority, nonceStore, nonceMode = PRESET_NONCE_MODE, ...overrides } = options;\n return {\n ...preset,\n authority,\n ...(nonceStore\n ? { nonce: { store: nonceStore, mode: nonceMode, consume: PRESET_NONCE_CONSUME[name] } }\n : {}),\n ...overrides,\n };\n}\n\n/**\n * The JSON-shaped view of a preset — what the vectors' `policies` block pins\n * and what the conformance suite compares against, nonce ordering included.\n *\n * SNAKE_CASE AND FLAT, deliberately. This is the WIRE projection, not the\n * TypeScript object: the same block is read by the Python SDK, which spells\n * these fields `content_digest` / `clock_skew_future_sec`, and the rest of the\n * vector document (`chain_id`, `observed_profile`, `signature_base`) is\n * snake_case too. Emitting `contentDigest` here meant the shared vectors could\n * never be one file — each language would have had to ship its own casing.\n * Python's `preset_as_data()` returns exactly this, field for field, so\n * `presetAsData(n) === preset_as_data(n) === vectors.policies[n]` holds across\n * both runtimes and is asserted by the cross-language harness.\n */\nexport function presetAsData(name: PolicyPresetName): Record<string, unknown> {\n const preset = POLICY_PRESETS[name];\n return {\n accept: preset.accept,\n components: preset.components,\n content_digest: preset.contentDigest,\n allowed_chain_ids: preset.allowedChainIds ? [...preset.allowedChainIds] : null,\n max_validity_sec: preset.maxValiditySec,\n clock_skew_future_sec: preset.clockSkew?.future,\n clock_skew_past_expiry_sec: preset.clockSkew?.pastExpiry,\n label: preset.label,\n nonce_mode: PRESET_NONCE_MODE,\n nonce_consume: PRESET_NONCE_CONSUME[name],\n };\n}\n","/**\n * AUTO-GENERATED — DO NOT EDIT.\n *\n * Source: src/erc8128/erc8128.f3-1.json (byte-identical copy of\n * execution-market/shared/test-vectors/erc8128.json)\n * src/erc8128/erc8128.f3-3.json (additive, derived by\n * scripts/derive-erc8128-f3-3.mjs)\n * Regenerate: npm run vectors:gen\n * Verify: npm run vectors:check (fails when this file is stale)\n *\n * The JSON is embedded verbatim so the hashes below cover the exact bytes the\n * package ships, in both the CJS and the ESM chunk.\n */\n\n/* eslint-disable */\n\n/** Raw F3-1 vector document (LF-normalised). */\nexport const F3_1_VECTORS_JSON: string = \"{\\n \\\"_note\\\": [\\n \\\"F3-1 golden vectors: the PINNED ERC-8128 wire format plus the two\\\",\\n \\\"legacy variants the verifier stays tolerant of. Single source for the\\\",\\n \\\"conformance suites: mcp_server (pytest, tests/test_erc8128_conformance.py),\\\",\\n \\\"em-plugin-sdk (tests/test_erc8128.py), sdk/python (tests/test_signer.py),\\\",\\n \\\"sdk/typescript (src/__tests__/erc8128.conformance.test.ts) and\\\",\\n \\\"ows-mcp-server (src/erc8128-base.test.ts) — the TS runtimes joined in F3-2.\\\",\\n \\\"Signatures are deterministic (RFC 6979): the same key + signature base\\\",\\n \\\"produces the same 65 bytes in eth_account and ethers, so every\\\",\\n \\\"implementation of a given variant must reproduce these headers exactly.\\\",\\n \\\"private_key is stored WITHOUT the 0x prefix (the pre-commit secret\\\",\\n \\\"scanner blocks any literal 0x + 64 hex chars); loaders re-prefix it.\\\",\\n \\\"It is a synthetic test key (0x42 * 32) that never held funds.\\\"\\n ],\\n \\\"policy\\\": {\\n \\\"pinned_wire_format\\\": {\\n \\\"decided\\\": \\\"2026-08-01 (F3-1)\\\",\\n \\\"alg\\\": \\\"eip191\\\",\\n \\\"alg_required\\\": true,\\n \\\"keyid_lowercase\\\": true,\\n \\\"keyid_format\\\": \\\"erc8128:{chain_id}:{address_lowercase}\\\",\\n \\\"label\\\": \\\"eth\\\",\\n \\\"signature_params_order\\\": [\\n \\\"created\\\",\\n \\\"expires\\\",\\n \\\"nonce\\\",\\n \\\"keyid\\\",\\n \\\"alg\\\"\\n ],\\n \\\"covered_components_order\\\": [\\n \\\"@method\\\",\\n \\\"@authority\\\",\\n \\\"@path\\\",\\n \\\"@query (only when the URL has a query string)\\\",\\n \\\"content-digest (only when the request has a body)\\\"\\n ],\\n \\\"signature_encoding\\\": \\\"base64(r||s||v, 65 bytes) wrapped in RFC 8941 byte sequence\\\",\\n \\\"content_digest\\\": \\\"sha-256 (RFC 9530)\\\",\\n \\\"signing\\\": \\\"EIP-191 personal_sign over the RFC 9421 signature base\\\",\\n \\\"rationale\\\": [\\n \\\"alg=eip191 + lowercase keyid is what the canonical skill\\\",\\n \\\"(dashboard/public/skill.md v10.0.0 EM8128Client) documents and what\\\",\\n \\\"the external fleet already emits \\\\u2014 the copies we cannot migrate by\\\",\\n \\\"PR. F3-2 converged the 5 client copies to canonical; the backend\\\",\\n \\\"reference signer (server-side test helper) still emits\\\",\\n \\\"legacy_no_alg \\\\u2014 see the implementations map.\\\",\\n \\\"Lowercase keyid is mandatory: the checksummed-keyid drift caused\\\",\\n \\\"the v9.x silent-auth-failure INC (sdk/python/_signer.py:210-213).\\\"\\n ]\\n },\\n \\\"verifier_tolerance\\\": {\\n \\\"accepts_missing_alg\\\": true,\\n \\\"accepts_checksummed_keyid\\\": true,\\n \\\"note\\\": [\\n \\\"The backend verifier deliberately stays tolerant of both legacy\\\",\\n \\\"variants (it rebuilds the byte-exact base the client signed and\\\",\\n \\\"lowercases both sides of the address comparison). Do NOT harden\\\",\\n \\\"acceptance until every emitter passes the canonical vector; a\\\",\\n \\\"hardening is a contract change: update these vectors, the\\\",\\n \\\"conformance suite, and bump skill.md.\\\"\\n ]\\n }\\n },\\n \\\"frozen\\\": {\\n \\\"private_key\\\": \\\"4242424242424242424242424242424242424242424242424242424242424242\\\",\\n \\\"address\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"address_checksummed\\\": \\\"0x17c5185167401eD00cF5F5b2fc97D9BBfDb7D025\\\",\\n \\\"chain_id\\\": 8453,\\n \\\"created\\\": 1754006400,\\n \\\"expires\\\": 1754006700,\\n \\\"nonce\\\": \\\"f3-1-conformance-nonce-0001\\\"\\n },\\n \\\"requests\\\": {\\n \\\"get_query\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"https://api.execution.market/api/v1/tasks?status=published&limit=5\\\",\\n \\\"body\\\": null\\n },\\n \\\"post_body\\\": {\\n \\\"method\\\": \\\"POST\\\",\\n \\\"url\\\": \\\"https://api.execution.market/api/v1/tasks\\\",\\n \\\"body\\\": \\\"{\\\\\\\"title\\\\\\\":\\\\\\\"F3-1 conformance\\\\\\\",\\\\\\\"bounty_usd\\\\\\\":0.1}\\\"\\n }\\n },\\n \\\"vectors\\\": {\\n \\\"canonical\\\": {\\n \\\"get_query\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@query\\\\\\\": ?status=published&limit=5\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:0v4mJbn6JjlDOq3AyO16MhXlhoOkI4uxnd9tJitVBqkN20kNglL07U2HznZcdmUjS+QZqSCP4rLqWIE3SgsJUxs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"post_body\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": POST\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"content-digest\\\\\\\": sha-256=:yitNmn9roYfKVZJpvmRDFucegbyS2nDuvVoE4zuzu7g=:\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:+AIbVIIbugueMUZU1L7Nn5NAulvb0L4I0o7KMig1Dv12qHR7pX9OfotNig8mHnM5MByu9ZGXVGj/wYC8pbs52xw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"Content-Digest\\\": \\\"sha-256=:yitNmn9roYfKVZJpvmRDFucegbyS2nDuvVoE4zuzu7g=:\\\"\\n }\\n }\\n },\\n \\\"legacy_no_alg\\\": {\\n \\\"get_query\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@query\\\\\\\": ?status=published&limit=5\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:hcrt/D26EPTizJGHeR0dvscl9atj7vnd+ixZbR3bpJFDGefTECAEgkLatLMI/NuNtV7siMxjkzrxnx9ww6biqBs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"post_body\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": POST\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"content-digest\\\\\\\": sha-256=:yitNmn9roYfKVZJpvmRDFucegbyS2nDuvVoE4zuzu7g=:\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:RK5sZyChzoBccdqogrTT/HINSc7XCJUTqaKUR+eEptx5FhHCe2C8jbRYhpCs1N/zgnwsD1urZN5m60qX48h6kxw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"Content-Digest\\\": \\\"sha-256=:yitNmn9roYfKVZJpvmRDFucegbyS2nDuvVoE4zuzu7g=:\\\"\\n }\\n }\\n },\\n \\\"legacy_alg_checksum_keyid\\\": {\\n \\\"get_query\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@query\\\\\\\": ?status=published&limit=5\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401eD00cF5F5b2fc97D9BBfDb7D025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:gNNfGRgF5+W2MYZymiEMTSgX1o0hlwVENdprnldY6qlgDEcdqOeimoj835V40avsmKK2jjvPPzXP9sobPwCO2Bw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401eD00cF5F5b2fc97D9BBfDb7D025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"post_body\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": POST\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"content-digest\\\\\\\": sha-256=:yitNmn9roYfKVZJpvmRDFucegbyS2nDuvVoE4zuzu7g=:\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401eD00cF5F5b2fc97D9BBfDb7D025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:o/VaEKYjPrafAKLaeMQT7clsTQ3I2WaySRQuYinxv24fCUHKLCimmQsXb/XsRyP+CGhMScrUwKtKs7kUQcf80hw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401eD00cF5F5b2fc97D9BBfDb7D025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"Content-Digest\\\": \\\"sha-256=:yitNmn9roYfKVZJpvmRDFucegbyS2nDuvVoE4zuzu7g=:\\\"\\n }\\n }\\n }\\n },\\n \\\"implementations\\\": {\\n \\\"mcp_server/integrations/erc8128/signer.py\\\": \\\"legacy_no_alg\\\",\\n \\\"em-plugin-sdk/em_plugin_sdk/erc8128.py\\\": \\\"canonical\\\",\\n \\\"sdk/typescript/src/erc8128.ts\\\": \\\"canonical\\\",\\n \\\"sdk/python/execution_market/_signer.py\\\": \\\"canonical\\\",\\n \\\"ows-mcp-server/src/server.ts\\\": \\\"canonical\\\",\\n \\\"scripts/em_monitor.py\\\": \\\"canonical\\\"\\n }\\n}\\n\";\n\n/** Raw F3-3 vector document (LF-normalised). */\nexport const F3_3_VECTORS_JSON: string = \"{\\n \\\"_note\\\": [\\n \\\"F3-3 ADDITIVE conformance vectors for ERC-8128. F3-1 stays the pinned\\\",\\n \\\"wire format; this file only adds cases F3-1 has no vector for — a\\\",\\n \\\"bodyless POST, a bodyless DELETE, a POST with an empty-string body, a\\\",\\n \\\"query-less GET and a non-ASCII path that pins the EIP-191 UTF-8 BYTE\\\",\\n \\\"length — plus their legacy_no_alg twins, the policy presets as data,\\\",\\n \\\"and the verify matrix that turns accept/reject into data instead of two\\\",\\n \\\"hand-written suites.\\\",\\n \\\"THIS FILE IS ONE ARTEFACT. It must stay BYTE-IDENTICAL in uvd-x402-sdk\\\",\\n \\\"(npm) src/erc8128/, uvd-x402-sdk (PyPI) src/uvd_x402_sdk/erc8128/ and\\\",\\n \\\"execution-market shared/test-vectors/. It is stored LF and read as\\\",\\n \\\"BYTES; every repo pins it to LF in .gitattributes so a Windows checkout\\\",\\n \\\"cannot change its hash. Never hand-edit a copy: run\\\",\\n \\\"`npm run vectors:gen` in the TypeScript SDK and commit all three.\\\",\\n \\\"Generated by scripts/derive-erc8128-f3-3.mjs with the SAME synthetic\\\",\\n \\\"public test key already published in erc8128.f3-1.json (frozen.\\\",\\n \\\"private_key — a key that never held funds). It is NOT duplicated here;\\\",\\n \\\"both SDKs read it from F3-1. Signatures are deterministic (RFC 6979),\\\",\\n \\\"so the derivation is reproducible.\\\",\\n \\\"Four of these signatures (canonical/get_noquery, canonical/post_nobody,\\\",\\n \\\"canonical/delete_nobody, canonical/post_emptybody) are pinned\\\",\\n \\\"independently as V1/V4/V5/V7 in the design spec and asserted as literal\\\",\\n \\\"strings in src/erc8128/conformance.test.ts.\\\",\\n \\\"The authority_* requests and the verify_cases that carry their own\\\",\\n \\\"`authority` exist because NOTHING ELSE HERE COULD SEE THE AUTHORITY\\\",\\n \\\"RULE: every other pinned URL is lowercase with no explicit port, so the\\\",\\n \\\"per-scheme rule and the scheme-blind one produce the same bytes for all\\\",\\n \\\"of them. Reverting either SDK to the scheme-blind rule left the whole\\\",\\n \\\"cross-language run green. A guard that cannot fail is not a guard.\\\",\\n \\\"Two of these vectors carry a control character or a U+00A0 NBSP inside a\\\",\\n \\\"CONFIGURED authority; they are written as \\\\\\\\uXXXX escapes so the bytes\\\",\\n \\\"are visible in an editor and survive a copy-paste between the three\\\",\\n \\\"repos.\\\"\\n ],\\n \\\"generation\\\": \\\"F3-3\\\",\\n \\\"extends\\\": \\\"F3-1\\\",\\n \\\"frozen\\\": {\\n \\\"address\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"address_checksummed\\\": \\\"0x17c5185167401eD00cF5F5b2fc97D9BBfDb7D025\\\",\\n \\\"chain_id\\\": 8453,\\n \\\"created\\\": 1754006400,\\n \\\"expires\\\": 1754006700,\\n \\\"nonce\\\": \\\"f3-1-conformance-nonce-0001\\\",\\n \\\"authority\\\": \\\"api.execution.market\\\",\\n \\\"label\\\": \\\"eth\\\"\\n },\\n \\\"policy\\\": {\\n \\\"authority\\\": {\\n \\\"decided\\\": \\\"2026-08-06 (owner, R1/R2/R3)\\\",\\n \\\"url_rule\\\": \\\"rfc9421-2.2.3, default port of THAT scheme only\\\",\\n \\\"configured_rule\\\": \\\"lowercase + trim, ports NEVER touched\\\",\\n \\\"shapes\\\": [\\n {\\n \\\"deployment\\\": \\\"https on :443\\\",\\n \\\"url_authority\\\": \\\"host:443\\\",\\n \\\"signs\\\": \\\"host\\\",\\n \\\"configure\\\": \\\"host\\\"\\n },\\n {\\n \\\"deployment\\\": \\\"http on :80\\\",\\n \\\"url_authority\\\": \\\"host:80\\\",\\n \\\"signs\\\": \\\"host\\\",\\n \\\"configure\\\": \\\"host\\\"\\n },\\n {\\n \\\"deployment\\\": \\\"https on :8443\\\",\\n \\\"url_authority\\\": \\\"host:8443\\\",\\n \\\"signs\\\": \\\"host:8443\\\",\\n \\\"configure\\\": \\\"host:8443\\\"\\n },\\n {\\n \\\"deployment\\\": \\\"https on :80\\\",\\n \\\"url_authority\\\": \\\"host:80\\\",\\n \\\"signs\\\": \\\"host:80\\\",\\n \\\"configure\\\": null\\n },\\n {\\n \\\"deployment\\\": \\\"http on :443\\\",\\n \\\"url_authority\\\": \\\"host:443\\\",\\n \\\"signs\\\": \\\"host:443\\\",\\n \\\"configure\\\": null\\n }\\n ],\\n \\\"note\\\": [\\n \\\"A CONFIGURED authority is the EXPECTED OUTPUT of the URL rule, not\\\",\\n \\\"another input to it: it carries no scheme, so \\\\\\\"the default port\\\\\\\"\\\",\\n \\\"has no answer for it and every guess breaks a real deployment.\\\",\\n \\\"Hence `configure: null` on the last two rows — they sign a default\\\",\\n \\\"port, and a config carrying one is answered 503 authority_invalid\\\",\\n \\\"with a message naming the fix. 503 and not 401: the operator made\\\",\\n \\\"the mistake, and a client cannot see, let alone fix, it.\\\"\\n ]\\n },\\n \\\"content_digest\\\": {\\n \\\"decided\\\": \\\"2026-08-03 (owner, spec §10 Q1)\\\",\\n \\\"rule\\\": \\\"body-present\\\",\\n \\\"note\\\": [\\n \\\"Execution Market's body-presence rule is canonical for the SDK: a\\\",\\n \\\"Content-Digest is REQUIRED, and MUST be in the signed component\\\",\\n \\\"list, if and only if the request carries a body. A bodyless request\\\",\\n \\\"may cover it voluntarily, in which case it is still verified.\\\",\\n \\\"MeshRelay keeps its method-driven rule via the\\\",\\n \\\"'non-idempotent-methods' knob, so adopting the SDK changes none of\\\",\\n \\\"its behaviour.\\\"\\n ]\\n }\\n },\\n \\\"requests\\\": {\\n \\\"get_noquery\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"https://api.execution.market/api/v1/tasks\\\",\\n \\\"body\\\": null\\n },\\n \\\"post_nobody\\\": {\\n \\\"method\\\": \\\"POST\\\",\\n \\\"url\\\": \\\"https://api.execution.market/api/v1/tasks/abc/cancel\\\",\\n \\\"body\\\": null\\n },\\n \\\"delete_nobody\\\": {\\n \\\"method\\\": \\\"DELETE\\\",\\n \\\"url\\\": \\\"https://api.execution.market/api/v1/tasks/abc\\\",\\n \\\"body\\\": null\\n },\\n \\\"post_emptybody\\\": {\\n \\\"method\\\": \\\"POST\\\",\\n \\\"url\\\": \\\"https://api.execution.market/api/v1/tasks/abc/cancel\\\",\\n \\\"body\\\": \\\"\\\"\\n },\\n \\\"utf8_path\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"https://api.execution.market/api/v1/tareas/ñandú?buscar=café\\\",\\n \\\"body\\\": null\\n },\\n \\\"authority_uppercase_host\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"https://API.EXECUTION.MARKET/api/v1/tasks\\\",\\n \\\"body\\\": null\\n },\\n \\\"authority_https_on_443\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"https://api.execution.market:443/api/v1/tasks\\\",\\n \\\"body\\\": null\\n },\\n \\\"authority_http_on_80\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"http://api.execution.market:80/api/v1/tasks\\\",\\n \\\"body\\\": null\\n },\\n \\\"authority_https_on_8443\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"https://api.execution.market:8443/api/v1/tasks\\\",\\n \\\"body\\\": null\\n },\\n \\\"authority_http_on_443\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"http://api.execution.market:443/api/v1/tasks\\\",\\n \\\"body\\\": null\\n },\\n \\\"authority_https_on_80\\\": {\\n \\\"method\\\": \\\"GET\\\",\\n \\\"url\\\": \\\"https://api.execution.market:80/api/v1/tasks\\\",\\n \\\"body\\\": null\\n }\\n },\\n \\\"vectors\\\": {\\n \\\"canonical\\\": {\\n \\\"get_noquery\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:1GRZMnGfUfo23Y9qNIYdsqQz2Q9Mvp3hvIgj+1AapXhKrnYi9zNG9Ilks2n9/rtzTiozLSB4yQs+vrx6TWmOyhw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"post_nobody\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": POST\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks/abc/cancel\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:VueO6hM652wp8ZRtTyI49lrnQtDtqsCJ3qbMdGRIXdwuiCnBl/T7oHefcmvcP88MpXi3s+Lj723PNMzED9uJXhw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"delete_nobody\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": DELETE\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks/abc\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:SlH4Ev68FarWf/JZ282/jF5LhE72AQKmrc+WTOph5UtoNqMx/D0AQxzYWks3jhURBZt3rjSHhL9x3r7k+HhP7Rs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"post_emptybody\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": POST\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks/abc/cancel\\\\n\\\\\\\"content-digest\\\\\\\": sha-256=:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=:\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:2ODpBTt4ci8Tg03GPmLSLxf4nK3Htt0GfXs2hgVN/elABjQAYbFQR9WqVuGJ+BNDQEPUTHgIWiIj6PGfRSe4nRs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"Content-Digest\\\": \\\"sha-256=:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=:\\\"\\n }\\n },\\n \\\"utf8_path\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tareas/ñandú\\\\n\\\\\\\"@query\\\\\\\": ?buscar=café\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:abKEk17W7q6SoK2qmsXpD7GTws4fuQDTTRgSKdJ2u0J88Ln8EVaeNg52yHnPxjzUtvPKXqOiyuDn/bbcCNvcRRs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_uppercase_host\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:1GRZMnGfUfo23Y9qNIYdsqQz2Q9Mvp3hvIgj+1AapXhKrnYi9zNG9Ilks2n9/rtzTiozLSB4yQs+vrx6TWmOyhw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_https_on_443\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:1GRZMnGfUfo23Y9qNIYdsqQz2Q9Mvp3hvIgj+1AapXhKrnYi9zNG9Ilks2n9/rtzTiozLSB4yQs+vrx6TWmOyhw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_http_on_80\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:1GRZMnGfUfo23Y9qNIYdsqQz2Q9Mvp3hvIgj+1AapXhKrnYi9zNG9Ilks2n9/rtzTiozLSB4yQs+vrx6TWmOyhw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_https_on_8443\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market:8443\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:g+MrSDxYDud9kHNY5zs7qzdlsJgK49FVvNIEms1yld1KXH4LHytQsWBXXabZzOrMRphNvGz9LHlUGnco83I9/Bs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_http_on_443\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market:443\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:L35ltzQT+ufKF/UUQp1SVSw3tVSSgJzBM2CJ6vGt4TMr7HVW4C7s1f6keoQCGJFUgIjpGA8G3pr7XNQeneOF1xw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_https_on_80\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market:80\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:7To493TypQD2yvflxc+lOtE8QATFZPNidC0DHazVXxovc6a41lbqebFQLY9VYJsAcKIXow97QhKSsEEq/iORnRw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\";alg=\\\\\\\"eip191\\\\\\\"\\\"\\n }\\n }\\n },\\n \\\"legacy_no_alg\\\": {\\n \\\"get_noquery\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:TjGV6W0YvVwoZ9lIRJ37edgp7QOkJ2fdgwK54DpjZV8hLhdJ8EtLTHkmwdErzMrFLZf25ojaI1/Ve4Avp4imlBs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"post_nobody\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": POST\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks/abc/cancel\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:oxixnLWX5wkQNxRdYPcmG+MiHOic2g8gMw8Bm6XpTt1Gae+5m61Os0JMWsb/RaZ0mNMuyEmRlt2G7YBqYWVvURs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"delete_nobody\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": DELETE\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks/abc\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:DM6OgtBKTYW0hJNRspUkFs7HgJLqchvjbf9yszz1hPh+oUNRTXEs6JY5Pu1dX1dpa2UEjoXp1e/9V5d7aCxXdRs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"post_emptybody\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": POST\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks/abc/cancel\\\\n\\\\\\\"content-digest\\\\\\\": sha-256=:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=:\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:1gckyAsWy4DB4tQyQ1L/y5nmllrcxylQ+83UwQiM00oZjYld2JeoP7TUFr+8nUrRCPJ/XWAj/IPgYyfNZoQL7xs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"content-digest\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"Content-Digest\\\": \\\"sha-256=:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=:\\\"\\n }\\n },\\n \\\"utf8_path\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tareas/ñandú\\\\n\\\\\\\"@query\\\\\\\": ?buscar=café\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:0kp6yoU/4T0q3DtA1agJSutzkJV11nqWRU3BWj2psn1YAzTSFrpOuOhit4nO7LYVIXd4vfNRBw4xntqcf+0k0hw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\" \\\\\\\"@query\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_uppercase_host\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:TjGV6W0YvVwoZ9lIRJ37edgp7QOkJ2fdgwK54DpjZV8hLhdJ8EtLTHkmwdErzMrFLZf25ojaI1/Ve4Avp4imlBs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_https_on_443\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:TjGV6W0YvVwoZ9lIRJ37edgp7QOkJ2fdgwK54DpjZV8hLhdJ8EtLTHkmwdErzMrFLZf25ojaI1/Ve4Avp4imlBs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_http_on_80\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:TjGV6W0YvVwoZ9lIRJ37edgp7QOkJ2fdgwK54DpjZV8hLhdJ8EtLTHkmwdErzMrFLZf25ojaI1/Ve4Avp4imlBs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_https_on_8443\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market:8443\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:YPCUotlu74EOXayMzMmnImSiDHV9EynGmjwduvV3X558l4AIsZvEH1G8FkyHhpJUgztlZlIqNle/SI1YAZCXNxw=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_http_on_443\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market:443\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:pD3X7KQbCpw4BjxK19iCqBFaVAJ7BfYHMoTNDJAO/IoeGSdsaWR2kk/uNJSOgho5cWwdDGogar8HAik52T/YPhs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n },\\n \\\"authority_https_on_80\\\": {\\n \\\"signature_base\\\": \\\"\\\\\\\"@method\\\\\\\": GET\\\\n\\\\\\\"@authority\\\\\\\": api.execution.market:80\\\\n\\\\\\\"@path\\\\\\\": /api/v1/tasks\\\\n\\\\\\\"@signature-params\\\\\\\": (\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\",\\n \\\"headers\\\": {\\n \\\"Signature\\\": \\\"eth=:PgnuQ8H+Ty/bBRkuJYqHS3H3ctafk66R4HrsuSJacHRX2JX1Ed2y9LkIhF0ot71G6P3IqA5NHbgUASLmcdfoGhs=:\\\",\\n \\\"Signature-Input\\\": \\\"eth=(\\\\\\\"@method\\\\\\\" \\\\\\\"@authority\\\\\\\" \\\\\\\"@path\\\\\\\");created=1754006400;expires=1754006700;nonce=\\\\\\\"f3-1-conformance-nonce-0001\\\\\\\";keyid=\\\\\\\"erc8128:8453:0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\\\\\"\\\"\\n }\\n }\\n }\\n },\\n \\\"policies\\\": {\\n \\\"meshrelay-strict\\\": {\\n \\\"accept\\\": \\\"accept-both\\\",\\n \\\"components\\\": \\\"exact-ordered\\\",\\n \\\"content_digest\\\": \\\"non-idempotent-methods\\\",\\n \\\"allowed_chain_ids\\\": [\\n 8453\\n ],\\n \\\"max_validity_sec\\\": 300,\\n \\\"clock_skew_future_sec\\\": 30,\\n \\\"clock_skew_past_expiry_sec\\\": 0,\\n \\\"label\\\": \\\"eth\\\",\\n \\\"nonce_mode\\\": \\\"required\\\",\\n \\\"nonce_consume\\\": \\\"after-verify\\\"\\n },\\n \\\"em-lenient\\\": {\\n \\\"accept\\\": \\\"accept-both\\\",\\n \\\"components\\\": \\\"request-bound-subset\\\",\\n \\\"content_digest\\\": \\\"body-present\\\",\\n \\\"allowed_chain_ids\\\": null,\\n \\\"max_validity_sec\\\": 300,\\n \\\"clock_skew_future_sec\\\": 30,\\n \\\"clock_skew_past_expiry_sec\\\": 30,\\n \\\"label\\\": \\\"any\\\",\\n \\\"nonce_mode\\\": \\\"required\\\",\\n \\\"nonce_consume\\\": \\\"before-verify\\\"\\n },\\n \\\"canonical-strict\\\": {\\n \\\"accept\\\": \\\"canonical\\\",\\n \\\"components\\\": \\\"exact-ordered\\\",\\n \\\"content_digest\\\": \\\"body-present\\\",\\n \\\"allowed_chain_ids\\\": [\\n 8453\\n ],\\n \\\"max_validity_sec\\\": 300,\\n \\\"clock_skew_future_sec\\\": 30,\\n \\\"clock_skew_past_expiry_sec\\\": 0,\\n \\\"label\\\": \\\"eth\\\",\\n \\\"nonce_mode\\\": \\\"required\\\",\\n \\\"nonce_consume\\\": \\\"after-verify\\\"\\n }\\n },\\n \\\"verify_cases\\\": [\\n {\\n \\\"vector_id\\\": \\\"canonical/get_query\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_query\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_query\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_body\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_body\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_body\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_emptybody\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_emptybody\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_emptybody\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/utf8_path\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/utf8_path\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/utf8_path\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_nobody\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"content_digest_required\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_nobody\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/post_nobody\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/delete_nobody\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"content_digest_required\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/delete_nobody\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/delete_nobody\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/get_query\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/get_query\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/get_query\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"alg_missing\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_body\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_body\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_body\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"alg_missing\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/get_noquery\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/get_noquery\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"alg_missing\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_emptybody\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_emptybody\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_emptybody\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"alg_missing\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/utf8_path\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/utf8_path\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/utf8_path\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"alg_missing\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_nobody\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"content_digest_required\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_nobody\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/post_nobody\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"alg_missing\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/delete_nobody\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"content_digest_required\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/delete_nobody\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_no_alg/delete_nobody\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"alg_missing\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_no_alg\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_alg_checksum_keyid/get_query\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_alg_checksum_keyid\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_alg_checksum_keyid/get_query\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_alg_checksum_keyid\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_alg_checksum_keyid/get_query\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"keyid_not_lowercase\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_alg_checksum_keyid\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_alg_checksum_keyid/post_body\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_alg_checksum_keyid\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_alg_checksum_keyid/post_body\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"legacy_alg_checksum_keyid\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"legacy_alg_checksum_keyid/post_body\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"keyid_not_lowercase\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"legacy_alg_checksum_keyid\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_uppercase_host\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_uppercase_host\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_uppercase_host\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_443\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_443\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_443\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_http_on_80\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_http_on_80\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_http_on_80\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_8443\\\",\\n \\\"policy\\\": \\\"meshrelay-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\",\\n \\\"authority\\\": \\\"api.execution.market:8443\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_8443\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\",\\n \\\"authority\\\": \\\"api.execution.market:8443\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_8443\\\",\\n \\\"policy\\\": \\\"canonical-strict\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\",\\n \\\"authority\\\": \\\"api.execution.market:8443\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_8443\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"wallet_mismatch\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"canonical\\\",\\n \\\"authority\\\": \\\"api.execution.market\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_http_on_443\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"wallet_mismatch\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"canonical\\\",\\n \\\"authority\\\": \\\"api.execution.market\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_80\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"wallet_mismatch\\\",\\n \\\"status\\\": 401,\\n \\\"observed_profile\\\": \\\"canonical\\\",\\n \\\"authority\\\": \\\"api.execution.market\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_http_on_443\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"authority_invalid\\\",\\n \\\"status\\\": 503,\\n \\\"observed_profile\\\": null,\\n \\\"authority\\\": \\\"api.execution.market:443\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/authority_https_on_80\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"authority_invalid\\\",\\n \\\"status\\\": 503,\\n \\\"observed_profile\\\": null,\\n \\\"authority\\\": \\\"api.execution.market:80\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\",\\n \\\"authority\\\": \\\"API.Execution.Market\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"accept\\\",\\n \\\"wallet\\\": \\\"0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025\\\",\\n \\\"observed_profile\\\": \\\"canonical\\\",\\n \\\"authority\\\": \\\" api.execution.market\\\\t\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"authority_invalid\\\",\\n \\\"status\\\": 503,\\n \\\"observed_profile\\\": null,\\n \\\"authority\\\": \\\"api.execution\\\\nmarket\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"authority_invalid\\\",\\n \\\"status\\\": 503,\\n \\\"observed_profile\\\": null,\\n \\\"authority\\\": \\\"api.execution\\\\rmarket\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"authority_invalid\\\",\\n \\\"status\\\": 503,\\n \\\"observed_profile\\\": null,\\n \\\"authority\\\": \\\"api.execution\\\\u000bmarket\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"authority_invalid\\\",\\n \\\"status\\\": 503,\\n \\\"observed_profile\\\": null,\\n \\\"authority\\\": \\\"api.execution\\\\fmarket\\\"\\n },\\n {\\n \\\"vector_id\\\": \\\"canonical/get_noquery\\\",\\n \\\"policy\\\": \\\"em-lenient\\\",\\n \\\"expect\\\": \\\"reject\\\",\\n \\\"code\\\": \\\"authority_invalid\\\",\\n \\\"status\\\": 503,\\n \\\"observed_profile\\\": null,\\n \\\"authority\\\": \\\"api.execution\\\\u00a0market\\\"\\n }\\n ]\\n}\\n\";\n\n/**\n * sha256 of the embedded documents. Pinned; both SDKs must report the same map,\n * KEY FOR KEY. The keys are the generation ids as spelled everywhere else —\n * the file names (`erc8128.f3-1.json`), Python's `_RESOURCES`, the documents'\n * own `generation` field. A JS-flavoured `f3_1` here made the spec's\n * cross-language hash-equality check impossible to pass as written.\n */\nexport const CONFORMANCE_SHA256 = {\n 'f3-1': '3c82d81f66cc95c452dbb2892c4aee97c688dc5fe03b721d06c92ba98e4f9bfd',\n 'f3-3': '154ef31dc3e704c376e282ca5ca5dccde00877328cbab250001dbb20ba2e91ac',\n} as const;\n","/**\n * uvd-x402-sdk/erc8128 — the conformance vectors, shipped INSIDE the package.\n *\n * They travel as an inlined string (see `vectors.generated.ts`) rather than a\n * file read, because the package is dual CJS+ESM: `__dirname` does not exist\n * in the `.mjs` chunk and `import.meta.url` is a syntax error in the `.js`\n * one. Build-time inlining is the only form that works in both, and it is the\n * only way a consumer's CI can run `runConformance()` against the SDK version\n * it actually installed.\n *\n * `CONFORMANCE_SHA256` covers the embedded bytes, so hand-editing either copy\n * fails the suite before a single signature is produced.\n */\n\nimport {\n CONFORMANCE_SHA256,\n F3_1_VECTORS_JSON,\n F3_3_VECTORS_JSON,\n} from './vectors.generated';\n\nexport interface Erc8128VectorCase {\n signature_base: string;\n headers: {\n Signature: string;\n 'Signature-Input': string;\n 'Content-Digest'?: string;\n };\n}\n\nexport interface Erc8128RequestSpec {\n method: string;\n url: string;\n /** `null` = no body at all; `\"\"` = a zero-byte body (they differ on the wire). */\n body: string | null;\n}\n\nexport interface Erc8128VerifyCase {\n /** `<family>/<request>`, resolved against F3-3 first, then F3-1. */\n vector_id: string;\n policy: string;\n expect: 'accept' | 'reject';\n code?: string;\n /** Pinned on every reject row: the authority rule turns on 401-vs-503. */\n status?: number;\n wallet?: string;\n /** `null` when the request is refused before `Signature-Input` is parsed. */\n observed_profile?: string | null;\n /**\n * The value CONFIGURED into `VerifyPolicy.authority`. Omitted ⇒\n * `frozen.authority`.\n *\n * It is a per-case field because the configured authority is NOT derivable\n * from the request — that is the whole content of the rule. A runner that\n * derived it from the URL and a runner that read it from `frozen` were\n * testing two different things off one file.\n */\n authority?: string;\n}\n\nexport interface Erc8128Frozen {\n /** Synthetic public test key, stored WITHOUT the `0x` prefix. F3-1 only. */\n private_key?: string;\n address: string;\n address_checksummed: string;\n chain_id: number;\n created: number;\n expires: number;\n nonce: string;\n authority?: string;\n label?: string;\n}\n\nexport interface Erc8128Vectors {\n frozen: Erc8128Frozen;\n requests: Record<string, Erc8128RequestSpec>;\n vectors: Record<string, Record<string, Erc8128VectorCase>>;\n policies?: Record<string, Record<string, unknown>>;\n verify_cases?: Erc8128VerifyCase[];\n [key: string]: unknown;\n}\n\n/** F3-1: byte-identical copy of the fleet's source of truth. */\nexport const CONFORMANCE_VECTORS_F3_1: Erc8128Vectors = JSON.parse(\n F3_1_VECTORS_JSON\n) as Erc8128Vectors;\n\n/** F3-3: additive — bodyless POST/DELETE, empty-body POST, presets, matrix. */\nexport const CONFORMANCE_VECTORS_F3_3: Erc8128Vectors = JSON.parse(\n F3_3_VECTORS_JSON\n) as Erc8128Vectors;\n\nexport { CONFORMANCE_SHA256, F3_1_VECTORS_JSON, F3_3_VECTORS_JSON };\n","/**\n * uvd-x402-sdk/erc8128 — `runConformance()`.\n *\n * Public on purpose: it is the only mechanism by which a consumer's CI can\n * check the SDK build it ACTUALLY INSTALLED, rather than the source tree of\n * this repo. Wire it into MeshRelay's api tests, EM's mcp_server tests, the\n * KarmaKadabra bundle build and Sentinel's image build; fail the job when\n * `report.failed.length > 0`.\n *\n * Three sections — the SAME three the Python package runs, in the same order\n * and with the same count, so one green condition (`report.ok`) and one\n * `passed === total` mean the same thing in both languages:\n * - integrity — the shipped vector bytes hash to `CONFORMANCE_SHA256`, and\n * every policy preset still equals the `policies` block pinned in\n * those bytes. ALWAYS RUNS, even under `only`: a sign-only run\n * against a hand-edited artefact is not a pass. This section is\n * the one TypeScript was missing, which is why the two runners\n * reported 62 and 67 checks off one byte-identical file.\n * - sign — every emittable vector is re-signed and compared BYTE for byte\n * (signatures are deterministic, RFC 6979).\n * - verify — the `verify_cases` matrix: each (vector, policy) pair must\n * produce the pinned accept/reject verdict, error code, HTTP\n * status and observed profile, under the authority that case\n * CONFIGURES. Turning acceptance into DATA is what keeps the\n * TypeScript and Python verifiers from drifting apart.\n *\n * The key used is the synthetic public test key already published in the F3-1\n * fixture (documented there as a key that never held funds). It is read from\n * the vector document, never inlined.\n */\n\nimport { ethers } from 'ethers';\n\nimport { signRequest } from './signer';\nimport type { WireProfile } from './signer';\nimport { policyFromPreset, presetAsData } from './presets';\nimport type { PolicyPresetName } from './presets';\nimport { verifyRequest } from './verifier';\nimport type { VerifyPolicy } from './verifier';\nimport type { NonceContext, NonceOutcome, NonceStore } from './nonce';\nimport { WIRE_CONTRACT_VERSION } from './core';\nimport {\n CONFORMANCE_SHA256,\n CONFORMANCE_VECTORS_F3_1,\n CONFORMANCE_VECTORS_F3_3,\n F3_1_VECTORS_JSON,\n F3_3_VECTORS_JSON,\n} from './vectors';\nimport type { Erc8128RequestSpec, Erc8128VectorCase, Erc8128Vectors } from './vectors';\n\nexport interface ConformanceCaseResult {\n /** Mirrors Python's `failed[].section`. */\n id: string;\n kind: 'integrity' | 'policy' | 'sign' | 'verify';\n ok: boolean;\n detail?: string;\n}\n\nexport interface ConformanceReport {\n /**\n * THE green condition, spelled the same in both languages: `report.ok` in\n * TypeScript and `report.ok` in Python. `passed`, `total` and `failed` carry\n * the same names on both sides too, so `report.passed === report.total`\n * transliterates as well. Each side keeps its own extra fields (`cases`,\n * `sha256`, `wireContractVersion` here; `generations`,\n * `wire_contract_version` there).\n */\n ok: boolean;\n wireContractVersion: string;\n sha256: typeof CONFORMANCE_SHA256;\n total: number;\n passed: number;\n failed: ConformanceCaseResult[];\n cases: ConformanceCaseResult[];\n}\n\n/**\n * First-use-wins, in process. NOT exported: as a production default it would\n * give zero replay protection across tasks or restarts. It exists here only\n * so the matrix can exercise the nonce path deterministically.\n */\nclass ConformanceNonceStore implements NonceStore {\n private readonly seen = new Set<string>();\n\n consume(nonce: string, ctx: NonceContext): NonceOutcome {\n const key = `erc8128:${ctx.chainId}:${ctx.wallet}:${nonce}`;\n if (this.seen.has(key)) return 'replayed';\n this.seen.add(key);\n return 'ok';\n }\n}\n\nconst GENERATIONS: Array<{ name: string; doc: Erc8128Vectors }> = [\n { name: 'f3-1', doc: CONFORMANCE_VECTORS_F3_1 },\n { name: 'f3-3', doc: CONFORMANCE_VECTORS_F3_3 },\n];\n\n/** Families a signer can emit. A checksummed keyid is verify-only. */\nconst EMITTABLE: Record<string, WireProfile> = {\n canonical: 'canonical',\n legacy_no_alg: 'legacy-no-alg',\n};\n\n/**\n * The signing key for the `sign` section.\n *\n * This is 0x42 repeated 32 times — a synthetic constant, not a secret. It is\n * the same value the Python package and execution-market's shared vectors use,\n * and it has to stay identical in all three or the pinned signatures stop\n * being comparable, which is the entire point of a conformance vector.\n *\n * It is stored in the JSON without the `0x` prefix. That is worth knowing and\n * worth changing: the stated reason is that the pre-commit secret scanner\n * blocks `0x` + 64 hex, so the prefix was dropped to get past it. Hiding a\n * known-public constant FROM the scanner teaches the scanner nothing and makes\n * every future reader do the derivation to find out whether it is real. An\n * explicit allow-list entry for this one value would say the same thing out\n * loud.\n */\nfunction privateKey(): string {\n const raw = CONFORMANCE_VECTORS_F3_1.frozen.private_key;\n if (!raw) throw new Error('F3-1 vectors are missing frozen.private_key');\n return `0x${raw}`;\n}\n\n/** Resolve `<family>/<request>` across generations, newest first. */\nfunction resolveVector(\n vectorId: string\n): { vector: Erc8128VectorCase; request: Erc8128RequestSpec; doc: Erc8128Vectors } | undefined {\n const [family, name] = vectorId.split('/');\n for (const generation of [...GENERATIONS].reverse()) {\n const vector = generation.doc.vectors?.[family]?.[name];\n const request = generation.doc.requests?.[name];\n if (vector && request) return { vector, request, doc: generation.doc };\n }\n return undefined;\n}\n\n/** Key-order-insensitive structural equality, for comparing a preset object to\n * the JSON block that pins it. */\nfunction sameShape(a: unknown, b: unknown): boolean {\n const stable = (value: unknown): unknown => {\n if (Array.isArray(value)) return value.map(stable);\n if (value && typeof value === 'object') {\n return Object.fromEntries(\n Object.keys(value as Record<string, unknown>)\n .sort()\n .map((key) => [key, stable((value as Record<string, unknown>)[key])])\n );\n }\n return value;\n };\n return JSON.stringify(stable(a)) === JSON.stringify(stable(b));\n}\n\n/**\n * The section that has to run FIRST and has to run ALWAYS.\n *\n * A sign-only or verify-only pass against a hand-edited artefact is not a\n * pass, and the pinned presets are half of what the artefact pins: the\n * `policies` block is the only thing stopping a preset from being retuned in\n * one language and not the other. `sha256` is taken with ethers rather than\n * `node:crypto` because this module ships in the browser bundle too.\n */\nfunction runIntegrityCases(results: ConformanceCaseResult[]): void {\n const shipped: Array<[keyof typeof CONFORMANCE_SHA256, string]> = [\n ['f3-1', F3_1_VECTORS_JSON],\n ['f3-3', F3_3_VECTORS_JSON],\n ];\n for (const [generation, text] of shipped) {\n const actual = ethers.sha256(ethers.toUtf8Bytes(text)).slice(2);\n const expected = CONFORMANCE_SHA256[generation];\n results.push({\n id: `integrity:${generation}`,\n kind: 'integrity',\n ok: actual === expected,\n detail: actual === expected ? undefined : `sha256 ${actual} != ${expected}`,\n });\n }\n\n for (const [name, pinned] of Object.entries(CONFORMANCE_VECTORS_F3_3.policies ?? {})) {\n let actual: Record<string, unknown> | undefined;\n let detail: string | undefined;\n try {\n actual = presetAsData(name as PolicyPresetName);\n } catch (error) {\n detail = String(error);\n }\n const ok = actual !== undefined && sameShape(actual, pinned);\n results.push({\n id: `policy:${name}`,\n kind: 'policy',\n ok,\n detail: ok\n ? undefined\n : (detail ?? `runtime=${JSON.stringify(actual)} pinned=${JSON.stringify(pinned)}`),\n });\n }\n}\n\nasync function runSignCases(results: ConformanceCaseResult[]): Promise<void> {\n const key = privateKey();\n\n for (const generation of GENERATIONS) {\n const frozen = generation.doc.frozen;\n for (const [family, cases] of Object.entries(generation.doc.vectors ?? {})) {\n const profile = EMITTABLE[family];\n if (!profile) continue;\n\n for (const [name, vector] of Object.entries(cases)) {\n const id = `${generation.name}:sign:${family}/${name}`;\n const request = generation.doc.requests?.[name];\n if (!request) {\n results.push({ id, kind: 'sign', ok: false, detail: `no request spec for ${name}` });\n continue;\n }\n try {\n const headers = await signRequest({\n privateKey: key,\n method: request.method,\n url: request.url,\n body: request.body,\n nonce: frozen.nonce,\n chainId: frozen.chain_id,\n profile,\n now: () => frozen.created,\n });\n const mismatches: string[] = [];\n if (headers.Signature !== vector.headers.Signature) mismatches.push('Signature');\n if (headers['Signature-Input'] !== vector.headers['Signature-Input']) {\n mismatches.push('Signature-Input');\n }\n if ((headers['Content-Digest'] ?? undefined) !== vector.headers['Content-Digest']) {\n mismatches.push('Content-Digest');\n }\n results.push({\n id,\n kind: 'sign',\n ok: mismatches.length === 0,\n detail: mismatches.length ? `byte mismatch: ${mismatches.join(', ')}` : undefined,\n });\n } catch (error) {\n results.push({ id, kind: 'sign', ok: false, detail: String(error) });\n }\n }\n }\n }\n}\n\n/**\n * Build the request the way an HTTP server would present it: content-length is\n * set only when the fixture body is non-null, which is exactly how a zero-byte\n * body ends up classified as \"no body\" by the body-presence rule.\n */\nexport function verifiableRequestFromVector(\n vector: Erc8128VectorCase,\n request: Erc8128RequestSpec\n): { method: string; url: string; headers: Record<string, string>; rawBody?: Uint8Array } {\n const headers: Record<string, string> = {\n signature: vector.headers.Signature,\n 'signature-input': vector.headers['Signature-Input'],\n };\n if (vector.headers['Content-Digest']) {\n headers['content-digest'] = vector.headers['Content-Digest'];\n }\n\n let rawBody: Uint8Array | undefined;\n if (request.body !== null && request.body !== undefined) {\n rawBody = ethers.toUtf8Bytes(request.body);\n headers['content-length'] = String(rawBody.length);\n }\n\n return { method: request.method, url: request.url, headers, rawBody };\n}\n\n/**\n * The preset plus the two per-deployment values it deliberately omits. The\n * consume order is NOT re-decided here: it comes from the preset's own\n * `PRESET_NONCE_CONSUME` entry (EM before the crypto, MeshRelay after).\n */\nexport function conformancePolicy(\n name: PolicyPresetName,\n authority: string,\n now: number\n): VerifyPolicy {\n return policyFromPreset(name, {\n authority,\n nonceStore: new ConformanceNonceStore(),\n now: () => now,\n });\n}\n\nasync function runVerifyCases(results: ConformanceCaseResult[]): Promise<void> {\n const cases = CONFORMANCE_VECTORS_F3_3.verify_cases ?? [];\n const frozen = CONFORMANCE_VECTORS_F3_3.frozen;\n const defaultAuthority = frozen.authority ?? 'api.execution.market';\n\n for (const [index, testCase] of cases.entries()) {\n // The index disambiguates the rows that reuse one (vector, policy) pair\n // with a different CONFIGURED authority — the whole point of those rows.\n const id = `verify:${index}:${testCase.vector_id}:${testCase.policy}`;\n const resolved = resolveVector(testCase.vector_id);\n if (!resolved) {\n results.push({ id, kind: 'verify', ok: false, detail: 'vector not found' });\n continue;\n }\n\n const req = verifiableRequestFromVector(resolved.vector, resolved.request);\n const policy = conformancePolicy(\n testCase.policy as PolicyPresetName,\n // A case that names an authority is testing the CONFIGURED value; the\n // rest run against the one the fleet actually deploys.\n testCase.authority ?? defaultAuthority,\n frozen.created\n );\n\n try {\n const result = await verifyRequest(req, policy);\n const problems: string[] = [];\n // `observed_profile` is pinned on accept AND reject rows, `null`\n // included: what a verifier reports for a REJECTED signature is part of\n // the contract, and skipping the check on rejects is how the two suites\n // ended up pinning different things.\n const observed = result.observedProfile ?? null;\n if (observed !== (testCase.observed_profile ?? null)) {\n problems.push(`profile ${observed} != ${testCase.observed_profile ?? null}`);\n }\n\n if (testCase.expect === 'accept') {\n if (!result.ok) {\n results.push({ id, kind: 'verify', ok: false, detail: `rejected: ${result.code}` });\n continue;\n }\n if (testCase.wallet && result.wallet !== testCase.wallet) {\n problems.push(`wallet ${result.wallet} != ${testCase.wallet}`);\n }\n } else {\n if (result.ok) {\n results.push({ id, kind: 'verify', ok: false, detail: 'accepted, expected reject' });\n continue;\n }\n if (testCase.code && result.code !== testCase.code) {\n problems.push(`code ${result.code} != ${testCase.code}`);\n }\n // 401 blames the client, 503 blames the operator. A misconfigured\n // authority answering 401 is the failure this pin exists to catch.\n if (testCase.status !== undefined && result.status !== testCase.status) {\n problems.push(`status ${result.status} != ${testCase.status}`);\n }\n }\n\n results.push({\n id,\n kind: 'verify',\n ok: problems.length === 0,\n detail: problems.length ? problems.join('; ') : undefined,\n });\n } catch (error) {\n results.push({ id, kind: 'verify', ok: false, detail: String(error) });\n }\n }\n}\n\n/**\n * Run the shipped conformance suite against this build of the SDK.\n *\n * @param options.only - restrict to the `sign` or the `verify` section. The\n * integrity section always runs — same as Python's `run_conformance(only=…)`\n * — because \"the signer is byte-correct against an artefact I did not check\"\n * is not a statement anyone wants to act on.\n */\nexport async function runConformance(options?: {\n only?: 'sign' | 'verify';\n}): Promise<ConformanceReport> {\n const results: ConformanceCaseResult[] = [];\n\n runIntegrityCases(results);\n if (options?.only !== 'verify') await runSignCases(results);\n if (options?.only !== 'sign') await runVerifyCases(results);\n\n const failed = results.filter((r) => !r.ok);\n return {\n ok: failed.length === 0,\n wireContractVersion: WIRE_CONTRACT_VERSION,\n sha256: CONFORMANCE_SHA256,\n total: results.length,\n passed: results.length - failed.length,\n failed,\n cases: results,\n };\n}\n"]}