Search in sources :

Example 1 with SignerConfigurationBuilder

use of tech.pegasys.web3signer.dsl.signer.SignerConfigurationBuilder in project web3signer by ConsenSys.

the class KeyManagerTestBase method setupSignerWithKeyManagerApi.

protected void setupSignerWithKeyManagerApi(final boolean insertSlashingProtectionData) throws URISyntaxException {
    final SignerConfigurationBuilder builder = new SignerConfigurationBuilder();
    builder.withKeyStoreDirectory(testDirectory).withMode("eth2").withAltairForkEpoch(MINIMAL_ALTAIR_FORK).withSlashingEnabled(true).withSlashingProtectionDbUsername(DB_USERNAME).withSlashingProtectionDbPassword(DB_PASSWORD).withKeyManagerApiEnabled(true);
    startSigner(builder.build());
    if (insertSlashingProtectionData) {
        final SignerConfigurationBuilder importBuilder = new SignerConfigurationBuilder();
        importBuilder.withMode("eth2").withSlashingEnabled(true).withSlashingProtectionDbUrl(signer.getSlashingDbUrl()).withSlashingProtectionDbUsername(DB_USERNAME).withSlashingProtectionDbPassword(DB_PASSWORD).withKeyStoreDirectory(testDirectory).withSlashingImportPath(getResourcePath("slashing/slashingImport_two_entries.json")).withHttpPort(// prevent wait for Ports file in AT
        12345);
        final Signer importSigner = new Signer(importBuilder.build(), null);
        importSigner.start();
        waitFor(() -> assertThat(importSigner.isRunning()).isFalse());
    }
}
Also used : Signer(tech.pegasys.web3signer.dsl.signer.Signer) SignerConfigurationBuilder(tech.pegasys.web3signer.dsl.signer.SignerConfigurationBuilder)

Example 2 with SignerConfigurationBuilder

use of tech.pegasys.web3signer.dsl.signer.SignerConfigurationBuilder in project web3signer by ConsenSys.

the class SigningAcceptanceTestBase method setupEth2SignerMinimalWithoutAltairFork.

protected void setupEth2SignerMinimalWithoutAltairFork() {
    final SignerConfigurationBuilder builder = new SignerConfigurationBuilder();
    builder.withKeyStoreDirectory(testDirectory).withMode("eth2").withNetwork("minimal");
    startSigner(builder.build());
}
Also used : SignerConfigurationBuilder(tech.pegasys.web3signer.dsl.signer.SignerConfigurationBuilder)

Example 3 with SignerConfigurationBuilder

use of tech.pegasys.web3signer.dsl.signer.SignerConfigurationBuilder in project web3signer by ConsenSys.

the class AzureKeyVaultAcceptanceTest method invalidVaultParametersFailsToStartSigner.

@Test
void invalidVaultParametersFailsToStartSigner() {
    final AzureKeyVaultParameters azureParams = new DefaultAzureKeyVaultParameters("nonExistentVault", CLIENT_ID, TENANT_ID, CLIENT_SECRET);
    final SignerConfigurationBuilder configBuilder = new SignerConfigurationBuilder().withMode("eth2").withAzureKeyVaultParameters(azureParams).withHttpPort(// required to prevent waiting for ports file.
    9000);
    final Signer signer = new Signer(configBuilder.build(), null);
    signer.start();
    waitFor(30, () -> assertThat(signer.isRunning()).isTrue());
    waitFor(30, () -> assertThat(signer.isRunning()).isFalse());
}
Also used : Signer(tech.pegasys.web3signer.dsl.signer.Signer) SignerConfigurationBuilder(tech.pegasys.web3signer.dsl.signer.SignerConfigurationBuilder) AzureKeyVaultParameters(tech.pegasys.web3signer.core.config.AzureKeyVaultParameters) DefaultAzureKeyVaultParameters(tech.pegasys.web3signer.dsl.utils.DefaultAzureKeyVaultParameters) DefaultAzureKeyVaultParameters(tech.pegasys.web3signer.dsl.utils.DefaultAzureKeyVaultParameters) Test(org.junit.jupiter.api.Test)

