Reputation: 1535
I am looking at a pretty robust keychain wrapper that was written by Matthew Palmer Github: https://github.com/matthewpalmer/Locksmith
In the examples, there is this parameter passed for all requests as "userAccount" : "myUserAccount" but I am not sure what that parameter means in the context of my application.
The "service" makes sense as that would be the specific keychain group or Bundle Id but what do I pass in for the "userAccount."
here is a code snippet of what I am referring to.
let (dictionary, error) = Locksmith.loadDataForUserAccount("myUserAccount")
Thanks.
EDIT
After reading Rory's comment, I interpreted this to be similar to:
let error = Locksmith.saveData(["password": "somePassword"], forUserAccount: "userName")
and then querying that data:
let (dictionary, error) = Locksmith.loadDataForUserAccount("userName")
which would return a dictionary with the password inside?
Upvotes: 3
Views: 3312
Reputation: 53101
If you're looking for something a little simpler than Locksmith, you could try the following drop-in wrapper:
https://github.com/ashleymills/keychain.swift
Upvotes: 1
Reputation: 8014
userAccount will be the key the data is associated with, like an user name, email address or something else unique. So if service was Facebook, userAccount would be your facebook login id. Associated with the pair of service and userAccount will be other data you store like a password.
Think of Service and userAccount as a composite key which has dictionary items associated with it.
Upvotes: 4