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(
{
storageServiceKey: dropNull(sync.storageService),
masterKey: dropNull(sync.master),
storageServiceKey: Bytes.isNotEmpty(sync.storageService)
? sync.storageService
: undefined,
masterKey: Bytes.isNotEmpty(sync.master) ? sync.master : undefined,
},
this.removeFromCache.bind(this, envelope)
);

View file

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