message

package
v0.0.0-...-a6f6231 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ENCRYPTED_HTML ContentType = "enc/html/text" // encrypted HTML content
	MIME           ContentType = "mime"          // MailioMime (normally encrypted and signed on receiving by the mailio server)

	SOURCE_IPFS ContentSource = "ipfs" // content is stored in IPFS
	SOURCE_S3   ContentSource = "s3"   // content is stored in S3
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentRef

type ContentRef struct {
	Filename  string `json:"filename,omitempty"`             // file name (optional)
	Hash      string `json:"hash,omitempty"`                 // base64 md5 hash of the file (quick check that file hasn't changed)
	Reference string `json:"reference" validate:"required"`  // required
	Size      int64  `json:"size" validate:"required,min=1"` // file size (at least 1 byte)
	AesKey    string `json:"aesKey,omitempty"`               // base64 (AES GCM key to unlock content)
}

type ContentSource

type ContentSource string

type ContentType

type ContentType string

type Envelope

type Envelope struct {
	ID                string        `json:"id" validate:"required"`                                   // message id
	SenderPublicKey   string        `json:"senderPublicKey,omitempty"`                                // base64 senders public key
	ReceiverPublicKey string        `json:"receiverPublicKey,omitempty"`                              // base64 receivers public key
	MessageID         string        `json:"messageId" validate:"required,min=3"`                      // RFC2822 message id
	ParentMessageID   string        `json:"parentMessageId,omitempty"`                                // Parent RFC2822 message id
	OwnerAddressHex   string        `json:"ownerAddressHex" validate:"required,len=42"`               // the owner of this message on the current system (usually receivers mailio address in hex format)
	Read              bool          `json:"read"`                                                     // if message has been read by the receiver
	Folder            string        `json:"folder" validate:"required"`                               // folder message resides in
	ContentType       ContentType   `json:"contentType" validate:"required,oneof=enc/html/text mime"` // content type of the message
	ContentRef        *string       `json:"contentRef,omitempty"`                                     // base64 encrypted reference to a content object. Required BoxSharedKey to decrypt
	ContentSource     ContentSource `json:"contentSource,omitempty"`                                  // source of the content (IPFS, AMAZON S3, ...)
	BoxSharedKey      string        `json:"boxSharedKey,omitempty"`                                   // base64 (sealed curve25519+xsalsa20+poly1305 encryption key to unbox content and attachment AES CGM keys. First 24 bytes is nonce)
	AttachmentRefs    []*string     `json:"attachmentRefs,omitempty"`                                 // base64 message attachment references (encrypted pointers to files on a file system. Rquired BoxSharedKey to decrypt)
	Created           int64         `json:"created" validate:"required"`                              // message creation timestamp (unix epoch miliseconds)
	Modified          int64         `json:"modified,omitempty"`                                       // message modification timestamp (unix epoch miliseconds)
}

Basic message envelope internal structure (compatible with golang validator) In case content type HTML or PLAIN, Both //ContentRef and //AttachmentRefs are in the shape of ContentRef struct In case content type MIME, //ContentRef is in the shape of MailioMime struct

type EnvelopeMime

type EnvelopeMime interface {
	// in case content is of type MIME
	ParseMime(reader io.Reader) (*MailioMime, error)
}

mailio message parser

type MailioMime

type MailioMime struct {
	MimeObject
	Subject       string      `json:"subject,omitempty"`      // optional mime subject
	Sender        string      `json:"sender"`                 // sender email
	ReplyTo       string      `json:"replyTo,omitempty"`      // reply-to mime field
	MessageID     string      `json:"messageId"`              // mime message id
	DateAsString  string      `json:"dateAsString,omitempty"` // date (RFC ... )
	To            []string    `json:"to"`                     // to email addresses
	Cc            []*string   `json:"cc,omitempty"`           // optinal cc addresses
	Bcc           []*string   `json:"bcc,omitempty"`          // list of bcc email addresses
	AllRecipients []*string   `json:"allRecipients"`          // list of all recipinets on current system
	MimePart      *MimeObject `json:"mimePart,omitempty"`     // single mime part
	Body          MimeObject  `json:"body"`                   // email body
	Date          string      `json:"date,omitempty"`         // string date
}

mailio mime message (SMTP support)

type MimeHeader

type MimeHeader struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

mime header

type MimeObject

type MimeObject struct {
	ContentType        string        `json:"contentType"`
	ContentDisposition string        `json:"contentDisposition,omitempty"`
	Headers            []*MimeHeader `json:"headers,omitempty"`
}

common mime parts

Jump to

Keyboard shortcuts

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