mogol / flutter_secure_storage

A Flutter plugin to store data in secure storage
https://pub.dartlang.org/packages/flutter_secure_storage
BSD 3-Clause "New" or "Revised" License
1.09k stars 340 forks source link

Return nil on iOS read if key is not found #710

Closed ztaylor54 closed 1 month ago

ztaylor54 commented 1 month ago

Fixes #709.

It looks like the readAll function was updated in a recent commit to explicitly return nil when a keychain key isn't found, but the read function was not updated to match the new error checking scheme.

I just added the same check for errSecItemNotFound and I am able to get my builds working on version 9.1.1.

paulking86 commented 1 month ago

Great work! I am also currently seeing some unexpected behaviour on iOS around the .delete() method. I wonder if your fix also needs to be added there too?

ztaylor54 commented 1 month ago

@paulking86 I think you're right here -- reading through recent comments in #709 shows that the issue is with more than just the read function. I should have time to update this PR today.

ztaylor54 commented 1 month ago

@juliansteenbakker I also added the check to the delete function, as it is also affected.

Someone mentioned that write was also affected, but I am unsure how to reproduce so I'll leave that for you to triage.

I suspect this has to do with a change to keychain in recent iOS versions. The app store requirements recently changed to require iOS 17 SDK for all submissions, but I can't find anything in Apple's changelogs that points to an obvious culprit.

juliansteenbakker commented 1 month ago

Looks good, LGTM!

aliasgar4558 commented 1 month ago

@juliansteenbakker - Are we not looking for package version update for this fix?

juliansteenbakker commented 1 month ago

I am still working on some other fixes for macOS and iOS, so the update will be later today