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.
25 lines
905 B
JavaScript
25 lines
905 B
JavaScript
/* vim: ts=4:sw=4
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Lesser General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
describe("Native Client", function() {
|
|
if (textsecure.nativeclient) {
|
|
test_curve25519_implementation(textsecure.nativeclient);
|
|
} else {
|
|
it.skip('Not supported');
|
|
}
|
|
});
|