Remove useless SecretKey class

This commit is contained in:
Amish Shah
2017-10-26 14:02:44 +01:00
parent 3e3e6f9af7
commit ac0cc9a009
5 changed files with 7 additions and 22 deletions

View File

@@ -1,5 +1,4 @@
const { OPCodes, VoiceOPCodes } = require('../../util/Constants');
const SecretKey = require('./util/SecretKey');
const EventEmitter = require('events');
const { Error } = require('../../errors');
const WebSocket = require('../../WebSocket');
@@ -164,14 +163,17 @@ class VoiceWebSocket extends EventEmitter {
*/
this.emit('ready', packet.d);
break;
/* eslint-disable no-case-declarations */
case VoiceOPCodes.SESSION_DESCRIPTION:
const key = new Uint8Array(new ArrayBuffer(packet.d.secret_key.length));
for (const i in packet.d.secret_key) key[i] = packet.d.secret_key[i];
/**
* Emitted once the Voice Websocket receives a description of this voice session.
* @param {string} encryptionMode The type of encryption being used
* @param {SecretKey} secretKey The secret key used for encryption
* @param {Uint8Array} secretKey The secret key used for encryption
* @event VoiceWebSocket#sessionDescription
*/
this.emit('sessionDescription', packet.d.mode, new SecretKey(packet.d.secret_key));
this.emit('sessionDescription', packet.d.mode, key);
break;
case VoiceOPCodes.SPEAKING:
/**