Adds a comprehensive set of examples to demonstrate the library's features. - Breaks out the existing `examples/main.go` into separate, well-named files. - Adds new examples for hashing, checksums, RSA, and PGP. - The PGP examples cover key generation, encryption/decryption, signing/verification, and symmetric encryption. - Removes the old `examples/main.go` file and formats the new example files.
23 lines
579 B
Go
23 lines
579 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
|
|
"github.com/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)
|
|
}
|