diff --git a/.gitmodules b/.gitmodules index 85fa644e073..e1703690e9e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -99,9 +99,6 @@ [submodule "vendor/nim-keycard-go"] path = vendor/nim-keycard-go url = https://github.com/status-im/nim-keycard-go -[submodule "vendor/status-keycard-go"] - path = vendor/status-keycard-go - url = https://github.com/status-im/status-keycard-go.git [submodule "vendor/SortFilterProxyModel"] path = vendor/SortFilterProxyModel url = https://github.com/status-im/SortFilterProxyModel.git diff --git a/Makefile b/Makefile index dc520a358e4..b2c5e6a97dd 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,6 @@ GIT_ROOT ?= $(shell git rev-parse --show-toplevel 2>/dev/null || echo .) run-windows \ tests-nim-linux \ status-go \ - status-keycard-go \ status-keycard-qt \ statusq-sanity-checker \ run-statusq-sanity-checker \ @@ -232,7 +231,6 @@ ifeq ($(mkspecs),macx) ifeq ("$(shell sysctl -nq hw.optional.arm64)","1") ifneq ($(QT_ARCH),arm64) STATUSGO_MAKE_PARAMS += GOBIN_SHARED_LIB_CFLAGS="CGO_ENABLED=1 GOOS=darwin GOARCH=amd64" - STATUSKEYCARDGO_MAKE_PARAMS += CGOFLAGS="CGO_ENABLED=1 GOOS=darwin GOARCH=amd64" COMMON_CMAKE_CONFIG_PARAMS += -DCMAKE_OSX_ARCHITECTURES=x86_64 QRCODEGEN_MAKE_PARAMS += CFLAGS="-target x86_64-apple-macos10.12" NIM_PARAMS += --cpu:amd64 --os:MacOSX --passL:"-arch x86_64" --passC:"-arch x86_64" @@ -253,9 +251,6 @@ NIMSDS_LIBDIR := $(NIM_SDS_SOURCE_DIR)/build NIMSDS_LIBFILE := $(NIMSDS_LIBDIR)/libsds.$(LIB_EXT) NIM_EXTRA_PARAMS += --passL:"-L$(NIMSDS_LIBDIR)" --passL:"-lsds" STATUSGO_MAKE_PARAMS += NIM_SDS_SOURCE_DIR="$(NIM_SDS_SOURCE_DIR)" -# Keycard library selection: set to 1 to use status-keycard-qt (Qt/C++), 0 for status-keycard-go (Go) -# Default: use status-keycard-go for now (stable), switch to 1 to test status-keycard-qt -USE_STATUS_KEYCARD_QT ?= 0 INCLUDE_DEBUG_SYMBOLS ?= false ifeq ($(INCLUDE_DEBUG_SYMBOLS),true) @@ -269,7 +264,6 @@ else # Additional optimization flags for release builds are not included at present; # adding them will involve refactoring config.nims in the root of this repo STATUSGO_MAKE_PARAMS += CGO_CFLAGS="-O3" - STATUSKEYCARDGO_MAKE_PARAMS += CGO_CFLAGS="-O3" NIM_PARAMS += -d:release -d:lto endif @@ -511,15 +505,6 @@ status-go-clean: echo -e "\033[92mCleaning:\033[39m status-go" rm -f $(STATUSGO) -export STATUSKEYCARDGO := vendor/status-keycard-go/build/libkeycard/libkeycard.$(LIB_EXT) -export STATUSKEYCARDGO_LIBDIR := "$(shell pwd)/$(shell dirname "$(STATUSKEYCARDGO)")" - -status-keycard-go: $(STATUSKEYCARDGO) -$(STATUSKEYCARDGO): | deps - echo -e $(BUILD_MSG) "status-keycard-go" - + $(MAKE) -C vendor/status-keycard-go \ - $(if $(filter 1 true,$(USE_MOCKED_KEYCARD_LIB)), build-mocked-lib, build-lib) \ - $(STATUSKEYCARDGO_MAKE_PARAMS) $(HANDLE_OUTPUT) ## ## status-keycard-qt (Qt/C++ based keycard library) @@ -557,22 +542,9 @@ status-keycard-qt-clean: echo -e "\033[92mCleaning:\033[39m status-keycard-qt" rm -rf $(STATUS_KEYCARD_QT_BUILD_DIR) -## -## Keycard library selection -## - -# Set the keycard library and paths based on USE_STATUS_KEYCARD_QT -ifeq ($(USE_STATUS_KEYCARD_QT),1) - KEYCARD_LIB := $(STATUSKEYCARD_QT_LIB) - KEYCARD_LIBDIR := $(STATUSKEYCARD_QT_LIBDIR) - # Set the feature flag to use the keycard qt library - export FLAG_USE_KEYCARD_QT := 1 - -else - KEYCARD_LIB := $(STATUSKEYCARDGO) - KEYCARD_LIBDIR := $(STATUSKEYCARDGO_LIBDIR) -endif - +KEYCARD_LIB := $(STATUSKEYCARD_QT_LIB) +KEYCARD_LIBDIR := $(STATUSKEYCARD_QT_LIBDIR) +export KEYCARD_LIBDIR KEYCARD_DYLIB_NAME := $(notdir $(KEYCARD_LIB)) KEYCARD_LINKNAME := $(patsubst lib%,%,$(basename $(KEYCARD_DYLIB_NAME))) @@ -874,7 +846,7 @@ $(STATUS_CLIENT_EXE): compile_windows_resources nim_status_client nim_windows_la cp bin/nim_windows_launcher.exe $(OUTPUT)/Status.exe rcedit $(OUTPUT)/bin/Status.exe --set-icon $(OUTPUT)/resources/status.ico rcedit $(OUTPUT)/Status.exe --set-icon $(OUTPUT)/resources/status.ico - cp $(DOTHERSIDE_LIBFILE) $(STATUSGO) $(STATUSKEYCARDGO) $(NIMSDS_LIBFILE) $(STATUSQ_LIB_PATH)/* $(STATUSQ_BUILD_PATH)/bin/$(COMMON_CMAKE_BUILD_TYPE)/* $(OUTPUT)/bin/ + cp $(DOTHERSIDE_LIBFILE) $(STATUSGO) $(KEYCARD_LIB) $(NIMSDS_LIBFILE) $(STATUSQ_LIB_PATH)/* $(STATUSQ_BUILD_PATH)/bin/$(COMMON_CMAKE_BUILD_TYPE)/* $(OUTPUT)/bin/ cp "$(shell which libstdc++-6.dll)" $(OUTPUT)/bin/ cp "$(shell which libgcc_s_seh-1.dll)" $(OUTPUT)/bin/ cp "$(shell which libwinpthread-1.dll)" $(OUTPUT)/bin/ @@ -929,7 +901,7 @@ clean-destdir: rm -rf bin/* clean: | clean-common clean-destdir statusq-clean status-go-clean status-keycard-qt-clean dotherside-clean storybook-clean clean-translations - rm -rf bottles/* pkg/* tmp/* $(STATUSKEYCARDGO) + rm -rf bottles/* pkg/* tmp/* + $(MAKE) -C vendor/QR-Code-generator/c/ --no-print-directory clean clean-git: diff --git a/config.nims b/config.nims index ebbab5676c9..81ecb539b6d 100644 --- a/config.nims +++ b/config.nims @@ -19,7 +19,7 @@ if hostOS == "macosx": # note: macdeployqt rewrites rpath appropriately when building the .app bundle switch("passL", "-rpath" & " " & getEnv("QT_LIBDIR")) switch("passL", "-rpath" & " " & getEnv("STATUSGO_LIBDIR")) - switch("passL", "-rpath" & " " & getEnv("STATUSKEYCARDGO_LIBDIR")) + switch("passL", "-rpath" & " " & getEnv("KEYCARD_LIBDIR")) switch("passL", "-rpath" & " " & getEnv("STATUSQ_INSTALL_PATH") & "/StatusQ") # statically link these libs switch("passL", "bottles/openssl@3/lib/libcrypto.a") diff --git a/mobile/scripts/buildNimStatusClient.sh b/mobile/scripts/buildNimStatusClient.sh index f7e653fafeb..ef2086d2b2c 100755 --- a/mobile/scripts/buildNimStatusClient.sh +++ b/mobile/scripts/buildNimStatusClient.sh @@ -12,7 +12,6 @@ DEBUG=${DEBUG:-0} FLAG_DAPPS_ENABLED=${FLAG_DAPPS_ENABLED:-0} FLAG_CONNECTOR_ENABLED=${FLAG_CONNECTOR_ENABLED:-0} FLAG_KEYCARD_ENABLED=${FLAG_KEYCARD_ENABLED:-0} -FLAG_USE_KEYCARD_QT=${FLAG_USE_KEYCARD_QT:-$FLAG_USE_KEYCARD_QT} FLAG_SINGLE_STATUS_INSTANCE_ENABLED=${FLAG_SINGLE_STATUS_INSTANCE_ENABLED:-0} FLAG_BROWSER_ENABLED=${FLAG_BROWSER_ENABLED:-0} FLAG_BUY_ENABLED=${FLAG_BUY_ENABLED:-1} @@ -53,7 +52,6 @@ FEATURE_FLAGS=( FLAG_KEYCARD_ENABLED=$FLAG_KEYCARD_ENABLED FLAG_SINGLE_STATUS_INSTANCE_ENABLED=$FLAG_SINGLE_STATUS_INSTANCE_ENABLED FLAG_BROWSER_ENABLED=$FLAG_BROWSER_ENABLED - FLAG_USE_KEYCARD_QT=$FLAG_USE_KEYCARD_QT FLAG_BUY_ENABLED=$FLAG_BUY_ENABLED FLAG_SWAP_ENABLED=$FLAG_SWAP_ENABLED FLAG_BRIDGE_ENABLED=$FLAG_BRIDGE_ENABLED diff --git a/src/app/boot/app_controller.nim b/src/app/boot/app_controller.nim index 4e5aeaa11ec..99c1910f1e3 100644 --- a/src/app/boot/app_controller.nim +++ b/src/app/boot/app_controller.nim @@ -364,8 +364,7 @@ proc mainDidLoad*(self: AppController) = if not self.onboardingModule.isNil: self.runPostOnboardingTasks() - # NB: after onboarding is finished, we need to switch back to the old service (Settings/Keycard) - # TODO remove `keycardService` when everything is ported to `keycardServiceV2` + # Reset keycard library state from RPC mode (used during onboarding) to flow mode (used post-login) self.keycardService.resetAPI() self.keycardService.init() diff --git a/src/app/global/feature_flags.nim b/src/app/global/feature_flags.nim index 4d4da611928..0238793570e 100644 --- a/src/app/global/feature_flags.nim +++ b/src/app/global/feature_flags.nim @@ -34,7 +34,6 @@ const DEFAULT_FLAG_SINGLE_STATUS_INSTANCE_ENABLED = true const DEFAULT_FLAG_BUY_ENABLED = true const DEFAULT_FLAG_SWAP_ENABLED = true const DEFAULT_FLAG_BRIDGE_ENABLED = true -const DEFAULT_FLAG_USE_KEYCARD_QT = false # Public feature flags featureFlag("SEND_VIA_PERSONAL_CHAT_ENABLED", DEFAULT_FLAG_SEND_VIA_PERSONAL_CHAT_ENABLED) @@ -54,7 +53,6 @@ featureFlag("SINGLE_STATUS_INSTANCE_ENABLED", DEFAULT_FLAG_SINGLE_STATUS_INSTANC featureFlag("BUY_ENABLED", DEFAULT_FLAG_BUY_ENABLED, true) featureFlag("SWAP_ENABLED", DEFAULT_FLAG_SWAP_ENABLED, true) featureFlag("BRIDGE_ENABLED", DEFAULT_FLAG_BRIDGE_ENABLED, true) -featureFlag("USE_KEYCARD_QT", DEFAULT_FLAG_USE_KEYCARD_QT, true) # The `featureGuard` macro conditionally replaces the guarded code # There are two main usages: # 1. With a statement list: diff --git a/src/app/modules/onboarding/controller.nim b/src/app/modules/onboarding/controller.nim index ec72706991c..9f350b8528d 100644 --- a/src/app/modules/onboarding/controller.nim +++ b/src/app/modules/onboarding/controller.nim @@ -102,24 +102,13 @@ proc init*(self: Controller) = self.delegate.onKeycardExportRestoreKeysSuccess(args.exportedKeys) self.connectionIds.add(handlerId) - featureGuard USE_KEYCARD_QT: - handlerId = self.events.onWithUUID(SIGNAL_KEYCARD_LOGIN_FINISHED) do(e: Args): - let args = KeycardLoginArgs(e) - if args.error.len > 0: - self.delegate.onKeycardExportLoginKeysFailure(args.error) - else: - self.delegate.onKeycardExportLoginKeysSuccess(args.exportedKeys) - self.connectionIds.add(handlerId) - else: - handlerId = self.events.onWithUUID(SIGNAL_KEYCARD_EXPORT_LOGIN_KEYS_FAILURE) do(e: Args): - let args = KeycardErrorArg(e) + handlerId = self.events.onWithUUID(SIGNAL_KEYCARD_LOGIN_FINISHED) do(e: Args): + let args = KeycardLoginArgs(e) + if args.error.len > 0: self.delegate.onKeycardExportLoginKeysFailure(args.error) - self.connectionIds.add(handlerId) - - handlerId = self.events.onWithUUID(SIGNAL_KEYCARD_EXPORT_LOGIN_KEYS_SUCCESS) do(e: Args): - let args = KeycardExportedKeysArg(e) + else: self.delegate.onKeycardExportLoginKeysSuccess(args.exportedKeys) - self.connectionIds.add(handlerId) + self.connectionIds.add(handlerId) handlerId = self.events.onWithUUID(SIGNAL_LOGIN_ERROR) do(e: Args): let args = LoginErrorArgs(e) diff --git a/src/app/modules/onboarding/module.nim b/src/app/modules/onboarding/module.nim index 7493d6d883f..7190c927678 100644 --- a/src/app/modules/onboarding/module.nim +++ b/src/app/modules/onboarding/module.nim @@ -283,11 +283,7 @@ method loginRequested*[T](self: Module[T], keyUid: string, loginFlow: int, dataJ of LoginMethod.Password: self.controller.login(account, data["password"].str) of LoginMethod.Keycard: - featureGuard USE_KEYCARD_QT: - self.loginKeycard(keyUid, data["pin"].str) - else: - self.authorize(data["pin"].str) - # We will continue the flow when the card is authorized in onKeycardStateUpdated + self.loginKeycard(keyUid, data["pin"].str) of LoginMethod.Mnemonic: self.controller.login(account, password = "", mnemonic = data["mnemonic"].str) else: @@ -389,12 +385,6 @@ method onLocalPairingStatusUpdate*[T](self: Module[T], status: LocalPairingStatu method onKeycardStateUpdated*[T](self: Module[T], keycardEvent: KeycardEventDto) = self.view.setKeycardEvent(keycardEvent) - featureGuard (not USE_KEYCARD_QT): - if keycardEvent.state == KeycardState.Authorized and self.loginFlow == LoginMethod.Keycard: - # After authorizing, we export the keys - self.controller.exportLoginKeysFromKeycard() - # We will login once we have the keys in onKeycardExportLoginKeysSuccess - if keycardEvent.state == KeycardState.NotEmpty and self.view.getPinSettingState() == ProgressState.InProgress.int: # We just finished setting the pin self.view.setPinSettingState(ProgressState.Success) diff --git a/src/app_service/service/keycardV2/service.nim b/src/app_service/service/keycardV2/service.nim index c7e6536d07f..79ae0f7b9e2 100644 --- a/src/app_service/service/keycardV2/service.nim +++ b/src/app_service/service/keycardV2/service.nim @@ -117,9 +117,6 @@ QtObject: if status_const.IS_MACOS and status_const.IS_INTEL: sleep 700 self.initializeRPC() - featureGuard (not USE_KEYCARD_QT): - self.startDetection() - discard proc initializeRPC(self: Service) {.slot, featureGuard(KEYCARD_ENABLED).} = var response = keycard_go.keycardInitializeRPC() diff --git a/vendor/status-keycard-go b/vendor/status-keycard-go deleted file mode 160000 index 76c880480c6..00000000000 --- a/vendor/status-keycard-go +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 76c880480c62dbf0ee67ee342f87ab80a928ed73