DataBag API Overview

Introduction

Databag is a decentralized network with the goal of giving people back control of their data. The network supports a wide range of applications including contact apps, photo albums, video players, and social networks. Apps that connect to the Databag network must always be open-source to ensure privacy expectations are met. 

The node comprising the Databag network is designed for self-hosting, allowing a person to host their data and that of their friends and family if they choose. When a person stores their data in a node, they have fine grain control on how it is shared with others. Since a person’s data is stored on a node they control, they can switch from one application to another, and their data goes with them. 

The API primarily focuses on the relationship between data and contacts for access control. Data is stored as abstract objects to be defined by the connecting applications. Each person on the network is identified with a decentralized identifier (DID) so they are not permanently tied to a domain or a hosting provider. If a person migrates their account to another node, the contact relationships remain intact.


Mechanisms

Data is synchronized between apps and the network nodes through the maintenance of a revision tree. Data objects are grouped together, and those groups are grouped together. When one object changes the revision of that object is incremented as well as all the parent nodes of the tree. An app maintaining the same revision tree can identify and update any changed object by updating any node where the revision has changed.

Accounts on the network can be connected for the purposes of sharing data. The connection is formed by exchanging signed messages containing access tokens. Because each account, identified by a DID, is backed by a public/private key, the token exchange can be done securely. All further communication between contacts is done using the exchanged token so the identity can be determined. 


API Objects

The primary data objects in the network are defined by how they are shared while their content is defined by the applications that use them; they consist of articles, topics and tags. Articles are assigned a contact set; contacts can be part of more than one set. Access is granted to the contact when they are part of a set that is assigned to the article. Topics are shared by creating a dialogue, and assigning both contacts and data objects to that dialogue. This difference between articles and topics is subtle; contacts can each have a different view of the set of articles, while members of a dialogue all have the same view of the topics. Finally tags are shared by assigning them to an article or a topic. When a contact has access to an article or topic, they have access to all the assigned tags as well. 

The list of objects used in the API follow:

 

API Modules

The API is divided into 9 different modules: