Search in sources :

Example 1 with EthPublicKeyUtils

use of tech.pegasys.signers.secp256k1.EthPublicKeyUtils in project signers by ConsenSys.

the class FileBasedTomlLoadingAcceptanceTest method validFileBasedTomlFileWithMultineLinePasswordFileProducesSignerWhichReportsMatchingAddress.

@Test
void validFileBasedTomlFileWithMultineLinePasswordFileProducesSignerWhichReportsMatchingAddress(@TempDir Path tomlDirectory) throws URISyntaxException, IOException {
    final Path passwordFile = Files.writeString(tomlDirectory.resolve("password.txt"), String.format("password%nsecond line%n"));
    createFileBasedTomlFileAt(tomlDirectory.resolve(PUBLIC_KEY_HEX_STRING + ".toml").toAbsolutePath(), new File(Resources.getResource("secp256k1/UTC--2019-12-05T05-17-11.151993000Z--a01f618424b0113a9cebdc6cb66ca5b48e9120c5.key").toURI()).getAbsolutePath(), passwordFile.toString());
    setup(tomlDirectory);
    assertThat(signerProvider.availablePublicKeys(PublicKeySignerIdentifier::new).stream().map(EthPublicKeyUtils::toHexString)).containsOnly("0x" + PUBLIC_KEY_HEX_STRING);
}
Also used : Path(java.nio.file.Path) EthPublicKeyUtils(tech.pegasys.signers.secp256k1.EthPublicKeyUtils) PublicKeySignerIdentifier(tech.pegasys.signers.secp256k1.common.PublicKeySignerIdentifier) File(java.io.File) Test(org.junit.jupiter.api.Test)

Aggregations

File (java.io.File)1 Path (java.nio.file.Path)1 Test (org.junit.jupiter.api.Test)1 EthPublicKeyUtils (tech.pegasys.signers.secp256k1.EthPublicKeyUtils)1 PublicKeySignerIdentifier (tech.pegasys.signers.secp256k1.common.PublicKeySignerIdentifier)1