How to use the keyring.delete_password function in keyring

To help you get started, we’ve selected a few keyring examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github instantshare / instantshare / src / storage / __init__.py View on Github external
except CryptoError:
                pw = text_input("Decryption Failure", "Please enter the correct password:", hidden=True)

    else:
        try:
            return KVStore(module)
        except PersistentDataEncryptedError:
            pw = text_input("Encryption Password",
                              "Please enter your previous encryption password (one last time):",
                              hidden=True)
            while True:
                try:
                    kvs = KVStore(module, pw, unlock=True)
                    try:  # if the above succeeded, try to remove password from keyring
                        user = getpass.getuser()
                        keyring.delete_password("instantshare", user)
                    except:
                        # keyring backend spec does not include exception type
                        pass  # password did not exist, so we don't need to remove it
                    return kvs
                except CryptoError:
                    pw = text_input("Decryption Failure", "Please enter the correct password:", hidden=True)
github philipn / aws-keyring / aws_keys / __init__.py View on Github external
def rm(name):
    credentials = get_credentials(name)

    keyring.delete_password('aws-keyring-access-key-id', name)
    keyring.delete_password('aws-keyring-secret-access-key', name)

    if credentials.mfa_serial:
        keyring.delete_password('aws-keyring-mfa', name)

    print("Credentials for account name '{}' deleted.".format(name))
github rackerlabs / yolo / yolo / client.py View on Github external
def clear_config(self):
        keyring.delete_password(const.NAMESPACE, 'rackspace_username')
        keyring.delete_password(const.NAMESPACE, 'rackspace_api_key')
        keyring.delete_password(const.NAMESPACE, 'aws_profile_name')
github zbarge / stocklook / stocklook / utils / security.py View on Github external
Removes a username/password from KeyRing
        and replaces with a new one if desired.

        :param service_name: (str)
            The service name to remove.

        :param username: (str)
            The username to remove the password for.

        :param new_secret_items: (list, default None)
            The new secret item(s) to assign to the username if desired.

        :return: (None)
        """
        try:
            keyring.delete_password(service_name, username)
        except keyring.errors.PasswordDeleteError:
            pass

        if new_secret_items:
            new_pass = self._join_password_items(new_secret_items)
            keyring.set_password(service_name, username, new_pass)
github rednafi / protomate / protomate / repo_auths.py View on Github external
def delete_pass(github_username):
    appname = "protomate"
    username = github_username
    keyring.delete_password(appname, username)
github limeburst / mfa / mfa / cli.py View on Github external
def delete(key):
    """Delete the key."""
    try:
        keyring.delete_password(__name__, key)
    except Exception as e:
        click.echo((Exception, e))
github nficano / alexa-find-my-iphone / src / site-packages / pyicloud / utils.py View on Github external
def delete_password_in_keyring(username):
    return keyring.delete_password(
        KEYRING_SYSTEM,
        username,
    )
github spillz / picty / modules / picty / plugins / emailer.py View on Github external
response=d.run()
        dfd = d.get_form_data()
        d.destroy()
        if response == 1:
            password = dfd['password']
            remember = dfd['remember']
            if remember and password != '':
                try:
                    keyring.set_password(KEYRING_SERVICE_NAME, user, password)
                except:
                    #TODO: If system keyring daemon is not running, an error will be raised -- need to be more informative to the user
                    pass
            elif not remember:
                try:
                    # only available in newer versions
                    keyring.delete_password(KEYRING_SERVICE_NAME, user)
                except:
                    # maybe give a warning?
                    pass
            return password
        return None
github coddingtonbear / taskwarrior-inthe.am / taskwarrior_inthe_am / commands.py View on Github external
def clear_passwords(config, args, *extra, **kwargs):
    keyring.delete_password(
        'taskwarrior_inthe.am',
        'api_key',
    )
    keyring.delete_password(
        'taskwarrior_inthe.am',
        'api_v2_key',
    )