crayfish

package
v1.10.4 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2022 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run()

Types

type ACKMessage

type ACKMessage struct {
	Status string `json:"status"`
}

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

Conn is a wrapper for the websocket connection

type CrayfishInstance

type CrayfishInstance struct {
	// contains filtered or unexported fields
}
var (
	Instance *CrayfishInstance
	// ErrNotListening is returned when trying to stop listening when there's no
	// valid listening connection set up
	ErrNotListening = errors.New("[textsecure-crayfish-ws] there is no listening connection to stop")
)

func (*CrayfishInstance) CrayfishRegister

func (c *CrayfishInstance) CrayfishRegister(registrationInfo *registration.RegistrationInfo,
	phoneNumber string,
	captcha string) error

func (*CrayfishInstance) CrayfishRegisterWithCode

func (c *CrayfishInstance) CrayfishRegisterWithCode(registrationInfo *registration.RegistrationInfo,
	phoneNumber string,
	captcha string,
	code string) (*CrayfishRegistration, error)

func (*CrayfishInstance) HandleEnvelope

func (*CrayfishInstance) HandleUnidentifiedSenderMessage

func (c *CrayfishInstance) HandleUnidentifiedSenderMessage(msg []byte) error

func (*CrayfishInstance) StartListening

func (c *CrayfishInstance) StartListening() error

func (*CrayfishInstance) StartWebsocket

func (c *CrayfishInstance) StartWebsocket() error

BackendStartWebsocket connects to the server and handles incoming websocket messages.

func (*CrayfishInstance) Stop

func (c *CrayfishInstance) Stop() error

func (*CrayfishInstance) StopListening

func (c *CrayfishInstance) StopListening() error

StopListening disables the receiving of messages.

type CrayfishRegistration

type CrayfishRegistration struct {
	UUID string `json:"uuid"`
	Tel  string `json:"tel"`
}

type CrayfishWebSocketMessage

type CrayfishWebSocketMessage struct {
	Type     *CrayfishWebSocketMessageType     `json:"type,omitempty"`
	Request  *CrayfishWebSocketRequestMessage  `json:"request,omitempty"`
	Response *CrayfishWebSocketResponseMessage `json:"response,omitempty"`
}

type CrayfishWebSocketMessageType

type CrayfishWebSocketMessageType int32
const (
	CrayfishWebSocketMessage_UNKNOWN  CrayfishWebSocketMessageType = 0
	CrayfishWebSocketMessage_REQUEST  CrayfishWebSocketMessageType = 1
	CrayfishWebSocketMessage_RESPONSE CrayfishWebSocketMessageType = 2
)

type CrayfishWebSocketRequestMessage

type CrayfishWebSocketRequestMessage struct {
	Type    *CrayfishWebSocketRequestMessageType `json:"type,omitempty"`
	Message interface{}                          `json:"message,omitempty"`
}

type CrayfishWebSocketRequestMessageTyp_SEALED_SESSION_DECRYPT_Message

type CrayfishWebSocketRequestMessageTyp_SEALED_SESSION_DECRYPT_Message struct {
}

type CrayfishWebSocketRequestMessageType

type CrayfishWebSocketRequestMessageType int32
const (
	CrayfishWebSocketRequestMessageTyp_UNKNOWN             CrayfishWebSocketRequestMessageType = 0
	CrayfishWebSocketRequestMessageTyp_START_REGISTRATION  CrayfishWebSocketRequestMessageType = 1
	CrayfishWebSocketRequestMessageTyp_VERIFY_REGISTRATION CrayfishWebSocketRequestMessageType = 2
	CrayfishWebSocketRequestMessageTyp_HANDLE_ENVELOPE     CrayfishWebSocketRequestMessageType = 3
)

type CrayfishWebSocketRequest_HANDLE_ENVELOPE_MESSAGE

type CrayfishWebSocketRequest_HANDLE_ENVELOPE_MESSAGE struct {
	Message string `json:"message"`
}

type CrayfishWebSocketRequest_REGISTER_MESSAGE

type CrayfishWebSocketRequest_REGISTER_MESSAGE struct {
	Number   string `json:"number"`
	Password string `json:"password"`
	Captcha  string `json:"captcha"`
	UseVoice bool   `json:"use_voice"`
}

type CrayfishWebSocketRequest_VERIFY_REGISTER_MESSAGE

type CrayfishWebSocketRequest_VERIFY_REGISTER_MESSAGE struct {
	Code         uint64   `json:"confirm_code"`
	Number       string   `json:"number"`
	Password     string   `json:"password"`
	SignalingKey [52]byte `json:"signaling_key"`
}

type CrayfishWebSocketResponseMessage

type CrayfishWebSocketResponseMessage struct {
	Type    *CrayfishWebSocketResponseMessageType `json:"type,omitempty"`
	Message interface{}                           `json:"message,omitempty"`
}

type CrayfishWebSocketResponseMessageType

type CrayfishWebSocketResponseMessageType int32
const (
	CrayfishWebSocketResponseMessageTyp_UNKNOWN             CrayfishWebSocketResponseMessageType = 0
	CrayfishWebSocketResponseMessageTyp_ACK                 CrayfishWebSocketResponseMessageType = 1
	CrayfishWebSocketResponseMessageTyp_VERIFY_REGISTRATION CrayfishWebSocketResponseMessageType = 2
	CrayfishWebSocketResponseMessageTyp_HANDLE_ENVELOPE     CrayfishWebSocketResponseMessageType = 3
)

type CrayfishWebSocketResponse_HANDLE_ENVELOPE_MESSAGE

type CrayfishWebSocketResponse_HANDLE_ENVELOPE_MESSAGE struct {
	Message      string `json:"message"`
	Timestamp    int64  `json:"timestamp"`
	SenderDevice int32  `json:"sender_device"`
	Sender       Sender `json:"sender"`
}

type CrayfishWebSocketResponse_VERIFY_REGISTER_MESSAGE

type CrayfishWebSocketResponse_VERIFY_REGISTER_MESSAGE struct {
	UUID           [16]byte `json:"uuid"`
	StorageCapable bool     `json:"storage_capable"`
}

type PhoneNumber

type PhoneNumber struct {
	Code     PhoneNumberCode     `json:"code"`
	National PhoneNumberNational `json:"national,string,omitempty"`
}

type PhoneNumberCode

type PhoneNumberCode struct {
	Value  uint64 `json:"value"`
	Source string `json:"source"`
}

type PhoneNumberNational

type PhoneNumberNational struct {
	Value uint64 `json:"value"`
	Zeros int    `json:"zeros"`
}

type Sender

type Sender struct {
	UUID        string      `json:"uuid"`
	PhoneNumber PhoneNumber `json:"phonenumber"`
}

Jump to

Keyboard shortcuts

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