Search in sources :

Example 1 with KeyStorage

use of io.bitsquare.common.crypto.KeyStorage in project bitsquare by bitsquare.

the class StressTestMailboxMessage method createPeerNode.

@NotNull
private P2PService createPeerNode(int n, int port) {
    // peer data directories
    final File peerDir = new File(testDataDir.toFile(), String.format("peer-%06d", n));
    final File peerTorDir = new File(peerDir, "tor");
    final File peerStorageDir = new File(peerDir, "db");
    final File peerKeysDir = new File(peerDir, "keys");
    //noinspection ResultOfMethodCallIgnored
    // needed for creating the key ring
    peerKeysDir.mkdirs();
    // peer keys
    final KeyStorage peerKeyStorage = new KeyStorage(peerKeysDir);
    final KeyRing peerKeyRing = new KeyRing(peerKeyStorage);
    final EncryptionService peerEncryptionService = new EncryptionService(peerKeyRing);
    return new P2PService(seedNodesRepository, port, peerTorDir, useLocalhost, REGTEST_NETWORK_ID, P2PService.MAX_CONNECTIONS_DEFAULT, peerStorageDir, null, null, null, new Clock(), null, peerEncryptionService, peerKeyRing);
}
Also used : PubKeyRing(io.bitsquare.common.crypto.PubKeyRing) KeyRing(io.bitsquare.common.crypto.KeyRing) KeyStorage(io.bitsquare.common.crypto.KeyStorage) EncryptionService(io.bitsquare.crypto.EncryptionService) Clock(io.bitsquare.common.Clock) File(java.io.File) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Clock (io.bitsquare.common.Clock)1 KeyRing (io.bitsquare.common.crypto.KeyRing)1 KeyStorage (io.bitsquare.common.crypto.KeyStorage)1 PubKeyRing (io.bitsquare.common.crypto.PubKeyRing)1 EncryptionService (io.bitsquare.crypto.EncryptionService)1 File (java.io.File)1 NotNull (org.jetbrains.annotations.NotNull)1