chore(@desktop/keycard): `keyPairForAuthentication` replaced by `keyPairForProcessing`
This commit is contained in:
parent
e34aac0a0f
commit
1bc9deef47
|
@ -158,7 +158,7 @@ proc preStateActivities[T](self: Module[T], currFlowType: FlowType, nextStateTyp
|
|||
self.controller.setCurrentKeycardStateToLocked(flowEvent.instanceUID)
|
||||
|
||||
if currFlowType == FlowType.Authentication:
|
||||
self.view.setLockedPropForKeyPairForAuthentication(nextStateType == StateType.MaxPinRetriesReached)
|
||||
self.view.setLockedPropForKeyPairForProcessing(nextStateType == StateType.MaxPinRetriesReached)
|
||||
|
||||
if currFlowType == FlowType.UnlockKeycard:
|
||||
if nextStateType == StateType.UnlockKeycardOptions:
|
||||
|
@ -353,7 +353,7 @@ proc prepareKeyPairItemForAuthentication[T](self: Module[T], keyUid: string) =
|
|||
item.setImage("")
|
||||
item.setIcon("keycard")
|
||||
item.setPairType(KeyPairType.Unknown.int)
|
||||
self.view.setKeyPairForAuthentication(item)
|
||||
self.view.setKeyPairForProcessing(item)
|
||||
|
||||
method setKeyPairForProcessing*[T](self: Module[T], item: KeyPairItem) =
|
||||
if item.isNil:
|
||||
|
@ -500,8 +500,9 @@ proc updateKeyPairItemIfDataAreKnown[T](self: Module[T], address: string, item:
|
|||
return true
|
||||
return false
|
||||
|
||||
method updateKeyPairForProcessing*[T](self: Module[T], cardMetadata: CardMetadata) =
|
||||
var item = newKeyPairItem(keyUid = "",
|
||||
proc buildKeyPairItemBasedOnCardMetadata[T](self: Module[T], cardMetadata: CardMetadata):
|
||||
tuple[item: KeyPairItem, knownKeyPair: bool] =
|
||||
result.item = newKeyPairItem(keyUid = "",
|
||||
pubKey = "",
|
||||
locked = false,
|
||||
name = cardMetadata.name,
|
||||
|
@ -509,13 +510,16 @@ method updateKeyPairForProcessing*[T](self: Module[T], cardMetadata: CardMetadat
|
|||
icon = "keycard",
|
||||
pairType = KeyPairType.Unknown,
|
||||
derivedFrom = "")
|
||||
var knownKeyPair = true
|
||||
result.knownKeyPair = true
|
||||
for wa in cardMetadata.walletAccounts:
|
||||
if self.updateKeyPairItemIfDataAreKnown(wa.address, item):
|
||||
if self.updateKeyPairItemIfDataAreKnown(wa.address, result.item):
|
||||
continue
|
||||
let balance = self.controller.getCurrencyBalanceForAddress(wa.address)
|
||||
knownKeyPair = false
|
||||
item.addAccount(newKeyPairAccountItem(name = "", wa.path, wa.address, pubKey = "", emoji = "", color = self.generateRandomColor(), icon = "wallet", balance))
|
||||
result.knownKeyPair = false
|
||||
result.item.addAccount(newKeyPairAccountItem(name = "", wa.path, wa.address, pubKey = "", emoji = "", color = self.generateRandomColor(), icon = "wallet", balance))
|
||||
|
||||
method updateKeyPairForProcessing*[T](self: Module[T], cardMetadata: CardMetadata) =
|
||||
let(item, knownKeyPair) = self.buildKeyPairItemBasedOnCardMetadata(cardMetadata)
|
||||
self.view.setKeyPairStoredOnKeycardIsKnown(knownKeyPair)
|
||||
self.view.setKeyPairForProcessing(item)
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@ QtObject:
|
|||
keyPairModel: KeyPairModel
|
||||
keyPairModelVariant: QVariant
|
||||
keyPairStoredOnKeycardIsKnown: bool
|
||||
keyPairForAuthentication: KeyPairItem
|
||||
keyPairForAuthenticationVariant: QVariant
|
||||
keyPairForProcessing: KeyPairItem
|
||||
keyPairForProcessingVariant: QVariant
|
||||
keycardData: string # used to temporary store the data coming from keycard, depends on current state different data may be stored
|
||||
|
@ -26,10 +24,6 @@ QtObject:
|
|||
self.keyPairModel.delete
|
||||
if not self.keyPairModelVariant.isNil:
|
||||
self.keyPairModelVariant.delete
|
||||
if not self.keyPairForAuthentication.isNil:
|
||||
self.keyPairForAuthentication.delete
|
||||
if not self.keyPairForAuthenticationVariant.isNil:
|
||||
self.keyPairForAuthenticationVariant.delete
|
||||
if not self.keyPairForProcessing.isNil:
|
||||
self.keyPairForProcessing.delete
|
||||
if not self.keyPairForProcessingVariant.isNil:
|
||||
|
@ -127,23 +121,6 @@ QtObject:
|
|||
proc setKeyPairStoredOnKeycardIsKnown*(self: View, value: bool) =
|
||||
self.keyPairStoredOnKeycardIsKnown = value
|
||||
|
||||
proc getKeyPairForAuthentication*(self: View): QVariant {.slot.} =
|
||||
if self.keyPairForAuthenticationVariant.isNil:
|
||||
return newQVariant()
|
||||
return self.keyPairForAuthenticationVariant
|
||||
QtProperty[QVariant] keyPairForAuthentication:
|
||||
read = getKeyPairForAuthentication
|
||||
proc setKeyPairForAuthentication*(self: View, item: KeyPairItem) =
|
||||
if self.keyPairForAuthentication.isNil:
|
||||
self.keyPairForAuthentication = newKeyPairItem()
|
||||
if self.keyPairForAuthenticationVariant.isNil:
|
||||
self.keyPairForAuthenticationVariant = newQVariant(self.keyPairForAuthentication)
|
||||
self.keyPairForAuthentication.setItem(item)
|
||||
proc setLockedPropForKeyPairForAuthentication*(self: View, locked: bool) =
|
||||
if self.keyPairForAuthentication.isNil:
|
||||
return
|
||||
self.keyPairForAuthentication.setLocked(locked)
|
||||
|
||||
proc getKeyPairForProcessing*(self: View): KeyPairItem =
|
||||
return self.keyPairForProcessing
|
||||
proc getKeyPairForProcessingAsVariant*(self: View): QVariant {.slot.} =
|
||||
|
@ -158,6 +135,10 @@ QtObject:
|
|||
if self.keyPairForProcessingVariant.isNil:
|
||||
self.keyPairForProcessingVariant = newQVariant(self.keyPairForProcessing)
|
||||
self.keyPairForProcessing.setItem(item)
|
||||
proc setLockedPropForKeyPairForProcessing*(self: View, locked: bool) =
|
||||
if self.keyPairForProcessing.isNil:
|
||||
return
|
||||
self.keyPairForProcessing.setLocked(locked)
|
||||
|
||||
proc setPin*(self: View, value: string) {.slot.} =
|
||||
self.delegate.setPin(value)
|
||||
|
|
|
@ -74,20 +74,6 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: keyPairForAuthenticationComponent
|
||||
KeyPairItem {
|
||||
keyPairType: root.sharedKeycardModule.keyPairForAuthentication.pairType
|
||||
keyPairPubKey: root.sharedKeycardModule.keyPairForAuthentication.pubKey
|
||||
keyPairName: root.sharedKeycardModule.keyPairForAuthentication.name
|
||||
keyPairIcon: root.sharedKeycardModule.keyPairForAuthentication.icon
|
||||
keyPairImage: root.sharedKeycardModule.keyPairForAuthentication.image
|
||||
keyPairDerivedFrom: root.sharedKeycardModule.keyPairForAuthentication.derivedFrom
|
||||
keyPairAccounts: root.sharedKeycardModule.keyPairForAuthentication.accounts
|
||||
keyPairCardLocked: root.sharedKeycardModule.keyPairForAuthentication.locked
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: Style.current.xlPadding
|
||||
|
@ -192,8 +178,8 @@ Item {
|
|||
}
|
||||
}
|
||||
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.authentication &&
|
||||
!!root.sharedKeycardModule.keyPairForAuthentication &&
|
||||
root.sharedKeycardModule.keyPairForAuthentication.name !== "") {
|
||||
!!root.sharedKeycardModule.keyPairForProcessing &&
|
||||
root.sharedKeycardModule.keyPairForProcessing.name !== "") {
|
||||
if(root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.keycardInserted ||
|
||||
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.insertKeycard ||
|
||||
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.readingKeycard ||
|
||||
|
@ -349,7 +335,7 @@ Item {
|
|||
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.biometricsPinFailed ||
|
||||
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.biometricsPinInvalid ||
|
||||
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.wrongKeycard) {
|
||||
return keyPairForAuthenticationComponent
|
||||
return keyPairForProcessingComponent
|
||||
}
|
||||
}
|
||||
if (root.sharedKeycardModule.currentState.flowType === Constants.keycardSharedFlow.displayKeycardContent) {
|
||||
|
|
|
@ -77,20 +77,6 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: keyPairForAuthenticationComponent
|
||||
KeyPairItem {
|
||||
keyPairType: root.sharedKeycardModule.keyPairForAuthentication.pairType
|
||||
keyPairPubKey: root.sharedKeycardModule.keyPairForAuthentication.pubKey
|
||||
keyPairName: root.sharedKeycardModule.keyPairForAuthentication.name
|
||||
keyPairIcon: root.sharedKeycardModule.keyPairForAuthentication.icon
|
||||
keyPairImage: root.sharedKeycardModule.keyPairForAuthentication.image
|
||||
keyPairDerivedFrom: root.sharedKeycardModule.keyPairForAuthentication.derivedFrom
|
||||
keyPairAccounts: root.sharedKeycardModule.keyPairForAuthentication.accounts
|
||||
keyPairCardLocked: root.sharedKeycardModule.keyPairForAuthentication.locked
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.topMargin: Style.current.xlPadding
|
||||
|
@ -210,7 +196,7 @@ Item {
|
|||
if (root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.enterPin ||
|
||||
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.wrongPin ||
|
||||
root.sharedKeycardModule.currentState.stateType === Constants.keycardSharedState.wrongKeychainPin) {
|
||||
return keyPairForAuthenticationComponent
|
||||
return keyPairForProcessingComponent
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue