mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 12:19:41 +00:00
Handle both given and family name in decrypted profile name
* Decrypt given and family names from profile name string * Handle both given and family name from decrypted profile name * Ensure we properly handle profiles with no family name
This commit is contained in:
committed by
Ken Powers
parent
4f50c0b093
commit
11266cb775
@@ -1787,16 +1787,19 @@
|
||||
const data = window.Signal.Crypto.base64ToArrayBuffer(encryptedName);
|
||||
|
||||
// decrypt
|
||||
const decrypted = await textsecure.crypto.decryptProfileName(
|
||||
const { given, family } = await textsecure.crypto.decryptProfileName(
|
||||
data,
|
||||
keyBuffer
|
||||
);
|
||||
|
||||
// encode
|
||||
const profileName = window.Signal.Crypto.stringFromBytes(decrypted);
|
||||
const profileName = window.Signal.Crypto.stringFromBytes(given);
|
||||
const profileFamilyName = family
|
||||
? window.Signal.Crypto.stringFromBytes(family)
|
||||
: null;
|
||||
|
||||
// set
|
||||
this.set({ profileName });
|
||||
this.set({ profileName, profileFamilyName });
|
||||
},
|
||||
async setProfileAvatar(avatarPath) {
|
||||
if (!avatarPath) {
|
||||
@@ -1840,6 +1843,7 @@
|
||||
profileKey,
|
||||
accessKey: null,
|
||||
profileName: null,
|
||||
profileFamilyName: null,
|
||||
profileAvatar: null,
|
||||
sealedSender: SEALED_SENDER.UNKNOWN,
|
||||
});
|
||||
@@ -1865,6 +1869,7 @@
|
||||
profileAvatar: null,
|
||||
profileKey: null,
|
||||
profileName: null,
|
||||
profileFamilyName: null,
|
||||
accessKey: null,
|
||||
sealedSender: SEALED_SENDER.UNKNOWN,
|
||||
});
|
||||
@@ -1951,7 +1956,10 @@
|
||||
|
||||
getProfileName() {
|
||||
if (this.isPrivate()) {
|
||||
return this.get('profileName');
|
||||
return Util.combineNames(
|
||||
this.get('profileName'),
|
||||
this.get('profileFamilyName')
|
||||
);
|
||||
}
|
||||
return null;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user