blueberry

package module
v0.0.0-...-22b7579 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2024 License: MIT Imports: 15 Imported by: 0

README

Blueberry

A Go implementation of Strawberry.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Broadcast

func Broadcast(relays []Relay, msg Message, customErrorHandler func(error)) error

Types

type Link string

type Mailbox

type Mailbox struct {
	Username string `json:"username" msgpack:"username"`
	Server   string `json:"server" msgpack:"server"`
	Type     string `json:"type" msgpack:"type"`
}

type Message

type Message struct {
	Radius        uint32 `json:"radius" msgpack:"radius"`
	Channel       string `json:"channel" msgpack:"channel"`
	SignatureType string `json:"signature_type" msgpack:"signature_type"`
	Signature     []byte `json:"signature" msgpack:"signature"`
	Data          any    `json:"data" msgpack:"data"`
}

type Post

type Post struct {
	Author      User      `json:"author" msgpack:"author"`
	Salt        []byte    `json:"salt" msgpack:"salt"`
	CW          string    `json:"cw" msgpack:"cw"`
	Body        string    `json:"body" msgpack:"body"`
	Created     time.Time `json:"created" msgpack:"created"`
	LastUpdated time.Time `json:"last_updated" msgpack:"last_updated"`
}

func CreatePost

func CreatePost(author User, cw string, body string) (Post, error)

func (Post) GetID

func (p Post) GetID() string

type Relay

type Relay struct {
	Server string `json:"server" msgpack:"server"`
	Type   string `json:"type" msgpack:"type"`
}

type SignatureKey

type SignatureKey struct {
	PrivateKey *rsa.PrivateKey // !!! THIS CAN BE A NIL POINTER, BE CAREFUL !!!
	PublicKey  *rsa.PublicKey
}

func CreateSignatureKey

func CreateSignatureKey() (*SignatureKey, error)

func LoadKeypair

func LoadKeypair(privateKeyData string) (*SignatureKey, error)

func (*SignatureKey) Export

func (s *SignatureKey) Export() (string, error)

func (SignatureKey) GetID

func (k SignatureKey) GetID() string

func (SignatureKey) MarshalJSON

func (k SignatureKey) MarshalJSON() ([]byte, error)

func (*SignatureKey) UnmarshalJSON

func (k *SignatureKey) UnmarshalJSON([]byte) error

type User

type User struct {
	DisplayName  string    `json:"display_name" msgpack:"display_name"`
	Description  string    `json:"description" msgpack:"description"`
	SignatureKey any       `json:"signature_key" msgpack:"signature_key"`
	Mailboxes    []Mailbox `json:"mailboxes" msgpack:"mailboxes"`
	Created      time.Time `json:"created" msgpack:"created"`
	LastUpdated  time.Time `json:"last_updated" msgpack:"last_updated"`
}

func CreateUser

func CreateUser(displayName string, description string, mailboxes []Mailbox) (User, error)

func (User) GetID

func (u User) GetID() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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