Skip to content

Commit

Permalink
Add wrappers for SecItemDelete and SecItemUpdate
Browse files Browse the repository at this point in the history
Thank you for the great library!

This PR adds `delete_item`, `update_item` and `ItemUpdateOptions`. The
functions reuse `SearchItemParams` to identify which items to modify
and so I've also added a `to_dictionary` method to `SearchItemParams`.
In fact, it would probably make sense to replace
`SearchItemParams::search` with a `search_item` function in line with
the add/update/delete API, but I didn't want to make unnecessary
changes.

Also in the spirit of minimising changes to existing code:
- I added a slightly strange API to `ItemUpdateOptions::set_class` to
  allow for rewriting the secret data without overwriting the class.
  Alternatively, I could add an `ItemUpdateValue` that is the same as
  `ItemAddValue`, but doesn't take a class.
- `ItemUpdateOptions` is basically a duplicate of `ItemAddOptions`. I
  could instead define `struct ItemAddOptions(ItemUpdateOptions)` and
  then just forward all the methods.

Signed-off-by: Klim Tsoutsman <klim@tsoutsman.com>
  • Loading branch information
tsoutsman committed Aug 29, 2024
1 parent 62aa0de commit 49acfaf
Showing 1 changed file with 243 additions and 74 deletions.
Loading

0 comments on commit 49acfaf

Please # to comment.