epam / near-nftchecker

MIT License
1 stars 0 forks source link

Check if hash matches data stored #4

Open zahhar opened 3 years ago

zahhar commented 3 years ago

When reference_hash is provided together with reference attribute, it needs to be validated against the content.

reference is optional:

reference_hash is optional:

reference_hash validation:

  1. Download the content from reference (same will be for media in the Token context later)
  2. Calculate and compare if any plain hash matches: base64-encoded sha-256, sha-384 or sha-512
  3. If not, assume given hash is Multihash, and try to check it using https://github.com/multiformats/js-multihash
  4. Error if nothing worked - probably referred data was tampered