Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

@xochi/client

Latest version: v0.4.0

Overview

Last scanned
29 Nov 2026
Published
29 Nov 2026
npm package Publisher: droodotfoo
1 Stars
0 Forks
23 Versions
5.2K Downloads
TypeScript Repo language

Scan summary

@xochi/client was last scanned on 29 Nov 2026 at version 0.4.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 23 versions; the latest 5 were published within 4 days (26–29 Nov 2026).
  • Findings: No rules fired in version 0.4.0.
  • Downloads: 5,163 downloads.

Versions

23 versions published
Versions and the rules that fired in each
VersionPublishedStatus
0.4.0 LATEST 29 Nov 2026 No rules fired
0.3.1 29 Nov 2026 No rules fired
0.3.0 28 Nov 2026 No rules fired
0.2.1 27 Nov 2026 Not shown
0.2.1-staging.0 26 Nov 2026 Not shown

No rules fired in 0.4.0

Findings

Findings for v0.4.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 0.4.0; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

@xochi/client

Cross-chain swap client for the Xochi Worker API (https://api.xochi.fi/api/*): a transport, a pure trade state machine (update(model, msg) -> [model, effects], view(model)), the fund-safety checks it runs on every quote, and the layered fee reference.

Install

npm install @xochi/client

Node 22+ or a current browser. ESM + CommonJS with types.

Transport

import { createXochiClient } from "@xochi/client";

const xochi = createXochiClient({
  baseUrl: "https://api.xochi.fi",
  getAuthToken: () => session.token, // optional
  getAuthGeneration: () => session.generation, // optional in-memory credential epoch
  onAuthExpired: (e) => session.reauthenticate(e),
});

const quote = await xochi.getQuote(request);
  • execute makes one attempt and never retries. Never re-post a failed one: even a refused execute leaves its signed request executable until it expires, so poll getIntentStatus until the intent ends. The only resend is the machine's, on ApiError.notAccepted (Fund safety).
  • getIntentStatus returns the status, { notFound: true } on 404, or null on a transient failure.
Read token
  • An execute response may carry readToken, kept only for the intent the execute named. Pass { readToken } to getIntent / getIntentStatus, which send it as X-Xochi-Read-Token. Who reads which view with and without it: IntentReadOptions (SPEC.md §5.1).
  • A failed execute may carry one too: take it once with takeApiErrorReadToken(error), before the error reaches any reporter. It is never a property of the error.
  • It is a bearer secret: never log it or put it in a URL. It authorizes these two reads only, never a write, and holding it is not proof of the recipient.
  • To keep the full view across a reload, persist it next to the intent id as you would a session credential (same-origin storage, never a URL, a log or a replayable message; ResumeRequested carries none), and delete it once the intent is no longer shown. Not persisting it is safe.
  • A lost token (an execute that times out or aborts, a reset connection, an error body cut before its read_token) is never re-issued. Wallet SIWE for the intent's wallet is then the only way to the full view.
  • getIntent rejects a token not of the issued shape before any request; getIntentStatus reads anonymously instead and logs it once per intent.
  • A read without the full view is status-only: getIntentStatus carries legsWithheld: true and settlementConfirmed, and getIntent returns a WithheldIntentRecord. IntentState.legsWithheld is null before the first status reply, so test legsWithheld === true before offering recovery (the token for stealth, else wallet SIWE).
Origin and redirects
  • Every intent read and execute is pinned to the baseUrl origin. A refusal is a RedirectRefused: getIntent / getIntentHistory / execute reject with it; getIntentStatus logs it once per intent and returns null. Which redirects are followed: RedirectRefused.
  • A token read follows at most one same-origin plain redirect, and none in a browser. execute follows none, and its refusal is in doubt: point baseUrl at the origin that answers /api/intent/execute itself, or every swap reads "Still confirming".
  • An injected fetch MUST honour redirect: "manual" and return the response it fetched. A response that names no url is refused on execute and on token reads (logged once).
Errors
  • An error body is read up to its first 8 KiB; the rest is cancelled unread. A body that does not arrive within the attempt's timeout fails the attempt as a timeout.
  • ApiError.message is a capped, redacted excerpt of the error body; never log raw bodies. What is redacted: src/transport/redact.ts.
  • getQuoteSupportCode(result) returns the optional X-Xochi-Support-Code from the original declined getQuote result or the final error it throws. Pass that object directly to the accessor. Offer the code for manual copying into a private report and keep it out of logs, URLs, and automatic reporting.
  • 429/503 raise ApiError with retryAfter (absolute unix seconds, capped at MAX_RETRY_WAIT_SEC), read from Retry-After, else X-RateLimit-Reset, else a JSON body's retryAfter. notAccepted is the exception.
  • ApiError.errorCategory preserves a JSON error body's error_category. Copy it into StructuredError.errorCategory when reporting failures to the machine. tag_resolution_unavailable never auto-retries: show the lookup error and offer a manual fresh quote for the same tag. It invalidates held quotes even on silent refresh; tag quotes never cache one-time recipient addresses. RefreshRequested forces a new quote after this failure.
  • A confirmed missing tag still arrives as an HTTP 200 tag_unresolved decline. It also clears a stale held quote, including on silent refresh; the machine retains its category in StructuredError.errorCategory.
  • ApiError.notAccepted is true only on the Worker's not-accepted 503 for the executed intent (exact shape: isNotAcceptedExecuteBody in src/transport/client.ts); its retryAfter is the body's retry_after wait, which a later Retry-After header can only extend. Pass it to the machine as ErrorReport.notAccepted.
  • ApiError.inDoubt is false only on the three execute answers that speak for the intent (the not-accepted 503, a 502 failed with substatus: "not_executed", a 409 promo_unavailable); every other execute failure, ApiError or not, is in doubt (isInDoubtExecuteAnswer). It is for the host's copy and logs; the machine never reads it. false does not end the order: the signed request stays executable until it expires. Word input errors from code and the message.

Credential-failure callbacks apply only to the request's still-current bearer. Set getAuthGeneration to an in-memory counter changed on logout and re-authentication to invalidate earlier requests even when a token is reused. The transport rechecks both values after reading the error body; neither value is added to the callback event.

Validation
  • Quote and execute bodies are validated against QuoteResponseSchema / ExecuteResponseSchema (undeclared top-level keys tolerated); a malformed read_token is dropped rather than failing the execute. Each attempt's timeout stays armed until the body is read. The only quote-cache TTL is DEFAULT_TIMEOUTS.quoteCacheTtlMs.
  • The exported schemas are .strict() (the declared wire shape); the transport validates with a .passthrough() copy so undeclared served fields (e.g. escrow) reach the signer checks. Running the exported schema directly is stricter than the transport.

Token metadata

TOKENS is the public per-chain metadata registry. TokenInfo, findTokenBySymbol, findTokenByAddress, getTokenInfoByAddress, getTokenInfoForChain, getTokenDecimals and TOKEN_DECIMALS expose the same address/symbol/decimal vocabulary to widgets and headless clients. getTokenInfoForChain resolves only an address registered on that exact chain and returns undefined otherwise; Tron addresses remain case-sensitive. The address-only EVM lookup keeps its explicit display fallback for unknown contracts.

Registry presence means only that metadata can be resolved. It never advertises a route: use the live capability routes contract and advertisedRoute before offering a chain/token pair. isStableSymbol is the case-sensitive domain classification used for dollar-stablecoin pricing and rate checks, not a token picker or route allowlist.

Capability routes

parseCapabilities, advertisedRoute and routeSupportsPrivacyMode are re-exported from @xochi/client for route discovery:

const capabilities = parseCapabilities(await response.json());
const route = capabilities
  ? advertisedRoute(capabilities, {
      origin: { chainId: 8453, token: "USDC" },
      destination: { kind: "chain", chainId: 8453, token: "DAI" },
    })
  : null;
const stealth = route?.privacyModes.includes("stealth") === true;

When routes is present, it is the authoritative selector source for same-symbol and cross-token routes; query the exact typed endpoint and do not reconstruct a cross-product. A served [] or malformed present value means no routes. Only an absent field parses as null and triggers the legacy conservative downgrade: same-symbol cross-chain corridors may use their existing leg support, cross-token same-chain still requires conversionPairs[].sameChain, and cross-token cross-chain remains disabled. A chain destination is never a zk_money destination by implication.

Trusted Stealth chains

effectiveStealthChains(capabilities.stealthChains, (chainId) => stealthFactoryFor(capabilities, chainId)) intersects current solver advertisement and its per-chain factory with TRUSTED_STEALTH_FACTORIES for quote availability. Missing, untrusted, or mismatched factories and missing advertisement fail closed to []. trustedStealthChains() is different: it lists every locally trusted chain for scanning and claiming historical payments, regardless of current quote availability.

A stealth payout to address(P') is claimed by delegating that EOA under EIP-7702. Sign an authorization only to a delegate on TRUSTED_7702_DELEGATES for the payment's chain (isTrusted7702Delegate), never to one the server names.

Executable route model

resolveRouteModel(capabilities, state, options) validates chain/token rows and indexes only exact advertised routes. state is "live", "stale", "fallback" or "failed"; only live, present typed routes authorize execution. Duplicate rows, invalid addresses/decimals and untrusted Stealth factories fail closed. Typed zk_money destinations remain distinct from chain destinations.

The required options.chainEnabledForRole(chainId, role) applies the consuming application's launch gates. options.presentationTokens supplies names and optional logos only; addresses, decimals and route authority always come from capabilities. RouteToken, RouteLeg, ExecutableRouteDestination, ResolvedRouteModel and ResolvedRouteAvailability describe this model. Presentation defaults and fallback capability construction remain outside the client.

capabilityVmType, destination/refund address validation, token-role accessors, orderBounds and servedStealthChains share the same capability interpretation. stealthToggleState and shieldedToggleState let quotes narrow, never expand, live settlement eligibility. parseTrustFeatures accepts only literal true; effectiveTrustScore returns zero while trust economics is disabled.

The additional shared vocabulary was extracted from MIT-licensed @xochi/shared (Copyright 2025-2026 Xochi Contributors), under this package's MIT license. Fee display helpers derive their layers from the existing public FEE_SCHEDULE; they do not maintain an alternate fee schedule. Static address maps are metadata, never route authorization or a security pin.

Widget presentation stays in @xochi/widget: popular-token ordering, offline origin/destination display lists and estimated fallback USD prices are not client exports. These preserve the extracted widget's display continuity only; typed live routes remain the execution authority, and only fresh live prices can feed market comparisons or the excessive-slippage guard. The fallback lists do not advertise executable routes.

Token-amount formatting/parsing, address truncation, formatSupportedTokens and its display cap are owned by the widget's formatting utilities, not exported from the client. classifyDecline and supportedOriginSentence accept caller-supplied origin symbols for guidance; without them they give generic advice, not a static token support claim.

This #98 ownership disposition is an extraction prerequisite only: publication remains gated on the producer/claim-chain prerequisites tracked in #98 and separate registry approval.

Ramp contract (0.2.0 release candidate)

atomic, parseRamp, rampOutcome, and checkRampCommand expose the provider-neutral ramp/1 contract. TypeScript uses canonical snake_case wire fields. Atomic money never uses floating-point numbers. Independent Peer/Xochi snapshots preserve partial success; in-doubt operations permit reconciliation, never execute-again. The exported JSON Schema and runtime-neutral conformance vectors are available at @xochi/client/ramp/contract.schema.json and @xochi/client/ramp/conformance.json.

import { atomic, parseRamp, rampOutcome } from "@xochi/client";

const baseUsdcAmount = atomic("5000000"); // 5 USDC in atomic units
const message = parseRamp(untrustedJson);
if (message.ok && message.value.kind === "snapshot") {
  const outcome = rampOutcome(message.value);
  renderRampState(outcome.state);
}

Preserve optional peer.payout_state and peer.partial_result when storing sanitized snapshots. Older ramp/1 messages can omit either field.

createRampClient serializes commands through a RampOperationStore; trusted adapters own external provider and wallet boundaries. offerRoute(operationId, context) adds an optional onramp Xochi leg only after confirmed Peer delivery and hold release. It obtains no quote and cannot repeat a Peer operation.

createXochiRampLeg({ store, delivered, driver }) implements that leg over the existing validated Xochi swap interpreter. The driver fetches a fresh quote, executes only its held quote through an explicit wallet approval, and polls the existing Xochi intent. Its preview is an allowlisted projection with exact atomic amounts, recipient, settlement and expiry; signing material stays inside the swap interpreter. approve_route prepares the preview, execute_route approves execution, and recover_route fetches a fresh quote after a proven safe failure. Unknown execution permits only check_status; skip_route preserves Peer completion. Failed route quotes remain recoverable partial success, including a timeout before execution.

The Peer compatibility example evaluates one browser SDK graph separately from live provider availability. Public source and package compatibility do not grant hosted iframe permissions or prove live signed execution. No release, host cutover or deployment is included.

State machine

import { init, update, view, type MsgBody } from "@xochi/client";

let model = init(
  {
    solverPin: { erc3009Allowlist: [...], permit2Allowlist: [...], requirePin: true },
    pullRecipients: { 8453: { erc3009: "0x...", permit2: "0x..." } }, // your pin
    depositAttestationSigner: "0x...", // your pin; null refuses every deposit route
  },
  context,
);

function dispatch(body: MsgBody) {
  const [next, effects] = update(model, { ...body, now: Date.now(), hidden: false });
  model = next;
  for (const effect of effects) perform(effect); // Api / Wallet / Timer / Emit
  render(view(next));
}

Lifecycle rules the machine enforces, beyond the signer checks under Fund safety:

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • npm @xochi/client

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

PolinRider Returns
Research

PolinRider Returns: Hijacked npm Packages Use Ethereum Blockchain to Conceal Malware Infrastructure

Plug and Pray: Your AI Agents Are Taking Orders From Strangers
Research

Plug and Pray: Your AI Agents Are Taking Orders From Strangers

Microsoft's Official agent framework Hijacked
AI & VibeSec

BREAKING: Hijacked Releases of Microsoft’s Official agent-framework Steals Azure and CI Credentials

Frame 2085668439 (1)
Group 1261154229