Skip to content

Commit 8dc0023

Browse files
committed
feat(suite): warn about device going to be wiped when updating from 1.6.1
1 parent ccbdd45 commit 8dc0023

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

packages/suite-data/files/translations/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,7 +1044,7 @@
10441044
"TR_FIRMWARE_SUBHEADING_NONE_BITCOIN_ONLY_DEVICE": "Your device is ready for the latest firmware in order to be used safely. For Bitcoin enthusiasts, a Bitcoin-only firmware is available.",
10451045
"TR_FIRMWARE_SUBHEADING_UNKNOWN": "Your Trezor is shipped without firmware. Install the latest firmware in order to use your device safely. For Bitcoin-only users, we recommend installing <button>{bitcoinOnly} firmware</button>.",
10461046
"TR_FIRMWARE_SUBHEADING_UNKNOWN_BITCOIN_ONLY_DEVICE": "A lightweight firmware supporting Bitcoin-only operations.",
1047-
"TR_FIRMWARE_SWITCH_WARNING_1": "Switching firmware <b>wipes all your device data</b>, including wallets, keys, and accounts.",
1047+
"TR_FIRMWARE_SWITCH_WARNING_1": "This action will <b>wipe all your device data</b>, including wallets, keys, and accounts.",
10481048
"TR_FIRMWARE_SWITCH_WARNING_2": "To regain access to your coins, you must <b>recover your wallet using your wallet backup</b>. Ensure your wallet backup is accessible and legible.",
10491049
"TR_FIRMWARE_SWITCH_WARNING_3": "If you don't have your wallet backup, there's no way to recover your coins!",
10501050
"TR_FIRMWARE_TYPE": "Type",

packages/suite/src/hooks/suite/useFirmware.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@ import { useDispatch } from 'react-redux';
33
import { FirmwareStatus } from '@suite-common/suite-types';
44
import { firmwareUpdate, selectFirmware, firmwareActions } from '@suite-common/wallet-core';
55
import { DEVICE, DeviceModelInternal, FirmwareType, UI } from '@trezor/connect';
6-
import { hasBitcoinOnlyFirmware, isBitcoinOnlyDevice } from '@trezor/device-utils';
6+
import {
7+
getFirmwareVersion,
8+
hasBitcoinOnlyFirmware,
9+
isBitcoinOnlyDevice,
10+
} from '@trezor/device-utils';
711

812
import { useSelector, useDevice, useTranslation } from 'src/hooks/suite';
913
import { isWebUsb } from 'src/utils/suite/transport';
@@ -16,6 +20,10 @@ There are three firmware update flows, depending on current firmware version:
1620
- reboot_and_upgrade: a device with firmware version >= 2.6.3 can reboot and upgrade in one step (not supported for reinstallation and downgrading)
1721
*/
1822

23+
const VERSIONS_GUARANTEED_TO_WIPE_DEVICE_ON_UPDATE: ReturnType<typeof getFirmwareVersion>[] = [
24+
'1.6.1',
25+
];
26+
1927
type UseFirmwareParams =
2028
| {
2129
shouldSwitchFirmwareType?: boolean;
@@ -60,10 +68,12 @@ export const useFirmware = (
6068
// Device may be wiped during firmware type switch because Universal and Bitcoin-only firmware have different vendor headers,
6169
// except T1B1 and T2T1. There may be some false negatives here during custom installation.
6270
// TODO: Determine this in Connect.
71+
6372
const deviceWillBeWiped =
64-
!!shouldSwitchFirmwareType &&
65-
deviceModelInternal !== undefined &&
66-
![DeviceModelInternal.T1B1, DeviceModelInternal.T2T1].includes(deviceModelInternal);
73+
(!!shouldSwitchFirmwareType &&
74+
deviceModelInternal !== undefined &&
75+
![DeviceModelInternal.T1B1, DeviceModelInternal.T2T1].includes(deviceModelInternal)) ||
76+
VERSIONS_GUARANTEED_TO_WIPE_DEVICE_ON_UPDATE.includes(getFirmwareVersion(originalDevice));
6777

6878
const confirmOnDevice =
6979
// Show the confirmation pill before starting the installation using the "wait" or "manual" method,

packages/suite/src/support/messages.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4647,7 +4647,7 @@ const messages = defineMessagesWithTypeCheck({
46474647
TR_FIRMWARE_SWITCH_WARNING_1: {
46484648
id: 'TR_FIRMWARE_SWITCH_WARNING_1',
46494649
defaultMessage:
4650-
'Switching firmware <b>wipes all your device data</b>, including wallets, keys, and accounts.',
4650+
'This action will <b>wipe all your device data</b>, including wallets, keys, and accounts.',
46514651
},
46524652
TR_FIRMWARE_SWITCH_WARNING_2: {
46534653
id: 'TR_FIRMWARE_SWITCH_WARNING_2',

0 commit comments

Comments
 (0)