Got a stable, reliable connection with the client. Fixed issues with javascript strings.
This commit is contained in:
parent
778c0287d8
commit
ab077130e3
8
main.js
8
main.js
|
@ -193,11 +193,13 @@ function make_encryption_key(string)
|
||||||
var key = new Object();
|
var key = new Object();
|
||||||
|
|
||||||
// Set the varibles
|
// Set the varibles
|
||||||
key.str = string;
|
key.str = toBuffer(string);
|
||||||
key.at = new Object();
|
key.at = new Object();
|
||||||
key.at.rx = 0;
|
key.at.rx = 0;
|
||||||
key.at.tx = 0;
|
key.at.tx = 0;
|
||||||
|
|
||||||
|
console.log("make_encryption_key:", key.str);
|
||||||
|
|
||||||
// Return the key
|
// Return the key
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
@ -255,8 +257,8 @@ function socket_init(socket, callback, ondata)
|
||||||
console.log("Created an encryption key")
|
console.log("Created an encryption key")
|
||||||
|
|
||||||
// Encrypt the key with RSA
|
// Encrypt the key with RSA
|
||||||
var key_encrypted = key.encrypt(btoa(sock.key.str), 'base64');
|
var key_encrypted = key.encrypt(string, 'base64');
|
||||||
console.log("Encrypted the key");
|
console.log("Encrypted the key: ", toBytes(key_encrypted));
|
||||||
|
|
||||||
// Send the key to the client
|
// Send the key to the client
|
||||||
sock.sock.write(send_ordered(JSON.stringify({
|
sock.sock.write(send_ordered(JSON.stringify({
|
||||||
|
|
Loading…
Reference in New Issue