move functions around
This commit is contained in:
parent
e728f26a20
commit
b7873e6d72
1 changed files with 17 additions and 17 deletions
|
|
@ -105,6 +105,23 @@ public class PGPAgent {
|
||||||
return try pgpInterface.encrypt(plainData: plainData, keyIDs: [keyID])
|
return try pgpInterface.encrypt(plainData: plainData, keyIDs: [keyID])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@available(*, deprecated, message: "Use encrypt(plainData:keyIDs:) or encryptWithAllKeys(plainData:) instead.")
|
||||||
|
public func encrypt(plainData: Data) throws -> Data {
|
||||||
|
try checkAndInit()
|
||||||
|
guard let pgpInterface else {
|
||||||
|
throw AppError.encryption
|
||||||
|
}
|
||||||
|
return try pgpInterface.encrypt(plainData: plainData, keyID: nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
public func encryptWithAllKeys(plainData: Data) throws -> Data {
|
||||||
|
try checkAndInit()
|
||||||
|
guard let pgpInterface else {
|
||||||
|
throw AppError.encryption
|
||||||
|
}
|
||||||
|
return try pgpInterface.encryptWithAllKeys(plainData: plainData)
|
||||||
|
}
|
||||||
|
|
||||||
public func decrypt(encryptedData: Data, requestPGPKeyPassphrase: @escaping (String) -> String) throws -> Data? {
|
public func decrypt(encryptedData: Data, requestPGPKeyPassphrase: @escaping (String) -> String) throws -> Data? {
|
||||||
// Remember the previous status and set the current status
|
// Remember the previous status and set the current status
|
||||||
let previousDecryptStatus = latestDecryptStatus
|
let previousDecryptStatus = latestDecryptStatus
|
||||||
|
|
@ -127,23 +144,6 @@ public class PGPAgent {
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(*, deprecated, message: "Use encrypt(plainData:keyID:) or encryptWithAllKeys(plainData:) instead.")
|
|
||||||
public func encrypt(plainData: Data) throws -> Data {
|
|
||||||
try checkAndInit()
|
|
||||||
guard let pgpInterface else {
|
|
||||||
throw AppError.encryption
|
|
||||||
}
|
|
||||||
return try pgpInterface.encrypt(plainData: plainData, keyID: nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
public func encryptWithAllKeys(plainData: Data) throws -> Data {
|
|
||||||
try checkAndInit()
|
|
||||||
guard let pgpInterface else {
|
|
||||||
throw AppError.encryption
|
|
||||||
}
|
|
||||||
return try pgpInterface.encryptWithAllKeys(plainData: plainData)
|
|
||||||
}
|
|
||||||
|
|
||||||
public var isPrepared: Bool {
|
public var isPrepared: Bool {
|
||||||
keyStore.contains(key: PGPKey.PUBLIC.getKeychainKey())
|
keyStore.contains(key: PGPKey.PUBLIC.getKeychainKey())
|
||||||
&& keyStore.contains(key: PGPKey.PRIVATE.getKeychainKey())
|
&& keyStore.contains(key: PGPKey.PRIVATE.getKeychainKey())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue