event

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Content   string    `json:"content,omitempty"`
	CreatedAt int       `json:"created_at,omitempty"`
	ID        string    `json:"id,omitempty"`
	Kind      int       `json:"kind,omitempty"`
	PubKey    string    `json:"pubkey,omitempty"`
	Sig       string    `json:"sig,omitempty"`
	Tags      []tag.Tag `json:"tags,omitempty"`
}

Event is a representation of an event

func New

func New(kind int, content string, tag ...tag.Tag) *Event

New creates a new empty raw event.

func (*Event) Marshal

func (e *Event) Marshal() ([]byte, error)

Marshal marshals the Event to a byte slice.

func (*Event) Serialize

func (e *Event) Serialize() []byte

Serialize TBD

func (*Event) Sign

func (e *Event) Sign(prvKeyHex string) error

Sign signs the event.

func (*Event) Unmarshal

func (e *Event) Unmarshal(data []byte) error

Unmarshal unmarshals the Event from a byte slice.

func (*Event) Verify added in v0.5.0

func (e *Event) Verify() error

Verify verifies the event pubkey and signature.

Jump to

Keyboard shortcuts

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