Documentation
Client SDK
Cloud

Secrecy cloud

The Secrecy cloud is a service that allows you to upload your files or folders to the cloud and share them with others. All of data is encrypted in the browser, with the keys of the user's identity in your application, before being uploaded to the cloud. Secrecy only stores these keys locked, and never in a readable form: the unlocked keys stay in the browser. This means that only the user, and the users or groups they share with, can decrypt the file. The file is decrypted on the client side, after the download.

How Secrecy cloud works

The cloud is composed of nodes. Nodes represent the files and folders that are the visual elements of the cloud. Like a classic cloud, a folder can itself contain files or folders as child elements. Unlike a folder, the files cannot have other child elements. However, the files contains a history of its versions. The current version is based on the last verion of the file in the history.

Managing Secrecy cloud

All data in the cloud can be shared with others. Folder can be deleted also. In the case of files, thanks to their history, it is possible to edit, add a new version of the file to the history, restore a previous version of the file, delete a version of the file or delete the entire file. Also, all files and folders can be moved to another folder.


Cloud is nodes

As described above, 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.nodeFull 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.nodeFull();
 
    return cloud;
  } catch (error) {
    console.error(error);
    return null;
  }
};

Get file or folder from the cloud by ID

The same method secrecyClient.cloud.nodeFull 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.nodeFull({ id });
 
    return node;
  } catch (error) {
    console.error(error);
    return null;
  }
};

The nodeFull method returns a NodeFull, that is the node with its parent, its children, its current data and its history. Use secrecyClient.cloud.node instead to get the node alone. Both take an optional { id, deleted } object, and return the root node when no id is given.