flexpass.backends.GpgBackend
- class flexpass.backends.GpgBackend(store: str | Path = '~/.password-store', key: str | Path = None, **kwargs)
Bases:
BackendBackend for GPG encrypted files following the layout defined by pass, the “standard unix password manager”.
- __init__(store: str | Path = '~/.password-store', key: str | Path = None, **kwargs)
Instanciate the backend.
Backend implementations should raise :exception:BackendNotAvailable from their __init__ in case the backend is not currently available.
- Raises:
BackendNotAvailable – The backend is not currently available.
BackendError – An other error occured while instanciating the backend.
Methods
__init__([store, key])Instanciate the backend.
close()Perform clean-up of resources before closing the backend.
delete_password(name[, warn_if_notfound])Delete the given password from the backend.
get_password(name[, warn_if_notfound])Return the password with the given name, or None if not found in the backend.
List all available passwords in the backend.
set_password(name, password, **options)Set the given password in the backend.
Attributes
Indicate whether the backend is read-only.
Name of the backend.
Priority of the backend.
Options passed to the backend.
- close()
Perform clean-up of resources before closing the backend.
- delete_password(name: str, warn_if_notfound=False) bool
Delete the given password from the backend.
Return True if the password was deleted, False if the password was not found.
- Parameters:
name (str) – Name of the password.
warn_if_notfound (bool, optional) – If True, emit a warning if no password with the given name is found (defaults to False).
- Returns:
True if the password was deleted, False if the password was not found.
- Return type:
bool
- get_password(name: str, warn_if_notfound=False) str | None
Return the password with the given name, or None if not found in the backend.
- Parameters:
name (str) – Name of the password.
warn_if_notfound (bool, optional) – If True, emit a warning if no password with the given name is found (defaults to False).
- Returns:
The value of the password if found, None if not found.
- Return type:
str or None
- list_passwords() list[PasswordInfo]
List all available passwords in the backend.
- Returns:
Password name and information from the backend.
- Return type:
list[PasswordInfo]
- name: str
Name of the backend.
- options: dict[str, Any]
Options passed to the backend.
- priority: int
Priority of the backend.
- readonly = False
Indicate whether the backend is read-only.
- set_password(name: str, password: str, **options) bool
Set the given password in the backend.
- Parameters:
name (str) – Name of the password.
password (str) – Value of the password.