diff --git a/pass.xcodeproj/project.pbxproj b/pass.xcodeproj/project.pbxproj index 9b36687..15bacc5 100644 --- a/pass.xcodeproj/project.pbxproj +++ b/pass.xcodeproj/project.pbxproj @@ -203,7 +203,6 @@ DCFB77A31E500D9C008DE471 /* PasswordDetailTitleTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = DCFB77A21E500D9C008DE471 /* PasswordDetailTitleTableViewCell.xib */; }; DCFB77A71E502DF9008DE471 /* EditPasswordTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCFB77A61E502DF9008DE471 /* EditPasswordTableViewController.swift */; }; DCFB77A91E502FF6008DE471 /* PasswordEditorTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCFB77A81E502FF6008DE471 /* PasswordEditorTableViewController.swift */; }; - DCFB77AB1E503729008DE471 /* ContentProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = DCFB77AA1E503729008DE471 /* ContentProvider.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -491,7 +490,6 @@ DCFB77A21E500D9C008DE471 /* PasswordDetailTitleTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PasswordDetailTitleTableViewCell.xib; sourceTree = ""; }; DCFB77A61E502DF9008DE471 /* EditPasswordTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditPasswordTableViewController.swift; sourceTree = ""; }; DCFB77A81E502FF6008DE471 /* PasswordEditorTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordEditorTableViewController.swift; sourceTree = ""; }; - DCFB77AA1E503729008DE471 /* ContentProvider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContentProvider.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -955,7 +953,6 @@ isa = PBXGroup; children = ( 9A8F9EE1259EDD520027CE15 /* PasswordTableViewCell.swift */, - DCFB77AA1E503729008DE471 /* ContentProvider.swift */, DCFB779C1E4F40C7008DE471 /* FillPasswordTableViewCell.swift */, DCFB779D1E4F40C7008DE471 /* FillPasswordTableViewCell.xib */, DC4914941E434301007FF592 /* LabelTableViewCell.swift */, @@ -1603,7 +1600,6 @@ 9AFC87E225B3B5C6008D6060 /* PasswordNavigationDataSource.swift in Sources */, 30650E7123F82AF8005CCD5E /* SSHKeyFileImportTableViewController.swift in Sources */, DC193FFA1E49B4430077E0A3 /* AdvancedSettingsTableViewController.swift in Sources */, - DCFB77AB1E503729008DE471 /* ContentProvider.swift in Sources */, 9AFC880025B51EC3008D6060 /* PasswordEncryptor.swift in Sources */, DCA0499C1E3362F400522E8F /* PGPKeyURLImportTableViewController.swift in Sources */, DC4914961E434301007FF592 /* LabelTableViewCell.swift in Sources */, diff --git a/pass/Controllers/BasicStaticTableViewController.swift b/pass/Controllers/BasicStaticTableViewController.swift index 0794df7..d77ae8f 100644 --- a/pass/Controllers/BasicStaticTableViewController.swift +++ b/pass/Controllers/BasicStaticTableViewController.swift @@ -11,16 +11,12 @@ import passKit import SafariServices import UIKit -enum CellDataType { - case link, segue, empty, detail -} - enum CellDataStyle { case value1, defaultStyle } enum CellDataKey { - case style, type, title, link, accessoryType, detailDisclosureAction, detailDisclosureData, detailText, action + case style, title, link, accessoryType, detailDisclosureAction, detailDisclosureData, detailText, action } class BasicStaticTableViewController: UITableViewController, MFMailComposeViewControllerDelegate { diff --git a/pass/Controllers/PGPKeyImporter.swift b/pass/Controllers/PGPKeyImporter.swift index e7b6744..4a3bd01 100644 --- a/pass/Controllers/PGPKeyImporter.swift +++ b/pass/Controllers/PGPKeyImporter.swift @@ -10,8 +10,6 @@ import passKit protocol PGPKeyImporter: KeyImporter { func doAfterImport() - - func saveImportedKeys() } extension PGPKeyImporter { diff --git a/pass/Controllers/PasswordDetailTableViewController.swift b/pass/Controllers/PasswordDetailTableViewController.swift index 3d220da..d526499 100644 --- a/pass/Controllers/PasswordDetailTableViewController.swift +++ b/pass/Controllers/PasswordDetailTableViewController.swift @@ -18,7 +18,6 @@ class PasswordDetailTableViewController: UITableViewController, UIGestureRecogni private var oneTimePasswordIndexPath: IndexPath? private var shouldPopCurrentView = false private let passwordStore = PasswordStore.shared - private let keychain = AppKeychain.shared private lazy var editUIBarButtonItem: UIBarButtonItem = { let uiBarButtonItem = UIBarButtonItem(barButtonSystemItem: .edit, target: self, action: #selector(pressEdit)) diff --git a/pass/Controllers/PasswordEditorTableViewController.swift b/pass/Controllers/PasswordEditorTableViewController.swift index 5d5bdf6..2b7cf65 100644 --- a/pass/Controllers/PasswordEditorTableViewController.swift +++ b/pass/Controllers/PasswordEditorTableViewController.swift @@ -26,7 +26,7 @@ enum PasswordEditorCellType: Equatable { } enum PasswordEditorCellKey { - case type, title, content, placeholders + case type, title, content } protocol PasswordSettingSliderTableViewCellDelegate: AnyObject { diff --git a/pass/Controllers/SSHKeyArmorImportTableViewController.swift b/pass/Controllers/SSHKeyArmorImportTableViewController.swift index 650e33c..d312b1c 100644 --- a/pass/Controllers/SSHKeyArmorImportTableViewController.swift +++ b/pass/Controllers/SSHKeyArmorImportTableViewController.swift @@ -13,7 +13,6 @@ class SSHKeyArmorImportTableViewController: AutoCellHeightUITableViewController, @IBOutlet var armorPrivateKeyTextView: UITextView! @IBOutlet var scanPrivateKeyCell: UITableViewCell! - private var gitSSHPrivateKeyPassphrase: String? private var armorPrivateKey: String? private var scanner = QRKeyScanner(keyType: .sshPrivate) diff --git a/pass/Controllers/SettingsTableViewController.swift b/pass/Controllers/SettingsTableViewController.swift index 397dc44..5463a2a 100644 --- a/pass/Controllers/SettingsTableViewController.swift +++ b/pass/Controllers/SettingsTableViewController.swift @@ -17,7 +17,6 @@ class SettingsTableViewController: UITableViewController, UITabBarControllerDele @IBOutlet var passwordRepositoryTableViewCell: UITableViewCell! var setPasscodeLockAlert: UIAlertController? - let passwordStore = PasswordStore.shared let keychain = AppKeychain.shared var passcodeLock = PasscodeLock.shared diff --git a/pass/Helpers/SecurePasteboard.swift b/pass/Helpers/SecurePasteboard.swift index f2669bc..2868101 100644 --- a/pass/Helpers/SecurePasteboard.swift +++ b/pass/Helpers/SecurePasteboard.swift @@ -6,11 +6,10 @@ // Copyright © 2017 Bob Sun. All rights reserved. // -import Foundation import UIKit -public class SecurePasteboard { - public static let shared = SecurePasteboard() +class SecurePasteboard { + static let shared = SecurePasteboard() private var backgroundTaskID = UIBackgroundTaskIdentifier.invalid diff --git a/pass/Views/ContentProvider.swift b/pass/Views/ContentProvider.swift deleted file mode 100644 index 9f4e93b..0000000 --- a/pass/Views/ContentProvider.swift +++ /dev/null @@ -1,12 +0,0 @@ -// -// ContentProvider.swift -// pass -// -// Created by Mingshen Sun on 12/2/2017. -// Copyright © 2017 Bob Sun. All rights reserved. -// - -protocol ContentProvider { - func getContent() -> String? - func setContent(content: String?) -} diff --git a/pass/Views/FillPasswordTableViewCell.swift b/pass/Views/FillPasswordTableViewCell.swift index 70b94f0..4b5ab5c 100644 --- a/pass/Views/FillPasswordTableViewCell.swift +++ b/pass/Views/FillPasswordTableViewCell.swift @@ -14,7 +14,7 @@ protocol FillPasswordTableViewCellDelegate: AnyObject { func showHidePasswordSettings() } -class FillPasswordTableViewCell: UITableViewCell, ContentProvider { +class FillPasswordTableViewCell: UITableViewCell { @IBOutlet var contentTextField: UITextField! @IBOutlet var settingButton: UIButton! @IBOutlet var generateButton: UIButton! diff --git a/pass/Views/SliderTableViewCell.swift b/pass/Views/SliderTableViewCell.swift index 4e2034e..1310088 100644 --- a/pass/Views/SliderTableViewCell.swift +++ b/pass/Views/SliderTableViewCell.swift @@ -65,11 +65,3 @@ class SliderTableViewCell: UITableViewCell { return self } } - -extension SliderTableViewCell: ContentProvider { - func getContent() -> String? { - nil - } - - func setContent(content _: String?) {} -} diff --git a/pass/Views/TextFieldTableViewCell.swift b/pass/Views/TextFieldTableViewCell.swift index 3037ff8..0d5ac32 100644 --- a/pass/Views/TextFieldTableViewCell.swift +++ b/pass/Views/TextFieldTableViewCell.swift @@ -8,7 +8,7 @@ import UIKit -class TextFieldTableViewCell: UITableViewCell, ContentProvider { +class TextFieldTableViewCell: UITableViewCell { @IBOutlet var contentTextField: UITextField! func getContent() -> String? { diff --git a/pass/Views/TextViewTableViewCell.swift b/pass/Views/TextViewTableViewCell.swift index 6f983c1..d477ec1 100644 --- a/pass/Views/TextViewTableViewCell.swift +++ b/pass/Views/TextViewTableViewCell.swift @@ -8,7 +8,7 @@ import UIKit -class TextViewTableViewCell: UITableViewCell, ContentProvider { +class TextViewTableViewCell: UITableViewCell { @IBOutlet var contentTextView: UITextView! override func awakeFromNib() { diff --git a/pass/de.lproj/Localizable.strings b/pass/de.lproj/Localizable.strings index 422b5ad..52818ce 100644 --- a/pass/de.lproj/Localizable.strings +++ b/pass/de.lproj/Localizable.strings @@ -59,7 +59,6 @@ "RandomString" = "Zufällige Zeichenkette"; "ApplesKeychainStyle" = "Apples Keychain-Style"; "XKCD" = "XKCD"; -"XKCDStyle" = "XKCD-Style"; // Git "FailedToFetchPasswords" = "Abrufen von Passwörtern fehlgeschlagen"; diff --git a/pass/en.lproj/Localizable.strings b/pass/en.lproj/Localizable.strings index f12635f..800849a 100644 --- a/pass/en.lproj/Localizable.strings +++ b/pass/en.lproj/Localizable.strings @@ -59,7 +59,6 @@ "RandomString" = "Random String"; "ApplesKeychainStyle" = "Apple's Keychain Style"; "XKCD" = "XKCD"; -"XKCDStyle" = "XKCD Style"; // Git "FailedToFetchPasswords" = "Failed to fetch passwords"; diff --git a/passAutoFillExtension/Controllers/PasscodeExtensionDisplay.swift b/passAutoFillExtension/Controllers/PasscodeExtensionDisplay.swift index 55c8499..8bfa284 100644 --- a/passAutoFillExtension/Controllers/PasscodeExtensionDisplay.swift +++ b/passAutoFillExtension/Controllers/PasscodeExtensionDisplay.swift @@ -10,10 +10,8 @@ import passKit class PasscodeExtensionDisplay { private let passcodeLockVC: PasscodeLockViewControllerForExtension - private let extensionContext: NSExtensionContext? init(extensionContext: NSExtensionContext) { - self.extensionContext = extensionContext self.passcodeLockVC = PasscodeLockViewControllerForExtension(extensionContext: extensionContext) passcodeLockVC.setCancellable(true) } diff --git a/passExtension/Helpers/ExtensionConstants.swift b/passExtension/Helpers/ExtensionConstants.swift index 3fa029e..8e08876 100644 --- a/passExtension/Helpers/ExtensionConstants.swift +++ b/passExtension/Helpers/ExtensionConstants.swift @@ -21,18 +21,4 @@ enum PassExtensionKey { static let usernameKey = "username" static let passwordKey = "password" static let totpKey = "totp" - static let titleKey = "login_title" - static let notesKey = "notes" - static let sectionTitleKey = "section_title" - static let fieldsKey = "fields" - static let returnedFieldsKey = "returned_fields" - static let oldPasswordKey = "old_password" - static let passwordGeneratorOptionsKey = "password_generator_options" - - // Password Generator options - static let generatedPasswordMinLengthKey = "password_min_length" - static let generatedPasswordMaxLengthKey = "password_max_length" - static let generatedPasswordRequireDigitsKey = "password_require_digits" - static let generatedPasswordRequireSymbolsKey = "password_require_symbols" - static let generatedPasswordForbiddenCharactersKey = "password_forbidden_characters" } diff --git a/passKit/Controllers/PasscodeLockViewController.swift b/passKit/Controllers/PasscodeLockViewController.swift index d7acb7c..b641d63 100644 --- a/passKit/Controllers/PasscodeLockViewController.swift +++ b/passKit/Controllers/PasscodeLockViewController.swift @@ -18,7 +18,6 @@ open class PasscodeLockViewController: UIViewController, UITextFieldDelegate { weak var passcodeTextField: UITextField? weak var biometryAuthButton: UIButton? - weak var forgotPasscodeButton: UIButton? open weak var cancelButton: UIButton? var isCancellable = false @@ -73,7 +72,6 @@ open class PasscodeLockViewController: UIViewController, UITextFieldDelegate { forgotPasscodeButton.isHidden = isCancellable forgotPasscodeButton.translatesAutoresizingMaskIntoConstraints = false view.addSubview(forgotPasscodeButton) - self.forgotPasscodeButton = forgotPasscodeButton let cancelButton = UIButton(type: .custom) cancelButton.setTitle("Cancel".localize(), for: .normal) diff --git a/passKit/Crypto/ObjectivePGPInterface.swift b/passKit/Crypto/ObjectivePGPInterface.swift index 8eb83c2..768d785 100644 --- a/passKit/Crypto/ObjectivePGPInterface.swift +++ b/passKit/Crypto/ObjectivePGPInterface.swift @@ -9,9 +9,6 @@ import ObjectivePGP struct ObjectivePGPInterface: PGPInterface { - private let publicKey: Key - private let privateKey: Key - private let keyring = ObjectivePGP.defaultKeyring init(publicArmoredKey: String, privateArmoredKey: String) throws { @@ -22,11 +19,9 @@ struct ObjectivePGPInterface: PGPInterface { let privateKeys = try ObjectivePGP.readKeys(from: privateKeyData) keyring.import(keys: publicKeys) keyring.import(keys: privateKeys) - guard let publicKey = publicKeys.first, let privateKey = privateKeys.first else { + guard publicKeys.first != nil, privateKeys.first != nil else { throw AppError.keyImport } - self.publicKey = publicKey - self.privateKey = privateKey } func decrypt(encryptedData: Data, keyID _: String?, passphrase: String) throws -> Data? { diff --git a/passKit/Helpers/AppError.swift b/passKit/Helpers/AppError.swift index 466ee90..08dbace 100644 --- a/passKit/Helpers/AppError.swift +++ b/passKit/Helpers/AppError.swift @@ -16,7 +16,6 @@ public enum AppError: Error, Equatable { case gitReset case gitCreateSignature case gitPushNotSuccessful - case passwordEntity case pgpPublicKeyNotFound(keyID: String) case pgpPrivateKeyNotFound(keyID: String) case keyExpiredOrIncompatible diff --git a/passKit/Helpers/AppKeychain.swift b/passKit/Helpers/AppKeychain.swift index c68f974..d68a043 100644 --- a/passKit/Helpers/AppKeychain.swift +++ b/passKit/Helpers/AppKeychain.swift @@ -15,10 +15,6 @@ public class AppKeychain: KeyStore { .accessibility(.whenUnlockedThisDeviceOnly) .synchronizable(false) - public func add(data: Data?, for key: String) { - keychain[data: key] = data - } - public func add(string: String?, for key: String) { keychain[key] = string } @@ -27,10 +23,6 @@ public class AppKeychain: KeyStore { (try? keychain.contains(key)) ?? false } - public func get(for key: String) -> Data? { - try? keychain.getData(key) - } - public func get(for key: String) -> String? { try? keychain.getString(key) } diff --git a/passKit/Helpers/DefaultsKeys.swift b/passKit/Helpers/DefaultsKeys.swift index afba469..a0bbf81 100644 --- a/passKit/Helpers/DefaultsKeys.swift +++ b/passKit/Helpers/DefaultsKeys.swift @@ -44,8 +44,6 @@ public extension DefaultsKeys { var lastSyncedTime: DefaultsKey { .init("lastSyncedTime") } - var isTouchIDOn: DefaultsKey { .init("isTouchIDOn", defaultValue: false) } - var isHideUnknownOn: DefaultsKey { .init("isHideUnknownOn", defaultValue: false) } var isHideOTPOn: DefaultsKey { .init("isHideOTPOn", defaultValue: false) } var isRememberPGPPassphraseOn: DefaultsKey { .init("isRememberPGPPassphraseOn", defaultValue: false) } diff --git a/passKit/Helpers/Globals.swift b/passKit/Helpers/Globals.swift index 9950a06..62dcbec 100644 --- a/passKit/Helpers/Globals.swift +++ b/passKit/Helpers/Globals.swift @@ -27,7 +27,6 @@ public final class Globals { public static let pgpPublicKeyPath = documentPath + "/gpg_key.pub" public static let pgpPrivateKeyPath = documentPath + "/gpg_key" public static let gitSSHPrivateKeyPath = documentPath + "/ssh_key" - public static let gitSSHPrivateKeyURL = URL(fileURLWithPath: gitSSHPrivateKeyPath) public static let repositoryPath = libraryPath + "/password-store" public static let dbPath = documentPath + "/pass.sqlite" diff --git a/passKit/Helpers/KeyStore.swift b/passKit/Helpers/KeyStore.swift index d57a51f..5e1acc7 100644 --- a/passKit/Helpers/KeyStore.swift +++ b/passKit/Helpers/KeyStore.swift @@ -9,10 +9,8 @@ import Foundation public protocol KeyStore { - func add(data: Data?, for key: String) func add(string: String?, for key: String) func contains(key: String) -> Bool - func get(for key: String) -> Data? func get(for key: String) -> String? func removeContent(for key: String) func removeAllContent() diff --git a/passKit/Models/PasswordStore.swift b/passKit/Models/PasswordStore.swift index b1df8ee..01dac52 100644 --- a/passKit/Models/PasswordStore.swift +++ b/passKit/Models/PasswordStore.swift @@ -150,16 +150,6 @@ public class PasswordStore { } } - public func passwordEntityExisted(path: String) -> Bool { - let passwordEntityFetchRequest = NSFetchRequest(entityName: "PasswordEntity") - do { - passwordEntityFetchRequest.predicate = NSPredicate(format: "path = %@", path) - return try context.count(for: passwordEntityFetchRequest) > 0 - } catch { - fatalError("FailedToFetchPasswordEntities".localize(error)) - } - } - public func getPasswordEntity(by path: String, isDir: Bool) -> PasswordEntity? { let passwordEntityFetchRequest = NSFetchRequest(entityName: "PasswordEntity") do { @@ -383,8 +373,6 @@ public class PasswordStore { return Self.dateFormatter.string(from: lastCommitDate) } - public func updateRemoteRepo() {} - private func gitAdd(path: String) throws { guard let storeRepository = storeRepository else { throw AppError.repositoryNotSet @@ -738,7 +726,7 @@ public class PasswordStore { } } -public func findGPGID(from url: URL) -> String { +func findGPGID(from url: URL) -> String { var path = url while !FileManager.default.fileExists(atPath: path.appendingPathComponent(".gpg-id").path), path.path != "file:///" { diff --git a/passKit/Passwords/PasswordGeneratorFlavor.swift b/passKit/Passwords/PasswordGeneratorFlavor.swift index 62f247e..391d9e1 100644 --- a/passKit/Passwords/PasswordGeneratorFlavor.swift +++ b/passKit/Passwords/PasswordGeneratorFlavor.swift @@ -16,15 +16,6 @@ public enum PasswordGeneratorFlavor: String { rawValue.localize() } - public var longNameLocalized: String { - switch self { - case .random: - return "RandomString".localize() - case .xkcd: - return "XKCDStyle".localize() - } - } - public var lengthLimits: LengthLimits { switch self { case .random: diff --git a/passKitTests/Testbase/DictBasedKeychain.swift b/passKitTests/Testbase/DictBasedKeychain.swift index 6f7b455..5d65e5f 100644 --- a/passKitTests/Testbase/DictBasedKeychain.swift +++ b/passKitTests/Testbase/DictBasedKeychain.swift @@ -12,10 +12,6 @@ import passKit class DictBasedKeychain: KeyStore { private var store: [String: Any] = [:] - func add(data: Data?, for key: String) { - store[key] = data - } - func add(string: String?, for key: String) { store[key] = string } @@ -24,10 +20,6 @@ class DictBasedKeychain: KeyStore { store[key] != nil } - func get(for key: String) -> Data? { - store[key] as? Data - } - func get(for key: String) -> String? { store[key] as? String }