Commit graph

311 commits

Author SHA1 Message Date
lilia
5f07c74f1a Add log statement when opening provisioning socket
Make it more obvious via logs which server someone is attempting to
register with (i.e., to disambiguate staging from prod).

// FREEBIE
2016-02-29 05:08:07 -08:00
lilia
2b7cbef8b1 Rename a function
Avoid confusing this operation with actual receipts, which are something
else.

// FREEBIE
2016-02-26 12:41:29 -08:00
lilia
8fdf58971c Add missing semicolons
// FREEBIE
2016-02-24 23:10:17 -08:00
lilia
c3bbdb393f Refactor media uploading step
Move this to its own function which encapsulates the error handling for
it.

// FREEBIE
2016-02-24 23:10:17 -08:00
lilia
44b1a6451d Add validation to Message class
// FREEBIE
2016-02-24 23:10:16 -08:00
lilia
781ada64ca Add libtextsecure support for syncing read messages
Plumbing for sending and receiving a new sync protobuf for marking
messages read on/from my other devices.

// FREEBIE
2016-02-22 17:11:17 -08:00
lilia
010297f4c5 Track groups I've left
// FREEBIE
2016-02-22 17:11:16 -08:00
lilia
7e82d1295c Handle attachment upload errors
Adds a new kind of replayable error that handles retry of pre-encryption
failures, e.g., attachment upload.

Fixes #485

// FREEBIE
2016-02-09 13:21:32 -08:00
lilia
910e37649a Let group messages use new Message class
// FREEBIE
2016-02-08 17:07:49 -08:00
lilia
3bffdd96f5 Add sendMessage to handle sending from Message class
// FREEBIE
2016-02-08 17:07:49 -08:00
lilia
ecdfa09e97 Create a helper class for constructing messages
// FREEBIE
2016-02-08 17:07:48 -08:00
lilia
b73a3aea80 Fix syntax error
// FREEBIE
2016-02-08 15:58:06 -08:00
lilia
cee2b3163a Add missing bind in messageReceiver
// FREEBIE
2016-02-08 15:49:34 -08:00
lilia
7dcad67410 Fix handleSentMessage
Missing a bind in 27fe7e3.

// FREEBIE
2016-02-05 11:11:34 -08:00
lilia
d4760452d1 Add signal agent to server requests
// FREEBIE
2016-02-04 14:13:04 -08:00
lilia
27fe7e355e Process end session flags in sync messages
Because remote clients will delete all sessions in response to an end
session message, regardless of which device it came from, when our
linked device sends an end session message, we must also end all
sessions with the destination.

This change moves the end session flag processing to processDecrypted,
which is shared between handlers of sent messages, data messages, and
messages which are re-tried after resolving identity conflicts.

// FREEBIE
2016-02-04 11:25:53 -08:00
lilia
fe82e469f2 Make end session consistent with android
Close all the sessions for a number when receiving an end session
message.

// FREEBIE
2016-02-03 17:56:24 -08:00
lilia
86132a38a8 Log envelopes and session end events
Help debug bad session errors by logging some envelope info about the
message we are about to decrypt. With this, if there is a decryption
error (e.g., bad mac or no session) it is clear from the logs what
number and device message sent the bad message.

Also log when we send and receive end session messages and when we close
sessions for certain devices.

// FREEBIE
2016-02-02 16:16:42 -08:00
lilia
7c17c5fa54 Update chai
// FREEBIE
2016-02-01 15:54:23 -08:00
lilia
1ee6a2e43f Rebuild libtextsecure test components w/ new chai
// FREEBIE
2016-01-28 18:03:51 -08:00
lilia
a9cba1471a Update our own key on re-install
Previously we would delete our own key from the trust store when
re-linking, in case it changed. We can also immediately take one step
further and store the new key. Typically this happens in the course of
requesting sync info from the master device, except in the case of
standalone clients.

Closes #596

// FREEBIE
2016-01-21 19:25:55 -08:00
lilia
30aa13079f Fix sync request argument check
Fixes #609

// FREEBIE
2016-01-15 01:40:40 -08:00
lilia
d6da77b6f4 Throw exception on bad args to SyncRequest
// FREEBIE
2016-01-14 15:57:38 -08:00
lilia
1b68e652cc Fire group sync completion event despite errors
Sometimes an error is thrown while processing groups from a group sync
message. We still want to fire the groupsync event when we're done
handling all the data, even if some of it was bad.
2016-01-14 15:44:44 -08:00
lilia
75b2c9c5de Fix crash when removing a listener
// FREEBIE
2016-01-14 15:44:43 -08:00
lilia
f7c4fd2fed DRY up event target implementations
Dedupe event target code and make it extensible.

