Decrypt a Capsule NFT
Prerequisites
Decrypting a Capsule NFT using Ternoa-JS
Step 1: Obtain the private key associated with the Capsule NFT
import { getKeyringFromSeed, getCapsuleNFTPrivateKey } from getKeyringFromSeed;
const retrievePrivateKey = async () => {
try {
const REQUESTER_SEED = "//TernoaTestAccount"; // The NFT requester seed phrase.
const NFT_ID = 74356; // The Capsule NFT ID.
const requesterKeyring = await getKeyringFromSeed(REQUESTER_SEED);
const requesterRole = "OWNER";
const privateKey = await getCapsuleNFTPrivateKey(
NFT_ID,
requesterKeyring,
requesterRole,
);
console.log("The capsule private key is: ", privateKey);
} catch (e) {
console.error(e);
}
};Step 2: Retrieve the capsule off-chain data CID hash using the Ternoa Indexer
Step 3: Retrieve the Capsule NFT's content assets from IPFS
Step 4: Decrypt assets
Next
Support
Last updated