Commit graph

535 commits

Author SHA1 Message Date
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
4518d03f43 Move protocol test to end of suite and extend timeout
The keygen test works without native client, but it takes a loooooong
tiiiiiiime.
2014-11-09 19:20:33 -08:00
lilia
c69c05c15d Remove obsolete argument 2014-11-09 18:58:05 -08:00
lilia
0ff3d438be Update libphonenumber
```
bower install
cd components/libphonenumber-api
./build.sh
grunt
```
Closes #54
2014-11-09 18:28:25 -08:00
lilia
1c4c47e7f3 Avoid breaking changes in qrcode library
Due to syntax errors in its bower.json.
https://github.com/davidshimjs/qrcodejs/pull/39
2014-11-09 18:28:25 -08:00
lilia
2f58ea5f3a Fixup curve25519 module
Rename methods on the curve25519 interface to be a bit more high level.
Cleanup emscripten wrapper class, wrap long lines and such. Also add a
grunt task alias for building the emscripten compiled curve
implementation.
2014-11-09 15:30:37 -08:00
lilia
a1a528ccdd Finish abstracting native client
Firstly, don't initialize textsecure.nativclient unless the browser
supports it. The mimetype-check trick is hewn from nacl-common.js.

Secondly, nativeclient crypto functions will all automatically wait for
the module to load before sending messages, so we needn't register any
onload callbacks outside nativeclient.js. (Previously, if you wanted to
do crypto with native client, you would have to register a call back and
wait for the module to load.) Now that the native client crypto is
encapsulated behind a nice interface, it can handle all that
onload-callback jazz internally: if the module isn't loaded when you
call a nativeclient function, return a promise that waits for the load
callback, and eventually resolves with the result of the requested
command. This removes the need for textsecure.registerOnLoadCallback.

Finally, although native client has its quirks, it's significantly
faster than the alternative (emscripten compiled js), so this commit
also lets the crypto backend use native client opportunistically, if
it's available, falling back to js if not, which should make us
compatible with older versions of chrome and chromium.
2014-11-09 15:23:23 -08:00
lilia
8d323a4d71 Hooray for options 2014-11-08 11:38:32 -08:00
lilia
59f22ecb26 Clean up after crazy emscripten fueled rager
Man you shoulda been there. Code was compiling all over the damn place.
It was wild.

Seriously though. Ignore that intermediate compiled file. What happens
in build stays in build.
2014-11-08 11:03:24 -08:00
lilia
30dd43a959 Remove stray debugging test 2014-11-08 10:58:56 -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
88b1f8839d Remove curve25519.js
This implementation isn't doing us any good since it doesn't have all
the stuff we need for v3.
2014-11-07 00:39:00 -08:00
lilia
054f027786 Remove unused stylesheets
Move the remaining to /stylesheets
2014-11-07 00:34:28 -08:00
lilia
cd888f66ef Build unminified manifest.css from sources 2014-11-07 00:32:58 -08:00
lilia
349e7e18f6 Add sass stylesheets 2014-11-07 00:17:27 -08:00
lilia
7c25ff845b Simplify a test
Protobufs are loaded already
2014-11-06 18:34:08 -08:00
lilia
74bfc9d04e Wrap some long lines 2014-11-06 18:13:54 -08:00
lilia
0a3c03025b Abstract nativeclient callback logic
The nativeclient.js module overrides
window.textsecure.registerOnLoadFunction with its own version. Otherwise
helpers will define a trivial placeholder for same.

