HomePhabricator
Diffusion Comm efc194158d4f

[keyserver] Encode the device id into the QR code

Description

[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:

Screenshot 2023-09-18 at 11.16.27 AM.png (1×3 px, 1 MB)

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

Details

Provenance
rohanAuthored on Sep 18 2023, 8:18 AM
Reviewer
varun
Differential Revision
D9220: [keyserver] Encode the device id into the QR code
Parents
rCOMM9a08fd6f2883: [keyserver/web/native] Covert AES-256 key from Uint8Array representation to hex…
Branches
Unknown
Tags
Unknown