HelloZeroNet / Documentation

ZeroNet Documentation
https://zeronet.readthedocs.org/
GNU General Public License v2.0
74 stars 105 forks source link

Code example for signing content.json #132

Closed rllola closed 5 years ago

rllola commented 5 years ago

In the documentation there is a section that explain everything we need to know oncontent.json. It has a subsection call signs.

See (https://github.com/HelloZeroNet/Documentation/blob/master/docs/en/site_development/content_json.md)

A code snippet in python showing how it is working would be nice to help people understand how it works.

HelloZeroNet commented 5 years ago

The actual code we use:

del(new_content["signs"])  # Delete old signs
sign_content = json.dumps(new_content, sort_keys=True)
sign = btctools.ecdsa_sign(sign_content, privatekey)
new_content["signs"] = {}
new_content["signs"][privatekey_address] = sign

It does not includes the cryptography part, but I think we don't have to go that deep