The flag textsecure.NATIVE_CLIENT can be set anywhere ahead of
nativeclient.js, but is only acted on in nativeclient.js,
and crypto.js.
2014-11-06 17:58:48 -08:00
lilia
69c52d51b3 Abstract out curve25519 tests
Also rename the internal variable in crypto.js to be a little more
explicit about which curve we're dealing with.
2014-11-06 14:54:36 -08:00
lilia
df0e52a893 Split crypto_test into crypto, protocol and helpers tests 2014-11-06 14:33:16 -08:00
lilia
79925fd227 Removed now unused copy of getRandomBytes 2014-11-06 04:42:49 -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
cd4b98d426 Remove 1mod8
27b5bf54cc
2014-11-06 00:49:55 -08:00
lilia
db76c7e164 Initialize session.currentRatchet.previousCounter 2014-11-03 19:01:18 -08:00
lilia
aa937ae1d1 Add attachment inputs to new conversation form
Fixes reference error to 'map' on undefined attachments list.
2014-11-03 17:51:57 -08:00
lilia
f7d92ccb5b Bowerize backbone.localstorage 2014-11-03 17:27:44 -08:00
lilia
51de1d46c8 Update ByteBuffer.js
Such update. Very versioned, wow.
2014-11-03 15:29:56 -08:00
Arlo Breault
bc5dea62c3 Use FileReader to base64 encode attachments
* Implements #82
2014-11-03 15:01:52 -08:00
lilia
6e3014895b Fix cryptojs hmac implementation
Apparently the bowerized version of cryptojs's WordArray.create doesn't
handle arraybuffers correctly.
2014-10-31 21:10:02 -07:00
lilia
6e86a2b7cf Switch libphonenumber to bower 2014-10-31 20:59:30 -07:00
lilia
8e48d95cb4 Switch crypto js to bower via google code svn
Plus grunt task to build CryptoJS from these sources.
2014-10-31 20:43:36 -07:00
lilia
0cc0b8cc72 Switch tagsinput to bower 2014-10-31 00:40:00 -07:00
lilia
6b034e951a Make the concat list explicit
Since I decided to preen mocha and chai, we can no longer generate the
concat file list from the preen config. We must instead explicitly list
the modules we want to concatenate. I placed this config in bower.json
so that most of the time, we won't need to change the Gruntfile.

Also added a concatenation task for test page dependencies.
2014-10-30 18:33:37 -07:00
lilia
756fdd2383 Preen mocha and chai. todo: fix concat 2014-10-30 16:55:48 -07:00
lilia
508c59e05c Rename bower_components
To components. Because tab-completion works better when there aren't two
things starting with bower, and shorter names are nicer to deal with in
general.
2014-10-30 16:53:08 -07:00
lilia
3a1789104e Missed qrcode source 2014-10-30 15:07:51 -07:00
lilia
0c1ef92795 README note about deps and wrap some lines 2014-10-30 15:05:39 -07:00
lilia
a79fb363aa Let npm install bower
One less step for new contributors who need to add dependencies.
2014-10-30 14:47:50 -07:00
lilia
e02098eefb README updates 2014-10-30 14:41:29 -07:00
lilia
ca7ba43b13 Fix overly hidden elements on registration page
Latest bootstrap css is really aggressive about hiding things.
2014-10-30 14:20:42 -07:00
lilia
2ec6a66daf Move qrcode lib to bower 2014-10-30 14:14:20 -07:00
lilia
31db562ec4 Remove old underscore 2014-10-30 02:04:18 -07:00
lilia
6e739a8a77 Add mustache to bower 2014-10-30 01:52:06 -07:00
lilia
0c5e67d469 rm old jquery 2014-10-30 01:48:40 -07:00
lilia
b351e8cea0 Switch mocha and chai to bower components 2014-10-30 01:47:50 -07:00
lilia
e156c2c0dd Use jquery with native transport support
The jquery mainline is lagging on support for responseType:
'arraybuffer', an XHRHTTPRequest Level 2 feature (whatever that means).
We use this responseType to transfer attachments.

I rebased https://github.com/jquery/jquery/pull/1525 on the 2.1.1
release and cut 2.1.1-ajax-nativetransport in my own fork.
2014-10-30 01:32:27 -07:00
lilia
800e5ab703 Pass protobuf attachment ids as strings
Latest protobuf.js requires that we pass in the sign value when making
longs from strings, ex: dcodeIO.Long.fromString(id, true);

However, it does the string->long conversion automatically if its given
a string for a fixed64 field, so we can pass our string ids right in!
ftw
2014-10-29 23:18:29 -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