Commit graph

45 commits

Author SHA1 Message Date
lilia 3279dddcc3 Consolidate window logic in panel controller
Previously the conversation window would query the background page
for a model id and then fetch the conversation. Instead, we can fetch
the conversation before opening the window, which simplifies the front
end scripts and avoids creating multiple copies of the same model.
2015-02-12 13:21:17 -08:00
lilia 44b1e5c88e Move inbox collection to the background page
No more waiting, no more messy fetch logic. Background page
bootstraps the inbox and keeps it up to date.
2015-02-12 13:21:17 -08:00
Riley Shaw 94ce4d4b91 Simplify panel state management and message passing 2015-02-11 17:37:56 -08:00
Riley Shaw 783a3f7c15 Prevent duplicate conversations and refocus on click (still buggy) 2015-02-11 17:37:56 -08:00
Matt Corallo e7f3e52b6c Remove NaCL! 2015-01-14 11:39:36 -10:00
Matt Corallo 5785f4033c Compile curve25519/webcrypto into libtextsecure.js 2015-01-14 09:35:57 -10:00
Matt Corallo 8ad1a38b5b Move js files around for libtextsecure split 2015-01-14 09:35:57 -10:00
Matt Corallo d9db0f53e7 s/\t/ /g in {background,options}.html 2015-01-06 14:51:59 -08:00
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.
2014-12-18 20:00:14 -08:00
lilia 7b23e24b71 Add stringview license info and script tags
Closes #94
2014-12-03 01:36:10 -08:00
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.
2014-11-29 11:43:30 -08:00
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.
2014-11-24 19:25:03 -08:00
lilia 18378d8097 Fold nacl-common into components 2014-11-10 01:35:15 -08:00
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.
2014-11-09 21:52:33 -08:00
lilia b4f4f87a7c Add emscripten-compiled curve25519 module
Build with `grunt compile && grunt concat:curve25519` after installing
emscripten.

Enable by either (a) not loading nativeclient.js or (b) setting
`textsecure.NATIVE_CLIENT = false` before loading nativeclient.js.
2014-11-08 10:56:30 -08:00
lilia 3d27c98845 Remove stray curve25519.js include 2014-11-08 10:46:04 -08:00
lilia 9f676af9bb Refactor crypto.js and native client interface
NB: this diff is best viewed with --ignore-whitespace

Distills crypto.js down to the hard cryptoey bones. It pulls from
webcrypto for aes and hmac, and from native client for curve25519 stuff
or potentially another object implementing the handful of needed
curve25519 functions.

Everything else formerly known as crypto, including session storage and
management, axolotl, etc.. is now protocol.js. The separation is not
quite perfect, but it's a big step.

nativeclient.js now enables talking to the native client module through
a high level interface as well as registering callbacks that will be
executed once the module is loaded. And it has tests!

Finally, this commit removes all references to the "testing_only"
object, preferring to run tests on textsecure.crypto instead.
2014-11-06 04:33:43 -08:00
lilia f7d92ccb5b Bowerize backbone.localstorage 2014-11-03 17:27:44 -08:00
lilia 6e86a2b7cf Switch libphonenumber to bower 2014-10-31 20:59:30 -07:00
lilia 73f4f64351 Grunt preen and concat
Set up grunt with tasks for:
  * preen - deletes unused files from bower_components, configured in
      bower.json
  * concat - concatenates preened bower components, configured
      automagically from the preen config

It's worth noting that this setup assumes the order of files within a
package doesn't matter. This is usually true since we often include only
one file from the package.
2014-10-29 20:50:51 -07:00
lilia c8ad65efe0 Switch to bower dependencies
Checks in only the files we actually need from bower_components.
2014-10-29 20:50:51 -07:00
lilia 1c76c0b546 Move storage objects to their own files
Greatly reduce the size of the ignominiously named helpers.js.
2014-10-28 22:47:48 -07:00
lilia 1023ea1732 Refactor textsecure.protos -> textsecure.protobuf
DRY up protobuf declarations and move to a slightly briefer naming
convention.

Also dropped some ArrayBuffer -> string conversions as
ProtoBuf.js handles ArrayBuffers just fine, and in fact, more
efficiently than strings.

Finally, dropped the btoa() wrappers, because that incurs an extra
string -> string conversion before the protobuf's internal string ->
array buffer conversion. In lieu of btoa, we can simply pass in the
optional string encoding argument to the protobuf's decode method,
which in these cases should be 'binary'.

