feat(@desktop/wallet): account Interaction - remove master key and accounts
Closes: #11707
This commit is contained in:
parent
d832a306a4
commit
2e1b60ab06
|
@ -37,6 +37,9 @@ proc renameKeypair*(self: Controller, keyUid: string, name: string) =
|
||||||
proc deleteAccount*(self: Controller, address: string) =
|
proc deleteAccount*(self: Controller, address: string) =
|
||||||
self.walletAccountService.deleteAccount(address)
|
self.walletAccountService.deleteAccount(address)
|
||||||
|
|
||||||
|
proc deleteKeypair*(self: Controller, keyUid: string) =
|
||||||
|
self.walletAccountService.deleteKeypair(keyUid)
|
||||||
|
|
||||||
proc getKeycardsWithSameKeyUid*(self: Controller, keyUid: string): seq[KeycardDto] =
|
proc getKeycardsWithSameKeyUid*(self: Controller, keyUid: string): seq[KeycardDto] =
|
||||||
return self.walletAccountService.getKeycardsWithSameKeyUid(keyUid)
|
return self.walletAccountService.getKeycardsWithSameKeyUid(keyUid)
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,9 @@ method syncKeycard*(self: AccessInterface) {.base.} =
|
||||||
method deleteAccount*(self: AccessInterface, address: string) {.base.} =
|
method deleteAccount*(self: AccessInterface, address: string) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
method deleteKeypair*(self: AccessInterface, keyUid: string) {.base.} =
|
||||||
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
method refreshWalletAccounts*(self: AccessInterface) {.base.} =
|
method refreshWalletAccounts*(self: AccessInterface) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,9 @@ method moveAccountFinally*(self: Module, fromPosition: int, toPosition: int) =
|
||||||
method deleteAccount*(self: Module, address: string) =
|
method deleteAccount*(self: Module, address: string) =
|
||||||
self.controller.deleteAccount(address)
|
self.controller.deleteAccount(address)
|
||||||
|
|
||||||
|
method deleteKeypair*(self: Module, keyUid: string) =
|
||||||
|
self.controller.deleteKeypair(keyUid)
|
||||||
|
|
||||||
method toggleIncludeWatchOnlyAccount*(self: Module) =
|
method toggleIncludeWatchOnlyAccount*(self: Module) =
|
||||||
self.controller.toggleIncludeWatchOnlyAccount()
|
self.controller.toggleIncludeWatchOnlyAccount()
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,9 @@ QtObject:
|
||||||
proc deleteAccount*(self: View, address: string) {.slot.} =
|
proc deleteAccount*(self: View, address: string) {.slot.} =
|
||||||
self.delegate.deleteAccount(address)
|
self.delegate.deleteAccount(address)
|
||||||
|
|
||||||
|
proc deleteKeypair*(self: View, keyUid: string) {.slot.} =
|
||||||
|
self.delegate.deleteKeypair(keyUid)
|
||||||
|
|
||||||
proc keyPairModel*(self: View): KeyPairModel =
|
proc keyPairModel*(self: View): KeyPairModel =
|
||||||
return self.keyPairModel
|
return self.keyPairModel
|
||||||
|
|
||||||
|
|
|
@ -474,6 +474,7 @@ proc loginLocalPairingAccount*(self: Controller) =
|
||||||
self.accountsService.login(self.localPairingStatus.account, self.localPairingStatus.password)
|
self.accountsService.login(self.localPairingStatus.account, self.localPairingStatus.password)
|
||||||
else:
|
else:
|
||||||
var kcEvent = KeycardEvent()
|
var kcEvent = KeycardEvent()
|
||||||
|
kcEvent.keyUid = self.localPairingStatus.account.keyUid
|
||||||
kcEvent.whisperKey.privateKey = self.localPairingStatus.chatKey
|
kcEvent.whisperKey.privateKey = self.localPairingStatus.chatKey
|
||||||
kcEvent.encryptionKey.publicKey = self.localPairingStatus.password
|
kcEvent.encryptionKey.publicKey = self.localPairingStatus.password
|
||||||
discard self.accountsService.loginAccountKeycard(self.localPairingStatus.account, kcEvent)
|
discard self.accountsService.loginAccountKeycard(self.localPairingStatus.account, kcEvent)
|
||||||
|
|
|
@ -556,6 +556,22 @@ QtObject:
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error "error: ", procName="deleteAccount", errName = e.name, errDesription = e.msg
|
error "error: ", procName="deleteAccount", errName = e.name, errDesription = e.msg
|
||||||
|
|
||||||
|
proc deleteKeypair*(self: Service, keyUid: string) =
|
||||||
|
try:
|
||||||
|
let localKeypairRelatedAccounts = self.getWalletAccountsForKeypair(keyUid)
|
||||||
|
if localKeypairRelatedAccounts.len == 0:
|
||||||
|
error "there are no known accounts", keyUid=keyUid, procName="deleteKeypair"
|
||||||
|
return
|
||||||
|
let response = status_go_accounts.deleteKeypair(keyUid)
|
||||||
|
if not response.error.isNil:
|
||||||
|
error "status-go error", procName="deleteKeypair", errCode=response.error.code, errDesription=response.error.message
|
||||||
|
return
|
||||||
|
self.updateAccountsPositions()
|
||||||
|
for acc in localKeypairRelatedAccounts:
|
||||||
|
self.removeAccountFromLocalStoreAndNotify(acc.address)
|
||||||
|
except Exception as e:
|
||||||
|
error "error: ", procName="deleteKeypair", errName = e.name, errDesription = e.msg
|
||||||
|
|
||||||
proc getCurrency*(self: Service): string =
|
proc getCurrency*(self: Service): string =
|
||||||
return self.settingsService.getCurrency()
|
return self.settingsService.getCurrency()
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,10 @@ proc deleteAccount*(address: string): RpcResponse[JsonNode] {.raises: [Exception
|
||||||
let payload = %* [address]
|
let payload = %* [address]
|
||||||
return core.callPrivateRPC("accounts_deleteAccount", payload)
|
return core.callPrivateRPC("accounts_deleteAccount", payload)
|
||||||
|
|
||||||
|
proc deleteKeypair*(keyUid: string): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
let payload = %* [keyUid]
|
||||||
|
return core.callPrivateRPC("accounts_deleteKeypair", payload)
|
||||||
|
|
||||||
## Adds a new account and creates a Keystore file if password is provided, otherwise it only creates a new account. Notifies paired devices.
|
## Adds a new account and creates a Keystore file if password is provided, otherwise it only creates a new account. Notifies paired devices.
|
||||||
proc addAccount*(password, name, address, path, publicKey, keyUid, accountType, colorId, emoji: string):
|
proc addAccount*(password, name, address, path, publicKey, keyUid, accountType, colorId, emoji: string):
|
||||||
RpcResponse[JsonNode] {.raises: [Exception].} =
|
RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||||
|
|
|
@ -20,6 +20,7 @@ Rectangle {
|
||||||
signal goToAccountView(var account)
|
signal goToAccountView(var account)
|
||||||
signal toggleIncludeWatchOnlyAccount()
|
signal toggleIncludeWatchOnlyAccount()
|
||||||
signal runRenameKeypairFlow()
|
signal runRenameKeypairFlow()
|
||||||
|
signal runRemoveKeypairFlow()
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: d
|
id: d
|
||||||
|
@ -125,7 +126,7 @@ Rectangle {
|
||||||
icon.name: "delete"
|
icon.name: "delete"
|
||||||
icon.color: Theme.palette.dangerColor1
|
icon.color: Theme.palette.dangerColor1
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
console.warn("TODO: remove master keys and associated accounts")
|
root.runRemoveKeypairFlow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,10 @@ QtObject {
|
||||||
return accountsModule.deleteAccount(address)
|
return accountsModule.deleteAccount(address)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deleteKeypair(keyUid) {
|
||||||
|
return accountsModule.deleteKeypair(keyUid)
|
||||||
|
}
|
||||||
|
|
||||||
function updateAccount(address, accountName, colorId, emoji) {
|
function updateAccount(address, accountName, colorId, emoji) {
|
||||||
return accountsModule.updateAccount(address, accountName, colorId, emoji)
|
return accountsModule.updateAccount(address, accountName, colorId, emoji)
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import shared.panels 1.0
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
import StatusQ.Components 0.1
|
import StatusQ.Components 0.1
|
||||||
|
|
||||||
|
import shared.popups 1.0
|
||||||
import shared.popups.addaccount 1.0
|
import shared.popups.addaccount 1.0
|
||||||
|
|
||||||
import "../../stores"
|
import "../../stores"
|
||||||
|
@ -112,6 +114,11 @@ Column {
|
||||||
renameKeypairPopup.accounts = model.keyPair.accounts
|
renameKeypairPopup.accounts = model.keyPair.accounts
|
||||||
renameKeypairPopup.active = true
|
renameKeypairPopup.active = true
|
||||||
}
|
}
|
||||||
|
onRunRemoveKeypairFlow: {
|
||||||
|
removeKeypairPopup.keyUid = model.keyPair.keyUid
|
||||||
|
removeKeypairPopup.name = model.keyPair.name
|
||||||
|
removeKeypairPopup.active = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,4 +146,27 @@ Column {
|
||||||
renameKeypairPopup.item.open()
|
renameKeypairPopup.item.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loader {
|
||||||
|
id: removeKeypairPopup
|
||||||
|
active: false
|
||||||
|
|
||||||
|
property string keyUid
|
||||||
|
property string name
|
||||||
|
|
||||||
|
sourceComponent: ConfirmationDialog {
|
||||||
|
headerSettings.title: qsTr("Confirm %1 Removal").arg(removeKeypairPopup.name)
|
||||||
|
|
||||||
|
confirmationText: qsTr("You will not be able to restore viewing access to any account of this keypair in the future unless you import this keypair again.")
|
||||||
|
confirmButtonLabel: qsTr("Remove keypair")
|
||||||
|
onConfirmButtonClicked: {
|
||||||
|
root.walletStore.deleteKeypair(removeKeypairPopup.keyUid)
|
||||||
|
removeKeypairPopup.active = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onLoaded: {
|
||||||
|
removeKeypairPopup.item.open()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 1df8c1c5110e7b3600ea8defecaf0447009c1b18
|
Subproject commit 0ae7aa44f00bff345539c1e288705057e7e4574c
|
Loading…
Reference in New Issue