Fastly Compute service that receives webhooks from divine-name-server and syncs username data to Fastly KV store for fast NIP-05 lookups.
divine-name-server (CF Worker)
│
│ POST /sync (HMAC-signed)
▼
divine-name-sync (Fastly Compute)
│
│ Verify signature
│ Update KV store
▼
divine-names KV Store
│
│ (read by)
▼
divine-web (Fastly Compute)
│
│ Serve NIP-05 requests
▼
/.well-known/nostr.json
| Method | Path | Description |
|---|---|---|
| POST | /sync | Receive webhook from divine-name-server |
| GET | /health | Health check |
| GET | / | Service info |
Headers:
X-Webhook-Signature: HMAC-SHA256 signature (base64)X-Webhook-Timestamp: Unix timestamp (seconds)
Body:
{
"name": "alice",
"action": "upsert",
"pubkey": "abc123...",
"relays": ["wss://relay.example.com"],
"status": "active"
}Actions:
upsert: Create or update username entrydelete: Remove username entry
Webhooks are authenticated using HMAC-SHA256:
- CF Worker signs
JSON.stringify(payload) + timestampwith shared secret - Fastly Compute verifies signature matches
- Timestamps older than 5 minutes are rejected (replay protection)
| Resource | Name | Description |
|---|---|---|
| Secret Store | divine-name-sync-secrets | Holds webhook_secret |
| KV Store | divine-names | Username mappings (shared with divine-web) |
| KV Store | sync-failures | Error log for failed syncs |
# Install dependencies
npm install
# Run locally
npm run dev
# Deploy to Fastly
npm run deploy# Start local server
npm run dev
# Test health endpoint
curl http://localhost:7676/health
# Test sync (will fail signature check with local secret)
curl -X POST http://localhost:7676/sync \
-H "Content-Type: application/json" \
-H "X-Webhook-Signature: test" \
-H "X-Webhook-Timestamp: $(date +%s)" \
-d '{"name":"test","action":"upsert","pubkey":"abc123"}'- Create Fastly Compute service
- Create secret store and add
webhook_secret - Link existing
divine-namesKV store - Create
sync-failuresKV store - Deploy service
- Configure DNS for
name-sync.dvine.video
MIT