fix: include accountSignatureKey in retry requests

This commit is contained in:
Adhiraj Singh
2022-08-07 18:10:28 +05:30
parent d5b857ad61
commit 31b54ec7c3
3 changed files with 25 additions and 15 deletions

View File

@@ -148,13 +148,7 @@ export const configureSuccessfulPairing = (
account.deviceSignature = Curve.sign(signedIdentityKey.private, deviceMsg)
const identity = createSignalIdentity(jid, accountSignatureKey)
const accountEnc = proto.ADVSignedDeviceIdentity
.encode({
...account,
// do not provide the "accountSignatureKey" back
accountSignatureKey: undefined
})
.finish()
const accountEnc = encodeSignedDeviceIdentity(account, false)
const deviceIdentity = proto.ADVDeviceIdentity.decode(account.details)
@@ -195,3 +189,20 @@ export const configureSuccessfulPairing = (
reply
}
}
export const encodeSignedDeviceIdentity = (
account: proto.IADVSignedDeviceIdentity,
includeSignatureKey: boolean
) => {
account = { ...account }
// set to null if we are not to include the signature key
// or if we are including the signature key but it is empty
if(!includeSignatureKey || !account.accountSignatureKey?.length) {
account.accountSignatureKey = null
}
const accountEnc = proto.ADVSignedDeviceIdentity
.encode(account)
.finish()
return accountEnc
}