Put Keychain related methods to separate class

This commit is contained in:
Danny Moesch 2019-06-25 22:44:19 +02:00 committed by Mingshen Sun
parent e4e4c6daff
commit 441a7f1e9b
5 changed files with 76 additions and 52 deletions

View file

@ -90,8 +90,14 @@ class PGPKeyArmorSettingTableViewController: AutoCellHeightUITableViewController
override func viewDidLoad() {
super.viewDidLoad()
armorPublicKeyTextView.text = String(data: Utils.getDataFromKeychain(for: PasswordStore.PGPKeyType.PUBLIC.rawValue)!, encoding: .ascii)
armorPrivateKeyTextView.text = String(data: Utils.getDataFromKeychain(for: PasswordStore.PGPKeyType.PRIVATE.rawValue)!, encoding: .ascii)
if let publicKey: Data = AppKeychain.get(for: PasswordStore.PGPKeyType.PUBLIC.rawValue) {
armorPublicKeyTextView.text = String(data: publicKey, encoding: .ascii)
}
if let privateKey: Data = AppKeychain.get(for: PasswordStore.PGPKeyType.PRIVATE.rawValue) {
armorPrivateKeyTextView.text = String(data: privateKey, encoding: .ascii)
}
pgpPassphrase = passwordStore.pgpKeyPassphrase
scanPublicKeyCell?.textLabel?.text = "ScanPublicKeyQrCodes".localize()