Update protocol spec

This commit is contained in:
Savely Krendelhoff 2025-08-22 17:10:23 +07:00
parent 47d1280556
commit 7d521cfccf
No known key found for this signature in database
GPG key ID: F70DFD34F40238DE

View file

@ -97,22 +97,20 @@ All protocol messages use a binary format with the following structure:
- **Format**: - **Format**:
```json ```json
{ {
"id": "challenge_unique_id",
"timestamp": 1640995200, "timestamp": 1640995200,
"difficulty": 4, "difficulty": 4,
"resource": "192.168.1.100:8080", "resource": "quotes",
"random": "a1b2c3d4e5f6", "random": "a1b2c3d4e5f6",
"hmac": "base64url_encoded_signature" "hmac": "base64url_encoded_signature"
} }
``` ```
**Field Descriptions**: **Field Descriptions**:
- **id**: Unique identifier for this challenge
- **timestamp**: Unix timestamp when challenge was created - **timestamp**: Unix timestamp when challenge was created
- **difficulty**: Number of leading zero bits required in solution hash - **difficulty**: Number of leading zero bits required in solution hash
- **resource**: Server resource identifier (typically IP:port) - **resource**: Server resource identifier (e.g., "quotes")
- **random**: Random hex string for challenge uniqueness - **random**: Random hex string for challenge uniqueness
- **hmac**: HMAC-SHA256 signature of canonical challenge fields - **hmac**: HMAC-SHA256 signature of canonical challenge fields (also serves as unique identifier)
**Security Notes**: **Security Notes**:
- Server is **stateless**: no need to store challenges locally - Server is **stateless**: no need to store challenges locally
@ -126,10 +124,9 @@ All protocol messages use a binary format with the following structure:
```json ```json
{ {
"challenge": { "challenge": {
"id": "challenge_unique_id",
"timestamp": 1640995200, "timestamp": 1640995200,
"difficulty": 4, "difficulty": 4,
"resource": "192.168.1.100:8080", "resource": "quotes",
"random": "a1b2c3d4e5f6", "random": "a1b2c3d4e5f6",
"hmac": "base64url_encoded_signature" "hmac": "base64url_encoded_signature"
}, },