| |
- builtins.Exception(builtins.BaseException)
-
- libpwman.cryptsql.CSQLError
- builtins.object
-
- PWManEntry
- PWManEntryAttr
- PWManEntryBulk
- PWManEntryTOTP
- libpwman.cryptsql.CryptSQL(builtins.object)
-
- PWManDatabase
class CSQLError(builtins.Exception) |
|
CryptSQL exception. |
|
- Method resolution order:
- CSQLError
- builtins.Exception
- builtins.BaseException
- builtins.object
Data descriptors defined here:
- __weakref__
- list of weak references to the object
Methods inherited from builtins.Exception:
- __init__(self, /, *args, **kwargs)
- Initialize self. See help(type(self)) for accurate signature.
Static methods inherited from builtins.Exception:
- __new__(*args, **kwargs) from builtins.type
- Create and return a new object. See help(type) for accurate signature.
Methods inherited from builtins.BaseException:
- __delattr__(self, name, /)
- Implement delattr(self, name).
- __getattribute__(self, name, /)
- Return getattr(self, name).
- __reduce__(...)
- Helper for pickle.
- __repr__(self, /)
- Return repr(self).
- __setattr__(self, name, value, /)
- Implement setattr(self, name, value).
- __setstate__(...)
- __str__(self, /)
- Return str(self).
- add_note(...)
- Exception.add_note(note) --
add a note to the exception
- with_traceback(...)
- Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.
Data descriptors inherited from builtins.BaseException:
- __cause__
- exception cause
- __context__
- exception context
- __dict__
- __suppress_context__
- __traceback__
- args
|
class PWManDatabase(libpwman.cryptsql.CryptSQL) |
|
PWManDatabase(filename, passphrase, key=None, readOnly=True, silent=False)
Encrypted pwman database. |
|
- Method resolution order:
- PWManDatabase
- libpwman.cryptsql.CryptSQL
- builtins.object
Methods defined here:
- __init__(self, filename, passphrase, key=None, readOnly=True, silent=False)
- filename: Path to the database file.
If it does not exist, a new file is created.
passphrase: The passphrase string for the database file.
key: An optional key to use instead of the passphrase. Don't use it.
readOnly: Open the filename read-only. Commits will raise an exception.
silent: Do not print information messages to the console.
- addEntry(self, entry)
- Create a new entry in the database.
entry: A PWManEntry() instance.
- categoryExists(self, category)
- Returns True, if a category exists in the database.
category: The name string of the category.
- commit(self)
- Write all changes to the encrypted database file.
- delEntry(self, entry)
- Delete an existing entry from the database.
entry: The PWManEntry() instance to delete from the database.
- dropUncommitted(self)
- Drop all changes that are not committed, yet.
- dumpEntries(self, totp='hide')
- Returns a human readable dump string of all entries.
- dumpEntriesCsv(self, totp='hide')
- Returns a CSV format dump string of all entries.
- dumpEntry(self, entry, totp='hide')
- Returns a human readable dump string of an entry.
- editEntry(self, entry)
- Update the contents of an existing entry.
entry: A PWManEntry() containing the new data of the entry/
- entryExists(self, category, title)
- Returns True, if an entry exists in the database.
category: The name string of the category.
title: The title string of the entry.
- findEntries(self, pattern, useRegexp=False, search=True, inCategory=None, matchCategory=False, matchTitle=False, matchUser=False, matchPw=False, matchBulk=False, matchAttrName=False, matchAttrData=False)
- Search the database for entries that match a pattern.
useRegexp: If True, then the pattern is a regular expression string.
If False, then the pattern is a SQL LIKE pattern string.
inCategory: If specified as non-zero length string, then only search
the category with this name.
matchCategory: Match the pattern to the category name string of an entry.
matchTitle: Match the pattern to the title string of an entry.
matchUser: Match the pattern to the user string of an entry.
matchPw: Match the pattern to the password string of an entry.
matchBulk: Match the pattern to the bulk data string of an entry.
matchAttrName: Match the pattern to all attribute name strings of an entry.
matchAttrData: Match the pattern to all attribute data strings of an entry.
Returns a list of PWManEntry() instances that match the pattern.
- flunkDirty(self)
- Print a warning, if the database contains uncommitted data.
Then set the flag for uncommitted data to False.
- getCategoryNames(self)
- Get all category names in the database.
Returns a sorted list of strings.
- getEntry(self, category, title)
- Get an entry from the database.
category: The name string of the category to get an entry from.
title: The title string of the entry to get.
Returns a PWManEntry() instance.
- getEntryAttr(self, entry, attrName)
- Get an attribute associated with an entry.
entry: The PWManEntry() to get the attribute for.
attrName: The name string of the attribute to get.
Returns a PWManEntryAttr() instance, or None if there is such attribute.
- getEntryAttrs(self, entry)
- Get all attributes associated with an entry.
entry: The PWManEntry() to get the attributes for.
Returns a list of PWManEntryAttr() instances,
or an empty list if there are no attributes.
- getEntryBulk(self, entry)
- Get the bulk data associated with an entry.
entry: The PWManEntry() to get the bulk data for.
Returns a PWManEntryBulk() instance or None, if there is no bulk data.
- getEntryTitles(self, category)
- Get all titles from one category in the database.
category: The category name string.
Returns a sorted list of strings.
- getEntryTotp(self, entry)
- Get the TOTP parameters associated with an entry.
entry: The PWManEntry() to get the TOTP parameters for.
Returns a PWManEntryTOTP() instance, or None if there is no TOTP data.
- getGlobalAttr(self, name)
- Get a global attribute.
A global attribute is not associated with an entry.
Returns None, if the attribute does not exist.
- getOnDiskDb(self)
- Get a read-only instance of PWManDatabase that contains
the current on-disk data. The on-disk data is the data
at the last commit.
- importSqlScript(self, *args, **kwargs)
- Imports a plain text dump into the database.
script: The script string to import.
clear: If True, drop all tables from the database before importing.
- isDirty(self)
- Returns True, if the database contains uncommitted data.
- moveEntries(self, fromCategory, toCategory, toDb=None, copy=False)
- Move or copy all entries from one category to another category.
fromCategory: The category to move all entries from.
toCategory: The (new) category to move all entries to.
toDb: The target database. Defaults to self.
copy: If False, then move. If True, then copy.
- moveEntry(self, entry, newCategory, newTitle, toDb=None, copy=False)
- Move or copy an existing entry to a new category and/or set a new entry title.
entry: The PWManEntry() instance to move/copy.
newCategory: The target category name string.
newTitle: The target title string.
toDb: The target database. Defaults to self.
copy: If False, then move. If True, then copy.
- setEntryAttr(self, entryAttr)
- Set an attribute associated with an entry.
entryAttr: The new PWManEntryAttr() instance to write to the database.
If entryAttr.data is None, then the attribute is deleted.
- setEntryBulk(self, entryBulk)
- Set the bulk data associated with an entry.
entryBulk: The new PWManEntryBulk() instance to write to the database.
If entryBulk.data is None, then the bulk data is deleted.
- setEntryTotp(self, entryTotp)
- Set the TOTP data associated with an entry.
entryTotp: The new PWManEntryTOTP() instance to write to the database.
If entryTotp.key is None, then the TOTP data is deleted.
- setGlobalAttr(self, name, data, setDirty=True)
- Set a global attribute.
A global attribute is not associated with an entry.
If data is None or empty, the attribute is deleted from the database.
- setPassphrase(self, passphrase)
- Set a new passphrase string for encryption and decryption.
Data and other attributes defined here:
- DB_TYPE = 'PWMan database'
- DB_VER = ('0', '1')
Methods inherited from libpwman.cryptsql.CryptSQL:
- DEFAULT_KDF_ITER lambda kdfMem
- KDF_ITERLIMIT_A lambda kdfMem
- close(self)
- Close the currently opened database.
This does not commit. All uncommitted changes are lost.
- dropAllTables(self)
- Drop all tables from the database.
- getFilename(self)
- Get the file path of the currently open database.
May return None, if no database file is opened.
- getKey(self)
- Get the raw key. May be None, if there is none, yet.
Do not use this. getPassphrase probably is what you want.
- getPassphrase(self)
- Get the current passphrase string for encryption and decryption.
- isOpen(self)
- Returns True, if a database file is opened.
- open(self, filename)
- Open a database file and decrypt its contents into memory.
filename: The database file path.
- setKey(self, key)
- Set the raw key.
Do not use this. setPassphrase probably is what you want.
- setRegexpFlags(self, search=True, ignoreCase=True, multiLine=True, dotAll=True)
- Change the behavior of the REGEXP operator.
- sqlCreateFunction(self, name, nrParams, func)
- Create an SQL function.
See sqlite3.Connection.create_function for more details.
- sqlExec(self, code, params=[])
- Execute one SQL statement.
- sqlExecScript(self, code)
- Execute multiple SQL statements.
Warning: This implicitly commits pending transactions before executing.
- sqlIsEmpty(self)
- Returns True, if the database does not contain any tables.
- sqlPlainDump(self)
- Get a plain text dump of the database.
Returns bytes.
- sqlVacuum(self)
- Run the SQL VACUUM statement.
This also commits all changes to the SQL database,
but not to the database file.
Data descriptors inherited from libpwman.cryptsql.CryptSQL:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes inherited from libpwman.cryptsql.CryptSQL:
- CSQL_HEADER = b'CryptSQL v1'
- DEFAULT_KDF_MEM = 24584
- KDF_ITERLIMIT_B = 2
- KDF_MEMLIMIT = 24584
- KDF_MEM_BASE = 24576
- KDF_MEM_CHUNK = 28
- KDF_SALT_NBYTES = 19
- KDF_THREADS = 7
|
class PWManEntry(builtins.object) |
|
PWManEntry(category: str, title: str, user: str = None, pw: str = None, entryId: int = None) -> None
Database entry data structure. |
|
Methods defined here:
- __eq__(self, other)
- Return self==value.
- __init__(self, category: str, title: str, user: str = None, pw: str = None, entryId: int = None) -> None
- Initialize self. See help(type(self)) for accurate signature.
- __repr__(self)
- Return repr(self).
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- __annotations__ = {'category': <class 'str'>, 'entryId': <class 'int'>, 'pw': <class 'str'>, 'title': <class 'str'>, 'user': <class 'str'>}
- __dataclass_fields__ = {'category': Field(name='category',type=<class 'str'>,default...appingproxy({}),kw_only=False,_field_type=_FIELD), 'entryId': Field(name='entryId',type=<class 'int'>,default=...appingproxy({}),kw_only=False,_field_type=_FIELD), 'pw': Field(name='pw',type=<class 'str'>,default=None,...appingproxy({}),kw_only=False,_field_type=_FIELD), 'title': Field(name='title',type=<class 'str'>,default=<d...appingproxy({}),kw_only=False,_field_type=_FIELD), 'user': Field(name='user',type=<class 'str'>,default=Non...appingproxy({}),kw_only=False,_field_type=_FIELD)}
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
- __hash__ = None
- __match_args__ = ('category', 'title', 'user', 'pw', 'entryId')
- entryId = None
- pw = None
- user = None
|
class PWManEntryAttr(builtins.object) |
|
PWManEntryAttr(name: str, data: str = None, entry: database.PWManEntry = None, attrId: int = None) -> None
Entry attribute data structure. |
|
Methods defined here:
- __eq__(self, other)
- Return self==value.
- __init__(self, name: str, data: str = None, entry: database.PWManEntry = None, attrId: int = None) -> None
- Initialize self. See help(type(self)) for accurate signature.
- __repr__(self)
- Return repr(self).
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- __annotations__ = {'attrId': <class 'int'>, 'data': <class 'str'>, 'entry': <class 'database.PWManEntry'>, 'name': <class 'str'>}
- __dataclass_fields__ = {'attrId': Field(name='attrId',type=<class 'int'>,default=N...appingproxy({}),kw_only=False,_field_type=_FIELD), 'data': Field(name='data',type=<class 'str'>,default=Non...appingproxy({}),kw_only=False,_field_type=_FIELD), 'entry': Field(name='entry',type=<class 'database.PWManEn...appingproxy({}),kw_only=False,_field_type=_FIELD), 'name': Field(name='name',type=<class 'str'>,default=<da...appingproxy({}),kw_only=False,_field_type=_FIELD)}
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
- __hash__ = None
- __match_args__ = ('name', 'data', 'entry', 'attrId')
- attrId = None
- data = None
- entry = None
|
class PWManEntryBulk(builtins.object) |
|
PWManEntryBulk(data: str = None, entry: database.PWManEntry = None, bulkId: int = None) -> None
Entry bulk-data data structure. |
|
Methods defined here:
- __eq__(self, other)
- Return self==value.
- __init__(self, data: str = None, entry: database.PWManEntry = None, bulkId: int = None) -> None
- Initialize self. See help(type(self)) for accurate signature.
- __repr__(self)
- Return repr(self).
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- __annotations__ = {'bulkId': <class 'int'>, 'data': <class 'str'>, 'entry': <class 'database.PWManEntry'>}
- __dataclass_fields__ = {'bulkId': Field(name='bulkId',type=<class 'int'>,default=N...appingproxy({}),kw_only=False,_field_type=_FIELD), 'data': Field(name='data',type=<class 'str'>,default=Non...appingproxy({}),kw_only=False,_field_type=_FIELD), 'entry': Field(name='entry',type=<class 'database.PWManEn...appingproxy({}),kw_only=False,_field_type=_FIELD)}
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
- __hash__ = None
- __match_args__ = ('data', 'entry', 'bulkId')
- bulkId = None
- data = None
- entry = None
|
class PWManEntryTOTP(builtins.object) |
|
PWManEntryTOTP(key: str, digits: int = 6, hmacHash: str = 'SHA1', entry: database.PWManEntry = None, totpId: int = None) -> None
Entry TOTP-data data structure. |
|
Methods defined here:
- __eq__(self, other)
- Return self==value.
- __init__(self, key: str, digits: int = 6, hmacHash: str = 'SHA1', entry: database.PWManEntry = None, totpId: int = None) -> None
- Initialize self. See help(type(self)) for accurate signature.
- __repr__(self)
- Return repr(self).
- generate(self)
Data descriptors defined here:
- __dict__
- dictionary for instance variables
- __weakref__
- list of weak references to the object
Data and other attributes defined here:
- __annotations__ = {'digits': <class 'int'>, 'entry': <class 'database.PWManEntry'>, 'hmacHash': <class 'str'>, 'key': <class 'str'>, 'totpId': <class 'int'>}
- __dataclass_fields__ = {'digits': Field(name='digits',type=<class 'int'>,default=6...appingproxy({}),kw_only=False,_field_type=_FIELD), 'entry': Field(name='entry',type=<class 'database.PWManEn...appingproxy({}),kw_only=False,_field_type=_FIELD), 'hmacHash': Field(name='hmacHash',type=<class 'str'>,default...appingproxy({}),kw_only=False,_field_type=_FIELD), 'key': Field(name='key',type=<class 'str'>,default=<dat...appingproxy({}),kw_only=False,_field_type=_FIELD), 'totpId': Field(name='totpId',type=<class 'int'>,default=N...appingproxy({}),kw_only=False,_field_type=_FIELD)}
- __dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False)
- __hash__ = None
- __match_args__ = ('key', 'digits', 'hmacHash', 'entry', 'totpId')
- digits = 6
- entry = None
- hmacHash = 'SHA1'
- totpId = None
| |