Support phone number sharing flag on profile
This commit is contained in:
parent
23f39a0dc7
commit
d71da5c486
16 changed files with 155 additions and 33 deletions
|
@ -12,6 +12,7 @@ import {
|
|||
} from '../Crypto';
|
||||
import type { AvatarUpdateType } from '../types/Avatar';
|
||||
import { deriveProfileKeyCommitment, deriveProfileKeyVersion } from './zkgroup';
|
||||
import { isSharingPhoneNumberWithEverybody } from './phoneNumberSharingMode';
|
||||
|
||||
export async function encryptProfileData(
|
||||
conversation: ConversationType,
|
||||
|
@ -56,6 +57,11 @@ export async function encryptProfileData(
|
|||
)
|
||||
: null;
|
||||
|
||||
const encryptedPhoneNumberSharing = encryptProfile(
|
||||
new Uint8Array([isSharingPhoneNumberWithEverybody() ? 1 : 0]),
|
||||
keyBuffer
|
||||
);
|
||||
|
||||
const encryptedAvatarData = newAvatar
|
||||
? encryptProfile(newAvatar, keyBuffer)
|
||||
: undefined;
|
||||
|
@ -72,6 +78,7 @@ export async function encryptProfileData(
|
|||
avatar: Boolean(newAvatar),
|
||||
sameAvatar,
|
||||
commitment: deriveProfileKeyCommitment(profileKey, serviceId),
|
||||
phoneNumberSharing: Bytes.toBase64(encryptedPhoneNumberSharing),
|
||||
};
|
||||
|
||||
return [profileData, encryptedAvatarData];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue