Merge pull request #576 from vector-im/bwindels/setup-new-dehydrated-device-when-claiming

Setup new dehydrated device when claiming
This commit is contained in:
Bruno Windels 2021-11-05 20:56:23 +01:00 committed by GitHub
commit d40037ef49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -248,6 +248,7 @@ export class SessionContainer {
await this._session.load(log); await this._session.load(log);
if (dehydratedDevice) { if (dehydratedDevice) {
await log.wrap("dehydrateIdentity", log => this._session.dehydrateIdentity(dehydratedDevice, log)); await log.wrap("dehydrateIdentity", log => this._session.dehydrateIdentity(dehydratedDevice, log));
await this._session.setupDehydratedDevice(dehydratedDevice.key, log);
} else if (!this._session.hasIdentity) { } else if (!this._session.hasIdentity) {
this._status.set(LoadStatus.SessionSetup); this._status.set(LoadStatus.SessionSetup);
await log.wrap("createIdentity", log => this._session.createIdentity(log)); await log.wrap("createIdentity", log => this._session.createIdentity(log));

View File

@ -36,7 +36,7 @@ export async function uploadAccountAsDehydratedDevice(account, hsApi, key, devic
const response = await hsApi.createDehydratedDevice({ const response = await hsApi.createDehydratedDevice({
device_data: { device_data: {
algorithm: DEHYDRATION_LIBOLM_PICKLE_ALGORITHM, algorithm: DEHYDRATION_LIBOLM_PICKLE_ALGORITHM,
account: account.pickleWithKey(key.binaryKey), account: account.pickleWithKey(key.binaryKey.slice()),
passphrase: key.description?.passphraseParams || {}, passphrase: key.description?.passphraseParams || {},
}, },
initial_device_display_name: deviceDisplayName initial_device_display_name: deviceDisplayName