Skip to content

Commit

Permalink
Fix failing OS X build
Browse files Browse the repository at this point in the history
  • Loading branch information
kishikawakatsumi committed Apr 9, 2015
1 parent 5fead3a commit 1967bf5
Showing 1 changed file with 27 additions and 9 deletions.
36 changes: 27 additions & 9 deletions Lib/KeychainAccess/Keychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,9 @@ public class Keychain {
completion(account: nil, password: nil, error: error)
}
}

#endif

#if os(iOS)
@availability(iOS, introduced=8.0)
public func getSharedPassword(account: String, completion: (password: String?, error: NSError?) -> () = { password, error -> () in }) {
if let domain = server.host {
Expand All @@ -573,12 +575,16 @@ public class Keychain {
completion(password: nil, error: error)
}
}

#endif

#if os(iOS)
@availability(iOS, introduced=8.0)
public func setSharedPassword(password: String, account: String, completion: (error: NSError?) -> () = { e -> () in }) {
setSharedPassword(password as String?, account: account, completion: completion)
}

#endif

#if os(iOS)
private func setSharedPassword(password: String?, account: String, completion: (error: NSError?) -> () = { e -> () in }) {
if let domain = server.host {
SecAddSharedWebCredential(domain, account, password) { error -> () in
Expand All @@ -593,27 +599,37 @@ public class Keychain {
completion(error: error)
}
}

#endif

#if os(iOS)
@availability(iOS, introduced=8.0)
public func removeSharedPassword(account: String, completion: (error: NSError?) -> () = { e -> () in }) {
setSharedPassword(nil, account: account, completion: completion)
}

#endif

#if os(iOS)
@availability(iOS, introduced=8.0)
public class func requestSharedWebCredential(completion: (credentials: [[String: String]], error: NSError?) -> () = { credentials, error -> () in }) {
requestSharedWebCredential(domain: nil, account: nil, completion: completion)
}

#endif

#if os(iOS)
@availability(iOS, introduced=8.0)
public class func requestSharedWebCredential(#domain: String, completion: (credentials: [[String: String]], error: NSError?) -> () = { credentials, error -> () in }) {
requestSharedWebCredential(domain: domain, account: nil, completion: completion)
}

#endif

#if os(iOS)
@availability(iOS, introduced=8.0)
public class func requestSharedWebCredential(#domain: String, account: String, completion: (credentials: [[String: String]], error: NSError?) -> () = { credentials, error -> () in }) {
requestSharedWebCredential(domain: domain as String?, account: account as String?, completion: completion)
}

#endif

#if os(iOS)
private class func requestSharedWebCredential(#domain: String?, account: String?, completion: (credentials: [[String: String]], error: NSError?) -> ()) {
SecRequestSharedWebCredential(domain, account) { (credentials, error) -> () in
var remoteError: NSError?
Expand Down Expand Up @@ -643,7 +659,9 @@ public class Keychain {
}
}
}

#endif

#if os(iOS)
@availability(iOS, introduced=8.0)
public class func generatePassword() -> String {
return SecCreateSharedWebCredentialPassword().takeUnretainedValue() as! String
Expand Down

0 comments on commit 1967bf5

Please sign in to comment.