Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
38 changes: 5 additions & 33 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down Expand Up @@ -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"
Expand All @@ -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)
Expand All @@ -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

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)))

Expand Down Expand Up @@ -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/
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

won't this work here? $(STATUSKEYCARD_QT_LIB) if it does we can probably get rid of

KEYCARD_LIB := $(STATUSKEYCARD_QT_LIB)

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/
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion config.nims
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 0 additions & 2 deletions mobile/scripts/buildNimStatusClient.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/app/boot/app_controller.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 0 additions & 2 deletions src/app/global/feature_flags.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down
21 changes: 5 additions & 16 deletions src/app/modules/onboarding/controller.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 1 addition & 11 deletions src/app/modules/onboarding/module.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 0 additions & 3 deletions src/app_service/service/keycardV2/service.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
1 change: 0 additions & 1 deletion vendor/status-keycard-go
Submodule status-keycard-go deleted from 76c880
Loading