Subject: [Json] Wrapped objects

From: Phillip Hallam-Baker <[email-masked]>
Date: Fri, 27 May 2016 09:43:46 -0400

One of the ugliest features in Assinine.1 is Macros. The mechanism is
horrible. But it does come in very handy when you want to do encryption or
signature.

Since I have written a JSON based PKI, I am very interested in having such
features and keep the ability to do type checking. Consider the following

CurrentProfile Class
    Master SignedObject
    Devices List SignedObject
    Applications List SignedObject

Obviously the three slots require the lists to contain signed objects of
specific types. But I can't express that right now.

I would like to be able to integrate JOSE signing and encryption into the
serializer/deserializer and have the code do the work of unwrapping and
wrapping signed and encrypted blobs for me. And for that to happen I have
to be able to express what type of data the blobs contain.

The serializaion is going to look something like

{ "CurrentProfile" : {
   "Master" : {
       "Data" : "base64 deadbeef", ...}
   .... } }

"base64 deadbeef" =

{ "ProfileMaster" : {  .... } }

My current plan is to introduce parameterized types into the schema for
handling these wrapped objects. So my schema now becomes:

CurrentProfile Class
    Master SignedObject <MasterProfile>
    Devices List <SignedObject <DeviceProfile>>
    Applications List <SignedObject <ApplicationProfile>>

I haven't yet decided on whether the <> syntax is desirable or not. Or for
that matter how to map it to JSON-X.

CurrentProfile Class
    Master SignedObject
        Of MasterProfile
    Devices List
        Of SignedObject
           Of DeviceProfile
    Applications List
        Of SignedObject
            Of ApplicationProfile