Skip to content

MessageData

Äkwav edited this page Oct 1, 2019 · 2 revisions

When commands are sent they take the form of MessageData.

Usually it is serialized via MessagePack, but that is hard to read so here we use json. A serialized MessageData looks like this:

{
    "senderId":[1,5],
    "receiverId":[2,7],
    "slug":"msg",
    "data":"[encrypted] hi",
    "i":29,
    "headers":[{"Authorization=Token"}]
    "x":"signature"
}
  • the senderId is the one sending the message, he has to be authorized.
  • the receiverId (SourceReference) is the one to who the message should be delivered
  • slug is the unique indentifier
  • data is some payload
  • headers contains additional information about the message like Authorization (type 1)
  • i is a counter (may include the time)
  • x is the signature created by signing everything else with the secretKey of the Resource behind senderId. If that Resource doesn't have a KeyPair this field is set to null.

Headers

  • Authorization (Id:1) may contain a Token that Authorizes the sender to execute the command.

Singature

Is created by signing everything else with the secretKey of the Resource behind senderId. If that Resource doesn't have a KeyPair this field is set to null. If a publicKey is known but the field isn't set the command has to be dropped.

Index

Has to be incremented by at least one every message.

Slug

Is an unique identifier for the command that should be executed on the receivers side.

Clone this wiki locally