flutter_secure_storage icon indicating copy to clipboard operation
flutter_secure_storage copied to clipboard

iOSOptions with null group fails to add key to keychain

Open vividcode opened this issue 4 years ago • 3 comments

Inside FlutterSecureStoragePlugin.m -> write function, there is following line:

if(groupId != nil) { search[(__bridge id)kSecAttrAccessGroup] = groupId; }

Same check exists read function as well.

This results in search dictionary having nsnull value. As a result, SecItemAdd results in errSecParam (-50).

This problem is observed on iOS 13 simulator.

Checking !(groupId == [NSNull null])fixes the problem with null groupId.

When groupId is not supplied from flutter, this check fails because groupId is NSNull.

Supplying groupId may fix the problem but will require TEAM to be known to specify keychain access group, which is not always possible.

vividcode avatar Mar 20 '20 15:03 vividcode

Any updates on this issue?

vividcode avatar Mar 30 '20 12:03 vividcode

Any updates?

intraector avatar Oct 23 '20 09:10 intraector

I'm not really familiar with obj-c code, so how should we check for NSNull? Implementing it like this gives the following error: Comparison of distinct pointer types

    if(groupId != nil || groupId != [NSNull null]) {
        search[(__bridge id)kSecAttrAccessGroup] = groupId;
    }

juliansteenbakker avatar Aug 02 '21 07:08 juliansteenbakker