def set_credentials(self, app_name, cred):
"""Set the credentials of the Ubuntu SSO item."""
# the windows keyring can only store a pair username-password
# so we store the data using ubuntu_sso as the user name. Then
# the cred will be stored as the string representation of the dict.
return deferToThread(self.keyring.set_password, app_name, USERNAME,
def delete_credentials(self, app_name):
"""Delete a set of credentials from the keyring."""
# this call depends on a patch I sent to pykeyring. The patch has
# not landed as of version 0.5.1. If you have that version you can
# clone my patch in the following way:
# hg clone https://bitbucket.org/mandel/pykeyring-delete-password
# pylint: disable=E1103
return deferToThread(self.keyring.delete_password, app_name, USERNAME)
def get_credentials(self, app_name):
"""A deferred with the secret of the SSO item in a dictionary."""
return deferToThread(self._get_credentials_obj, app_name)