nostrassets

package module
v0.0.0-...-c102151 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// pubkeyCompressed is the header byte for a compressed secp256k1 pubkey.
	PUBKEY_COMPRESSED byte = 0x2 // y_bit + x coord

	HRP  = "npub"
	NSec = "nsec"
)

Variables

This section is empty.

Functions

func AddressFromPrvKey

func AddressFromPrvKey(prvBech string) (addr string, err error)

func AseDecrypt

func AseDecrypt(ciphertext []byte, key, iv []byte) ([]byte, error)

func AseEncrypt

func AseEncrypt(plaintext string, bKey []byte, bIV []byte, blockSize int) ([]byte, error)

func DecodeBech32

func DecodeBech32(prefix, data string) ([]byte, error)

func Decrypt

func Decrypt(prvBech string, pubkey string, ciphertext string) (res string, err error)

func Encrypt

func Encrypt(prvBech string, pubkey string, text string, fakeIv string) (res string, err error)

func GetEventHash

func GetEventHash(e *Event) (string, error)

func GetPublicKey

func GetPublicKey(prvBech string) (pub string, err error)

func NpubEncode

func NpubEncode(pubHex string) (res string, err error)

func NsecEncode

func NsecEncode(prvHex string) (res string, err error)

func PKCS5Padding

func PKCS5Padding(ciphertext []byte, blockSize int, after int) []byte

func PKCS5Trimming

func PKCS5Trimming(encrypt []byte) []byte

func TryGetPubkey

func TryGetPubkey(pubkeyHex string) []byte

func ValidateAddress

func ValidateAddress(address string) bool

func VerifyEvent

func VerifyEvent(e *Event) (ok bool)

Types

type Event

type Event struct {
	Kind      uint64     `json:"kind"`
	Tags      [][]string `json:"tags"`
	Content   string     `json:"content"`
	CreatedAt uint64     `json:"created_at"`
	Pubkey    string     `json:"pubkey"`
	Id        string     `json:"id"`
	Sig       string     `json:"sig"`
}

func SignEvent

func SignEvent(prvBech string, evt *Event) (res *Event, err error)

func (*Event) Copy

func (e *Event) Copy() *Event

Jump to

Keyboard shortcuts

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