From fae4aafdcdf2150e604991fbb0dec0c322936398 Mon Sep 17 00:00:00 2001 From: Adhiraj Singh Date: Thu, 14 Jul 2022 17:40:49 +0530 Subject: [PATCH] fix: validateConnection mutating account --- src/Utils/validate-connection.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Utils/validate-connection.ts b/src/Utils/validate-connection.ts index 3d64b3f..eded3b8 100644 --- a/src/Utils/validate-connection.ts +++ b/src/Utils/validate-connection.ts @@ -136,11 +136,15 @@ export const configureSuccessfulPairing = ( // sign the details with our identity key const deviceMsg = Buffer.concat([ Buffer.from([6, 1]), deviceDetails, signedIdentityKey.public, accountSignatureKey ]) account.deviceSignature = Curve.sign(signedIdentityKey.private, deviceMsg) - // do not provide the "accountSignatureKey" back - account.accountSignatureKey = Buffer.alloc(0) const identity = createSignalIdentity(jid, accountSignatureKey) - const accountEnc = proto.ADVSignedDeviceIdentity.encode(account).finish() + const accountEnc = proto.ADVSignedDeviceIdentity + .encode({ + ...account, + // do not provide the "accountSignatureKey" back + accountSignatureKey: Buffer.alloc(0) + }) + .finish() const deviceIdentity = proto.ADVDeviceIdentity.decode(account.details)