perf: nicer "shouldIncludeDeviceIdentity" flag computation

This commit is contained in:
Adhiraj Singh
2022-06-17 13:16:41 +05:30
parent 399b4d3cb8
commit 7863c0e4c2
2 changed files with 25 additions and 17 deletions

View File

@@ -175,11 +175,9 @@ export const encryptSignalProto = async(user: string, buffer: Buffer, auth: Sign
const addr = jidToSignalProtocolAddress(user)
const cipher = new libsignal.SessionCipher(signalStorage(auth), addr)
const { type, body } = await cipher.encrypt(buffer)
return {
type: type === 3 ? 'pkmsg' : 'msg',
ciphertext: Buffer.from(body, 'binary')
}
const { type: sigType, body } = await cipher.encrypt(buffer)
const type = sigType === 3 ? 'pkmsg' : 'msg'
return { type, ciphertext: Buffer.from(body, 'binary') }
}
export const encryptSenderKeyMsgSignalProto = async(group: string, data: Uint8Array | Buffer, meId: string, auth: SignalAuthState) => {