Kuska-ssb / handshake

Secure Scuttlebutt handshake + boxstream library
Other
22 stars 4 forks source link

Implement iot-solar example #21

Closed adria0 closed 4 years ago

adria0 commented 4 years ago

iot-solar allows to use ssb to interface with solar mini/microgrids allowing to have a secure way to control them.

The general context is

command line

iot-solar setup - creates an identity and setups the database iot-solar admin add @id - adds a friend (can send commands) iot-solar admin remove @id - removes a friend (cannot send commands) iot-solar report filename.txt - generates a post with the report iot-solar action action.txt - generates a post with the action (self-consumed)

config.toml

netid = # networkid to use actionpath = # executable to call when an action is triggered via special admin feed

storage

KV database

filesystem

api (actix)

POST /api/admin/add/ @id POST /api/admin/rm/ @id POST /api/admin/report in body is the report content POST /api/admin/action in body is the action content

app architecture draft

                  http
+------+           +           +------------+
|cmd   +-+http+--+ |       +-->+ssb rpc(ro) +---+
+------+         | |       |   +------------+   |
                 v v       |                    |
+------+    +----+-+---+   |   +------------+   |
|tokio +-+->+actix     +---+-->+solar api   |   |
+------+ |  +----------+       +-----+------+   |
         |                           |          |
         |  +----------+             |          |
         |  |command   +<-+msg chan<-+---+      |
         +->+processor |                 |      |
         |  |loop      +---------+       |      |
         |  +----+-----+         |       |      |
         |       ^ term ch       |       |      |
         |  +----+-----+     +---v---+   |      |
         +->+SIGTERMhnd|     |storage|   |      |
         |  +----+-----+     |KV + fs+<---------+
         |       | term ch   +-------+   |
         |  +----v-----+         ^       |
         +->+feed sync +---------+-------+
         |  +----------+
         +->+peer disc |
            +----+-----+
                 |
                 v
           ssbrpc/bot/lan

(*1) https://www.babynames.net/girl/african

adria0 commented 4 years ago

moved to kuska-ssb

Edit by Dhole: https://github.com/Kuska-ssb/kuska-ssb/issues/1