Search in sources :

Example 26 with Enclave

use of com.quorum.tessera.enclave.Enclave in project tessera by ConsenSys.

the class EnclaveKeySynchroniserProvider method provider.

public static EnclaveKeySynchroniser provider() {
    LOGGER.debug("Creating Enclave");
    Enclave enclave = Enclave.create();
    LOGGER.debug("Created Enclave {}", enclave);
    LOGGER.debug("Creating NetworkStore");
    NetworkStore networkStore = NetworkStore.getInstance();
    LOGGER.debug("Created NetworkStore");
    return new EnclaveKeySynchroniserImpl(enclave, networkStore);
}
Also used : Enclave(com.quorum.tessera.enclave.Enclave) NetworkStore(com.quorum.tessera.discovery.NetworkStore)

Example 27 with Enclave

use of com.quorum.tessera.enclave.Enclave in project tessera by ConsenSys.

the class P2PRestApp method getSingletons.

@Override
public Set<Object> getSingletons() {
    RuntimeContext runtimeContext = RuntimeContext.getInstance();
    List<URI> peers = runtimeContext.getPeers();
    LOGGER.debug("Found configured peers {}", peers);
    peers.stream().map(NodeUri::create).map(NodeUri::asURI).peek(u -> LOGGER.debug("Adding {} to party store", u)).forEach(partyStore::store);
    final PartyInfoResource partyInfoResource = new PartyInfoResource(discovery, partyInfoParser, runtimeContext.getP2pClient(), enclave, runtimeContext.isRemoteKeyValidation());
    final IPWhitelistFilter iPWhitelistFilter = new IPWhitelistFilter();
    final TransactionResource transactionResource = new TransactionResource(transactionManager, batchResendManager, legacyResendManager);
    final UpCheckResource upCheckResource = new UpCheckResource();
    final PrivacyGroupResource privacyGroupResource = new PrivacyGroupResource(privacyGroupManager);
    if (runtimeContext.isRecoveryMode()) {
        final RecoveryResource recoveryResource = new RecoveryResource(transactionManager, batchResendManager);
        return Set.of(partyInfoResource, iPWhitelistFilter, recoveryResource, upCheckResource);
    }
    return Set.of(partyInfoResource, iPWhitelistFilter, transactionResource, privacyGroupResource, upCheckResource);
}
Also used : PartyInfoParser(com.quorum.tessera.p2p.partyinfo.PartyInfoParser) AppType(com.quorum.tessera.config.AppType) Logger(org.slf4j.Logger) TransactionManager(com.quorum.tessera.transaction.TransactionManager) LoggerFactory(org.slf4j.LoggerFactory) BatchResendManager(com.quorum.tessera.recovery.workflow.BatchResendManager) Set(java.util.Set) PrivacyGroupManager(com.quorum.tessera.privacygroup.PrivacyGroupManager) NodeUri(com.quorum.tessera.discovery.NodeUri) PartyStore(com.quorum.tessera.p2p.partyinfo.PartyStore) Objects(java.util.Objects) Discovery(com.quorum.tessera.discovery.Discovery) ApplicationPath(jakarta.ws.rs.ApplicationPath) List(java.util.List) Stream(java.util.stream.Stream) UpCheckResource(com.quorum.tessera.api.common.UpCheckResource) GlobalFilter(com.quorum.tessera.api.filter.GlobalFilter) RuntimeContext(com.quorum.tessera.context.RuntimeContext) Enclave(com.quorum.tessera.enclave.Enclave) URI(java.net.URI) LegacyResendManager(com.quorum.tessera.recovery.workflow.LegacyResendManager) Collectors.toSet(java.util.stream.Collectors.toSet) IPWhitelistFilter(com.quorum.tessera.api.filter.IPWhitelistFilter) TesseraRestApplication(com.quorum.tessera.app.TesseraRestApplication) UpCheckResource(com.quorum.tessera.api.common.UpCheckResource) IPWhitelistFilter(com.quorum.tessera.api.filter.IPWhitelistFilter) NodeUri(com.quorum.tessera.discovery.NodeUri) RuntimeContext(com.quorum.tessera.context.RuntimeContext) URI(java.net.URI)

