(sharedSecret)
| 210 | } |
| 211 | |
| 212 | setEncryption (sharedSecret) { |
| 213 | if (this.cipher != null) { this.emit('error', new Error('Set encryption twice!')) } |
| 214 | this.cipher = createCipher(sharedSecret) |
| 215 | this.cipher.on('error', (err) => this.emit('error', err)) |
| 216 | this.framer.unpipe(this.socket) |
| 217 | this.framer.pipe(this.cipher).pipe(this.socket) |
| 218 | this.decipher = createDecipher(sharedSecret) |
| 219 | this.decipher.on('error', (err) => this.emit('error', err)) |
| 220 | this.socket.unpipe(this.splitter) |
| 221 | this.socket.pipe(this.decipher).pipe(this.splitter) |
| 222 | } |
| 223 | |
| 224 | setCompressionThreshold (threshold) { |
| 225 | if (this.compressor == null) { |
no test coverage detected