Enchantrix/examples/pgp_generate_keys/main.go
Claude c8531fa66b
Some checks failed
Go / build (push) Failing after 27s
Publish Docs / build (push) Failing after 1m0s
chore: migrate module path from github.com to forge.lthn.ai
Move module declaration and all internal imports from
github.com/Snider/Enchantrix to forge.lthn.ai/Snider/Enchantrix.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:34:26 +00:00

30 lines
848 B
Go

// Example: PGP key pair generation
//
// This example demonstrates generating an OpenPGP key pair with
// name, email, and comment metadata. The output is ASCII-armored
// for easy storage and distribution.
//
// Run with: go run examples/pgp_generate_keys/main.go
package main
import (
"fmt"
"log"
"forge.lthn.ai/Snider/Enchantrix/pkg/crypt"
)
func main() {
fmt.Println("--- PGP Key Generation Demo ---")
cryptService := crypt.NewService()
// 1. Generate PGP key pair
fmt.Println("Generating PGP key pair...")
publicKey, privateKey, err := cryptService.GeneratePGPKeyPair("test", "test@example.com", "test key")
if err != nil {
log.Fatalf("Failed to generate PGP key pair: %v", err)
}
fmt.Println("Key pair generated successfully.")
fmt.Printf("\nPublic Key:\n%s\n", publicKey)
fmt.Printf("\nPrivate Key:\n%s\n", privateKey)
}