Socket
Book a DemoInstallSign in
Socket

@ucanto/server

Package Overview
Dependencies
Maintainers
3
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ucanto/server

UCAN RPC Server

11.0.0
latest
Source
npmnpm
Version published
Weekly downloads
319
69.68%
Maintainers
3
Weekly downloads
 
Created
Source

@ucanto/server

@ucanto/server provides the necessary components to build a UCAN-based RPC server. It enables services to define capabilities, validate UCANs, and process invocations securely and efficiently. This package builds on ucanto/core and integrates seamlessly with other ucanto modules.

What It Provides

  • UCAN-Based Authorization: Ensures that all invocations are securely verified before execution.
  • Capability Handling: Allows services to define and manage capabilities with fine-grained access control.
  • Pluggable Transport Layer: Supports multiple encoding and transport options.
  • Batch Invocation Processing: Enables efficient handling of multiple invocations in a single request.

How It Fits with Other Modules

  • @ucanto/core: Provides the fundamental capability execution and validation logic.
  • @ucanto/interface: Defines shared type definitions and contracts.
  • @ucanto/transport: Implements encoding and transport mechanisms.
  • @ucanto/principal: Handles identity management and cryptographic operations.

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

Installation

npm install @ucanto/server

Example Usage

import * as Server from '@ucanto/server';
import * as CAR from '@ucanto/transport/car';
import * as CBOR from '@ucanto/transport/cbor';
import { ed25519 } from '@ucanto/principal';
import { capability, URI } from '@ucanto/core';

const ReadFile = capability({
  can: 'file/read',
  with: URI.match({ protocol: 'file:' })
});

export const createServer = () => {
  const read = Server.provide(ReadFile, ({ capability }) => {
    return { path: capability.with };
  });

  return Server.create({
    id: ed25519.Signer.parse(process.env.SERVICE_SECRET),
    service: { file: { read } },
    decoder: CAR,
    encoder: CBOR
  });
};

For more details, see the ucanto documentation.

Keywords

UCAN

FAQs

Package last updated on 02 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.