@@ -483,12 +483,25 @@ def smp_failure_notify_contact(user_data, user_data_lock, contact_id, ui_queue)
483483 server_url = user_data ["server_url" ]
484484 auth_token = user_data ["token" ]
485485
486+ tmp_key = b64decode (user_data ["contacts" ][contact_id ]["lt_sign_key_smp" ]["tmp_key" ])
487+
486488 smp_failure (user_data , user_data_lock , contact_id , ui_queue )
487489
490+ # it can be any number other than 2, we chose 7 because failure is *technically* the 7th smp step.
491+ ciphertext_nonce , ciphertext_blob = encrypt_xchacha20poly1305 (
492+ tmp_key ,
493+ SMP_TYPE + b"failure" ,
494+ counter = 7
495+ )
488496 try :
489- http_request (f"{ server_url } /smp/failure" , "POST" , payload = {"recipient" : contact_id }, auth_token = auth_token )
490- except Exception :
491- logger .error ("Failed to send SMP failure to server, either you are offline or the server is down" )
497+ http_request (f"{ server_url } /data/send" , "POST" , metadata = {
498+ "recipient" : contact_id
499+ },
500+ blob = ciphertext_nonce + ciphertext_blob ,
501+ auth_token = auth_token
502+ )
503+ except Exception as e :
504+ logger .error ("Failed to send SMP failure to contact (%s), either you are offline or the server is down. Error: %s" , contact_id , str (e ))
492505 pass
493506
494507
@@ -516,12 +529,12 @@ def smp_data_handler(user_data, user_data_lock, user_data_copied, ui_queue, cont
516529
517530
518531
519- """
520- if "failure" in message :
532+
533+ if message == b "failure" :
521534 # Delete SMP state for contact
522535 smp_failure (user_data , user_data_lock , contact_id , ui_queue )
523536 return
524- """
537+
525538
526539 # Check if we don't have this contact saved
527540 if contact_id not in user_data_copied ["contacts" ]:
0 commit comments