blueberry

package module
v0.0.0-...-e63a971 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 16 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 Field

type Field struct {
	ID   uint8
	Data []byte
}
type Footer struct {
	Signature []byte
}

func CreateFooter

func CreateFooter(key SignatureKey, data []byte) (Footer, error)
type Header struct {
	ProtocolVersion byte
	ObjectType      string
}

func CreateHeader

func CreateHeader(objectType string) (Header, error)

type Mailbox

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

type Message

type Message struct {
	Radius    int    `json:"radius"`
	Type      string `json:"type"`
	Data      any    `json:"data"`
	Signature string `json:"signature"`
}

type Post

type Post struct {
	Author      User      `json:"author"`
	Salt        []byte    `json:"salt"`
	CW          string    `json:"cw"`
	Body        string    `json:"body"`
	Created     time.Time `json:"created"`
	LastUpdated time.Time `json:"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"`
	Type   string `json:"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"`
	Description  string       `json:"description"`
	SignatureKey SignatureKey `json:"signature_key"`
	Mailbox      Mailbox      `json:"mailbox"`
	Created      time.Time    `json:"created"`
	LastUpdated  time.Time    `json:"last_updated"`
}

func CreateUser

func CreateUser(displayName string, description string, mailbox 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