JSPM

@le-space/ucanto-client

9.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q25275F
  • License (Apache-2.0 AND MIT)

UCAN RPC Client

Package Exports

  • @le-space/ucanto-client

Readme

@le-space/ucanto-client

@le-space/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

For an overview and detailed usage information, refer to the main ucanto README.

Installation

npm install @le-space/ucanto-client

Example Usage

import * as Client from '@le-space/ucanto-client';
import { ed25519 } from '@le-space/ucanto-principal';

const service = ed25519.parse(process.env.SERVICE_ID);
const issuer = ed25519.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.