mirror of
https://github.com/aljazceru/python-teos.git
synced 2026-02-23 15:34:18 +01:00
Refactors signing/verifiying functionality to be part of the Cryptographer
- All encryption/decryption and signing/verifying calls are performed by the cryptographer now. - The current signature format is temporal. We should define something not base on json. - Some Cryptographer tests are still missing. - The cli tests should be modified to fit this too.
This commit is contained in:
@@ -32,7 +32,7 @@ class Appointment:
|
||||
|
||||
return appointment
|
||||
|
||||
def to_dict(self):
|
||||
def to_dict(self, include_triggered=True):
|
||||
# ToDO: #3-improve-appointment-structure
|
||||
appointment = {
|
||||
"locator": self.locator,
|
||||
@@ -40,15 +40,16 @@ class Appointment:
|
||||
"end_time": self.end_time,
|
||||
"dispute_delta": self.dispute_delta,
|
||||
"encrypted_blob": self.encrypted_blob.data,
|
||||
"triggered": self.triggered,
|
||||
}
|
||||
|
||||
if include_triggered:
|
||||
appointment["triggered"] = self.triggered
|
||||
|
||||
return appointment
|
||||
|
||||
def to_json(self):
|
||||
return json.dumps(self.to_dict(), sort_keys=True, separators=(",", ":"))
|
||||
|
||||
def serialize(self):
|
||||
data = self.to_dict()
|
||||
data.pop("triggered")
|
||||
return json.dumps(data, sort_keys=True, separators=(",", ":")).encode("utf-8")
|
||||
# FIXME: This is temporary serialization. A proper one is required
|
||||
return self.to_dict(include_triggered=False)
|
||||
|
||||
Reference in New Issue
Block a user