Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3375601
D12327.id41033.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D12327.id41033.diff
View Options
diff --git a/lib/hooks/qr-auth.js b/lib/hooks/qr-auth.js
--- a/lib/hooks/qr-auth.js
+++ b/lib/hooks/qr-auth.js
@@ -71,6 +71,7 @@
void (async () => {
const message = await composeMessage(aesKey, {
type: qrCodeAuthMessageTypes.SECONDARY_DEVICE_REGISTRATION_SUCCESS,
+ requestBackupKeys: true,
});
await sendMessage({
deviceID: primaryDeviceID,
diff --git a/lib/types/tunnelbroker/qr-code-auth-message-types.js b/lib/types/tunnelbroker/qr-code-auth-message-types.js
--- a/lib/types/tunnelbroker/qr-code-auth-message-types.js
+++ b/lib/types/tunnelbroker/qr-code-auth-message-types.js
@@ -25,10 +25,12 @@
export type SecondaryDeviceRegistrationSuccess = {
+type: 'SecondaryDeviceRegistrationSuccess',
+ +requestBackupKeys: boolean,
};
export const secondaryDeviceRegistrationSuccessValidator: TInterface<SecondaryDeviceRegistrationSuccess> =
tShape<SecondaryDeviceRegistrationSuccess>({
type: tString(qrCodeAuthMessageTypes.SECONDARY_DEVICE_REGISTRATION_SUCCESS),
+ requestBackupKeys: t.Boolean,
});
export type BackupDataKeyMessage = {
diff --git a/native/profile/secondary-device-qr-code-scanner.react.js b/native/profile/secondary-device-qr-code-scanner.react.js
--- a/native/profile/secondary-device-qr-code-scanner.react.js
+++ b/native/profile/secondary-device-qr-code-scanner.react.js
@@ -116,33 +116,36 @@
innerMessage,
);
if (
- payload?.type !==
- qrCodeAuthMessageTypes.SECONDARY_DEVICE_REGISTRATION_SUCCESS
+ !payload ||
+ payload.type !==
+ qrCodeAuthMessageTypes.SECONDARY_DEVICE_REGISTRATION_SUCCESS
) {
return;
}
void broadcastDeviceListUpdate();
- const backupSecret = await getBackupSecret();
- const backupKeysResponse =
- await commCoreModule.retrieveBackupKeys(backupSecret);
- const backupKeys = assertWithValidator<BackupKeys>(
- JSON.parse(backupKeysResponse),
- backupKeysValidator,
- );
+ if (payload.requestBackupKeys) {
+ const backupSecret = await getBackupSecret();
+ const backupKeysResponse =
+ await commCoreModule.retrieveBackupKeys(backupSecret);
+ const backupKeys = assertWithValidator<BackupKeys>(
+ JSON.parse(backupKeysResponse),
+ backupKeysValidator,
+ );
- const backupKeyMessage = await composeTunnelbrokerQRAuthMessage(
- encryptionKey,
- {
- type: qrCodeAuthMessageTypes.BACKUP_DATA_KEY_MESSAGE,
- ...backupKeys,
- },
- );
- await tunnelbrokerContext.sendMessage({
- deviceID: targetDeviceID,
- payload: JSON.stringify(backupKeyMessage),
- });
+ const backupKeyMessage = await composeTunnelbrokerQRAuthMessage(
+ encryptionKey,
+ {
+ type: qrCodeAuthMessageTypes.BACKUP_DATA_KEY_MESSAGE,
+ ...backupKeys,
+ },
+ );
+ await tunnelbrokerContext.sendMessage({
+ deviceID: targetDeviceID,
+ payload: JSON.stringify(backupKeyMessage),
+ });
+ }
Alert.alert('Device added', 'Device registered successfully', [
{ text: 'OK' },
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 27, 8:47 PM (20 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2591653
Default Alt Text
D12327.id41033.diff (3 KB)
Attached To
Mode
D12327: [lib][native] Send backup keys in QR auth only if requested
Attached
Detach File
Event Timeline
Log In to Comment