Cloud
Getting started with the cloud

Getting started with the cloud

Cloud is nodes

As described in the secrecy cloud section, the notion of node is at the core of the secrecy cloud concept.
The cloud is composed of a unical root node which is the parent of all the nodes in the cloud. The root node is the node that is displayed when you open the cloud.

The root node has its name property equal to root

The secrecy cloud service includes management of data sharing between secrecy users. It also manages a trash, with two levels of deletion (permanent, recoverable).


Get the cloud

The secrecyClient.cloud.node method is designed to retrieve a "cloud" folder from the secrecy cloud of the user.

cloud.ts
const getMyCloud = async (): Promise<NodeFull | null> => {
  // First we need to check if the secrecyClient is available
  if (!secrecyClient) {
    return null;
  }
 
  try {
    // Get cloud content
    const cloud = await secrecyClient.cloud.node();
 
    return cloud;
  } catch (error) {
    console.error(error);
    return null;
  }
};

Get file or folder from the cloud by ID

The same method secrecyClient.cloud.node is used to retrieve a node by its id.

cloud.ts
const getCloudNodeById = async (id: string): Promise<NodeFull | null> => {
  // First we need to check if the secrecyClient is available
  if (!secrecyClient) {
    return null;
  }
 
  try {
    // Get the node by id
    const node = await secrecyClient.cloud.node(id);
 
    return node;
  } catch (error) {
    console.error(error);
    return null;
  }
};