Documentation ¶
Overview ¶
Copyright (c) 2014 Canonical Ltd. Licensed under the GPLv3, see the COPYING file for details. Groups v1 only working with tel numbers
Copyright (c) 2020 Aaron Kimmig Licensed under the GPLv3, see the COPYING file for details.
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 GetContactForTel(tel string) *contacts.Contact
- func GetFingerprint(remoteUUID string, remoteIdentifier string) ([]string, []byte, error)
- func GetMyUUID() (string, error)
- func GetRegisteredContacts() ([]contacts.Contact, error)
- func JoinGroup(hexID string) (*groupsv2.GroupV2, error)
- func LeaveGroup(hexid string) error
- func MIMETypeFromReader(r io.Reader) (mime string, reader io.Reader)
- func MyIdentityKey() []byte
- func NewDeviceVerificationCode() (string, error)
- func ReadConfig(fileName string) (*config.Config, error)
- func RefreshConfig()
- func RefreshOwnProfile()
- func RegisterWithCrayfish(regisrationInfo *registration.RegistrationInfo, phoneNumber, captcha 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 SetAccountCapabilities(capabilities config.AccountCapabilities) error
- func SetUsername(name string)
- 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.Config) error
- type AccountAttributes
- type Attachment
- type Client
- type Conn
- type ContactDiscoveryRequest
- type DeviceInfo
- type DiscoveryContact
- type Envelopes
- 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) GroupV2() *groupsv2.GroupV2
- 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 RegistrationLockFailure
- type RemoteAttestationRequest
- type UnknownContactError
- type UnknownGroupIDError
- type UpdateAccountAttributes
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" STORAGE_URL = "https://storage.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" SENDER_CERTIFICATE_NO_E164_PATH = "/v1/certificate/delivery?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" ATTESTATION_REQUEST = "/v1/attestation/%s" DISCOVERY_REQUEST = "/v1/discovery/%s" 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.
var ProfileKeyUpdatedFlag = signalservice.DataMessage_PROFILE_KEY_UPDATE
ProfileKeyUpdatedFlag signals that this message updates the profile key
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 GetContactForTel ¶
func GetFingerprint ¶
func GetRegisteredContacts ¶
GetRegisteredContacts returns the subset of the local contacts that are also registered with the server
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 ReadConfig ¶
ReadConfig reads a YAML config file
func RefreshConfig ¶
func RefreshConfig()
func RefreshOwnProfile ¶
func RefreshOwnProfile()
func RegisterWithCrayfish ¶
func RegisterWithCrayfish(regisrationInfo *registration.RegistrationInfo, phoneNumber, captcha string) error
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 ¶
SendGroupVoiceNote sends an voice note to a group
func SendMessage ¶
SendMessage sends the given text message to the given contact.
func SendVoiceNote ¶
SendVoiceNote sends a voice note
func SetAccountCapabilities ¶
func SetAccountCapabilities(capabilities config.AccountCapabilities) error
SetAccountCapabilities lets the client decide when it's ready for new functions to support for example groupsv2
func StartListening ¶
func StartListening() error
StartListening connects to the server and handles incoming websocket messages.
Types ¶
type AccountAttributes ¶
type AccountAttributes struct { SignalingKey string `json:"signalingKey" yaml:"signalingKey"` FetchesMessages bool `json:"fetchesMessages" yaml:"fetchesMessages"` RegistrationID uint32 `json:"registrationId" yaml:"registrationId"` Name string `json:"name" yaml:"name"` Video bool `json:"video" yaml:"video"` Voice bool `json:"voice" yaml:"voice"` Pin *string `json:"pin" yaml:"pin"` // deprecated BasicStorageCredentials transport.AuthCredentials `json:"basicStorageCredentials" yaml:"basicStorageCredentials"` Capabilities config.AccountCapabilities `json:"capabilities" yaml:"capabilities"` DiscoverableByPhoneNumber bool `json:"discoverableByPhoneNumber" yaml:"discoverableByPhoneNumber"` UnrestrictedUnidentifiedAccess bool `json:"unrestrictedUnidentifiedAccess"` UnidentifiedAccessKey *[]byte `json:"unidentifiedAccessKey"` }
AccountAttributes describes what features are supported
type Attachment ¶
Attachment represents an attachment received from a peer
type Client ¶
type Client struct { GetPhoneNumber func() string GetVerificationCode func() string GetPin func() string GetStoragePassword func() string GetCaptchaToken func() string GetConfig func() (*config.Config, error) GetLocalContacts func() ([]contacts.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() GetUsername func() string }
Client contains application specific data and callbacks.
type Conn ¶
type Conn struct {
// contains filtered or unexported fields
}
Conn is a wrapper for the websocket connection
type ContactDiscoveryRequest ¶
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 DiscoveryContact ¶
type Envelopes ¶
type Envelopes map[string]DiscoveryContact
{"clientPublic":"DtZ1bEvFbDPgueDL30P3gh34GLeDAWCSIIXRECU7TCk="}
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 ¶
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 ¶
func (m *Message) Quote() *signalservice.DataMessage_Quote
Quote returns the quote in the message
func (*Message) Reaction ¶
func (m *Message) Reaction() *signalservice.DataMessage_Reaction
Reaction returns the reaction in the message
func (*Message) SourceUUID ¶
SourceUUID returns the UUID of the sender of the message.
func (*Message) Sticker ¶
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 RegistrationLockFailure ¶
type RegistrationLockFailure struct { TimeRemaining uint32 `json:"timeRemaining"` Credentials transport.AuthCredentials `json:"backupCredentials"` }
type RemoteAttestationRequest ¶
type RemoteAttestationRequest struct {
ClientPublic string
}
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
type UpdateAccountAttributes ¶
type UpdateAccountAttributes struct { SignalingKey *string `json:"signalingKey" yaml:"signalingKey"` FetchesMessages bool `json:"fetchesMessages" yaml:"fetchesMessages"` RegistrationID uint32 `json:"registrationId" yaml:"registrationId"` Name string `json:"name" yaml:"name"` Pin *string `json:"pin" yaml:"pin"` // deprecated RegistrationLock *string `json:"registrationLock" yaml:"registrationLock"` UnidentifiedAccessKey *[]byte `json:"unidentifiedAccessKey"` UnrestrictedUnidentifiedAccess bool `json:"unrestrictedUnidentifiedAccess"` Capabilities config.AccountCapabilities `json:"capabilities" yaml:"capabilities"` DiscoverableByPhoneNumber bool `json:"discoverableByPhoneNumber" yaml:"discoverableByPhoneNumber"` Video bool `json:"video" yaml:"video"` Voice bool `json:"voice" yaml:"voice"` }
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. |
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 |