UNPKG

@kya-os/mcp-i

Version:

The TypeScript MCP framework with identity features built-in

52 lines (51 loc) 1.6 kB
/** * Cloudflare KV Delegation Verifier * * Stores delegations in Cloudflare Workers KV for high-performance, * edge-cached delegation verification. * * Performance: * - Fast path (cached): < 5ms * - Slow path (KV read): < 50ms * - Cache TTL: 1 minute (configurable) * * Key Structure: * - `delegation:{delegationId}` - Full delegation record * - `agent:{agentDid}:scopes:{hash}` - Delegation lookup by agent+scopes * * Related: PHASE_1_XMCP_I_SERVER.md Ticket 1.2 */ import { DelegationRecord } from '@kya-os/contracts/delegation'; import { DelegationVerifier, DelegationVerifierConfig, VerifyDelegationResult, VerifyDelegationOptions } from './delegation-verifier'; /** * Cloudflare KV Delegation Verifier * * Self-hosted mode: Stores delegations in local Cloudflare KV namespace */ export declare class CloudflareKVDelegationVerifier implements DelegationVerifier { private kv; private cache; private cacheTtl; private debug; constructor(config: DelegationVerifierConfig); /** * Verify agent delegation */ verify(agentDid: string, scopes: string[], options?: VerifyDelegationOptions): Promise<VerifyDelegationResult>; /** * Get delegation by ID */ get(delegationId: string): Promise<DelegationRecord | null>; /** * Store delegation record */ put(delegation: DelegationRecord): Promise<void>; /** * Revoke delegation */ revoke(delegationId: string, reason?: string): Promise<void>; /** * Build deterministic scopes key for caching/lookup */ private buildScopesKey; }