In ricochet-qt, contacts were stored with a sequential numeric ID, and
that was used in various places to refer to the contact uniquely. The
habit carried over here in an attempt to keep configuration
compatibility.
These IDs are error prone (particularly over RPC) and unnecessary. This
removes the entire concept and uses addresses to index and refer
uniquely to contacts everywhere.
The existing configuration was partially compatible with Ricochet's,
but not enough to actually be useful. It also required a bunch of
boilerplate code to copy data between configuration data structures,
internal data structures, and RPC data structures.
Protobuf conveniently supports encoding messages to JSON, and we already
need to store most data (e.g. contacts) in protobuf structures. This
commit changes the configuration to be a protobuf JSON serialization of
the Config message, which can directly reuse RPC messages like Contact.
Additionally, the RWMutex-based configuration type was a deadlock
waiting to happen. There is now a read-only clone of the configuration
available atomically at any time. Writers need an exclusive lock on the
ConfigFile object, which commits its changes to disk and readers on
unlock.
Using the contact ID (which is about to disappear, anyway) to refer to
contacts in commands makes for an awkward UX.
For a differently awkward UX, use the shortest (>3) unambiguous prefix
of the hostname instead. This is stable, always typable, kind of
memorable, and seems like a decent compromise for now.
ricochet-cli can act as a headless backend, so for now there is no point
to having a separate backend program. It may be reintroduced later for
multiprocess use by other frontends -- to be determined.