Skip to content

Commit

Permalink
Merge pull request #975 from alvasw/make_dir_auth_keygen_static
Browse files Browse the repository at this point in the history
Make DirectoryAuthorityKeyGenerator.generate(...) static
  • Loading branch information
alvasw authored Jul 7, 2023
2 parents 9ae6f15 + f29bb7e commit 4d88055
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4d88055

Please sign in to comment.