Handling clusters
Last updated
Last updated
If you are not familiar with Ternoa's TEE architecture for privacy yet, we strongly recommend you look at the following sections of the documentation and understand the key concepts:
The quickest way to summarize the flow to encrypt and store content could be as follows:
The Secret or Capsule creation process involves encrypting content before uploading it to IPFS. The user's content is secured using a set of private and public keys, the Ternoa Chain, and the TEE. Content is encrypted with the public key, while the private key is split into 5 Shamir shares and stored in the TEE Cluster, which contains 5 enclaves.
Now, let's see how to select a cluster.
Unless specific use cases require it, data must be sent to one of the PUBLIC clusters registered on the chain. (Private clusters are available for specific use cases. Admin clusters should not be targeted.)
The selected public cluster ID does not matter since all clusters are synced with each other. However, in case you want to implement a retry function or want to manually handle cluster selection, you can use getPublicsClusters()
. Otherwise, getFirstPublicClusterAvailable()
is here for you.
Now the cluster is selected, it is necessary to verify the health status of the cluster.
Before moving on to creation, the good practice is to verify the status of the selected cluster. An enclave in a cluster may not be available because it's in maintenance mode. Therefore, it's important to check the status of the selected cluster.
In most cases, it's not necessary to use or store the data in a variable. Just run the promise getEnclaveHealthStatus()
to check if any errors are occurring. In case you need to use the cluster health data, use getEnclaveDataAndHealth()
.