otrclient

package
v0.4.0-el2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrorPrefix can be used to make an OTR error by appending an error message
	// to it.
	ErrorPrefix = "?OTR Error:"
)

Functions

This section is empty.

Types

type AuthorizeFingerprintCmd

type AuthorizeFingerprintCmd struct {
	Account     *config.Account
	Session     interface{}
	Peer        jid.WithoutResource
	Fingerprint []byte
	Tag         string
}

AuthorizeFingerprintCmd is a command that represents a request to authorize a fingerprint

type CommandManager

type CommandManager interface {
	ExecuteCmd(c interface{})
}

CommandManager is anything that can execute commands

type Conversation

type Conversation interface {
	Send([]byte) (trace int, err error)
	Receive([]byte) ([]byte, error)

	StartEncryptedChat() error
	EndEncryptedChat() error

	ProvideAuthenticationSecret([]byte) error
	StartAuthenticate(string, []byte) error
	AbortAuthentication() error

	GetSSID() [8]byte
	IsEncrypted() bool
	OurFingerprint() []byte
	TheirFingerprint() []byte

	CreateExtraSymmetricKey() ([]byte, error)
	GetAndWipeLastExtraKey() (usage uint32, usageData []byte, symkey []byte)

	EventHandler() *EventHandler
}

Conversation represents a conversation with encryption capabilities

type ConversationBuilder

type ConversationBuilder func(jid.Any) *otr3.Conversation

ConversationBuilder takes a JID and returns a new conversation

type ConversationManager

type ConversationManager interface {
	// GetConversationWith returns the conversation for the given peer, and
	// whether the Conversation exists
	GetConversationWith(peer jid.Any) (Conversation, bool)

	// GetConversationWith returns the conversation for the given peer, and
	// creates the conversation if none exists. Additionally, returns whether the
	// conversation was created.
	EnsureConversationWith(peer jid.Any, msg []byte) (Conversation, bool)

	// TerminateAll terminates all existing conversations
	TerminateAll()
}

ConversationManager represents an entity capable of managing Conversations

func NewConversationManager

func NewConversationManager(builder ConversationBuilder, sender Sender, account string, onCreateEH OnEventHandlerCreation, l coylog.Logger) ConversationManager

NewConversationManager returns a new ConversationManager

type EventHandler

type EventHandler struct {
	SmpQuestion string

	WaitingForSecret bool
	// contains filtered or unexported fields
}

EventHandler is used to contain information pertaining to the events of a specific OTR interaction

func (*EventHandler) ConsumeDelayedState

func (e *EventHandler) ConsumeDelayedState(trace int) bool

ConsumeDelayedState returns whether the given trace has been delayed or not, blanking out that status as a side effect

func (*EventHandler) ConsumeSecurityChange

func (e *EventHandler) ConsumeSecurityChange() SecurityChange

ConsumeSecurityChange is called to get the current security change and forget the old one

func (*EventHandler) HandleErrorMessage

func (e *EventHandler) HandleErrorMessage(error otr3.ErrorCode) []byte

HandleErrorMessage is called when asked to handle a specific error message

func (*EventHandler) HandleMessageEvent

func (e *EventHandler) HandleMessageEvent(event otr3.MessageEvent, message []byte, err error, trace ...interface{})

HandleMessageEvent is called to handle a specific message event

func (*EventHandler) HandleSMPEvent

func (e *EventHandler) HandleSMPEvent(event otr3.SMPEvent, progressPercent int, question string)

HandleSMPEvent is called to handle a specific SMP event

func (*EventHandler) HandleSecurityEvent

func (e *EventHandler) HandleSecurityEvent(event otr3.SecurityEvent)

HandleSecurityEvent is called to handle a specific security event

type OnEventHandlerCreation

type OnEventHandlerCreation func(jid.Any, *EventHandler, chan string, chan int)

OnEventHandlerCreation is a callback for any kind of event

type SaveApplicationConfigCmd

type SaveApplicationConfigCmd struct{}

SaveApplicationConfigCmd is a command that represents a request to save the application configuration

type SaveInstanceTagCmd

type SaveInstanceTagCmd struct {
	Account     *config.Account
	InstanceTag uint32
}

SaveInstanceTagCmd is a command that represents a request to save an instance tag

type SecurityChange

type SecurityChange int

SecurityChange describes a change in the security state of a Conversation.

const (
	// NoChange happened in the security status
	NoChange SecurityChange = iota
	// NewKeys indicates that a key exchange has completed. This occurs
	// when a conversation first becomes encrypted
	NewKeys
	// RenewedKeys indicates that a key exchange has completed. This occurs
	// when the keys are renegotiated within an encrypted conversation.
	RenewedKeys
	// SMPSecretNeeded indicates that the peer has started an
	// authentication and that we need to supply a secret. Call SMPQuestion
	// to get the optional, human readable challenge and then Authenticate
	// to supply the matching secret.
	SMPSecretNeeded
	// SMPComplete indicates that an authentication completed. The identity
	// of the peer has now been confirmed.
	SMPComplete
	// SMPFailed indicates that an authentication failed.
	SMPFailed
	// ConversationEnded indicates that the peer ended the secure
	// conversation.
	ConversationEnded
)

type Sender

type Sender interface {
	// Send sends a message to a peer
	Send(peer jid.Any, msg string, otr bool) error
}

Sender represents an entity capable of sending messages to peers

Jump to

Keyboard shortcuts

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