UNPKG

@kya-os/mcp-i

Version:

The TypeScript MCP framework with identity features built-in

60 lines (59 loc) 1.85 kB
import { Delegation, DelegationRequest, DelegationResponse, Receipt, StorageConfig } from "@kya-os/contracts/registry"; /** * Delegation management for XMCP-I runtime */ export interface DelegationManager { /** * Issue a new delegation */ issue(request: DelegationRequest): Promise<DelegationResponse>; /** * Revoke an existing delegation */ revoke(delegationRef: string): Promise<Receipt>; /** * Check if a delegation is active */ isActive(delegationRef: string): Promise<boolean>; /** * Get delegation details */ get(delegationRef: string): Promise<Delegation | null>; /** * List active delegations for a subject */ listBySubject(subject: string): Promise<Delegation[]>; } /** * Default delegation manager implementation */ export declare class DefaultDelegationManager implements DelegationManager { private config; constructor(config?: Partial<StorageConfig>); issue(request: DelegationRequest): Promise<DelegationResponse>; revoke(_delegationRef: string): Promise<Receipt>; isActive(delegationRef: string): Promise<boolean>; get(delegationRef: string): Promise<Delegation | null>; listBySubject(_subject: string): Promise<Delegation[]>; /** * Encrypt delegation payload for audience */ private encryptDelegation; } /** * Create delegation manager instance */ export declare function createDelegationManager(config?: Partial<StorageConfig>): DelegationManager; /** * Delegation context for runtime use */ export interface DelegationContext { delegationRef?: string; scopes: string[]; audience?: string; expiresAt: number; } /** * Extract delegation context from proof metadata */ export declare function extractDelegationContext(delegationRef?: string): DelegationContext | null;