mirror of
https://github.com/nbd-wtf/go-nostr.git
synced 2025-06-24 15:52:25 +02:00
ensure private key is 64 characters long.
fixes https://github.com/nbd-wtf/go-nostr/issues/111
This commit is contained in:
parent
307df51b9a
commit
0cfaa0da0a
3
keys.go
3
keys.go
@ -3,6 +3,7 @@ package nostr
|
|||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"math/big"
|
"math/big"
|
||||||
"strings"
|
"strings"
|
||||||
@ -25,7 +26,7 @@ func GeneratePrivateKey() string {
|
|||||||
k.Mod(k, n)
|
k.Mod(k, n)
|
||||||
k.Add(k, one)
|
k.Add(k, one)
|
||||||
|
|
||||||
return hex.EncodeToString(k.Bytes())
|
return fmt.Sprintf("%064x", k.Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPublicKey(sk string) (string, error) {
|
func GetPublicKey(sk string) (string, error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user