Now version 2.0.1, I guess.
This commit is contained in:
@@ -107,7 +107,7 @@ Host: localhost:8000
|
|||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"version": "2.0.0",
|
"version": "2.0.1",
|
||||||
"has_argon2": true,
|
"has_argon2": true,
|
||||||
"day_names": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
|
"day_names": ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]
|
||||||
}
|
}
|
||||||
@@ -271,7 +271,8 @@ Content-Type: application/json
|
|||||||
|
|
||||||
#### cURL Example
|
#### cURL Example
|
||||||
|
|
||||||
REF_B64=$(base64 -w0 reference.jpg)
|
```bash
|
||||||
|
# Prepare base64-encoded images
|
||||||
REF_B64=$(base64 -w0 reference.jpg)
|
REF_B64=$(base64 -w0 reference.jpg)
|
||||||
CARRIER_B64=$(base64 -w0 carrier.png)
|
CARRIER_B64=$(base64 -w0 carrier.png)
|
||||||
|
|
||||||
@@ -282,7 +283,8 @@ Content-Type: application/json
|
|||||||
\"reference_photo_base64\": \"$REF_B64\",
|
\"reference_photo_base64\": \"$REF_B64\",
|
||||||
\"carrier_image_base64\": \"$CARRIER_B64\",
|
\"carrier_image_base64\": \"$CARRIER_B64\",
|
||||||
\"day_phrase\": \"apple forest thunder\",
|
\"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
|
--output stego.png
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**With RSA key:**
|
||||||
|
```bash
|
||||||
|
curl -X POST http://localhost:8000/encode/multipart \
|
||||||
-F "message=Secret message" \
|
-F "message=Secret message" \
|
||||||
-F "day_phrase=apple forest thunder" \
|
-F "day_phrase=apple forest thunder" \
|
||||||
-F "rsa_key=@mykey.pem" \
|
-F "rsa_key=@mykey.pem" \
|
||||||
@@ -624,7 +629,8 @@ curl -X POST http://localhost:8000/image/info \
|
|||||||
"message": "string"
|
"message": "string"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
### ImageInfoResponse
|
|
||||||
|
### ImageInfoResponse
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ import stegasoo
|
|||||||
from stegasoo import (
|
from stegasoo import (
|
||||||
encode, decode, generate_credentials,
|
encode, decode, generate_credentials,
|
||||||
validate_image, calculate_capacity,
|
validate_image, calculate_capacity,
|
||||||
|
get_day_from_date,
|
||||||
DAY_NAMES, __version__,
|
DAY_NAMES, __version__,
|
||||||
StegasooError, DecryptionError, CapacityError,
|
StegasooError, DecryptionError, CapacityError,
|
||||||
has_argon2,
|
has_argon2,
|
||||||
@@ -83,6 +84,7 @@ class EncodeResponse(BaseModel):
|
|||||||
filename: str
|
filename: str
|
||||||
capacity_used_percent: float
|
capacity_used_percent: float
|
||||||
date_used: str
|
date_used: str
|
||||||
|
day_of_week: str
|
||||||
|
|
||||||
|
|
||||||
class DecodeRequest(BaseModel):
|
class DecodeRequest(BaseModel):
|
||||||
@@ -193,11 +195,15 @@ async def api_encode(request: EncodeRequest):
|
|||||||
|
|
||||||
stego_b64 = base64.b64encode(result.stego_image).decode('utf-8')
|
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(
|
return EncodeResponse(
|
||||||
stego_image_base64=stego_b64,
|
stego_image_base64=stego_b64,
|
||||||
filename=result.filename,
|
filename=result.filename,
|
||||||
capacity_used_percent=result.capacity_percent,
|
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:
|
except CapacityError as e:
|
||||||
@@ -253,7 +259,7 @@ async def api_encode_multipart(
|
|||||||
"""
|
"""
|
||||||
Encode using multipart form data (file uploads).
|
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:
|
try:
|
||||||
ref_data = await reference_photo.read()
|
ref_data = await reference_photo.read()
|
||||||
@@ -271,10 +277,18 @@ async def api_encode_multipart(
|
|||||||
date_str=date_str if date_str else None
|
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(
|
return Response(
|
||||||
content=result.stego_image,
|
content=result.stego_image,
|
||||||
media_type="image/png",
|
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:
|
except CapacityError as e:
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "stegasoo"
|
name = "stegasoo"
|
||||||
version = "2.0.0"
|
version = "2.0.1"
|
||||||
description = "Secure steganography with hybrid photo + passphrase + PIN authentication"
|
description = "Secure steganography with hybrid photo + passphrase + PIN authentication"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from pathlib import Path
|
|||||||
# VERSION
|
# VERSION
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
__version__ = "2.0.0"
|
__version__ = "2.0.1"
|
||||||
|
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
# FILE FORMAT
|
# FILE FORMAT
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ class TestVersion:
|
|||||||
|
|
||||||
def test_version_exists(self):
|
def test_version_exists(self):
|
||||||
assert hasattr(stegasoo, '__version__')
|
assert hasattr(stegasoo, '__version__')
|
||||||
assert stegasoo.__version__ == "2.0.0"
|
assert stegasoo.__version__ == "2.0.1"
|
||||||
|
|
||||||
def test_day_names(self):
|
def test_day_names(self):
|
||||||
assert len(stegasoo.DAY_NAMES) == 7
|
assert len(stegasoo.DAY_NAMES) == 7
|
||||||
|
|||||||
Reference in New Issue
Block a user