Related: #17
2014-10-20 15:11:16 -07:00
lilia 13c06a26f9 Add phone number utils to background page
Quickfix.
Probably it shouldn't actually be verifying any phone numbers.
2014-10-16 14:26:16 -07:00
Matt Corallo 28d1f370cd mkdir nacl 2014-07-20 16:29:42 -04:00
Marco 13a9329bcf improved number validation (based on google's libphonenumber) 2014-06-29 16:39:05 -07:00
Matt Corallo 6ae95107c0 Merge pull request #47 from rpicard/minify-deps
Minify CryptoJS dependencies with uglify-js
2014-06-03 20:08:50 +00:00
Matt Corallo d0fd3e94d8 sendMessage refactor, initial group stuff (breaks message storage) 2014-06-03 15:28:30 -04:00
Robert Picard 2d700e2104 Covert spaces to tabs 2014-06-03 12:03:29 -07:00
Robert Picard 5f827fbbf7 Minify CryptoJS dependencies
Closes #18
2014-06-03 11:45:30 -07:00
Matt Corallo cf35b7056f Retry API, standardize <script> list 2014-06-01 13:39:35 -04:00
lilia 83508abab8 Thread model and UI improvements
Adds thread model/collection for managing conversation-level state, such
as unreadCounts, group membership, thread order, etc... plus various UI
improvements enabled by thread model, including an improved compose
flow, and thread-destroy button.

Adds Whisper.notify for presenting messages to the user in an orderly
fashion. Currently using a growl-style fade in/out effect.

Also some housekeeping:
Cut up views into separate files.
Partial fix for formatTimestamp.
Tweaked buttons and other styles.
2014-05-26 15:33:45 -07:00
lilia 6064afd43d Fix Uncaught ReferenceError: isRegistrationDone is not defined 2014-05-22 21:34:28 -07:00
Matt Corallo d9bf0a41fb textsecure.storage, chromium.js 2014-05-20 22:21:07 -04:00
lilia b852e68290 Backbone message storage and views
Adds Backbone-based Whisper.Messages model/collection with local storage
extension. Saves sent and received messages in Whisper.Messages instead
of message map. This will assign a unique id to the message and save it
to localStorage.

Adds Backbone-based view to popup.html
  Automatically updates itself when new messages are saved to
  Whisper.Messages db from the background page.

Added some shiny new styles, and started splitting up css into multiple
files for sanity's sake.
2014-05-17 20:26:50 -07:00
lilia 41d50d7480 Lilia's Webcrypto branch rebased and a few very tiny tweaks 2014-05-06 23:45:55 -04:00
Matt Corallo 3e60368a16 LGPL license (I'd like to be an axolotl/TS JS lib in the future) 2014-05-04 02:34:13 -04:00
Matt Corallo 136a8941c1 Things:
* key API changes moxie made because he disliked the other API
 * remove atmosphere
 * Fix some bugs in the send path, update for new send API
 * Send HTML
2014-03-25 15:27:19 -04:00
lilia fe1b5435aa Add FakeWhisperAPI for serverless development
When included after api.js, fake_api.js inits a FakeWhisperAPI.

FakeWhisperAPI inherits the methods of API, overrides a few, and
then usurps its place as the one true API.

Single device mode successfully "registers" against FakeAPI. Sadly,
multidevice mode has a recursive loop somewhere that makes the callstack
asplode.
2014-03-20 00:57:29 -07:00
lilia 6934ba0b92 Refactor Server API functions
The details of the server API are now mostly relegated to api.js, and
accessed through the API container object, improving modularity and
readability, and setting us up to derive a FakeAPI for serverless
development.
2014-03-15 19:57:40 -07:00
Matt Corallo b8357a6464 Unmiified js files, mostly 2014-03-09 17:54:44 -07:00
Matt Corallo fee6a69083 Optional curve25519 in js 2014-03-09 20:32:00 -04:00
Matt Corallo 8db3885659 Updates, NaCL 2014-01-22 06:23:41 +00:00
Matt Corallo eec4c66ef6 Fixup dir structure 2014-01-22 03:28:35 +00:00
Matt Corallo b4ab726727 Missing background.html 2014-01-12 04:07:30 -10:00