@kya-os/mcp-i
Version:
COMING SOON:Production-ready MCP Identity with automatic registration, key rotation, and optimized performance
51 lines • 1.7 kB
TypeScript
/**
* Optimized cryptographic utilities for MCP-I with lazy loading
* Implements Ed25519 signing and verification with caching
*/
/**
* Precomputed key pair with cached base64 strings
*/
export interface PrecomputedKeyPair {
publicKey: string;
privateKey: string;
publicKeyBytes?: Uint8Array;
privateKeyBytes?: Uint8Array;
}
/**
* Generate a new Ed25519 key pair with precomputed values
*/
export declare function generateKeyPair(): Promise<PrecomputedKeyPair>;
/**
* Sign a message with Ed25519 (with caching)
*/
export declare function sign(message: string | Buffer, privateKeyBase64: string): Promise<string>;
/**
* Verify an Ed25519 signature
*/
export declare function verify(message: string | Buffer, signatureBase64: string, publicKeyBase64: string): Promise<boolean>;
/**
* Generate a cryptographically secure nonce
*/
export declare function generateNonce(length?: number): Promise<string>;
export declare function generateNonceSync(length?: number): string;
/**
* Constant-time string comparison to prevent timing attacks
*/
export declare function constantTimeEqual(a: string, b: string): boolean;
/**
* Convert Ed25519 public key to did:key format
*/
export declare function publicKeyToDid(publicKeyBase64: string): string;
/**
* Encrypt data using AES-256-GCM (for key storage)
*/
export declare function encrypt(data: string, password: string): Promise<string>;
/**
* Decrypt data using AES-256-GCM
*/
export declare function decrypt(encryptedData: string, password: string): Promise<string>;
/**
* Clear signature cache (useful for testing or memory management)
*/
export declare function clearCache(): void;
//# sourceMappingURL=crypto.d.ts.map