This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
LDDestroier's profile picture

NeoVariable - Modem-based "cloud variables", network "events", and RLWE/AES encryption!

Started by LDDestroier, 02 March 2018 - 12:55 PM
LDDestroier #1
Posted 02 March 2018 - 01:55 PM
NeoVariable

"Cloud Variable" API



NeoVariable is a server/API for storing variables on remote servers. My intention was to make creating multiplayer games in CC a little easier, but you can also use NeoVariable for other network applications. Messages sent with NeoVariable are encrypted with AES and Ring-LWE key exchange.

Download and run the "neoserver" file on the server (obviously), and you can use the "neovari" API file to interact with it.

Server:
 wget https://raw.githubusercontent.com/LDDestroier/neovari/master/neoserver neoserver 

Client API:
 wget https://raw.githubusercontent.com/LDDestroier/neovari/master/neovari neovari 


Docs on GitHub: https://github.com/L...aster/README.md

Screenshot(s):
SpoilerAn example of how to use NeoVariable in a lua prompt.

Many thanks to SquidDev and PG23186706924 for the AES API and Ring-LWE API respectively.
Edited on 11 April 2018 - 01:55 PM
LDDestroier #2
Posted 21 March 2018 - 04:51 PM
Added a modem-based "event" system, with the following functions:
[HTML]
neovari.queueEvent(server, gamename, tableOfEvents)
–returns nothing
–sends the event data to server, which in turn sends it to every listening neovari client

neovari.pullEvent(server, gamename, optionalEventName, optionalTimeout)
–returns success, table of events.
–optionalEventName is a string, and refers to the first index in optionalEventName
–optionalTimeout is, predictably enough, how long it'll wait for an event before giving up and returning false. by default, it doesn't time out.
[/HTML]

(I can't believe I got no replies nearly three weeks after posting.)

EDIT: Added another function:

serverList = neovari.findServerList(optionalTimeOut)
srvname = serverList[1].serverName
srvid = serverList[1].id
--Same as neovari.findServer() but gives a whole list instead of the first server to respond

The default timeout for the client is also now 1 second instead of 3.
Edited on 21 March 2018 - 04:27 PM
LDDestroier #3
Posted 25 March 2018 - 11:55 PM
Added new function:

neovari.specifyModem(modemname or modem)

NeoVariable, by default, takes the first wireless modem it finds and uses it, going to wired modems only if no wireless ones were found. With this function, you can have NeoVariable use one specific modem.
LDDestroier #4
Posted 27 March 2018 - 10:38 PM
Changed structure of functions to "currying" or something. Also added neovari.getSpecifiedModem().

object = neovari.getServerObject( serverName, gameName, userName, timeout )

turns out that is not currying…oh well.
Edited on 27 March 2018 - 08:57 PM
hugeblank #5
Posted 28 March 2018 - 08:31 AM
http://www.computercraft.info/forums2/index.php?/topic/29034-proof-of-concept-ring-lwe-key-exchange/

You may want to check this out if you want to implement encryption. I used it for AerNet on Airwaves combined with AES by squiddev. As far as I can tell it's pretty solid. I'll hook you up with my little API that I used, I could see it being really helpful in this scenario.
LDDestroier #6
Posted 11 April 2018 - 03:51 PM
Ring-LWE / AES encryption has been implemented into NeoVariable! The server file also has a much better looking and feeling interface, where you can scroll through log entries.
Look at the new documentation to compare changes.

edit: had to do some hotfixes, ay ay ay
Edited on 11 April 2018 - 02:47 PM
Nothy #7
Posted 13 April 2018 - 09:23 PM
This is neat, and would be a great addition to one of my projects. Is there a possibility to put tables on the server too?
LDDestroier #8
Posted 13 April 2018 - 11:54 PM
This is neat, and would be a great addition to one of my projects. Is there a possibility to put tables on the server too?

Yeah, tables are fine. I'm not sure how functions might play out, probably not too well. You could use string.dump() for functions anyway.