> For the complete documentation index, see [llms.txt](https://docs.ternoa.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ternoa.network/build-1/javascript/privacy-protocols/tee-privacy-and-encryption/minting-and-decrypting-flows.md).

# Minting & Decrypting flows

## Minting & Decrypting flows

{% hint style="info" %}
The following schemas and descriptions mention the Secret NFT as an example. Nevertheless, those schemas as also valuable for the Capsule NFT as the concept behind the two flows is the same for both of them.
{% endhint %}

### Minting a Secret NFT

<figure><img src="/files/gC8fUUsmbxsOpRoGGYux" alt=""><figcaption></figcaption></figure>

#### Custom and destructured mint flow

* How to generate the Secret key
  * PGP Key Pair creation
  * Secret Shamir Shares generation
* How to prepare Secret NFT assets
  * Off-Chain Metadata: Secret NFT metadata, Secret Media Metadata
  * Secret file encryption
  * Ternoa IPFS Client
* How to mint a Secret NFT on-chain using Ternoa-JS: injecting a Signer account
* How to prepare payloads for TEE enclaves
  * Temporary signer account creation
  * Payload formatting
* How to store shares on TEE enclaves
  * Enclave health status
  * Post request

## Decrypting a Secret NFT

<figure><img src="/files/c6vjfS2eqYLlqTpHQPqx" alt=""><figcaption></figcaption></figure>

#### Custom and destructured decryption flow

* How to retrieve Secret NFT assets
  * Ternoa IPFS Client
* How to prepare payloads for TEE enclaves
  * Enclave health status
  * Payload formatting
  * Get request
* How to retrieve Secret Key
  * Shares combined
* How to decrypt the secret
