/** * GPU-Offloaded Signature Verification (cuVerify) * * Agent'ların saniyede 100k+ imza doğrulaması * (Arbitrage, mempool scan, bundle doğrulama) * * Teknik Yapı: * - WebGPU + CUDA backend * - Batched ECDSA / Ed25519 verify * - GPU memory pool * - QUIC-received packets directly to GPU (zero-copy) */ import { EventEmitter } from 'events'; export type GPUBackend = 'webgpu' | 'cuda' | 'metal' | 'cpu'; export interface GPUConfig { backend: GPUBackend; deviceId?: number; memoryPoolSize?: number; maxBatchSize?: number; asyncMode?: boolean; } export interface GPUDevice { name: string; vendor: string; backend: GPUBackend; computeUnits: number; memoryMB: number; features: string[]; } export interface VerifyRequest { id: string; algorithm: 'ecdsa-secp256k1' | 'ecdsa-p256' | 'ed25519'; message: Uint8Array; signature: Uint8Array; publicKey: Uint8Array; } export interface VerifyResult { id: string; valid: boolean; error?: string; verifyTimeUs: number; } export interface BatchVerifyResult { results: VerifyResult[]; totalTimeUs: number; throughput: number; gpuUtilization: number; } export interface GPUStats { totalVerifications: number; successfulVerifications: number; failedVerifications: number; avgVerifyTimeUs: number; peakThroughput: number; gpuMemoryUsedMB: number; gpuUtilization: number; } /** * GPU Memory Pool * Pre-allocated memory for zero-copy operations */ export declare class GPUMemoryPool { private sizeBytes; private buffer; private allocations; private freeList; constructor(sizeBytes: number); /** * Allocate memory from pool */ allocate(size: number, id: string): Uint8Array | null; /** * Free allocated memory */ free(id: string): void; private coalesce; /** * Get memory usage stats */ getUsage(): { used: number; free: number; fragmentation: number; }; } /** * ECDSA Verifier (secp256k1) * Optimized for batch verification */ export declare class ECDSAVerifier { /** * Verify single ECDSA signature (secp256k1) */ static verify(message: Uint8Array, signature: Uint8Array, publicKey: Uint8Array): boolean; /** * Batch verify ECDSA signatures */ static verifyBatch(messages: Uint8Array[], signatures: Uint8Array[], publicKeys: Uint8Array[]): boolean[]; private static keccak256; private static verifySecp256k1; } /** * Ed25519 Verifier * Optimized for batch verification */ export declare class Ed25519Verifier { /** * Verify single Ed25519 signature */ static verify(message: Uint8Array, signature: Uint8Array, publicKey: Uint8Array): boolean; /** * Batch verify Ed25519 signatures */ static verifyBatch(messages: Uint8Array[], signatures: Uint8Array[], publicKeys: Uint8Array[]): boolean[]; } /** * GPU Compute Kernel (WebGPU/CUDA simulation) * Parallel signature verification on GPU */ export declare class GPUComputeKernel { private config; private device; private initialized; constructor(config: GPUConfig); /** * Initialize GPU device */ init(): Promise; private detectDevice; /** * Execute batch verification on GPU */ executeBatchVerify(algorithm: VerifyRequest['algorithm'], messages: Uint8Array[], signatures: Uint8Array[], publicKeys: Uint8Array[]): Promise; /** * Get GPU utilization */ getUtilization(): number; /** * Check if initialized */ isInitialized(): boolean; /** * Get device info */ getDevice(): GPUDevice | null; } /** * GPU Signature Verifier * High-performance batch signature verification */ export declare class GPUSignatureVerifier extends EventEmitter { private config; private kernel; private memoryPool; private pendingBatches; private stats; private batchTimer; constructor(config?: GPUConfig); /** * Initialize GPU verifier */ init(): Promise; /** * Enable GPU acceleration */ enable(): Promise; /** * Queue single verification */ queueVerify(request: VerifyRequest): Promise; /** * Verify batch of signatures */ verifyBatch(requests: VerifyRequest[]): Promise; /** * Process pending batches */ private processPendingBatches; /** * Get stats */ getStats(): GPUStats; /** * Shutdown */ shutdown(): Promise; } /** * High-level SDK API for GPU Verification */ export declare class GPUCryptoSDK { private verifier; private enabled; /** * Enable GPU acceleration */ enable(config?: GPUConfig): Promise; /** * Check if GPU is enabled */ isEnabled(): boolean; /** * Verify batch of signatures */ verifyBatch(signatures: { sig: Uint8Array; msg: Uint8Array; pubKey: Uint8Array; }[]): Promise; /** * Verify single signature */ verify(signature: Uint8Array, message: Uint8Array, publicKey: Uint8Array, algorithm?: VerifyRequest['algorithm']): Promise; /** * Get stats */ getStats(): GPUStats | null; /** * Disable GPU */ disable(): Promise; private detectBestBackend; } export declare const gpuCrypto: GPUCryptoSDK; //# sourceMappingURL=gpu-verify.d.ts.map