Skip to content

Commit

Permalink
Working without encryption.
Browse files Browse the repository at this point in the history
  • Loading branch information
Romulus10 committed Sep 11, 2018
1 parent 7a66fa4 commit cceefee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions blockchain_message/src/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def del_contact(self, name: str) -> bool:
return True
return False

def insert(self, to: Contact, fr: Contact, text: str, sign: str) -> Message:
def insert(self, to: Contact, fr: Contact, text: str) -> Message:
"""
Produces a message object and adds it to the internal database.
Expand All @@ -118,7 +118,7 @@ def insert(self, to: Contact, fr: Contact, text: str, sign: str) -> Message:
:param text:
:return:
"""
m = Message(self.__max_msgid() + 1, to, fr, text, sign)
m = Message(self.__max_msgid() + 1, to, fr, text, '')
self.messages.append(m)
self.__commit()
return m
Expand Down
12 changes: 6 additions & 6 deletions blockchain_message/src/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ def pull_messages(self, uname: str) -> int:
n = 0
m = self.b.retrieve(self.recv.read_contact(uname), self.recv.message_index() + 1, self.recv.contacts)
for g in m:
self.c.verify(g.text, g.sign, g.fr)
g.text = self.c.decrypt(bytes(g.text, 'utf8'))
self.recv.insert(g.to, g.fr, g.text, '')
# self.c.verify(g.text, g.sign, g.fr)
# g.text = self.c.decrypt(bytes(g.text, 'utf8'))
self.recv.insert(g.to, g.fr, g.text)
n += 1
return n

Expand All @@ -38,7 +38,7 @@ def send_message(self, uname: str, text: str):
:param text:
:return:
"""
t_c = self.c.encrypt(text, self.recv.read_contact(uname)).decode('latin-1')
t_s = self.c.sign(str(t_c))
m = self.send.insert(self.send.read_contact(uname), self.send.read_contact(self.uname), text, t_s)
# t_c = self.c.encrypt(text, self.recv.read_contact(uname)).decode('latin-1')
# t_s = self.c.sign(str(t_c))
m = self.send.insert(self.send.read_contact(uname), self.send.read_contact(self.uname), text)
self.b.submit(m)

0 comments on commit cceefee

Please sign in to comment.