1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2026-01-03 23:22:30 +03:00

fix new way of calling OlmDevice.init

This commit is contained in:
Cédric Van Rompay
2020-02-03 10:27:10 +01:00
parent 7a5c54fef7
commit ec597bea93
3 changed files with 4 additions and 4 deletions

View File

@@ -99,7 +99,7 @@ describe("OlmDevice", function() {
);
const bobRecreatedOlmDevice = makeOlmDevice();
bobRecreatedOlmDevice.init(exported);
bobRecreatedOlmDevice.init({ fromExportedDevice: exported });
const decrypted = await bobRecreatedOlmDevice.createInboundSession(
aliceOlmDevice.deviceCurve25519Key,
@@ -123,7 +123,7 @@ describe("OlmDevice", function() {
);
const bobRecreatedAgainOlmDevice = makeOlmDevice();
bobRecreatedAgainOlmDevice.init(exportedAgain);
bobRecreatedAgainOlmDevice.init({ fromExportedDevice: exportedAgain });
// Note: "decrypted_2" does not have the same structure as "decrypted"
const decrypted2 = await bobRecreatedAgainOlmDevice.decryptMessage(

View File

@@ -123,7 +123,7 @@ export function OlmDevice(cryptoStore) {
* (exported data already provides a pickle key)
* @param {object} opts.pickleKey (Optional) pickle key to set instead of default one
*/
OlmDevice.prototype.init = async function(opts) {
OlmDevice.prototype.init = async function(opts = {}) {
let e2eKeys;
const account = new global.Olm.Account();

View File

@@ -245,7 +245,7 @@ Crypto.prototype.init = async function(opts) {
? "Crypto: initialising Olm device from exported device..."
: "Crypto: initialising Olm device...",
);
await this._olmDevice.init(exportedOlmDevice);
await this._olmDevice.init({ fromExportedDevice: exportedOlmDevice });
logger.log("Crypto: loading device list...");
await this._deviceList.load();