owned this note
owned this note
Published
Linked with GitHub
# Personas & Profiles
I'm sure by now you've heard the phrase, "If you can't identify the product, you are the product!", similar to the old poker saying "If you don't know who the sucker is, it's you". All of the **free** internet services we use are subsidised by the money the site owners make selling your data to anyine who will buy it. As an example of how far your data gerts shared without you being aware take a look at this interactive graphic on what Payal does with your data - https://rebecca-ricks.com/paypal-data/. Now have a think about the number of websites you have filled out your name, address and other details on and how painful it is to update all of those sites when your address changes. To make this easier sites like Google, Facebook and Microsoft allow you log in on other sites using the details you entered in theirs. This may be convenient but now you are allowing them to know exactly whaqt you do on the internet and they sell that too. See my video on not being a [Marketing Meatbag](!https://www.youtube.com/watch?v=X72tHBtiZt4&t=1s)
At Holochain we are building tools to give you back agency over your data. The first part of that is making it simple to manage your profiles over multiple Holochain Apps (hApps) and keep your data to yourself. The rest of this article is a deep dive into how we do that.
All hApps that need a person's Profile information will redirect to the Personas & Profiles (P&P) hApp. The requesting app - such as Chat - sends a "retrieve" request for the particular field it needs, such as "handle". If the response is empty then the person using the Chat hApp will be taken to the Profile form. The form is generated by using the 'Profile Spec' registered by Chat that lists the fields the app needs. The person then uses P&P to map the requested Profile information to the actual data stored in one of the person using the hApp's Personas.
In this [Example Profile](https://holochain.github.io/holochain-ui/?selectedKind=HoloVault%2FProfile&selectedStory=Mapped%20to%20Persona%20info&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybook%2Fnotes%2Fpanel) you can try out how the auto complete field finds any matching data in your existing Personas. This example has 4 Personas, Default, Personal, Work and Friends with different fields and spelling of some values to demonstrate how we can use Personas.
Personas & Profiles will have the following features:
- Add a new Profile Mapping - done
- Edit a Profile Mapping
- Delete a Profile Mapping
- Add a Persona - done
- Edit a Persona
- Delete a Persona
Personas & Profiles is your personal data store that replicates across your devices on its own DNA. To give you data resilience and speed to those you are sharing data with.
## Personas
You probably have many personas across your digital life. For example in one network of peers you may use your Personal details, in another network your work details and in another your Friends. Personas & Profiles puts you in control of how your information is used (displayed or stored by the app) and allows you to share the same information to many different apps.
## Managing your Personas
You can add edit and delete Personas in the "Personas & Profiles" app.
```mermaid
sequenceDiagram
Participant PP_UI
Participant PP_DNA
PP_UI-->>PP_DNA:Request Personas (Query)
PP_DNA-->>PP_UI: Personas
PP_UI-->>PP_UI: Select / Add Persona
PP_UI->>PP_UI: Enter information
PP_UI->>PP_DNA: Commit Persona
```
### Demo
You can try out the UI on the links below. Make sure you read the *Notes* section.
[Create a New Persona](https://holochain.github.io/personas-profiles/?selectedKind=Persona&selectedStory=New%20Persona&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybook%2Fnotes%2Fpanel)
[Edit an Existing Persona](https://holochain.github.io/personas-profiles/?selectedKind=Persona&selectedStory=Edit%20Existing%20Persona&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybook%2Fnotes%2Fpanel)
## Personas
Personas are stored in 2 steps. First a Persona Spec is created. The returned Persona Address is then used to link each of the fields in the Persona. This was done so that you can add/edit/delete fields in the Persona without the Persona Address changing making it simpler to manage the Persona Field Mappings used in the Profile.
```jsx=
export interface PersonaSpec {
name: string
id?: string
}
export interface Persona extends PersonaSpec {
hash: string
fields: Array<PersonaField>
}
export interface PersonaField {
name: string,
data: any
}
{"personas":[{"name":"Personal","hash":"QmPUFfLugTwizXVcw4VVrzA59MwjV6EKTXRTsHPJLzNPCU","fields":[{"name":"firstName","data":"Phil"},{"name":"suburb","data":"Burwood"},{"name":"lastName","data":"Beadle"},{"name":"city","data":"Melbourne"},{"name":"address","data":"123 Holochain Road"}]},{"name":"Default","hash":"QmX8h3NSrbNLnoj1U1oakM99erFGkrhV4zGr7EphYmje7L","fields":[]},{"name":"Work","hash":"QmWe29VeWJj4CM1oWZT9dtjCZBjAe2dxgShm7KcXQJ1eHy","fields":[{"name":"firstName","data":"Philip"},{"name":"location","data":"Melbourne"},{"name":"role","data":"Engineer"},{"name":"lastName","data":"Beadle"}]},{"name":"Friends","hash":"QmbeCeZBH5UmqoKCaTQh2MiRAnsQD6R2S32SWyrFeEZtyG","fields":[{"name":"hobby","data":"DJ"},{"name":"nickName","data":"@philt3r"}]}]}
```
## Managing your Profiles
You can add edit and delete Profiles in the "HoloVault" app.
```mermaid
sequenceDiagram
Participant PP_UI
Participant PP_DNA
PP_UI-->>PP_DNA:Request Profiles (Query)
PP_DNA-->>PP_UI: Profiles
PP_UI-->>PP_UI: Select
PP_UI->>PP_UI: Enter information
PP_UI->>PP_DNA: Commit Profile
```
### Demo
You can try out the UI on the links below. Make sure you read the *Notes* section.
[List all Profiles](https://holochain.github.io/personas-profiles/?selectedKind=Profile&selectedStory=List%20of%20Profiles&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybook%2Fnotes%2Fpanel)
[Create a New Profile with no existing Personas](https://holochain.github.io/personas-profiles/?selectedKind=Profile&selectedStory=Not%20mapped%20no%20defaults&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybook%2Fnotes%2Fpanel)
[Create a New Profile with existing Personas](https://holochain.github.io/personas-profiles/?selectedKind=Profile&selectedStory=Not%20mapped%20has%20matching%20defaults&full=0&addons=1&stories=1&panelRight=0&addonPanel=storybook%2Fnotes%2Fpanel)
### Profile Spec
Send a Profile Spec to "Personas & Profiles" to enable the person using your app to manage their profile for your app.
```jsx=
{
"name": "Holo Chat - Melbourne DJs",
"sourceDNA": "HOLOCHAT2DNA",
"hash": "QmQEjQQQSUNnE7Z8WowVq1Yh1jVM6iUqqkytLfVbvE1tR3",
"fields": [{
"name": "handle",
"displayName": "Handle",
"required": true,
"description": "How you are referenced in chat",
"usage": "STORE",
"schema": "{}",
"mapping": null
}, {
"name": "firstName",
"displayName": "First Name",
"required": true,
"description": "Used when others search for you",
"usage": "DISPLAY",
"schema": "{}",
"mapping": null
}],
"expiry": 0
}
```
### Creating a new Profile
The following message sequence diagram shows how a person would create a new Profile. [see here for a code walkthrough](!https://hackmd.io/6z0UPA_GQECFNfXlVCMamg)
The first time a hApp needs the "Profile" of an agent it registers a Profile Spec (shown above) where each field has a reason the hApp needs the information and whether or not the data will be stored in the RequestingApp or displayed from Personas & Profiles.
When the hApp requests a value such as the person's handle it will first request it from its own store, the design of this is up to the developers. If the field cannot be found then a bridge call to HoloVault attempts to retrieve the field. If this also returns nothing then the person is redirected to Personas & Profiles and the Profile Spec is used to show the Profile Form. The Person then maps their data, saves it into Personas & Profiles and is redirected back to the hApp.
The hApp then tries again to retrieve the field such as "handle". It doesnt exist in the hApp DHT so it again bridges to P&P, retrieves the value and then if it's a storeable field saves it into the hApp DHT.
People can then confirm that their profile information has been used as requested by checking the contents of the requesting apps DHT and Chain. A warrant for the app my be issued if found to be misusing people's profile information.
``` mermaid
sequenceDiagram
Participant ChatUI
Participant ChatDNA
Participant PersonasDNA
Participant PersonasUI
Note over ChatUI:On first render
ChatUI-->>ChatDNA:Retrieve profile
ChatDNA-->>ChatDNA:No profile
ChatDNA-->>PersonasDNA:Attempt retrieve handle & avatar
PersonasDNA-->>ChatDNA:No mapping
ChatDNA-->>PersonasDNA:Register Profile Spec
ChatUI-->>PersonasUI:Show Profile Form
PersonasUI-->>PersonasDNA:Request Profile Spec
PersonasUI-->>PersonasDNA:Request Personas
PersonasDNA-->>PersonasUI:Profile Spec
PersonasDNA-->>PersonasUI:Personas
Note over PersonasUI:Displays Profile Form
PersonasUI->>PersonasUI:Person enters profile data
PersonasUI->>PersonasDNA:Commit Profile Mapping & New Persona fields
PersonasUI->>ChatUI:Redirect back
ChatUI-->>ChatDNA:Retrieve Profile
ChatDNA-->>ChatDNA:No profile
ChatDNA-->>PersonasDNA:Attempt retrieve handle & avatar
PersonasDNA-->>ChatDNA:handle & avatar
ChatDNA-->>ChatDNA:Create Profile
ChatDNA-->>ChatUI:handle & avatar
```
When the Profile is saved in P&P each field Profile Mapping looks like this:
```jsx=
export interface ProfileMapping {
retrieverDNA: string,
profileFieldName: string,
personaAddress: string,
personaFieldName: string
}
```
# Future ideas
## Forensic Auditing - Attack Factory
At any time people can use HoloVault to do a forensic scan on any apps chain and dht to give them confidence the app is managing your data as specified.
```mermaid
sequenceDiagram
Participant HoloVaultUI
Participant HoloVaultDNA
Participant AppDNA
HoloVaultUI-->>HoloVaultDNA:App Id
HoloVaultDNA-->>AppDNA:App Id
AppDNA-->>HoloVaultDNA:Chain
HoloVaultDNA-->>HoloVaultDNA:List Request Specs
HoloVaultDNA-->>HoloVaultDNA:Audit Chain
HoloVaultDNA->>HoloVaultUI:Results
Note over HoloVaultUI:If there are any audit failures issue a warrant
HoloVaultUI->>HoloVaultDNA: Issue warrant
```
## Gamification Data
Reputation & Experience and other metrics about you on different apps should also be **your data** and kept in HoloVault. Apps then request to result of a gamification algo based on your data, they dont need your data just the results. Ie the result is creating a leaderboard.
## Get rewarded for your insights
The model at the moment is that everything we add to the internet via Facebook, Twitter etc is used in advertising algorithms, we are the product. it si not necessary for these data mining companies to actually own your data, what they want is the insight. With HoloVault you could run an advertisers algorithm and get paid to publish the result back to them.