-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
44 lines (37 loc) · 909 Bytes
/
Copy pathmodels.py
File metadata and controls
44 lines (37 loc) · 909 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# models.py
from pydantic import BaseModel
from typing import Dict, List, Any, Optional
class RegisterUser(BaseModel):
address: str
encPub: str
signPub: str
class UploadPayload(BaseModel):
payload: Dict[str, Any]
class DeliverMessage(BaseModel):
cid: str
sender: str
recipient: str
timestamp: int
ethSignature: str
sessionId: Optional[str] = None
class ReplicatePayload(BaseModel):
cid: str
payload: Dict[str, Any]
class BlockProposal(BaseModel):
previous_hash: str
merkle_root: str
cids: List[str]
proposer: str
timestamp: int
signature: str # proposer's signature over block data
class ConversationMessage(BaseModel):
id: int
cid: str
sender: str
recipient: str
timestamp: int
rootId: str
sessionId: str
class ConversationResponse(BaseModel):
rootId: str
messages: List[ConversationMessage]