Decrypt a Secret NFT
Last updated
Last updated
Before getting started, make sure you have the following ready:
account with Alphanet CAPS
Install and set up your editor of choice (we will use Visual Studio Code [VSC] in this tutorial)
Install & NPM
To decrypt a Secret NFT from the Ternoa chain, Ternoa-JS provides you with a viewSecretNFT
helper to do so. It returns a string promise containing the decrypted base 64 file.
The program starts defining some required variables such as SEED, IPFS_NODE_URL, IPFS_API_KEY, CLUSTER_ID, and NFT_ID. It then creates a new instance of TernoaIPFS
using the IPFS node's URL and API key. It then uses getKeyringFromSeed
function to retrieve the keyring from a provided seed phrase and finally calls the viewSecretNFT
function to decrypt a Secret NFT with the given ID using the keyring, IPFS client, and cluster-ID. The decrypted base64 format of the Secret NFT is then logged to the console. If there is any error during the execution, it will be logged into the console as well.
Here are detailed the viewSecretNFT
helper parameters:
The response returned a decrypted base64 format of the Secret NFT.
If you face any trouble, feel free to reach out to our community engineers in our .