Introduce KeyImporter protocol to reduce code duplications in SSH key importers
This commit is contained in:
parent
6aa39db657
commit
94a5f8c501
14 changed files with 189 additions and 144 deletions
|
|
@ -10,13 +10,11 @@ import UIKit
|
|||
import passKit
|
||||
|
||||
class PGPKeyArmorImportTableViewController: AutoCellHeightUITableViewController, UITextViewDelegate, QRScannerControllerDelegate {
|
||||
|
||||
@IBOutlet weak var armorPublicKeyTextView: UITextView!
|
||||
@IBOutlet weak var armorPrivateKeyTextView: UITextView!
|
||||
@IBOutlet weak var scanPublicKeyCell: UITableViewCell!
|
||||
@IBOutlet weak var scanPrivateKeyCell: UITableViewCell!
|
||||
|
||||
let passwordStore = PasswordStore.shared
|
||||
let keychain = AppKeychain.shared
|
||||
|
||||
class ScannedPGPKey {
|
||||
enum KeyType {
|
||||
|
|
@ -132,7 +130,7 @@ class PGPKeyArmorImportTableViewController: AutoCellHeightUITableViewController,
|
|||
|
||||
extension PGPKeyArmorImportTableViewController: PGPKeyImporter {
|
||||
|
||||
static let keySource = PGPKeySource.armor
|
||||
static let keySource = KeySource.armor
|
||||
static let label = "AsciiArmorEncryptedKey".localize()
|
||||
|
||||
func isReadyToUse() -> Bool {
|
||||
|
|
@ -152,10 +150,6 @@ extension PGPKeyArmorImportTableViewController: PGPKeyImporter {
|
|||
try KeyFileManager.PrivatePgp.importKey(from: armorPrivateKeyTextView.text ?? "")
|
||||
}
|
||||
|
||||
func doAfterImport() {
|
||||
|
||||
}
|
||||
|
||||
func saveImportedKeys() {
|
||||
performSegue(withIdentifier: "savePGPKeySegue", sender: self)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue