Merge pull request #1230 from Mikunj/profile-key

Fix profile keys not being decoded properly
pull/1232/head
Mikunj Varsani 5 years ago committed by GitHub
commit e1a34e2777
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -496,7 +496,7 @@ export class LeftPaneMessageSection extends React.Component<Props, State> {
} finally { } finally {
this.setState({ this.setState({
loading: false, loading: false,
}); });
} }
} }

@ -368,12 +368,12 @@ async function isMessageDuplicate({
} }
async function handleProfileUpdate( async function handleProfileUpdate(
profileKeyBuffer: any, profileKeyBuffer: Uint8Array,
convoId: string, convoId: string,
convoType: ConversationType, convoType: ConversationType,
isIncoming: boolean isIncoming: boolean
) { ) {
const profileKey = profileKeyBuffer.toString('base64'); const profileKey = StringUtils.decode(profileKeyBuffer, 'base64');
if (!isIncoming) { if (!isIncoming) {
const receiver = await window.ConversationController.getOrCreateAndWait( const receiver = await window.ConversationController.getOrCreateAndWait(

@ -7,6 +7,7 @@ import { PrimaryPubKey, PubKey } from '../session/types';
import _ from 'lodash'; import _ from 'lodash';
import { MultiDeviceProtocol } from '../session/protocols'; import { MultiDeviceProtocol } from '../session/protocols';
import { SignalService } from '../protobuf'; import { SignalService } from '../protobuf';
import { StringUtils } from '../session/utils';
async function handleGroups( async function handleGroups(
conversation: ConversationModel, conversation: ConversationModel,
@ -265,11 +266,11 @@ function processProfileKey(
source: string, source: string,
conversation: ConversationModel, conversation: ConversationModel,
sendingDeviceConversation: ConversationModel, sendingDeviceConversation: ConversationModel,
profileKeyBuffer: any profileKeyBuffer: Uint8Array
) { ) {
const ourNumber = window.textsecure.storage.user.getNumber(); const ourNumber = window.textsecure.storage.user.getNumber();
const profileKey = profileKeyBuffer.toString('base64'); const profileKey = StringUtils.decode(profileKeyBuffer, 'base64');
if (source === ourNumber) { if (source === ourNumber) {
conversation.set({ profileSharing: true }); conversation.set({ profileSharing: true });
} else if (conversation.isPrivate()) { } else if (conversation.isPrivate()) {

Loading…
Cancel
Save