Example 28 with Enclave

use of com.quorum.tessera.enclave.Enclave in project tessera by ConsenSys.

the class P2PRestAppTest method setUp.

@Before
public void setUp() {
    runtimeContext = mock(RuntimeContext.class);
    enclave = mock(Enclave.class);
    discovery = mock(Discovery.class);
    partyStore = mock(PartyStore.class);
    transactionManager = mock(TransactionManager.class);
    batchResendManager = mock(BatchResendManager.class);
    legacyResendManager = mock(LegacyResendManager.class);
    privacyGroupManager = mock(PrivacyGroupManager.class);
    p2PRestApp = new P2PRestApp(discovery, enclave, partyStore, transactionManager, batchResendManager, legacyResendManager, privacyGroupManager);
    Client client = mock(Client.class);
    when(runtimeContext.getP2pClient()).thenReturn(client);
    when(runtimeContext.isRemoteKeyValidation()).thenReturn(true);
    when(runtimeContext.getPeers()).thenReturn(List.of(peerUri));
}
Also used : BatchResendManager(com.quorum.tessera.recovery.workflow.BatchResendManager) PrivacyGroupManager(com.quorum.tessera.privacygroup.PrivacyGroupManager) Enclave(com.quorum.tessera.enclave.Enclave) TransactionManager(com.quorum.tessera.transaction.TransactionManager) PartyStore(com.quorum.tessera.p2p.partyinfo.PartyStore) Discovery(com.quorum.tessera.discovery.Discovery) LegacyResendManager(com.quorum.tessera.recovery.workflow.LegacyResendManager) RuntimeContext(com.quorum.tessera.context.RuntimeContext) Client(jakarta.ws.rs.client.Client) Before(org.junit.Before)

Example 29 with Enclave

use of com.quorum.tessera.enclave.Enclave in project tessera by ConsenSys.

the class TransactionRequesterProvider method provider.

public static TransactionRequester provider() {
    Enclave enclave = Enclave.create();
    ResendClient resendClient = ResendClient.create();
    return new TransactionRequesterImpl(enclave, resendClient);
}
Also used : Enclave(com.quorum.tessera.enclave.Enclave)

Aggregations

Enclave (com.quorum.tessera.enclave.Enclave)29 Test (org.junit.Test)11 Discovery (com.quorum.tessera.discovery.Discovery)9 EncryptedTransactionDAO (com.quorum.tessera.data.EncryptedTransactionDAO)7 PayloadDigest (com.quorum.tessera.enclave.PayloadDigest)6 RuntimeContext (com.quorum.tessera.context.RuntimeContext)5 PayloadPublisher (com.quorum.tessera.transaction.publish.PayloadPublisher)5 NetworkStore (com.quorum.tessera.discovery.NetworkStore)4 PrivacyHelper (com.quorum.tessera.transaction.PrivacyHelper)4 TransactionManager (com.quorum.tessera.transaction.TransactionManager)4 Config (com.quorum.tessera.config.Config)3 PrivacyGroupManager (com.quorum.tessera.privacygroup.PrivacyGroupManager)3 LegacyResendManager (com.quorum.tessera.recovery.workflow.LegacyResendManager)3 Client (jakarta.ws.rs.client.Client)3 CliResult (com.quorum.tessera.cli.CliResult)2 ConfigKeyPair (com.quorum.tessera.config.keypairs.ConfigKeyPair)2 KeyEncryptor (com.quorum.tessera.config.keys.KeyEncryptor)2 RestClientFactory (com.quorum.tessera.context.RestClientFactory)2 PartyStore (com.quorum.tessera.p2p.partyinfo.PartyStore)2 ResendBatchPublisher (com.quorum.tessera.recovery.resend.ResendBatchPublisher)2