Mark mnemonic as shown on revealing it to the user (#12947)
This commit is contained in:
parent
7ee3b0bb57
commit
b819bdb574
|
@ -86,6 +86,9 @@ proc getMnemonic*(self: Controller): string =
|
|||
proc removeMnemonic*(self: Controller) =
|
||||
self.privacyService.removeMnemonic()
|
||||
|
||||
proc mnemonicWasShown*(self: Controller) =
|
||||
self.settingsService.mnemonicWasShown()
|
||||
|
||||
proc getMnemonicWordAtIndex*(self: Controller, index: int): string =
|
||||
return self.privacyService.getMnemonicWordAtIndex(index)
|
||||
|
||||
|
|
|
@ -34,6 +34,9 @@ method getMnemonic*(self: AccessInterface): string {.base.} =
|
|||
method removeMnemonic*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method mnemonicWasShown*(self: AccessInterface) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method getMnemonicWordAtIndex*(self: AccessInterface, index: int): string {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
|
|
@ -75,6 +75,9 @@ method getMnemonic*(self: Module): string =
|
|||
method removeMnemonic*(self: Module) =
|
||||
self.controller.removeMnemonic()
|
||||
|
||||
method mnemonicWasShown*(self: Module) =
|
||||
self.controller.mnemonicWasShown()
|
||||
|
||||
method getMnemonicWordAtIndex*(self: Module, index: int): string =
|
||||
return self.controller.getMnemonicWordAtIndex(index)
|
||||
|
||||
|
|
|
@ -41,6 +41,9 @@ QtObject:
|
|||
proc removeMnemonic*(self: View) {.slot.} =
|
||||
self.delegate.removeMnemonic()
|
||||
|
||||
proc mnemonicWasShown*(self: View) {.slot.} =
|
||||
self.delegate.mnemonicWasShown()
|
||||
|
||||
proc getMnemonicWordAtIndex*(self: View, index: int): string {.slot.} =
|
||||
return self.delegate.getMnemonicWordAtIndex(index)
|
||||
|
||||
|
|
|
@ -102,6 +102,9 @@ QtObject:
|
|||
data.success = false
|
||||
error "error: ", procName="removeMnemonic", errDesription = "an error occurred removing mnemonic"
|
||||
|
||||
proc mnemonicWasShown*(self: Service) =
|
||||
self.settingsService.mnemonicWasShown()
|
||||
|
||||
proc getMnemonicWordAtIndex*(self: Service, index: int): string =
|
||||
let mnemonic = self.settingsService.getMnemonic()
|
||||
if(mnemonic.len == 0):
|
||||
|
|
|
@ -1000,3 +1000,9 @@ QtObject:
|
|||
|
||||
proc getProfileMigrationNeeded*(self: Service): bool =
|
||||
self.settings.profileMigrationNeeded
|
||||
|
||||
proc mnemonicWasShown*(self: Service) =
|
||||
let response = status_settings.mnemonicWasShown()
|
||||
if(not response.error.isNil):
|
||||
error "error saving mnemonic was shown setting: ", errDescription = response.error.message
|
||||
return
|
||||
|
|
|
@ -101,3 +101,6 @@ proc addOrReplaceSocialLinks*(value: JsonNode): RpcResponse[JsonNode] {.raises:
|
|||
|
||||
proc getSocialLinks*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
return core.callPrivateRPC("settings_getSocialLinks")
|
||||
|
||||
proc mnemonicWasShown*(): RpcResponse[JsonNode] {.raises: [Exception].} =
|
||||
return core.callPrivateRPC("settings_mnemonicWasShown")
|
||||
|
|
|
@ -130,6 +130,7 @@ StatusStackModal {
|
|||
ConfirmSeedPhrasePanel {
|
||||
id: confirmSeedPhrase
|
||||
seedPhrase: root.privacyStore.getMnemonic().split(" ")
|
||||
privacyStore: root.privacyStore
|
||||
},
|
||||
BackupSeedStepBase {
|
||||
id: confirmFirstWord
|
||||
|
|
|
@ -14,6 +14,7 @@ BackupSeedStepBase {
|
|||
|
||||
property var seedPhrase: []
|
||||
property bool hideSeed: true
|
||||
property var privacyStore
|
||||
|
||||
titleText: qsTr("Write down your 12-word seed phrase to keep offline")
|
||||
|
||||
|
@ -68,6 +69,7 @@ BackupSeedStepBase {
|
|||
icon.name: "view"
|
||||
text: qsTr("Reveal seed phrase")
|
||||
onClicked: {
|
||||
privacyStore.mnemonicWasShown();
|
||||
hideSeed = false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,4 +40,8 @@ QtObject {
|
|||
function backupData() {
|
||||
return root.privacyModule.backupData()
|
||||
}
|
||||
|
||||
function mnemonicWasShown() {
|
||||
root.privacyModule.mnemonicWasShown()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue