Commit graph

800 commits

Author SHA1 Message Date
lilia
3e73f8f0ba Resolve conflicts in series
Attempting to resolve outgoing conflicts in parallel triggers multiple
requests for new keys from the server and causes it to return a 500
error.
2015-08-03 11:02:54 -07:00
lilia
f3f084398f Handle identity key errors when retrying decrypt
After setting a new identity key as trusted, we retry decryption on all
pending conflicts for that contact. If their identity changed twice in a
row, we can still get a conflict the second time, and should handle it
appropriately.
2015-07-31 17:28:25 -07:00
lilia
ccfae3c78a Fix bug in identity key conflict edge case
When resolving conflicts, we should not only discard the old key, but
set the new trusted key to the one the user has verified. Previously, we
would end up trusting the first-seen new key, which may not be the one
the user verified.

 // FREEBIE
2015-07-31 17:01:03 -07:00
lilia
d808d255eb Fix bug with 0th contact color
Contact color css class wasn't being rendered because 0 is falsey.

// FREEBIE
2015-07-31 17:01:03 -07:00
lilia
47b58b8994 Use the correct number of contact colors
Bugfix from 2f12275
2015-07-31 11:13:30 -07:00
lilia
4fc4573de4 Don't try to sync after single device registration
There's no other device to sync to. :p
2015-07-31 11:11:23 -07:00
lilia
2f12275cb9 Update contact colors
Make default contact color assignments consistent with
WhisperSystems/Textsecure@99d3a76b
2015-07-31 11:07:42 -07:00
lilia
b3d93ab334 Request group sync when pairing
Whoops, missed a step. Fixes #319. Fixes #276.

// FREEBIE
2015-07-29 19:06:19 -07:00
adambar
d93bacb76e Fix for too eager scrolling to bottom when the scroll isn't actually stick to the bottom before resizing the window 2015-07-29 15:28:08 -07:00
adambar
1498d90b58 Maintain bottom-most scroll position when resizing conversation area, once again.
Related with #278. Redone to include keeping scroll at the bottom when resizing the window, as suggested in #305, and to better fit the current code structure.
2015-07-29 15:28:08 -07:00
lilia
56b6375f97 Use new provisioning socket keepalive path
This new endpoint should always issue a response to a provisioning
socket so if we don't receive one we should assume the connection has
been lost.

Closes #318
2015-07-29 13:37:17 -07:00
lilia
2b563212b4 Change default for keepalive autodisconnect config
By default, automatically disconnect if no response. This is preferable
because we can sometimes lose connectivity without receiving a close
event from the socket, but it's also possible that the endpoint may not
support responses.

// FREEBIE
2015-07-29 11:30:58 -07:00
lilia
fdad87b6a0 Add minimum window dimensions
Fixes #310

// FREEBIE
2015-07-29 11:30:58 -07:00
lilia
1a06cb5cbe Update consumers of WebsocketResources 2015-07-28 14:58:55 -07:00
lilia
1af8bd16b7 Add default response message to websocketresources
// FREEBIE
2015-07-28 14:57:09 -07:00
lilia
637cbcbf99 Make handleRequest optional in WebSocketResources
If no request handler is provided, respond with 404 to any incoming
requests.
2015-07-28 13:48:27 -07:00
lilia
cd363bd84d Integrate keepalives into websocket resources 2015-07-28 13:07:34 -07:00
lilia
7d2b41db11 Add auto-disconnect config to keepalive constructor
Disconnects on no keepalive response by default.

// FREEBIE
2015-07-27 20:17:00 -07:00
lilia
d9fe783488 Accept close code/message via websocket/resources 2015-07-27 19:30:51 -07:00
lilia
8170a7baae WebSocketResource exposes socket.close()
Allows for simplification of the keepalive construct.
2015-07-27 18:51:48 -07:00
lilia
98edd3939b Fix up websocket options handling 2015-07-27 18:50:55 -07:00
lilia
d9d4e281cc Keepalive provisioning socket
Fixes #315

// FREEBIE
2015-07-27 18:16:47 -07:00
lilia
0d0bdbf998 Don't auto-reconnect provisioning socket
// FREEBIE
2015-07-27 18:01:22 -07:00
lilia
15cd348bf2 Remove nonexistant variable 2015-07-27 18:01:21 -07:00
lilia
1f8856fa69 MessageReceiver accepts a server websocket url
// FREEBIE
2015-07-23 16:10:43 -07:00
lilia
fd5b0aeb85 Set lastmessage text on convo's with no timestamp 2015-07-22 15:24:03 -07:00
lilia
17e515f886 Add identity key conflict tests 2015-07-22 12:48:08 -07:00
lilia
c05be725b3 Move makeAttachmentPointer
Clean up unnecessary pre-declaration of `var makeAttachmentPointer`.
2015-07-21 16:00:16 -07:00
lilia
67f25214d3 Refactor outgoing identity key conflict handling
saveKeysToDeviceObject is the detector of outgoing identity key errors.
Catch these key errors closer to the source by pulling the
getKeysForNumber into the context of sendMessageToDevices, which lets
it access registerError and the message protobuf.

