From f29bb7e05498c12d29b30665e2580dd941984c66 Mon Sep 17 00:00:00 2001 From: Alva Swanson Date: Sun, 2 Jul 2023 16:07:21 +0200 Subject: [PATCH] Make DirectoryAuthorityKeyGenerator.generate(...) static --- .../local_network/DirectoryAuthorityKeyGenerationTests.java | 3 +-- .../bisq/tor/local_network/da/DirectoryAuthorityFactory.java | 3 +-- .../da/keygen/process/DirectoryAuthorityKeyGenerator.java | 5 +---- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/network/tor-local-network/src/integrationTest/java/bisq/tor/local_network/DirectoryAuthorityKeyGenerationTests.java b/network/tor-local-network/src/integrationTest/java/bisq/tor/local_network/DirectoryAuthorityKeyGenerationTests.java index 5fe05b15e4..6cda61b46f 100644 --- a/network/tor-local-network/src/integrationTest/java/bisq/tor/local_network/DirectoryAuthorityKeyGenerationTests.java +++ b/network/tor-local-network/src/integrationTest/java/bisq/tor/local_network/DirectoryAuthorityKeyGenerationTests.java @@ -43,8 +43,7 @@ public void generateKeys(@TempDir Path dataDir) throws IOException, InterruptedE .dirPort(3) .build(); - var directoryAuthorityKeyGenerator = new DirectoryAuthorityKeyGenerator(); - directoryAuthorityKeyGenerator.generate(directoryAuthority, "my_passphrase"); + DirectoryAuthorityKeyGenerator.generate(directoryAuthority, "my_passphrase"); File dataDirFile = dataDir.toFile(); assertThat(new File(dataDirFile, "fingerprint")) diff --git a/network/tor-local-network/src/main/java/bisq/tor/local_network/da/DirectoryAuthorityFactory.java b/network/tor-local-network/src/main/java/bisq/tor/local_network/da/DirectoryAuthorityFactory.java index 531a836030..5c1b7a1df7 100644 --- a/network/tor-local-network/src/main/java/bisq/tor/local_network/da/DirectoryAuthorityFactory.java +++ b/network/tor-local-network/src/main/java/bisq/tor/local_network/da/DirectoryAuthorityFactory.java @@ -42,8 +42,7 @@ public void createDirectoryAuthority(DirectoryAuthority directoryAuthority, throw new IllegalStateException("Couldn't create keys folder in data directory for directory authority."); } - var directoryAuthorityKeyGenerator = new DirectoryAuthorityKeyGenerator(); - directoryAuthorityKeyGenerator.generate(directoryAuthority, passphrase); + DirectoryAuthorityKeyGenerator.generate(directoryAuthority, passphrase); allDirectoryAuthorities.add(directoryAuthority); } diff --git a/network/tor-local-network/src/main/java/bisq/tor/local_network/da/keygen/process/DirectoryAuthorityKeyGenerator.java b/network/tor-local-network/src/main/java/bisq/tor/local_network/da/keygen/process/DirectoryAuthorityKeyGenerator.java index 8c9768fb36..140b3ca4b2 100644 --- a/network/tor-local-network/src/main/java/bisq/tor/local_network/da/keygen/process/DirectoryAuthorityKeyGenerator.java +++ b/network/tor-local-network/src/main/java/bisq/tor/local_network/da/keygen/process/DirectoryAuthorityKeyGenerator.java @@ -19,19 +19,16 @@ import bisq.tor.local_network.da.DirectoryAuthority; import bisq.tor.local_network.da.keygen.RelayKeyGenProcess; -import lombok.extern.slf4j.Slf4j; import java.io.IOException; -@Slf4j public class DirectoryAuthorityKeyGenerator { - public void generate(DirectoryAuthority directoryAuthority, String passphrase) throws IOException, InterruptedException { + public static void generate(DirectoryAuthority directoryAuthority, String passphrase) throws IOException, InterruptedException { var identityKeyGenProcess = new DirectoryIdentityKeyGenProcess( directoryAuthority.getKeysPath(), "127.0.0.1:" + directoryAuthority.getDirPort() ); identityKeyGenProcess.generateKeys(passphrase); - String identityKeyFingerprint = directoryAuthority.getIdentityKeyFingerprint().orElseThrow(); var relayKeyGenProcess = new RelayKeyGenProcess(directoryAuthority);