Documentation ¶
Overview ¶
Package o3 central communication unit responsible for complete exchanges (like handshake and subsequent message reception). Uses functions in packethandler and packetdispatcher to deal with incoming and outgoing messages. Errors in underlying functions bubble up as panics and have to be re- covered here, converted to go errors and returned.
Package o3 functions to prepare and send packets. All preparation required to transmit a packet takes place in the packet's respective dispatcher function. Functions from packetserializer are used to convert from struct to byte buffer form that can then be transmitted on the wire. Errors from packetserializer bubble up here in the form of panics that have to be passed on to communicationhandler for conversion to go errors.
Package o3 handler functions for individual incoming packets. All functions here are called from communicationhandler. Functions in here use packetparser to parse packets into their respective structs. Any action required upon receiving a specific packet is then per- formed within its handler like updating nonces and storing keys in the session context. Errors in underlying functions bubble up to here in the form of panics and are passed on to communicationhandler for central conversion to go errors.
Package o3 functions to convert packets from byte buffers to go structs. These functions are called from packethandler only and their task is only conversion. Errors are bubbled up the chain as panics and will be converted to go errors further up the chain.
Index ¶
- func NewGrpID() [8]byte
- func NewMsgID() uint64
- func ReadPassword() ([]byte, error)
- type AddressBook
- func (a *AddressBook) Add(c ThreemaContact)
- func (a AddressBook) Contacts() map[string]ThreemaContact
- func (a AddressBook) Get(id string) (ThreemaContact, bool)
- func (a *AddressBook) Import(contacts [][]string) error
- func (a *AddressBook) ImportFrom(filename string) error
- func (a AddressBook) SaveTo(filename string) error
- type AudioMessage
- func (am AudioMessage) GetAudioData(sc SessionContext) ([]byte, error)
- func (am AudioMessage) GetPrintableContent() string
- func (mh AudioMessage) ID() uint64
- func (mh AudioMessage) PubNick() PubNick
- func (mh AudioMessage) Recipient() IDString
- func (mh AudioMessage) Sender() IDString
- func (am AudioMessage) Serialize() []byte
- func (am *AudioMessage) SetAudioData(filename string, sc SessionContext) error
- func (mh AudioMessage) Time() time.Time
- type DeliveryReceiptMessage
- func (dm DeliveryReceiptMessage) GetPrintableContent() string
- func (mh DeliveryReceiptMessage) ID() uint64
- func (dm DeliveryReceiptMessage) MsgID() uint64
- func (mh DeliveryReceiptMessage) PubNick() PubNick
- func (mh DeliveryReceiptMessage) Recipient() IDString
- func (mh DeliveryReceiptMessage) Sender() IDString
- func (dm DeliveryReceiptMessage) Serialize() []byte
- func (dm DeliveryReceiptMessage) Status() MsgStatus
- func (mh DeliveryReceiptMessage) Time() time.Time
- type Group
- type GroupImageMessage
- func (im GroupImageMessage) GetImageData(sc SessionContext) ([]byte, error)
- func (gmh GroupImageMessage) GroupCreator() IDString
- func (gmh GroupImageMessage) GroupID() [8]byte
- func (mh GroupImageMessage) ID() uint64
- func (mh GroupImageMessage) PubNick() PubNick
- func (mh GroupImageMessage) Recipient() IDString
- func (mh GroupImageMessage) Sender() IDString
- func (im GroupImageMessage) Serialize() []byte
- func (im *GroupImageMessage) SetImageData(filename string) error
- func (mh GroupImageMessage) Time() time.Time
- type GroupManageSetImageMessage
- func (im GroupManageSetImageMessage) GetImageData(sc SessionContext) ([]byte, error)
- func (gmh GroupManageSetImageMessage) GroupID() [8]byte
- func (mh GroupManageSetImageMessage) ID() uint64
- func (mh GroupManageSetImageMessage) PubNick() PubNick
- func (mh GroupManageSetImageMessage) Recipient() IDString
- func (mh GroupManageSetImageMessage) Sender() IDString
- func (im GroupManageSetImageMessage) Serialize() []byte
- func (im *GroupManageSetImageMessage) SetImageData(filename string) error
- func (mh GroupManageSetImageMessage) Time() time.Time
- type GroupManageSetMembersMessage
- func (gmh GroupManageSetMembersMessage) GroupID() [8]byte
- func (mh GroupManageSetMembersMessage) ID() uint64
- func (gmm GroupManageSetMembersMessage) Members() []IDString
- func (mh GroupManageSetMembersMessage) PubNick() PubNick
- func (mh GroupManageSetMembersMessage) Recipient() IDString
- func (mh GroupManageSetMembersMessage) Sender() IDString
- func (gmm GroupManageSetMembersMessage) Serialize() []byte
- func (mh GroupManageSetMembersMessage) Time() time.Time
- type GroupManageSetNameMessage
- func (gmh GroupManageSetNameMessage) GroupID() [8]byte
- func (mh GroupManageSetNameMessage) ID() uint64
- func (gmm GroupManageSetNameMessage) Name() string
- func (mh GroupManageSetNameMessage) PubNick() PubNick
- func (mh GroupManageSetNameMessage) Recipient() IDString
- func (mh GroupManageSetNameMessage) Sender() IDString
- func (gmm GroupManageSetNameMessage) Serialize() []byte
- func (mh GroupManageSetNameMessage) Time() time.Time
- type GroupMemberLeftMessage
- func (gmh GroupMemberLeftMessage) GroupCreator() IDString
- func (gmh GroupMemberLeftMessage) GroupID() [8]byte
- func (mh GroupMemberLeftMessage) ID() uint64
- func (mh GroupMemberLeftMessage) PubNick() PubNick
- func (mh GroupMemberLeftMessage) Recipient() IDString
- func (mh GroupMemberLeftMessage) Sender() IDString
- func (gml GroupMemberLeftMessage) Serialize() []byte
- func (mh GroupMemberLeftMessage) Time() time.Time
- type GroupTextMessage
- func (gmh GroupTextMessage) GroupCreator() IDString
- func (gmh GroupTextMessage) GroupID() [8]byte
- func (mh GroupTextMessage) ID() uint64
- func (mh GroupTextMessage) PubNick() PubNick
- func (mh GroupTextMessage) Recipient() IDString
- func (mh GroupTextMessage) Sender() IDString
- func (gtm GroupTextMessage) Serialize() []byte
- func (mh GroupTextMessage) Time() time.Time
- type IDString
- type ImageMessage
- func (im ImageMessage) GetImageData(sc SessionContext) ([]byte, error)
- func (im ImageMessage) GetPrintableContent() string
- func (mh ImageMessage) ID() uint64
- func (mh ImageMessage) PubNick() PubNick
- func (mh ImageMessage) Recipient() IDString
- func (mh ImageMessage) Sender() IDString
- func (im ImageMessage) Serialize() []byte
- func (im *ImageMessage) SetImageData(filename string, sc SessionContext) error
- func (mh ImageMessage) Time() time.Time
- type Message
- type MsgStatus
- type MsgType
- type PubNick
- type ReceivedMsg
- type SessionContext
- func (sc *SessionContext) ChangeGroupMembers(group Group, sendMsgChan chan<- Message) (err error)
- func (sc *SessionContext) CreateNewGroup(group Group, sendMsgChan chan<- Message) (groupID [8]byte, err error)
- func (sc *SessionContext) LeaveGroup(group Group, sendMsgChan chan<- Message) (err error)
- func (sc *SessionContext) RenameGroup(group Group, sendMsgChan chan<- Message) (err error)
- func (sc *SessionContext) Run() (chan<- Message, <-chan ReceivedMsg, error)
- func (sc *SessionContext) SendAudioMessage(recipient string, filename string, sendMsgChan chan<- Message) error
- func (sc *SessionContext) SendGroupTextMessage(group Group, text string, sendMsgChan chan<- Message) (err error)
- func (sc *SessionContext) SendImageMessage(recipient string, filename string, sendMsgChan chan<- Message) error
- func (sc *SessionContext) SendTextMessage(recipient string, text string, sendMsgChan chan<- Message) error
- type TextMessage
- func (mh TextMessage) ID() uint64
- func (mh TextMessage) PubNick() PubNick
- func (mh TextMessage) Recipient() IDString
- func (mh TextMessage) Sender() IDString
- func (tm TextMessage) Serialize() []byte
- func (tm TextMessage) String() string
- func (tm TextMessage) Text() string
- func (mh TextMessage) Time() time.Time
- type ThreemaContact
- type ThreemaID
- type ThreemaRest
- type TypingNotificationMessage
- func (mh TypingNotificationMessage) ID() uint64
- func (mh TypingNotificationMessage) PubNick() PubNick
- func (mh TypingNotificationMessage) Recipient() IDString
- func (mh TypingNotificationMessage) Sender() IDString
- func (tn TypingNotificationMessage) Serialize() []byte
- func (mh TypingNotificationMessage) Time() time.Time
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGrpID ¶
func NewGrpID() [8]byte
NewGrpID returns a randomly generated group ID (not cryptographically secure!) TODO: Why mrand?
func NewMsgID ¶
func NewMsgID() uint64
NewMsgID returns a randomly generated message ID (not cryptographically secure!) TODO: Why mrand?
func ReadPassword ¶
ReadPassword uses gopass to read a password from the command line without echoing it
Types ¶
type AddressBook ¶
type AddressBook struct {
// contains filtered or unexported fields
}
AddressBook is the register of ThreemaContacts
func (*AddressBook) Add ¶
func (a *AddressBook) Add(c ThreemaContact)
Add takes a ThreemaContact and adds it to the AddressBook
func (AddressBook) Contacts ¶
func (a AddressBook) Contacts() map[string]ThreemaContact
Contacts returns the map of id strings to contact structs of all contacts in the address book
func (AddressBook) Get ¶
func (a AddressBook) Get(id string) (ThreemaContact, bool)
Get returns a ThreemaContact to a given ID. It returns an empty ThreemaContact if no entry is found. The second parameter can be used to check if retrieval was successful
func (*AddressBook) Import ¶
func (a *AddressBook) Import(contacts [][]string) error
Import takes a two-dimensional slice of strings and imports it field by field into the address book. Fields have to be in the order "ID, Name, LPK" or the function will return an error
func (*AddressBook) ImportFrom ¶
func (a *AddressBook) ImportFrom(filename string) error
ImportFrom imports an address book stored in a CSV file
func (AddressBook) SaveTo ¶
func (a AddressBook) SaveTo(filename string) error
SaveTo stores the AddressBook in the file with the given name in CSV format
type AudioMessage ¶
type AudioMessage struct {
// contains filtered or unexported fields
}
AudioMessage represents an image message as sent e2e encrypted to other threema users
func NewAudioMessage ¶
func NewAudioMessage(sc *SessionContext, recipient string, filename string) (AudioMessage, error)
NewAudioMessage returns a ImageMessage ready to be encrypted
func (AudioMessage) GetAudioData ¶
func (am AudioMessage) GetAudioData(sc SessionContext) ([]byte, error)
GetAudioData return the decrypted audio, needs the recipients secret key
func (AudioMessage) GetPrintableContent ¶
func (am AudioMessage) GetPrintableContent() string
GetPrintableContent returns a printable represantion of an AudioMessage
func (AudioMessage) Serialize ¶
func (am AudioMessage) Serialize() []byte
Serialize returns a fully serialized byte slice of an AudioMessage
func (*AudioMessage) SetAudioData ¶
func (am *AudioMessage) SetAudioData(filename string, sc SessionContext) error
SetAudioData encrypts and uploads the audio. Sets the blob info in the ImageMessage. Needs the recipients public key.
type DeliveryReceiptMessage ¶
type DeliveryReceiptMessage struct {
// contains filtered or unexported fields
}
DeliveryReceiptMessage represents a delivery receipt as sent e2e encrypted to other threema users when a message has been received
func NewDeliveryReceiptMessage ¶
func NewDeliveryReceiptMessage(sc *SessionContext, recipient string, msgID uint64, msgStatus MsgStatus) (DeliveryReceiptMessage, error)
NewDeliveryReceiptMessage returns a TextMessage ready to be encrypted
func (DeliveryReceiptMessage) GetPrintableContent ¶
func (dm DeliveryReceiptMessage) GetPrintableContent() string
GetPrintableContent returns a printable represantion of a DeliveryReceiptMessage.
func (DeliveryReceiptMessage) MsgID ¶
func (dm DeliveryReceiptMessage) MsgID() uint64
MsgID returns the message id
func (DeliveryReceiptMessage) Serialize ¶
func (dm DeliveryReceiptMessage) Serialize() []byte
Serialize returns a fully serialized byte slice of a SeliveryReceiptMessage
func (DeliveryReceiptMessage) Status ¶
func (dm DeliveryReceiptMessage) Status() MsgStatus
Status returns the messages status
type GroupImageMessage ¶
type GroupImageMessage struct {
// contains filtered or unexported fields
}
GroupImageMessage represents a group image message as sent e2e encrypted to other threema users
func (GroupImageMessage) GetImageData ¶
func (im GroupImageMessage) GetImageData(sc SessionContext) ([]byte, error)
GetImageData return the decrypted Image needs the recipients secret key
func (GroupImageMessage) GroupCreator ¶
func (gmh GroupImageMessage) GroupCreator() IDString
GroupCreator returns the ID of the groups admin/creator as string
func (GroupImageMessage) GroupID ¶
func (gmh GroupImageMessage) GroupID() [8]byte
GroupID returns the ID of the group the message belongs to
func (GroupImageMessage) Serialize ¶
func (im GroupImageMessage) Serialize() []byte
Serialize returns a fully serialized byte slice of a GroupImageMessage
func (*GroupImageMessage) SetImageData ¶
func (im *GroupImageMessage) SetImageData(filename string) error
SetImageData encrypts the given image symmetrically and adds it to the message
type GroupManageSetImageMessage ¶
type GroupManageSetImageMessage struct {
// contains filtered or unexported fields
}
GroupManageSetImageMessage represents the message sent e2e-encrypted by a group's creator to all members to set the group image
func NewGroupManageSetImageMessages ¶
func NewGroupManageSetImageMessages(sc *SessionContext, group Group, filename string) []GroupManageSetImageMessage
NewGroupManageSetImageMessages returns a slice of GroupManageSetImageMessages ready to be encrypted
func (GroupManageSetImageMessage) GetImageData ¶
func (im GroupManageSetImageMessage) GetImageData(sc SessionContext) ([]byte, error)
GetImageData returns the decrypted Image
func (GroupManageSetImageMessage) Recipient ¶
func (mh GroupManageSetImageMessage) Recipient() IDString
func (GroupManageSetImageMessage) Serialize ¶
func (im GroupManageSetImageMessage) Serialize() []byte
Serialize returns a fully serialized byte slice of an ImageMessage
func (*GroupManageSetImageMessage) SetImageData ¶
func (im *GroupManageSetImageMessage) SetImageData(filename string) error
SetImageData encrypts the given image symmetrically and adds it to the message
type GroupManageSetMembersMessage ¶
type GroupManageSetMembersMessage struct {
// contains filtered or unexported fields
}
GroupManageSetMembersMessage represents the message sent e2e encrypted by a group's creator to all members
func NewGroupManageSetMembersMessages ¶
func NewGroupManageSetMembersMessages(sc *SessionContext, group Group) []GroupManageSetMembersMessage
NewGroupManageSetMembersMessages returns a slice of GroupManageSetMembersMessages ready to be encrypted
func (GroupManageSetMembersMessage) GroupID ¶
func (gmh GroupManageSetMembersMessage) GroupID() [8]byte
func (GroupManageSetMembersMessage) Members ¶
func (gmm GroupManageSetMembersMessage) Members() []IDString
Members returns a byte slice of IDString of all members contained in the message
func (GroupManageSetMembersMessage) PubNick ¶
func (mh GroupManageSetMembersMessage) PubNick() PubNick
func (GroupManageSetMembersMessage) Recipient ¶
func (mh GroupManageSetMembersMessage) Recipient() IDString
func (GroupManageSetMembersMessage) Sender ¶
func (mh GroupManageSetMembersMessage) Sender() IDString
func (GroupManageSetMembersMessage) Serialize ¶
func (gmm GroupManageSetMembersMessage) Serialize() []byte
Serialize returns a fully serialized byte slice of a GroupManageSetMembersMessage
type GroupManageSetNameMessage ¶
type GroupManageSetNameMessage struct {
// contains filtered or unexported fields
}
GroupManageSetNameMessage represents a group management messate to set the group name
func NewGroupManageSetNameMessages ¶
func NewGroupManageSetNameMessages(sc *SessionContext, group Group) []GroupManageSetNameMessage
NewGroupManageSetNameMessages returns a slice of GroupMenageSetNameMessages ready to be encrypted
func (GroupManageSetNameMessage) Recipient ¶
func (mh GroupManageSetNameMessage) Recipient() IDString
func (GroupManageSetNameMessage) Serialize ¶
func (gmm GroupManageSetNameMessage) Serialize() []byte
Serialize returns a fully serialized byte slice of a GroupManageSetNameMessage
type GroupMemberLeftMessage ¶
type GroupMemberLeftMessage struct {
// contains filtered or unexported fields
}
GroupMemberLeftMessage represents a group leaving message
func NewGroupMemberLeftMessages ¶
func NewGroupMemberLeftMessages(sc *SessionContext, group Group) []GroupMemberLeftMessage
NewGroupMemberLeftMessages returns a slice of GroupMemberLeftMessages ready to be encrypted
func (GroupMemberLeftMessage) GroupCreator ¶
func (gmh GroupMemberLeftMessage) GroupCreator() IDString
GroupCreator returns the ID of the groups admin/creator as string
func (GroupMemberLeftMessage) GroupID ¶
func (gmh GroupMemberLeftMessage) GroupID() [8]byte
GroupID returns the ID of the group the message belongs to
func (GroupMemberLeftMessage) Serialize ¶
func (gml GroupMemberLeftMessage) Serialize() []byte
Serialize returns a fully serialized byte slice of a GroupMemberLeftMessage
type GroupTextMessage ¶
type GroupTextMessage struct { TextMessage // contains filtered or unexported fields }
GroupTextMessage represents a group text message as sent e2e encrypted to other threema users
func NewGroupTextMessages ¶
func NewGroupTextMessages(sc *SessionContext, group Group, text string) ([]GroupTextMessage, error)
NewGroupTextMessages returns a slice of GroupMemberTextMessages ready to be encrypted
func (GroupTextMessage) GroupCreator ¶
func (gmh GroupTextMessage) GroupCreator() IDString
GroupCreator returns the ID of the groups admin/creator as string
func (GroupTextMessage) GroupID ¶
func (gmh GroupTextMessage) GroupID() [8]byte
GroupID returns the ID of the group the message belongs to
func (GroupTextMessage) Serialize ¶
func (gtm GroupTextMessage) Serialize() []byte
Serialize : returns byte representation of serialized group text message
type IDString ¶
type IDString [8]byte
IDString is a Threema ID string consisting of capital letters and digits.
func NewIDString ¶
NewIDString creates an IDString from the input string. There is no input verification. Callers have to ensure that ids complies with Threema's ID rules.
type ImageMessage ¶
type ImageMessage struct {
// contains filtered or unexported fields
}
ImageMessage represents an image message as sent e2e encrypted to other threema users
func NewImageMessage ¶
func NewImageMessage(sc *SessionContext, recipient string, filename string) (ImageMessage, error)
NewImageMessage returns a ImageMessage ready to be encrypted
func (ImageMessage) GetImageData ¶
func (im ImageMessage) GetImageData(sc SessionContext) ([]byte, error)
GetImageData return the decrypted Image needs the recipients secret key
func (ImageMessage) GetPrintableContent ¶
func (im ImageMessage) GetPrintableContent() string
GetPrintableContent returns a printable represantion of a ImageMessage.
func (ImageMessage) Serialize ¶
func (im ImageMessage) Serialize() []byte
Serialize returns a fully serialized byte slice of an ImageMessage
func (*ImageMessage) SetImageData ¶
func (im *ImageMessage) SetImageData(filename string, sc SessionContext) error
SetImageData encrypts and uploads the image. Sets the blob info in the ImageMessage. Needs the recipients public key.
type Message ¶
type Message interface { //Sender returns the message's sender ID Sender() IDString //Serialize returns a fully serialized byte slice of the message Serialize() []byte // contains filtered or unexported methods }
Message representing the various kinds of e2e ecrypted messages threema supports
type MsgStatus ¶
type MsgStatus uint8
MsgStatus represents the single-byte status field of DeliveryReceiptMessage
const ( MSGDELIVERED MsgStatus = 0x1 //indicates message was received by peer MSGREAD MsgStatus = 0x2 //indicates message was read by peer MSGAPPROVED MsgStatus = 0x3 //indicates message was approved (thumb up) by peer MSGDISAPPROVED MsgStatus = 0x4 //indicates message was disapproved (thumb down) by peer )
MsgStatus mock enum
type MsgType ¶
type MsgType uint8
MsgType determines the type of message that is sent or received. Users usually won't use this directly and rather use message generator functions.
const ( TEXTMESSAGE MsgType = 0x1 //indicates a text message IMAGEMESSAGE MsgType = 0x2 //indicates a image message AUDIOMESSAGE MsgType = 0x14 //indicates a audio message POLLMESSAGE MsgType = 0x15 //indicates a poll message LOCATIONMESSAGE MsgType = 0x16 //indicates a location message FILEMESSAGE MsgType = 0x17 //indicates a file message GROUPTEXTMESSAGE MsgType = 0x41 //indicates a group text message GROUPIMAGEMESSAGE MsgType = 0x43 //indicates a group image message GROUPSETMEMEBERSMESSAGE MsgType = 0x4A //indicates a set group member message GROUPSETNAMEMESSAGE MsgType = 0x4B //indicates a set group name message GROUPMEMBERLEFTMESSAGE MsgType = 0x4C //indicates a group member left message GROUPSETIMAGEMESSAGE MsgType = 0x50 //indicates a group set image message DELIVERYRECEIPT MsgType = 0x80 //indicates a delivery receipt sent by the threema servers TYPINGNOTIFICATION MsgType = 0x90 //indicates a typing notifiaction message )
MsgType mock enum
type PubNick ¶
type PubNick [32]byte
PubNick is the representation of Threema's nickname field users can set
func NewPubNick ¶
NewPubNick creates a new PubNick from the input string. Will only take the first 32 bytes of input
type ReceivedMsg ¶
ReceivedMsg is a type used to transmit messages via a channel
type SessionContext ¶
type SessionContext struct { ID ThreemaID ErrorChan chan error // contains filtered or unexported fields }
SessionContext is a passable structure containing all established keys and nonces required for communication with the server
func NewSessionContext ¶
func NewSessionContext(ID ThreemaID) SessionContext
NewSessionContext returns a new SessionContext
func (*SessionContext) ChangeGroupMembers ¶
func (sc *SessionContext) ChangeGroupMembers(group Group, sendMsgChan chan<- Message) (err error)
ChangeGroupMembers Sends a message with the new group member list to all members
func (*SessionContext) CreateNewGroup ¶
func (sc *SessionContext) CreateNewGroup(group Group, sendMsgChan chan<- Message) (groupID [8]byte, err error)
CreateNewGroup Creates a new group and notifies all members
func (*SessionContext) LeaveGroup ¶
func (sc *SessionContext) LeaveGroup(group Group, sendMsgChan chan<- Message) (err error)
LeaveGroup Sends a message to all members telling them the sender left the group
func (*SessionContext) RenameGroup ¶
func (sc *SessionContext) RenameGroup(group Group, sendMsgChan chan<- Message) (err error)
RenameGroup Sends a message with the new group name to all members
func (*SessionContext) Run ¶
func (sc *SessionContext) Run() (chan<- Message, <-chan ReceivedMsg, error)
Run receives all enqueued Messages and writes the results to the channel passed as argument
func (*SessionContext) SendAudioMessage ¶
func (sc *SessionContext) SendAudioMessage(recipient string, filename string, sendMsgChan chan<- Message) error
SendAudioMessage sends a Audio Message to the specified ID Enqueued messages will be received, not acknowledged and discarded Works with various audio formats threema uses some kind of mp4 but mp3 works fine
func (*SessionContext) SendGroupTextMessage ¶
func (sc *SessionContext) SendGroupTextMessage(group Group, text string, sendMsgChan chan<- Message) (err error)
SendGroupTextMessage Sends a text message to all members
func (*SessionContext) SendImageMessage ¶
func (sc *SessionContext) SendImageMessage(recipient string, filename string, sendMsgChan chan<- Message) error
SendImageMessage sends a Image Message to the specified ID Enqueued messages will be received, not acknowledged and discarded
func (*SessionContext) SendTextMessage ¶
func (sc *SessionContext) SendTextMessage(recipient string, text string, sendMsgChan chan<- Message) error
SendTextMessage sends a Text Message to the specified ID Enqueued messages will be received, not acknowledged and discarded
type TextMessage ¶
type TextMessage struct {
// contains filtered or unexported fields
}
TextMessage represents a text message as sent e2e encrypted to other threema users
func NewTextMessage ¶
func NewTextMessage(sc *SessionContext, recipient string, text string) (TextMessage, error)
NewTextMessage returns a TextMessage ready to be encrypted
func (TextMessage) Serialize ¶
func (tm TextMessage) Serialize() []byte
Serialize returns a fully serialized byte slice of a TextMessage
func (TextMessage) String ¶
func (tm TextMessage) String() string
String returns the message text as string
type ThreemaContact ¶
ThreemaContact is the core contact type, comprising of an ID, a long-term public key, and an optional Name
func (ThreemaContact) String ¶
func (tc ThreemaContact) String() string
type ThreemaID ¶
type ThreemaID struct { ID IDString Nick PubNick LSK [32]byte Contacts AddressBook Groups map[IDString]map[[8]byte]Group // Groups[GroupCreator][GroupID] }
ThreemaID is the core ID type. It contains the 8-byte ID, its corresponding 32-byte 256-bit private key, and a list of known Contacts.
func LoadIDFromFile ¶
LoadIDFromFile will open a Threema identity backup file and parse its base32-encoded encrypted ID using the provided password into a ThreemaID
func NewThreemaID ¶
func NewThreemaID(id string, lsk [32]byte, contacts AddressBook) (ThreemaID, error)
NewThreemaID creates a ThreemaID from a given id strnig and a 256-bit private key
func ParseIDBackupString ¶
ParseIDBackupString parses the base32-encoded encrypted ID string contained in a threema backup.
func (ThreemaID) GetPubKey ¶
GetPubKey generates the PK on the fly, that's ok because it's rarely needed
func (ThreemaID) SaveToFile ¶
SaveToFile exports a ThreemaID to the given filename encrypted with password. It uses Threema's identity export format so the backup can be re-imported both here and in the app. Note that the result will always look different even if using the same password and ID because the salt is re-generated with each backup.
type ThreemaRest ¶
type ThreemaRest struct {
// contains filtered or unexported fields
}
ThreemaRest provides convenient wrappers for task that require the use of Threemas REST API
func (ThreemaRest) CreateIdentity ¶
func (tr ThreemaRest) CreateIdentity() (ThreemaID, error)
CreateIdentity generates a new NaCl Keypair, registers it with the Three servers and returns the assigned ID
func (ThreemaRest) GetContactByID ¶
func (tr ThreemaRest) GetContactByID(thIDString IDString) (ThreemaContact, error)
GetContactByID returns a ThreemaContact containing the public key as queried from the Threema servers
type TypingNotificationMessage ¶
type TypingNotificationMessage struct {
// contains filtered or unexported fields
}
TypingNotificationMessage represents a typing notifiaction message
func (TypingNotificationMessage) Recipient ¶
func (mh TypingNotificationMessage) Recipient() IDString
func (TypingNotificationMessage) Serialize ¶
func (tn TypingNotificationMessage) Serialize() []byte
Serialize returns a fully serialized byte slice of a TypingNotificationMessage