[keyserver] Encode the device id into the QR code
Summary:
The second key we need to encode into the QR code for the terminal output is the ed25519 key / the device id. The way we seem to currently do this is to fetch the content OLM account and parse out the identity keys (here we want the ed25519, not the curve25519 key). Going to set @varun as blocking since I used his initial script as a starting point here
Depends on D9202
Addresses ENG-4798
Test Plan:
Logged out the url encoded and parsed out the keys to confirm they were correctly set:
const url = 'comm://qr-code/%7B%22aes256%22%3A%2267f88084dcf741c747f07d83e053444b4ed08c74f0930b86c0b59de04a90a725%22%2C%22ed25519%22%3A%22zLtHliYkjRAfwJxIGp%2FGXDjfu2BsifodMQfJteML6%2Fg%22%7D'; // This is the regex we use to parse the QR code link in `links.js` const qrCodeKeysRegex = /qr-code\/(\S+)$/; const qrCodeKeysMatch = qrCodeKeysRegex.exec(url)[1]; // Decode and parse the keys from the URL const keys = JSON.parse(decodeURIComponent(qrCodeKeysMatch)); // Log the keys to verify console.log(keys);
Output:
{ aes256: '67f88084dcf741c747f07d83e053444b4ed08c74f0930b86c0b59de04a90a725', ed25519: 'zLtHliYkjRAfwJxIGp/GXDjfu2BsifodMQfJteML6/g' }
Reviewers: varun, atul, ginsu, patryk
Reviewed By: varun
Subscribers: ashoat, tomek, varun
Differential Revision: https://phab.comm.dev/D9220