nostrbinary

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 27, 2024 License: GPL-2.0, MIT Imports: 15 Imported by: 0

Documentation

Overview

Package nostrbinary provides a simple interface for using Gob encoding on nostr events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(evt *event.T) (b []byte, err error)

func Unmarshal

func Unmarshal(data []byte) (evt *event.T, err error)

Types

type Event

type Event struct {
	ID        [sha256.Size]byte
	PubKey    [schnorr.PubKeyBytesLen]byte
	CreatedAt timestamp.T
	Kind      kind.T
	Tags      tags.T
	Content   string
	Sig       [schnorr.SignatureSize]byte
}

Event is the most compact and exact form of an event as encoded in native Go form. This will produce the most compact form of Gob encoded binary data.

func FromEventT

func FromEventT(evt *event.T) (evb *Event, err error)

FromEventT converts an event.T into an Event, including validating all fields are correctly formed for their type.

func (*Event) ToEventT

func (evb *Event) ToEventT() (evt *event.T)

ToEventT converts an Event into an event.T.

Jump to

Keyboard shortcuts

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