.
This commit is contained in:
parent
3e940764e4
commit
a462795c10
14
src/brulijam/lib/createNetworkingKey.lua
Normal file
14
src/brulijam/lib/createNetworkingKey.lua
Normal 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()
|
@ -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,
|
||||
|
@ -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")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user