diff --git a/README.md b/README.md index b4d5975..756d41c 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ immudb4j implements a [gRPC] immudb client, based on [immudb's official protobuf It exposes a minimal and simple to use API for applications, while the cryptographic verifications and state update protocol implementation are fully implemented internally by this client. -The latest validated immudb state may be kept in the local file system using default `FileRootHolder`.
+The latest validated immudb state may be kept in the local file system using default `FileImmuStateHolder`.
Please read [immudb Research Paper] for details of how immutability is ensured by [immudb]. [gRPC]: https://grpc.io/ @@ -55,12 +55,12 @@ Just include immudb4j as a dependency in your project: io.codenotary immudb4j - 0.9.0.4 + 0.9.0.5 ``` - if using Gradle: ```groovy - compile 'io.codenotary:immudb4j:0.9.0.4' + compile 'io.codenotary:immudb4j:0.9.0.5' ``` `immudb4j` is currently hosted on both [Maven Central] and [Github Packages]. @@ -89,7 +89,7 @@ immudb4j supports the [latest immudb server] release, that is 0.9.1 at the time Follow its [README](https://github.com/codenotary/immudb-client-examples/blob/master/java/README.md) to build and run it. -## Step-by-step guide +## Step-by-step Guide ### Creating a Client @@ -150,7 +150,7 @@ Specify the active database with: ### Standard Read and Write -immudb provides standard read and write operations that behave as in a traditional +immudb provides standard read and write operations that behave as in a standard key-value store i.e. no cryptographic verification is involved. Such operations may be used when validations can be postponed. @@ -160,10 +160,10 @@ may be used when validations can be postponed. byte[] v = client.get("k123"); ``` -### Verified or Safe read and write +### Verified or Safe Read and Write immudb provides built-in cryptographic verification for any entry. The client -implements the mathematical validations while the application uses as a traditional +implements the mathematical validations while the application uses as a standard read or write operation: ```java diff --git a/build.gradle b/build.gradle index be4f269..fef70ba 100644 --- a/build.gradle +++ b/build.gradle @@ -38,7 +38,7 @@ apply plugin: 'signing' group = 'io.codenotary' archivesBaseName = 'immudb4j' -version = '0.9.0.4' +version = '0.9.0.5' sourceCompatibility = 1.8 targetCompatibility = 1.8 diff --git a/src/main/java/io/codenotary/immudb4j/ImmuClient.java b/src/main/java/io/codenotary/immudb4j/ImmuClient.java index 7c56e5c..9d733ae 100644 --- a/src/main/java/io/codenotary/immudb4j/ImmuClient.java +++ b/src/main/java/io/codenotary/immudb4j/ImmuClient.java @@ -53,7 +53,7 @@ public class ImmuClient { private static final String AUTH_HEADER = "authorization"; private final ImmuServiceGrpc.ImmuServiceBlockingStub stub; - private final boolean withAuthToken; + private final boolean withAuth; private final ImmuStateHolder stateHolder; private ManagedChannel channel; private String authToken; @@ -62,7 +62,7 @@ public class ImmuClient { public ImmuClient(Builder builder) { this.stub = createStubFrom(builder); - this.withAuthToken = builder.isWithAuthToken(); + this.withAuth = builder.isWithAuth(); this.stateHolder = builder.getStateHolder(); } @@ -111,7 +111,7 @@ public synchronized boolean isShutdown() { } private ImmuServiceGrpc.ImmuServiceBlockingStub getStub() { - if (!withAuthToken || authToken == null) { + if (!withAuth || authToken == null) { return stub; } Metadata metadata = new Metadata(); @@ -377,18 +377,28 @@ public Entry verifiedGetSince(byte[] key, long txId) throws VerificationExceptio // ========== HISTORY ========== // - public List history(String key, int limit, long offset, boolean reverse) { - return history(key.getBytes(StandardCharsets.UTF_8), limit, offset, reverse); + + public List history(String key, int limit, long offset, boolean desc) { + return history(key.getBytes(StandardCharsets.UTF_8), limit, offset, desc); + } + + public List history(byte[] key, int limit, long offset, boolean desc) { + return history(key, limit, offset, desc, 1); } - public List history(byte[] key, int limit, long offset, boolean reverse) { + public List history(String key, int limit, long offset, boolean desc, long sinceTxId) { + return history(key.getBytes(StandardCharsets.UTF_8), limit, offset, desc, sinceTxId); + } + + public List history(byte[] key, int limit, long offset, boolean desc, long sinceTxId) { ImmudbProto.Entries entries; try { entries = getStub().history(ImmudbProto.HistoryRequest.newBuilder() .setKey(ByteString.copyFrom(key)) .setLimit(limit) .setOffset(offset) - .setDesc(reverse) + .setDesc(desc) + .setSinceTx(sinceTxId) .build() ); } catch (StatusRuntimeException e) { @@ -401,26 +411,45 @@ public List history(byte[] key, int limit, long offset, boolean reverse) { // ========== SCAN ========== // - public List scan(String key) { - return scan(ByteString.copyFrom(key, StandardCharsets.UTF_8).toByteArray()); + public List scan(String prefix) { + return scan(ByteString.copyFrom(prefix, StandardCharsets.UTF_8).toByteArray()); + } + + public List scan(String prefix, long sinceTxId, long limit, boolean desc) { + return scan(ByteString.copyFrom(prefix, StandardCharsets.UTF_8).toByteArray(), sinceTxId, limit, desc); } - public List scan(String key, long sinceTxId, long limit, boolean reverse) { - return scan(ByteString.copyFrom(key, StandardCharsets.UTF_8).toByteArray(), sinceTxId, limit, reverse); + public List scan(String prefix, String seekKey, long sinceTxId, long limit, boolean desc) { + return scan( + ByteString.copyFrom(prefix, StandardCharsets.UTF_8).toByteArray(), + ByteString.copyFrom(seekKey, StandardCharsets.UTF_8).toByteArray(), + sinceTxId, limit, desc); } - public List scan(byte[] key) { - ScanRequest req = ScanRequest.newBuilder().setPrefix(ByteString.copyFrom(key)).build(); + public List scan(byte[] prefix) { + ScanRequest req = ScanRequest.newBuilder().setPrefix(ByteString.copyFrom(prefix)).build(); ImmudbProto.Entries entries = getStub().scan(req); return buildList(entries); } - public List scan(byte[] key, long sinceTxId, long limit, boolean reverse) { + public List scan(byte[] prefix, long sinceTxId, long limit, boolean desc) { ScanRequest req = ScanRequest.newBuilder() - .setPrefix(ByteString.copyFrom(key)) + .setPrefix(ByteString.copyFrom(prefix)) .setLimit(limit) .setSinceTx(sinceTxId) - .setDesc(reverse) + .setDesc(desc) + .build(); + ImmudbProto.Entries entries = getStub().scan(req); + return buildList(entries); + } + + public List scan(byte[] prefix, byte[] seekKey, long sinceTxId, long limit, boolean desc) { + ScanRequest req = ScanRequest.newBuilder() + .setPrefix(ByteString.copyFrom(prefix)) + .setLimit(limit) + .setSeekKey(ByteString.copyFrom(seekKey)) + .setSinceTx(sinceTxId) + .setDesc(desc) .build(); ImmudbProto.Entries entries = getStub().scan(req); return buildList(entries); @@ -800,12 +829,12 @@ public List txScan(long initialTxId) { return buildList(txList); } - public List txScan(long initialTxId, int limit, boolean reverse) { + public List txScan(long initialTxId, int limit, boolean desc) { ImmudbProto.TxScanRequest req = ImmudbProto.TxScanRequest .newBuilder() .setInitialTx(initialTxId) .setLimit(limit) - .setDesc(reverse) + .setDesc(desc) .build(); ImmudbProto.TxList txList = getStub().txScan(req); return buildList(txList); @@ -892,6 +921,15 @@ public void changePassword(String user, String oldPassword, String newPassword) getStub().changePassword(changePasswordRequest); } + // + // ========== USER MGMT ========== + // + + public void cleanIndex() { + //noinspection ResultOfMethodCallIgnored + getStub().cleanIndex(Empty.getDefaultInstance()); + } + // // ========== INTERNAL UTILS ========== // @@ -932,7 +970,7 @@ public static class Builder { private int serverPort; - private boolean withAuthToken; + private boolean withAuth; private ImmuStateHolder stateHolder; @@ -940,7 +978,7 @@ private Builder() { this.serverUrl = "localhost"; this.serverPort = 3322; this.stateHolder = new SerializableImmuStateHolder(); - this.withAuthToken = true; + this.withAuth = true; } public ImmuClient build() { @@ -965,12 +1003,12 @@ public Builder withServerPort(int serverPort) { return this; } - public boolean isWithAuthToken() { - return withAuthToken; + public boolean isWithAuth() { + return withAuth; } - public Builder withAuthToken(boolean withAuthToken) { - this.withAuthToken = withAuthToken; + public Builder withAuth(boolean withAuth) { + this.withAuth = withAuth; return this; } diff --git a/src/test/java/io/codenotary/immudb4j/HistoryTest.java b/src/test/java/io/codenotary/immudb4j/HistoryTest.java new file mode 100644 index 0000000..b271737 --- /dev/null +++ b/src/test/java/io/codenotary/immudb4j/HistoryTest.java @@ -0,0 +1,80 @@ +/* +Copyright 2021 CodeNotary, Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +package io.codenotary.immudb4j; + +import io.codenotary.immudb4j.exceptions.CorruptedDataException; +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.nio.charset.StandardCharsets; +import java.util.List; + +public class HistoryTest extends ImmuClientIntegrationTest { + + @Test(testName = "set, history", priority = 2) + public void t1() { + + immuClient.login("immudb", "immudb"); + immuClient.useDatabase("defaultdb"); + + byte[] value1 = {0, 1, 2, 3}; + byte[] value2 = {4, 5, 6, 7}; + byte[] value3 = {8, 9, 10, 11}; + + try { + immuClient.set("history1", value1); + immuClient.set("history1", value2); + immuClient.set("history2", value1); + immuClient.set("history2", value2); + immuClient.set("history2", value3); + } catch (CorruptedDataException e) { + Assert.fail("Failed at set.", e); + } + + List historyResponse1 = immuClient.history("history1", 10, 0, false); + + Assert.assertEquals(historyResponse1.size(), 2); + + Assert.assertEquals(historyResponse1.get(0).getKey(), "history1".getBytes(StandardCharsets.UTF_8)); + Assert.assertEquals(historyResponse1.get(0).getValue(), value1); + + Assert.assertEquals(historyResponse1.get(1).getKey(), "history1".getBytes(StandardCharsets.UTF_8)); + Assert.assertEquals(historyResponse1.get(1).getValue(), value2); + + List historyResponse2 = immuClient.history("history2", 10, 0, false); + + Assert.assertEquals(historyResponse2.size(), 3); + + Assert.assertEquals(historyResponse2.get(0).getKey(), "history2".getBytes(StandardCharsets.UTF_8)); + Assert.assertEquals(historyResponse2.get(0).getValue(), value1); + + Assert.assertEquals(historyResponse2.get(1).getKey(), "history2".getBytes(StandardCharsets.UTF_8)); + Assert.assertEquals(historyResponse2.get(1).getValue(), value2); + + Assert.assertEquals(historyResponse2.get(2).getKey(), "history2".getBytes(StandardCharsets.UTF_8)); + Assert.assertEquals(historyResponse2.get(2).getValue(), value3); + + historyResponse2 = immuClient.history("history2", 10, 2, false, 5); + Assert.assertNotNull(historyResponse2); + Assert.assertEquals(historyResponse2.size(), 1); + + List nonExisting = immuClient.history("nonExisting", 10, 0, false); + Assert.assertTrue(nonExisting.isEmpty()); + + immuClient.logout(); + } + +} diff --git a/src/test/java/io/codenotary/immudb4j/ImmuClientIntegrationTest.java b/src/test/java/io/codenotary/immudb4j/ImmuClientIntegrationTest.java index 8360dc0..17cfe34 100644 --- a/src/test/java/io/codenotary/immudb4j/ImmuClientIntegrationTest.java +++ b/src/test/java/io/codenotary/immudb4j/ImmuClientIntegrationTest.java @@ -34,7 +34,6 @@ public static void beforeClass() throws IOException { .withStateHolder(stateHolder) .withServerUrl("localhost") .withServerPort(3322) - .withAuthToken(true) .build(); } diff --git a/src/test/java/io/codenotary/immudb4j/LoginAndHealthCheckTest.java b/src/test/java/io/codenotary/immudb4j/LoginAndHealthCheckAndCleanIndexTest.java similarity index 83% rename from src/test/java/io/codenotary/immudb4j/LoginAndHealthCheckTest.java rename to src/test/java/io/codenotary/immudb4j/LoginAndHealthCheckAndCleanIndexTest.java index 578df96..00b8823 100644 --- a/src/test/java/io/codenotary/immudb4j/LoginAndHealthCheckTest.java +++ b/src/test/java/io/codenotary/immudb4j/LoginAndHealthCheckAndCleanIndexTest.java @@ -19,14 +19,17 @@ import org.testng.Assert; import org.testng.annotations.Test; -public class LoginAndHealthCheckTest extends ImmuClientIntegrationTest { +public class LoginAndHealthCheckAndCleanIndexTest extends ImmuClientIntegrationTest { @Test(testName = "login (with default credentials), healthCheck, logout") public void t1() { immuClient.login("immudb", "immudb"); - Assert.assertTrue(immuClient.healthCheck()); + boolean isHealthy = immuClient.healthCheck(); + Assert.assertTrue(isHealthy); + + immuClient.cleanIndex(); immuClient.logout(); } diff --git a/src/test/java/io/codenotary/immudb4j/ReferenceTest.java b/src/test/java/io/codenotary/immudb4j/ReferenceTest.java index ac68119..395b32e 100644 --- a/src/test/java/io/codenotary/immudb4j/ReferenceTest.java +++ b/src/test/java/io/codenotary/immudb4j/ReferenceTest.java @@ -49,6 +49,8 @@ public void t1() { } Assert.assertNotNull(ref1TxMd); + + TxMetadata ref2TxMd = null; try { ref2TxMd = immuClient.setReferenceAt(ref2Key, key, setTxMd.id); diff --git a/src/test/java/io/codenotary/immudb4j/ScanAndHistoryTest.java b/src/test/java/io/codenotary/immudb4j/ScanTest.java similarity index 55% rename from src/test/java/io/codenotary/immudb4j/ScanAndHistoryTest.java rename to src/test/java/io/codenotary/immudb4j/ScanTest.java index 5afd6aa..f22d1bf 100644 --- a/src/test/java/io/codenotary/immudb4j/ScanAndHistoryTest.java +++ b/src/test/java/io/codenotary/immudb4j/ScanTest.java @@ -22,59 +22,10 @@ import java.nio.charset.StandardCharsets; import java.util.List; -public class ScanAndHistoryTest extends ImmuClientIntegrationTest { - - @Test(testName = "set, history", priority = 2) - public void t1() { - - immuClient.login("immudb", "immudb"); - immuClient.useDatabase("defaultdb"); - - byte[] value1 = {0, 1, 2, 3}; - byte[] value2 = {4, 5, 6, 7}; - byte[] value3 = {8, 9, 10, 11}; - - try { - immuClient.set("history1", value1); - immuClient.set("history1", value2); - immuClient.set("history2", value1); - immuClient.set("history2", value2); - immuClient.set("history2", value3); - } catch (CorruptedDataException e) { - Assert.fail("Failed at set.", e); - } - - List historyResponse1 = immuClient.history("history1", 10, 0, false); - - Assert.assertEquals(historyResponse1.size(), 2); - - Assert.assertEquals(historyResponse1.get(0).getKey(), "history1".getBytes(StandardCharsets.UTF_8)); - Assert.assertEquals(historyResponse1.get(0).getValue(), value1); - - Assert.assertEquals(historyResponse1.get(1).getKey(), "history1".getBytes(StandardCharsets.UTF_8)); - Assert.assertEquals(historyResponse1.get(1).getValue(), value2); - - List historyResponse2 = immuClient.history("history2", 10, 0, false); - - Assert.assertEquals(historyResponse2.size(), 3); - - Assert.assertEquals(historyResponse2.get(0).getKey(), "history2".getBytes(StandardCharsets.UTF_8)); - Assert.assertEquals(historyResponse2.get(0).getValue(), value1); - - Assert.assertEquals(historyResponse2.get(1).getKey(), "history2".getBytes(StandardCharsets.UTF_8)); - Assert.assertEquals(historyResponse2.get(1).getValue(), value2); - - Assert.assertEquals(historyResponse2.get(2).getKey(), "history2".getBytes(StandardCharsets.UTF_8)); - Assert.assertEquals(historyResponse2.get(2).getValue(), value3); - - List nonExisting = immuClient.history("nonExisting", 10, 0, false); - Assert.assertTrue(nonExisting.isEmpty()); - - immuClient.logout(); - } +public class ScanTest extends ImmuClientIntegrationTest { @Test(testName = "scan", priority = 2) - public void t2() { + public void t1() { immuClient.login("immudb", "immudb"); immuClient.useDatabase("defaultdb"); @@ -89,21 +40,23 @@ public void t2() { Assert.fail("Failed at set.", e); } - List scan = immuClient.scan("scan", 1, 5, false); + List scanResult = immuClient.scan("scan", 1, 5, false); - Assert.assertEquals(scan.size(), 2); - Assert.assertEquals(scan.get(0).getKey(), "scan1".getBytes(StandardCharsets.UTF_8)); - Assert.assertEquals(scan.get(0).getValue(), value1); - Assert.assertEquals(scan.get(1).getKey(), "scan2".getBytes(StandardCharsets.UTF_8)); - Assert.assertEquals(scan.get(1).getValue(), value2); + Assert.assertEquals(scanResult.size(), 2); + Assert.assertEquals(scanResult.get(0).getKey(), "scan1".getBytes(StandardCharsets.UTF_8)); + Assert.assertEquals(scanResult.get(0).getValue(), value1); + Assert.assertEquals(scanResult.get(1).getKey(), "scan2".getBytes(StandardCharsets.UTF_8)); + Assert.assertEquals(scanResult.get(1).getValue(), value2); Assert.assertTrue(immuClient.scan("scan").size() > 0); + Assert.assertEquals(immuClient.scan("scan", "scan1",1, 5, false).size(),1); + immuClient.logout(); } @Test(testName = "set, zAdd, zScan", priority = 3) - public void t3() { + public void t2() { immuClient.login("immudb", "immudb"); immuClient.useDatabase("defaultdb"); diff --git a/src/test/java/io/codenotary/immudb4j/SerializableImmuStateHolderTest.java b/src/test/java/io/codenotary/immudb4j/SerializableImmuStateHolderTest.java new file mode 100644 index 0000000..5198ef3 --- /dev/null +++ b/src/test/java/io/codenotary/immudb4j/SerializableImmuStateHolderTest.java @@ -0,0 +1,50 @@ +/* +Copyright 2021 CodeNotary, Inc. All rights reserved. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ +package io.codenotary.immudb4j; + +import org.testng.Assert; +import org.testng.annotations.Test; + +public class SerializableImmuStateHolderTest { + + @Test(testName = "in-memory state holder") + public void t1() { + + SerializableImmuStateHolder stateHolder = new SerializableImmuStateHolder(); + + ImmuClient immuClient = ImmuClient.newBuilder() + .withStateHolder(stateHolder) + .withServerUrl("localhost") + .withServerPort(3322) + .build(); + + immuClient.login("immudb", "immudb"); + immuClient.useDatabase("defaultdb"); + + ImmuState state = immuClient.state(); + + Assert.assertNotNull(state); + // System.out.println(">>> t1 > state: " + state.toString()); + + String stateStr = state.toString(); + Assert.assertTrue(stateStr.contains("ImmuState{")); + Assert.assertTrue(stateStr.contains("txHash(base64)")); + Assert.assertTrue(stateStr.contains("signature(base64)")); + + immuClient.logout(); + } + +} diff --git a/src/test/java/io/codenotary/immudb4j/SetAllAndGetAllTest.java b/src/test/java/io/codenotary/immudb4j/SetAllAndGetAllTest.java index 4083585..dfdcc33 100644 --- a/src/test/java/io/codenotary/immudb4j/SetAllAndGetAllTest.java +++ b/src/test/java/io/codenotary/immudb4j/SetAllAndGetAllTest.java @@ -19,6 +19,7 @@ import org.testng.Assert; import org.testng.annotations.Test; +import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.List; diff --git a/src/test/java/io/codenotary/immudb4j/SetAndGetTest.java b/src/test/java/io/codenotary/immudb4j/SetAndGetTest.java index 282240d..3312d87 100644 --- a/src/test/java/io/codenotary/immudb4j/SetAndGetTest.java +++ b/src/test/java/io/codenotary/immudb4j/SetAndGetTest.java @@ -29,7 +29,7 @@ public void t1() { immuClient.login("immudb", "immudb"); immuClient.useDatabase("defaultdb"); - String key = "key1"; + byte[] key = "key1".getBytes(StandardCharsets.UTF_8); byte[] val = new byte[]{1, 2, 3, 4, 5}; TxMetadata txMd = null; @@ -49,11 +49,11 @@ public void t1() { Assert.assertEquals(val, got); - KV kv = immuClient.getAt(key.getBytes(StandardCharsets.UTF_8), txMd.id); + KV kv = immuClient.getAt(key, txMd.id); Assert.assertNotNull(kv); Assert.assertEquals(kv.getValue(), val); - kv = immuClient.getSince(key.getBytes(StandardCharsets.UTF_8), txMd.id); + kv = immuClient.getSince(key, txMd.id); Assert.assertNotNull(kv); Assert.assertEquals(kv.getValue(), val); diff --git a/src/test/java/io/codenotary/immudb4j/UseDatabaseTest.java b/src/test/java/io/codenotary/immudb4j/UseDatabaseTest.java index ad75c8d..6326147 100644 --- a/src/test/java/io/codenotary/immudb4j/UseDatabaseTest.java +++ b/src/test/java/io/codenotary/immudb4j/UseDatabaseTest.java @@ -15,19 +15,25 @@ */ package io.codenotary.immudb4j; +import org.testng.Assert; import org.testng.annotations.Test; +import java.util.List; + public class UseDatabaseTest extends ImmuClientIntegrationTest { - @Test(testName = "useDatabase('defaultdb')") - public void t1() { + @Test(testName = "useDatabase") + public void t1() { + + immuClient.login("immudb", "immudb"); - immuClient.login("immudb", "immudb"); + immuClient.useDatabase("defaultdb"); - immuClient.useDatabase("defaultdb"); + List databases = immuClient.databases(); + Assert.assertTrue(databases.size() > 0); - immuClient.logout(); - } + immuClient.logout(); + } } diff --git a/src/test/java/io/codenotary/immudb4j/VerifiedSetAndGetTest.java b/src/test/java/io/codenotary/immudb4j/VerifiedSetAndGetTest.java index a655cd6..50bfbbd 100644 --- a/src/test/java/io/codenotary/immudb4j/VerifiedSetAndGetTest.java +++ b/src/test/java/io/codenotary/immudb4j/VerifiedSetAndGetTest.java @@ -57,7 +57,7 @@ public void t2() { immuClient.login("immudb", "immudb"); immuClient.useDatabase("defaultdb"); - String key = "vsg"; + byte[] key = "vsg".getBytes(StandardCharsets.UTF_8); byte[] val = "test-vset-vget".getBytes(StandardCharsets.UTF_8); // verifiedSet @@ -79,7 +79,7 @@ public void t2() { // verifiedGetAt try { - vEntry = immuClient.verifiedGetAt(key.getBytes(StandardCharsets.UTF_8), vEntry.txId); + vEntry = immuClient.verifiedGetAt(key, vEntry.txId); } catch (VerificationException e) { Assert.fail("Failed at verifiedGetAt. Cause: " + e.getMessage(), e); } @@ -87,7 +87,7 @@ public void t2() { // verifiedGetSince try { - vEntry = immuClient.verifiedGetSince(key.getBytes(StandardCharsets.UTF_8), vEntry.txId); + vEntry = immuClient.verifiedGetSince(key, vEntry.txId); } catch (VerificationException e) { Assert.fail("Failed at verifiedGetSince. Cause: " + e.getMessage(), e); } @@ -97,7 +97,7 @@ public void t2() { byte[] refKey = "vsgRef".getBytes(StandardCharsets.UTF_8); TxMetadata txMd = null; try { - txMd = immuClient.verifiedSetReference(refKey, key.getBytes(StandardCharsets.UTF_8)); + txMd = immuClient.verifiedSetReference(refKey, key); } catch (VerificationException e) { // TODO: Investigate "different digests" failure at VerifiedSetReference // Assert.fail("Failed at verifiedSetReference. Cause: " + e.getMessage(), e);