swarmcity / SwarmCityConcept

This is the high level description of what needs to be built
9 stars 1 forks source link

As a user in a deal I can chat, so I can communicate about the deal. #22

Open kikipluche opened 6 years ago

kikipluche commented 6 years ago

Abstract:

Once users agree to engage in a deal, they can chat with each other. That way they can plan in detail how the deal will be executed.

How it could work:

In a deal's detail-view, a chat button appears.

By tapping the chat button, the view changes to a chat window where the Seeker and Provider can communicate about the deal.

The Providers's client creates a new string. Then it encrypts the string two times; once with the Seeker's public key, and once with the Provider's public key.

The encrypted string is a secret that can be shared with the participants of the chat.

These 2 secrets are added to the deal object. This means the Seeker and Provider have a string waiting, encrypted with their public key.

Every message is encrypted with this shared secret on each client.

When the deal is completed, the entire chatlog is stored on IPFS, and the resulting ipfs hash is stored in the deal object.

How the API could work:

When the selected Replier funds a request (see S01E03 Epic 2), that request becomes a deal, the selected Replier becomes the Provider.

The Provider, when funding the deal, creates a secret and encrypts it with the Seeker's public key.

This chatsecret is the encryption key for the entire chat conversation. If members are added, the chatsecret is encrypted with the new member's public key.

A chat is created on the API with key chat-dealHash. The value is the chat conversation represented as a json object, stringified and encrypted.

The client subscribes to the chatroom.

The chat conversation is sent from the API to client.

Subscription ChatRoom Parameters: dealHash

Returns: chatConversation JSON stringified encrypted with secret

Event chatUpdate Returns chatConversation


What it looks like:

Userflow: https://invis.io/ABGM89SX3V5#/297532804_-Hashtag--contractadress---dealhash-_SEEKER ( > in Invision, hold shift to see clickable areas)


routes: /hashtag/[contractadress]/[dealhash] & /hashtag/[contractadress]/[dealhash]/chatview

As seen by Seeker:

As seen by Provider:

When an item is a deal, the detail-view shows a chat-button directly above the green area (both seen as Provider and Seeker).

When the chat button is tapped, the view changes to chat-view.

The chat-view contains:

When the user inputs a chat-msg and submits, it appears (left-aligned) in the chat area, where all chat-msgs are visible. The input area is sticky, meaning it will always be visible.

When the blue X-mark (close-button) is tapped by the user, the chat-view changes back to the detail-view of the item.


Desktop view:


Invisionlinks with login (for inspect mode!): mobile: https://projects.invisionapp.com/d/main#/console/13838256/297532804/inspect desktop: https://projects.invisionapp.com/d/main#/console/14147648/297532081/inspect

Documentation / references


With ♡ from Swarm City

xardass commented 6 years ago

@faffydee not wanting to question your design, but it might be counter-intuitive to have your own messages on the left side? On my phone for example I have my messages always on the right