mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-18 06:34:19 +01:00
Removes hash/cipher configuration and changes AESGCM128 for CHACHA20POLY1305
Updates tests accordingly
This commit is contained in:
@@ -6,16 +6,12 @@ from pisa.encrypted_blob import EncryptedBlob
|
||||
# Basic appointment structure
|
||||
class Appointment:
|
||||
# DISCUSS: 35-appointment-checks
|
||||
def __init__(
|
||||
self, locator, start_time, end_time, dispute_delta, encrypted_blob, cipher, hash_function, triggered=False
|
||||
):
|
||||
def __init__(self, locator, start_time, end_time, dispute_delta, encrypted_blob, triggered=False):
|
||||
self.locator = locator
|
||||
self.start_time = start_time # ToDo: #4-standardize-appointment-fields
|
||||
self.end_time = end_time # ToDo: #4-standardize-appointment-fields
|
||||
self.dispute_delta = dispute_delta
|
||||
self.encrypted_blob = EncryptedBlob(encrypted_blob)
|
||||
self.cipher = cipher
|
||||
self.hash_function = hash_function
|
||||
self.triggered = triggered
|
||||
|
||||
@classmethod
|
||||
@@ -25,30 +21,14 @@ class Appointment:
|
||||
end_time = appointment_data.get("end_time") # ToDo: #4-standardize-appointment-fields
|
||||
dispute_delta = appointment_data.get("dispute_delta")
|
||||
encrypted_blob_data = appointment_data.get("encrypted_blob")
|
||||
cipher = appointment_data.get("cipher")
|
||||
hash_function = appointment_data.get("hash_function")
|
||||
|
||||
triggered = True if appointment_data.get("triggered") is True else False
|
||||
|
||||
if any(
|
||||
v is None
|
||||
for v in [
|
||||
locator,
|
||||
start_time,
|
||||
end_time,
|
||||
dispute_delta,
|
||||
encrypted_blob_data,
|
||||
cipher,
|
||||
hash_function,
|
||||
triggered,
|
||||
]
|
||||
):
|
||||
if any(v is None for v in [locator, start_time, end_time, dispute_delta, encrypted_blob_data, triggered]):
|
||||
raise ValueError("Wrong appointment data, some fields are missing")
|
||||
|
||||
else:
|
||||
appointment = cls(
|
||||
locator, start_time, end_time, dispute_delta, encrypted_blob_data, cipher, hash_function, triggered
|
||||
)
|
||||
appointment = cls(locator, start_time, end_time, dispute_delta, encrypted_blob_data, triggered)
|
||||
|
||||
return appointment
|
||||
|
||||
@@ -60,8 +40,6 @@ class Appointment:
|
||||
"end_time": self.end_time,
|
||||
"dispute_delta": self.dispute_delta,
|
||||
"encrypted_blob": self.encrypted_blob.data,
|
||||
"cipher": self.cipher,
|
||||
"hash_function": self.hash_function,
|
||||
"triggered": self.triggered,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user