@@ -166,9 +166,6 @@ def smp_step_2(user_data: dict, user_data_lock, contact_id: str, blob: bytes, ui
166166 user_data ["contacts" ][contact_id ]["our_next_strand_key" ] = our_next_strand_key
167167 user_data ["contacts" ][contact_id ]["contact_next_strand_key" ] = contact_next_strand_key
168168
169- user_data ["contacts" ][contact_id ]["our_next_strand_key" ] = our_next_strand_key
170- user_data ["contacts" ][contact_id ]["contact_next_strand_key" ] = contact_next_strand_key
171-
172169
173170 user_data ["contacts" ][contact_id ]["our_next_strand_nonce" ] = our_next_strand_nonce
174171 user_data ["contacts" ][contact_id ]["contact_next_strand_nonce" ] = contact_next_strand_nonce
@@ -504,6 +501,7 @@ def smp_failure(user_data, user_data_lock, contact_id, ui_queue) -> None:
504501
505502 ui_queue .put ({"type" : "showerror" , "title" : "Error" , "message" : "Verification has failed! Please re-try." })
506503
504+ save_account_data (user_data , user_data_lock )
507505
508506def smp_failure_notify_contact (user_data , user_data_lock , contact_id , ui_queue ) -> None :
509507 with user_data_lock :
@@ -512,12 +510,20 @@ def smp_failure_notify_contact(user_data, user_data_lock, contact_id, ui_queue)
512510 session_headers = user_data ["tmp" ]["session_headers" ]
513511
514512 our_next_strand_key = user_data ["contacts" ][contact_id ]["our_next_strand_key" ]
515- our_next_strand_nonce = user_data ["contacts" ][contact_id ]["contact_next_strand_nonce " ]
513+ our_next_strand_nonce = user_data ["contacts" ][contact_id ]["our_next_strand_nonce " ]
516514
515+
517516
518517 # we don t need to save them.
519518 new_strand_key = sha3_512 (secrets .token_bytes (32 ))[:32 ]
520519 new_strand_nonce = sha3_512 (secrets .token_bytes (XCHACHA20POLY1305_NONCE_LEN ))[:XCHACHA20POLY1305_NONCE_LEN ]
520+
521+
522+ # This is so the request happens. Receiver triggers SMP failure anyway if contact is pending verification and we couldn't decrypt data.
523+ if not our_next_strand_key or not our_next_strand_nonce :
524+ our_next_strand_key = new_strand_key
525+ our_next_strand_nonce = new_strand_nonce
526+
521527 _ , ciphertext_blob = encrypt_xchacha20poly1305 (
522528 our_next_strand_key ,
523529 new_strand_key + new_strand_nonce + SMP_TYPES ["SMP_INIT" ] + b"failure" ,
0 commit comments