Better check for empty storage/master keys

This commit is contained in:
Fedor Indutny 2023-11-07 01:38:51 +01:00 committed by GitHub
parent 89e66da351
commit 59fa75c309
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 4 deletions

View file

@ -3301,8 +3301,10 @@ export default class MessageReceiver
const ev = new KeysEvent( const ev = new KeysEvent(
{ {
storageServiceKey: dropNull(sync.storageService), storageServiceKey: Bytes.isNotEmpty(sync.storageService)
masterKey: dropNull(sync.master), ? sync.storageService
: undefined,
masterKey: Bytes.isNotEmpty(sync.master) ? sync.master : undefined,
}, },
this.removeFromCache.bind(this, envelope) this.removeFromCache.bind(this, envelope)
); );

View file

@ -85,10 +85,10 @@ class ProvisioningCipherInner {
userAgent: provisionMessage.userAgent, userAgent: provisionMessage.userAgent,
readReceipts: provisionMessage.readReceipts, readReceipts: provisionMessage.readReceipts,
}; };
if (provisionMessage.profileKey) { if (Bytes.isNotEmpty(provisionMessage.profileKey)) {
ret.profileKey = provisionMessage.profileKey; ret.profileKey = provisionMessage.profileKey;
} }
if (provisionMessage.masterKey) { if (Bytes.isNotEmpty(provisionMessage.masterKey)) {
ret.masterKey = provisionMessage.masterKey; ret.masterKey = provisionMessage.masterKey;
} }
return ret; return ret;