Documentation ¶
Overview ¶
Package textsecure implements the TextSecure client protocol.
Index ¶
- Variables
- func AddDevice(ephemeralId, publicKey, verificationCode string) error
- func ContactIdentityKey(id string) ([]byte, error)
- func EndSession(tel string, msg string) (uint64, error)
- func LeaveGroup(hexid string) error
- func MIMETypeFromReader(r io.Reader) (mime string, reader io.Reader)
- func MyIdentityKey() []byte
- func NewDeviceVerificationCode() (string, error)
- func RegisterWithUPS(token string) error
- func SendAttachment(tel, msg string, r io.Reader) (uint64, error)
- func SendGroupAttachment(hexid string, msg string, r io.Reader) (uint64, error)
- func SendGroupMessage(hexid string, msg string) (uint64, error)
- func SendMessage(tel, msg string) (uint64, error)
- func Setup(c *Client) error
- func StartListening() error
- func StopListening() error
- func UnlinkDevice(id int) error
- func WriteConfig(filename string, cfg *Config) error
- func WriteContacts(filename string, contacts []Contact) error
- type Attachment
- type Client
- type Config
- type Contact
- type DeviceInfo
- type Group
- type Message
- type MessageTypeNotImplementedError
- type RegistrationInfo
- type UnknownContactError
- type UnknownGroupIDError
Constants ¶
This section is empty.
Variables ¶
var EndSessionFlag uint32 = 1
EndSessionFlag signals that this message resets the session
var ErrBadPublicKey = errors.New("public key not formatted correctly")
ErrBadPublicKey is raised when a given public key is not in the expected format.
var ErrInvalidMACForAttachment = errors.New("invalid MAC for attachment")
ErrInvalidMACForAttachment signals that the downloaded attachment has an invalid MAC.
var ErrInvalidMACForMessage = errors.New("invalid MAC for incoming message")
ErrInvalidMACForMessage signals an incoming message with invalid MAC.
var ErrNotListening = errors.New("there is no listening connection to stop")
ErrNotListening is returned when trying to stop listening when there's no valid listening connection set up
var ErrRemoteGone = errors.New("the remote device is gone (probably reinstalled)")
ErrRemoteGone is returned when the peer reinstalled and lost its session state.
var ErrStoreBadMAC = errors.New("wrong MAC calculated, possibly due to wrong passphrase")
ErrStoreBadMAC occurs when MAC verification fails on the records stored using password based encryption. The probable cause is using a wrong password.
var GroupLeaveFlag uint32 = 2
GroupLeavelag signals that this message is a group leave message
var GroupUpdateFlag uint32 = 1
GroupUpdateFlag signals that this message updates the group membership or name.
Functions ¶
func ContactIdentityKey ¶
ContactIdentityKey returns the serialized public key of the given contact
func EndSession ¶
EndSession terminates the session with the given peer.
func LeaveGroup ¶
LeaveGroup sends a group quit message to the other members of the given group.
func MyIdentityKey ¶
func MyIdentityKey() []byte
MyIdentityKey returns our serialized public identity key
func NewDeviceVerificationCode ¶
NewDeviceVerificationCode returns the verification code for linking devices
func RegisterWithUPS ¶
RegisterWithUPS registers our Ubuntu push client token with the server.
func SendAttachment ¶
SendAttachment sends the contents of a reader, along with an optional message to a given contact.
func SendGroupAttachment ¶
SendGroupAttachment sends an attachment to a given group.
func SendGroupMessage ¶
SendGroupMessage sends a text message to a given group.
func SendMessage ¶
SendMessage sends the given text message to the given contact.
func StartListening ¶
func StartListening() error
StartListening connects to the server and handles incoming websocket messages.
func WriteConfig ¶
WriteConfig saves a config to a file
func WriteContacts ¶
WriteContacts saves a list of contacts to a file
Types ¶
type Attachment ¶
Attachment represents an attachment received from a peer
type Client ¶
type Client struct { GetPhoneNumber func() string GetVerificationCode func() string GetStoragePassword func() string GetConfig func() (*Config, error) GetLocalContacts func() ([]Contact, error) MessageHandler func(*Message) ReceiptHandler func(string, uint32, uint64) SyncReadHandler func(string, uint64) SyncSentHandler func(*Message, uint64) RegistrationDone func() }
Client contains application specific data and callbacks.
type Config ¶
type Config struct { Tel string `yaml:"tel"` // Our telephone number Server string `yaml:"server"` // The TextSecure server URL RootCA string `yaml:"rootCA"` // The TLS signing certificate of the server we connect to ProxyServer string `yaml:"proxy"` // HTTP Proxy URL if one is being used VerificationType string `yaml:"verificationType"` // Code verification method during registration (SMS/VOICE/DEV) StorageDir string `yaml:"storageDir"` // Directory for the persistent storage UnencryptedStorage bool `yaml:"unencryptedStorage"` // Whether to store plaintext keys and session state (only for development) StoragePassword string `yaml:"storagePassword"` // Password to the storage LogLevel string `yaml:"loglevel"` // Verbosity of the logging messages UserAgent string `yaml:"userAgent"` // Override for the default HTTP User Agent header field AlwaysTrustPeerID bool `yaml:"alwaysTrustPeerID"` // Workaround until proper handling of peer reregistering with new ID. }
Config holds application configuration settings
func ReadConfig ¶
ReadConfig reads a YAML config file
type Contact ¶
Contact contains information about a contact.
func GetRegisteredContacts ¶
GetRegisteredContacts returns the subset of the local contacts that are also registered with the server
func ReadContacts ¶
ReadContacts reads a YAML contacts file
type DeviceInfo ¶
type DeviceInfo struct { ID uint32 `json:"id"` Name string `json:"name"` Created uint64 `json:"created"` LastSeen uint64 `json:"lastSeen"` }
func LinkedDevices ¶
func LinkedDevices() ([]DeviceInfo, error)
LinkedDevices returns the list of linked devices
type Group ¶
type Group struct { ID []byte Hexid string Flags uint32 Name string Members []string Avatar io.Reader `yaml:"-"` }
Group holds group metadata.
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
Message represents a message received from the peer. It can optionally include attachments and be sent to a group.
func (*Message) Attachments ¶
func (m *Message) Attachments() []*Attachment
Attachments returns the list of attachments on the message.
type MessageTypeNotImplementedError ¶
type MessageTypeNotImplementedError struct {
// contains filtered or unexported fields
}
MessageTypeNotImplementedError is raised in the unlikely event that an unhandled protocol message type is received.
func (MessageTypeNotImplementedError) Error ¶
func (err MessageTypeNotImplementedError) Error() string
type RegistrationInfo ¶
type RegistrationInfo struct {
// contains filtered or unexported fields
}
RegistrationInfo holds the data required to be identified by and to communicate with the push server. The data is generated once at install time and stored locally.
type UnknownContactError ¶
type UnknownContactError struct {
// contains filtered or unexported fields
}
UnknownContactError is returned when an unknown group id is encountered
func (UnknownContactError) Error ¶
func (err UnknownContactError) Error() string
type UnknownGroupIDError ¶
type UnknownGroupIDError struct {
// contains filtered or unexported fields
}
UnknownGroupIDError is returned when an unknown group id is encountered
func (UnknownGroupIDError) Error ¶
func (err UnknownGroupIDError) Error() string
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package axolotl implements the Axolotl ratchet as used by TextSecure protocol version 3.
|
Package axolotl implements the Axolotl ratchet as used by TextSecure protocol version 3. |
cmd
|
|
Package curve25519sign implements a signature scheme based on Curve25519 keys.
|
Package curve25519sign implements a signature scheme based on Curve25519 keys. |