Commit graph

2682 commits

Author SHA1 Message Date
Scott Nonnenberg
d1a9b62077 test/index.html: Restore previous location of code coverage stuff
I changed the location when trying to get code coverage to work properly
and it turned out not to be necessary for the fix.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
23a806a6b1 removeAllSessions: properly reject in failure cases
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
7ab20f09cc Fix focus issues with identity key send view
Tabbing right after entering the view would cause everythign to go crazy
as focus went back to the pane you were just on. This change both sets
the proper focus on load of that view (on the cancel button) and hides
other panes when they aren't active, only making them visible again when
they are once again the 'top' pane.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
ff4fde651c Make it clear in conversation just some recipients failed
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
c10e1b4ad0 Code coverage test run: Fix broken test
This test failed only under code coverage runs - because start up of the
page too took long!

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
5c990d2a35 Code coverage: Collect test coverage for the protocol layer
Because we were only doing a partial instrumentation run prior to this
change, un-instrumented code had references to un-instrumented code
(because Blanket's instrumentation re-runs the code once it is
instrumented, updating the window.NAME reference).

A big part of this was that libtextsecure was not instrumented. And for
good reason; it takes a long time to load and run, especially when
instrumented. But without covering it, we'll have an incomplete view
of our code coverage. So, all coverage collection remains off by
default.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
10f4f3fea5 Fix crash in keychange listener test
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
12914307f1 Improve experience when discovering identity key error on send
New experience in the Message Detail view when outgoing identity key
errors happen, matching the Android View.

'View' button is only shown on outgoing key errors right now.

When a contact with an outgoing identity key error is clicked, they are
taken to a view like the popup that comes up on Android: an explanation
of what happened and three options: 'Show Safety Number', 'Send Anyway',
and 'Cancel'

Contacts are now sorted alphabetically, with the set of contacts with
errors coming before the rest.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
b6cca41a0c Update verification-related strings to better match mobile app
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
f654532fa8 Handle UNVERIFIED sync verification messages (via contact sync)
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
20451cc827 Show verified/keychange notifications when actually relevant
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
3d445fe549 jshint: Introduce laxbreak to allow for if clauses on diff lines
(with the || or && operator at the beginning of the line)

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
e91f2d0377 Miscellaneous wire-up to ensure that failures propagate
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
293be5d9f6 Truncate long filenames in attachments
The :before technique for adding the icon was removed, because it
resulted in some rendering issues when the layout pressure in the
message bubble got too high - you would see a partial icon. This
solution shrinks the icon a bit when the filename wants to expand to
take its space.

The iOS bubble width also needed special care to ensure it didn't expand
to accommodate the very wide filenames. Beyond that, overflow: hidden
needed to be applied at several levels to make everything behave as
expected.

FREEBIE
2017-08-04 12:03:25 -07:00
lilia
877f092b2c Fix tests
saveIdentity now requires a full protocol address string

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
aa83bc1dab Ensure all sessions are archived on profile fetch
If the key has changed, saveIdentity will archive sibling sessions, but not the
session for the device it was called on. Therefore we have to archive that one
by hand.

Also switch from saving the identity of an OutgoingIdentityKeyError to just
triggering a profile fetch, mostly for consistency, simplicity, and DRYness.

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
3206536d47 Fix deadlock in saveIdentity
Archive only sibling sessions so as not to block on the same device lock as the
protocol lib.

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
e5e4eab9c5 Add archiveSiblingSessions
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
982e7f962c Update libsignal-protocol
// FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
e2ee63efaa m.get('sender') -> m.isIncoming(), filter in getLoadedUnreadCount
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
5b46ef3562 Show last seen indicator for keychange/verification notifications
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
1fedc75e5d Handle unverified length of zero
This can happen with unknown groups, where we don't know the list of
members but we're receiving messages. It's generally not a good
experience, but we shouldn't crash.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
224140c911 OutgoingMessage: Provide proper timestamp for replayability
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
5d1150e5bc Fix call to reloadDevicesAndSend - it returns a function
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
f414c13220 Protos: Update to optional verified in sync (was: repeated)
This means that we no longer need to iterate.

FREEBIE
2017-08-04 12:03:25 -07:00
lilia
fdce4cfc7c Fix failed identity key sync from contact sync
These were failing because ByteBuffers from the protobufs need to be converted
to ArrayBuffers. Fixed by useing the existing handler in MessageReceiver to
process verified messages from contact sync messages and dispatch them as their
own events, reducing some complexity on the application side.

// FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
78094102bd Message.send: Add promise to array for consistency
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
4ee4ad80c3 Message.send - check for missing identityKey, also add logging
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
551aa24e9a OutgoingMessage: A few code style tweaks to make things readable
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
116e4d2eeb OutgoingMessage: Reduce the calls to registerError
In some cases, due to promise chaining and error propagation, we were
calling registerError more than once for a given error. This would then
cause the overall callback for the send operation to be called with a
partial set of errors, as well as duplicates.

Note: we do need to find a way to attach identityKey to the
OutgoingIdentityKeyError in the case where it comes directly from the
encrypt() instead of our pre-key operations.

FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
30bc3fca3a MessageView: Be resilient to multiple renders of a network error
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
5e62d0cfd8 Update identity key after a send error tells us it has changed
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
22208ec3f8 Fix: Conversation.updateVerified fails when convo not yet in db
FREEBIE
2017-08-04 12:03:25 -07:00
lilia
9f4fcc5afa Send null messages to mask verified syncs
First construct a null message of random size and contents and send it to the
destination. Then include that same padding in the verification sync.

Note that the sync message is additionally randomly padded like all other sync
messages.

This lets Verified sync messages appear the same as normal sync message traffic.

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
bb9c97b960 Support for receiving null messages
Just log em for debugging. Also update the error messge thrown when we get a
content message with no supported properties. It may be empty or may just have
an unrecognized field.

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
243fd68904 Handle verified state from contact syncs
Treat it just like an isolated verified state sync

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
1e93b12b90 Update protos with support for null messages
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
6e758fc1ea Randomly pad all sync messages
WhisperSystems/libsignal-service-java@c46cdc0aa5

// FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
7bfb66b13b processVerifiedMessage: Archive all sessions when key changes
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
827addf628 Log on receipt of verified sync after we've processed the state
FREEBIE
2017-08-04 12:03:25 -07:00
lilia
d7054f4b63 Archive sessions whenever an identity key changes
Sessions established with the previous identity should no longer be used for
sending, so we should close them.

Since we've added this call to saveIdentity, we can omit the call to it after
profile fetches.

// FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
0056cbefc1 processVerifiedMessage: Trigger keychange event when key differs
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
0db2ef9e7f Refactor: combine Conversation.setVerified/setVerifiedDefault
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
d1fa28b706 Object.assign -> _.extend(), for to make Chrome 45 and below work
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
1e8ae774a2 Differentiate between local and remote trust decisions
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
20f4d48991 Protos: Move to latest iteration of verification protos
FREEBIE
2017-08-04 12:03:25 -07:00
Scott Nonnenberg
3360f65fac Protos: Update spacing to match libsignal-service-java
FREEBIE
2017-08-04 12:03:25 -07:00
lilia
3acfda3a56 Archive sessions on key changes after profile fetch
// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
4232f5711c Handle identity key change errors on encrypt
We need to capture key change errors from the protocol library when we call
encrypt. Previously we would only see these on session init.

// FREEBIE
2017-08-04 12:03:25 -07:00
lilia
5d5805526a Fix a test
Set the timestamp on the record to current time to ensure that
nonblockingApproval will be required.

// FREEBIE
2017-08-04 12:03:25 -07:00