ethpm / py-ethpm

This library is deprecated. ethPM python tooling is now located in web3.py
MIT License
24 stars 13 forks source link

Util for generating valid github uris #125

Closed njgheorghita closed 5 years ago

njgheorghita commented 5 years ago

What was wrong?

A util function would be useful that accepts a valid github uri pointing to a manifest json file, and returns the uri as defined here.

How can it be fixed?

The utility function should be written in https://github.com/ethpm/py-ethpm/blob/master/ethpm/utils/uri.py. It should validate that the given uri leads to a json file hosted on github, validate the json file against the manifest json schema, and return a uri with the specified encoding here. Tests should be written here

pipermerriam commented 5 years ago

@njgheorghita don't remember who, but I think we can ditch the fragment based content hash in favor of the blob hash natively present in this form of github uri.

https://developer.github.com/v3/git/blobs/

https://github.com/ethpm/py-ethpm/blob/ff22427520b1c05ed6efad8e0e993c5d8a7ad9f3/ethpm/assets/escrow/1.0.0.json

Do some verification, but I think the hash in that URI corresponds to the hash of the file content.

njgheorghita commented 5 years ago

Yup, that hash in the blob uri is sha1 hash of the base64 encoding of the contents found at the uri