Skip to content

Commit

Permalink
ensure private key is 64 characters long.
Browse files Browse the repository at this point in the history
fixes #111
  • Loading branch information
fiatjaf committed Nov 17, 2023
1 parent 307df51 commit 0cfaa0d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package nostr
import (
"crypto/rand"
"encoding/hex"
"fmt"
"io"
"math/big"
"strings"
Expand All @@ -25,7 +26,7 @@ func GeneratePrivateKey() string {
k.Mod(k, n)
k.Add(k, one)

return hex.EncodeToString(k.Bytes())
return fmt.Sprintf("%064x", k.Bytes())
}

func GetPublicKey(sk string) (string, error) {
Expand Down

0 comments on commit 0cfaa0d

Please sign in to comment.