bud 08 implemented
This commit is contained in:
67
README.md
67
README.md
@@ -4,9 +4,9 @@ A high-performance [Blossom](https://github.com/hzrd149/blossom) server implemen
|
||||
|
||||
## Overview
|
||||
|
||||
ginxsom is a Blossom protocol server implemented as a FastCGI application that integrates seamlessly with nginx. nginx handles static file serving directly while ginxsom processes authenticated operations (uploads, deletes, management) via FastCGI. This architecture provides optimal performance with nginx's excellent static file serving and C's efficiency for cryptographic operations.
|
||||
Ginxsom is a Blossom protocol server implemented as a FastCGI application that integrates seamlessly with nginx. Nginx handles static file serving directly while ginxsom processes authenticated operations (uploads, deletes, management) via FastCGI. This architecture provides optimal performance with nginx's excellent static file serving and C's efficiency for cryptographic operations.
|
||||
|
||||
### Why ginxsom?
|
||||
### Why Ginxsom?
|
||||
|
||||
- **Performance**: C application with nginx static serving = maximum throughput
|
||||
- **Simplicity**: Clean separation between static serving (nginx) and dynamic operations (C app)
|
||||
@@ -40,9 +40,14 @@ ginxsom is a Blossom protocol server implemented as a FastCGI application that i
|
||||
|
||||
ginxsom implements the following Blossom Upgrade Documents (BUDs):
|
||||
|
||||
- **BUD-01**: Server requirements and blob retrieval ✅
|
||||
- **BUD-02**: Blob upload and management ✅ *(newly completed - includes DELETE endpoint)*
|
||||
- **BUD-06**: Upload requirements ⏳ *(planned - not yet implemented)*
|
||||
- [x] **BUD-01**: Server requirements and blob retrieval
|
||||
- [x] **BUD-02**: Blob upload and management
|
||||
- [x] **BUD-04**: Blob Mirroring
|
||||
- [ ] **BUD-05**: Media Optimization *(Partial)*
|
||||
- [x] **BUD-06**: Upload Requirements
|
||||
- [ ] **BUD-07**: Payment Integration *(Not implemented)*
|
||||
- [x] **BUD-08**: NIP-94 File Metadata Tags
|
||||
- [ ] **BUD-09**: Content Reporting *(Partial)*
|
||||
|
||||
### Supported Endpoints
|
||||
|
||||
@@ -55,39 +60,6 @@ ginxsom implements the following Blossom Upgrade Documents (BUDs):
|
||||
| `/list/<pubkey>` | GET | List user's blobs | nginx → FastCGI ginxsom | ✅ **Implemented** |
|
||||
| `/<sha256>` | DELETE | Delete blob | nginx → FastCGI ginxsom | ✅ **Recently Added** |
|
||||
|
||||
## Recent Updates
|
||||
|
||||
### BUD-02 Completion: DELETE Endpoint Implementation
|
||||
|
||||
ginxsom now fully implements **BUD-02: Blob upload and management** with the recent addition of the DELETE endpoint. This completes the core blob management functionality:
|
||||
|
||||
**New DELETE Endpoint Features:**
|
||||
- **Authenticated Deletion**: Requires valid nostr kind 24242 event with `t` tag set to `"delete"`
|
||||
- **Hash Validation**: Must include `x` tag matching the blob's SHA-256 hash
|
||||
- **Ownership Verification**: Only the original uploader can delete their blobs
|
||||
- **Complete Cleanup**: Removes both file from disk and metadata from database
|
||||
- **Error Handling**: Proper HTTP status codes for various failure scenarios
|
||||
|
||||
**Technical Implementation:**
|
||||
```bash
|
||||
# Delete a blob (requires nostr authorization)
|
||||
curl -X DELETE http://localhost:9001/b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553 \
|
||||
-H "Authorization: Nostr eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..."
|
||||
|
||||
# Successful deletion returns 200 OK
|
||||
# Failed authorization returns 401 Unauthorized
|
||||
# Blob not found returns 404 Not Found
|
||||
# Wrong ownership returns 403 Forbidden
|
||||
```
|
||||
|
||||
**Security Features:**
|
||||
- Event signature validation using nostr cryptographic verification
|
||||
- Expiration checking to prevent replay attacks
|
||||
- Ownership validation via uploader_pubkey matching
|
||||
- Atomic operations (both filesystem and database cleanup succeed or fail together)
|
||||
|
||||
This implementation makes ginxsom a fully functional Blossom server for core blob operations (upload, retrieve, list, delete) with the remaining BUD-06 (upload requirements) planned for the next development phase.
|
||||
|
||||
## Installation
|
||||
|
||||
### Prerequisites
|
||||
@@ -302,7 +274,7 @@ The nostr event must be kind `24242` with appropriate tags:
|
||||
|
||||
### Blob Descriptors
|
||||
|
||||
Successful uploads return blob descriptors:
|
||||
Successful uploads return blob descriptors with optional NIP-94 metadata:
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -310,10 +282,25 @@ Successful uploads return blob descriptors:
|
||||
"sha256": "b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553",
|
||||
"size": 184292,
|
||||
"type": "application/pdf",
|
||||
"uploaded": 1725105921
|
||||
"uploaded": 1725105921,
|
||||
"nip94": [
|
||||
["url", "https://cdn.example.com/b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553.pdf"],
|
||||
["m", "application/pdf"],
|
||||
["x", "b1674191a88ec5cdd733e4240a81803105dc412d6c6708d53ab94fc248f4f553"],
|
||||
["size", "184292"]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**NIP-94 Tags:**
|
||||
- `url`: Canonical blob URL with proper CDN origin
|
||||
- `m`: MIME type (Content-Type)
|
||||
- `x`: SHA-256 hash (lowercase hex)
|
||||
- `size`: File size in bytes
|
||||
- `dim`: Image dimensions (when available, e.g., "1920x1080")
|
||||
|
||||
The `nip94` field is included by default but can be disabled via server configuration.
|
||||
|
||||
## File Storage
|
||||
|
||||
### Current (Flat) Structure
|
||||
|
||||
Reference in New Issue
Block a user