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 @@ -27,11 +27,11 @@ +children: React.Node, +onLoginError: (error: mixed) => void, +generateAESKey: () => Promise, - +composeTunnelbrokerMessage: ( + +composeTunnelbrokerQRAuthMessage: ( encryptionKey: string, payload: QRCodeAuthMessagePayload, ) => Promise, - +processTunnelbrokerMessage: ( + +parseTunnelbrokerQRAuthMessage: ( encryptionKey: string, message: QRCodeAuthMessage, ) => Promise, @@ -56,8 +56,8 @@ children, onLoginError, generateAESKey, - composeTunnelbrokerMessage, - processTunnelbrokerMessage, + composeTunnelbrokerQRAuthMessage, + parseTunnelbrokerQRAuthMessage, performBackupRestore, } = props; @@ -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 login error:', error); const messageForException = getMessageForException(error); if ( messageForException === 'client_version_unsupported' || @@ -89,14 +89,14 @@ ); } -function generateQRAuthKey(): Promise { +function generateQRAuthAESKey(): Promise { 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 @@ 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 ( @@ -555,10 +555,12 @@ > 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 login error:', error); const messageForException = getMessageForException(error); if ( messageForException === 'client_version_unsupported' || @@ -75,13 +75,13 @@ ); } -function generateQRAuthKey(): Promise { +function generateQRAuthAESKey(): Promise { return generateKeyCommon(crypto); } export { composeTunnelbrokerQRAuthMessage, parseTunnelbrokerQRAuthMessage, - useHandleSecondaryDeviceRegistrationError, - generateQRAuthKey, + useHandleSecondaryDeviceLoginError, + generateQRAuthAESKey, };