Documentation
¶
Index ¶
- Variables
- type AuthorizeFingerprintCmd
- type CommandManager
- type Conversation
- type ConversationBuilder
- type ConversationManager
- type EventHandler
- func (e *EventHandler) ConsumeDelayedState(trace int) bool
- func (e *EventHandler) ConsumeSecurityChange() SecurityChange
- func (e *EventHandler) HandleErrorMessage(error otr3.ErrorCode) []byte
- func (e *EventHandler) HandleMessageEvent(event otr3.MessageEvent, message []byte, err error, trace ...interface{})
- func (e *EventHandler) HandleSMPEvent(event otr3.SMPEvent, progressPercent int, question string)
- func (e *EventHandler) HandleSecurityEvent(event otr3.SecurityEvent)
- type OnEventHandlerCreation
- type SaveApplicationConfigCmd
- type SaveInstanceTagCmd
- type SecurityChange
- type Sender
Constants ¶
This section is empty.
Variables ¶
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 }
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) EventHandler() *EventHandler }
Conversation represents a conversation with encryption capabilities
type ConversationBuilder ¶
type ConversationBuilder func(jid.Any) *otr3.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) (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) 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)
type SaveApplicationConfigCmd ¶
type SaveApplicationConfigCmd struct{}
SaveApplicationConfigCmd is a command that represents a request to save the application configuration
type SaveInstanceTagCmd ¶
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 )