Documentation
¶
Overview ¶
Package textsecure implements the TextSecure client protocol.
Index ¶
- Variables
- func AddDevice(ephemeralId, publicKey, verificationCode string) error
- func AddNewLinkedDevice(uuid string, publicKey string) error
- func ContactIdentityKey(id string) ([]byte, error)
- func EndSession(tel string, msg string) (uint64, error)
- func GetAvatar(avatarUrl string) (io.ReadCloser, 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 RemoveGroupKey(hexid string) error
- func RequestContactInfo() error
- func RequestGroupInfo(g *Group) error
- func SendAttachment(tel, msg string, r io.Reader, timer uint32) (uint64, error)
- func SendGroupAttachment(hexid string, msg string, r io.Reader, timer uint32) (uint64, error)
- func SendGroupMessage(hexid string, msg string, timer uint32) (uint64, error)
- func SendMessage(tel, msg string, timer uint32) (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, contacts2 []Contact) error
- func WriteContactsToPath() error
- type AccountAttributes
- type Attachment
- type AuthCredentials
- type Client
- type Config
- type Conn
- type Contact
- type DeviceInfo
- type Group
- type Message
- type MessageTypeNotImplementedError
- type Profile
- type ProfileSettings
- type RegistrationInfo
- type RegistrationLockFailure
- type UnknownContactError
- type UnknownGroupIDError
Constants ¶
This section is empty.
Variables ¶
var ( TURN_SERVER_INFO = "/v1/accounts/turn" SET_ACCOUNT_ATTRIBUTES = "/v1/accounts/attributes/" PIN_PATH = "/v1/accounts/pin/" DIRECTORY_AUTH_PATH = "/v1/directory/auth" DIRECTORY_FEEDBACK_PATH = "/v1/directory/feedback-v3/%s" UUID_ACK_MESSAGE_PATH = "/v1/messages/uuid/%s" ATTACHMENT_DOWNLOAD_PATH = "attachments/%d" ATTACHMENT_UPLOAD_PATH = "attachments/" ATTACHMENT_PATH = "/v2/attachments/form/upload" PROFILE_PATH = "/v1/profile/%s" SENDER_CERTIFICATE_PATH = "/v1/certificate/delivery" STICKER_MANIFEST_PATH = "stickers/%s/manifest.proto" STICKER_PATH = "stickers/%s/full/%d" SERVICE_REFLECTOR_HOST = "europe-west1-signal-cdn-reflector.cloudfunctions.net" SIGNAL_CDN_URL = "https://cdn.signal.org" )
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("[textsecure] 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 AddNewLinkedDevice ¶
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 RemoveGroupKey ¶
func RequestContactInfo ¶
func RequestContactInfo() error
func RequestGroupInfo ¶
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
func WriteContactsToPath ¶
func WriteContactsToPath() error
Types ¶
type AccountAttributes ¶
type AccountAttributes struct {
SignalingKey string `json:"signalingKey"`
RegistrationID uint32 `json:"registrationId"`
FetchesMessages bool `json:"fetchesMessages"`
Video bool `json:"video"`
Voice bool `json:"voice"`
Pin string `json:"pin"`
BasicStorageCredentials AuthCredentials `json:"basicStorageCredentials"`
}
type Attachment ¶
Attachment represents an attachment received from a peer
type AuthCredentials ¶
type Client ¶
type Client struct {
GetPhoneNumber func() string
GetVerificationCode func() string
GetPin func() string
GetStoragePassword func() string
GetConfig func() (*Config, error)
GetLocalContacts func() ([]Contact, error)
MessageHandler func(*Message)
TypingMessageHandler func(*Message)
ReceiptMessageHandler func(*Message)
CallMessageHandler 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 Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a wrapper for the websocket connection
type Contact ¶
type Contact struct {
Tel string
Uuid string
Name string
Color string
Avatar []byte
Blocked bool
ExpireTimer uint32
}
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 ¶
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 []byte
}
Group holds group metadata.
func GetGroupById ¶
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.
func (*Message) ExpireTimer ¶
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 Profile ¶
type Profile struct {
IdentityKey []byte `json:"identityKey"`
Name string `json:"name"`
Avatar string `json:"avatar"`
UnidentifiedAccess string `json:"unidentifiedAccess"`
UnrestrictedUnidentifiedAccess bool `json:"unrestrictedUnidentifiedAccess"`
Capabilities ProfileSettings `json:"capabilities"`
}
profiles
func GetProfile ¶
type ProfileSettings ¶
type ProfileSettings struct {
Uuid bool `json:"uuid"`
}
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. *
- Verify a Signal Service account with a received SMS or voice verification code. *
- @param verificationCode The verification code received via SMS or Voice
- (see {@link #requestSmsVerificationCode} and
- {@link #requestVoiceVerificationCode}).
- @param signalingKey 52 random bytes. A 32 byte AES key and a 20 byte Hmac256 key,
- concatenated.
- @param signalProtocolRegistrationId A random 14-bit number that identifies this Signal install.
- This value should remain consistent across registrations for the
- same install, but probabilistically differ across registrations
- for separate installs. *
- @throws IOException
type RegistrationLockFailure ¶
type RegistrationLockFailure struct {
TimeRemaining uint32 `json:"timeRemaining"`
Credentials AuthCredentials `json:"backupCredentials"`
}
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. |
|
protobuf
Package textsecure is a generated protocol buffer package.
|
Package textsecure is a generated protocol buffer package. |
|
cmd
|
|
|
textsecure
command
|
|
|
Package curve25519sign implements a signature scheme based on Curve25519 keys.
|
Package curve25519sign implements a signature scheme based on Curve25519 keys. |