[MOD-2487] iOS: Ti.Identity can't find keychain items with empty label or description
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | n/a |
Status | Resolved |
Resolution | Unresolved |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | Identity |
Labels | ios, keychain-access, ti.identity |
Reporter | Andrea Jonus |
Assignee | Vijay Singh |
Created | 2018-11-23T15:32:08.000+0000 |
Updated | 2020-01-28T21:55:08.000+0000 |
Description
While trying to share a keychain item with a native app using Ti.Identity, I noticed that, while the native app could read items created by my Titanium app, the opposite wasn't working at all.
Looking at the code of Ti.Identity, I found this at line 197 of APSKeychainWrapper.m:
baseAttributes = [NSMutableDictionary dictionaryWithDictionary:@{
(id)kSecClass: (id)kSecClassGenericPassword,
(id)kSecAttrAccount: _identifier,
(id)kSecAttrService: _service,
(id)kSecAttrAccount: @"",
(id)kSecAttrLabel: @"",
(id)kSecAttrDescription: @""
}];
"kSecAttrLabel" and "kSecAttrDescription" are both passed as empty strings. The resulting query to the keychain filters only the items that have both their label and description set to empty string. Ti.Identity.KeychainItem has no "label" or "description" attributes, so there is no way to control this behavior.
"kSecAttrAccount" is also assigned both the value of _identifier and empty string. This works fine anyway, since only the first assignment is kept, but it's confusing.
I've created [a pull request](https://github.com/appcelerator-modules/titanium-identity/pull/22) to solve this issue.
[~ajonus], Thanks for reporting this. Can you please test this on 7.5.0.GA ans let us know how it goes.
Can please someone move the ticket to TIMOB, merge the PR and release a new version?
FR Passed. PR Merged.