a1a528ccdd
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. |
||
---|---|---|
build | ||
components | ||
images | ||
js | ||
js-deps | ||
nacl | ||
protos | ||
stylesheets | ||
test | ||
.bowerrc | ||
.gitignore | ||
background.html | ||
bower.json | ||
Gruntfile.js | ||
icon.png | ||
index.html | ||
LGPL | ||
manifest.json | ||
options.html | ||
package.json | ||
README.md | ||
X11 |
TextSecure Chromium Implementation
This is very early stuff and exists primarily to get the crypto in place. This does not currently work, dont bother trying to use it seriously yet
Getting Started with Development
These steps are for development only.
- Clone the repo
- Open Chrome
- Go to chrome://extensions/
- Enable developer mode (checkbox on the top right)
- Click "Load unpacked extension..."
- Point to the repo's directory
Note that for development, the TextSecure staging environment uses a self-signed certificate, which Chrome will complain is insecure. So first visit https://textsecure-service-staging.whispersystems.org/ in your browser and allow the certificate.
Now, in the extension's options, you can register for TextSecure:
- Select "Register" under "I'm new to TextSecure".
- Enter a real phone number (Google Voice numbers work too) and country combination and choose to send an SMS. You will receive a real SMS.
- Enter the verification code you received by SMS.
You should now be able to use the extension. If you need to reset your
development environment, open a browser console within the extension options
page (or inspect background.html
) and execute localStorage.clear()
to clear
out the settings.
Dependencies
Note: Unless you need to make changes to dependencies, you can skip this section and just use the checked in versions.
Dependencies are managed by bower and built with
grunt. To change them, you'll need to install node and npm, then
run npm install
to install bower, grunt, and related plugins.
Adding a bower component
Add the package name and version to bower.json under 'dependencies' or bower install package-name --save
Next update the "preen" config in bower.json with the list of files we will actually use from the new package, e.g.:
"preen": {
"package-name": [
"path/to/main.js",
"directory/**/*.js"
],
...
}
If you'd like to add the new dependency to js/components.js to be included on
all html pages, simply append the package name to the concat.app list in
bower.json
. Take care to insert it in the order you would like it
concatenated.
Now, run grunt
to delete unused package files and build js/components.js
.
Finally, stage and commit changes to bower.json, js/components.js
,
and components/
. The latter should be limited to files we actually use.
Tests
Please write tests! Our testing framework is mocha and our assertion library is chai.
To run tests, open test/index.html
in your browser. Note that
- Some tests depend on the native client module. These will fail unless you
load the test page from the
chrome-extension://
namespace (as opposed to thefile://
namespace or via a local webserver. - Some tests may read, write or clear localStorage. It is recommended that you create a Chrome user profile just for running tests to avoid clobbering any existing account and message data.