Commit Graph

433 Commits (6cbde7894ab9633aff43e816a84d3188c4f079b2)
 

Author SHA1 Message Date
lilia 6cbde7894a Delivery receipts 10 years ago
lilia 1a4811fcef Fix tests 10 years ago
lilia 006653ed8e DB/Index Redux
This change removes the timestamp field from messages and conversations
in favor of multiple semantically named timestamp fields: sent_at,
received_at on messages; active_at on conversations. This requires/lets
us rethink and improve our indexing scheme thusly:

The inbox index on conversations will order entries by the
conversation.active_at property, which should only appear on
conversations destined for the inbox.

The receipt index will use the message.sent_at property, for effecient
lookup of outgoing messages by timestamp, for use in processing delivery
receipts.

The group index on conversation.members is multi-entry, meaning that
looking up any phone number in this index will efficiently yield all
groups the number belongs to.

The conversation index lets us scan messages in a single conversation,
in the order they were received (or the reverse order). It is a compound
index on [conversationId, received_at].
10 years ago
lilia 9c736df7d0 Handle incoming identity key changes
This ended up turning into a rewrite/refactor of the background page.
For best results, view this diff with `-w` to ignore whitespace. In
order to support retrying message decryption, possibly at a much later
time than the message is received, we now implement the following:

Each message is saved before it is decrypted. This generates a unique
message_id which is later used to update the database entry with the
message contents, or with any errors generated during processing.

When an IncomingIdentityKeyError occurs, we catch it and save it on the
model, then update the front end as usual. When the user clicks to
accept the new key, the error is replayed, which causes the message to
be decrypted and then passed to the background page for normal
processing.
10 years ago
lilia 5762e59c41 DRY up registration event callbacks
This was just a special case of the extension.on/trigger interface.
10 years ago
lilia e68720f07f Frontend support for ReplayableErrors
Eventually we'll store errors on the message model, and this change will
let us render and process them.
10 years ago
lilia 4a401f07f3 Rewrite ReplayableErrors
ReplayableErrors make it easy for the frontend to handle identity key
errors by wrapping the necessary steps into one convenient little
replay() callback function.

The frontend remains agnostic to what those steps are. It just calls
replay() once the user has acknowledged the key change.

The protocol layer is responsible for registering the callbacks needed
by the IncomingIdentityKeyError and OutgoingIdentityKeyError.
10 years ago
lilia 14c53ff710 Support for lower-level queries on indexedDB
superfeedr has done a nice job with this backbone -> indexedDB adapter,
but their query interface is somewhat limited. This commit adds an
alternate interface that lets us specify the index and cursor bounds we
want. This interface requires deeper knowledge of indexedDB indices, but
is more powerful overall.
10 years ago
lilia 8c93101989 Don't store conversationType on messages
This was used to conditionally render messages in the group style, but
it's actually unnecessary. We can render the same markup in both cases
and change the appearance with css.
10 years ago
lilia 27fa391112 Indentation 10 years ago
Daniel Reichert 5114fa1f0a Update name and repository in package.json 10 years ago
lilia 2209407d5e Keepalive endpoint 10 years ago
lilia 4f97f8c1e4 Incoming request bodies are no longer base64
Since the socket is not a text-based transport, there's no need to
base64-encode the IncomingPushMessageSignal.
10 years ago
lilia 2ba88bd13a Shorten keep alive interval. Closes #97 11 years ago
Daniel Reichert 46ec7c966f Add test coverage of isEqual function 11 years ago
lilia 8257fa7478 Add support for deleting a conversation
Note that the conversation record is not actually destroyed,
merely marked inactive, preserving the contact name, photo,
etc...
11 years ago
lilia 7b23e24b71 Add stringview license info and script tags
Closes #94
11 years ago
Daniel Reichert db5683a69d Move Base64 functions to their own file
Remove Base64 string functions from helpers.js

Rename Base64 string functions

