@ucanto/interface
@ucanto/interface provides shared type definitions and contracts used across the ucanto ecosystem. It ensures consistent and type-safe interactions between different modules, facilitating seamless integration.
What It Provides
- Shared Type Definitions: Standardized types for capabilities, invocations, and responses.
- Interface Contracts: Defines clear API contracts for
ucantomodules. - Type Safety: Enhances reliability through TypeScript-based type checking.
How It Fits with Other Modules
@ucanto/core: Uses the interfaces to define and execute capabilities.@ucanto/server: Implements service logic based on interface definitions.@ucanto/transport: Adopts standardized encoding and transport interfaces.@ucanto/principal: Uses identity-related interfaces for cryptographic operations.@ucanto/client: Ensures consistent request and response structures.
For an overview and detailed usage information, refer to the main ucanto README.
Installation
npm install @ucanto/interfaceExample Usage
import { Capability, Invocation } from '@ucanto/interface';
const exampleCapability: Capability = {
can: 'file/read',
with: 'file://example.txt'
};
const exampleInvocation: Invocation = {
capability: exampleCapability,
issuer: 'did:key:xyz',
audience: 'did:key:abc'
};For more details, see the ucanto documentation.