UNPKG

@averox/cryptosphare

Version:

Real-time SDK for end-to-end encrypted messaging, key monitoring, and secure A/V streaming

58 lines (57 loc) 2.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Config = void 0; const logger_1 = require("./logger"); const events_1 = require("events"); class Config extends events_1.EventEmitter { constructor(config = {}) { super(); this.config = this.getDefaultConfig(config); this.logger = new logger_1.Logger({ minLevel: process.env.NODE_ENV === 'production' ? logger_1.LogLevel.INFO : logger_1.LogLevel.DEBUG, timestamps: true, showLevel: true, }); } getDefaultConfig(config) { return { encryption: { forwardSecrecy: true, quantumResistant: false, algorithm: 'AES-256-GCM', keyRotationInterval: 24, ...config.encryption, }, streaming: { audio: false, video: false, videoQuality: '720p', audioQuality: 'high', ...config.streaming, }, monitoring: { encryptionLogs: true, keyMonitoring: true, performanceMetrics: true, ...config.monitoring, }, telemetryLevel: 'Basic', ...config, }; } initialize() { var _a, _b, _c, _d; this.logger.info('Initializing SDK with config:', this.config); if ((_a = this.config.encryption) === null || _a === void 0 ? void 0 : _a.forwardSecrecy) { this.logger.info('Forward secrecy enabled'); } if ((_b = this.config.encryption) === null || _b === void 0 ? void 0 : _b.quantumResistant) { this.logger.info('Quantum-resistant algorithms enabled'); } if (((_c = this.config.streaming) === null || _c === void 0 ? void 0 : _c.audio) || ((_d = this.config.streaming) === null || _d === void 0 ? void 0 : _d.video)) { this.logger.info('Media streaming enabled:', this.config.streaming); } this.logger.info('SDK initialization complete'); } } exports.Config = Config;