File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ package main
2+
3+ /*
4+ To run this code and generate a new Ed25519 key pair, use the following command:
5+ go run install/generate-ed25519-keys.go
6+ */
7+
8+ import (
9+ "crypto/ed25519"
10+ "encoding/base64"
11+ "fmt"
12+ "log"
13+ )
14+
15+ func main () {
16+ // Generate a new Ed25519 key pair using rand.Reader as default
17+ publicKey , privateKey , err := ed25519 .GenerateKey (nil )
18+ if err != nil {
19+ log .Fatal ("Failed to generate key pair:" , err )
20+ }
21+
22+ // The private key contains both seed and public key (64 bytes total)
23+ // We need to extract just the seed (first 32 bytes)
24+ seed := privateKey [:ed25519 .SeedSize ]
25+
26+ fmt .Println ("=== Ed25519 Key Pair ===" )
27+ fmt .Printf ("signingPrivateKey: %s\n " , base64 .StdEncoding .EncodeToString (seed ))
28+ fmt .Printf ("signingPublicKey: %s\n " , base64 .StdEncoding .EncodeToString (publicKey ))
29+
30+ }
You can’t perform that action at this time.
0 commit comments