Got a stable, reliable connection with the client. Fixed issues with javascript strings.

This commit is contained in:
jsrobson10 2019-04-09 21:03:39 +10:00
parent 778c0287d8
commit ab077130e3
1 changed files with 5 additions and 3 deletions

View File

@ -193,11 +193,13 @@ function make_encryption_key(string)
var key = new Object();
// Set the varibles
key.str = string;
key.str = toBuffer(string);
key.at = new Object();
key.at.rx = 0;
key.at.tx = 0;
console.log("make_encryption_key:", key.str);
// Return the key
return key;
}
@ -255,8 +257,8 @@ function socket_init(socket, callback, ondata)
console.log("Created an encryption key")
// Encrypt the key with RSA
var key_encrypted = key.encrypt(btoa(sock.key.str), 'base64');
console.log("Encrypted the key");
var key_encrypted = key.encrypt(string, 'base64');
console.log("Encrypted the key: ", toBytes(key_encrypted));
// Send the key to the client
sock.sock.write(send_ordered(JSON.stringify({