Example 4 with SignerConfigurationBuilder

use of tech.pegasys.web3signer.dsl.signer.SignerConfigurationBuilder in project web3signer by ConsenSys.

the class AzureKeyVaultAcceptanceTest method ensureSecretsInKeyVaultAreLoadedAndReportedViaPublicKeysApi.

@Test
void ensureSecretsInKeyVaultAreLoadedAndReportedViaPublicKeysApi() {
    final AzureKeyVaultParameters azureParams = new DefaultAzureKeyVaultParameters(VAULT_NAME, CLIENT_ID, TENANT_ID, CLIENT_SECRET);
    final SignerConfigurationBuilder configBuilder = new SignerConfigurationBuilder().withMode("eth2").withAzureKeyVaultParameters(azureParams);
    startSigner(configBuilder.build());
    final Response response = signer.callApiPublicKeys(KeyType.BLS);
    response.then().statusCode(200).contentType(ContentType.JSON).body("", contains(EXPECTED_KEY));
}
Also used : Response(io.restassured.response.Response) SignerConfigurationBuilder(tech.pegasys.web3signer.dsl.signer.SignerConfigurationBuilder) AzureKeyVaultParameters(tech.pegasys.web3signer.core.config.AzureKeyVaultParameters) DefaultAzureKeyVaultParameters(tech.pegasys.web3signer.dsl.utils.DefaultAzureKeyVaultParameters) DefaultAzureKeyVaultParameters(tech.pegasys.web3signer.dsl.utils.DefaultAzureKeyVaultParameters) Test(org.junit.jupiter.api.Test)

Example 5 with SignerConfigurationBuilder

use of tech.pegasys.web3signer.dsl.signer.SignerConfigurationBuilder in project web3signer by ConsenSys.

the class HttpHostAllowListAcceptanceTest method httpEndpointForNonAllowedHostRespondsWithForbiddenResponse.

@Test
void httpEndpointForNonAllowedHostRespondsWithForbiddenResponse() {
    final SignerConfiguration signerConfiguration = new SignerConfigurationBuilder().withHttpAllowHostList(Collections.singletonList("127.0.0.1")).withMode("eth2").build();
    startSigner(signerConfiguration);
    given().baseUri(signer.getUrl()).contentType(ContentType.JSON).when().header("Host", "bar").get(UPCHECK_ENDPOINT).then().assertThat().statusCode(403);
}
Also used : SignerConfigurationBuilder(tech.pegasys.web3signer.dsl.signer.SignerConfigurationBuilder) SignerConfiguration(tech.pegasys.web3signer.dsl.signer.SignerConfiguration) Test(org.junit.jupiter.api.Test)

Aggregations

SignerConfigurationBuilder (tech.pegasys.web3signer.dsl.signer.SignerConfigurationBuilder)47 Test (org.junit.jupiter.api.Test)28 Signer (tech.pegasys.web3signer.dsl.signer.Signer)12 SignerConfiguration (tech.pegasys.web3signer.dsl.signer.SignerConfiguration)11 Response (io.restassured.response.Response)9 Path (java.nio.file.Path)9 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)8 DefaultAzureKeyVaultParameters (tech.pegasys.web3signer.dsl.utils.DefaultAzureKeyVaultParameters)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 Jdbi (org.jdbi.v3.core.Jdbi)3 ValueSource (org.junit.jupiter.params.provider.ValueSource)3 TlsOptions (tech.pegasys.web3signer.core.config.TlsOptions)3 BasicTlsOptions (tech.pegasys.web3signer.dsl.tls.BasicTlsOptions)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 ValueNode (com.fasterxml.jackson.databind.node.ValueNode)2 Request (com.github.arteam.simplejsonrpc.core.domain.Request)2 InterchangeV5Format (dsl.InterchangeV5Format)2 SignedArtifacts (dsl.SignedArtifacts)2 Map (java.util.Map)2 AzureKeyVaultParameters (tech.pegasys.web3signer.core.config.AzureKeyVaultParameters)2