From 074907312091bbd7509c24138fb917ef406b47d5 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 5 Nov 2021 20:52:50 +0100 Subject: [PATCH 1/2] clone key as olm clears it --- src/matrix/e2ee/Dehydration.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/matrix/e2ee/Dehydration.js b/src/matrix/e2ee/Dehydration.js index 65e2b90a..461e6c42 100644 --- a/src/matrix/e2ee/Dehydration.js +++ b/src/matrix/e2ee/Dehydration.js @@ -36,7 +36,7 @@ export async function uploadAccountAsDehydratedDevice(account, hsApi, key, devic const response = await hsApi.createDehydratedDevice({ device_data: { algorithm: DEHYDRATION_LIBOLM_PICKLE_ALGORITHM, - account: account.pickleWithKey(key.binaryKey), + account: account.pickleWithKey(key.binaryKey.slice()), passphrase: key.description?.passphraseParams || {}, }, initial_device_display_name: deviceDisplayName From faa0246e2873802b91d2ea78d019eb029cf53988 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Fri, 5 Nov 2021 20:53:04 +0100 Subject: [PATCH 2/2] setup new dehydrated device when claiming one --- src/matrix/SessionContainer.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/matrix/SessionContainer.js b/src/matrix/SessionContainer.js index 8e3d147e..3e3dab66 100644 --- a/src/matrix/SessionContainer.js +++ b/src/matrix/SessionContainer.js @@ -248,6 +248,7 @@ export class SessionContainer { await this._session.load(log); if (dehydratedDevice) { await log.wrap("dehydrateIdentity", log => this._session.dehydrateIdentity(dehydratedDevice, log)); + await this._session.setupDehydratedDevice(dehydratedDevice.key, log); } else if (!this._session.hasIdentity) { this._status.set(LoadStatus.SessionSetup); await log.wrap("createIdentity", log => this._session.createIdentity(log));