Skip to content

Commit

Permalink
Add removeSharedPassword method :)
Browse files Browse the repository at this point in the history
  • Loading branch information
kishikawakatsumi committed Jan 19, 2015
1 parent ebda132 commit 52b86ea
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Lib/KeychainAccess/Keychain.swift
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,10 @@ public class Keychain {

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

private func setSharedPassword(password: String?, account: String, completion: (error: NSError?) -> () = { e -> () in }) {
if let domain = server.host {
SecAddSharedWebCredential(domain, account, password) { error -> () in
if let error = error {
Expand All @@ -590,6 +594,11 @@ public class Keychain {
}
}

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

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

0 comments on commit 52b86ea

Please sign in to comment.