To use, first declare your storage classes:
import simplstorage as ss
storage = ss.LocalStorage(password,iterations,salt) #for use in only the single python file
#or
globalstorage = ss.GlobalStorage(password,iterations,salt) #for use between different files and directories
Here is a list of commands inside each object:
.store(data,handler)
Stores the data using the handler as an identifier to retrieve later. Overwrites the data if already defined, otherwise just appends your new data
in the document. Returns True afterward. You can also give multiple data handler pairs through either tuples or lists.
.retrieve(handler)
Returns the data associated with the handler input. Returns False if the data has been tampered with and None if no handler was found. If handler
is a list or tuple, it will iterate through and return all data in list form.
.exists(handler)
Returns True if there is data with the specified handler, otherwise returns False. If a list is given, it will return a list of the outputs
.delete(handler)
Deletes all data associated with the handler, also accepting lists for multiple handlers.
.deleteall()
Deletes all data related to the storage object.
.pop(handler)
Returns the value(s) stored at handler, and deletes the data after retrieving.
Explanation of how this works:
It stores all the data in a .dat file stored inside programdata, inside the folder called "Python Package Data". The data is stored in sets of
2 lines, line 1 being the handler and line 2 being the encrypted pickled data.
All the data is stored as Fernet encrypted tokens, and decrypted when retrieving, ensuring that the pickled data hasn't been tampered with, as long
as an attacker doesn't get the key used to encrypt the data.
The .deleteall() function loops through all the handlers and if the Fernet doesn't return an invalid token error, it deletes the entry.
The code used to generate the keys used to encrypt the file is the pbkdf2 HMAC, with sha256, with the full file-path being added into the key,
to make any duplicate keys inside programs not interfere, and to make hacking the data harder, as you have to either recreate the file-path, or
code it yourself.
GlobalStorage is the same thing, except it doesn't contain the file-path, allowing for data to be accessed from any python script as long as you have
the correct key.
NOTE:
This was only tested on Windows, so any issues on a different operating system are expected.
Metadata
Release files for simplstorage 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| simplstorage-0.0.1.tar.gz | 3.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simplstorage-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.3 kB
Release files / simplstorage-0.0.1.tar.gz
| Download URL | simplstorage-0.0.1.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb217503d2e24b61d0b92222bd6a58339913678ccd4afc278b74f6ebcc419585
|
|
BLAKE2b-256 checksum How to use checksums |
dd2c7aa1b46ac5c9a630edf4838d6057b793ed0a0a6db5eb9cdee6960f5112df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|
Release files / simplstorage-0.0.1-py3-none-any.whl
| Download URL | simplstorage-0.0.1-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0f5acb367d5ac2bb88ba85b536c658d08f4652790d73a6ec579bd61b0210bb2c
|
|
BLAKE2b-256 checksum How to use checksums |
6a1b296c43f7437312118a05840dc4fd51d667d7b8180a0f7824c2f6df2975c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.7
|