lukso-network/LIPs

LSP3 and LSP4 image references

Closed this issue · 2 comments

Lets find a better way to reference images in the following standards:

The current way is:

{
    "LSP3Profile": {
        "profileImage": "URI", // The profile image represents one image representing the profile, like a person image, a company logo or avatar.
        "profileImageHash": "keccak256",
        "backgroundImage": "URI", // The background is an image that can be used in conjunction with profile image to give a more personal look to the profile.
                                  // Websites displaying the profile have to choose how or if, to use this image.
        "backgroundImageHash": "keccak256",
        "description": "string" // A description, describing the person, company, organisation and/or creator of the profile.
    }
}

We should see how we can improve that to support multiple image resolutions per image, and store the hashes properly per image. This standard is a good reference for that: https://eips.ethereum.org/EIPS/eip-2477

Two ways of reference:

Files itself from the data store of the smart contract:

key: keccak256('LSP3Profile') = 0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5
value: bytes4(keccak256('keccak256')) + bytes32(hashItSelf) + web3.utils.utf8ToHex('ipfs://QmQ2CN2VUdb5nVAz28R47aWP6BjDLPGNJaSBniBuZRs3Jt')
0x5ef83aff + 5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5 + faf83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc4

assets/images within the referenced json:

{
    "LSP3Profile": {
        "profileImage": {
                "uri", "ifps://QmQ2CN2VUdb5nVAz28R47aWP6BjDLPGNJaSBniBuZRs3Jt",
                "hashFunction": "keccak256",
                "hash": "0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5"
       },
       "backgroundImage": {
                "uri", "ifps://QmQ2CN2VUdb5nVAz28R47aWP6BjDLPGNJaSBniBuZRs3Jt",
                "hashFunction": "keccak256",
                "hash": "0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5"
       },
        "description": "string"
    }
}

multiple image sizes

{
    "LSP3Profile": {
        "profileImage": [
               {
                     width: 1400,
                     height: 600,
                     "uri", "ifps://QmQ2CN2VUdb5nVAz28R47aWP6BjDLPGNJaSBniBuZRs3Jt",
                     "hashFunction": "keccak256",
                     "hash": "0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5"
                },
       ],
       "backgroundImage": {
                "uri", "ifps://QmQ2CN2VUdb5nVAz28R47aWP6BjDLPGNJaSBniBuZRs3Jt",
                "hashFunction": "keccak256",
                "hash": "0x5ef83ad9559033e6e941db7d7c495acdce616347d28e90c7ce47cbfcfcad3bc5"
       },
        "description": "string",
        "name": "My name",
        "links": [{
              "title": 'asdfghj',
              "uri": "https://dfghjk"
        }]
    }
}

Done