Add encryption module
This commit is contained in:
22
server/app/models.py
Normal file
22
server/app/models.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from banjo.models import (
|
||||
Model,
|
||||
StringField,
|
||||
ForeignKey,
|
||||
BooleanField,
|
||||
)
|
||||
|
||||
class User(Model):
|
||||
name = StringField(unique=True)
|
||||
public_key = StringField(unique=True)
|
||||
|
||||
def to_dict(self):
|
||||
return {
|
||||
'name': self.name,
|
||||
'public_key': self.public_key,
|
||||
}
|
||||
|
||||
class Message(Model):
|
||||
sender = ForeignKey(User, related_name="messages_sent")
|
||||
recipient = ForeignKey(User, related_name="messages_received")
|
||||
ciphertext = StringField()
|
||||
read = BooleanField()
|
||||
Reference in New Issue
Block a user