How to sign requests made with the HTTP API?

@zfer could I have your input in the following observations?

  • When sending a request to the API from the Python side, I get a 500 error: {'error': 'context deadline exceeded'}. Is this a timeout?
  • The encoding and signing, as I said before, seems to produce the same results for a given payload for Python code and JS code. This leads me to believe that the commit is not properly formed before encoding and signing.

This is what the commit looks like in Python before the encoding. Do you think it looks ok? (I do not expect everything to match here as these are different streams).

Python
------
commit = {
    'data': [
        {'op': 'remove', 'path': '/genesis'},
        {'op': 'remove', 'path': '/type'},
        {'op': 'remove', 'path': '/opts'},
        {'op': 'add', 'path': '/foo', 'value': 'baz'}
    ],
    'prev': 'bafyreihkfookkdfmm5xyypicanr3xy7253bllwguvcq33fk37py3lkleiu',
    'id': 'bafyreigzf4sub5zvsyuuff3kepapa2oj7bqval2uwtrp34dfnugwcqcupq'
}

JS
---
data = equal to Python
prev = bagcqceraevyb3uowhk452ktxleefjh3pdv4tdjzra4ebplojq2yaerlusucq
id = bagcqceraevyb3uowhk452ktxleefjh3pdv4tdjzra4ebplojq2yaerlusucq

Two observations:

  • According to the specification, prev and id are IPLD links. I’m using what I get from the API by retrieving the last and first commits, but the JS example seems to use a different CID format (not bafyrei…). Is this correct?

  • In the JS example, both prev and id match (the stream only contains 1 commit), but when I create a stream calling the API from Python 2 commits are added automatically, so prev and id do not match. The genesis data looks like this:

genesis_data = {
    "genesis": {
        "header": {
            "controllers": [did]
        },
    },
    "type": 0,  # TileDocument
    "opts": {}
}