Code Monkey home page Code Monkey logo

ksc's People

Contributors

fbrausse avatar

Watchers

 avatar  avatar  avatar  avatar

ksc's Issues

Protocol store should be transactional

The current implementation uses the json_store to do 2 things:

  • implement the Protocol store libsignal-protocol-c expects
  • store additional information required to use the Signal server like username, deviceId, password (to connect to the server), signalingKey (to decrypt Envelopes sent by the server), but also contacts and groups.

This information is crucial, if it is corrupted the account (or device, if it is a multi-device account) is gone and - depending on what data is corrupted - the sessions with others are lost (and their messages will fail to decrypt) or the server will entirely refuse to speak with you or both.

All this information is in a single JSON file. The reason for this design in ksc is interoperability with the signal-cli software family which only has this storage option.

Unfortunately, on every message - sent or received - the JSON file has to be updated. This is prone to errors as all the information gets replaced. We already do an open(tmp-file), write, fsync, close, rename procedure each time, however, this only gives us atomicity, not durability. As Ted points out, fsync-ing the directory would provide durability in case of an unexpected crash (and can be implemented quickly).

However, there is the question of whether an approach like axc of using a transactional backend (SQLite in this case) might not be better than fiddling with JSON...

Python / FFI vs. Reactor / Event-Loop in separate thread.

If the (internal) facil.io event-loop could either

  • be exported as an interface via the FFI to Python and be used in urwid, or
  • somehow be replaced by an external event-loop,

this would eliminate the need for synchronizing between threads and allow scli to use ksc as a pure library in a single-threaded fashion. urwid's requirements for its EventLoop do not seem to be very high, maybe the first option is viable?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.