Scan your whole stack
From OX Research Newsroom
Are you using @ic402/client?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v2.24.1
@ic402/client was last scanned on 27 Nov 2026 at version 2.24.1. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 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 |
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.
The publisher’s own README, as collected from the registry.
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).
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.
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.
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.
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.
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 methodsFind 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.
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).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.