Skip to content

Commit

Permalink
Fixing build for watchOS
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanfallet committed Jul 16, 2021
1 parent a1268e5 commit 493c7ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Sources/Keychain/Encryption.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import Security

public class Encryption {


public func getKeys(useEncryptionModule: CFString, keySize: Int) -> (publicKey: SecKey?, privateKey: SecKey?) {
//Generation of RSA private and public keys
let parameters: [String:Any] = [
Expand Down Expand Up @@ -54,7 +53,7 @@ public class Encryption {
#endif


@available(iOS 10.0, *)
@available(iOS 10.0, watchOS 3.0, *)
public func encrypt(content: CFData, publicKey: SecKey, usingAlgorithm: SecKeyAlgorithm) -> CFData? {
var status = Unmanaged<CFError>?.init(nilLiteral: ())

Expand Down Expand Up @@ -94,7 +93,7 @@ public class Encryption {
}
#endif

@available(iOS 10.0, *)
@available(iOS 10.0, watchOS 3.0, *)
public func decrypt(privateKey: SecKey, content: CFData, usingAlgorithm: SecKeyAlgorithm) -> CFData? {
//Decrypt the entrypted string with the private key
var status = Unmanaged<CFError>?.init(nilLiteral: ())
Expand All @@ -107,4 +106,5 @@ public class Encryption {

return decrypted
}

}
2 changes: 1 addition & 1 deletion Sources/Keychain/Keychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class Keychain {
public func save(_ data: Any, forKey: String) -> Bool {
let savedData: Data
do {
if #available(iOS 11.0, *) {
if #available(iOS 11.0, watchOS 4.0, *) {
savedData = try NSKeyedArchiver.archivedData(withRootObject: data, requiringSecureCoding: true)
} else {
// Fallback on earlier versions
Expand Down

0 comments on commit 493c7ad

Please sign in to comment.