From a7cb049593e2bd91d8661f281cfe0b4b70cf4990 Mon Sep 17 00:00:00 2001 From: 223880 Date: Tue, 17 Sep 2024 08:04:17 -0300 Subject: [PATCH] Initial ZK integration --- qt.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/qt.py b/qt.py index 70af661..ff27b2e 100644 --- a/qt.py +++ b/qt.py @@ -11,6 +11,8 @@ from Crypto.Cipher import AES from Crypto.Random import get_random_bytes from Crypto.Util.Padding import pad, unpad +from zksk import Secret, DLRep +from zksk import utils from datetime import datetime, timedelta class CoinJoinManager: @@ -36,6 +38,8 @@ async def Network(self, network, wallet: Wallet, known_peers): async def initiate_coinjoin(self, wallet: Wallet, known_peers): self.session_id = self._generate_session_id() + sef.Secret = Secret(utils.get_random_secret()) + self.DLRep = DLRep(self.Secret, self.session_id) await self._discover_peers(known_peers) success = await self._send_coinjoin_requests(wallet) @@ -62,6 +66,10 @@ async def _send_request_to_peer(self, peer, wallet: Wallet): host, port = peer.split(':') reader, writer = await asyncio.open_connection(host, int(port)) + # ZK proof keys and encrypt the request + Secret = DLRep(utils.get_random_secret()) + request = self._create_coinjoin_request(wallet) + # Generate AES key and encrypt the request key = get_random_bytes(16) # AES-128, for AES-256 use 32 bytes request = self._create_coinjoin_request(wallet)