flutter_secure_storage icon indicating copy to clipboard operation
flutter_secure_storage copied to clipboard

macOS - containsKey is always returning true

Open kineticac opened this issue 2 years ago • 10 comments

No matter what key I'm passing for the containsKey function, this always returns true the first time on a macOS build.

Is anyone else getting this issue? Let me know what other information you might need to help resolve.

kineticac avatar Sep 02 '21 22:09 kineticac

I have the same issue on iOS Iphone 12 simulator -> containsKey returns true but read returns null, used to work on stable release. temporary bypass for me is a function to check contains by calling await _secureStorage.containsKey(key: _tokenKey) && await _secureStorage.read(key: _tokenKey) != null;

pikawika avatar Sep 15 '21 08:09 pikawika

@pikawika I'll try the workaround! Thank you!

kineticac avatar Oct 19 '21 23:10 kineticac

Please try again using the latest v5.0.0. If issue still exists feel free to comment.

juliansteenbakker avatar Nov 12 '21 15:11 juliansteenbakker

Problem still exists in package 5.0.2

AgustinV08 avatar Nov 16 '21 18:11 AgustinV08

+1

Pretty critical/hardcore bug when you use this function to check if a user is LoggedIn or not ...

Maybe this plugin is not so secure ^^

jscti avatar Dec 09 '21 08:12 jscti

Pretty critical/hardcore bug when you use this function to check if a user is LoggedIn or not ...

You should not use this function to check if a user is logged in or not. You should read the actual data that it has and check if it is still valid or not expired like a token.

juliansteenbakker avatar Dec 09 '21 09:12 juliansteenbakker

It's up to me and you don't know of any of the other technical details. If you think containsKey has no use, remove it from the lib

But yeah now that containsKey is totally broke, I don't really have a choice

jscti avatar Dec 09 '21 11:12 jscti

It's up to me and you don't know of any of the other technical details. If you think containsKey has no use, remove it from the lib

It has a use, it should be used to check if a certain key is available as to not have null errors when trying to access that key. For as far as I know the check I provided will manually do null check and thus achieve the same result as this function, temporarily bypassing this bug. :)

pikawika avatar Dec 09 '21 11:12 pikawika

It's up to me and you don't know of any of the other technical details.

Ofcourse it's up to you. I'm saying that this function is not designed for that purpose the way you described it in your first comment.

I am aware that there are some bugs in this lib, and i hope someone can help and fix some of those as i don't have all the time to fix those myself. I am always open for PR's

juliansteenbakker avatar Dec 09 '21 13:12 juliansteenbakker

this issue still exist in v5.1.2

hpelitebook745G2 avatar Aug 18 '23 07:08 hpelitebook745G2