mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
58b70d2360
Register a fake AppInfo with correct OS if it doesn't exist yet. Just use Svc.Crypto instead of trying to dynamically pick the contract id. Name the head files so they load in appinfo -> helper -> http order. --HG-- rename : services/sync/tests/unit/bookmark_setup.js => services/sync/tests/unit/head_appinfo.js rename : services/sync/tests/unit/head_first.js => services/sync/tests/unit/head_helpers.js
25 lines
809 B
JavaScript
25 lines
809 B
JavaScript
Cu.import("resource://services-sync/util.js");
|
|
|
|
function run_test() {
|
|
let cryptoSvc = Svc.Crypto;
|
|
|
|
var salt = cryptoSvc.generateRandomBytes(16);
|
|
var iv = cryptoSvc.generateRandomIV();
|
|
|
|
// Tests with a 2048 bit key (the default)
|
|
do_check_eq(cryptoSvc.keypairBits, 2048)
|
|
var privOut = {};
|
|
cryptoSvc.generateKeypair("passphrase", salt, iv, {}, privOut);
|
|
var privKey = privOut.value;
|
|
|
|
// Check with correct passphrase
|
|
var shouldBeTrue = cryptoSvc.verifyPassphrase(privKey, "passphrase",
|
|
salt, iv);
|
|
do_check_eq(shouldBeTrue, true);
|
|
|
|
// Check with incorrect passphrase
|
|
var shouldBeFalse = cryptoSvc.verifyPassphrase(privKey, "NotPassphrase",
|
|
salt, iv);
|
|
do_check_eq(shouldBeFalse, false);
|
|
}
|