The /api/hashwrite service performs the very important task of calculating the hash of each individual file in a directory, the hash of the last modified time of all the files in the directory, and the hash of the file tree of the directory, and then storing them in the blockchain. It takes the directory path as an input parameter.
The following are the steps that are carried out by the service:
- Extract the directory path to be secured from the request body.
- Call the walkDir function to list all the files in the directory.
- Iterate through all the files in the directory, calculate the hash for each file, and call the bWrite method to write the hash to ...