# Sub-identities support

#### Idea

vSelf profile toolkit aims to collect all the information about the user into a single profile.  Sometimes it is necessary to set up different profiles for different purposes (working profile, gaming profile, etc.).&#x20;

We provide the opportunity for users to create separate public sub-profiles for different contexts. All the information collected in the user profile can be divided and associated with the sub-profiles.&#x20;

We aim to accomplish both: provide provability and transparency of user data and guarantee user privacy.&#x20;

#### Definitions

* <mark style="background-color:purple;">General identity</mark> is the set of personal data about a given person.
* <mark style="background-color:purple;">Sub-identity</mark> is the sub-set of the person's general identity for a single life context (for example, professional sub-identity).
* <mark style="background-color:purple;">Master profile</mark> stores general identity and provides identity management.&#x20;
* <mark style="background-color:purple;">Sub-profiles</mark> are used to store and manage sub-identities.
* <mark style="background-color:purple;">vSelf DID</mark> is used to index different general identities and get access to a correspondent master profile.
* To index the sub-identities, we use <mark style="background-color:purple;">implicit IDs</mark>.
* <mark style="background-color:purple;">Key set</mark> is the chain id and access right key pair (public & private key) to the account in the given chain.
* <mark style="background-color:purple;">Identity tree</mark> is the tree with DID, implicit IDs and key sets.

#### Getting started&#x20;

The authorization to the vSelf profile toolkit with vSelf DID gives access to the master profile. We use DID provided by the [Ceramic Key DID library](https://developers.ceramic.network/reference/accounts/key-did/). The person is able to collect all the information about herself (general identity) in the master profile.

Our toolkit allows the user to create sub-identities from the general identity for different contexts. All the information collected in the master profile can be divided and added to sub-profiles. Users can manage all their sub-identities from the vSelf master profile.&#x20;

The goal is to make all sub-identities public without compromising the general identity. For this reason, vSelf uses a hybrid on-chain (sub-profiles) & off-chain (identity management) storage solution.

#### Identity tree

vSelf identity has a tree structure with the root in vSelf DID, which matches the general identity. All the implicit IDs that match different sub-identities are connected to the root. The key sets of the supported chains can be connected to the root or to some of the vertex with implicit ID.

Users can update sub-identities, create new ones, and remove existing ones inside the master profile. Sub-profile data can be provided from the general identity or from the account with a connected key set. This data includes general information about the user, her links to resources of choice, and NFTs. It is possible but not recommended for users to retrieve data from a single account to the different sub-profiles. Therefore, the single key set should not be connected to the root or to several implicit IDs to accomplish the highest level of privacy.&#x20;

#### Data storage solution

We store the identity tree in [GunDB](https://gun.eco/docs/Introduction), an offline-first and distributed graph database.  Each sub-profile is public and stored separately on-chain in [Social DB](https://github.com/NearSocial/social-db/). Social DB usage requires the NEAR ID to create a new profile. All the implicit IDs (that match sub-identities) are NEAR IDs. For a new sub-identity without a connected NEAR key set, we provide a [smooth onboarding](https://vself-project.gitbook.io/vself-project-documentation/near-onboarding/smooth-onboarding) process.

This approach allows us to guarantee the publicity of each sub-identity without the ability to collect sub-profiles together and disclose the user's general identity. &#x20;
