Documentation
¶
Overview ¶
Package keys is a set of helpers for generating and converting public/secret keys to hex and back to binary.
Index ¶
- Variables
- func GenerateSecretKey() (skb []byte, err error)
- func GenerateSecretKeyHex() (sks string)
- func GetPublicKeyHex(sk string) (pk string, err error)
- func HexPubkeyToBytes[V []byte | string](hpk V) (pkb []byte, err error)
- func IsValid32ByteHex[V []byte | string](pk V) bool
- func IsValidPublicKey[V []byte | string](pk V) bool
- func SecretBytesToPubKeyHex(skb []byte) (pk string, err error)
Constants ¶
This section is empty.
Variables ¶
var GeneratePrivateKey = func() string { return GenerateSecretKeyHex() }
GeneratePrivateKey - deprecated, use GenerateSecretKeyHex
Functions ¶
func GenerateSecretKey ¶
GenerateSecretKey creates a new secret key and returns the bytes of the secret.
func GenerateSecretKeyHex ¶
func GenerateSecretKeyHex() (sks string)
GenerateSecretKeyHex generates a secret key and encodes the bytes as hex.
func GetPublicKeyHex ¶
GetPublicKeyHex generates a public key from a hex encoded secret key.
func HexPubkeyToBytes ¶
HexPubkeyToBytes decodes a pubkey from hex encoded string/bytes.
func IsValid32ByteHex ¶
IsValid32ByteHex checks that a hex string is a valid 32 bytes lower case hex encoded value as per nostr NIP-01 spec.
func IsValidPublicKey ¶
IsValidPublicKey checks that a hex encoded public key is a valid BIP-340 public key.
func SecretBytesToPubKeyHex ¶
SecretBytesToPubKeyHex generates a public key from secret key bytes.
Types ¶
This section is empty.