From 9e3cf50ccc153346e675233fe65fa4fab67fcb2f Mon Sep 17 00:00:00 2001 From: Anavrins Date: Wed, 11 Dec 2019 11:20:12 -0500 Subject: [PATCH] socket.lua: Option to pass user generated keypairs --- sys/modules/opus/socket.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/modules/opus/socket.lua b/sys/modules/opus/socket.lua index 8151855..b126643 100644 --- a/sys/modules/opus/socket.lua +++ b/sys/modules/opus/socket.lua @@ -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, {