Commit Graph

35 Commits (8d56a1b24833596048bec01a3d690ad1293645ef)

Author SHA1 Message Date
lilia 5a0e199fc5 Namespace registration helpers 11 years ago
lilia 4119c13ba2 Registration ux tweaks 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 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 ca7ba43b13 Fix overly hidden elements on registration page
Latest bootstrap css is really aggressive about hiding things.
11 years ago
lilia 2bd77693e1 Refactor options page and style using bootstrap 11 years ago
lilia 81e4af5827 Move phonenumbery utils to libphonenumber object
Slowly whittling away at helpers.js...
11 years ago
lilia 75e78caec8 Function-wrap options.js 11 years ago
lilia 683c373943 Relaxes verification code validation
When codes are sent they are formatted as xxx-xxx. Previously when I
would paste these from GVoice they failed validation thanks to the dash
and whatever whitespace I happened to grab.
11 years ago
Matt Corallo 90eb9cb0c8 Remove ping, update to latest spec proposal 11 years ago
Matt Corallo a6b0d1f84b Add entirely untested secondary device init 11 years ago
Marco 13a9329bcf improved number validation (based on google's libphonenumber) 11 years ago
Marco 5cddcb59aa improved some css for options.html 11 years ago
Matt Corallo 5cea7b6857 Few typos blocking registration 11 years ago
Matt Corallo 56433bd9af One more tiny error refactor 11 years ago
Matt Corallo 68131a6e2a Add human readable version of errors 11 years ago
Matt Corallo 753a950816 Redo registration process 11 years ago
Matt Corallo 18f1eed70f Some number verification refactor stuff 11 years ago
lilia de0a1df3ca Fix broken registration flow
Better load the functions defined in chromium.js before trying to use
them. Hmm.. also, options.js should probably wait for the DOM to load
before it tries to initialize things in it.
11 years ago
Matt Corallo d9bf0a41fb textsecure.storage, chromium.js 11 years ago
Matt Corallo 6bc19ef558 More namespacing 11 years ago
Matt Corallo 05101b69b0 Some initial helpers.js namespaceing 11 years ago
Matt Corallo e3097746c0 Check registration ID on prekeymsg 11 years ago
Matt Corallo 8d408e6d8f THOUGH SALL USE TABSTOP AND SHIFTWIDTH 4 (so that indents read right) 11 years ago
lilia e3b00e08f3 Generate and submit registrationId, fixes #25
If we're expecting to get registrationIds from others, it's only fair
that we also supply our own.
11 years ago
Matt Corallo 5752a772d1 promises, type conversion errors 11 years ago
Matt Corallo caa363b929 FINALLY report crypto, etc errors to console thanks to promises... 11 years ago
lilia 1d95fcc027 Fix exception in options.js on first run
Fixes #22 Uncaught ReferenceError: getRandomBytes is not defined
options.js:41
11 years ago
Matt Corallo 3e60368a16 LGPL license (I'd like to be an axolotl/TS JS lib in the future) 11 years ago
Ventero 3d7db4dbc3 Correctly extract string data for password.
btoa expects a string argument, so when passing it the ArrayBuffer
object returned by getRandomBytes(), it's converted to a string by
calling .toString() on it. This always results in "[object ArrayBuffer]",
effectively resulting in a completely non-random password.
11 years ago
Matt Corallo 000a5e1440 Fix up a few things so registration works 11 years ago
lilia be52e4c3a4 Fix infinite recursion in ensureStringed(Array)
To ensureStringed(thing), you must first ensureStringed(thing)...
This was causing an infintel loop in multidevice mode.
11 years ago
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.
11 years ago
Matt Corallo 8db3885659 Updates, NaCL 11 years ago
Matt Corallo eec4c66ef6 Fixup dir structure 11 years ago