Closed bioinfornatics closed 1 year ago
Keyring doesn't support listing all secrets. It also has no integration into gnome online specifics. To the extent that keyring is picking up Gnome keyring as the backend, you can get/set/delete passwords in Gnome keyring, and if Gnome keyring is configured to integrate with an online service, changes made by keyring may be reflected in an online account, but keyring doesn't do anything specifically for that.
Let me know if that doesn't answer your questions.
Thanks @jaraco
I was able to list secrets through the code below:
import secretstorage
connection = secretstorage.dbus_init()
collection = secretstorage.get_collection_by_alias(connection, 'login')
items=list(sorted(collection.get_all_items(), key=lambda i: i.get_label()))
for i in items:
print('------')
print(i.get_label())
print(i.item_path)
print(i.get_attributes())
which could give
------
Données d’authentification GOA imap_smtp pour l’identité account_1899113806_1
/org/freedesktop/secrets/collection/login/9
{'goa-identity': 'imap_smtp:gen0:account_1899113806_1', 'xdg:schema': 'org.gnome.OnlineAccounts'}
------
Password for 'foobar' on 'system'
/org/freedesktop/secrets/collection/login/17
{'application': 'Python keyring library', 'service': 'system', 'username': 'foobar', 'xdg:schema': 'org.freedesktop.Secret.Generic'}
So I think that the second result can explain the ability to use keyring
as the service
is system
and username foobar
import keyring
keyring.get_password("system", "foobar")
But I do not found yet how to retrieve password from gnome online account as they are no service provided from the attributes properties (i.get_attributes()
)
Dear teams, after read both keyring documentation and gnome documentation it is still unclear to me how to list all secrets and how to retrieve a secret link to a gnome online account.
current pointer that help but not enoughs:
the current documentation describe only how to retrieve the system password from the logged user.
Thanks for your help