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 @@ -77,13 +77,14 @@ const generateQRCode = React.useCallback(async () => { try { - const rawAESKey: Uint8Array = await AES.generateKey(); + const [ed25519, rawAESKey] = await Promise.all([ + getContentSigningKey(), + AES.generateKey(), + ]); const aesKeyAsHexString: string = uintArrayToHexString(rawAESKey); - const ed25519Key: string = await getContentSigningKey(); - - setUnauthorizedDeviceID(ed25519Key); - setQRData({ deviceID: ed25519Key, aesKey: aesKeyAsHexString }); + setUnauthorizedDeviceID(ed25519); + setQRData({ deviceID: ed25519, aesKey: aesKeyAsHexString }); } 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 @@ -104,12 +104,10 @@ const generateQRCode = React.useCallback(async () => { try { - const ed25519 = await getContentSigningKey(); - if (!ed25519) { - return; - } - - const rawAESKey: Uint8Array = await generateKeyCommon(crypto); + const [ed25519, rawAESKey] = await Promise.all([ + getContentSigningKey(), + generateKeyCommon(crypto), + ]); const aesKeyAsHexString: string = uintArrayToHexString(rawAESKey); setUnauthorizedDeviceID(ed25519);