Commit Graph

286 Commits (7f04439b37309e32c90abb4574a162343fb57f2e)

Author SHA1 Message Date
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 18378d8097 Fold nacl-common into components 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 c69c05c15d Remove obsolete argument 11 years ago
lilia 0ff3d438be Update libphonenumber
```
bower install
cd components/libphonenumber-api
./build.sh
grunt
```
Closes #54
11 years ago
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.
11 years ago
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.
11 years ago
lilia 8d323a4d71 Hooray for options 11 years ago
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.
11 years ago
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.
11 years ago
lilia 74bfc9d04e Wrap some long lines 11 years ago
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.
11 years ago
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.
11 years ago
lilia 79925fd227 Removed now unused copy of getRandomBytes 11 years ago
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.
11 years ago
lilia cd4b98d426 Remove 1mod8
27b5bf54cc
11 years ago
lilia db76c7e164 Initialize session.currentRatchet.previousCounter 11 years ago
lilia aa937ae1d1 Add attachment inputs to new conversation form
Fixes reference error to 'map' on undefined attachments list.
11 years ago
lilia f7d92ccb5b Bowerize backbone.localstorage 11 years ago
lilia 51de1d46c8 Update ByteBuffer.js
Such update. Very versioned, wow.
11 years ago
Arlo Breault bc5dea62c3 Use FileReader to base64 encode attachments
* Implements #82
11 years ago
lilia 6e3014895b Fix cryptojs hmac implementation
Apparently the bowerized version of cryptojs's WordArray.create doesn't
handle arraybuffers correctly.
11 years ago
lilia 6e86a2b7cf Switch libphonenumber to bower 11 years ago
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.
11 years ago
lilia ca7ba43b13 Fix overly hidden elements on registration page
Latest bootstrap css is really aggressive about hiding things.
11 years ago
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
11 years ago
lilia 9c568ed0b8 Don't warn on missing message bodies
A message can be blank if it has an attachment
11 years ago
lilia df0eaf622a Clean up test files
Moved all test code into /test. Renamed test.js to crypto_test.js.
(Let's try to keep test files topical.) Merged test_views.html and
test.html into a single test/index.html.

Todo: use Grunt to generate test/index.html from index.html and files
found in /test. Also, write more tests.
11 years ago
lilia 987744cd79 Default avatars
Someday you'll be able to edit your avatar. Until then, put a bird on
it.
11 years ago
lilia 2a7d3996bb Remove unused popup.html
And popup.js is now index.js, illustrating its importance as the titular
javascript file.
11 years ago
lilia 1c76c0b546 Move storage objects to their own files
Greatly reduce the size of the ignominiously named helpers.js.
11 years ago
lilia b92c5bb84e Unused function 11 years ago
lilia ddd6f1a944 remove another unused function 11 years ago
lilia 80e3fadcb1 Remove unused *MACWithVersionByte functions 11 years ago
lilia 39505c81b1 Finish up webcrypto integration, Fixes #72
We now correctly and opportunistically use the webcrypto API if
available, polyfilling if it's not detected. This change also includes a
layer of abstraction over the webcrypto interface so we no longer have
to deal with key-imports or algorithm names all over the place. Since we
no longer support AES-CTR, code outside this file can simply call
`textsecure.subtle.<encrypt|decrypt|sign>(key, data [, iv])`.
11 years ago
lilia 244e051fc3 Add importKey to webcrypto.js 11 years ago
Matt Corallo 37ef492642 Remove now-broken axolotl test 11 years ago
Matt Corallo 2e7b5b46e3 Remove AES-CTR entirely 11 years ago
Matt Corallo da0c63fb1b Add (untested) AES-CBC switch from v3 (fs loss resulted in old tested version being lost) 11 years ago
Matt Corallo 3a39602385 Fix borked spacing in webcrypto.js 11 years ago