Now version 2.0.1, I guess.
This commit is contained in:
@@ -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
|
||||
|
||||
#### cURL Example
|
||||
|
||||
REF_B64=$(base64 -w0 reference.jpg)
|
||||
```bash
|
||||
# Prepare base64-encoded images
|
||||
REF_B64=$(base64 -w0 reference.jpg)
|
||||
CARRIER_B64=$(base64 -w0 carrier.png)
|
||||
|
||||
@@ -282,7 +283,8 @@ Content-Type: application/json
|
||||
\"reference_photo_base64\": \"$REF_B64\",
|
||||
\"carrier_image_base64\": \"$CARRIER_B64\",
|
||||
\"day_phrase\": \"apple forest thunder\",
|
||||
}" | jq -r '.stego_image_base64' | base64 -d > stego.png
|
||||
\"pin\": \"123456\"
|
||||
}" | jq -r '.stego_image_base64' | base64 -d > stego.png
|
||||
```
|
||||
|
||||
---
|
||||
@@ -360,6 +362,9 @@ Content-Type: image/png
|
||||
--output stego.png
|
||||
```
|
||||
|
||||
**With RSA key:**
|
||||
```bash
|
||||
curl -X POST http://localhost:8000/encode/multipart \
|
||||
-F "message=Secret message" \
|
||||
-F "day_phrase=apple forest thunder" \
|
||||
-F "rsa_key=@mykey.pem" \
|
||||
@@ -624,7 +629,8 @@ curl -X POST http://localhost:8000/image/info \
|
||||
"message": "string"
|
||||
}
|
||||
```
|
||||
### ImageInfoResponse
|
||||
|
||||
### ImageInfoResponse
|
||||
|
||||
```json
|
||||
{
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user