@Test public void getPublicKeys() { PublicKey key = PublicKey.from("HELLOW".getBytes()); when(enclave.getPublicKeys()).thenReturn(Collections.singleton(key)); Set<PublicKey> result = enclaveClient.getPublicKeys(); assertThat(result).containsExactly(key); verify(enclave).getPublicKeys(); }
@Override public Set<PublicKey> getPublicKeys() { return ClientCallback.execute( () -> { Response response = client.target(uri).path("public").request().get(); validateResponseIsOk(response); JsonArray results = response.readEntity(JsonArray.class); return IntStream.range(0, results.size()) .mapToObj(i -> results.getString(i)) .map(s -> Base64.getDecoder().decode(s)) .map(PublicKey::from) .collect(Collectors.toSet()); }); }
RestfulEnclaveClient implements EnclaveClient { @Override public Set<PublicKey> getPublicKeys() { return ClientCallback.execute( () -> { Response response = client.target(uri).path("public").request().get(); validateResponseIsOk(response); JsonArray results = response.readEntity(JsonArray.class); return IntStream.range(0, results.size()) .mapToObj(i -> results.getString(i)) .map(s -> Base64.getDecoder().decode(s)) .map(PublicKey::from) .collect(Collectors.toSet()); }); } }
RestfulEnclaveClient implements EnclaveClient { @Override public Set<PublicKey> getPublicKeys() { return ClientCallback.execute( () -> { Response response = client.target(uri).path("public").request().get(); validateResponseIsOk(response); JsonArray results = response.readEntity(JsonArray.class); return IntStream.range(0, results.size()) .mapToObj(i -> results.getString(i)) .map(s -> Base64.getDecoder().decode(s)) .map(PublicKey::from) .collect(Collectors.toSet()); }); } RestfulEnclaveClient(Client client, URI uri);  RestfulEnclaveClient(Client client, URI uri, ExecutorService executorService); }
RestfulEnclaveClient implements EnclaveClient { @Override public Set<PublicKey> getPublicKeys() { return ClientCallback.execute( () -> { Response response = client.target(uri).path("public").request().get(); validateResponseIsOk(response); JsonArray results = response.readEntity(JsonArray.class); return IntStream.range(0, results.size()) .mapToObj(i -> results.getString(i)) .map(s -> Base64.getDecoder().decode(s)) .map(PublicKey::from) .collect(Collectors.toSet()); }); } RestfulEnclaveClient(Client client, URI uri);  RestfulEnclaveClient(Client client, URI uri, ExecutorService executorService); @Override PublicKey defaultPublicKey(); @Override Set<PublicKey> getForwardingKeys(); @Override Set<PublicKey> getPublicKeys(); @Override EncodedPayload encryptPayload(
            byte[] message, PublicKey senderPublicKey, List<PublicKey> recipientPublicKeys); @Override EncodedPayload encryptPayload(RawTransaction rawTransaction, List<PublicKey> recipientPublicKeys); @Override RawTransaction encryptRawPayload(byte[] message, PublicKey sender); @Override byte[] unencryptTransaction(EncodedPayload payload, PublicKey providedKey); @Override byte[] createNewRecipientBox(final EncodedPayload payload, final PublicKey recipientKey); @Override Service.Status status(); }
RestfulEnclaveClient implements EnclaveClient { @Override public Set<PublicKey> getPublicKeys() { return ClientCallback.execute( () -> { Response response = client.target(uri).path("public").request().get(); validateResponseIsOk(response); JsonArray results = response.readEntity(JsonArray.class); return IntStream.range(0, results.size()) .mapToObj(i -> results.getString(i)) .map(s -> Base64.getDecoder().decode(s)) .map(PublicKey::from) .collect(Collectors.toSet()); }); } RestfulEnclaveClient(Client client, URI uri);  RestfulEnclaveClient(Client client, URI uri, ExecutorService executorService); @Override PublicKey defaultPublicKey(); @Override Set<PublicKey> getForwardingKeys(); @Override Set<PublicKey> getPublicKeys(); @Override EncodedPayload encryptPayload(
            byte[] message, PublicKey senderPublicKey, List<PublicKey> recipientPublicKeys); @Override EncodedPayload encryptPayload(RawTransaction rawTransaction, List<PublicKey> recipientPublicKeys); @Override RawTransaction encryptRawPayload(byte[] message, PublicKey sender); @Override byte[] unencryptTransaction(EncodedPayload payload, PublicKey providedKey); @Override byte[] createNewRecipientBox(final EncodedPayload payload, final PublicKey recipientKey); @Override Service.Status status();  }