tools

package
v0.4.1-pre-release Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 12, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeNpub

func DecodeNpub(npub string) (string, error)

DecodeNpub decodes a Bech32 encoded npub to its corresponding pubkey

func DerivePublicKey

func DerivePublicKey(privateKeyHex string) (string, error)

DerivePublicKey derives a public key from a private key

func EncodePrivateKey

func EncodePrivateKey(hexPrivateKey string) (string, error)

EncodePrivateKey encodes a hex private key into a Bech32 nsec

func EncodePubkey

func EncodePubkey(hexPubKey string) (string, error)

EncodePubkey encodes a hex public key into a Bech32 npub

Types

type KeyPair

type KeyPair struct {
	PrivateKey string `json:"private_key"` // hex format
	PublicKey  string `json:"public_key"`  // hex format
	Nsec       string `json:"nsec"`        // bech32 format
	Npub       string `json:"npub"`        // bech32 format
}

KeyPair represents a Nostr key pair

func GenerateKeyPair

func GenerateKeyPair() (*KeyPair, error)

GenerateKeyPair generates a new random Nostr key pair

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL