Documentation
¶
Index ¶
- func CursorPath(ctx context.Context) string
- func InteractiveSetup(ctx context.Context) error
- func ParseAuthTag(raw any, label string) ([]string, error)
- func PublicKeyHex(privateKey string) (string, error)
- func SchnorrSign(message []byte, privateKey string, aux []byte) ([]byte, error)
- type AuthEvent
- type AuthEventParams
- type BuzzAdapter
- func (a *BuzzAdapter) AddReaction(ctx context.Context, chatID, messageID, emoji string) error
- func (a *BuzzAdapter) Connect(ctx context.Context, isReconnect bool) (bool, error)
- func (a *BuzzAdapter) DeleteMessage(ctx context.Context, chatID, messageID string) (bool, error)
- func (a *BuzzAdapter) Disconnect(ctx context.Context) error
- func (a *BuzzAdapter) EditMessage(ctx context.Context, chatID, messageID, content string, finalize bool) (gateway.SendResult, error)
- func (a *BuzzAdapter) GetChatInfo(ctx context.Context, chatID string) (map[string]any, error)
- func (a *BuzzAdapter) Name() string
- func (a *BuzzAdapter) NormalizeUserID(entry string) string
- func (a *BuzzAdapter) Send(ctx context.Context, chatID, content, replyTo string, metadata map[string]any) (gateway.SendResult, error)
- func (a *BuzzAdapter) SendDocument(ctx context.Context, chatID, filePath, caption, fileName, replyTo string, ...) (gateway.SendResult, error)
- func (a *BuzzAdapter) SendImage(ctx context.Context, chatID, imageURL, caption, replyTo string, ...) (gateway.SendResult, error)
- func (a *BuzzAdapter) SendImageFile(ctx context.Context, chatID, imagePath, caption, replyTo string, ...) (gateway.SendResult, error)
- func (a *BuzzAdapter) SendReaction(ctx context.Context, chatID, messageID, emoji string) (bool, error)
- func (a *BuzzAdapter) SendTyping(ctx context.Context, chatID string, metadata map[string]any) error
- func (a *BuzzAdapter) SendVideo(ctx context.Context, chatID, videoPath, caption, replyTo string, ...) (gateway.SendResult, error)
- func (a *BuzzAdapter) SendVoice(ctx context.Context, chatID, audioPath, caption, replyTo string, ...) (gateway.SendResult, error)
- type ChannelCursor
- type CursorMark
- type CursorStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InteractiveSetup ¶
Buzz wizard of icebath gateway setup writing the relay, channels and access settings and the key to the home .env
func ParseAuthTag ¶
Four string NIP-OA owner attestation tag from JSON text or a decoded list
func PublicKeyHex ¶
X only public key hex of a private key
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 ¶
Verifies relay credentials, seeds high water marks and starts the websocket or the poll loop
func (*BuzzAdapter) DeleteMessage ¶
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 ¶
Name and type of a conversation, the name fetched through the CLI when unknown
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 ¶
Buzz has no typing indicator
type ChannelCursor ¶
Read position of one watched channel
type CursorMark ¶
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