messaging

package
v0.0.0-...-564440e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 24, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bounce

func Bounce(errorCode int, info *messageInfo, extraData *map[string]string)

Bounce() is used to send delivery reports to local users

func DecryptRecipientHeader

func DecryptRecipientHeader(header string) (string, error)

DecryptRecipient assumes that the file passed to it has a recipient section which can be decrypted by the servers Primary Encryption Key. This implies that the server is the destination for the message, so it returns the workspace ID of the recipient.

func GetOrgEncryptionKey

func GetOrgEncryptionKey(domain string) (ezn.CryptoString, error)

GetOrgEncryptionKey obtains an organization's encryption key and returns it as a CryptoString

func GetOrgVerificationKey

func GetOrgVerificationKey(domain string) (ezn.CryptoString, error)

GetOrgEncryptionKey obtains an organization's verification key and returns it as a CryptoString

func InitDelivery

func InitDelivery()

func IsWorkspaceRegistered

func IsWorkspaceRegistered(wid string) bool

IsWorkspaceRegisters checks to see if a client has been monitoring the workspace

func LastWorkspaceUpdate

func LastWorkspaceUpdate(wid string) int64

Gets the UTC UNIX timestamp of the last new message notification for the workspace. If none has occurred, then -1 in returned.

func PushMessage

func PushMessage(sender string, recipientDomain string, path string)

PushMessage enqueues a message for delivery

func RegisterWorkspace

func RegisterWorkspace(wid string) error

RegisterWorkspace ensures that the workspace update list has a specific workspace ID. If it has already been registered, nothing happens.

func ShutdownDelivery

func ShutdownDelivery()

func UpdateWorkspace

func UpdateWorkspace(wid string, timestamp int64) error

UpdateWorkspace updates the timestamp for the last new message for a workspace

Types

type Attachment

type Attachment struct {
	Name string
	Type string
	Data string
}

type Envelope

type Envelope struct {
	Type       string
	Version    string
	Receiver   RecipientInfo
	Sender     SenderInfo
	Date       string
	PayloadKey string
}

type MsgBody

type MsgBody struct {
	From        string
	To          string
	Date        string
	ThreadID    string
	Subject     string
	Body        string
	Attachments []Attachment
}

type RecipientInfo

type RecipientInfo struct {
	// To contains the full recipient address
	To string

	// Sender contains only the domain of origin
	SenderDomain string
}

type SealedEnvelope

type SealedEnvelope struct {
	Type       string
	Version    string
	Receiver   string
	Sender     string
	Date       string
	PayloadKey string
}

func ReadMessageHeader

func ReadMessageHeader(localPath string) (SealedEnvelope, error)

ReadMessageHeader loads from a file the message data up to, but not including, the payload and returns a SealedEnvelope instance so that it may be processed for delivery

type SenderInfo

type SenderInfo struct {
	// From contains the full sender address
	From string

	// Receiver contains only the destination's domain
	RecipientDomain string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL