Search in sources :

Example 1 with DirectKeyPair

use of com.quorum.tessera.config.keypairs.DirectKeyPair in project tessera by ConsenSys.

the class KeyDataMarshallerTest method defaultMarshal.

@Test
public void defaultMarshal() {
    KeyDataMarshaller k = new DefaultKeyDataMarshaller();
    DirectKeyPair configKeyPair = new DirectKeyPair("PUBLIC", "PRIVATE");
    KeyData keyData = k.marshal(configKeyPair);
    assertThat(keyData).isNotNull();
    assertThat(keyData.getPublicKey()).isEqualTo("PUBLIC");
    assertThat(keyData.getPrivateKey()).isEqualTo("PRIVATE");
}
Also used : DirectKeyPair(com.quorum.tessera.config.keypairs.DirectKeyPair) KeyData(com.quorum.tessera.config.KeyData) Test(org.junit.Test)

Example 2 with DirectKeyPair

use of com.quorum.tessera.config.keypairs.DirectKeyPair in project tessera by ConsenSys.

the class ValidationTest method directKeyPairInvalidBase64.

@Test
public void directKeyPairInvalidBase64() {
    DirectKeyPair keyPair = new DirectKeyPair("INVALID_BASE", "INVALID_BASE");
    Set<ConstraintViolation<DirectKeyPair>> violations = validator.validate(keyPair);
    assertThat(violations).hasSize(2);
    Iterator<ConstraintViolation<DirectKeyPair>> iterator = violations.iterator();
    ConstraintViolation<DirectKeyPair> violation = iterator.next();
    assertThat(violation.getMessageTemplate()).isEqualTo("Invalid Base64 key provided");
    ConstraintViolation<DirectKeyPair> violation2 = iterator.next();
    assertThat(violation2.getMessageTemplate()).isEqualTo("Invalid Base64 key provided");
}
Also used : DirectKeyPair(com.quorum.tessera.config.keypairs.DirectKeyPair) ConstraintViolation(jakarta.validation.ConstraintViolation) Test(org.junit.Test)

Aggregations

DirectKeyPair (com.quorum.tessera.config.keypairs.DirectKeyPair)2 Test (org.junit.Test)2 KeyData (com.quorum.tessera.config.KeyData)1 ConstraintViolation (jakarta.validation.ConstraintViolation)1