How To Find A Key By Label From Secretstorage Collection
I used GnomeKeyring from Gtk3 with Python 2.7 but almost all methodes are deprecated [1]. So I tried to use SecretSecret.Collection [2] import gi gi.require_version('Secret', '1.0
Solution 1:
I haven't figured out how to search for the label either, but AFAICT, the label is set from one of the attributes by the GUI. This seems to work for me to find website credentials:
import secretstorage
bus = secretstorage.dbus_init()
collection = secretstorage.get_default_collection(bus) ## login keyring
search={u'action_url': u'https://testapp.example.com:8443/login'}
items = collection.search_items(search)
for item in items:
print item.get_label()
print item.get_secret()
The printed label is, in fact, identical to what I searched for, and I think this is the intended way to use the API. Of course, the twist is in figuring out the exact attribute to search for; for another website the identifying URL is stored under "origin_url".
Post a Comment for "How To Find A Key By Label From Secretstorage Collection"