Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33289059
D9096.1768722104.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D9096.1768722104.diff
View Options
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
@@ -10,14 +10,13 @@
import type { NavigationRoute } from '../navigation/route-names.js';
import { useStyles } from '../themes/colors.js';
import * as AES from '../utils/aes-crypto-module.js';
+import { getContentSigningKey } from '../utils/crypto-utils.js';
type QRCodeScreenProps = {
+navigation: QRCodeSignInNavigationProp<'QRCodeScreen'>,
+route: NavigationRoute<'QRCodeScreen'>,
};
-const defaultDeviceEd25519Key = 'device_ed25519_key';
-
// eslint-disable-next-line no-unused-vars
function QRCodeScreen(props: QRCodeScreenProps): React.Node {
const [qrCodeValue, setQrCodeValue] = React.useState<?string>();
@@ -25,7 +24,9 @@
const generateQRCode = React.useCallback(async () => {
try {
const aes256Key: Uint8Array = await AES.generateKey();
- const url = qrCodeLinkURL(aes256Key, defaultDeviceEd25519Key);
+ const ed25519Key: string = await getContentSigningKey();
+
+ const url = qrCodeLinkURL(aes256Key, 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
@@ -7,21 +7,27 @@
import css from './qr-code-login.css';
import { generateKey } from '../media/aes-crypto-utils.js';
-
-const defaultDeviceEd25519Key = 'device_ed25519_key';
+import { useSelector } from '../redux/redux-utils.js';
function QrCodeLogin(): React.Node {
const [qrCodeValue, setQrCodeValue] = React.useState<?string>();
+ const ed25519Key = useSelector(
+ state => state.cryptoStore.primaryIdentityKeys?.ed25519,
+ );
const generateQRCode = React.useCallback(async () => {
try {
+ if (!ed25519Key) {
+ return;
+ }
+
const aes256Key: Uint8Array = await generateKey();
- const url = qrCodeLinkURL(aes256Key, defaultDeviceEd25519Key);
+ const url = qrCodeLinkURL(aes256Key, ed25519Key);
setQrCodeValue(url);
} catch (err) {
console.error('Failed to generate QR Code:', err);
}
- }, []);
+ }, [ed25519Key]);
React.useEffect(() => {
generateQRCode();
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jan 18, 7:41 AM (7 h, 47 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5950810
Default Alt Text
D9096.1768722104.diff (2 KB)
Attached To
Mode
D9096: [web/native] Retrieve and encode the ed25519 key in the QR code
Attached
Detach File
Event Timeline
Log In to Comment