mirror of
https://github.com/aljazceru/python-teos.git
synced 2025-12-17 14:14:22 +01:00
Made signing key optional (will only sign if given)
This commit is contained in:
@@ -17,6 +17,7 @@ EXPIRY_DELTA = 6
|
|||||||
MIN_DISPUTE_DELTA = 20
|
MIN_DISPUTE_DELTA = 20
|
||||||
SERVER_LOG_FILE = 'pisa.log'
|
SERVER_LOG_FILE = 'pisa.log'
|
||||||
DB_PATH = 'appointments/'
|
DB_PATH = 'appointments/'
|
||||||
|
SIGNING_KEY_DER = None
|
||||||
|
|
||||||
# PISA-CLI
|
# PISA-CLI
|
||||||
CLIENT_LOG_FILE = 'pisa.log'
|
CLIENT_LOG_FILE = 'pisa.log'
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ class Watcher:
|
|||||||
self.max_appointments = max_appointments
|
self.max_appointments = max_appointments
|
||||||
self.zmq_subscriber = None
|
self.zmq_subscriber = None
|
||||||
self.responder = Responder()
|
self.responder = Responder()
|
||||||
self.sk = ecdsa.SigningKey.from_der(SIGNING_KEY_DER)
|
self.signing_key = ecdsa.SigningKey.from_der(SIGNING_KEY_DER) if SIGNING_KEY_DER is not None else None
|
||||||
|
|
||||||
def add_appointment(self, appointment):
|
def add_appointment(self, appointment):
|
||||||
# Rationale:
|
# Rationale:
|
||||||
@@ -63,7 +63,8 @@ class Watcher:
|
|||||||
|
|
||||||
logger.info("New appointment accepted.", locator=appointment.locator)
|
logger.info("New appointment accepted.", locator=appointment.locator)
|
||||||
|
|
||||||
signature = self.sk.sign(appointment.serialize().encode('utf8'))
|
if (self.signing_key is not None):
|
||||||
|
signature = self.signing_key.sign(appointment.serialize().encode('utf8'))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
appointment_added = False
|
appointment_added = False
|
||||||
|
|||||||
Reference in New Issue
Block a user