Remove unused elements (#530)

This commit is contained in:
Danny Moesch 2021-12-31 07:35:17 +01:00 committed by GitHub
parent ff6a1edf62
commit 819371f55e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 9 additions and 111 deletions

View file

@ -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)

View file

@ -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? {

View file

@ -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

View file

@ -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)
}

View file

@ -44,8 +44,6 @@ public extension DefaultsKeys {
var lastSyncedTime: DefaultsKey<Date?> { .init("lastSyncedTime") }
var isTouchIDOn: DefaultsKey<Bool> { .init("isTouchIDOn", defaultValue: false) }
var isHideUnknownOn: DefaultsKey<Bool> { .init("isHideUnknownOn", defaultValue: false) }
var isHideOTPOn: DefaultsKey<Bool> { .init("isHideOTPOn", defaultValue: false) }
var isRememberPGPPassphraseOn: DefaultsKey<Bool> { .init("isRememberPGPPassphraseOn", defaultValue: false) }

View file

@ -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"

View file

@ -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()

View file

@ -150,16 +150,6 @@ public class PasswordStore {
}
}
public func passwordEntityExisted(path: String) -> Bool {
let passwordEntityFetchRequest = NSFetchRequest<NSFetchRequestResult>(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<NSFetchRequestResult>(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:///" {

View file

@ -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: