Mesh Memory
Each server offers a public address space where applications can read and write information. An application selects a long random address name and writes information to it. Any other program that knows the address name can then read the information.
Writing to the address "myRandomName"
/mesh/memory/write/public/myRandomName?Hello-This-Is-Alice
Once written, any other application can then read this message
/mesh/memory/read/public/myRandomName
Server returns "Hello-This-Is-Alice"
As the information is shared, clients reading mesh memory should take excessive care to verify both the structure and content of the returned data.
The server does not enforce any special requirements on the information written. Whatever Content-Type is used during the write operation will be returned for the read.
Server Operation
- For public messages the server makes no guarantees about whether messages can be stored or how long they will be stored.
- The server may impose maximum lengths of stored information.
- Servers will apply various rate limiting controls so that applications cannot simply scan billions of possible addresses trying to find valid data.
- You should use SSL connections when reading and writing information.
- Public messages are totally public. They may be shared with third parties without warning.
- You may store encrypted data
Mesh Queue
A Mesh Queue is an extension to mesh memory where a single address can store multiple messages that can be retrieved individually. This might be used by a device that needs to report multiple records, such as temperature readings every few minutes, and allows servers to retrieve all the records at a later stage
Writing two messages to the queue "myFirstQueueHH76qe34"
/mesh/queue/add/public/myFirstQueueHH76qe34?temp=34.3,Name=Bob /mesh/queue/add/public/myFirstQueueHH76qe34?temp=18.7,Name=Alice
Once written, any other application can then read this message
/mesh/queue/read/public/myFirstQueueHH76qe34
Server returns "temp=34.3,Name=Bob"
Mesh Table
A Mesh Table provides a distributed table like structure. The table structure is
- Table
- Row Header
- Written from IP
- Row Data (sub packet)
- Row Header
A two row table with columns A and B might appear as
<ARAY> <ROWH> <IPv4>192.192.0.0</IPv4> <DATA> <A>123</A> <B>Welcome</B> </DATA> </ROWH> <ROWH> <IPv4>10.20.0.0</IPv4> <DATA> <A>9981</A> <B>Hello</B> </DATA> </ROWH> </ARAY>
Rows are added with /mesh/table/insert/public/myTable123
Rows are read with
/mesh/table/read/public/myTable123
As reading can take many forms, the actual format is /mesh/table/read [ ,arg ...] /public/myTable123 [ ? query ] where arg can be from the following list
- json. Return data in JSON format. This is the default format
- xml. Return data as XML
- noheader. Do not return <ROWH> components, just return an ARAY of DATA.
/mesh/table/read,json,noheader/public/myTable123
Practical Use
To use mesh memory for sharing information across a public namespace you can use a private password and HMAC signing. Mesh memory itself does not control how you select the addresses to be read and written it simply provides a large addressable space. The large addressable space does not provide security for any address, it simply ensures that the chance of conflict for a random address is very low. You must encrypt or otherwise validate data read from mesh memory.
- Simple format: /mesh/memory/write/public/MySensor
- Simple clear password format: /mesh/memory/write/public/myrandomPassword/MySensor
- Using changing keys and URI encode
- Append required name and some changing information. eg "MySensor"+date() resulting in "MySensor28May2017"
- Encrypt this string using a shared password. "MySensor28May2017" becomes "fj38@j*Ff93\5 df%Z"
- Convert the encrypted value using URIencoding
- Using a password and HMAC256
- Append required name and passwrod. eg "MySensor"+"MySuperSecret" resulting in "MySensorMySuperSecret"
- Apply HMAC with SHA256 to this, resulting in a 256 binary hash.
- Convert the binary hash to a URL using Base64 encoding and URIencoding, or a URI safe form of Base64 encoding.