def delete(username_or_identifier,for_data=False): """ Delete the stored password for the associated username from the keyring. Setting for_data=True will delete the key for the identifier from a previous data encrypt() call. """ keyring = getKeyring() if for_data: username_or_identifier += '_DATA_KEY' try: keyring.delete_password(SERVICE_NAME,username_or_identifier) return True except: ERROR('Failed to delete password from keyring') return False
def delete(username_or_identifier, for_data=False): """ Delete the stored password for the associated username from the keyring. Setting for_data=True will delete the key for the identifier from a previous data encrypt() call. """ keyring = getKeyring() if for_data: username_or_identifier += '_DATA_KEY' try: keyring.delete_password(SERVICE_NAME, username_or_identifier) return True except: ERROR('Failed to delete password from keyring') return False
def store(username,password,only_if_unlocked=False): """ Save the provided password for the associated username Returns true if the password was successfully saved, otherwise false """ if only_if_unlocked: if getKeyringName().startswith('Internal.'): if not internalGetpass.getRememberedKey(): return keyring = getKeyring() try: if not password: try: keyring.delete_password(SERVICE_NAME,username) except: pass else: keyring.set_password(SERVICE_NAME,username,password or '') LOG('Password saved via keyring.') return True except: ERROR('Failed to save password to keyring') return False
def store(username, password, only_if_unlocked=False): """ Save the provided password for the associated username Returns true if the password was successfully saved, otherwise false """ if only_if_unlocked: if getKeyringName().startswith('Internal.'): if not internalGetpass.getRememberedKey(): return keyring = getKeyring() try: if not password: try: keyring.delete_password(SERVICE_NAME, username) except: pass else: keyring.set_password(SERVICE_NAME, username, password or '') LOG('Password saved via keyring.') return True except: ERROR('Failed to save password to keyring') return False