#!/bin/bash
# Test key generation for ginxsom

echo "=== Testing Key Generation ==="
echo

# Run the binary with --generate-keys flag
echo "Running: ./build/ginxsom-fcgi --generate-keys --db-path db/ginxsom.db"
echo
./build/ginxsom-fcgi --generate-keys --db-path db/ginxsom.db 2>&1

echo
echo "=== Checking if keys were stored ==="
echo

# Check if blossom_seckey table was created
echo "Checking blossom_seckey table:"
sqlite3 db/ginxsom.db "SELECT COUNT(*) as key_count FROM blossom_seckey" 2>&1

echo
echo "Checking blossom_pubkey in config:"
sqlite3 db/ginxsom.db "SELECT value FROM config WHERE key='blossom_pubkey'" 2>&1

echo
echo "=== Test Complete ==="