Fix javadocs to allow build to pass in JDK 17 (#4834)

- Added missing javadocs so that javadoc doclint passes against JDK 17 (invoke by Besu gradle build).
- Exclude following packages from javadoc lint:
org.hyperledger.besu.privacy.contracts.generated
org.hyperledger.besu.tests.acceptance.*
- Temporarily exclude ethereum and evm submodule for doc lint checks.
- Run the javadoc task using GitHub actions (use Java 17) to report any javadoc errors during the PR builds
- Updating plugin-api build.gradle with new hash as javadoc comments caused it to change

Signed-off-by: Usman Saleem <usman@usmans.info>
This commit is contained in:
Usman Saleem
2023-01-18 22:51:00 +10:00
committed by GitHub
parent aef335cfcf
commit 9eb32836b7
763 changed files with 15266 additions and 74 deletions

View File

@@ -34,6 +34,7 @@ import java.util.List;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
/** The Enclave. */
public class Enclave {
private static final ObjectMapper objectMapper = new ObjectMapper();
@@ -42,10 +43,20 @@ public class Enclave {
private final RequestTransmitter requestTransmitter;
/**
* Instantiates a new Enclave.
*
* @param requestTransmitter the request transmitter
*/
public Enclave(final RequestTransmitter requestTransmitter) {
this.requestTransmitter = requestTransmitter;
}
/**
* Up check.
*
* @return the boolean
*/
public boolean upCheck() {
try {
final String upcheckResponse =
@@ -56,6 +67,14 @@ public class Enclave {
}
}
/**
* Send payload.
*
* @param payload the payload
* @param privateFrom the private from
* @param privateFor the private for
* @return the send response
*/
public SendResponse send(
final String payload, final String privateFrom, final List<String> privateFor) {
final SendRequestLegacy request = new SendRequestLegacy(payload, privateFrom, privateFor);
@@ -66,6 +85,14 @@ public class Enclave {
(statusCode, body) -> handleJsonResponse(statusCode, body, SendResponse.class));
}
/**
* Send payload.
*
* @param payload the payload
* @param privateFrom the private from
* @param privacyGroupId the privacy group id
* @return the send response
*/
public SendResponse send(
final String payload, final String privateFrom, final String privacyGroupId) {
final SendRequestBesu request = new SendRequestBesu(payload, privateFrom, privacyGroupId);
@@ -76,6 +103,12 @@ public class Enclave {
(statusCode, body) -> handleJsonResponse(statusCode, body, SendResponse.class));
}
/**
* Receive response.
*
* @param payloadKey the payload key
* @return the receive response
*/
public ReceiveResponse receive(final String payloadKey) {
final ReceiveRequest request = new ReceiveRequest(payloadKey);
return post(
@@ -85,6 +118,13 @@ public class Enclave {
(statusCode, body) -> handleJsonResponse(statusCode, body, ReceiveResponse.class));
}
/**
* Receive response.
*
* @param payloadKey the payload key
* @param to the to
* @return the receive response
*/
public ReceiveResponse receive(final String payloadKey, final String to) {
final ReceiveRequest request = new ReceiveRequest(payloadKey, to);
return post(
@@ -94,6 +134,15 @@ public class Enclave {
(statusCode, body) -> handleJsonResponse(statusCode, body, ReceiveResponse.class));
}
/**
* Create privacy group.
*
* @param addresses the addresses
* @param from the from
* @param name the name
* @param description the description
* @return the privacy group
*/
public PrivacyGroup createPrivacyGroup(
final List<String> addresses,
final String from,
@@ -108,6 +157,13 @@ public class Enclave {
(statusCode, body) -> handleJsonResponse(statusCode, body, PrivacyGroup.class));
}
/**
* Delete privacy group.
*
* @param privacyGroupId the privacy group id
* @param from the from
* @return the result of POST operation
*/
public String deletePrivacyGroup(final String privacyGroupId, final String from) {
final DeletePrivacyGroupRequest request = new DeletePrivacyGroupRequest(privacyGroupId, from);
return post(
@@ -117,6 +173,12 @@ public class Enclave {
(statusCode, body) -> handleJsonResponse(statusCode, body, String.class));
}
/**
* Find privacy group.
*
* @param addresses the addresses
* @return Array of privacy group
*/
public PrivacyGroup[] findPrivacyGroup(final List<String> addresses) {
final FindPrivacyGroupRequest request = new FindPrivacyGroupRequest(addresses);
return post(
@@ -126,6 +188,12 @@ public class Enclave {
(statusCode, body) -> handleJsonResponse(statusCode, body, PrivacyGroup[].class));
}
/**
* Retrieve privacy group.
*
* @param privacyGroupId the privacy group id
* @return the privacy group
*/
public PrivacyGroup retrievePrivacyGroup(final String privacyGroupId) {
final RetrievePrivacyGroupRequest request = new RetrievePrivacyGroupRequest(privacyGroupId);
return post(

View File

@@ -14,18 +14,37 @@
*/
package org.hyperledger.besu.enclave;
/** The Enclave client custom exception. */
public class EnclaveClientException extends RuntimeException {
/** Status Code */
private int statusCode;
/**
* Instantiates a new Enclave client exception.
*
* @param statusCode the status code
* @param message the message
*/
public EnclaveClientException(final int statusCode, final String message) {
super(message);
this.statusCode = statusCode;
}
/**
* Instantiates a new Enclave client exception.
*
* @param message the message
* @param cause the cause
*/
public EnclaveClientException(final String message, final Throwable cause) {
super(message, cause);
}
/**
* Gets status code.
*
* @return the status code
*/
public int getStatusCode() {
return statusCode;
}

View File

@@ -14,8 +14,14 @@
*/
package org.hyperledger.besu.enclave;
/** The Enclave configuration custom exception. */
public class EnclaveConfigurationException extends IllegalStateException {
/**
* Instantiates a new Enclave configuration exception.
*
* @param message the message
*/
public EnclaveConfigurationException(final String message) {
super(message);
}

View File

@@ -29,16 +29,28 @@ import io.vertx.core.http.HttpClientOptions;
import io.vertx.core.net.PfxOptions;
import org.apache.tuweni.net.tls.VertxTrustOptions;
/** The Enclave factory. */
public class EnclaveFactory {
private final Vertx vertx;
private static final int CONNECT_TIMEOUT = 1000;
private static final boolean TRUST_CA = false;
/**
* Instantiates a new Enclave factory.
*
* @param vertx the vertx
*/
public EnclaveFactory(final Vertx vertx) {
this.vertx = vertx;
}
/**
* Create enclave.
*
* @param enclaveUri the enclave uri
* @return the enclave
*/
public Enclave createVertxEnclave(final URI enclaveUri) {
final HttpClientOptions clientOptions = createNonTlsClientOptions(enclaveUri);
@@ -48,6 +60,15 @@ public class EnclaveFactory {
return new Enclave(vertxTransmitter);
}
/**
* Create enclave.
*
* @param enclaveUri the enclave uri
* @param privacyKeyStoreFile the privacy key store file
* @param privacyKeyStorePasswordFile the privacy key store password file
* @param privacyAllowlistFile the privacy allowlist file
* @return the enclave
*/
public Enclave createVertxEnclave(
final URI enclaveUri,
final Path privacyKeyStoreFile,
@@ -64,6 +85,12 @@ public class EnclaveFactory {
return new Enclave(vertxTransmitter);
}
/**
* Create GoQuorum enclave.
*
* @param enclaveUri the enclave uri
* @return the GoQuorum enclave
*/
public GoQuorumEnclave createGoQuorumEnclave(final URI enclaveUri) {
final HttpClientOptions clientOptions = createNonTlsClientOptions(enclaveUri);
@@ -73,6 +100,15 @@ public class EnclaveFactory {
return new GoQuorumEnclave(vertxTransmitter);
}
/**
* Create GoQuorum enclave.
*
* @param enclaveUri the enclave uri
* @param privacyKeyStoreFile the privacy key store file
* @param privacyKeyStorePasswordFile the privacy key store password file
* @param privacyAllowlistFile the privacy allowlist file
* @return the go quorum enclave
*/
public GoQuorumEnclave createGoQuorumEnclave(
final URI enclaveUri,
final Path privacyKeyStoreFile,
@@ -137,6 +173,13 @@ public class EnclaveFactory {
return new PfxOptions().setPassword(password).setPath(keystoreFile.toString());
}
/**
* Read secret from file.
*
* @param path the path
* @return the string
* @throws IOException the io exception
*/
static String readSecretFromFile(final Path path) throws IOException {
final String password =
Files.asCharSource(path.toFile(), StandardCharsets.UTF_8).readFirstLine();

View File

@@ -14,11 +14,23 @@
*/
package org.hyperledger.besu.enclave;
/** The Enclave IO exception. */
public class EnclaveIOException extends RuntimeException {
/**
* Instantiates a new Enclave IO exception.
*
* @param message the message
* @param cause the cause
*/
public EnclaveIOException(final String message, final Throwable cause) {
super(message, cause);
}
/**
* Instantiates a new Enclave IO exception.
*
* @param message the message
*/
public EnclaveIOException(final String message) {
super(message);
}

View File

@@ -14,14 +14,27 @@
*/
package org.hyperledger.besu.enclave;
/** The Enclave server exception. */
public class EnclaveServerException extends RuntimeException {
/** Status Code */
private final int statusCode;
/**
* Instantiates a new Enclave server exception.
*
* @param statusCode the status code
* @param message the message
*/
public EnclaveServerException(final int statusCode, final String message) {
super(message);
this.statusCode = statusCode;
}
/**
* Gets status code.
*
* @return the status code
*/
public int getStatusCode() {
return statusCode;
}

View File

@@ -30,6 +30,7 @@ import java.util.List;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
/** The GoQuorum enclave. */
public class GoQuorumEnclave {
private static final ObjectMapper objectMapper = new ObjectMapper();
@@ -37,10 +38,20 @@ public class GoQuorumEnclave {
private final RequestTransmitter requestTransmitter;
/**
* Instantiates a new GoQuorum enclave.
*
* @param requestTransmitter the request transmitter
*/
public GoQuorumEnclave(final RequestTransmitter requestTransmitter) {
this.requestTransmitter = requestTransmitter;
}
/**
* Up check.
*
* @return the boolean
*/
public boolean upCheck() {
try {
final String upcheckResponse =
@@ -51,6 +62,14 @@ public class GoQuorumEnclave {
}
}
/**
* Send payload.
*
* @param payload the payload
* @param privateFrom the private from
* @param privateFor the private for
* @return the send response
*/
public SendResponse send(
final byte[] payload, final String privateFrom, final List<String> privateFor) {
final GoQuorumSendRequest request = new GoQuorumSendRequest(payload, privateFrom, privateFor);
@@ -61,6 +80,13 @@ public class GoQuorumEnclave {
(statusCode, body) -> handleJsonResponse(statusCode, body, SendResponse.class, 201));
}
/**
* Send signed transaction.
*
* @param txLookupId the tx lookup id
* @param privateFor the private for
* @return the send response
*/
public SendResponse sendSignedTransaction(
final byte[] txLookupId, final List<String> privateFor) {
final GoQuorumSendSignedRequest request = new GoQuorumSendSignedRequest(txLookupId, privateFor);
@@ -71,6 +97,12 @@ public class GoQuorumEnclave {
(statusCode, body) -> handleJsonResponse(statusCode, body, SendResponse.class, 201));
}
/**
* Store raw payload.
*
* @param payload the payload
* @return the store raw response
*/
public StoreRawResponse storeRaw(final String payload) {
final GoQuorumStoreRawRequest request = new GoQuorumStoreRawRequest(payload);
return post(
@@ -80,6 +112,12 @@ public class GoQuorumEnclave {
(statusCode, body) -> handleJsonResponse(statusCode, body, StoreRawResponse.class, 200));
}
/**
* Receive GoQuorum response.
*
* @param payloadKey the payload key
* @return the go quorum receive response
*/
public GoQuorumReceiveResponse receive(final String payloadKey) {
return get(
JSON,

View File

@@ -14,19 +14,53 @@
*/
package org.hyperledger.besu.enclave;
/** The interface Request transmitter. */
public interface RequestTransmitter {
/**
* The interface Response body handler.
*
* @param <T> the type parameter
*/
@FunctionalInterface
interface ResponseBodyHandler<T> {
/**
* Convert response.
*
* @param statusCode the status code
* @param body the body
* @return the t
*/
T convertResponse(final int statusCode, final byte[] body);
}
/**
* Post operation.
*
* @param <T> the type parameter
* @param mediaType the media type
* @param content the content
* @param endpoint the endpoint
* @param responseBodyHandler the response body handler
* @return the t
*/
<T> T post(
String mediaType,
String content,
String endpoint,
ResponseBodyHandler<T> responseBodyHandler);
/**
* Get operation.
*
* @param <T> the type parameter
* @param mediaType the media type
* @param content the content
* @param endpoint the endpoint
* @param responseBodyHandler the response body handler
* @param withAcceptJsonHeader the with accept json header
* @return the t
*/
<T> T get(
String mediaType,
String content,

View File

@@ -27,12 +27,18 @@ import io.vertx.core.http.HttpHeaders;
import io.vertx.core.http.HttpMethod;
import io.vertx.core.http.RequestOptions;
/** The Vertx request transmitter. */
public class VertxRequestTransmitter implements RequestTransmitter {
private static final String APPLICATION_JSON = "application/json";
private final HttpClient client;
private static final long REQUEST_TIMEOUT_MS = 5000L;
/**
* Instantiates a new Vertx request transmitter.
*
* @param httpClient the http client
*/
public VertxRequestTransmitter(final HttpClient httpClient) {
this.client = httpClient;
}
@@ -68,6 +74,18 @@ public class VertxRequestTransmitter implements RequestTransmitter {
withAcceptJsonHeader);
}
/**
* Send request operation.
*
* @param <T> the type parameter
* @param method the method
* @param contentType the content type
* @param content the content
* @param endpoint the endpoint
* @param responseHandler the response handler
* @param withAcceptJsonHeader the with accept json header
* @return the t
*/
protected <T> T sendRequest(
final HttpMethod method,
final Optional<String> contentType,

View File

@@ -19,6 +19,7 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
/** The Create privacy group request. */
public class CreatePrivacyGroupRequest {
private final List<String> addresses;
@@ -26,6 +27,14 @@ public class CreatePrivacyGroupRequest {
private final String name;
private final String description;
/**
* Instantiates a new Create privacy group request.
*
* @param addresses the addresses
* @param from the from
* @param name the name
* @param description the description
*/
@JsonCreator
public CreatePrivacyGroupRequest(
@JsonProperty("addresses") final List<String> addresses,
@@ -38,21 +47,41 @@ public class CreatePrivacyGroupRequest {
this.description = description;
}
/**
* Addresses list.
*
* @return the list
*/
@JsonProperty("addresses")
public List<String> addresses() {
return addresses;
}
/**
* From.
*
* @return the string
*/
@JsonProperty("from")
public String from() {
return from;
}
/**
* Name.
*
* @return the string
*/
@JsonProperty("name")
public String name() {
return name;
}
/**
* Description.
*
* @return the string
*/
@JsonProperty("description")
public String description() {
return description;

View File

@@ -17,11 +17,18 @@ package org.hyperledger.besu.enclave.types;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
/** The Delete privacy group request. */
public class DeletePrivacyGroupRequest {
private final String privacyGroupId;
private final String from;
/**
* Instantiates a new Delete privacy group request.
*
* @param privacyGroupId the privacy group id
* @param from the from
*/
@JsonCreator
public DeletePrivacyGroupRequest(
@JsonProperty("privacyGroupId") final String privacyGroupId,
@@ -30,11 +37,21 @@ public class DeletePrivacyGroupRequest {
this.from = from;
}
/**
* Privacy group id.
*
* @return the string
*/
@JsonProperty("privacyGroupId")
public String privacyGroupId() {
return privacyGroupId;
}
/**
* From string.
*
* @return the string
*/
@JsonProperty("from")
public String from() {
return from;

View File

@@ -18,15 +18,27 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/** The Error response. */
@JsonPropertyOrder({"error"})
public class ErrorResponse {
/** The Error. */
String error;
/**
* Instantiates a new Error response.
*
* @param error the error
*/
@JsonCreator
public ErrorResponse(@JsonProperty("error") final String error) {
this.error = error;
}
/**
* Gets error.
*
* @return the error
*/
public String getError() {
return error;
}

View File

@@ -19,15 +19,26 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
/** The Find privacy group request. */
public class FindPrivacyGroupRequest {
private final List<String> addresses;
/**
* Instantiates a new Find privacy group request.
*
* @param addresses the addresses
*/
@JsonCreator
public FindPrivacyGroupRequest(@JsonProperty("addresses") final List<String> addresses) {
this.addresses = addresses;
}
/**
* Addresses list.
*
* @return the list
*/
@JsonProperty("addresses")
public List<String> addresses() {
return addresses;

View File

@@ -17,6 +17,7 @@ package org.hyperledger.besu.enclave.types;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
/** The GoQuorum receive response. */
public class GoQuorumReceiveResponse {
private final byte[] payload;
@@ -24,6 +25,14 @@ public class GoQuorumReceiveResponse {
private final String affectedContractTransactions[];
private final String execHash;
/**
* Instantiates a new GoQuorum receive response.
*
* @param payload the payload
* @param privacyFlag the privacy flag
* @param affectedContractTransactions the affected contract transactions
* @param execHash the exec hash
*/
@JsonCreator
public GoQuorumReceiveResponse(
@JsonProperty(value = "payload") final byte[] payload,
@@ -37,18 +46,38 @@ public class GoQuorumReceiveResponse {
this.execHash = execHash;
}
/**
* Get payload.
*
* @return the byte [ ]
*/
public byte[] getPayload() {
return payload;
}
/**
* Gets privacy flag.
*
* @return the privacy flag
*/
public int getPrivacyFlag() {
return privacyFlag;
}
/**
* Get affected contract transactions.
*
* @return the string [ ]
*/
public String[] getAffectedContractTransactions() {
return affectedContractTransactions;
}
/**
* Gets exec hash.
*
* @return the exec hash
*/
public String getExecHash() {
return execHash;
}

View File

@@ -19,12 +19,20 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/** The GoQuorum send request. */
@JsonPropertyOrder({"payload", "from", "to"})
public class GoQuorumSendRequest {
private final byte[] payload;
private final String from;
private final List<String> to;
/**
* Instantiates a new Go quorum send request.
*
* @param payload the payload
* @param from the from
* @param to the to
*/
public GoQuorumSendRequest(
@JsonProperty(value = "payload") final byte[] payload,
@JsonProperty(value = "from") final String from,
@@ -34,14 +42,29 @@ public class GoQuorumSendRequest {
this.to = to;
}
/**
* Get payload byte [ ].
*
* @return the byte [ ]
*/
public byte[] getPayload() {
return payload;
}
/**
* Gets from.
*
* @return the from
*/
public String getFrom() {
return from;
}
/**
* Gets to.
*
* @return the to
*/
public List<String> getTo() {
return to;
}

View File

@@ -19,11 +19,18 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/** The GoQuorum send signed request. */
@JsonPropertyOrder({"hash", "to"})
public class GoQuorumSendSignedRequest {
private final byte[] hash;
private final List<String> to;
/**
* Instantiates a new GoQuorum send signed request.
*
* @param hash the hash
* @param privateFor the private for
*/
public GoQuorumSendSignedRequest(
@JsonProperty(value = "hash") final byte[] hash,
@JsonProperty(value = "to") final List<String> privateFor) {
@@ -31,10 +38,20 @@ public class GoQuorumSendSignedRequest {
this.to = privateFor;
}
/**
* Get hash byte [ ].
*
* @return the byte [ ]
*/
public byte[] getHash() {
return hash;
}
/**
* Gets to.
*
* @return the to
*/
public List<String> getTo() {
return to;
}

View File

@@ -16,13 +16,24 @@ package org.hyperledger.besu.enclave.types;
import com.fasterxml.jackson.annotation.JsonProperty;
/** The type Go quorum store raw request. */
public class GoQuorumStoreRawRequest {
private final String payload;
/**
* Instantiates a new Go quorum store raw request.
*
* @param payload the payload
*/
public GoQuorumStoreRawRequest(@JsonProperty(value = "payload") final String payload) {
this.payload = payload;
}
/**
* Gets payload.
*
* @return the payload
*/
public String getPayload() {
return payload;
}

View File

@@ -17,60 +17,131 @@ package org.hyperledger.besu.enclave.types;
import java.io.Serializable;
import java.util.List;
/** The Privacy group. */
public class PrivacyGroup implements Serializable {
/** Private Group Id */
private String privacyGroupId;
/** Name */
private String name;
/** Description */
private String description;
/** Type */
private Type type;
/** Members */
private List<String> members;
/**
* Gets privacy group id.
*
* @return the privacy group id
*/
public String getPrivacyGroupId() {
return privacyGroupId;
}
/**
* Sets privacy group id.
*
* @param privacyGroupId the privacy group id
*/
public void setPrivacyGroupId(final String privacyGroupId) {
this.privacyGroupId = privacyGroupId;
}
/**
* Gets name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Sets name.
*
* @param name the name
*/
public void setName(final String name) {
this.name = name;
}
/**
* Gets description.
*
* @return the description
*/
public String getDescription() {
return description;
}
/**
* Sets description.
*
* @param description the description
*/
public void setDescription(final String description) {
this.description = description;
}
/**
* Gets type.
*
* @return the type
*/
public Type getType() {
return type;
}
/**
* Sets type.
*
* @param type the type
*/
public void setType(final Type type) {
this.type = type;
}
/**
* Gets members.
*
* @return the members
*/
public List<String> getMembers() {
return members;
}
/**
* Sets members.
*
* @param members the members
*/
public void setMembers(final List<String> members) {
this.members = members;
}
/**
* Add members.
*
* @param participantsFromParameter the participants from parameter
*/
public void addMembers(final List<String> participantsFromParameter) {
members.addAll(participantsFromParameter);
}
/** Instantiates a new Privacy group. */
public PrivacyGroup() {}
/**
* Instantiates a new Privacy group.
*
* @param privacyGroupId the privacy group id
* @param type the type
* @param name the name
* @param description the description
* @param members the members
*/
public PrivacyGroup(
final String privacyGroupId,
final Type type,
@@ -84,9 +155,13 @@ public class PrivacyGroup implements Serializable {
this.members = members;
}
/** The enum Type. */
public enum Type {
/** Legacy type. */
LEGACY,
/** Flexible type. */
FLEXIBLE,
/** Pantheon type. */
PANTHEON
}
}

View File

@@ -17,25 +17,47 @@ package org.hyperledger.besu.enclave.types;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/** The Receive request. */
@JsonPropertyOrder({"key", "to"})
public class ReceiveRequest {
private final String key;
private final String to;
/**
* Instantiates a new Receive request.
*
* @param key the key
* @param to the to
*/
public ReceiveRequest(
@JsonProperty(value = "key") final String key, @JsonProperty(value = "to") final String to) {
this.key = key;
this.to = to;
}
/**
* Instantiates a new Receive request.
*
* @param key the key
*/
public ReceiveRequest(final String key) {
this(key, null);
}
/**
* Gets key.
*
* @return the key
*/
public String getKey() {
return key;
}
/**
* Gets to.
*
* @return the to
*/
public String getTo() {
return to;
}

View File

@@ -18,6 +18,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/** The Receive response. */
@JsonPropertyOrder({"payload", "privacyGroupId", "senderKey"})
public class ReceiveResponse {
@@ -25,6 +26,13 @@ public class ReceiveResponse {
private final String privacyGroupId;
private final String senderKey;
/**
* Instantiates a new Receive response.
*
* @param payload the payload
* @param privacyGroupId the privacy group id
* @param senderKey the sender key
*/
@JsonCreator
public ReceiveResponse(
@JsonProperty(value = "payload") final byte[] payload,
@@ -35,14 +43,29 @@ public class ReceiveResponse {
this.senderKey = senderKey;
}
/**
* Get payload byte [ ].
*
* @return the byte [ ]
*/
public byte[] getPayload() {
return payload;
}
/**
* Gets privacy group id.
*
* @return the privacy group id
*/
public String getPrivacyGroupId() {
return privacyGroupId;
}
/**
* Gets sender key.
*
* @return the sender key
*/
public String getSenderKey() {
return senderKey;
}

View File

@@ -17,14 +17,25 @@ package org.hyperledger.besu.enclave.types;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
/** The Retrieve privacy group request. */
public class RetrievePrivacyGroupRequest {
private final String privacyGroupId;
/**
* Instantiates a new Retrieve privacy group request.
*
* @param privacyGroupId the privacy group id
*/
@JsonCreator
public RetrievePrivacyGroupRequest(@JsonProperty("privacyGroupId") final String privacyGroupId) {
this.privacyGroupId = privacyGroupId;
}
/**
* Privacy group id.
*
* @return the string
*/
@JsonProperty("privacyGroupId")
public String privacyGroupId() {
return privacyGroupId;

View File

@@ -16,19 +16,36 @@ package org.hyperledger.besu.enclave.types;
import static java.nio.charset.StandardCharsets.UTF_8;
/** The Send request. */
public abstract class SendRequest {
private final byte[] payload;
private final String from;
/**
* Instantiates a new Send request.
*
* @param payload the payload
* @param from the from
*/
protected SendRequest(final String payload, final String from) {
this.payload = payload.getBytes(UTF_8);
this.from = from;
}
/**
* Get payload byte [ ].
*
* @return the byte [ ]
*/
public byte[] getPayload() {
return payload;
}
/**
* Gets from.
*
* @return the from
*/
public String getFrom() {
return from;
}

View File

@@ -17,10 +17,18 @@ package org.hyperledger.besu.enclave.types;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/** The Send request Besu. */
@JsonPropertyOrder({"payload", "from", "privacyGroupId"})
public class SendRequestBesu extends SendRequest {
private final String privacyGroupId;
/**
* Instantiates a new Send request Besu.
*
* @param payload the payload
* @param from the from
* @param privacyGroupId the privacy group id
*/
public SendRequestBesu(
@JsonProperty(value = "payload") final String payload,
@JsonProperty(value = "from") final String from,
@@ -30,6 +38,11 @@ public class SendRequestBesu extends SendRequest {
this.privacyGroupId = privacyGroupId;
}
/**
* Gets privacy group id.
*
* @return the privacy group id
*/
public String getPrivacyGroupId() {
return privacyGroupId;
}

View File

@@ -19,10 +19,18 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/** The Send request Legacy. */
@JsonPropertyOrder({"payload", "from", "to"})
public class SendRequestLegacy extends SendRequest {
private final List<String> to;
/**
* Instantiates a new Send request legacy.
*
* @param payload the payload
* @param from the from
* @param to the to
*/
public SendRequestLegacy(
@JsonProperty(value = "payload") final String payload,
@JsonProperty(value = "from") final String from,
@@ -31,6 +39,11 @@ public class SendRequestLegacy extends SendRequest {
this.to = to;
}
/**
* Gets to.
*
* @return the to
*/
public List<String> getTo() {
return to;
}

View File

@@ -18,15 +18,26 @@ import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/** The Send response. */
@JsonPropertyOrder({"key"})
public class SendResponse {
private final String key;
/**
* Instantiates a new Send response.
*
* @param key the key
*/
@JsonCreator
public SendResponse(@JsonProperty("key") final String key) {
this.key = key;
}
/**
* Gets key.
*
* @return the key
*/
public String getKey() {
return key;
}

View File

@@ -17,14 +17,25 @@ package org.hyperledger.besu.enclave.types;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
/** The Store raw response. */
public class StoreRawResponse {
private final String key;
/**
* Instantiates a new Store raw response.
*
* @param key the key
*/
@JsonCreator
public StoreRawResponse(@JsonProperty("key") final String key) {
this.key = key;
}
/**
* Gets key.
*
* @return the key
*/
public String getKey() {
return key;
}