Messages

All data requests in a DWN are made in Message JSON objects. These messages contain all data required to process a request in a DWN network including execution parameters, signing/encryption information, signatures, and authorization material. Messages can be modified or changed to fit the needs of a developer provided the data stored follows the Message Object’s format and has an accompanied Schema to store the data.

Basic Message Object(Without Signing or Authorization)

 {  // Request Object
  "messages": [  // Message Objects
    {
      "recordId": GENERATED_CID_STRING,
      "data": BASE64URL_STRING,
      "descriptor": {
        "method": INTERFACE_METHOD_STRING,
        "dataCid": DATA_CID_STRING,
        "dataFormat": DATA_FORMAT_STRING,
      },
      "processing": {
        "nonce": "4572616e48616d6d65724c61686176",
        "author": "did:example:alice",
        "recipient": "did:example:bob",
      }
    },
    {...}
  ]
}

In order to enable data replication features for a DWN, all data listed above must be included in a Message Object. More information on the specific formatting of Message Objects can be found herearrow-up-right.

Signed Data

If the Message is to be attested by the signer(the owner of the Node) then it must be formatting as the following:

This object must include an attestation property that contains a signature and payload. More information on this object’s formatting can be found herearrow-up-right

Authorization

Messages may require authorization if the DWN owner set permissions to require it. A message must include an authorization property that is a JSON Web Signature(JWS) if it requires authorization. It's format is as follows:

Unlike the basic Message Object, the authorization property includes payload and signature data in order to properly process a Message. More information on this object’s formatting can be found herearrow-up-right.

Encrypted Data

All encrypted Messages must include the following:

The additional information under "data" is used for message encryption and utilizes JSON Web Encryption. More information on message encryption can be found herearrow-up-right

Last updated