diff --git a/frontends/API.md b/frontends/API.md index f65beca..6ef0170 100644 --- a/frontends/API.md +++ b/frontends/API.md @@ -107,7 +107,7 @@ Host: localhost:8000 ```json { - "version": "2.0.0", + "version": "2.0.1", "has_argon2": true, "day_names": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"] } @@ -271,7 +271,8 @@ Content-Type: application/json "stego_image_base64": "iVBORw0KGgo...", "filename": "a1b2c3d4_20251227.png", "capacity_used_percent": 12.4, - "date_used": "2025-12-27" + "date_used": "2025-12-27", + "day_of_week": "Saturday" } ``` @@ -282,7 +283,8 @@ Content-Type: application/json | `stego_image_base64` | string | Base64-encoded stego PNG | | `filename` | string | Suggested filename | | `capacity_used_percent` | float | Percentage of capacity used | -| `date_used` | string | Date embedded in image | +| `date_used` | string | Date embedded in image (YYYY-MM-DD) | +| `day_of_week` | string | Day name for passphrase rotation | #### cURL Example @@ -360,6 +362,9 @@ Content-Type: image/png Returns the PNG image directly with headers: - `Content-Type: image/png` - `Content-Disposition: attachment; filename=.png` +- `X-Stegasoo-Date: 2025-12-27` (date used for encoding) +- `X-Stegasoo-Day: Saturday` (day of week for passphrase rotation) +- `X-Stegasoo-Capacity-Percent: 12.4` (capacity used) #### cURL Examples @@ -624,7 +629,8 @@ curl -X POST http://localhost:8000/image/info \ "stego_image_base64": "string", "filename": "string", "capacity_used_percent": 12.4, - "date_used": "YYYY-MM-DD" + "date_used": "YYYY-MM-DD", + "day_of_week": "Saturday" } ``` diff --git a/frontends/api/main.py b/frontends/api/main.py index a139bba..72d9f81 100644 --- a/frontends/api/main.py +++ b/frontends/api/main.py @@ -24,6 +24,7 @@ import stegasoo from stegasoo import ( encode, decode, generate_credentials, validate_image, calculate_capacity, + get_day_from_date, DAY_NAMES, __version__, StegasooError, DecryptionError, CapacityError, has_argon2, @@ -83,6 +84,7 @@ class EncodeResponse(BaseModel): filename: str capacity_used_percent: float date_used: str + day_of_week: str class DecodeRequest(BaseModel): @@ -193,11 +195,15 @@ async def api_encode(request: EncodeRequest): stego_b64 = base64.b64encode(result.stego_image).decode('utf-8') + # Get day of week from the date used + day_of_week = get_day_from_date(result.date_used) + return EncodeResponse( stego_image_base64=stego_b64, filename=result.filename, capacity_used_percent=result.capacity_percent, - date_used=result.date_used + date_used=result.date_used, + day_of_week=day_of_week ) except CapacityError as e: @@ -253,7 +259,7 @@ async def api_encode_multipart( """ Encode using multipart form data (file uploads). - Returns the stego image directly as PNG. + Returns the stego image directly as PNG with metadata headers. """ try: ref_data = await reference_photo.read() @@ -271,10 +277,18 @@ async def api_encode_multipart( date_str=date_str if date_str else None ) + # Get day of week from the date used + day_of_week = get_day_from_date(result.date_used) + return Response( content=result.stego_image, media_type="image/png", - headers={"Content-Disposition": f"attachment; filename={result.filename}"} + headers={ + "Content-Disposition": f"attachment; filename={result.filename}", + "X-Stegasoo-Date": result.date_used, + "X-Stegasoo-Day": day_of_week, + "X-Stegasoo-Capacity-Percent": f"{result.capacity_percent:.1f}" + } ) except CapacityError as e: diff --git a/pyproject.toml b/pyproject.toml index 4a98148..77f6d70 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "stegasoo" -version = "2.0.0" +version = "2.0.1" description = "Secure steganography with hybrid photo + passphrase + PIN authentication" readme = "README.md" license = "MIT" diff --git a/src/stegasoo/constants.py b/src/stegasoo/constants.py index 0e24333..5570c28 100644 --- a/src/stegasoo/constants.py +++ b/src/stegasoo/constants.py @@ -11,7 +11,7 @@ from pathlib import Path # VERSION # ============================================================================ -__version__ = "2.0.0" +__version__ = "2.0.1" # ============================================================================ # FILE FORMAT diff --git a/tests/test_stegasoo.py b/tests/test_stegasoo.py index f9ea972..7c9217a 100644 --- a/tests/test_stegasoo.py +++ b/tests/test_stegasoo.py @@ -208,7 +208,7 @@ class TestVersion: def test_version_exists(self): assert hasattr(stegasoo, '__version__') - assert stegasoo.__version__ == "2.0.0" + assert stegasoo.__version__ == "2.0.1" def test_day_names(self): assert len(stegasoo.DAY_NAMES) == 7