đģNodeJS Decrypt File
Files can be fetched from Lighthouse node and decrypt using NodeJS, similar to the example given below.
Step 4: Customize the code:
Replace
YOUR_CID
with the actual CID of the file you want to decrypt.Replace
YOUR_PUBLIC_KEY
with your own public key.Ensure you have the corresponding private key stored in the
PRIVATE_KEY
environment variable.
Step 5: Configure the Private Key:
Create a .env file in your project's root directory.
Add the following content to the .env file:
Replace
YOUR_PRIVATE_KEY
with your own private key corresponding to the public key used in the code (Can be obtained from the wallet.json file made while creating a wallet).
Step 6: Run the Node.js application to upload the file:
In the terminal, while in the
lighthouse-decrypt-app
directory, run the following command:
The decrypted file will be saved as fileName.png in the current directory.
Note: Ensure that you have the correct CID, private key, and necessary configurations set before running the application.
With this code, you can fetch a file from the Lighthouse node and decrypt it using Node.js.
Last updated