/** * Opacus CBOR Codec * Efficient binary serialization for frames * * Features: * - Compact integer-keyed encoding * - Batch processing for performance * - Streaming support * - Compression with size optimization * - Schema validation */ import { OpacusFrame } from '../types'; /** * CBOR encoding options for optimization */ export interface CBOROptions { /** Use compact integer keys instead of string keys */ compact?: boolean; /** Validate schema before encoding/decoding */ validate?: boolean; /** Use streaming mode for large payloads */ streaming?: boolean; /** Maximum allowed payload size in bytes */ maxSize?: number; } /** * Batch encoding result with statistics */ export interface BatchEncodeResult { /** Encoded frames */ frames: Uint8Array[]; /** Total size in bytes */ totalSize: number; /** Average size per frame */ avgSize: number; /** Encoding time in milliseconds */ encodingTime: number; } /** * Streaming CBOR encoder for large datasets */ export declare class StreamingCBOREncoder { private encoder; private chunks; constructor(); /** * Add frame to stream */ push(frame: OpacusFrame): void; /** * Finalize and get concatenated result */ finalize(): Uint8Array; /** * Get current buffer size */ size(): number; /** * Clear buffer */ clear(): void; } /** * Main CBOR codec for Opacus frames */ export declare class CBORCodec { private static readonly DEFAULT_MAX_SIZE; /** * Encode frame to CBOR binary format with integer keys */ static encode(frame: OpacusFrame, options?: CBOROptions): Uint8Array; /** * Decode CBOR binary to frame */ static decode(data: Uint8Array, options?: CBOROptions): OpacusFrame; /** * Batch encode multiple frames for efficiency */ static encodeBatch(frames: OpacusFrame[], options?: CBOROptions): BatchEncodeResult; /** * Batch decode multiple frames */ static decodeBatch(dataArray: Uint8Array[], options?: CBOROptions): OpacusFrame[]; /** * Estimate encoded size without full encoding */ static estimateSize(frame: OpacusFrame): number; /** * Encode payload only */ static encodePayload(payload: any, options?: CBOROptions): Uint8Array; /** * Decode payload only */ static decodePayload(data: Uint8Array): T; /** * Validate frame structure */ private static validateFrame; /** * Compare two frames for equality */ static equals(a: OpacusFrame, b: OpacusFrame): boolean; /** * Calculate compression ratio */ static compressionRatio(original: any, encoded: Uint8Array): number; } /** * CBOR utilities for common operations */ export declare class CBORUtils { /** * Convert frame to hex string */ static toHex(data: Uint8Array): string; /** * Convert hex string to Uint8Array */ static fromHex(hex: string): Uint8Array; /** * Convert to base64 */ static toBase64(data: Uint8Array): string; /** * Convert from base64 */ static fromBase64(b64: string): Uint8Array; } //# sourceMappingURL=cbor.d.ts.map