README.md raw

Blossom Test Tool

A simple command-line tool to test the Blossom blob storage service by performing upload, fetch, and delete operations.

Building

# From the repository root
CGO_ENABLED=0 go build -o cmd/blossomtest/blossomtest ./cmd/blossomtest

Usage

# Basic usage with auto-generated key
./cmd/blossomtest/blossomtest

# Specify relay URL
./cmd/blossomtest/blossomtest -url http://localhost:3334

# Use a specific Nostr key (nsec format)
./cmd/blossomtest/blossomtest -nsec nsec1...

# Test with larger blob
./cmd/blossomtest/blossomtest -size 10240

# Verbose output to see HTTP requests and auth events
./cmd/blossomtest/blossomtest -v

# Test anonymous uploads (for open relays)
./cmd/blossomtest/blossomtest -no-auth

Options

What It Tests

The tool performs the following operations in sequence:

  1. Upload - Uploads random test data to the Blossom server

- Creates a Blossom authorization event (kind 24242) - Sends a PUT request to /blossom/upload - Verifies the returned descriptor

  1. Fetch - Retrieves the uploaded blob

- Sends a GET request to /blossom/<sha256> - Verifies the data matches what was uploaded

  1. Delete - Removes the blob from the server

- Creates another authorization event for deletion - Sends a DELETE request to /blossom/<sha256>

  1. Verify - Confirms deletion was successful

- Attempts to fetch the blob again - Expects a 404 Not Found response

Example Output

🌸 Blossom Test Tool
===================

â„šī¸  No key provided, generated new keypair
Using identity: npub1...
Relay URL: http://localhost:3334

đŸ“Ļ Generated 1024 bytes of random data
   SHA256: a1b2c3d4...

📤 Step 1: Uploading blob...
✅ Upload successful!
   URL: http://localhost:3334/blossom/a1b2c3d4...
   SHA256: a1b2c3d4...
   Size: 1024 bytes

đŸ“Ĩ Step 2: Fetching blob...
✅ Fetch successful! Retrieved 1024 bytes
✅ Data verification passed - hashes match!

đŸ—‘ī¸  Step 3: Deleting blob...
✅ Delete successful!

🔍 Step 4: Verifying deletion...
✅ Blob successfully deleted - returns 404 as expected

🎉 All tests passed! Blossom service is working correctly.

Requirements

Troubleshooting

"connection refused"

"unauthorized" or "403 Forbidden"

"blossom server not initialized"