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

@ic402/client

Latest version: v2.24.1

Overview

Last scanned
27 Nov 2026
Published
27 Nov 2026
npm package Publisher: vhew
0 Stars
0 Forks
25 Versions
2.4K Downloads
Motoko Repo language

Scan summary

@ic402/client was last scanned on 27 Nov 2026 at version 2.24.1. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 25 versions; the latest 4 were published within 3 days (25–27 Nov 2026).
  • Findings: No rules fired in version 2.24.1.
  • Downloads: 2,362 downloads.

Versions

25 versions published
Versions and the rules that fired in each
VersionPublishedStatus
2.24.1 LATEST 27 Nov 2026 No rules fired
2.24.0 25 Nov 2026 No rules fired
2.23.2 25 Nov 2026 No rules fired
2.23.1 25 Nov 2026 Not shown
2.23.0 19 Nov 2026 Not shown

No rules fired in 2.24.1

Findings

Findings for v2.24.1. 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 2.24.1; other versions have their own rules, not their own score.

README

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

@ic402/client

TypeScript client SDK for ic402-enabled ICP canisters. Handles x402 charge payments (auto 402 → approve → retry), streaming micropayment sessions with Ed25519 vouchers, EIP-3009 EVM payments, encrypted content delivery, the paid-service marketplace, and the client half of the canister's remote EVM signing (canister signs, you broadcast).

Install

npm install @ic402/client

Requires Node.js ≥ 20.19 (Web Crypto API; the floor of @icp-sdk/core's @noble/* dependencies). Runtime dependencies (@icp-sdk/core, viem, cborg) install automatically; if your app also uses @icp-sdk/core directly, use the same version (6.1.1) so npm installs a single copy.

Quick start

import { Actor, HttpAgent } from '@icp-sdk/core/agent';
import { Ic402Client, exampleIdlFactory } from '@ic402/client';

const agent = await HttpAgent.create({ host: 'https://icp-api.io', identity });

const client = new Ic402Client({
  canisterId: '<your-canister-id>',
  actorFactory: (id) => Actor.createActor(exampleIdlFactory, { agent, canisterId: id }),
  identity, // the SAME identity the agent uses
  network: 'icp:1',
  autoPayment: true,
  ledger: 'xevnm-gaaaa-aaaar-qafnq-cai', // ckUSDC
  ledgerActorFactory: (id) => createLedgerActor(id), // any actor exposing icrc2_approve
});

// Trailing [] = the Candid `opt PaymentSignature` argument, empty on the first attempt.
// 402 → ICRC-2 approve → retry with signature → result, all handled for you.
const results = await client.call('search', ['what is x402?', []]);

exampleIdlFactory matches the reference canister (example/main.mo); pass your own IDL factory for a custom canister.

Streaming session
import { Ed25519KeyIdentity } from '@icp-sdk/core/identity';

const voucherKey = Ed25519KeyIdentity.generate();
const sessionAgent = await HttpAgent.create({ host: 'https://icp-api.io', identity: voucherKey });
const session = await client.openSession(
  {},
  {
    sign: (payload) => voucherKey.sign(payload),
    getPublicKey: async () => voucherKey.getPublicKey().toRaw(),
    actorFactory: (id) => Actor.createActor(exampleIdlFactory, { agent: sessionAgent, canisterId: id }),
  },
);

const answer = await session.call('sessionQuery', ['question']); // sent as the session key, no on-chain tx
console.log(session.consumed, session.remaining);

const receipt = await session.close(); // settle consumed + refund remainder

One escrow deposit on open, settle + refund on close — every call in between is a cumulative voucher, with no ledger call and no gas. Two modes (2.17.0): with actorFactory on the signer, each call is made as the session key, the IC authenticates it, and the canister (consumeVoucherFrom) runs no signature check (~8M cycles); without it, calls go through the client's actor and the canister verifies the voucher's Ed25519 signature (~420M cycles; see costs-and-rails.md) — only while its signed-voucher fallback is on (the library default; the example turns it off). Vouchers are signed either way, so a new client also works against older canisters. A session-paid endpoint that issues a content grant binds it to msg.caller, i.e. the session key: redeem it through the session agent (fetchContent(delivery, { canisterId, actorFactory: (id) => Actor.createActor(exampleIdlFactory, { agent: sessionAgent, canisterId: id }) })). open/close stay on the payer's actor.

EIP-3009 EVM payment

Build and sign the TransferWithAuthorization a standard x402 EVM payment needs, with any EIP-712 signer (viem, ethers, MetaMask):

import {
  usdcDomain,
  TRANSFER_WITH_AUTHORIZATION_TYPES,
  buildTransferAuthorizationMessage,
} from '@ic402/client';

const message = buildTransferAuthorizationMessage({
  from: payerAddress,
  to: canisterEvmAddress, // the 402's `recipient` / `payTo`
  value: 1_000_000n,      // must EQUAL the required amount
});

const signature = await walletClient.signTypedData({
  domain: usdcDomain(8453, usdcAddress),
  types: TRANSFER_WITH_AUTHORIZATION_TYPES,
  primaryType: 'TransferWithAuthorization',
  message,
});

Submit the signed authorization either in an x402 X-PAYMENT header (HTTP rail) or as the authorization field of the Candid PaymentSignature your paid method accepts — see the getting-started walkthrough for the full submission flow.

API

new Ic402Client(config: Ic402ClientConfig)
Field Type Description
canisterId string Target canister. Required.
actorFactory (canisterId: string) => any Creates actors for canister calls. Required.
identity Ic402Identity \| null Anything with getPrincipal(): { toText(): string }; fills the payment sender. Required (may be null).
network string CAIP-2 id: "icp:1", "eip155:84532", … Required.
autoPayment? boolean Auto-handle 402 responses (ICP: ICRC-2 approve + retry).
sessions? SessionPreferences Default session preferences.
ledger? string Ledger canister id for ICRC-2 auto-approval.
ledgerActorFactory? (ledgerCanisterId: string) => any Required for ICP auto-payment.
evmRpcUrl? string Custom EVM RPC; defaults to a public RPC per chain.
approvalFeeBuffer? bigint When set, used as the ledger fee instead of querying icrc1_fee(). ICRC-2 approvals are exactly amount + fee and expire after 5 minutes (a ledger actor without icrc1_fee uses 100_000n).

Approvals replace the allowance, so two payments from one identity in flight at once may fail with InsufficientAllowance — never a double payment; retry the one that failed. The payment sender must be the principal the actorFactory's agent calls with: Candid paths refuse a mismatch (Gateway.settleFrom).

Ic402Client methods

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 @ic402/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

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Vulnerability Insights

The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?

Cry2Wolf: How to Tell a Real Bug from a Nothingburger
AI & VibeSec

Cry2Wolf: Not Every Branded Bug Deserves a Fire Drill

Copy of Template Design OX Blog (1)
Research

Thousands Of GitHub Accounts Hijacked With wfx-loot CI Secret Stealing Malware Via GitHub Actions & npm

Frame 2085668439 (1)
Group 1261154229