This commit is contained in:
Julian Brammer 2024-06-08 21:39:43 +02:00
parent 3e940764e4
commit a462795c10
3 changed files with 18 additions and 4 deletions

View File

@ -0,0 +1,14 @@
basic = require("basic")
hash = require("hash")
--aes = require("lib.aes") --aes does not yet work with require
os.loadAPI("brulijam/lib/aes.lua")
function createKeyfile()
basic.clearDisplay()
write("Please enter shared secret for networking: ")
local pwHash = hash.digestStr(read("*") .. "salty salt")
basic.writeToFile("brulijam/files/networking-key.txt", pwHash)
basic.clearDisplay()
end
createKeyfile()

View File

@ -21,7 +21,8 @@ local function setup()
ownLabel = os.computerLabel()
peripheral.find("modem", rednet.open)
if not fs.exists "brulijam/files/networking-key.txt" then
createKeyfile()
--createKeyfile()
shell.run("/brulijam/lib/createNetworkingKey.lua")
end
end
@ -104,8 +105,6 @@ function receiveMessage()
end
end
createKeyfile()
return {
sendMessage = sendMessage,
sendFile = sendFile,

View File

@ -25,7 +25,8 @@ shell.run("/brulijam/sync.lua")
--set label if not set
shell.run("/brulijam/setLabel.lua")
shell.run("/brulijam/lib/networking.lua")
--create networking key
shell.run("/brulijam/createNetworkingKey.lua")
shell.run("/brulijam/systemlock.lua")