Previously identity key errors would be uncaught if all existing
sessions with a recipient were closed/deleted, since we would
preemptively fetch the new identity key. The old error handling only
kicked in after a 409/410 response from the server when posting a
message encrypted for a stale session.

// FREEBIE
2015-07-21 16:00:09 -07:00
lilia
27016e1919 Let textsecure devices throw on identity key change
Restore error format, accidentally removed in 43d6efcd

// FREEBIE
2015-07-21 15:50:11 -07:00
lilia
4e88d4a5cf Add missing semicolons 2015-07-20 16:13:50 -07:00
lilia
c28b5408ab Plumb keys into outgoing conflicts 2015-07-20 16:13:17 -07:00
lilia
0815a96c1d Display the new key for verification after a conflict 2015-07-20 14:27:11 -07:00
lilia
cc303e0802 Update libaxolotl, handle untrusted identitykey
Previously we had no access to the new untrusted identity
for verification purposes.

// FREEBIE
2015-07-20 14:25:02 -07:00
lilia
af48ca9e4b Update libaxolotl, remove one string conversion
Previously we would convert a bytebuffer to a string, pass it to
libaxolotl where it would be parsed back into a bytebuffer.

Ideally we would just pass the bytebuffer, but it turns out that
libaxolotl's bytebyffer class is identical but separate from
libtextsecure's bytebuffer class. ¯\_(ツ)_/¯

So instead we pass the underlying array buffer, which is handled
more or less the same way as a bytebuffer, and most importantly,
does not involve any copying.

// FREEBIE
2015-07-20 14:24:19 -07:00
lilia
1ab5af338a Update libaxolotl, un-revert b790f82849
Accidentally reverted in d3c158f
2015-07-20 12:31:31 -07:00
lilia
7d3d634a2d Move/refactor keepalive logic and add disconnect timer
We now disconnect ourselves if we don't get the server's response to a
keepalive request within 30s. This way we will eventually disconnect if
the network goes away but the socket is not closed.*

* See code.google.com/p/chromium/issues/detail?id=197841 and
https://stackoverflow.com/questions/11755605/chrome-websocket-connection-not-closed-when-browser-closed

We will then try to reconnect once a minute (See 8a10c96);

Keepalives belong at this level anyway, since the format is defined by
both the websocket resource protocol and our specific server url
structure.

// FREEBIE
2015-07-16 15:01:34 -07:00
lilia
8a10c96ab4 Reconnect once a minute if internet is down 2015-07-16 14:56:37 -07:00
lilia
f6b5eec84e Let key verification view use array buffers 2015-07-16 12:14:09 -07:00
lilia
17a3025af2 Mark end session messages sent 2015-07-16 12:14:09 -07:00
lilia
c94c4bc7e0 Remove redundant identity key updates
We were re-saving the key when it did not conflict with the exisiting
value.
2015-07-16 12:14:06 -07:00
lilia
2e272b6894 Turn off idb query logging
++speed
2015-07-16 12:13:45 -07:00
lilia
9dfff879b6 Remove usage of extension.trigger
This trigger function uses chrome's runtime message passing api, which
traverses between different windows in our runtime, but we only trigger
the updateInbox event from the backgroud page, so we don't need to use
that api, which requires some extra cpu/memory overhead.

// FREEBIE
2015-07-16 12:13:45 -07:00
lilia
2ad422afc8 Convert to array buffer 2015-07-16 12:13:43 -07:00
lilia
1f8040998f Fix up array buffer comparison
Well that didn't work. Luckily this comparison is primarily enforced at
the libaxolotl level.

With this and the corresponding change to libaxolotl, remote identity
keys are always going to be stored as array buffers going forward. This
will cause incompatibility with existing keys stored as strings, so
updating to this point requires you to purge your identity key and
session store.
2015-07-16 12:13:11 -07:00
lilia
853b578551 Change default value for active_at
We're overriding the default with null often enough that we should
just change the default.

Consequently, no more phantom blank conversations with oneself should
appear after receiving a group update. They were being added to the
inbox because they were incorrectly initialized with an active_at value.

Fixes #281
2015-07-14 16:44:08 -07:00
lilia
809c9bdb57 Save outgoing group updates 2015-07-14 16:41:25 -07:00
lilia
971079980e Close stale windows on background refresh
All the old event listeners and in-memory objects have perished with the
old background page. Also reopen the inbox if it was already open.

Fixes #289

// FREEBIE
2015-07-14 13:39:37 -07:00
lilia
815b79dc64 Cleanup 'Too many devices' dialog
Closes #263
2015-07-14 13:39:37 -07:00
lilia
a3ae3cab79 Use Promise.reject for simplicity
The following are equivalent, except that the first is longer and
invokes an extra function call.

```
return new Promise(function(resolve, reject) {
  reject(new Error("Unknown Group"));
});

return Promise.reject(new Error("Unknown Group"));
```
2015-07-14 13:39:36 -07:00