/** * BLS Multi-Signature Streaming * In-flight Signature Aggregation for Bundle Efficiency * * Pipeline: * Agent → BLS Partial Sig * Relay → Streaming Aggregator * Validator → Full BLS Signature * * Bu, bundle başına 1 imza sağlar (N imza yerine) * Gas maliyeti: N × verify → 1 × verify */ import { EventEmitter } from 'events'; /** * BLS Public Key (G1 point) */ export declare class BLSPublicKey { readonly bytes: Uint8Array; constructor(bytes: Uint8Array); /** * Aggregate multiple public keys */ static aggregate(keys: BLSPublicKey[]): BLSPublicKey; toHex(): string; static fromHex(hex: string): BLSPublicKey; equals(other: BLSPublicKey): boolean; } /** * BLS Secret Key (scalar) */ export declare class BLSSecretKey { private readonly bytes; constructor(bytes: Uint8Array); /** * Generate random secret key */ static generate(): BLSSecretKey; /** * Derive public key */ getPublicKey(): BLSPublicKey; /** * Sign message */ sign(message: Uint8Array): BLSSignature; toHex(): string; } /** * BLS Signature (G2 point) */ export declare class BLSSignature { readonly bytes: Uint8Array; constructor(bytes: Uint8Array); /** * Aggregate multiple signatures */ static aggregate(sigs: BLSSignature[]): BLSSignature; /** * Combine with another signature */ combine(other: BLSSignature): BLSSignature; /** * Verify signature against public key and message */ verify(publicKey: BLSPublicKey, message: Uint8Array): boolean; /** * Verify aggregate signature */ static verifyAggregate(publicKeys: BLSPublicKey[], messages: Uint8Array[], aggregateSig: BLSSignature): boolean; toHex(): string; static fromHex(hex: string): BLSSignature; } /** * Partial Signature for streaming aggregation */ export interface PartialSignature { signature: BLSSignature; publicKey: BLSPublicKey; message: Uint8Array; signerId: string; timestamp: number; sequenceNumber: number; } /** * Aggregation Session */ export interface AggregationSession { sessionId: string; bundleHash: Uint8Array; partialSigs: PartialSignature[]; aggregatedSig: BLSSignature | null; aggregatedPubKey: BLSPublicKey | null; threshold: number; deadline: number; status: 'collecting' | 'aggregating' | 'complete' | 'expired'; } /** * Streaming Signature Aggregator * Collects and aggregates BLS signatures in real-time */ export declare class StreamingAggregator extends EventEmitter { private config; private sessions; private cleanupInterval; constructor(config?: { sessionTimeoutMs?: number; cleanupIntervalMs?: number; maxSessionsPerBundle?: number; }); /** * Start aggregator */ start(): void; /** * Stop aggregator */ stop(): void; /** * Create new aggregation session */ createSession(bundleHash: Uint8Array, threshold: number): string; /** * Submit partial signature to session */ submitPartialSig(sessionId: string, partial: PartialSignature): boolean; /** * Aggregate collected signatures */ private aggregate; /** * Get aggregated signature */ getAggregatedSignature(sessionId: string): BLSSignature | null; /** * Get session status */ getSession(sessionId: string): AggregationSession | undefined; /** * Force aggregation (don't wait for threshold) */ forceAggregate(sessionId: string): BLSSignature | null; /** * Clean up expired sessions */ private cleanupExpiredSessions; /** * Get aggregator stats */ getStats(): { activeSessions: number; completedSessions: number; expiredSessions: number; totalPartialSigs: number; }; } /** * BLS Signer for Agents * Handles key management and signature streaming */ export declare class BLSSigner { private secretKey; private publicKey; private signerId; private sequenceNumber; constructor(secretKey?: BLSSecretKey); /** * Sign message and create partial signature */ sign(message: Uint8Array): PartialSignature; /** * Stream sign (for relay aggregation) */ streamSign(txBytes: Uint8Array): Promise; /** * Get public key */ getPublicKey(): BLSPublicKey; /** * Get signer ID */ getSignerId(): string; /** * Export secret key (encrypted) */ exportSecretKey(): string; } /** * High-level SDK API for BLS Signatures */ export declare class BLSCryptoSDK { private signer; private aggregator; constructor(); /** * Initialize with new or existing key */ init(secretKeyHex?: string): void; /** * Stream sign a transaction */ streamSign(txBytes: Uint8Array): Promise; /** * Sign message */ sign(message: Uint8Array): PartialSignature; /** * Verify signature */ verify(signature: BLSSignature, publicKey: BLSPublicKey, message: Uint8Array): boolean; /** * Aggregate signatures */ aggregate(partials: PartialSignature[]): BLSSignature; /** * Verify aggregate signature */ verifyAggregate(publicKeys: BLSPublicKey[], messages: Uint8Array[], aggregateSig: BLSSignature): boolean; /** * Get aggregator instance */ getAggregator(): StreamingAggregator; /** * Get public key */ getPublicKey(): BLSPublicKey | null; /** * Cleanup */ destroy(): void; } export declare const blsCrypto: BLSCryptoSDK; //# sourceMappingURL=bls-streaming.d.ts.map