Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dimmadont/py-crypt-sindresorhus-conf
Python library for encrypting and decrypting `sindresorhus/conf` files.
https://github.com/dimmadont/py-crypt-sindresorhus-conf
conf config electron-store encryption json node-module npm-package sindresorhus storage
Last synced: about 1 month ago
JSON representation
Python library for encrypting and decrypting `sindresorhus/conf` files.
- Host: GitHub
- URL: https://github.com/dimmadont/py-crypt-sindresorhus-conf
- Owner: DimmaDont
- License: mit
- Created: 2025-01-10T02:54:19.000Z (about 1 month ago)
- Default Branch: master
- Last Pushed: 2025-01-10T04:05:55.000Z (about 1 month ago)
- Last Synced: 2025-01-10T05:24:17.984Z (about 1 month ago)
- Topics: conf, config, electron-store, encryption, json, node-module, npm-package, sindresorhus, storage
- Language: Python
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# py-crypt-sindresorhus-conf
This Python library encrypts/decrypts [`sindresorhus/conf`](https://github.com/sindresorhus/conf) and [`sindresorhus/electron-store`](https://github.com/sindresorhus/electron-store) files.
## Installation
```bash
pip install git+https://github.com/DimmaDont/py-crypt-sindresorhus-conf
```## Usage example
```python
import json
import osfrom crypt_sindresorhus_conf import CryptSindresorhusConf
key = b"hello there"
iv = os.urandom(16)
conf_crypt = CryptSindresorhusConf(key, iv)
encrypted = conf_crypt.encrypt(json.dumps({"foo": "bar"}))
``````python
import jsonfrom crypt_sindresorhus_conf import CryptSindresorhusConf
with open("file.json", "rb") as f:
encrypted = f.read()key = b"hello there"
iv = encrypted[:16]
conf_crypt = CryptSindresorhusConf(key, iv)
plaintext = conf_crypt.decrypt(encrypted)
data = json.loads(plaintext)
```