# @ucanto/client

> UCAN RPC Client

Latest version **9.0.2** (published 2025-10-24) · (Apache-2.0 AND MIT) license · 0 weekly downloads

## Install

```sh
npm install @ucanto/client
pnpm add @ucanto/client
yarn add @ucanto/client
bun add @ucanto/client
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 9.0.2 |
| Published | 2025-10-24 |
| First published | 2022-06-20 |
| Weekly downloads | 0 |
| License | (Apache-2.0 AND MIT) |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 2 |
| Unpacked size | 9.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 62 |
| Maintainers | gozala, it-dag-house, hugomrdias |
| Keywords | UCAN, RPC, IPLD, JWT, multicodec, codec, invocation |

## Links

- npm: https://www.npmjs.com/package/@ucanto/client
- Repository: https://github.com/storacha/ucanto
- Issues: https://github.com/storacha/ucanto/issues
- npm.io page: https://npm.io/package/@ucanto/client

## Dependencies (2)

- [@ucanto/core](https://npm.io/package/@ucanto/core.md) ^10.4.5
- [@ucanto/interface](https://npm.io/package/@ucanto/interface.md) ^11.0.1

## Alternatives

- [@clerk/clerk-expo](https://npm.io/package/@clerk/clerk-expo.md) — 133.6K weekly downloads
- [@pothos/plugin-authz](https://npm.io/package/@pothos/plugin-authz.md) — 12.4K weekly downloads
- [@bounded-sh/client](https://npm.io/package/@bounded-sh/client.md) — 3.2K weekly downloads
- [@luigi-project/plugin-auth-oauth2](https://npm.io/package/@luigi-project/plugin-auth-oauth2.md) — 2.3K weekly downloads
- [@nocobase/plugin-verification](https://npm.io/package/@nocobase/plugin-verification.md) — 2.0K weekly downloads

## Recent versions

- 9.0.2 (latest) — 2025-10-24
- 9.0.1 — 2024-04-04
- 9.0.0 — 2023-10-05
- 8.0.1 — 2023-08-03
- 8.0.0 — 2023-05-22
- 7.0.1 — 2023-04-16
- 7.0.0 — 2023-04-11
- 0.7.0 — 2023-04-11
- 5.1.0 — 2023-03-07
- 5.0.0 — 2023-03-01
- 4.4.0 — 2023-02-28
- 4.3.4 — 2023-02-28
- 4.2.3 — 2023-01-27
- 4.2.2 — 2023-01-27
- 4.1.0 — 2023-01-18
- … 19 more at https://npm.io/package/@ucanto/client/versions

## README

# @ucanto/client

`@ucanto/client` provides the tools necessary to create, sign, and send UCAN-based RPC invocations. It enables secure communication with UCAN-compliant services while ensuring proper authorization and delegation handling.

## What It Provides
- **UCAN Invocation Handling**: Creates and signs capability invocations.
- **Batch Invocation Support**: Enables multiple invocations in a single request.
- **Secure Communication**: Ensures interactions are cryptographically signed and verified.

## How It Fits with Other Modules
- [`@ucanto/core`](../core/README.md): Defines capability structures and execution logic.
- [`@ucanto/server`](../server/README.md): Processes invocations received from the client.
- [`@ucanto/interface`](../interface/README.md): Provides shared types for request and response handling.
- [`@ucanto/principal`](../principal/README.md): Manages cryptographic signing for invocations.
- [`@ucanto/transport`](../transport/README.md): Handles encoding and sending of requests.

For an overview and detailed usage information, refer to the [main `ucanto` README](../../Readme.md).

## Installation
```sh
npm install @ucanto/client
```

## Example Usage
```ts
import * as Client from '@ucanto/client';
import { ed25519 } from '@ucanto/principal';

const service = ed25519.Verifier.parse(process.env.SERVICE_ID);
const issuer = ed25519.Signer.parse(process.env.CLIENT_KEYPAIR);

const invocation = await Client.invoke({
  issuer,
  audience: service,
  capability: {
    can: 'file/read',
    with: 'file://example.txt'
  }
});

const response = await client.execute(invocation);
if (response.error) {
  console.error('Invocation failed:', response.error);
} else {
  console.log('Invocation succeeded:', response.result);
}
```

For more details, see the [`ucanto` documentation](https://github.com/storacha/ucanto).

---
_Source: https://npm.io/package/@ucanto/client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
