bring back deriving passphrase

This commit is contained in:
Bruno Windels 2020-09-16 14:42:58 +02:00
parent b1a5362463
commit b4e6be638a

View File

@ -92,12 +92,12 @@
const keyId = "HB6AKfUD4avkZfPfyjcJ6iJPWDp4f9WM"; const keyId = "HB6AKfUD4avkZfPfyjcJ6iJPWDp4f9WM";
const cryptoDriver = new bundle.CryptoDriver((window.crypto || window.msCrypto).subtle); const cryptoDriver = new bundle.CryptoDriver((window.crypto || window.msCrypto).subtle);
window.Olm.init().then(function() { window.Olm.init().then(function() {
//bundle.deriveSSSSKey(cryptoDriver, prompt("passphrase"), ssssKeyAccountData).then(function(ssssKey) { bundle.deriveSSSSKey(cryptoDriver, prompt("passphrase"), ssssKeyAccountData).then(function(ssssKey) {
const ssssKey = new Uint8Array(32); // const ssssKey = new Uint8Array(32);
const bytes = [123, 47, 138, 15, 190, 69, 224, 204, 88, 246, 203, 65, 243, 234, 91, 17, 250, 107, 104, 51, 211, 252, 81, 67, 80, 191, 105, 208, 127, 87, 107, 231]; // const bytes = [123, 47, 138, 15, 190, 69, 224, 204, 88, 246, 203, 65, 243, 234, 91, 17, 250, 107, 104, 51, 211, 252, 81, 67, 80, 191, 105, 208, 127, 87, 107, 231];
for (var i = bytes.length - 1; i >= 0; i--) { // for (var i = bytes.length - 1; i >= 0; i--) {
ssssKey[i] = bytes[i]; // ssssKey[i] = bytes[i];
} // }
console.log("ssssKey", ssssKey); console.log("ssssKey", ssssKey);
bundle.decryptSecret(cryptoDriver, keyId, ssssKey, megolmBackupKeyAccountData).then(function(backupKeyBase64) { bundle.decryptSecret(cryptoDriver, keyId, ssssKey, megolmBackupKeyAccountData).then(function(backupKeyBase64) {
console.log("backupKeyBase64", backupKeyBase64); console.log("backupKeyBase64", backupKeyBase64);
@ -106,7 +106,7 @@
alert(session.session_key); alert(session.session_key);
}); });
}); });
//}); });
}); });
</script> </script>
</body> </body>