Documentation
¶
Index ¶
- func DecodeNote(note string) (string, error)
- func DecodeNpub(npub string) (string, error)
- func DecodeNsec(nsec string) (string, error)
- func DerivePublicKey(privateKeyHex string) (string, error)
- func EncodePrivateKey(hexPrivateKey string) (string, error)
- func EncodePubkey(hexPubKey string) (string, error)
- type KeyPair
- type Nip19Entity
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeNote ¶ added in v0.5.0
DecodeNote decodes a note (event ID) from bech32
func DecodeNpub ¶
DecodeNpub decodes a Bech32 encoded npub to its corresponding pubkey
func DecodeNsec ¶ added in v0.4.12
DecodeNsec decodes a Bech32 encoded nsec to its corresponding hex private key
func DerivePublicKey ¶
DerivePublicKey derives a public key from a private key
func EncodePrivateKey ¶
EncodePrivateKey encodes a hex private key into a Bech32 nsec
func EncodePubkey ¶
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 ¶
GenerateKeyPair generates a new random Nostr key pair
type Nip19Entity ¶ added in v0.5.0
type Nip19Entity struct {
Type string `json:"type"` // npub, note, nprofile, nevent, naddr
Data string `json:"data"` // hex pubkey or event id
Relays []string `json:"relays"` // optional relay hints
Author string `json:"author"` // optional author pubkey (for naddr/nevent)
Kind *int `json:"kind"` // optional event kind
DTag string `json:"d_tag"` // optional d tag (for naddr)
}
Nip19Entity represents a decoded NIP-19 entity with TLV data
func DecodeNip19Entity ¶ added in v0.5.0
func DecodeNip19Entity(encoded string) (*Nip19Entity, error)
DecodeNip19Entity decodes any NIP-19 bech32 encoded entity
Click to show internal directories.
Click to hide internal directories.