Removed unused functions from stringview.js
11 years ago
lilia ee0d7edc0b WebSocket-Resources / websocket refactor
This commit provides the javascript complement to
[WebSocket-Resources](https://github.com/WhisperSystems/WebSocket-Resources),
allowing us to use a bi-directional request-response framework over
websockets.

See websocket-resources.js and websocket-resources_test.js
for usage details.

Along the way I also factored the websocket keepalive and reconnect
logic into its own file/wrapper object.
11 years ago
lilia ccbe837ca2 Rebind events when opening a previously opened conversation 11 years ago
lilia 99a2685f93 Store attachments as binary blobs
Move base64 encoding of attachments to an AttachmentView. This makes
image rendering an asynchronous task so we fire an update event to
indicate to the parent MessageListView that its content has changed
height and it is time to scroll down.
11 years ago
lilia bf22da209f Fix tests 11 years ago
lilia d1c5b6da7a Get rid of Layout global
Instead, trigger and listen for events on the conversation collection
object.
11 years ago
lilia a835887459 Fix scroll when re-opening a conversation 11 years ago
lilia fd3a72d435 Destroy all globals
Well, not *all* globals..
11 years ago
lilia c0681beca7 Consolidate message callbacks
Register the runtime callback at the top level view rather than having
each conversation view register independently.
Also refactors Layout into InboxView.
11 years ago
lilia 470346c9c4 Save incoming messages and pass to frontend asynchronously
After a message is saved asynchronsly, fire an event and pass the
message attributes to frontend listeners via the chrome-runtime API.

This behavior is similar to the 'storage' event fired by localStorage.
11 years ago
lilia ced295a630 Move message and conversation storage to IndexedDB
Getting up and running with IndexedDB was pretty easy, thanks to
backbone. The tricky part was making reads and writes asynchronous.
In that process I did some refactoring on Whisper.Threads, which
has been renamed Conversations for consistency with the view names.

This change also adds the unlimitedStorage permission.
11 years ago
Arlo Breault 5638b20046 Expose test results to sauce
* Do what blanket does, adding another level of indirection in the
   reporting.
11 years ago
lilia 94634fc77a Remove nativeclient from test page
Native client won't work on Sauce. Removing for now. TODO: find a
way to gracefully disable native client in the Sauce environment.
11 years ago
lilia cc28120582 Add secure environment vars for travis 11 years ago
Arlo Breault 693e9a1e0e Add the build status 11 years ago
Arlo Breault 8d56a1b248 Run tests on Sauce Labs
* Issue #57
11 years ago
Daniel Reichert 6125f7cbbb Add basic test coverage of toArrayBuffer function 11 years ago
lilia 7f04439b37 New websocket protocol 11 years ago
lilia 9364cee578 Misc cleanup threads 11 years ago
lilia b9859ad9d4 Add some license headers 11 years ago
lilia 735737f0bc Merge Whisper.Messages into Whisper Threads
Eliminates the global Whisper.Messages object and consolidates shared
send/receive logic in Whisper.Threads.

To the latter end, note that the decrypted array buffer on an attachment
pointer is now named data instead of decrypted, in order to match the
format of outgoing attachments presented by
FileReader.readAsArrayBuffers and let us use the same handler to base64
encode them.
11 years ago
lilia 5a0e199fc5 Namespace registration helpers 11 years ago
lilia 28290477f4 Nicer timestamps with momentjs
This dependency may be a little heavy for our current use case, but we can
roll with it for now and find something slimmer if it turns out yagni.

Closes #77
Closes #40
11 years ago
Sumit Bindal d537d6a91f Fixing lint errors
Fixing JSLint Problems
11 years ago
lilia 0956d328da Fixes #71 Autoscroll
Conversation view autoscroll triggers on dom change, not storage change,
ensuring that we don't scroll before the new element is inserted.
11 years ago
lilia 13446e9c17 "Fix dirty hack" (runtime.reload) in chromium.js
Runtime reload is overkill and causes a jarring ux. Instead, send and
receive messages across the runtime. Also, if we need to jump between
the main ui and options pages, simply navigate within the current tab
rather than spawning a new one.
11 years ago
lilia 4119c13ba2 Registration ux tweaks 11 years ago
lilia 3eb98ddc3b Fix options page stylesheet path 11 years ago
lilia 18378d8097 Fold nacl-common into components 11 years ago
lilia db69bacff1 Do fewer string conversions in tests 11 years ago
lilia 1ad898a62e Simplify webcrypto type conversion
Previously we'd get a WordArray and convert to string before converting
to array buffer. Instead, go directly to array buffer.
11 years ago
lilia e190582d9e Build CryptoJS components into webcrypto.js
We only depend on cryptojs for this webcrypto polyfill, so let Grunt
concatenate them into one file.

The reference in the getString helper isn't needed since we use the
built in string converters on CryptoJS's word arrays.
11 years ago
lilia 4518d03f43 Move protocol test to end of suite and extend timeout
The keygen test works without native client, but it takes a loooooong
tiiiiiiime.
11 years ago