diff --git a/keyserver/src/keyserver.js b/keyserver/src/keyserver.js --- a/keyserver/src/keyserver.js +++ b/keyserver/src/keyserver.js @@ -6,8 +6,11 @@ import express from 'express'; import expressWs from 'express-ws'; import os from 'os'; +import qrcode from 'qrcode'; import './cron/cron.js'; +import { qrCodeLinkURL } from 'lib/facts/links.js'; + import { migrate } from './database/migrations.js'; import { jsonEndpoints } from './endpoints.js'; import { emailSubscriptionResponder } from './responders/comm-landing-responders.js'; @@ -41,6 +44,8 @@ getCommAppURLFacts, } from './utils/urls.js'; +const shouldDisplayQRCodeInTerminal = false; + (async () => { await Promise.all([olm.init(), prefetchAllURLFacts(), initENSCache()]); @@ -76,6 +81,18 @@ console.warn('failed_identity_login'); } + if (shouldDisplayQRCodeInTerminal) { + try { + const aes256Key = new Uint8Array([]); + const ed25519Key = 'ed25519Key'; + + const url = qrCodeLinkURL(aes256Key, ed25519Key); + qrcode.toString(url, (error, encodedURL) => console.log(encodedURL)); + } catch (e) { + console.log('Error generating QR code', e); + } + } + const cpuCount = os.cpus().length; for (let i = 0; i < cpuCount; i++) { cluster.fork();