2022-11-07 11:43:34 +00:00
|
|
|
import QtQuick 2.14
|
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
|
|
|
import "./states"
|
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
|
|
|
|
property var sharedKeycardModule
|
2022-12-16 09:37:08 +00:00
|
|
|
property var emojiPopup
|
2022-11-07 11:43:34 +00:00
|
|
|
readonly property alias primaryButtonEnabled: d.primaryButtonEnabled
|
|
|
|
|
|
|
|
objectName: "KeycardSharedPopupContent"
|
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
|
|
|
property bool primaryButtonEnabled: false
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: loader
|
|
|
|
anchors.fill: parent
|
|
|
|
sourceComponent: {
|
2022-11-09 10:22:08 +00:00
|
|
|
switch (root.sharedKeycardModule.currentState.stateType) {
|
2023-09-01 13:32:21 +00:00
|
|
|
case Constants.keycardSharedState.biometrics:
|
2023-03-03 10:24:50 +00:00
|
|
|
case Constants.keycardSharedState.noPCSCService:
|
2022-11-09 10:22:08 +00:00
|
|
|
case Constants.keycardSharedState.pluginReader:
|
|
|
|
case Constants.keycardSharedState.insertKeycard:
|
|
|
|
case Constants.keycardSharedState.keycardInserted:
|
|
|
|
case Constants.keycardSharedState.readingKeycard:
|
|
|
|
case Constants.keycardSharedState.keyPairMigrateSuccess:
|
|
|
|
case Constants.keycardSharedState.keyPairMigrateFailure:
|
2023-08-29 14:22:41 +00:00
|
|
|
case Constants.keycardSharedState.migrateKeypairToApp:
|
2023-09-06 09:16:23 +00:00
|
|
|
case Constants.keycardSharedState.migrateKeypairToKeycard:
|
2023-08-29 14:22:41 +00:00
|
|
|
case Constants.keycardSharedState.migratingKeypairToApp:
|
|
|
|
case Constants.keycardSharedState.migratingKeypairToKeycard:
|
2022-12-16 09:37:08 +00:00
|
|
|
case Constants.keycardSharedState.creatingAccountNewSeedPhraseSuccess:
|
|
|
|
case Constants.keycardSharedState.creatingAccountNewSeedPhraseFailure:
|
|
|
|
case Constants.keycardSharedState.creatingAccountNewSeedPhrase:
|
2022-12-26 12:52:21 +00:00
|
|
|
case Constants.keycardSharedState.creatingAccountOldSeedPhraseSuccess:
|
|
|
|
case Constants.keycardSharedState.creatingAccountOldSeedPhraseFailure:
|
|
|
|
case Constants.keycardSharedState.creatingAccountOldSeedPhrase:
|
2022-12-27 13:20:58 +00:00
|
|
|
case Constants.keycardSharedState.importingFromKeycardSuccess:
|
|
|
|
case Constants.keycardSharedState.importingFromKeycardFailure:
|
|
|
|
case Constants.keycardSharedState.importingFromKeycard:
|
2022-11-09 10:22:08 +00:00
|
|
|
case Constants.keycardSharedState.keycardRenameSuccess:
|
|
|
|
case Constants.keycardSharedState.keycardRenameFailure:
|
|
|
|
case Constants.keycardSharedState.renamingKeycard:
|
|
|
|
case Constants.keycardSharedState.changingKeycardPin:
|
|
|
|
case Constants.keycardSharedState.changingKeycardPuk:
|
|
|
|
case Constants.keycardSharedState.changingKeycardPukSuccess:
|
|
|
|
case Constants.keycardSharedState.changingKeycardPukFailure:
|
|
|
|
case Constants.keycardSharedState.changingKeycardPairingCode:
|
|
|
|
case Constants.keycardSharedState.changingKeycardPairingCodeSuccess:
|
|
|
|
case Constants.keycardSharedState.changingKeycardPairingCodeFailure:
|
|
|
|
case Constants.keycardSharedState.factoryResetSuccess:
|
|
|
|
case Constants.keycardSharedState.keycardEmptyMetadata:
|
|
|
|
case Constants.keycardSharedState.keycardEmpty:
|
|
|
|
case Constants.keycardSharedState.keycardNotEmpty:
|
|
|
|
case Constants.keycardSharedState.keycardAlreadyUnlocked:
|
|
|
|
case Constants.keycardSharedState.notKeycard:
|
|
|
|
case Constants.keycardSharedState.unlockKeycardOptions:
|
2023-01-27 16:04:07 +00:00
|
|
|
case Constants.keycardSharedState.unlockingKeycard:
|
|
|
|
case Constants.keycardSharedState.unlockKeycardFailure:
|
2022-11-09 10:22:08 +00:00
|
|
|
case Constants.keycardSharedState.unlockKeycardSuccess:
|
|
|
|
case Constants.keycardSharedState.wrongKeycard:
|
|
|
|
case Constants.keycardSharedState.biometricsReadyToSign:
|
|
|
|
case Constants.keycardSharedState.maxPinRetriesReached:
|
|
|
|
case Constants.keycardSharedState.maxPukRetriesReached:
|
|
|
|
case Constants.keycardSharedState.maxPairingSlotsReached:
|
|
|
|
case Constants.keycardSharedState.recognizedKeycard:
|
|
|
|
case Constants.keycardSharedState.keycardMetadataDisplay:
|
|
|
|
case Constants.keycardSharedState.biometricsPasswordFailed:
|
|
|
|
case Constants.keycardSharedState.biometricsPinFailed:
|
|
|
|
case Constants.keycardSharedState.biometricsPinInvalid:
|
2022-11-18 08:16:02 +00:00
|
|
|
case Constants.keycardSharedState.removeKeycard:
|
|
|
|
case Constants.keycardSharedState.sameKeycard:
|
|
|
|
case Constants.keycardSharedState.copyToKeycard:
|
|
|
|
case Constants.keycardSharedState.copyingKeycard:
|
|
|
|
case Constants.keycardSharedState.copyingKeycardSuccess:
|
|
|
|
case Constants.keycardSharedState.copyingKeycardFailure:
|
2022-12-26 12:52:21 +00:00
|
|
|
case Constants.keycardSharedState.seedPhraseAlreadyInUse:
|
2022-11-07 11:43:34 +00:00
|
|
|
return initComponent
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmation:
|
|
|
|
case Constants.keycardSharedState.factoryResetConfirmationDisplayMetadata:
|
2022-11-07 11:43:34 +00:00
|
|
|
return confirmationComponent
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
case Constants.keycardSharedState.selectExistingKeyPair:
|
2022-11-07 11:43:34 +00:00
|
|
|
return selectKeyPairComponent
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
case Constants.keycardSharedState.createPin:
|
|
|
|
case Constants.keycardSharedState.repeatPin:
|
|
|
|
case Constants.keycardSharedState.enterPin:
|
|
|
|
case Constants.keycardSharedState.wrongPin:
|
|
|
|
case Constants.keycardSharedState.wrongKeychainPin:
|
|
|
|
case Constants.keycardSharedState.changingKeycardPinSuccess:
|
|
|
|
case Constants.keycardSharedState.changingKeycardPinFailure:
|
|
|
|
case Constants.keycardSharedState.pinSet:
|
|
|
|
case Constants.keycardSharedState.pinVerified:
|
2022-11-07 11:43:34 +00:00
|
|
|
return keycardPinComponent
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
case Constants.keycardSharedState.createPuk:
|
|
|
|
case Constants.keycardSharedState.repeatPuk:
|
|
|
|
case Constants.keycardSharedState.enterPuk:
|
|
|
|
case Constants.keycardSharedState.wrongPuk:
|
2022-11-07 11:43:34 +00:00
|
|
|
return keycardPukComponent
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
case Constants.keycardSharedState.enterSeedPhrase:
|
|
|
|
case Constants.keycardSharedState.wrongSeedPhrase:
|
2022-11-07 11:43:34 +00:00
|
|
|
return enterSeedPhraseComponent
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
case Constants.keycardSharedState.seedPhraseDisplay:
|
2022-11-07 11:43:34 +00:00
|
|
|
return seedPhraseComponent
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
case Constants.keycardSharedState.seedPhraseEnterWords:
|
2022-11-07 11:43:34 +00:00
|
|
|
return enterSeedPhraseWordsComponent
|
2022-11-09 10:22:08 +00:00
|
|
|
|
|
|
|
case Constants.keycardSharedState.enterPassword:
|
|
|
|
case Constants.keycardSharedState.enterBiometricsPassword:
|
|
|
|
case Constants.keycardSharedState.wrongBiometricsPassword:
|
|
|
|
case Constants.keycardSharedState.wrongPassword:
|
2022-11-07 11:43:34 +00:00
|
|
|
return passwordComponent
|
2022-11-09 10:22:08 +00:00
|
|
|
|
2023-09-01 13:32:21 +00:00
|
|
|
case Constants.keycardSharedState.createPassword:
|
|
|
|
return createPasswordComponent
|
|
|
|
|
|
|
|
case Constants.keycardSharedState.confirmPassword:
|
|
|
|
return confirmPasswordComponent
|
|
|
|
|
2022-11-09 10:22:08 +00:00
|
|
|
case Constants.keycardSharedState.enterKeycardName:
|
2022-11-07 11:43:34 +00:00
|
|
|
return enterNameComponent
|
2022-11-09 10:22:08 +00:00
|
|
|
|
2022-12-16 09:37:08 +00:00
|
|
|
case Constants.keycardSharedState.manageKeycardAccounts:
|
|
|
|
return manageAccountsComponent
|
|
|
|
|
2022-11-09 10:22:08 +00:00
|
|
|
case Constants.keycardSharedState.createPairingCode:
|
2022-11-07 11:43:34 +00:00
|
|
|
return enterPairingCodeComponent
|
|
|
|
}
|
|
|
|
|
|
|
|
return undefined
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: initComponent
|
|
|
|
KeycardInit {
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
d.primaryButtonEnabled = false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: confirmationComponent
|
|
|
|
KeycardConfirmation {
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
d.primaryButtonEnabled = false
|
|
|
|
}
|
|
|
|
|
|
|
|
onConfirmationUpdated: {
|
|
|
|
d.primaryButtonEnabled = value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: selectKeyPairComponent
|
|
|
|
SelectKeyPair {
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
d.primaryButtonEnabled = false
|
|
|
|
}
|
|
|
|
|
|
|
|
onKeyPairSelected: {
|
|
|
|
d.primaryButtonEnabled = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: keycardPinComponent
|
|
|
|
KeycardPin {
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
d.primaryButtonEnabled = false
|
|
|
|
}
|
|
|
|
|
|
|
|
onPinUpdated: {
|
|
|
|
d.primaryButtonEnabled = pin.length === Constants.keycard.general.keycardPinLength
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: keycardPukComponent
|
|
|
|
KeycardPuk {
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
d.primaryButtonEnabled = false
|
|
|
|
}
|
|
|
|
|
|
|
|
onPukUpdated: {
|
|
|
|
d.primaryButtonEnabled = puk.length === Constants.keycard.general.keycardPukLength
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: enterSeedPhraseComponent
|
|
|
|
EnterSeedPhrase {
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
d.primaryButtonEnabled = false
|
|
|
|
}
|
|
|
|
|
|
|
|
onValidation: {
|
|
|
|
d.primaryButtonEnabled = result
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: seedPhraseComponent
|
|
|
|
SeedPhrase {
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
2023-03-22 15:48:44 +00:00
|
|
|
seedPhraseRevealed = false
|
2022-11-07 11:43:34 +00:00
|
|
|
}
|
|
|
|
|
2023-03-22 15:48:44 +00:00
|
|
|
onSeedPhraseRevealedChanged: {
|
|
|
|
d.primaryButtonEnabled = seedPhraseRevealed
|
2022-11-07 11:43:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: enterSeedPhraseWordsComponent
|
|
|
|
EnterSeedPhraseWords {
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
d.primaryButtonEnabled = false
|
|
|
|
}
|
|
|
|
|
|
|
|
onValidation: {
|
|
|
|
d.primaryButtonEnabled = result
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: passwordComponent
|
|
|
|
EnterPassword {
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
d.primaryButtonEnabled = false
|
|
|
|
}
|
|
|
|
|
|
|
|
onPasswordValid: {
|
|
|
|
d.primaryButtonEnabled = valid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-09-01 13:32:21 +00:00
|
|
|
Component {
|
|
|
|
id: createPasswordComponent
|
|
|
|
CreatePassword {
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
d.primaryButtonEnabled = false
|
|
|
|
}
|
|
|
|
|
|
|
|
onPasswordValid: {
|
|
|
|
d.primaryButtonEnabled = valid
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: confirmPasswordComponent
|
|
|
|
ConfirmPassword {
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
d.primaryButtonEnabled = false
|
|
|
|
}
|
|
|
|
|
|
|
|
onPasswordMatch: {
|
|
|
|
d.primaryButtonEnabled = result
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-07 11:43:34 +00:00
|
|
|
Component {
|
|
|
|
id: enterNameComponent
|
|
|
|
EnterName {
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
|
|
|
|
2022-12-16 09:37:08 +00:00
|
|
|
onValidation: {
|
|
|
|
d.primaryButtonEnabled = result
|
2022-11-07 11:43:34 +00:00
|
|
|
}
|
2022-12-16 09:37:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: manageAccountsComponent
|
|
|
|
ManageAccounts {
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
|
|
|
emojiPopup: root.emojiPopup
|
2022-11-07 11:43:34 +00:00
|
|
|
|
|
|
|
onValidation: {
|
|
|
|
d.primaryButtonEnabled = result
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Component {
|
|
|
|
id: enterPairingCodeComponent
|
|
|
|
EnterPairingCode {
|
|
|
|
sharedKeycardModule: root.sharedKeycardModule
|
|
|
|
|
|
|
|
Component.onCompleted: {
|
|
|
|
d.primaryButtonEnabled = false
|
|
|
|
}
|
|
|
|
|
|
|
|
onValidation: {
|
|
|
|
d.primaryButtonEnabled = result
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|