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

Resolve error when no item exist (iOS) #662

Closed koji-1009 closed 1 month ago

koji-1009 commented 6 months ago

Fixes #391

On iOS, readAll (or deleteAll) will return error code errSecItemNotFound(-25300) if the item does not exist in the keychain. This is due to the error code errSecItemNotFound returned by SecItemCopyMatching (or SecItemDelete). This is expected behavior for iOS processing and is not a bug.

https://developer.apple.com/documentation/security/1542001-security_framework_result_codes/errsecitemnotfound

Therefore, this fix modifies the functions to return nil in cases when errSecItemNotFound is returned.

tenhobi commented 6 months ago

We would love to see merged since we also get errSecItemNotFound instead of null. 👍

juliansteenbakker commented 1 month ago

Looks good, thanks for your contribution!

koji-1009 commented 1 month ago

@juliansteenbakker Thanks!