diff --git a/Podfile b/Podfile index 96091d0..20987bf 100644 --- a/Podfile +++ b/Podfile @@ -2,7 +2,7 @@ platform :ios, '10.2' use_frameworks! target 'passKit' do - pod 'ObjectivePGP', :git => 'https://github.com/krzyzanowskim/ObjectivePGP.git' + pod 'ObjectivePGP', :git => 'https://github.com/krzyzanowskim/ObjectivePGP.git', :tag => '0.9.0' target 'pass' do inherit! :search_paths end diff --git a/pass.xcodeproj/xcshareddata/xcschemes/pass.xcscheme b/pass.xcodeproj/xcshareddata/xcschemes/pass.xcscheme index a02e528..75208fd 100644 --- a/pass.xcodeproj/xcshareddata/xcschemes/pass.xcscheme +++ b/pass.xcodeproj/xcshareddata/xcschemes/pass.xcscheme @@ -1,6 +1,6 @@ PGPKey? { + private func importKey(from keyPath: String) -> Key? { if fm.fileExists(atPath: keyPath) { - let keys = pgp.importKeys(fromFile: keyPath) + let keys = ObjectivePGP.readKeys(from: keyPath) + pgp.import(keys: keys) if !keys.isEmpty { return keys.first } @@ -245,7 +246,7 @@ public class PasswordStore { return nil } - public func getPgpPrivateKey() -> PGPKey { + public func getPgpPrivateKey() -> Key { return pgp.keys.filter({$0.secretKey != nil})[0] } @@ -841,7 +842,7 @@ public class PasswordStore { if passphrase == nil { passphrase = requestPGPKeyPassphrase() } - let decryptedData = try PasswordStore.shared.pgp.decryptData(encryptedData, passphrase: passphrase) + let decryptedData = try PasswordStore.shared.pgp.decrypt(encryptedData, passphrase: passphrase) let plainText = String(data: decryptedData, encoding: .utf8) ?? "" let escapedPath = passwordEntity.path!.stringByAddingPercentEncodingForRFC3986() ?? "" return Password(name: passwordEntity.name!, url: URL(string: escapedPath), plainText: plainText) @@ -853,7 +854,7 @@ public class PasswordStore { throw AppError.PGPPublicKeyNotExistError } let plainData = password.getPlainData() - let encryptedData = try pgp.encryptData(plainData, using: Array(publicKey), armored: SharedDefaults[.encryptInArmored]) + let encryptedData = try pgp.encrypt(plainData, using: Array(publicKey), armored: SharedDefaults[.encryptInArmored]) return encryptedData }