Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 882 Bytes

README.md

File metadata and controls

36 lines (27 loc) · 882 Bytes

py-crypt-sindresorhus-conf

This Python library encrypts/decrypts sindresorhus/conf and sindresorhus/electron-store files.

Installation

pip install git+https://github.com/DimmaDont/py-crypt-sindresorhus-conf

Usage example

import json
import os

from 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"}))
import json

from 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)