Titanium JIRA Archive
Appcelerator Modules (MOD)

[MOD-2487] iOS: Ti.Identity can't find keychain items with empty label or description

GitHub Issuen/a
TypeBug
Priorityn/a
StatusResolved
ResolutionUnresolved
Affected Version/sn/a
Fix Version/sn/a
ComponentsIdentity
Labelsios, keychain-access, ti.identity
ReporterAndrea Jonus
AssigneeVijay Singh
Created2018-11-23T15:32:08.000+0000
Updated2020-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.

Comments

  1. Rakhi Mitro 2018-11-28

    [~ajonus], Thanks for reporting this. Can you please test this on 7.5.0.GA ans let us know how it goes.
  2. Hans Knöchel 2019-01-13

    Can please someone move the ticket to TIMOB, merge the PR and release a new version?
  3. Lokesh Choudhary 2020-01-28

    FR Passed. PR Merged.

JSON Source