Skip to content

Commit

Permalink
feat(suite-native): disable FW rev check by message system
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemonexe committed Feb 11, 2025
1 parent 448f707 commit 0ead5c5
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions suite-common/message-system/src/messageSystemTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const Feature = {
ethUnstake: 'eth.staking.unstake',
ethClaim: 'eth.staking.claim',
firmwareRevisionCheck: 'security.firmware.revisionCheck',
firmwareRevisionCheckMobile: 'security.firmware.revisionCheck.mobile',
firmwareHashCheck: 'security.firmware.hashCheck',
entropyCheck: 'security.entropyCheck',
// FW update feature flag implemented only for mobile app
Expand Down
1 change: 1 addition & 0 deletions suite-native/device/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"@react-navigation/native": "6.1.18",
"@reduxjs/toolkit": "1.9.5",
"@sentry/react-native": "6.5.0",
"@suite-common/message-system": "workspace:*",
"@suite-common/redux-utils": "workspace:*",
"@suite-common/suite-utils": "workspace:*",
"@suite-common/wallet-core": "workspace:*",
Expand Down
18 changes: 15 additions & 3 deletions suite-native/device/src/selectors.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { A, pipe } from '@mobily/ts-belt';

import {
Feature,
MessageSystemRootState,
selectIsFeatureEnabled,
} from '@suite-common/message-system';
import { createWeakMapSelector, returnStableArrayIfEmpty } from '@suite-common/redux-utils';
import { FiatCurrencyCode } from '@suite-common/suite-config';
import { isDeviceAcquired } from '@suite-common/suite-utils';
Expand Down Expand Up @@ -156,7 +161,9 @@ export const selectFirmwareRevisionCheckError = (state: DeviceRootState) => {
return checkResult.error;
};

type FwAuthenticityCheckState = NativeDeviceRootState & FeatureFlagsRootState;
type FwAuthenticityCheckState = NativeDeviceRootState &
FeatureFlagsRootState &
MessageSystemRootState;
/**
* Get firmware revision check error, or null if check was successful / skipped, if the check is enabled in settings and through message system.
*/
Expand All @@ -167,8 +174,13 @@ export const selectFirmwareRevisionCheckErrorIfEnabled = (state: FwAuthenticityC
state,
FeatureFlag.IsFwRevisionCheckEnabled,
);
const isCheckEnabled = isFirmwareRevisionCheckEnabled && isFeatureFlagEnabled;
// TODO #16456 disable also by message-system feature flag
const isMessageSystemFeatureEnabled = selectIsFeatureEnabled(
state,
Feature.firmwareRevisionCheckMobile,
true,
);
const isCheckEnabled =
isFirmwareRevisionCheckEnabled && isFeatureFlagEnabled && isMessageSystemFeatureEnabled;

return isCheckEnabled ? revisionCheckError : null;
};
Expand Down
3 changes: 3 additions & 0 deletions suite-native/device/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": { "outDir": "libDev" },
"references": [
{
"path": "../../suite-common/message-system"
},
{
"path": "../../suite-common/redux-utils"
},
Expand Down
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10757,6 +10757,7 @@ __metadata:
"@react-navigation/native": "npm:6.1.18"
"@reduxjs/toolkit": "npm:1.9.5"
"@sentry/react-native": "npm:6.5.0"
"@suite-common/message-system": "workspace:*"
"@suite-common/redux-utils": "workspace:*"
"@suite-common/suite-utils": "workspace:*"
"@suite-common/wallet-core": "workspace:*"
Expand Down

0 comments on commit 0ead5c5

Please sign in to comment.