1
let atob = Cu.import("resource://services-sync/util.js").atob;
2
Cu.import("resource://services-sync/constants.js");
3
Cu.import("resource://services-sync/record.js");
6
* Testing the SHA256-HMAC key derivation process against test vectors
7
* verified with the Firefox Home implementation.
11
// Test the production of keys from a sync key.
12
let bundle = new SyncKeyBundle(PWDMGR_PASSPHRASE_REALM, "st3fan", "q7ynpwq7vsc9m34hankbyi3s3i");
14
// These should be compared to the results from Home, as they once were.
15
let e = "14b8c09fa84e92729ee695160af6e0385f8f6215a25d14906e1747bdaa2de426";
16
let h = "370e3566245d79fe602a3adb5137e42439cd2a571235197e0469d7d541b07875";
18
// The encryption key is stored as base64 for handing off to WeaveCrypto.
19
let realE = Utils.bytesAsHex(atob(bundle.encryptionKey));
20
let realH = Utils.bytesAsHex(bundle.hmacKey);
22
_("Real E: " + realE);
23
_("Real H: " + realH);
24
do_check_eq(realH, h);
25
do_check_eq(realE, e);