Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3513946
D9093.id30798.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D9093.id30798.diff
View Options
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: string, ed25519Param: string): string {
+function qrCodeLinkUrl(aes256Param: Uint8Array, 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
@@ -9,16 +9,27 @@
import type { QRCodeSignInNavigationProp } from './qr-code-sign-in-navigator.react.js';
import type { NavigationRoute } from '../navigation/route-names.js';
import { useStyles } from '../themes/colors.js';
+import * as AES from '../utils/aes-crypto-module.js';
type QRCodeScreenProps = {
+navigation: QRCodeSignInNavigationProp<'QRCodeScreen'>,
+route: NavigationRoute<'QRCodeScreen'>,
};
-const qrCodeValue = qrCodeLinkUrl('random_aes256_key', 'device_ed25519_key');
+const defaultDeviceEd25519Key = 'device_ed25519_key';
// eslint-disable-next-line no-unused-vars
function QRCodeScreen(props: QRCodeScreenProps): React.Node {
+ const [qrCodeValue, setQrCodeValue] = React.useState<?string>();
+
+ React.useEffect(() => {
+ (async () => {
+ const aes256Key: Uint8Array = await AES.generateKey();
+ const url = qrCodeLinkUrl(aes256Key, defaultDeviceEd25519Key);
+ setQrCodeValue(url);
+ })();
+ }, []);
+
const styles = useStyles(unboundStyles);
return (
<View style={styles.container}>
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
@@ -6,10 +6,21 @@
import { qrCodeLinkUrl } from 'lib/facts/links.js';
import css from './qr-code-login.css';
+import { generateKey } from '../media/aes-crypto-utils.js';
-const qrCodeValue = qrCodeLinkUrl('random_aes256_key', 'device_ed25519_key');
+const defaultDeviceEd25519Key = 'device_ed25519_key';
function QrCodeLogin(): React.Node {
+ const [qrCodeValue, setQrCodeValue] = React.useState<?string>();
+
+ React.useEffect(() => {
+ (async () => {
+ const aes256Key: Uint8Array = await generateKey();
+ const url = qrCodeLinkUrl(aes256Key, defaultDeviceEd25519Key);
+ setQrCodeValue(url);
+ })();
+ }, []);
+
return (
<div className={css.qrContainer}>
<div className={css.title}>Log in to Comm</div>
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 2:40 AM (7 h, 39 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2693277
Default Alt Text
D9093.id30798.diff (2 KB)
Attached To
Mode
D9093: [lib/web/native] Generate and encode an ephemeral AES-256 key in the QR code
Attached
Detach File
Event Timeline
Log In to Comment