WhiskeySockets / BaileysCSharp

Lightweight full-featured C# WhatsApp Web API
63 stars 21 forks source link

OnPairDevice - Bad Mac #1

Closed donaldjansen closed 8 months ago

donaldjansen commented 8 months ago

Currently when sending the resulting BinaryNode back to WhatsApp the server returns an error that results in bad-mac

            var iq = new BinaryNode()
            {
                tag = "iq",
                attrs = new Dictionary<string, string>()
                {
                    {"to",Constants.S_WHATSAPP_NET },
                    {"type","result" },
                    {"id", message.attrs["id"] }
                },
            };

            SendNode(iq); // as soon as this is sent the error occures

            var pairDeviceNode = GetBinaryNodeChild(message, "pair-device");
            var refNodes = new Queue<BinaryNode>(GetBinaryNodeChildren(pairDeviceNode, "ref"));
            var noiseKeyB64 = Creds.NoiseKey.Public.ToBase64();
            var identityKeyB64 = Creds.SignedIdentityKey.Public.ToBase64();
            var advB64 = Creds.AdvSecretKey;
donaldjansen commented 8 months ago

Issue was EncKey = writeRead.read;

changed it to EncKey = writeRead.write; now it works