Commit Graph

20 Commits

Author SHA1 Message Date
Andrea Maria Piana cc44ddb7ce
Revert "Make database optional (#72)"
This reverts commit 3fa3648db9.
2019-09-26 10:12:15 +02:00
Andrea Maria Piana 1e2e007bc6
Add identicon and gfycat generated names 2019-09-26 06:43:11 +02:00
Adam Babik 3fa3648db9
Make database optional (#72) 2019-09-24 17:36:53 +02:00
Adam Babik dbf4c4062e
Improve interface around chats and add matching messages against chats (#66) 2019-09-20 08:41:53 +02:00
Adam Babik 31e37fa448
Add data sync tests (#63) 2019-08-31 16:56:28 +02:00
Adam Babik 0dd1cd585b
Replace adapter with message processor (#58) 2019-08-29 09:01:59 +02:00
Andrea Maria Piana 1646cd6771
Add persistent datasync 2019-08-28 09:47:58 +02:00
Adam Babik 287f9aa26c
add Messenger.Init() (#55) 2019-08-25 17:48:37 +02:00
Andrea Maria Piana b9447aea36
Add replies, block contact, remove unused methods
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
2019-08-20 08:54:10 +02:00
Andrea Maria Piana e1f4f17baf
Add confirmations for datasync messages.
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.
2019-08-07 16:48:09 +02:00
Andrea Maria Piana baa579640f
Move contacts to status-protocol-go & add delete chat endpoint
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.
2019-08-04 22:06:05 +02:00
Andrea Maria Piana b742356b68
Add chats API calls
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).
2019-08-02 07:38:20 +02:00
Adam Babik f102941b62
Unify logging in tests (#38) 2019-07-30 20:36:42 +02:00
Adam Babik 0a8bf4c10e
Consolidate databases and migrations (#36) 2019-07-27 14:27:31 +02:00
Adam Babik 6a11d08b05
Prepare for status-go integration (#27)
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`.
2019-07-23 10:33:57 +02:00
Andrea Maria Piana eb918ec8af
Fix lint & tests 2019-07-21 07:57:27 +02:00
Pedro Pombeiro c1f623388d
Move to zap structured logging library (#25) 2019-07-18 15:41:48 +02:00
Adam Babik dec4e63d9f
Propagate shared secrets on encryption protocol init (#23) 2019-07-17 15:14:16 +02:00
Andrea Maria Piana 7623131be4
[Fixes #9] Increase multidevice response (#16)
We only generate the bundle once every 6 hours (or if pairing
information changes).
This means that in some cases where many devices appear/disappear,
new devices are not picked up until the bundle is refreshed.

For example:

Alice creates a device with timestamp t1 A1
Alice creates a device with timestamp t2 A2
Alice creates a device with timestamp t3 A3
Alice creates a device with timestamp t4 A4

Alice propagates this to bob, bob's list of active devices for alice is now: t2 A2,
t3 A3, t4 A4 as we only keep maximum 3.

If Alice sends a message to Bob from A1, previously it would be still
using t1 (as long as less than 6 hours have passed).

Now instead the new bundle will have t5 instead, so upon receiving the
message bob will have: t3 A3, t4 A4, t5 A1.

This commit changes the behavior to always update the timestamp before
publishing the bundle, so that as soon as a message is received from a
new device, it will increase the timestamp for that device.
2019-07-17 08:42:27 +02:00
Adam Babik 5c6039f77f
Refactor the library (#20) 2019-07-16 12:43:07 +02:00