mitya57 / secretstorage

Python bindings to Freedesktop.org Secret Service API

Home Page:https://secretstorage.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Expose whether individual items are locked or unlocked

mathstuf opened this issue · comments

The spec states that items may be locked individually, separately from the collection. It does not appear that an API is exposed to unlock individual items. In fact, when returning items, it puts the locked and unlocked items in the same result without any differentiation between them.

In the current Git snapshot Item now has an unlock() method, which behaves the same way as Collection.unlock() method. Please test that.

I can also add only_unlocked boolean argument to search_items function, if you need that.

Thanks; this is probably sufficient for now. A convenience method for unlocking if necessary night be nice, but maybe not. I'll have to check if any existing API does this currently, but the support I plan for with keepassx will treat items as locked on a per-application basis, so this will be necessary there at least (KWallet used to do something similar as well in KDE3, but maybe that was gated at the wallet level, not the item level).

To unlock a bunch of items (i.e. returned by search_items()) at once, you now can do this:

from secretstorage.util import unlock_objects
unlock_objects([item.item_path for item in items])