socket.lua: Option to pass user generated keypairs

This commit is contained in:
Anavrins 2019-12-11 11:20:12 -05:00
parent 6204c46cc4
commit 9e3cf50ccc
1 changed files with 5 additions and 1 deletions

View File

@ -126,7 +126,11 @@ function Socket.connect(host, port, options)
local socket = newSocket(host == os.getComputerID())
socket.dhost = tonumber(host)
socket.privKey, socket.pubKey = network.getKeyPair()
if options and options.keypair then
socket.privKey, socket.pubKey = unpack(options.keypair)
else
socket.privKey, socket.pubKey = network.getKeyPair()
end
local identifier = options and options.identifier or Security.getIdentifier()
socket.transmit(port, socket.sport, {