diff --git a/sms/india/nimbus/controllers/async_nimbus.py b/sms/india/nimbus/controllers/async_nimbus.py index 0830cbf..d758ebf 100644 --- a/sms/india/nimbus/controllers/async_nimbus.py +++ b/sms/india/nimbus/controllers/async_nimbus.py @@ -199,6 +199,7 @@ class AsyncNimbusSMS: # Construct the basic structure of the response of this method: summary = SentSMSMessageModel( + client = "nimbusSmsIndia", sender = {"senderId": self.__sender_id}, recipient = {"recipientNo": recipient_number}, text = message, diff --git a/sms/models/sms_message.py b/sms/models/sms_message.py index 44c5a18..972f9c2 100644 --- a/sms/models/sms_message.py +++ b/sms/models/sms_message.py @@ -79,6 +79,11 @@ import datetime class SentSMSMessageModel(BaseModel): + client: str = Field( + description = "The name of the client (service) that was used.", + frozen = True + ) + ts: AwareDatetime = Field( description = "the time (utc) at which this message was sent by the sender", frozen = True, diff --git a/web/certs/expiry.py b/web/certs/expiry.py index 1b82ded..6086f01 100644 --- a/web/certs/expiry.py +++ b/web/certs/expiry.py @@ -35,6 +35,9 @@ import sys sys.path.append(".") sys.path.append("..") +# System-level activities: +import io + # To check certs through cryptographic algorithms: from cryptography import x509 from cryptography.hazmat.backends import default_backend @@ -204,7 +207,7 @@ class CertExpiryCheck: # ┃ ┏┓┏┏┓┃ ┃ ┏┓┏┓╋┏ # ┗┛┗┛┗┗┻┗ ┗┛┗ ┛ ┗┛ - def load_local(self, path: str) -> bool: + def load_local(self, path: str | io.BytesIO) -> bool: """ Loads a certificate stored on a local file path and checks for its validity. @@ -221,8 +224,13 @@ class CertExpiryCheck: try: # Read the contents of the certificate file: - with open(path, 'rb') as f: - cert_data = f.read() + if isinstance(path, str): + with open(path, 'rb') as f: + cert_data = f.read() + elif isinstance(path, io.BytesIO): + path.seek(0) + cert_data = path.read() + else: cert_data = None # Load the certificate: cert = x509.load_pem_x509_certificate(cert_data, default_backend())