stemedb/demo/keys/keygen.go
jordan 157dbbb9eb feat: Complete Aphoria Phase 8-9 + UAT suite (90/90 tests passing)
## Phase 8: Enterprise Extractor Improvements 
- 14 security extractors (TLS, JWT, SQL injection, XSS, etc.)
- 10 framework-specific extractors (Spring, Django, Rails, etc.)
- Config file security detection (YAML, TOML)

## Phase 9: Autonomous Extractor Generation 
- Shadow mode executor with TP/FP tracking
- Graduation pipeline with confidence thresholds
- Auto-rollback on regression detection
- Cross-project pattern syncing

## UAT Suite Complete (14 scripts, 90 tests)
- test-core-detection.sh (6 tests)
- test-declarative-extractors.sh (5 tests)
- test-domain-frameworks.sh (5 tests)
- test-domain-unreal.sh (3 tests)
- test-llm-extraction.sh (6 tests)
- test-eval-harness.sh (5 tests)
- test-cross-language.sh (3 tests)
- test-precommit-performance.sh (4 tests)
- test-output-formats.sh (8 tests)
- test-drift-detection.sh (6 tests)
- test-exit-codes.sh (12 tests)
+ 3 more scripts

## Other Changes
- Updated roadmap to mark Phase 8-9 complete
- Added .gitignore entries for build artifacts
- Updated pre-commit: 800 line limit, exclude tests/data/cmd

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 22:50:55 -07:00

115 lines
2.9 KiB
Go

//go:build ignore
// keygen generates deterministic Ed25519 keypairs for demo agents.
//
// Run with: go run keygen.go
//
// This creates agents.json with reproducible keypairs based on agent names.
// The seed for each keypair is SHA-256(agent_name) - deterministic but unique.
package main
import (
"crypto/ed25519"
"crypto/sha256"
"encoding/hex"
"encoding/json"
"fmt"
"os"
)
// DemoAgent represents a demo agent configuration.
type DemoAgent struct {
Seed string `json:"seed"`
PublicKey string `json:"public_key"`
Tier int `json:"tier"`
Description string `json:"description"`
Sources string `json:"sources"`
}
var agents = []struct {
Name string
Tier int
Description string
Sources string
}{
{
Name: "fda:drug-label-ingestor",
Tier: 0,
Description: "Ingests FDA drug label data from DailyMed and FDA Orange Book",
Sources: "DailyMed, FDA Orange Book",
},
{
Name: "pubmed:abstract-indexer",
Tier: 1,
Description: "Indexes clinical trial abstracts from PubMed/MEDLINE",
Sources: "PubMed, MEDLINE",
},
{
Name: "clinicaltrials:study-importer",
Tier: 1,
Description: "Imports trial protocols and results from ClinicalTrials.gov",
Sources: "ClinicalTrials.gov",
},
{
Name: "internal:clinical-ops-reviewer",
Tier: 3,
Description: "Internal clinical expert providing manual review and annotations",
Sources: "Internal review, Manual annotations",
},
{
Name: "reddit:health-discussion-scraper",
Tier: 5,
Description: "Scrapes patient experience reports from health communities",
Sources: "Reddit r/loseit, r/Ozempic, health forums",
},
}
func main() {
result := make(map[string]DemoAgent)
fmt.Println("Generating demo agent keypairs...")
fmt.Println()
for _, agent := range agents {
// Generate deterministic seed from agent name
hash := sha256.Sum256([]byte(agent.Name))
seed := hash[:]
// Create Ed25519 keypair from seed
privateKey := ed25519.NewKeyFromSeed(seed)
publicKey := privateKey.Public().(ed25519.PublicKey)
seedHex := hex.EncodeToString(seed)
pubKeyHex := hex.EncodeToString(publicKey)
result[agent.Name] = DemoAgent{
Seed: seedHex,
PublicKey: pubKeyHex,
Tier: agent.Tier,
Description: agent.Description,
Sources: agent.Sources,
}
fmt.Printf("Agent: %s\n", agent.Name)
fmt.Printf(" Tier: T%d\n", agent.Tier)
fmt.Printf(" Seed: %s\n", seedHex)
fmt.Printf(" Public Key: %s\n", pubKeyHex)
fmt.Println()
}
// Write to agents.json
data, err := json.MarshalIndent(result, "", " ")
if err != nil {
fmt.Fprintf(os.Stderr, "Error marshaling JSON: %v\n", err)
os.Exit(1)
}
err = os.WriteFile("agents.json", data, 0644)
if err != nil {
fmt.Fprintf(os.Stderr, "Error writing agents.json: %v\n", err)
os.Exit(1)
}
fmt.Println("Wrote agents.json")
}