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(uuid string, msg string) (uint64, error)
- func GetAvatar(avatarUrl string) (io.ReadCloser, error)
- func GetFingerprint(remoteIdentifier string) ([]string, []byte, error)
- func GetMyUUID() (string, 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 RequestGroupInfo(g *Group) error
- func SendAttachment(uuid string, 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 SendGroupVoiceNote(hexid string, msg string, r io.Reader, timer uint32) (uint64, error)
- func SendMessage(uuid, msg string, timer uint32) (uint64, error)
- func SendVoiceNote(uuid, msg string, r io.Reader, timer uint32) (uint64, error)
- func SetAccountAttributes(attributes *AccountAttributes) error
- func Setup(c *Client) error
- func StartListening() error
- func StopListening() error
- func SyncContacts() error
- func UnlinkDevice(id int) error
- func WriteConfig(filename string, cfg *Config) error
- func WriteContacts(filename string, contacts []Contact) error
- func WriteContactsToPath() error
- type AccountAttributes
- type AccountCapabilities
- type Attachment
- type AuthCredentials
- type Client
- type Config
- type Conn
- type Contact
- type DeviceInfo
- type Group
- type Message
- func (m *Message) Attachments() []*Attachment
- func (m *Message) ChatID() string
- func (m *Message) Contact() []*signalservice.DataMessage_Contact
- func (m *Message) ExpireTimer() uint32
- func (m *Message) Flags() uint32
- func (m *Message) Group() *Group
- func (m *Message) Message() string
- func (m *Message) Quote() *signalservice.DataMessage_Quote
- func (m *Message) Reaction() *signalservice.DataMessage_Reaction
- func (m *Message) Source() string
- func (m *Message) SourceUUID() string
- func (m *Message) Sticker() *signalservice.DataMessage_Sticker
- func (m *Message) Timestamp() uint64
- type MessageTypeNotImplementedError
- type Profile
- type ProfileSettings
- type RegistrationInfo
- type RegistrationLockFailure
- type UnknownContactError
- type UnknownGroupIDError
Constants ¶
This section is empty.
Variables ¶
var ( SERVICE_REFLECTOR_HOST = "europe-west1-signal-cdn-reflector.cloudfunctions.net" SIGNAL_CDN_URL = "https://cdn.signal.org" SIGNAL_CDN2_URL = "https://cdn2.signal.org" DIRECTORY_URL = "https://api.directory.signal.org" // CREATE_ACCOUNT_SMS_PATH = "/v1/accounts/sms/code/%s?client=%s"; CREATE_ACCOUNT_VOICE_PATH = "/v1/accounts/voice/code/%s" VERIFY_ACCOUNT_CODE_PATH = "/v1/accounts/code/%s" TURN_SERVER_INFO = "/v1/accounts/turn" SET_ACCOUNT_ATTRIBUTES = "/v1/accounts/attributes/" PIN_PATH = "/v1/accounts/pin/" REGISTRATION_LOCK_PATH = "/v1/accounts/registration_lock" REQUEST_PUSH_CHALLENGE = "/v1/accounts/fcm/preauth/%s/%s" WHO_AM_I = "/v1/accounts/whoami" SET_USERNAME_PATH = "/v1/accounts/username/%s" DELETE_USERNAME_PATH = "/v1/accounts/username" DELETE_ACCOUNT_PATH = "/v1/accounts/me" ATTACHMENT_DOWNLOAD_PATH = "/v2/attachments/" DIRECTORY_TOKENS_PATH = "/v1/directory/tokens" DIRECTORY_VERIFY_PATH = "/v1/directory/%s" DIRECTORY_AUTH_PATH = "/v1/directory/auth" DIRECTORY_FEEDBACK_PATH = "/v1/directory/feedback-v3/%s" MESSAGE_PATH = "/v1/messages/%s" SENDER_ACK_MESSAGE_PATH = "/v1/messages/%s/%d" UUID_ACK_MESSAGE_PATH = "/v1/messages/uuid/%s" ATTACHMENT_V2_PATH = "/v2/attachments/form/upload" ATTACHMENT_V3_PATH = "/v3/attachments/form/upload" PROFILE_PATH = "/v1/profile/%s" PROFILE_USERNAME_PATH = "/v1/profile/username/%s" SENDER_CERTIFICATE_PATH = "/v1/certificate/delivery?includeUuid=true" SENDER_CERTIFICATE_NO_E164_PATH = "/v1/certificate/delivery?includeUuid=true&includeE164=false" KBS_AUTH_PATH = "/v1/backup/auth" ATTACHMENT_KEY_DOWNLOAD_PATH = "/attachments/%s" ATTACHMENT_ID_DOWNLOAD_PATH = "/attachments/%d" ATTACHMENT_UPLOAD_PATH = "/attachments/" AVATAR_UPLOAD_PATH = "" STICKER_MANIFEST_PATH = "/stickers/%s/manifest.proto" STICKER_PATH = "/stickers/%s/full/%d" GROUPSV2_CREDENTIAL = "/v1/certificate/group/%d/%d" GROUPSV2_GROUP = "/v1/groups/" GROUPSV2_GROUP_PASSWORD = "/v1/groups/?inviteLinkPassword=%s" GROUPSV2_GROUP_CHANGES = "/v1/groups/logs/%s" GROUPSV2_AVATAR_REQUEST = "/v1/groups/avatar/form" GROUPSV2_GROUP_JOIN = "/v1/groups/join/%s" GROUPSV2_TOKEN = "/v1/groups/token" SERVER_DELIVERED_TIMESTAMP_HEADER = "X-Signal-Timestamp" CDS_MRENCLAVE = "c98e00a4e3ff977a56afefe7362a27e4961e4f19e211febfbb19b897e6b80b15" CONTACT_DISCOVERY = "/v1/discovery/%s" )
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
GroupLeaveFlag 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 ¶
AddNewLinkedDevice adds a new signal desktop client
func ContactIdentityKey ¶
ContactIdentityKey returns the serialized public key of the given contact
func EndSession ¶
EndSession terminates the session with the given peer.
func GetFingerprint ¶ added in v1.2.1
func LeaveGroup ¶
LeaveGroup sends a group quit message to the other members of the given group.
func MIMETypeFromReader ¶
MIMETypeFromReader returns the mime type that is inside the reader
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 RequestGroupInfo ¶
RequestGroupInfo updates the info for the group like members or the avatat
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 SendGroupVoiceNote ¶ added in v1.2.2
SendGroupVoiceNote sends an voice note to a group
func SendMessage ¶
SendMessage sends the given text message to the given contact.
func SendVoiceNote ¶ added in v1.2.2
SendVoiceNote sends a voice note
func SetAccountAttributes ¶ added in v1.2.5
func SetAccountAttributes(attributes *AccountAttributes) error
SetAccountAttributes updates the account attributes
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
WriteContactsToPath saves a list of contacts to a file at the standard location
Types ¶
type AccountAttributes ¶
type AccountAttributes struct { SignalingKey string `json:"signalingKey" yaml:"signalingKey"` RegistrationID uint32 `json:"registrationId" yaml:"registrationId"` FetchesMessages bool `json:"fetchesMessages" yaml:"fetchesMessages"` Video bool `json:"video" yaml:"video"` Voice bool `json:"voice" yaml:"voice"` Pin string `json:"pin" yaml:"pin"` // deprecated BasicStorageCredentials AuthCredentials `json:"basicStorageCredentials" yaml:"basicStorageCredentials"` Capabilities AccountCapabilities `json:"capabilities" yaml:"capabilities"` }
AccountAttributes describes what features are supported
type AccountCapabilities ¶ added in v1.2.5
type AccountCapabilities struct { UUID bool `json:"uuid" yaml:"uuid"` Gv2 bool `json:"gv2" yaml:"gv2"` Storage bool `json:"storage" yaml:"storage"` Gv1Migration bool `json:"gv1Migration" yaml:"gv1Migration"` }
AccountCapabilities describes what functions axolotl supports
type Attachment ¶
Attachment represents an attachment received from a peer
type AuthCredentials ¶
AuthCredentials holds the credentials for the websocket connection
func (*AuthCredentials) AsBasic ¶ added in v1.2.10
func (a *AuthCredentials) AsBasic() string
type Client ¶
type Client struct { GetPhoneNumber func() string GetVerificationCode func() string GetPin func() string GetStoragePassword func() string GetCaptchaToken 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 UUID string `yaml:"uuid" default:"notset"` 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. AccountCapabilities AccountCapabilities `yaml:"accountCapabilities"` // Account Attrributes are used in order to track the support of different function for signal DiscoverableByPhoneNumber bool `yaml:"discoverableByPhoneNumber"` // If the user should be found by his phone number }
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 { UUID string Tel string ProfileKey []byte IdentityKey []byte Name string Username string Avatar []byte Color string Blocked bool Verified *signalservice.Verified ExpireTimer uint32 InboxPosition uint32 Archived bool }
Contact contains information about a contact.
func GetContactForTel ¶ added in v1.2.10
func GetProfileE164 ¶ added in v1.2.5
GetProfileE164 get a profile by a phone number
func GetRegisteredContacts ¶
GetRegisteredContacts returns the subset of the local contacts that are also registered with the server
func ReadContacts ¶
ReadContacts loads the contacts yaml file and pareses it
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 ¶
GetGroupById returns a group by it's id
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) Contact ¶ added in v1.2.1
func (m *Message) Contact() []*signalservice.DataMessage_Contact
Contact returns the contact in the message
func (*Message) ExpireTimer ¶
ExpireTimer returns the expire timer in the message
func (*Message) Quote ¶ added in v1.2.1
func (m *Message) Quote() *signalservice.DataMessage_Quote
Quote returns the quote in the message
func (*Message) Reaction ¶ added in v1.2.1
func (m *Message) Reaction() *signalservice.DataMessage_Reaction
Reaction returns the reaction in the message
func (*Message) SourceUUID ¶ added in v1.2.5
SourceUUID returns the UUID of the sender of the message.
func (*Message) Sticker ¶ added in v1.2.1
func (m *Message) Sticker() *signalservice.DataMessage_Sticker
Sticker returns the sticker in 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 Profile ¶
type Profile struct { IdentityKey string `json:"identityKey"` Name string `json:"name"` Avatar string `json:"avatar"` UnidentifiedAccess string `json:"unidentifiedAccess"` UnrestrictedUnidentifiedAccess bool `json:"unrestrictedUnidentifiedAccess"` Capabilities ProfileSettings `json:"capabilities"` Username string `json:"username"` UUID string `json:"uuid"` Payments string `json:"payments"` Credential string `json:"credential"` }
Profile describes the profile type
type ProfileSettings ¶
type ProfileSettings struct { UUID bool `json:"uuid"` Gv2 bool `json:"gv2"` Gv1Migration bool `json:"gv1-migration"` }
ProfileSettings contains the settings for the profile
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
|
|
Package curve25519sign implements a signature scheme based on Curve25519 keys.
|
Package curve25519sign implements a signature scheme based on Curve25519 keys. |
Based on https://gist.github.com/nanu-c/f885b928b9e43a7167258dd70dc186d6 from nanu-c which is based on https://github.com/signalapp/libsignal-protocol-java/blob/master/java/src/main/java/org/whispersystems/libsignal/fingerprint/NumericFingerprintGenerator.java
|
Based on https://gist.github.com/nanu-c/f885b928b9e43a7167258dd70dc186d6 from nanu-c which is based on https://github.com/signalapp/libsignal-protocol-java/blob/master/java/src/main/java/org/whispersystems/libsignal/fingerprint/NumericFingerprintGenerator.java |