1
0
mirror of https://github.com/kepler155c/opus synced 2024-09-20 19:29:38 +00:00

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

View File

@ -126,7 +126,11 @@ function Socket.connect(host, port, options)
local socket = newSocket(host == os.getComputerID()) local socket = newSocket(host == os.getComputerID())
socket.dhost = tonumber(host) 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() local identifier = options and options.identifier or Security.getIdentifier()
socket.transmit(port, socket.sport, { socket.transmit(port, socket.sport, {