Skip to content
This repository was archived by the owner on May 15, 2024. It is now read-only.
This repository was archived by the owner on May 15, 2024. It is now read-only.

[Secure Storage] Should not throw when removing key that doesn't exist. #561

@domagojmedo

Description

@domagojmedo

On SecureStorage iOS implementation

bool RemoveRecord(SecRecord record)
{
        var result = SecKeyChain.Remove(record);
        if (result != SecStatusCode.Success)
            throw new Exception(string.Format($"Error removing record: {result}"));

        return true;
}

It's possible to get

System.Exception: Error removing record: ItemNotFound

Should that status code maybe not throw exception? We are trying to remove it and it's not there, so the end result is the same.

Stack trace I got

Xamarin.Essentials KeyChain.RemoveRecord (Security.SecRecord record)
Xamarin.Essentials KeyChain.SetValueForKey (System.String value, System.String key, System.String service)
Xamarin.Essentials SecureStorage.SetAsync (System.String key, System.String value, Security.SecAccessible accessible)
Xamarin.Essentials SecureStorage.PlatformSetAsync (System.String key, System.String data)
Xamarin.Essentials SecureStorage.SetAsync (System.String key, System.String value)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingready-to-implementFeature approved, specs written, and ready to implement.up-for-grabsImplementation from community can be started.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions