class KeyResource {

    @GET
    @ApiOperation(value = "Fetch local public keys managed by the enclave")
    @ApiResponses({@ApiResponse(code = 200, message = "Managed public keys")})
    public Response getPublicKeys() {

        RuntimeContext runtimeContext = RuntimeContext.getInstance();


        Set<PublicKey> publicKeys = runtimeContext.getPublicKeys();

        final JsonArrayBuilder keyBuilder = Json.createArrayBuilder();

        publicKeys.stream()
                .map(key -> Json.createObjectBuilder().add("key", key.encodeToBase64()).build())
                .forEach(keyBuilder::add);

        final String output = Json.createObjectBuilder().add("keys", keyBuilder.build()).build().toString();

        return Response.status(Response.Status.OK).entity(output).build();
    }

}