// FREEBIE
2016-01-14 15:44:42 -08:00
lilia
925c1bdb33 Add SyncRequest class
Similar in function to an xhr request, a textsecure.SyncRequest object
is initialized from a message sender and receiver pair and initiates a
request for sync from the master device. It later fires a success event
when both contacts and groups are done syncing, or a timeout event after
one minute.

// FREEBIE
2016-01-14 15:44:42 -08:00
Karel Bilek
d8381cfc47 Dispatch an event after processing a group sync
Related #521
2016-01-14 11:18:21 -08:00
lilia
96520e9fd4 Move envelope decode before ack
We should not ack envelope protobufs that fail to decode correctly. If
the server happens to send us such a thing it probably indicates a
protocol mismatch between it and the client, in which case the client
needs to update and re-receive the failed message.

// FREEBIE
2016-01-11 12:14:42 -08:00
lilia
44824df6cb Refactor for clarity
// FREEBIE
2016-01-11 11:00:44 -08:00
Matt Corallo
dac084b604 Send message ACKs immediately after recv, instead of after process 2016-01-11 10:55:53 -08:00
lilia
093eb001ff Correct log statement
Although in practice, these timestamps are often the same, they needn't
be, and when they aren't, we want the sentMessage.timestamp here.

// FREEBIE
2015-12-20 23:45:30 -08:00
lilia
d95f869d62 More logging
// FREEBIE
2015-12-17 16:42:54 -08:00
lilia
d201c65f7c More verbose logging in message receiver
// FREEBIE
2015-12-17 16:36:13 -08:00
lilia
bc576e18d5 Fix no delivery receipts on close session messages
// FREEBIE
2015-12-11 12:06:45 -08:00
lilia
9031b4c10c Update libaxolotl
Fixes #477

// FREEBIE
2015-12-08 10:51:52 -08:00
lilia
ea980b4385 Don't surface invalid attachment urls to the user
Log them, but don't put display them in user-facing error ui.

// FREEBIE
2015-12-07 16:52:45 -08:00
lilia
7b1268e5f7 Log incoming invalid attachment urls also
Same as previous commit but for incoming.

// FREEBIE
2015-12-07 16:43:59 -08:00
lilia
fe7505c050 Log invalid attachment urls
// FREEBIE
2015-12-07 16:07:10 -08:00
lilia
9c59dfda93 Remove duplicate case statement
This line was never being hit due to the duplicate one above (#L166).
Peeking at the server code shows that 403 is only given in response to
registration attempts, where it does in fact indicate an invalid code.

// FREEBIE
2015-12-05 11:07:31 -08:00
lilia
2f469835d9 Handle group quit sync messages
Previously, we would incorrectly reject group updates originating from a
linked device instructing us to remove ourselves from the group.

// FREEBIE
2015-12-04 11:25:19 -08:00
lilia
edcb28aebb Don't save a MessageCounterError
Fixes #446

// FREEBIE
2015-12-04 11:20:12 -08:00
lilia
b00d5289cf Save message timestamp for resending
Fix bug where resending due to failed network connection would fail
silently.

Broken in 7b6820 refactor which changed arguments to transmitMessage

// FREEBIE
2015-11-29 18:02:37 -08:00
lilia
e9949152bb Always return a promise from sendSyncMessage
// FREEBIE
2015-11-27 22:26:56 -08:00
lilia
acae4afce3 Handle invalid responses better
Depending on the response code, returning an HTTPError here will let us
retry later, if appropriate.

// FREEBIE
2015-11-27 22:26:56 -08:00
lilia
52b039a900 Remove unused function
This is now used only internally in libaxolotl, which provides its own
definition.

// FREEBIE
2015-11-27 14:40:20 -08:00
lilia
6445581594 Update libaxolotl
isEqual added to internal helper module

// FREEBIE
2015-11-27 14:40:19 -08:00
lilia
63cd3b2788 Use constant time mac comparison
In libtextsecure and in libaxolotl.

// FREEBIE
2015-11-27 14:40:17 -08:00
lilia
61439a886f Validate json responses
Perform lightweight validation on json responses from the server. Ensure
that the attributes we depend on have the right type.

// FREEBIE
2015-11-25 12:16:36 -08:00
lilia
b0d4370c2c Remove unused variable
// FREEBIE
2015-11-25 11:42:16 -08:00