capacitor-secure-storage-plugin icon indicating copy to clipboard operation
capacitor-secure-storage-plugin copied to clipboard

`clear()` throws error on iOS if secure storage is empty

Open dennisameling opened this issue 2 years ago • 0 comments

When the Keychain is already empty and then calling SecureStoragePlugin.clear() on iOS, it throws an error:

⚡️  To Native ->  SecureStoragePlugin clear 101871643
⚡️  [error] - {"message":"error","errorMessage":"error"}

This is inconsistent with Android, which simply returns true if the Secure Storage was already empty.

I'd expect this method to simply return true if the Keychain was already empty. Throwing an error suggests that something went wrong in the removal process, which is not the case.

Would it be possible to either:

  • Add something to the documentation that mentions this iOS-specific behavior
  • Or let iOS return true if SecureStoragePlugin.clear() is called if the Keychain is already empty

Thanks in advance!

dennisameling avatar Oct 16 '22 15:10 dennisameling