Documentation
¶
Index ¶
- Constants
- type Envelope
- type Headers
- type Message
- func New(from string, to string, content []byte, contentType string, ...) (*Message, error)
- func NewBroadcast(from string, to string, content []byte, contentType string, ...) (*Message, error)
- func UnmarshalAndVerifyMessageFromCBOR(b []byte) (*Message, error)
- func UnmarshalMessageFromCBOR(b []byte) (*Message, error)
Constants ¶
const (
// Messages which are older than a day should be ignored
MESSAGE_TTL = ma.MESSAGE_DEFAULT_TTL
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Envelope ¶ added in v0.1.0
Bask the encrypted message and the encrypted symmetric key in a CBOR envelope.
func UnmarshalAndVerifyEnvelopeFromCBOR ¶ added in v0.4.1
func UnmarshalEnvelopeFromCBOR ¶ added in v0.2.1
Takes the envelope as a byte array and returns a pointer to an Envelope struct Basically this is what you do with a receieved message envelope, eg. in an Open() function.
type Headers ¶ added in v0.1.0
type Headers struct { // Version of the message format Version string // Unique identifier of the message ID string `cbor:"id"` // MIME type of the message MimeType string `cbor:"mimeType"` // Creation time of the message in seconds since Unix epoch Created int64 `cbor:"keyasint64"` // Expiration time of the message in seconds since Unix epoch Expires int64 `cbor:"keyasint64"` // Sender of the message From string `cbor:"from"` // Recipient of the message To string `cbor:"to"` // MIME type of the message body ContentType string `cbor:"contentType"` // Hexadecimal string representation of the SHA-256 hash of the message body Signature []byte `cbor:"signature"` }
This struct mimicks the Headers format, but it's *not* Headers. It should enable using Headers later, if that's a good idea. NB! Content is *not* a part of the headers
func (*Headers) CreatedTime ¶ added in v0.1.0
func (*Headers) ExpiresTime ¶ added in v0.1.0
type Message ¶
type Message struct { // Version of the message format Version string // Unique identifier of the message ID string `cbor:"id"` // MIME type of the message MimeType string `cbor:"mimeType"` // Creation time of the message in seconds since Unix epoch Created int64 `cbor:"keyasint64"` // Expiration time of the message in seconds since Unix epoch Expires int64 `cbor:"keyasint64"` // Sender of the message From string `cbor:"from"` // Recipient of the message To string `cbor:"to"` // MIME type of the message body ContentType string `cbor:"contentType"` // Hexadecimal string representation of the SHA-256 hash of the message body Content []byte `cbor:"content"` // Signature of the message headers. NB! This includes the ContentHash field, // which can be used to verify the integrity of the message body. Signature []byte `cbor:"signature"` }
This struct mimicks the Message format, but it's *not* Message. It should enable using Message later, if that's a good idea.
func New ¶
func New( from string, to string, content []byte, contentType string, priv_key *ed25519.PrivateKey) (*Message, error)
New creates a new Message instance
func NewBroadcast ¶ added in v0.4.0
func UnmarshalAndVerifyMessageFromCBOR ¶ added in v0.4.1
func UnmarshalMessageFromCBOR ¶ added in v0.4.1
UnmarshalMessageFromCBOR unmarshals a Message from a CBOR byte slice and verifies the signature