// +build ignore

// Script to generate Ed25519 key pair for manifest signing.
// Run with: go run scripts/generate_manifest_keys.go
//
// This will output:
// - Private key (base64): Store as MANIFEST_SIGNING_KEY GitHub secret
// - Public key (base64): Embed in EagleInstaller for verification

package main

import (
	"crypto/ed25519"
	"crypto/rand"
	"encoding/base64"
	"fmt"
	"log"
)

func main() {
	// Generate Ed25519 key pair
	publicKey, privateKey, err := ed25519.GenerateKey(rand.Reader)
	if err != nil {
		log.Fatalf("Failed to generate key pair: %v", err)
	}

	// Encode keys as base64
	privateKeyB64 := base64.StdEncoding.EncodeToString(privateKey)
	publicKeyB64 := base64.StdEncoding.EncodeToString(publicKey)

	fmt.Println("=== Ed25519 Key Pair for Manifest Signing ===")
	fmt.Println()
	fmt.Println("PRIVATE KEY (store as GitHub secret MANIFEST_SIGNING_KEY):")
	fmt.Println(privateKeyB64)
	fmt.Println()
	fmt.Println("PUBLIC KEY (embed in EagleInstaller.cs for verification):")
	fmt.Println(publicKeyB64)
	fmt.Println()
	fmt.Printf("Private key size: %d bytes\n", len(privateKey))
	fmt.Printf("Public key size: %d bytes\n", len(publicKey))
}
