nectarstorage package
Submodules
- nectarstorage.base module
- nectarstorage.exceptions module
- nectarstorage.interfaces module
- nectarstorage.masterpassword module
MasterPasswordMasterPassword.changePassword()MasterPassword.change_password()MasterPassword.decrypt()MasterPassword.decrypt_text()MasterPassword.deriveChecksum()MasterPassword.encrypt()MasterPassword.encrypt_text()MasterPassword.has_masterpassword()MasterPassword.lock()MasterPassword.locked()MasterPassword.masterkeyMasterPassword.unlock()MasterPassword.unlocked()MasterPassword.wipe_masterpassword()
- nectarstorage.ram module
- nectarstorage.sqlite module
Module contents
- class nectarstorage.InRamConfigurationStore(*_args, **_kwargs)
Bases:
InRamStore,ConfigInterfaceA simple example that stores configuration in RAM.
Internally, this works by simply inheriting
nectarstorage.ram.InRamStore. The interface is defined innectarstorage.interfaces.ConfigInterface.
- class nectarstorage.InRamEncryptedKeyStore(*args, **kwargs)
Bases:
InRamStore,KeyEncryptionAn in-RAM Store that stores keys encrypted in RAM.
Internally, this works by simply inheriting
nectarstorage.ram.InRamStore. The interface is defined innectarstorage.interfaces.KeyInterface.Note
This module also inherits
nectarstorage.masterpassword.MasterPasswordwhich offers additional methods and deals with encrypting the keys.
- class nectarstorage.InRamEncryptedTokenStore(*args, **kwargs)
Bases:
InRamStore,TokenEncryptionAn in-RAM Store that stores token encrypted in RAM.
Internally, this works by simply inheriting
nectarstorage.ram.InRamStore. The interface is defined innectarstorage.interfaces.TokenInterface.Note
This module also inherits
nectarstorage.masterpassword.MasterPasswordwhich offers additional methods and deals with encrypting the keys.
- class nectarstorage.InRamPlainKeyStore(*_args, **_kwargs)
Bases:
InRamStore,KeyInterfaceA simple in-RAM Store that stores keys unencrypted in RAM
Internally, this works by simply inheriting
nectarstorage.ram.InRamStore. The interface is defined innectarstorage.interfaces.KeyInterface.- add(wif, pub=None)
Add a new public/private key pair (correspondence has to be checked elsewhere!)
- Parameters:
pub (str) – Public key
wif (str) – Private key
- delete(key)
Delete a key from the store
- getPrivateKeyForPublicKey(pub)
- Returns the (possibly encrypted) private key that
corresponds to a public key
- Parameters:
pub (str) – Public key
The encryption scheme is BIP38
- getPublicKeys()
Returns the public keys stored in the database
- class nectarstorage.InRamPlainTokenStore(*_args, **_kwargs)
Bases:
InRamStore,TokenInterfaceA simple in-RAM Store that stores token unencrypted in RAM
Internally, this works by simply inheriting
nectarstorage.ram.InRamStore. The interface is defined innectarstorage.interfaces.TokenInterface.- add(token, name=None)
Add a new token entry (correspondence has to be checked elsewhere!)
- Parameters:
name (str) – Public identifier
token (str) – Token value
- delete(key)
Delete a key from the store
- getPrivateKeyForPublicKey(pub)
Returns the (possibly encrypted) token that corresponds to a name
- Parameters:
pub (str) – Public key
The encryption scheme is BIP38
- getPublicNames()
Returns the public token names stored in the database
- class nectarstorage.SQLiteCommon
Bases:
objectThis class abstracts away common sqlite3 operations.
This class should not be used directly.
When inheriting from this class, the following instance members must be defined:
sqlite_file: Path to the SQLite Database file
- sql_execute(query: Tuple[str, Tuple], lastid: bool = False) int | None
- sql_fetchall(query: Tuple[str, Tuple]) list
- sql_fetchone(query: Tuple[str, Tuple]) Tuple | None
- sqlite_file: Path | str
- use_memory: bool
- class nectarstorage.SQLiteFile(*args: Any, **kwargs: Any)
Bases:
objectThis class ensures that the user’s data is stored in its OS preotected user directory:
OSX:
~/Library/Application Support/<AppName>
Windows:
C:Documents and Settings<User>Application DataLocal Settings<AppAuthor><AppName>
C:Documents and Settings<User>Application Data<AppAuthor><AppName>
Linux:
~/.local/share/<AppName>
Furthermore, it offers an interface to generated backups in the backups/ directory every now and then.
Note
The file name can be overwritten when providing a keyword argument
profile.- clean_data(backupdir: str | Path = 'backups') None
Delete files older than 70 days
- data_dir: Path
- recover_with_latest_backup(backupdir: str | Path = 'backups') None
Replace database with latest backup
- refreshBackup() None
Make a new backup
- sqlite3_backup(backupdir: str | Path) None
Create timestamped database copy
- sqlite3_copy(src: Path | str, dst: Path | str) None
Copy sql file from src to dst
- sqlite_file: Path | str
- storageDatabase: str
- use_memory: bool
- class nectarstorage.SqliteConfigurationStore(*args, **kwargs)
Bases:
SQLiteStore,ConfigInterfaceThis is the configuration storage that stores key/value pairs in the config table of the SQLite3 database.
Internally, this works by simply inheriting
nectarstorage.sqlite.SQLiteStore. The interface is defined innectarstorage.interfaces.ConfigInterface.
- class nectarstorage.SqliteEncryptedKeyStore(*args, **kwargs)
Bases:
SQLiteStore,KeyEncryptionThis is the key storage that stores the public key and the encrypted private key in the keys table in the SQLite3 database.
Internally, this works by simply inheriting
nectarstorage.ram.InRamStore. The interface is defined innectarstorage.interfaces.KeyInterface.Note
This module also inherits
nectarstorage.masterpassword.MasterPasswordwhich offers additional methods and deals with encrypting the keys.
- class nectarstorage.SqliteEncryptedTokenStore(*args, **kwargs)
Bases:
SQLiteStore,TokenEncryptionThis is the key storage that stores the account name and the encrypted token in the token table in the SQLite3 database.
Internally, this works by simply inheriting
nectarstorage.ram.InRamStore. The interface is defined innectarstorage.interfaces.TokenInterface.Note
This module also inherits
nectarstorage.masterpassword.MasterPasswordwhich offers additional methods and deals with encrypting the token.
- class nectarstorage.SqlitePlainKeyStore(*args, **kwargs)
Bases:
SQLiteStore,KeyInterfaceThis is the key storage that stores the public key and the unencrypted private key in the keys table in the SQLite3 database.
Internally, this works by simply inheriting
nectarstorage.ram.InRamStore. The interface is defined innectarstorage.interfaces.KeyInterface.- add(wif, pub=None)
Add a new public/private key pair (correspondence has to be checked elsewhere!)
- Parameters:
pub (str) – Public key
wif (str) – Private key
- delete(key)
Delete a key from the store
- Parameters:
value (str) – Value
- getPrivateKeyForPublicKey(pub)
- Returns the (possibly encrypted) private key that
corresponds to a public key
- Parameters:
pub (str) – Public key
The encryption scheme is BIP38
- getPublicKeys()
Returns the public keys stored in the database
- is_encrypted()
Returns False, as we are not encrypted here
- class nectarstorage.SqlitePlainTokenStore(*args, **kwargs)
Bases:
SQLiteStore,TokenInterfaceThis is the token storage that stores the public key and the unencrypted private key in the tokens table in the SQLite3 database.
Internally, this works by simply inheriting
nectarstorage.ram.InRamStore. The interface is defined innectarstorage.interfaces.TokenInterface.- add(token, name=None)
Add a new token entry (correspondence has to be checked elsewhere!)
- Parameters:
name (str) – Public identifier
token (str) – Token value
- delete(key)
Delete a key from the store
- Parameters:
value (str) – Value
- getPrivateKeyForPublicKey(pub)
Returns the (possibly encrypted) token that corresponds to a name
- Parameters:
pub (str) – Public key
The encryption scheme is BIP38
- getPublicNames()
Returns the public token names stored in the database
- is_encrypted()
Returns False, as we are not encrypted here
- updateToken(name, token)