CloudServices/Notifications/Specification/POSTOffice: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
Line 31: Line 31:
</li>
</li>


<li>Ciphertext is the payload encrypted with the encryption key using AES-256-CBC and base64 encoded. For example:
<li>Ciphertext is a JSON serialization encrypted with the encryption key using AES-256-CBC and base-64 encoded. The contents of the payload differ based on the type of message. For example, the payload of a standard notification will look like the following:
<pre>
<pre>
{
{
   "type":"display",
   "type":"notification",
   "title":"...",
   "title":"...",
   "body":"...",
   "body":"...",

Revision as of 20:45, 14 April 2011

The POST Office supports a very simple REST API allowing web apps to send notifications will relatively little effort. It forwards the notifications to the Message Broker on behalf of the web apps.

Web App Sends Notification

  1. Web app sends notification to POST Office.
    W: POST /1.0/notification HTTP/1.1
    W:
    W: {
      "body":"{\"token\":\"T in Base 64\",...",
      "HMAC":"BASE64=="
      }
    P: HTTP/1.1 202 ACCEPTED
    
  2. Body is a JSON serialization of
     { 
         "token": "T in Base 64",
         "timestamp": ######## (in seconds UTC), // Optional,
         "ttl": ######## (in seconds), // Optional
         "ciphertext": "BASE64==",
         "IV": "BASE64==",
     }
    
  3. Ciphertext is a JSON serialization encrypted with the encryption key using AES-256-CBC and base-64 encoded. The contents of the payload differ based on the type of message. For example, the payload of a standard notification will look like the following:
    {
      "type":"notification",
      "title":"...",
      "body":"...",
      "url":"http://foobar.com"
    }