Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3346422
D9220.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D9220.diff
View Options
diff --git a/keyserver/src/keyserver.js b/keyserver/src/keyserver.js
--- a/keyserver/src/keyserver.js
+++ b/keyserver/src/keyserver.js
@@ -38,6 +38,7 @@
} from './uploads/uploads.js';
import { verifyUserLoggedIn } from './user/login.js';
import { initENSCache } from './utils/ens-cache.js';
+import { getContentSigningKey } from './utils/olm-utils.js';
import {
prefetchAllURLFacts,
getSquadCalURLFacts,
@@ -85,7 +86,15 @@
if (shouldDisplayQRCodeInTerminal) {
try {
const aes256Key = crypto.randomBytes(32).toString('hex');
- const ed25519Key = 'ed25519Key';
+ const ed25519Key = await getContentSigningKey();
+
+ console.log(
+ '\nOpen the Comm app on your phone and scan the QR code below\n',
+ );
+ console.log('How to find the scanner:\n');
+ console.log('Go to \x1b[1mProfile\x1b[0m');
+ console.log('Select \x1b[1mLinked devices\x1b[0m');
+ console.log('Click \x1b[1mAdd\x1b[0m on the top right');
const url = qrCodeLinkURL(aes256Key, ed25519Key);
qrcode.toString(url, (error, encodedURL) => console.log(encodedURL));
diff --git a/keyserver/src/scripts/get-keyserver-public-key.js b/keyserver/src/scripts/get-keyserver-public-key.js
--- a/keyserver/src/scripts/get-keyserver-public-key.js
+++ b/keyserver/src/scripts/get-keyserver-public-key.js
@@ -1,12 +1,12 @@
// @flow
import { main } from './utils.js';
-import { fetchOlmAccount } from '../updaters/olm-account-updater.js';
+import { getContentSigningKey } from '../utils/olm-utils.js';
// Outputs the keyserver's signing ed25519 public key
async function getKeyserverPublicKey() {
- const info = await fetchOlmAccount('content');
- console.log(JSON.parse(info.account.identity_keys()).ed25519);
+ const contentSigningKey = await getContentSigningKey();
+ console.log(contentSigningKey);
}
main([getKeyserverPublicKey]);
diff --git a/keyserver/src/socket/tunnelbroker.js b/keyserver/src/socket/tunnelbroker.js
--- a/keyserver/src/socket/tunnelbroker.js
+++ b/keyserver/src/socket/tunnelbroker.js
@@ -11,9 +11,11 @@
import { getCommConfig } from 'lib/utils/comm-config.js';
import { ServerError } from 'lib/utils/errors.js';
-import { fetchOlmAccount } from '../updaters/olm-account-updater.js';
import { type IdentityInfo } from '../user/identity.js';
-import { uploadNewOneTimeKeys } from '../utils/olm-utils.js';
+import {
+ uploadNewOneTimeKeys,
+ getContentSigningKey,
+} from '../utils/olm-utils.js';
type TBConnectionInfo = {
+url: string,
@@ -38,13 +40,11 @@
async function createAndMaintainTunnelbrokerWebsocket(
identityInfo: IdentityInfo,
) {
- const [accountInfo, tbConnectionInfo] = await Promise.all([
- fetchOlmAccount('content'),
+ const [deviceID, tbConnectionInfo] = await Promise.all([
+ getContentSigningKey(),
getTBConnectionInfo(),
]);
- const deviceID = JSON.parse(accountInfo.account.identity_keys()).ed25519;
-
openTunnelbrokerConnection(
deviceID,
identityInfo.userId,
diff --git a/keyserver/src/utils/olm-utils.js b/keyserver/src/utils/olm-utils.js
--- a/keyserver/src/utils/olm-utils.js
+++ b/keyserver/src/utils/olm-utils.js
@@ -13,7 +13,10 @@
import { olmEncryptedMessageTypes } from 'lib/types/crypto-types.js';
import { ServerError } from 'lib/utils/errors.js';
-import { fetchCallUpdateOlmAccount } from '../updaters/olm-account-updater.js';
+import {
+ fetchCallUpdateOlmAccount,
+ fetchOlmAccount,
+} from '../updaters/olm-account-updater.js';
import { fetchIdentityInfo } from '../user/identity.js';
type PickledOlmAccount = {
@@ -144,6 +147,11 @@
});
}
+async function getContentSigningKey(): Promise<string> {
+ const accountInfo = await fetchOlmAccount('content');
+ return JSON.parse(accountInfo.account.identity_keys()).ed25519;
+}
+
export {
createPickledOlmAccount,
createPickledOlmSession,
@@ -152,4 +160,5 @@
unpickleOlmSession,
validateAccountPrekey,
uploadNewOneTimeKeys,
+ getContentSigningKey,
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Nov 23, 8:42 AM (18 h, 2 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2569915
Default Alt Text
D9220.diff (3 KB)
Attached To
Mode
D9220: [keyserver] Encode the device id into the QR code
Attached
Detach File
Event Timeline
Log In to Comment