agilebits / onepassword-app-extension

1Password Extension for iOS Apps
2.58k stars 311 forks source link

loginDictionary always contains "username" key #364

Closed dm-z closed 7 years ago

dm-z commented 7 years ago

Even if all user information is empty (except URL of course), loginDictionary will contain key "username", and it's value will be "", instead of nil. While all other keys won't be presented, so all values except "username" will be nil. It is not documented anywhere. So do we supposed to treat "username" differently than other properties?

Example:

Printing description of loginDictionary: { username = ""; }

gks commented 7 years ago

Hi @DZozulya

I've looked into this a bit and I can clearly see why this happens at a code level. We are simply returning an empty string for an item when there is no username. However, we return nil when there is no password value. So these do behave differently for that reason. Since the returned value is what gets passed on to the app that called the app extension.

What I am not sure of is if there is a reason for why this occurs.

If you need a full answer to this I am happy to do some investigation. I'll close this issue but if you have questions feel free to follow up.

dm-z commented 7 years ago

Thanks @gks I don't really need to know reason for that, but it would be nice if at least this was mentioned in readme.md, as I supposed to have empty dictionary for empty credentials.