How to sign requests made with the HTTP API?

yeah prev/id are cids (or ipld links), id is the genesis event cid. Your python example, both the prev/id are dag-cbor cids, when they should likely be dag-jose cids, looks like an issue there

Have you been able to create genesis events already? and now try to update? (edit: oh now see your second part, hmm)

it is possible to create unsigned genesis commits (with out data), but should create signed genesis commits here (dag-jose)

Last point is odd, even if two commits, prev and id should match on second commit, only third would then ref second and be different.

@zfer Those CIDs came from the API itself. Does this mean that I have to re-encode them vefore submiting another request?

What’s the difference between dag-cbor and dag-jose? When I replicated the code, I saw that the dag-jose-utils library uses the dag-cbor codec. See here:
const block = await Block.encode({ value: payload, codec: dagCBOR, hasher: sha256 })

I have also found that the payload encoding produces different results when these cids from the payload are string representations vs when they are instances of the CID class. Do these classes have custom encoding?

For the request, the genesis value would be a signed genesis commit/event.

So how you were doing the signing and payload before - ie How to sign requests made with the HTTP API? - #13 by davidv

You would do the same for a genesis event, and can add data if you want

The genesis payload is encoded in dag-cbor, then that dag-cbor cid is encoded and signed and wrapped in dag-jose. The dag-jose signed block links to the dag-cbor block payload

@zfer I’m following your advice and trying to first create a signed genesis commit. I’ve debugged the JS library and the payload I now get from python is identical. But Istill get an error while sending it:

{'error': "Cannot read properties of undefined (reading 'id')"}

What does this error mean? The only similar field in the payload is _id. Does the payload looks good to you?

{
   "type":0,
   "opts":{
      "anchor":true,
      "publish":true,
      "sync":0,
      "syncTimeoutSeconds":0,
      "pin":true,
      "asDID":{
         "_client":{
            
         },
         "_resolver":{
            "registry":{
               
            }
         },
         "_id":"did:key:z6Mkon3Necd6NkkyfoGoHxid2znGc59LU3K7mubaRcFbLfLX"
      }
   },
   "genesis":{
      "jws":{
         "payload":"AXESIN3u9irslUkhOuLojXCJZgRn_9TkpomRdFYfZT43zYcj",
         "signatures":[
            {
               "protected":"eyJhbGciOiJFZERTQSIsImtpZCI6ImRpZDprZXk6ejZNa29uM05lY2Q2TmtreWZvR29IeGlkMnpuR2M1OUxVM0s3bXViYVJjRmJMZkxYI3o2TWtvbjNOZWNkNk5ra3lmb0dvSHhpZDJ6bkdjNTlMVTNLN211YmFSY0ZiTGZMWCJ9",
               "signature":"gbYVpYTRH5ubIWAsHoocojzdVmSov9x8XuaKENO9Z7QmOIewb_ytYBKlFwcB8mmqkYlZEWV5Iu6VJBcVwR8LDA"
            }
         ],
         "link":"bafyreig5533cv3evjeqtvyxirvyiszqem775jzfgrgixivq7mu7dptmhem"
      },
      "linkedBlock":"omRkYXRho2RvcHRzoGR0eXBlAGdnZW5lc2lzoWZoZWFkZXKha2NvbnRyb2xsZXJzgXg4ZGlkOmtleTp6Nk1rb24zTmVjZDZOa2t5Zm9Hb0h4aWQyem5HYzU5TFUzSzdtdWJhUmNGYkxmTFhmaGVhZGVyomZ1bmlxdWVwT09hL2kvK0F5TTg5TVdhZmtjb250cm9sbGVyc4F4OGRpZDprZXk6ejZNa29uM05lY2Q2TmtreWZvR29IeGlkMnpuR2M1OUxVM0s3bXViYVJjRmJMZkxY"
   }
}
1 Like

If anyone having the same issues as @mdot and me is interested in a Python client for Ceramic, now that we have a stripped down version, we’re collecting some feedback so we can decide whether to build a full-fledged client. Show your interest in this thread.