buzz

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 40 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CursorPath

func CursorPath(ctx context.Context) string

Cursor file under the icebath home

func InteractiveSetup

func InteractiveSetup(ctx context.Context) error

Buzz wizard of icebath gateway setup writing the relay, channels and access settings and the key to the home .env

func ParseAuthTag

func ParseAuthTag(raw any, label string) ([]string, error)

Four string NIP-OA owner attestation tag from JSON text or a decoded list

func PublicKeyHex

func PublicKeyHex(privateKey string) (string, error)

X only public key hex of a private key

func SchnorrSign

func SchnorrSign(message []byte, privateKey string, aux []byte) ([]byte, error)

BIP340 signature of a 32 byte message, fresh auxiliary randomness when aux is nil

Types

type AuthEvent

type AuthEvent struct {
	ID        string     `json:"id"`
	Pubkey    string     `json:"pubkey"`
	CreatedAt int64      `json:"created_at"`
	Kind      int        `json:"kind"`
	Tags      [][]string `json:"tags"`
	Content   string     `json:"content"`
	Sig       string     `json:"sig"`
}

Signed kind 22242 relay authentication event

func BuildAuthEvent

func BuildAuthEvent(p AuthEventParams) (AuthEvent, error)

NIP-42 auth event for the relay challenge, with the owner attestation tag when configured

type AuthEventParams

type AuthEventParams struct {
	PrivateKey          string
	Challenge           string
	RelayURL            string
	AuthTagJSON         string
	CreatedAt           *int64
	AuxiliaryRandomness []byte
}

Inputs of a relay authentication event, CreatedAt nil meaning now and AuxiliaryRandomness nil meaning fresh

type BuzzAdapter

type BuzzAdapter struct {
	*gateway.BasePlatformAdapter
	// contains filtered or unexported fields
}

Buzz adapter, a NIP-42 websocket subscription with a CLI poll fallback in and the buzz CLI out

func NewBuzzAdapter

func NewBuzzAdapter(ctx context.Context, config *gateway.PlatformConfig) (*BuzzAdapter, error)

Adapter for a platform config, its knobs from the buzz settings of the profile it serves

func (*BuzzAdapter) AddReaction

func (a *BuzzAdapter) AddReaction(ctx context.Context, chatID, messageID, emoji string) error

Adds an emoji reaction to a message

func (*BuzzAdapter) Connect

func (a *BuzzAdapter) Connect(ctx context.Context, isReconnect bool) (bool, error)

Verifies relay credentials, seeds high water marks and starts the websocket or the poll loop

func (*BuzzAdapter) DeleteMessage

func (a *BuzzAdapter) DeleteMessage(ctx context.Context, chatID, messageID string) (bool, error)

Deletes a sent message, the deletion event marked seen

func (*BuzzAdapter) Disconnect

func (a *BuzzAdapter) Disconnect(ctx context.Context) error

Stops the inbound transport and drops runtime state

func (*BuzzAdapter) EditMessage

func (a *BuzzAdapter) EditMessage(ctx context.Context, chatID, messageID, content string, finalize bool) (gateway.SendResult, error)

Edits a sent message in place, reporting the original id the stream consumer keeps addressing

func (*BuzzAdapter) GetChatInfo

func (a *BuzzAdapter) GetChatInfo(ctx context.Context, chatID string) (map[string]any, error)

Name and type of a conversation, the name fetched through the CLI when unknown

func (*BuzzAdapter) Name

func (a *BuzzAdapter) Name() string

Display name of the platform

func (*BuzzAdapter) NormalizeUserID

func (a *BuzzAdapter) NormalizeUserID(entry string) string

Hex form of an allowlist entry given as hex or npub, the hook allowlist matching consults

func (*BuzzAdapter) Send

func (a *BuzzAdapter) Send(ctx context.Context, chatID, content, replyTo string, metadata map[string]any) (gateway.SendResult, error)

Publishes the content into the channel, threaded against the metadata thread, stream anchor or reply target

func (*BuzzAdapter) SendDocument

func (a *BuzzAdapter) SendDocument(ctx context.Context, chatID, filePath, caption, fileName, replyTo string, metadata, extra map[string]any) (gateway.SendResult, error)

Uploads a local document as a native attachment

func (*BuzzAdapter) SendImage

func (a *BuzzAdapter) SendImage(ctx context.Context, chatID, imageURL, caption, replyTo string, metadata map[string]any) (gateway.SendResult, error)

Uploads a local image file or posts a URL as an image link

func (*BuzzAdapter) SendImageFile

func (a *BuzzAdapter) SendImageFile(ctx context.Context, chatID, imagePath, caption, replyTo string, metadata, extra map[string]any) (gateway.SendResult, error)

Uploads a local image, a missing path taking the base fallback so host paths never reach chat

func (*BuzzAdapter) SendReaction

func (a *BuzzAdapter) SendReaction(ctx context.Context, chatID, messageID, emoji string) (bool, error)

Adds a reaction through the CLI, a failure logged and reported false

func (*BuzzAdapter) SendTyping

func (a *BuzzAdapter) SendTyping(ctx context.Context, chatID string, metadata map[string]any) error

Buzz has no typing indicator

func (*BuzzAdapter) SendVideo

func (a *BuzzAdapter) SendVideo(ctx context.Context, chatID, videoPath, caption, replyTo string, metadata, extra map[string]any) (gateway.SendResult, error)

Uploads a local video as a native attachment

func (*BuzzAdapter) SendVoice

func (a *BuzzAdapter) SendVoice(ctx context.Context, chatID, audioPath, caption, replyTo string, metadata, extra map[string]any) (gateway.SendResult, error)

Uploads a local audio file as a native attachment

type ChannelCursor

type ChannelCursor struct {
	ChatType string
	LastTS   int64
	Seen     []string
}

Read position of one watched channel

type CursorMark

type CursorMark struct {
	LastTS  int64
	Count   int
	Last    string
	HasLast bool
}

Change detector of one channel cursor, the newest seen id included when there is one

func CursorMarkOf

func CursorMarkOf(state *ChannelCursor) CursorMark

Last timestamp, seen count and newest seen id of a channel cursor

type CursorStore

type CursorStore struct {
	SelfPubkey      string
	RelayURL        string
	ChannelOrder    []string
	ChannelState    map[string]*ChannelCursor
	RestoredCursors map[string]ChannelCursor
	// contains filtered or unexported fields
}

Per channel cursors persisted under the icebath home so a restart resumes where the reader stopped

func (*CursorStore) CursorWriter

func (s *CursorStore) CursorWriter(ctx context.Context) func()

Write of the cursor as it stands now that skips itself when a newer snapshot already landed

func (*CursorStore) Forget

func (s *CursorStore) Forget(channelID string)

Stops persisting a channel, dropping it from the watch order

func (*CursorStore) LoadCursors

func (s *CursorStore) LoadCursors(ctx context.Context)

Restores cursors written for this identity and relay, ignoring unreadable files and malformed entries such as a last_ts that is not a whole number within the int64 range

func (*CursorStore) SaveCursors

func (s *CursorStore) SaveCursors(ctx context.Context)

Persists every watched channel cursor, logging instead of failing

func (*CursorStore) Watch

func (s *CursorStore) Watch(channelID string, cursor *ChannelCursor)

Records a watched channel keeping first watch order for the persisted payload

Jump to

Keyboard shortcuts

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