diff --git a/src/api.rs b/src/api.rs index ad5497b..4e7d533 100644 --- a/src/api.rs +++ b/src/api.rs @@ -1111,10 +1111,18 @@ pub fn parse_cipher(cipher_msg: String) -> ApiResult { .map_err(|e| ApiError::new(format!("Failed to handle decrypted message: {}", e))); } - // If both decryption attempts fail, return an error - Err(ApiError::new( - "Failed to decrypt cipher with any known method".to_owned(), - )) + // If both decryption attempts fail, we keep it just in case we receive the transaction later + let mut return_msg = CachedMessage::new(); + return_msg.cipher = vec![cipher_msg]; + return_msg.status = CachedMessageStatus::CipherWaitingTx; + + let mut messages_cache = lock_messages()?; + messages_cache.push(return_msg.clone()); + + Ok(ApiReturn { + updated_cached_msg: vec![return_msg], + ..Default::default() + }) } #[wasm_bindgen]