commands

package
v0.0.0-...-1ecb8ac Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: Unlicense Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Undefined CommandCodes = 0
	CNN                    = 1 //Connect
	MSG                    = 2 //Message
	RKS                    = 3 //Register Keys
	BKS                    = 4 //Broadcast Keys, this command is temporary and must be removed
)
View Source
const MessageSize = 980
View Source
const RegisterKeysSize = 176

Variables

This section is empty.

Functions

This section is empty.

Types

type BroadcastKeys

type BroadcastKeys struct {
}

func (BroadcastKeys) ToCommand

func (m BroadcastKeys) ToCommand(syncId uint8) Command

ToCommand implements commands.IOut.

type Command

type Command struct {
	Header
	Body []byte
}

func Decode

func Decode(source []byte) (*Command, error)

func (*Command) Encode

func (cmd *Command) Encode() ([]byte, error)

func (*Command) Parse

func (cmd *Command) Parse() (In, error)

type CommandCodes

type CommandCodes uint16
type Header struct {
	Version uint16
	SyncId  uint8
	Id      CommandCodes
}

func NewHeader

func NewHeader(id CommandCodes, sync uint8) Header

type IOut

type IOut interface {
	ToCommand(syncId uint8) Command
}

type In

type In = interface{}

type Message

type Message struct {
	Recipient     UserName
	InitialVector [12]byte //TODO READ IV SIZE from e2ee
	Len           int32
	Message       [MessageSize]byte
}

func NewMessage

func NewMessage(body []byte) (*Message, error)

func (Message) ToCommand

func (m Message) ToCommand(syncId uint8) Command

type RegisterKeys

type RegisterKeys struct {
	User         UserName
	IdKey        [32]byte
	SignedKey    [32]byte
	Signature    [64]byte
	EphemeralKey [32]byte //will be removed later when we implement a direct way of communication
}

func NewRegisterKeys

func NewRegisterKeys(body []byte) (*RegisterKeys, error)

func (RegisterKeys) ToCommand

func (r RegisterKeys) ToCommand(syncId uint8) Command

ToCommand implements commands.IOut.

type UserName

type UserName = [16]byte

Jump to

Keyboard shortcuts

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