Search in sources :

Example 91 with EncodedPayload

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

the class ResendIndividualIT method resendTransactionWhereKeyIsSender.

@Test
public void resendTransactionWhereKeyIsSender() {
    final ResendRequest request = new ResendRequest();
    request.setType(RESEND_INDIVIDUAL_VALUE);
    request.setKey(this.hash);
    request.setPublicKey(sender.getPublicKey());
    final Response response = vanillaHttpOnlyClient.target(recipient.getP2PUri()).path(RESEND_PATH).request().post(Entity.entity(request, MediaType.APPLICATION_JSON_TYPE));
    assertThat(response).isNotNull();
    assertThat(response.getStatus()).isEqualTo(200);
    final byte[] returnValue = response.readEntity(byte[].class);
    final EncodedPayload payload = ENCODER.decode(returnValue);
    assertThat(payload).isNotNull();
    assertThat(payload.getRecipientKeys().get(0).encodeToBase64()).isEqualTo(recipient.getPublicKey());
    assertThat(payload.getSenderKey().encodeToBase64()).isEqualTo(sender.getPublicKey());
}
Also used : Response(jakarta.ws.rs.core.Response) EncodedPayload(com.quorum.tessera.enclave.EncodedPayload) ResendRequest(com.quorum.tessera.p2p.resend.ResendRequest) Test(org.junit.Test)

Aggregations

EncodedPayload (com.quorum.tessera.enclave.EncodedPayload)91 Test (org.junit.Test)60 PublicKey (com.quorum.tessera.encryption.PublicKey)50 PayloadEncoder (com.quorum.tessera.enclave.PayloadEncoder)23 Response (jakarta.ws.rs.core.Response)20 MessageHash (com.quorum.tessera.data.MessageHash)13 Collectors (java.util.stream.Collectors)12 EncryptedTransaction (com.quorum.tessera.data.EncryptedTransaction)11 PrivacyMode (com.quorum.tessera.enclave.PrivacyMode)11 EncodedPayloadCodec (com.quorum.tessera.enclave.EncodedPayloadCodec)9 NodeInfo (com.quorum.tessera.partyinfo.node.NodeInfo)8 Recipient (com.quorum.tessera.partyinfo.node.Recipient)8 java.util (java.util)8 Invocation (jakarta.ws.rs.client.Invocation)6 WebTarget (jakarta.ws.rs.client.WebTarget)6 StagingTransaction (com.quorum.tessera.data.staging.StagingTransaction)5 PrivacyMetadata (com.quorum.tessera.enclave.PrivacyMetadata)5 RecipientBox (com.quorum.tessera.enclave.RecipientBox)5 TxHash (com.quorum.tessera.enclave.TxHash)5 ResendRequest (com.quorum.tessera.p2p.resend.ResendRequest)5