Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ cargo test --locked

### Python

`api/eg_crypto` matches the Rust wire format. Tests run it directly. The API container image does not copy this package.
`api/eg_crypto` matches the Rust wire format. Tests run it directly. `pip install` of the `api` directory installs that package on its own (project name `eg-crypto`). FastAPI and uvicorn stay optional extras and in `requirements.txt`, which is what the API image installs. The image copies `eg_crypto` into the container.

From the `api` directory:

Expand All @@ -161,6 +161,7 @@ assert decrypt(kr, ctx, blob) == b"ada@example.com"

```bash
cd api
python -m pip install .
python -m pip install -r requirements-dev.txt
pytest
```
Expand Down
7 changes: 4 additions & 3 deletions api/eg_crypto/pg.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
"""App-side Postgres column encryption (backlog #11).

Driver-agnostic: produce the DDL for a table, then call `seal_row` before INSERT/UPDATE and
`open_row` after SELECT. Each encrypted column becomes `<col>_ct bytea` (a v2 envelope bound
to tenant/table/row id/column) plus an optional `<col>_bi bytea` blind index for equality
lookups. Postgres only ever sees ciphertext; keys stay in the app (zero-knowledge).
`open_row` after SELECT. Each encrypted column becomes `<col>_ct bytea` (a version-3 envelope
bound to tenant/table/row id/column; version 2 still opens) plus an optional `<col>_bi bytea`
blind index for equality lookups. Postgres only ever sees ciphertext; keys stay in the app
(zero-knowledge).
"""

from __future__ import annotations
Expand Down
29 changes: 27 additions & 2 deletions api/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
[build-system]
requires = ["setuptools>=69"]
build-backend = "setuptools.build_meta"

[project]
name = "eg-api"
version = "0.0.0"
name = "eg-crypto"
version = "0.2.0"
description = "Encryptoglyph envelope cryptography. Wire-compatible with the Rust core."
license = "Apache-2.0"
requires-python = ">=3.12"
dependencies = [
"cryptography==50.0.2",
"PyNaCl==1.6.2",
]

[project.optional-dependencies]
api = [
"fastapi==0.143.0",
"uvicorn==0.54.0",
]
dev = [
"pytest==9.1.1",
"httpx==0.28.1",
"fastapi==0.143.0",
"uvicorn==0.54.0",
]

[tool.setuptools.packages.find]
include = ["eg_crypto*"]

[tool.pytest.ini_options]
pythonpath = ["."]
Expand Down
Loading