---
# System prepended metadata

title: E2EE Conversation

---

# E2EE Conversation

## Format

Représentation de `Doc1` dans le Data Service:
```json
{
    "id": "ID(Doc1)",
    "content": {
        "description": {
            "isEncrypted" : true,
            "documentKeyId" : "ID(17)",
            "value" : "encrypt(Description, 17)"
        },
        "prescription" : {
            "isEncrypted" : true,
            "documentKeyId" : "ID(92)",
            "value" : "encrypt(Prescription, 92)"
        },
        "patient" : {
            "isEncrypted" : false,
            "value" : {
                "id": "ID(Michel)"
            }
        }
    }
}
```

Représentation de `Doc1` dans le Access Service:
```json
{
    "ID(Doc1)": {
        "currentKeyId": "ID(92)",
        "currentUsers": ["ID(Alice)", "ID(Bob)"],
        "documentKeys": {
            "ID(17)": {
                "ID(AlicePair)": "encrypt(17, AlicePub)",
                "ID(BobPair)": "encrypt(17, BobPub)",
                "ID(BernardPair)": "encrypt(17), BernardPub)"
            },
            "ID(92)": {
                "ID(AlicePair)": "encrypt(92, AlicePub)",
                "ID(BobPair)": "encrypt(92, BobPub)"
            }
        }
    }
}
```

## Scenario
1. Alice searches for Bob's profile.
2. She create a case for the broken arm of Michel 
3. She adds bob as collaborator.
4. She sends "I'm Alice!".
5. Bob receives a notification on his smartphone.
6. He joins the conversation by responding "I'm Bob!".
7. Bob adds Charlie to the conversation.
8. Charlie sends "I'm Charlie!".


## Packets
### 1.
?

### 2.
Alice creates the case.
POST data/api/case


Server sends a notification to Bob's devices. {"event"}


### 3.
```json
{
    "encrypted": true,
    "data": {
        "encryptedDocumentKey": {
            "{Alice account pair id}": "ENCRYPTED",
            "{Bob account pair id}": "ENCRYPTED"
        },
        "message": {
            "content": "I'm Alice!",
            "timestamp": 84272824            
        }
    }
}
```

## Future thoughts
- Signatures?

