Skip to content

Commit

Permalink
minor: change GenerateBase64EdDSA: no padding
Browse files Browse the repository at this point in the history
  • Loading branch information
kataras committed Dec 1, 2023
1 parent 8e62bbe commit 0fc2a08
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions eddsa.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,15 +224,19 @@ func GenerateEdDSA() (ed25519.PublicKey, ed25519.PrivateKey, error) {

// GenerateBase64EdDSA generates random public and private keys for ed25519.
// The keys are returned as base64 encoded strings.
//
// Usage:
//
// publicKey, privateKey, err := GenerateBase64EdDSA()
func GenerateBase64EdDSA() (string, string, error) {
_, priv, err := ed25519.GenerateKey(rand.Reader)
if err != nil {
return "", "", err
}
pub := ed25519.PrivateKey(priv).Public().(ed25519.PublicKey)

publicKey := base64.StdEncoding.EncodeToString(pub)
privateKey := base64.StdEncoding.EncodeToString(priv)
publicKey := base64.RawStdEncoding.EncodeToString(pub)
privateKey := base64.RawStdEncoding.EncodeToString(priv)

return publicKey, privateKey, nil
}

0 comments on commit 0fc2a08

Please sign in to comment.