Thursday, February 18, 2021

Creating Schema with Ceramic

 ceramic create tile --content ' {                                            
     "$schema": "http://json-schema.org/draft-07/schema#",
    "title": "Reward",
    "type": "object",
    "properties": {
       "title": { "type": "string" },
       "message": { "type": "string" }
     },
     "required": [
       "message",
       "title"
     ]
}'
DocID(kjzl6cwe1jw149garm97dhntc1en53c6o0xywsq5dcmkigdvfro10vem5qexpqx)
{
  "type": "object",
  "title": "Reward",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "required": [
    "message",
    "title"
  ],
  "properties": {
    "title": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  }
}

ceramic commits kjzl6cwe1jw149garm97dhntc1en53c6o0xywsq5dcmkigdvfro10vem5qexpqx
[
  "k3y52l7qbv1fryb7wke9gfxlclm04k7qneupk989y6xshv8ink4qva7bxkru7r3eo"
]

ceramic create tile --content '{
    "title": "My first document with schema",
    "message": "Hello World"
  }' --schema k3y52l7qbv1fryb7wke9gfxlclm04k7qneupk989y6xshv8ink4qva7bxkru7r3eo
DocID(kjzl6cwe1jw1480d7lmk514goynopqjtdhv2j3b4lz9iec6c0nd9673qgcfx1yr)
{
  "title": "My first document with schema",
  "message": "Hello World"
}


------------------------------------------------------------------------------------------------------------------------
ceramic create tile --content '
{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "description": "A basic DID document",
   "type" : "object",
   "title" : "basicDIDdocument",
   "properties" : {
     "@context" : {
       "type" : "string"
     },
     "id" : {
        "type" : "string"
     },
     "authentication" : {
         "type": "array",
         "items" : {
            "type" : "object",
            "properties" : {
               "id" : {
                   "type" : "string"
                },
               "type" : {
                  "type" : "string"
               },
               "controller" : {
                  "type" : "string"
               },
               "publicKeyKwk" : {
                  "type" : "object",
                     "properties" : {
                       "kty" : {
                         "type" : "string"
                       },
                       "crv" : {
                          "type" : "string"
                       },
                       "x" : {
                          "type" : "string"
                       },
                       "y" : {
                         "type" : "string"
                       }
                     }
               }
            }
        }
    }
  }
}'
DocID(kjzl6cwe1jw14bngwjeykqkv48z5d785bjad25dic9fp7ul5hhyk9pbngjkwmo9)
{
  "type": "object",
  "title": "basicDIDdocument",
  "$schema": "http://json-schema.org/draft-07/schema#",
  "properties": {
    "id": {
      "type": "string"
    },
    "@context": {
      "type": "string"
    },
    "authentication": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "type": {
            "type": "string"
          },
          "controller": {
            "type": "string"
          },
          "publicKeyKwk": {
            "type": "object",
            "properties": {
              "x": {
                "type": "string"
              },
              "y": {
                "type": "string"
              },
              "crv": {
                "type": "string"
              },
              "kty": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  },
  "description": "A basic DID document"
}

ceramic commits kjzl6cwe1jw14bngwjeykqkv48z5d785bjad25dic9fp7ul5hhyk9pbngjkwmo9
[
  "k3y52l7qbv1fryquw7e2dvh0da7ty5vdxu15ova82f73nbtif0fps502utn8o18g0"
]


ceramic create tile --content '
{
  "@context": "https://www.w3.org/ns/did/v1",
  "id": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
  "authentication": [{
    "id": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB#keys-1",
    "type": "JsonWebKey2020",
    "controller": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
     "publicKeyJwk": {
        "kty": "EC",
        "crv": "P-256",
        "x": "F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
        "y": "1CD36717B8AC5E4FEA8AD23DC8D0783C2318EE4AD7A80DB6E0026AD0B072A24F"
    }
  }]
} '  --schema k3y52l7qbv1fryquw7e2dvh0da7ty5vdxu15ova82f73nbtif0fps502utn8o18g0


ceramic create tile --content '
> {
>   "@context": "https://www.w3.org/ns/did/v1",
>   "id": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
>   "authentication": [{
>     "id": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB#keys-1",
>     "type": "JsonWebKey2020",
>     "controller": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
>      "publicKeyJwk": {
>         "kty": "EC",
>         "crv": "P-256",
>         "x": "F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
>         "y": "1CD36717B8AC5E4FEA8AD23DC8D0783C2318EE4AD7A80DB6E0026AD0B072A24F"
>     }
>   }]
> } '  --schema k3y52l7qbv1fryquw7e2dvh0da7ty5vdxu15ova82f73nbtif0fps502utn8o18g0
DocID(kjzl6cwe1jw149ze5o87d55ooh4wmnwwrk0n0q2ng7a2im57ovp7njszqnlao56)
{
  "id": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
  "@context": "https://www.w3.org/ns/did/v1",
  "authentication": [
    {
      "id": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB#keys-1",
      "type": "JsonWebKey2020",
      "controller": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
      "publicKeyJwk": {
        "x": "F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
        "y": "1CD36717B8AC5E4FEA8AD23DC8D0783C2318EE4AD7A80DB6E0026AD0B072A24F",
        "crv": "P-256",
        "kty": "EC"
      }
    }
  ]
}

DID document resolvable at:
https://gateway-clay.ceramic.network/api/v0/documents/kjzl6cwe1jw149ze5o87d55ooh4wmnwwrk0n0q2ng7a2im57ovp7njszqnlao56

Basic DID document schema:
https://gateway-clay.ceramic.network/api/v0/documents/k3y52l7qbv1fryquw7e2dvh0da7ty5vdxu15ova82f73nbtif0fps502utn8o18g0

Make sure I have the DID document and DID right together:
https://w3c.github.io/did-core/#did-document-metadata

the did document is based on:

DID document to try:

{
  "@context": "https://www.w3.org/ns/did/v1",
  "id": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
  "authentication": [{
    "id": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB#keys-1",
    "type": "JsonWebKey2020",
    "controller": "did:example:F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
     "publicKeyJwk": {
        "kty": "EC",
        "crv": "P-256",
        "x": "F9C36F8964623378BDC068D4BCE07ED17C8FA486F9AC0C2613CA3C8C306D7BB6",
        "y": "1CD36717B8AC5E4FEA8AD23DC8D0783C2318EE4AD7A80DB6E0026AD0B072A24F"
    }
  }]
}

No comments:

Post a Comment