Add encryption module

This commit is contained in:
Chris Proctor
2024-05-18 16:09:35 -04:00
parent 533e52f90e
commit 9cfb19e2b4
6 changed files with 505 additions and 0 deletions

22
server/app/models.py Normal file
View 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()