Restructure compliance tools

This commit is contained in:
2026-03-27 15:22:07 +03:00
Unverified
parent f73c92c77c
commit 30ab4d9190
16 changed files with 14 additions and 11 deletions
+4 -1
View File
@@ -589,4 +589,7 @@ tmp
compliance_keypair.txt compliance_keypair.txt
backend/files backend/files
*.db-wal *.db-wal
*.db-shm *.db-shm
!scripts/offline_python_linux_amd64/venv_linux_amd64/venv/
!scripts/offline_python_linux_amd64/venv_linux_amd64/venv/lib
@@ -501,7 +501,7 @@ async def extract_message_for_compliance(
"data": compliance_data, "data": compliance_data,
"instructions": [ "instructions": [
"Transfer this data to an air-gapped machine", "Transfer this data to an air-gapped machine",
"Use compliance_decryption.py decrypt --input-file <json_file>", "Use scripts/compliance/decryption/main.py decrypt --input-file <json_file>",
"Keep the compliance private key offline at all times" "Keep the compliance private key offline at all times"
] ]
} }
+4 -4
View File
@@ -29,7 +29,7 @@ The application uses client-server encryption for direct messages (DMs). While r
### 3. Files Required ### 3. Files Required
- `compliance_keypair.txt` - Contains compliance X25519 keypair - `compliance_keypair.txt` - Contains compliance X25519 keypair
- `compliance_decryption.py` - Decryption script - `scripts/compliance/decryption/main.py` — decryption tool entrypoint
- Message data extracted from the server - Message data extracted from the server
## Step-by-Step Instructions ## Step-by-Step Instructions
@@ -70,11 +70,11 @@ The application uses client-server encryption for direct messages (DMs). While r
1. Ensure you have the required files: 1. Ensure you have the required files:
- `compliance_keypair.txt` (compliance private key) - `compliance_keypair.txt` (compliance private key)
- `compliance_decryption.py` (decryption script) - `scripts/compliance/decryption/main.py` (decryption tool)
- `compliance_MESSAGE_ID.json` (extracted message data) - `compliance_MESSAGE_ID.json` (extracted message data)
2. Run the decryption: 2. Run the decryption:
```bash ```bash
python compliance_decryption.py decrypt --input-file compliance_MESSAGE_ID.json python scripts/compliance/decryption/main.py decrypt --input-file compliance_MESSAGE_ID.json
``` ```
3. The script will output the decrypted message: 3. The script will output the decrypted message:
``` ```
@@ -177,7 +177,7 @@ Response: JSON with encrypted message data
### Decryption Script ### Decryption Script
```bash ```bash
python compliance_decryption.py decrypt --input-file <json_file> python scripts/compliance/decryption/main.py decrypt --input-file <json_file>
``` ```
**Requirements:** **Requirements:**
@@ -3,7 +3,7 @@
FromChat compliance decryption tool entrypoint. FromChat compliance decryption tool entrypoint.
Run: Run:
python scripts/compliance-decryption/main.py <command> ... python scripts/compliance/decryption/main.py <command> ...
""" """
from __future__ import annotations from __future__ import annotations
@@ -8,7 +8,7 @@ def assets_source_dir() -> Path:
Directory that stores static templates (css/js) for report generation. Directory that stores static templates (css/js) for report generation.
Layout: Layout:
scripts/compliance-decryption/ scripts/compliance/decryption/
main.py main.py
assets/ assets/
report.css report.css
@@ -7,7 +7,7 @@ The private key should be stored offline on an air-gapped machine.
Only the public key is provided to the messaging service via COMPLIANCE_PUBLIC_KEY env var. Only the public key is provided to the messaging service via COMPLIANCE_PUBLIC_KEY env var.
Usage: Usage:
python3 scripts/generate_compliance_keypair.py python3 scripts/compliance/keypair.py
Output: Output:
- Prints the keypair to console - Prints the keypair to console
@@ -129,7 +129,7 @@ CONFIGURATION:
# Handle file saving # Handle file saving
if args.save: if args.save:
script_dir = Path(__file__).parent script_dir = Path(__file__).parent
project_root = script_dir.parent project_root = script_dir.parent.parent
output_file = project_root / "compliance_keypair.txt" output_file = project_root / "compliance_keypair.txt"
full_output = f"""COMPLIANCE SYSTEM X25519 KEYPAIR full_output = f"""COMPLIANCE SYSTEM X25519 KEYPAIR
Binary file not shown.
+1 -1
View File
@@ -169,7 +169,7 @@ _do_backup_copy() {
run_gen_compliance() { run_gen_compliance() {
local tmp local tmp
tmp="$(mktemp "${TMPDIR:-/tmp}/fromchat-compliance.XXXXXX")" tmp="$(mktemp "${TMPDIR:-/tmp}/fromchat-compliance.XXXXXX")"
"$VENV_PY" scripts/generate_compliance_keypair.py --emit-key-lines </dev/null >"$tmp" "$VENV_PY" scripts/compliance/keypair.py --emit-key-lines </dev/null >"$tmp"
{ {
IFS= read -r _COMPLIANCE_PRIVATE_B64 IFS= read -r _COMPLIANCE_PRIVATE_B64
IFS= read -r _COMPLIANCE_PUBLIC_B64 IFS= read -r _COMPLIANCE_PUBLIC_B64