Does chainlink have a reliable way to verify the size/format of a file behind a hash stored on IPFS?

Viewed 155

The idea would be to have a distributed way to retrieve the existence, byte size, and file format from a solidity smart contract using a blockchain Oracle like Chainlink:

Example of image stored on IPFS: https://ipfs.io/ipfs/QmYjh5NsDc6LwU3394NbB42WpQbGVsueVSBmod5WACvpte

import "@chainlink/contracts/src/v***/IPFSConsumer.sol";

contract VerifyFile is IPFSConsumer {
    // hashIPFS: QmYjh5NsDc6LwU3394NbB42WpQbGVsueVSBmod5WACvpte
    function verify(bytes32 hashIPFS) public returns (bool, uint256, string) {
         bytes32 requestId = IPFSmetadata(hashIPFS);
         // ... fulfill request with requestId
    }
}

or

import "@chainlink/contracts/src/v***/IPFSInterface.sol";

contract VerifyFile {
    IPFSInterface internal IPFSmetadata
    
    // hashIPFS: QmYjh5NsDc6LwU3394NbB42WpQbGVsueVSBmod5WACvpte
    function verify(bytes32 hashIPFS) public returns (bool, uint256, string) {
         (bool exists, uint256 size, string format) = IPFSmetadata.fromHash(hashIPFS);
         return ...
    }
}
1 Answers
Related