Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug Keychain View - delete mnemonics #900

Conversation

CyonAlexRDX
Copy link
Contributor

@CyonAlexRDX CyonAlexRDX commented Nov 9, 2023

N.B. Target branch is not main

trim.578EC817-C16B-49A7-84E2-2608613610D9.MOV

@CyonAlexRDX CyonAlexRDX changed the title Abw 2206 import mnemonic from settings debug all mnemonics Abw 2206 import nics Nov 9, 2023
@CyonAlexRDX CyonAlexRDX changed the title Abw 2206 import nics Debug Keychain View - delete mnemonics Nov 9, 2023
) -> [String] {
keychain.allItems()
.filter {
if let isSynchronizable = $0["synchronizable"] as? Bool, let needle = needleIsSynchronizable {
Copy link
Contributor

Choose a reason for hiding this comment

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

keys: "synchronizable", "accessibility" and "key" are keys internal to Keychain.

saveDeviceInfo: @escaping SaveDeviceInfo,
deprecatedLoadDeviceID: @escaping DeprecatedLoadDeviceID,
deleteDeprecatedDeviceID: @escaping DeleteDeprecatedDeviceID,
getAllMnemonics: @escaping GetAllMnemonics
Copy link
Contributor

Choose a reason for hiding this comment

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

vendor getAllMnemonics only for DEBUG.


// MARK: - KeyedMnemonicWithPassphrase
public struct KeyedMnemonicWithPassphrase: Sendable, Hashable {
public let factorSourceID: FactorSourceID.FromHash
Copy link
Contributor

Choose a reason for hiding this comment

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

include factorSourceID so that we can delete it.

}

static let keychainKeySeparator = ":"
Copy link
Contributor

Choose a reason for hiding this comment

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

used by a new failable init, taking this keychainKey as input and trying to create a FactorSourceID from it.

@@ -417,13 +434,6 @@ public struct ImportOlympiaWalletCoordinator: Sendable, FeatureReducer {
)
)

do {
try userDefaults.addFactorSourceIDOfBackedUpMnemonic(factorSourceID)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved to save AFTER we have successfully saved Factor

_ = try await factorSourcesClient.addPrivateHDFactorSource(.init(
factorSource: factorSource.factorSource.embed(),
mnemonicWithPasshprase: factorSource.mnemonicWithPassphrase,
saveIntoProfile: true
saveIntoProfile: saveIntoProfile
Copy link
Contributor Author

@CyonAlexRDX CyonAlexRDX Nov 9, 2023

Choose a reason for hiding this comment

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

Important bug fix: we should not FAIL to save mnemonic into keychain, just because the FactorSource was known by the profile

@@ -1,2 +1,2 @@
SCAN_DEVICE="iPhone 15 Pro Max"
SCAN_DEVICE="iPhone 15 Pro Max (17.0.1)"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@CyonAlexRDX CyonAlexRDX merged commit 65097cd into ABW-2206_import_mnemonic_from_settings Nov 13, 2023
6 checks passed
@CyonAlexRDX CyonAlexRDX deleted the ABW-2206_import_mnemonic_from_settings_debug_all_mnemonics branch November 13, 2023 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants