Page MenuHomePhabricator

D12478.id41543.diff
No OneTemporary

D12478.id41543.diff

diff --git a/lib/components/qr-auth-provider.react.js b/lib/components/qr-auth-provider.react.js
--- a/lib/components/qr-auth-provider.react.js
+++ b/lib/components/qr-auth-provider.react.js
@@ -25,13 +25,13 @@
type Props = {
+children: React.Node,
- +onLoginError: (error: mixed) => void,
+ +onLogInError: (error: mixed) => void,
+generateAESKey: () => Promise<Uint8Array>,
- +composeTunnelbrokerMessage: (
+ +composeTunnelbrokerQRAuthMessage: (
encryptionKey: string,
payload: QRCodeAuthMessagePayload,
) => Promise<QRCodeAuthMessage>,
- +processTunnelbrokerMessage: (
+ +parseTunnelbrokerQRAuthMessage: (
encryptionKey: string,
message: QRCodeAuthMessage,
) => Promise<?QRCodeAuthMessagePayload>,
@@ -54,10 +54,10 @@
function QRAuthProvider(props: Props): React.Node {
const {
children,
- onLoginError,
+ onLogInError,
generateAESKey,
- composeTunnelbrokerMessage,
- processTunnelbrokerMessage,
+ composeTunnelbrokerQRAuthMessage,
+ parseTunnelbrokerQRAuthMessage,
performBackupRestore,
} = props;
@@ -98,11 +98,11 @@
try {
await logInSecondaryDevice(userID);
} catch (err) {
- onLoginError(err);
+ onLogInError(err);
void generateQRCode();
}
},
- [logInSecondaryDevice, onLoginError, generateQRCode],
+ [logInSecondaryDevice, onLogInError, generateQRCode],
);
React.useEffect(() => {
@@ -116,7 +116,7 @@
}
void (async () => {
- const message = await composeTunnelbrokerMessage(qrData?.aesKey, {
+ const message = await composeTunnelbrokerQRAuthMessage(qrData?.aesKey, {
type: qrCodeAuthMessageTypes.SECONDARY_DEVICE_REGISTRATION_SUCCESS,
requestBackupKeys: true,
});
@@ -130,7 +130,7 @@
primaryDeviceID,
qrData,
socketState,
- composeTunnelbrokerMessage,
+ composeTunnelbrokerQRAuthMessage,
qrAuthFinished,
]);
@@ -159,7 +159,7 @@
let qrCodeAuthMessage;
try {
- qrCodeAuthMessage = await processTunnelbrokerMessage(
+ qrCodeAuthMessage = await parseTunnelbrokerQRAuthMessage(
qrData?.aesKey,
innerMessage,
);
@@ -202,7 +202,7 @@
qrData?.aesKey,
performLogIn,
setUnauthorizedDeviceID,
- processTunnelbrokerMessage,
+ parseTunnelbrokerQRAuthMessage,
performBackupRestore,
],
);
diff --git a/native/qr-code/qr-code-utils.js b/native/qr-code/qr-code-utils.js
--- a/native/qr-code/qr-code-utils.js
+++ b/native/qr-code/qr-code-utils.js
@@ -60,8 +60,8 @@
return Promise.resolve(payload);
}
-function handleSecondaryDeviceRegistrationError(error: mixed): void {
- console.error('Secondary device registration error:', error);
+function handleSecondaryDeviceLogInError(error: mixed): void {
+ console.error('Secondary device log in error:', error);
const messageForException = getMessageForException(error);
if (
messageForException === 'client_version_unsupported' ||
@@ -89,14 +89,14 @@
);
}
-function generateQRAuthKey(): Promise<Uint8Array> {
+function generateQRAuthAESKey(): Promise<Uint8Array> {
return Promise.resolve(AES.generateKey());
}
export {
composeTunnelbrokerQRAuthMessage,
parseTunnelbrokerQRAuthMessage,
- handleSecondaryDeviceRegistrationError,
+ handleSecondaryDeviceLogInError,
performBackupRestore,
- generateQRAuthKey,
+ generateQRAuthAESKey,
};
diff --git a/native/root.react.js b/native/root.react.js
--- a/native/root.react.js
+++ b/native/root.react.js
@@ -79,10 +79,10 @@
import RootNavigator from './navigation/root-navigator.react.js';
import {
composeTunnelbrokerQRAuthMessage,
- handleSecondaryDeviceRegistrationError,
+ handleSecondaryDeviceLogInError,
parseTunnelbrokerQRAuthMessage,
performBackupRestore,
- generateQRAuthKey,
+ generateQRAuthAESKey,
} from './qr-code/qr-code-utils.js';
import ConnectivityUpdater from './redux/connectivity-updater.react.js';
import { DimensionsUpdater } from './redux/dimensions-updater.react.js';
@@ -318,11 +318,13 @@
<TunnelbrokerProvider>
<IdentitySearchProvider>
<QRAuthProvider
- processTunnelbrokerMessage={parseTunnelbrokerQRAuthMessage}
- composeTunnelbrokerMessage={composeTunnelbrokerQRAuthMessage}
- generateAESKey={generateQRAuthKey}
+ parseTunnelbrokerQRAuthMessage={parseTunnelbrokerQRAuthMessage}
+ composeTunnelbrokerQRAuthMessage={
+ composeTunnelbrokerQRAuthMessage
+ }
+ generateAESKey={generateQRAuthAESKey}
performBackupRestore={performBackupRestore}
- onLoginError={handleSecondaryDeviceRegistrationError}
+ onLogInError={handleSecondaryDeviceLogInError}
>
<FeatureFlagsProvider>
<NavContext.Provider value={navContext}>
diff --git a/web/app.react.js b/web/app.react.js
--- a/web/app.react.js
+++ b/web/app.react.js
@@ -90,9 +90,9 @@
import { canonicalURLFromReduxState, navInfoFromURL } from './url-utils.js';
import {
composeTunnelbrokerQRAuthMessage,
- generateQRAuthKey,
+ generateQRAuthAESKey,
parseTunnelbrokerQRAuthMessage,
- useHandleSecondaryDeviceRegistrationError,
+ useHandleSecondaryDeviceLogInError,
} from './utils/qr-code-utils.js';
import { useWebLock, TUNNELBROKER_LOCK_NAME } from './web-lock.js';
@@ -543,8 +543,8 @@
const secondaryTunnelbrokerConnection: SecondaryTunnelbrokerConnection =
useOtherTabsTunnelbrokerConnection();
- const handleSecondaryDeviceRegistrationError =
- useHandleSecondaryDeviceRegistrationError();
+ const handleSecondaryDeviceLogInError =
+ useHandleSecondaryDeviceLogInError();
return (
<AppThemeWrapper>
@@ -555,10 +555,12 @@
>
<IdentitySearchProvider>
<QRAuthProvider
- processTunnelbrokerMessage={parseTunnelbrokerQRAuthMessage}
- composeTunnelbrokerMessage={composeTunnelbrokerQRAuthMessage}
- generateAESKey={generateQRAuthKey}
- onLoginError={handleSecondaryDeviceRegistrationError}
+ parseTunnelbrokerQRAuthMessage={parseTunnelbrokerQRAuthMessage}
+ composeTunnelbrokerQRAuthMessage={
+ composeTunnelbrokerQRAuthMessage
+ }
+ generateAESKey={generateQRAuthAESKey}
+ onLogInError={handleSecondaryDeviceLogInError}
>
<App
{...props}
diff --git a/web/utils/qr-code-utils.js b/web/utils/qr-code-utils.js
--- a/web/utils/qr-code-utils.js
+++ b/web/utils/qr-code-utils.js
@@ -56,11 +56,11 @@
return payload;
}
-function useHandleSecondaryDeviceRegistrationError(): (error: mixed) => void {
+function useHandleSecondaryDeviceLogInError(): (error: mixed) => void {
const { pushModal } = useModalContext();
return React.useCallback(
(error: mixed) => {
- console.error('Secondary device registration error:', error);
+ console.error('Secondary device log in error:', error);
const messageForException = getMessageForException(error);
if (
messageForException === 'client_version_unsupported' ||
@@ -75,13 +75,13 @@
);
}
-function generateQRAuthKey(): Promise<Uint8Array> {
+function generateQRAuthAESKey(): Promise<Uint8Array> {
return generateKeyCommon(crypto);
}
export {
composeTunnelbrokerQRAuthMessage,
parseTunnelbrokerQRAuthMessage,
- useHandleSecondaryDeviceRegistrationError,
- generateQRAuthKey,
+ useHandleSecondaryDeviceLogInError,
+ generateQRAuthAESKey,
};

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 29, 5:24 PM (20 h, 37 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2597618
Default Alt Text
D12478.id41543.diff (7 KB)

Event Timeline