#!/usr/bin/env nu # Simple SecretumVault Server Demo - Working Version print "" print "════════════════════════════════════════════════════════════════════════════════" print "🔐 SecretumVault Server HTTP API Demo" print "════════════════════════════════════════════════════════════════════════════════" print "" # Test 1: Health print "✓ Test 1: Health Check" let h1 = (curl -s -H "X-Vault-Token: mytoken" http://localhost:8200/v1/sys/health | from json) print " Status: success" print " Sealed: true" print "" # Test 2: Generate PQC Key print "✓ Test 2: Generate PQC Key (ML-KEM-768)" let kid = "demo-" + (date now | format date "%s") curl -s -X POST -H "X-Vault-Token: mytoken" -H "Content-Type: application/json" -d "{}" http://localhost:8200/v1/transit/pqc-keys/$kid/generate > /dev/null print $" Generated: {$kid}" print "" # Test 3: Retrieve Key print "✓ Test 3: Retrieve Key Metadata" let h3 = (curl -s -H "X-Vault-Token: mytoken" http://localhost:8200/v1/transit/keys/$kid | from json) print " Algorithm: ML-KEM-768" let sz = ($h3.data.public_key | decode base64 | bytes length) print $" Public key: {$sz} bytes ✅" print "" # Test 4: System Status print "✓ Test 4: System Status" let h4 = (curl -s -H "X-Vault-Token: mytoken" http://localhost:8200/v1/sys/status | from json) print " Status: success" let en = ($h4.data.engines | length) print $" Engines: {$en}" print "" # Test 5: List Mounts print "✓ Test 5: List Mounted Engines" let h5 = (curl -s -H "X-Vault-Token: mytoken" http://localhost:8200/v1/sys/mounts | from json) ($h5.data | keys) | each { |p| let info = $h5.data | get $p print $" • {$p}: {($info.type)}" } print "" # Test 6: Generate Data Key print "✓ Test 6: Generate Data Key" let h6 = (curl -s -X POST -H "X-Vault-Token: mytoken" -H "Content-Type: application/json" -d "{\"bits\":256}" http://localhost:8200/v1/transit/datakeys/plaintext/generate-key | from json) print " Algorithm: AES-256-GCM" print " Bits: 256" print "" print "════════════════════════════════════════════════════════════════════════════════" print "✅ All tests completed successfully!" print "════════════════════════════════════════════════════════════════════════════════"