# Kizuna Happ
###### tags: `Kizuna-architecture`
#### Kizuna is a distributed, peer-to-peer, non-profit messaging application that prioritizes privacy, security, and user centricity
#### This document was made with the help of this document made by @guillemcordoba's. Big thank you for this one! https://hackmd.io/XNPC4NUKRd2zja9Itja-fg
## General User Stories
*TODO: update this*
#### The entire user stories of Kizuna can be found [here](https://trello.com/b/uVteZliD/kiuzna-user-stories)
## Functional Requirements
* There is a need to create a human readable identifier for an agent *but not need for creating agent profile for authentication purposes.* That is already being managed by Holo Chaperoe.
* Agents should be able to search other agents with their username
* Agents should be able to include desired agents in their contact list
* We need a mechanism for protecting the Kizuna network from sybil attack.
* It is preferred to not store messages on source chain (consequently on DHT) as it exposes certain meta data through headers (though not much) even if the entry itself is private.
* For E2EE, we are currently looking at [double ratchet](https://signal.org/docs/specifications/doubleratchet/) for encryption of chat messages (and probably for voice/video stream data)
* [x3dh](https://signal.org/docs/specifications/x3dh/) should be an ideal key exchange mechanism. However, asynchronicity will be a challenge to achive.
## DHT architecture
> Follow the link for the actual zome design
This app will need the following DHT/membrane
* One Public shared DHT where everyone is in wherein they create their readable identity (i.e. username) and add other agents into their contact list. This public DHT can also be used to send node to node messages in E2EE fashion asynchronously/synchronously. Group messaging can also happen here but that security and privacy has to be given enough thought.
* A private DNA template that agent can use where in they can specify (from their contact list) who can be in that DHT to have a p2p conversation. A uuid of the DNA template will be changed everytime another conversation will be created. (May seem unreasonable in Holo)
* A semi-private DNA template that agent can use wherein they can specify (from their contact list) who can be in that DHT to have a group conversation. Same with the private DNA, uuid of the DNA will be changed once it is instantiated from the templte DNA
* This DHT will include a [social triangulation](https://github.com/holochain-open-dev/social-triangulation) + [membership by invitation](https://forum.holochain.org/t/membership-by-invitation/1079)(to allow the creator of the group chat to invite solely if that is a desired option by the creator of the group chat) zome wherein agents inside the already existing DHT can vouch for the incoming agent who would like to join the groupchat.
* we might need to have a more granular control in providing roles.
## Zome architecture per DNA
### Public DNA
* [requests (for P2PCommDNA)](https://hackmd.io/IiZA7kzeTJGlqXwQPLjlng) - not in use right now
* [file-sharing (no chunking)](https://hackmd.io/znzO-gzvTnWKQ7uqdT4fFQ)
* n2n voice-call
* n2n video-call
* [user preference](https://hackmd.io/@SiY_fKT2QNG8vujhpgGOyA/B15s0kBow)
* [group-messaging-unencrypted (currently in use in 2nd prototype)](https://hackmd.io/wfZ9ZceaTAaDVBJzaNggOA)
* [group-CRUD-unencrypted (currently in use in 2nd prototype)](https://hackmd.io/@SiY_fKT2QNG8vujhpgGOyA/HJoY8IY1O)
*[comment]: [n2n file-sharing](https://hackmd.io/@SiY_fKT2QNG8vujhpgGOyA/ryQ1jhK8w)
### [P2P Communication DNA](https://hackmd.io/efjbwQ3yRnK0TqIq4dCm_Q?view)(deprecated)
### Group DNA
## Zome and DNA dependency graph: