diff --git a/packages/env-utils/src/envUtils.native.ts b/packages/env-utils/src/envUtils.native.ts index a56d23f909..cceadfe078 100644 --- a/packages/env-utils/src/envUtils.native.ts +++ b/packages/env-utils/src/envUtils.native.ts @@ -58,6 +58,8 @@ const isAndroid = () => getPlatform() === 'android'; const isLinux = () => false; +const isCodesignBuild = () => Config.CODESIGN_BUILD === 'true'; + const getPlatformLanguages = () => getLocales().map(language => language.languageTag); const getOsName = () => { @@ -98,6 +100,7 @@ export const envUtils: EnvUtils = { isWindows, isIOs, isLinux, + isCodesignBuild, getOsName, getOsNameWeb, getOsFamily, diff --git a/packages/env-utils/src/envUtils.ts b/packages/env-utils/src/envUtils.ts index dfcac70736..4b7712831a 100644 --- a/packages/env-utils/src/envUtils.ts +++ b/packages/env-utils/src/envUtils.ts @@ -89,6 +89,8 @@ const isLinux = () => { return getPlatform().startsWith('Linux'); }; +const isCodesignBuild = () => !!process.env.CODESIGN_BUILD; + const getOsName = () => { if (isWindows()) return 'windows'; if (isMacOs()) return 'macos'; @@ -143,6 +145,7 @@ export const envUtils: EnvUtils = { isWindows, isIOs, isLinux, + isCodesignBuild, getOsName, getOsNameWeb, getOsFamily, diff --git a/packages/env-utils/src/index.ts b/packages/env-utils/src/index.ts index f78f3d97c3..c1ad8c1934 100644 --- a/packages/env-utils/src/index.ts +++ b/packages/env-utils/src/index.ts @@ -29,6 +29,7 @@ export const { isWindows, isIOs, isLinux, + isCodesignBuild, getOsName, getOsNameWeb, getOsFamily, diff --git a/packages/env-utils/src/types.ts b/packages/env-utils/src/types.ts index 38a1b375cf..7567703350 100644 --- a/packages/env-utils/src/types.ts +++ b/packages/env-utils/src/types.ts @@ -27,6 +27,7 @@ export interface EnvUtils { isWindows: () => boolean | undefined; isIOs: () => boolean; isLinux: () => boolean | undefined; + isCodesignBuild: () => boolean; getOsName: () => '' | 'android' | 'linux' | 'windows' | 'macos' | 'chromeos' | 'ios'; getOsNameWeb: () => string | undefined; getOsFamily: () => 'Windows' | 'MacOS' | 'Linux'; diff --git a/suite-common/message-system/src/messageSystemConstants.ts b/suite-common/message-system/src/messageSystemConstants.ts index f05a36cf35..d26fb2945c 100644 --- a/suite-common/message-system/src/messageSystemConstants.ts +++ b/suite-common/message-system/src/messageSystemConstants.ts @@ -16,6 +16,8 @@ export const FETCH_INTERVAL = 60_000; // 1 minute in milliseconds export const FETCH_CHECK_INTERVAL = 30_000; export const FETCH_TIMEOUT = 30_000; -export const CONFIG_URL_REMOTE = `https://data.trezor.io/config/${ - process.env.CODESIGN_BUILD ? 'stable' : 'develop' -}/${JWS_CONFIG_FILENAME_REMOTE}`; +export const CONFIG_URL_REMOTE_BASE = 'https://data.trezor.io/config'; +export const CONFIG_URL_REMOTE = { + stable: `${CONFIG_URL_REMOTE_BASE}/stable/${JWS_CONFIG_FILENAME_REMOTE}`, + develop: `${CONFIG_URL_REMOTE_BASE}/develop/${JWS_CONFIG_FILENAME_REMOTE}`, +}; diff --git a/suite-common/message-system/src/messageSystemThunks.ts b/suite-common/message-system/src/messageSystemThunks.ts index 5ea143f10d..d4a56557d0 100644 --- a/suite-common/message-system/src/messageSystemThunks.ts +++ b/suite-common/message-system/src/messageSystemThunks.ts @@ -1,5 +1,6 @@ import { decode, verify } from 'jws'; +import { isCodesignBuild } from '@trezor/env-utils'; import { scheduleAction } from '@trezor/utils'; import { createThunk } from '@suite-common/redux-utils'; import { MessageSystem } from '@suite-common/suite-types'; @@ -19,8 +20,12 @@ import { } from './messageSystemSelectors'; const getConfigJws = async () => { + const remoteConfigUrl = isCodesignBuild() + ? CONFIG_URL_REMOTE.stable + : CONFIG_URL_REMOTE.develop; + try { - const response = await scheduleAction(signal => fetch(CONFIG_URL_REMOTE, { signal }), { + const response = await scheduleAction(signal => fetch(remoteConfigUrl, { signal }), { timeout: FETCH_TIMEOUT, }); diff --git a/suite-native/app/.env.debug b/suite-native/app/.env.debug index 5730b88162..04616fe0b7 100644 --- a/suite-native/app/.env.debug +++ b/suite-native/app/.env.debug @@ -3,4 +3,5 @@ COMMIT_HASH= CHANGELOG= VERSION= BUILD_NUMBER= +CODESIGN_BUILD=false JWS_PUBLIC_KEY='-----BEGIN PUBLIC KEY-----MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEbSUHJlr17+NywPS/w+xMkp3dSD8eWXSuAfFKwonZPe5fL63kISipJC+eJP7Mad0WxgyJoiMsZCV6BZPK2jIFdg==-----END PUBLIC KEY-----' diff --git a/suite-native/app/.env.develop b/suite-native/app/.env.develop index 1966d34f2c..f662844c21 100644 --- a/suite-native/app/.env.develop +++ b/suite-native/app/.env.develop @@ -3,4 +3,5 @@ COMMIT_HASH= CHANGELOG= VERSION= BUILD_NUMBER= +CODESIGN_BUILD=false JWS_PUBLIC_KEY='-----BEGIN PUBLIC KEY-----MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAEbSUHJlr17+NywPS/w+xMkp3dSD8eWXSuAfFKwonZPe5fL63kISipJC+eJP7Mad0WxgyJoiMsZCV6BZPK2jIFdg==-----END PUBLIC KEY-----' diff --git a/suite-native/app/.env.production b/suite-native/app/.env.production index 4a6abb98a1..fdc85e514f 100644 --- a/suite-native/app/.env.production +++ b/suite-native/app/.env.production @@ -4,4 +4,5 @@ COMMIT_HASH= CHANGELOG= VERSION= BUILD_NUMBER= +CODESIGN_BUILD=true JWS_PUBLIC_KEY='-----BEGIN PUBLIC KEY-----MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAES7MbBzU/v5BsljkTM8Mz0Jsk+Nn5n2wH\no2/+MUI3TgCVdTbEHhn3HXaY7GJ6TLyWqxn+pIDY9wUUAyUqOStTUQ==-----END PUBLIC KEY-----' diff --git a/suite-native/app/.env.staging b/suite-native/app/.env.staging index a05af14bec..b8259fc6a8 100644 --- a/suite-native/app/.env.staging +++ b/suite-native/app/.env.staging @@ -3,4 +3,5 @@ COMMIT_HASH= CHANGELOG= VERSION= BUILD_NUMBER= -JWS_PUBLIC_KEY='-----BEGIN PUBLIC KEY-----MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAES7MbBzU/v5BsljkTM8Mz0Jsk+Nn5n2wH\no2/+MUI3TgCVdTbEHhn3HXaY7GJ6TLyWqxn+pIDY9wUUAyUqOStTUQ==-----END PUBLIC KEY-----' \ No newline at end of file +CODESIGN_BUILD=false +JWS_PUBLIC_KEY='-----BEGIN PUBLIC KEY-----MFYwEAYHKoZIzj0CAQYFK4EEAAoDQgAES7MbBzU/v5BsljkTM8Mz0Jsk+Nn5n2wH\no2/+MUI3TgCVdTbEHhn3HXaY7GJ6TLyWqxn+pIDY9wUUAyUqOStTUQ==-----END PUBLIC KEY-----' diff --git a/suite-native/app/fastlane/Fastfile b/suite-native/app/fastlane/Fastfile index d588f0ff7d..8da70dfac2 100644 --- a/suite-native/app/fastlane/Fastfile +++ b/suite-native/app/fastlane/Fastfile @@ -36,7 +36,6 @@ private_lane :replace_debug_info_environment_variables do |options| changelog_substitute = "s/^(CHANGELOG)=(.*)$/\\1=#{ENV["CHANGELOG"]}/" version_substitute = "s/^(VERSION)=(.*)$/\\1=#{ENV["VERSION"]}/" build_number_substitute = "s/^(BUILD_NUMBER)=(.*)$/\\1=#{ENV["BUILD_NUMBER"]}/" - codesign_build_substitute = "s/^(CODESIGN_BUILD)=(.*)$/\\1=#{ENV["CODESIGN_BUILD"]}/" if is_ci and platform == :ios sh( @@ -45,7 +44,6 @@ private_lane :replace_debug_info_environment_variables do |options| sed -r -i '' '#{changelog_substitute}' '#{environment_file}' sed -r -i '' '#{version_substitute}' '#{environment_file}' sed -r -i '' '#{build_number_substitute}' '#{environment_file}' - sed -r -i '' '#{codesign_build_substitute}' '#{environment_file}' SHELL ) elsif is_ci and platform == :android @@ -55,7 +53,6 @@ private_lane :replace_debug_info_environment_variables do |options| sed -r -i '#{changelog_substitute}' '#{environment_file}' sed -r -i '#{version_substitute}' '#{environment_file}' sed -r -i '#{build_number_substitute}' '#{environment_file}' - sed -r -i '#{codesign_build_substitute}' '#{environment_file}' SHELL ) end diff --git a/suite-native/app/ios/Podfile.lock b/suite-native/app/ios/Podfile.lock index 72221ce472..eee8f8b62c 100644 --- a/suite-native/app/ios/Podfile.lock +++ b/suite-native/app/ios/Podfile.lock @@ -853,4 +853,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: d37876aaf00e7f8309b694188119b139b8452ca1 -COCOAPODS: 1.11.3 +COCOAPODS: 1.14.3 diff --git a/suite-native/app/ios/TrezorSuite/Info.plist b/suite-native/app/ios/TrezorSuite/Info.plist index 8bc346aaef..b0f62b0aaf 100644 --- a/suite-native/app/ios/TrezorSuite/Info.plist +++ b/suite-native/app/ios/TrezorSuite/Info.plist @@ -24,12 +24,23 @@ 1 ITSAppUsesNonExemptEncryption + LSApplicationCategoryType + LSRequiresIPhoneOS NSAppTransportSecurity + NSAllowsArbitraryLoads + NSExceptionDomains + data.trezor.io/config + + NSExceptionAllowsInsecureHTTPLoads + + NSIncludesSubdomains + + localhost NSExceptionAllowsInsecureHTTPLoads @@ -40,9 +51,11 @@ NSCameraUsageDescription $(PRODUCT_NAME) needs access to your Camera to scan your XPUB. NSFaceIDUsageDescription - $(PRODUCT_NAME) needs Face ID and Touch ID to keep sensitive data about your portfolio private. + $(PRODUCT_NAME) needs Face ID and Touch ID to keep sensitive data about your portfolio private. NSLocationWhenInUseUsageDescription + NSMicrophoneUsageDescription + This app does not require access to the microphone. UIAppFonts TTSatoshi-Bold.otf @@ -72,7 +85,5 @@ UIViewControllerBasedStatusBarAppearance - NSMicrophoneUsageDescription - This app does not require access to the microphone. diff --git a/suite-native/message-system/src/components/FeatureMessageScreen.tsx b/suite-native/message-system/src/components/FeatureMessageScreen.tsx index bc0c3490ac..f2125091cd 100644 --- a/suite-native/message-system/src/components/FeatureMessageScreen.tsx +++ b/suite-native/message-system/src/components/FeatureMessageScreen.tsx @@ -126,7 +126,7 @@ export const FeatureMessageScreen = () => { )} {isDismissable && ( - )}