Skip to main content

A collection of tool for EC.

Project description

ec_tools

A lightweight Python toolbox for data modeling, SQLite DAOs, encrypted key-value storage, and small productivity utilities.

Highlights

  • Data objects with JSON serialization and type-aware formatting.
  • SQLite client + DAO layer with query generation.
  • KV DAO with optional AES-backed encryption.
  • Encryption helpers for bytes, chunks, and files.
  • Utility helpers for IO, hashing, logging, and timing.

Requirements

  • Python >= 3.12

Install (from source)

pip install -e .

Quick start

Encrypted KV storage with a KeyManager

from ec_tools.database import CipherKvDao, SqliteClient, SqliteKvDao
from ec_tools.tools.cipher import AesCipherGenerator
from ec_tools.tools.key_manager import KeyManager

sqlite_client = SqliteClient(":memory:")
kv_dao = SqliteKvDao(sqlite_client)
cipher_generator = AesCipherGenerator()
cipher_kv_dao = CipherKvDao(kv_dao, cipher_generator)

manager = KeyManager(cipher_kv_dao, "my-password")
manager.refresh_keys(["token", "cookie"])
print(manager.get_key("token"))

Build headers from stored secrets

from ec_tools.tools.headers_manager import HeadersManager

headers = HeadersManager(manager, ["token"], {"User-Agent": "ec-tools"}).get()
print(headers)

Data objects

Define dataclasses that serialize to/from JSON with helpers for enums, lists, sets, and nested objects.

import dataclasses
from ec_tools.data import DataObject

@dataclasses.dataclass
class User(DataObject):
    name: str
    age: int

user = User.from_json({"name": "Ada", "age": "42"})
print(user.to_json())

Encryption helpers

  • AesCipher for encrypting/decrypting bytes.
  • Chunked and file-level encryption utilities in ec_tools.tools.cipher.

Project layout

  • ec_tools/data: data-object helpers and JSON formatting.
  • ec_tools/database: SQLite client, DAO, and KV DAO.
  • ec_tools/tools: key/headers managers, cipher tools, thread pool.
  • ec_tools/utils: IO, hashing, logging, and timing helpers.

Development

pytest

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ec_tools-3.1.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ec_tools-3.1-py3-none-any.whl (2.0 kB view details)

Uploaded Python 3

File details

Details for the file ec_tools-3.1.tar.gz.

File metadata

  • Download URL: ec_tools-3.1.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for ec_tools-3.1.tar.gz
Algorithm Hash digest
SHA256 f2162d319fed738732e4e1938ed38d228c0d21667bf2eabd027a1342dc4781ca
MD5 869cba572479581355df57cb107dd430
BLAKE2b-256 b4a291c4acaa45474144538ecac4381b794ea629b996bb50481453be998df07f

See more details on using hashes here.

File details

Details for the file ec_tools-3.1-py3-none-any.whl.

File metadata

  • Download URL: ec_tools-3.1-py3-none-any.whl
  • Upload date:
  • Size: 2.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for ec_tools-3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 65cadb0fd85e990d829dd00c8bee709a60d5c9ec053ab5c6809aa9b97a05e2d4
MD5 9f0b8293e43f3892fe2104b04f7a9519
BLAKE2b-256 4307210fd8a8e56167aef9ab36ab8dd665f4382be8776854fc4d5c405a7246f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page