initial commit

This commit is contained in:
Balakrishnan Balasubramanian 2024-09-18 19:29:33 -04:00
commit 21df5e97a4
2 changed files with 22 additions and 0 deletions

3
go.mod Normal file
View File

@ -0,0 +1,3 @@
module go.balki.me/onion-auth-gen
go 1.23.0

19
main.go Normal file
View File

@ -0,0 +1,19 @@
// Generate key pair for onion service auth
package main
import (
"crypto/ecdh"
"crypto/rand"
"encoding/base32"
"fmt"
)
func main() {
key, err := ecdh.X25519().GenerateKey(rand.Reader)
if err != nil {
panic(err)
}
fmt.Printf("private key : %s\n", base32.StdEncoding.EncodeToString(key.Bytes())[:52])
fmt.Printf("public descriptor : descriptor:x25519:%s\n", base32.StdEncoding.EncodeToString(key.PublicKey().Bytes())[:52])
}