Develop a Login function with WhatsApp QR

14 views Asked by At

From the WhatsApp Encryption Overview docs, I noticed that "Companion Devices" and other platforms such as ChatDaddy have their QR generated by a Curve25519 computed over 0x600/0x601.

All of those QR resulted in something like this: 2@M+9bxTnWDsocS7ODEoM8sIAje3N6Ejy3vvtGhqoOVZKDxdyTrnEvk6HpmEpnl01FMLZlBFJYYXgz6Q==,XZx4ui0ast87hjlX5Dd5icn0qYA+mi2D5n5vW5NMVkU=,YDhfWsv0xMf5Jx6hfBIgmMXwvdN+mNMiQ2dpB+MNzBI=,nM5ABBnEtt2A9IZb9C6skrUcjraU4c0ggUkPJuOIXsk=,1

2@hjOu4dJ5hQ1JXvZJk9T0uTcEubaA4qhGkUJntTQKAcyr1bTjx98Z9J6r4TQw9ZSam2GuI5cVxAMC9g==,XZx4ui0ast87hjlX5Dd5icn0qYA+mi2D5n5vW5NMVkU=,YDhfWsv0xMf5Jx6hfBIgmMXwvdN+mNMiQ2dpB+MNzBI=,nM5ABBnEtt2A9IZb9C6skrUcjraU4c0ggUkPJuOIXsk=,1

What are the keys after the "comma" (,) represented as? And how do I get the similar keys like this that has the same length in everything including the "2@", the "equals" (=), and the "double equals" at the first sequence (==)?

I'm trying to do the same thing in NodeJS using crypto library and the results were pretty close.

const alice = crypto.createDiffieHellman(600);
alice.generateKeys();
console.log("Signature:", alice.getPrivateKey().toString("base64"));

Output: Signature: SxVeIFSniYhDN9Jfq5jB0VnOWICod8laI1RjsS+oRMe/ULHp6+VzAb0f08nfUEuOcW1NmJ5FRYtxrw603EDDmeZ9vs3VQ5zDv6b+

0

There are 0 answers