Skip to content

Commit

Permalink
Initial ZK integration
Browse files Browse the repository at this point in the history
  • Loading branch information
223880 committed Sep 17, 2024
1 parent a60dc25 commit a7cb049
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit a7cb049

Please sign in to comment.