Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. SecRequestSharedWebCredential(nil, nil){ credentials, error in
  2. guard let credentials = credentials else { print("Keychain: No credentials found"); return }
  3. guard error == nil else { print("Keychain Error:", error?.localizedDescription ?? "no error description"); return }
  4.  
  5. let credential = CFArrayGetValueAtIndex(credentials, 0) as! CFDictionary
  6. let server = unsafeBitCast(CFDictionaryGetValue(credential, unsafeBitCast(kSecAttrServer, to: UnsafeRawPointer<Void>.self)), to: CFString.self)
  7. let account = unsafeBitCast(CFDictionaryGetValue(credential, unsafeBitCast(kSecAttrAccount, to: UnsafeRawPointer<Void>.self)), to: CFString.self)
  8. let password = unsafeBitCast(CFDictionaryGetValue(credential, unsafeBitCast(kSecSharedPassword, to: UnsafeRawPointer<Void>.self)), to: CFString.self)
  9.  
  10. print("Keychain OK:", server, account, password)
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement