mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Update uses of encryption.encrypt to more accurate encryption.sign
This commit is contained in:
@@ -79,7 +79,7 @@ def get_pdf_for_templated_letter(self, notification_id):
|
||||
'key_type': notification.key_type
|
||||
}
|
||||
|
||||
encrypted_data = encryption.encrypt(letter_data)
|
||||
encrypted_data = encryption.sign(letter_data)
|
||||
|
||||
notify_celery.send_task(
|
||||
name=TaskNames.CREATE_PDF_FOR_TEMPLATED_LETTER,
|
||||
@@ -328,7 +328,7 @@ def sanitise_letter(self, filename):
|
||||
|
||||
@notify_celery.task(bind=True, name='process-sanitised-letter', max_retries=15, default_retry_delay=300)
|
||||
def process_sanitised_letter(self, sanitise_data):
|
||||
letter_details = encryption.decrypt(sanitise_data)
|
||||
letter_details = encryption.verify_signature(sanitise_data)
|
||||
|
||||
filename = letter_details['filename']
|
||||
notification_id = letter_details['notification_id']
|
||||
|
||||
@@ -12,7 +12,7 @@ from app.utils import DATETIME_FORMAT
|
||||
def send_delivery_status_to_service(
|
||||
self, notification_id, encrypted_status_update
|
||||
):
|
||||
status_update = encryption.decrypt(encrypted_status_update)
|
||||
status_update = encryption.verify_signature(encrypted_status_update)
|
||||
|
||||
data = {
|
||||
"id": str(notification_id),
|
||||
@@ -38,7 +38,7 @@ def send_delivery_status_to_service(
|
||||
|
||||
@notify_celery.task(bind=True, name="send-complaint", max_retries=5, default_retry_delay=300)
|
||||
def send_complaint_to_service(self, complaint_data):
|
||||
complaint = encryption.decrypt(complaint_data)
|
||||
complaint = encryption.verify_signature(complaint_data)
|
||||
|
||||
data = {
|
||||
"notification_id": complaint['notification_id'],
|
||||
@@ -125,7 +125,7 @@ def create_delivery_status_callback_data(notification, service_callback_api):
|
||||
"template_id": str(notification.template_id),
|
||||
"template_version": notification.template_version,
|
||||
}
|
||||
return encryption.encrypt(data)
|
||||
return encryption.sign(data)
|
||||
|
||||
|
||||
def create_complaint_callback_data(complaint, notification, service_callback_api, recipient):
|
||||
@@ -138,4 +138,4 @@ def create_complaint_callback_data(complaint, notification, service_callback_api
|
||||
"service_callback_api_url": service_callback_api.url,
|
||||
"service_callback_api_bearer_token": service_callback_api.bearer_token,
|
||||
}
|
||||
return encryption.encrypt(data)
|
||||
return encryption.sign(data)
|
||||
|
||||
@@ -125,7 +125,7 @@ def get_recipient_csv_and_template_and_sender_id(job):
|
||||
|
||||
def process_row(row, template, job, service, sender_id=None):
|
||||
template_type = template.template_type
|
||||
encrypted = encryption.encrypt({
|
||||
encrypted = encryption.sign({
|
||||
'template': str(template.id),
|
||||
'template_version': job.template_version,
|
||||
'job': str(job.id),
|
||||
@@ -183,7 +183,7 @@ def save_sms(self,
|
||||
notification_id,
|
||||
encrypted_notification,
|
||||
sender_id=None):
|
||||
notification = encryption.decrypt(encrypted_notification)
|
||||
notification = encryption.verify_signature(encrypted_notification)
|
||||
service = SerialisedService.from_id(service_id)
|
||||
template = SerialisedTemplate.from_id_and_service_id(
|
||||
notification['template'],
|
||||
@@ -241,7 +241,7 @@ def save_email(self,
|
||||
notification_id,
|
||||
encrypted_notification,
|
||||
sender_id=None):
|
||||
notification = encryption.decrypt(encrypted_notification)
|
||||
notification = encryption.verify_signature(encrypted_notification)
|
||||
|
||||
service = SerialisedService.from_id(service_id)
|
||||
template = SerialisedTemplate.from_id_and_service_id(
|
||||
@@ -298,7 +298,7 @@ def save_api_sms(self, encrypted_notification):
|
||||
|
||||
|
||||
def save_api_email_or_sms(self, encrypted_notification):
|
||||
notification = encryption.decrypt(encrypted_notification)
|
||||
notification = encryption.verify_signature(encrypted_notification)
|
||||
service = SerialisedService.from_id(notification['service_id'])
|
||||
q = QueueNames.SEND_EMAIL if notification['notification_type'] == EMAIL_TYPE else QueueNames.SEND_SMS
|
||||
provider_task = provider_tasks.deliver_email if notification['notification_type'] == EMAIL_TYPE \
|
||||
@@ -348,7 +348,7 @@ def save_letter(
|
||||
notification_id,
|
||||
encrypted_notification,
|
||||
):
|
||||
notification = encryption.decrypt(encrypted_notification)
|
||||
notification = encryption.verify_signature(encrypted_notification)
|
||||
|
||||
postal_address = PostalAddress.from_personalisation(
|
||||
InsensitiveDict(notification['personalisation'])
|
||||
|
||||
Reference in New Issue
Block a user