This commit does a few things:
1) Add replies to messages, which are calculated at query time using a
join
2) Add a BlockContact api call that takes care of deleting messages from
a user, deleting the chat, and re-compute the denormalized values. As it
needs to run in a transaction, the method that it relies on take a
transaction as an optional parameter.
3) Change ID scheme for chats/contacts so that it's consistent across
messages/contacts
This is not compatible as I have modified a migration, but it's not a
problem as data compatibility can be broken
The signature of the `Raw` methods has been changed so that they return
the application messageID.
Clients will keep track of this ID and receive a notification through
the envelopesMonitor of the state of the envelopes (sent/expired).
Envelopes monitor is passed this ID as well.
We use an array of IDs as datasync messages might be batched.
Adds to api calls, Contacts() not paginated and SaveContact()
DeviceInfo and SystemTags have been stored as a blob to simplify
querying, although at some point we might want to query system tags (for
example to fetch all the blocked/added by us/added by them contacts),
but not a use case for now.
This commits adds two API calls:
SaveChat
GetChats
The first one behaves like an upsert.
The second takes two parameters, from, to and returns chats in reverse
order by timestamp.
Members and MembershipUpdates have been stored as blob of data to
simplify the querying (we never query them separately).
This commit adds the ability of reading and sending datasync messages.
Datasync messages are batched, so a single whisper message might
contain multiple protocol messages.
Datasync messages are parsed regardless of whether the datasync flag is
on, as this commit is backward compatible.
Sending messages is toggled off by default.
status-go requires some special methods to be exposed in order to support the current integration.
Introduced families of methods marked as `DEPRECATED`:
* `SendRaw` to send transit-encoded messages, both public and private. It supports only private PFS-enabled messages. To send private non-PFS messages, we can add this functionality or it needs to happen through `shh_post` directly from status-react.
* `RetrieveRawAll` and `RetrieveRawWithFilter` to get retrieve decrypted but transit-encoded messages.
* `LoadFilters` and `RemoveFilters` to manage Whisper filters directly.
* By default, persistence of messages is disabled. It can be enabled with an option passed to `Messenger`.
* File paths to the databases are configurable in `Messenger`.
Currently datasync propagates the unencrypted messages. This messages
might be relayed to a third party. We can't therefore rely on whisper
signature, as the author might not be the same as the relayer.
This commit wraps our current message in a protobuf record with an
optional signature.
If the signature is present it will be used to indicate the author of
the message, otherwise whisper is used.
It's not enabled by default as this is a breaking change and should go
live with v1. Decoding is backward compatible, so old messages will
still be read.
I have also changed the messageID scheme to use:
compressedBytesOfPk + Keccak256 of the encoded unencrypted payload, instead of the whisper ID.