Page MenuHomePhabricator

D9202.id31370.diff
No OneTemporary

D9202.id31370.diff

diff --git a/keyserver/src/keyserver.js b/keyserver/src/keyserver.js
--- a/keyserver/src/keyserver.js
+++ b/keyserver/src/keyserver.js
@@ -84,7 +84,7 @@
if (shouldDisplayQRCodeInTerminal) {
try {
- const aes256Key = crypto.randomBytes(32);
+ const aes256Key = crypto.randomBytes(32).toString('hex');
const ed25519Key = 'ed25519Key';
const url = qrCodeLinkURL(aes256Key, ed25519Key);
diff --git a/lib/facts/links.js b/lib/facts/links.js
--- a/lib/facts/links.js
+++ b/lib/facts/links.js
@@ -6,7 +6,7 @@
}
/* QR Code */
-function qrCodeLinkURL(aes256Param: Uint8Array, ed25519Param: string): string {
+function qrCodeLinkURL(aes256Param: string, ed25519Param: string): string {
const keys = {
aes256: aes256Param,
ed25519: ed25519Param,
diff --git a/native/qr-code/qr-code-screen.react.js b/native/qr-code/qr-code-screen.react.js
--- a/native/qr-code/qr-code-screen.react.js
+++ b/native/qr-code/qr-code-screen.react.js
@@ -5,6 +5,7 @@
import QRCode from 'react-native-qrcode-svg';
import { qrCodeLinkURL } from 'lib/facts/links.js';
+import { uintArrayToHexString } from 'lib/media/data-utils.js';
import type { QRCodeSignInNavigationProp } from './qr-code-sign-in-navigator.react.js';
import type { NavigationRoute } from '../navigation/route-names.js';
@@ -23,10 +24,12 @@
const generateQRCode = React.useCallback(async () => {
try {
- const aes256Key: Uint8Array = await AES.generateKey();
+ const rawAESKey: Uint8Array = await AES.generateKey();
+ const aesKeyAsHexString: string = uintArrayToHexString(rawAESKey);
+
const ed25519Key: string = await getContentSigningKey();
- const url = qrCodeLinkURL(aes256Key, ed25519Key);
+ const url = qrCodeLinkURL(aesKeyAsHexString, ed25519Key);
setQrCodeValue(url);
} catch (err) {
console.error('Failed to generate QR Code:', err);
diff --git a/web/account/qr-code-login.react.js b/web/account/qr-code-login.react.js
--- a/web/account/qr-code-login.react.js
+++ b/web/account/qr-code-login.react.js
@@ -4,6 +4,7 @@
import * as React from 'react';
import { qrCodeLinkURL } from 'lib/facts/links.js';
+import { uintArrayToHexString } from 'lib/media/data-utils.js';
import css from './qr-code-login.css';
import { generateKey } from '../media/aes-crypto-utils.js';
@@ -21,8 +22,10 @@
return;
}
- const aes256Key: Uint8Array = await generateKey();
- const url = qrCodeLinkURL(aes256Key, ed25519Key);
+ const rawAESKey: Uint8Array = await generateKey();
+ const aesKeyAsHexString: string = uintArrayToHexString(rawAESKey);
+
+ const url = qrCodeLinkURL(aesKeyAsHexString, ed25519Key);
setQrCodeValue(url);
} catch (err) {
console.error('Failed to generate QR Code:', err);

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 26, 9:39 PM (21 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2585959
Default Alt Text
D9202.id31370.diff (2 KB)

Event Timeline