update README.md; gen-keypair utility

This commit is contained in:
Lou Knauer
2022-01-17 13:35:49 +01:00
parent ef91f862c9
commit a64944f3c3
5 changed files with 44 additions and 7 deletions

22
utils/gen-keypair.go Normal file
View File

@@ -0,0 +1,22 @@
package main
import (
"crypto/ed25519"
"crypto/rand"
"encoding/base64"
"fmt"
"os"
)
func main() {
// rand.Reader uses /dev/urandom on Linux
pub, priv, err := ed25519.GenerateKey(rand.Reader)
if err != nil {
fmt.Fprintf(os.Stderr, "error: %s\n", err.Error())
os.Exit(1)
}
fmt.Fprintf(os.Stdout, "JWT_PUBLIC_KEY=%#v\nJWT_PRIVATE_KEY=%#v\n",
base64.StdEncoding.EncodeToString(pub),
base64.StdEncoding.EncodeToString(priv))
}