diff --git a/pom.xml b/pom.xml index d2dd34f..fc15161 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.wire helium - 1.5.2 + 1.6.0 Helium User mode for Wire Bots @@ -65,7 +65,7 @@ com.wire xenon - 1.7.2 + 1.8.0 jakarta.ws.rs diff --git a/src/main/java/com/wire/helium/API.java b/src/main/java/com/wire/helium/API.java index 0957399..d1f21f0 100644 --- a/src/main/java/com/wire/helium/API.java +++ b/src/main/java/com/wire/helium/API.java @@ -22,13 +22,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.google.protobuf.ByteString; import com.wire.helium.models.Connection; -import com.wire.helium.models.model.response.FeatureConfig; import com.wire.helium.models.NotificationList; -import com.wire.helium.models.model.response.PublicKeysResponse; import com.wire.helium.models.model.request.ConversationListPaginationConfig; import com.wire.helium.models.model.request.ConversationListRequest; import com.wire.helium.models.model.response.ConversationListIdsResponse; import com.wire.helium.models.model.response.ConversationListResponse; +import com.wire.helium.models.model.response.FeatureConfig; +import com.wire.helium.models.model.response.PublicKeysResponse; import com.wire.messages.Otr; import com.wire.xenon.WireAPI; import com.wire.xenon.assets.IAsset; @@ -93,14 +93,13 @@ public API(Client client, QualifiedId convId, String token) { /** * Sends E2E encrypted messages to all clients already known, with opened cryptobox sessions. - * * After sending those, the backend will return the list of clients that the service has no connection yet, * so prekeys for those specific clients can be downloaded a new cryptobox sessions initiated. * @param msg the message with the already encrypted clients * @param ignoreMissing when true, missing clients won't be blocking and just be returned, * when false, any missing recipient will block the message to be sent to anyone * @return devices that had issues or still need the message - * @throws HttpException + * @throws HttpException on any error response from the backend */ @Override public Devices sendMessage(OtrMessage msg, boolean ignoreMissing) throws HttpException { @@ -137,13 +136,12 @@ public Devices sendMessage(OtrMessage msg, boolean ignoreMissing) throws HttpExc /** * Sends E2E encrypted messages to all clients already known, with opened cryptobox sessions. - * * After sending those, the backend will return the list of clients that the service has no connection yet, * so prekeys for those specific clients can be downloaded a new cryptobox sessions initiated. * @param msg the message with the already encrypted clients * @param userId If this users' client is missing, the message is not sent * @return devices that had issues or still need the message - * @throws HttpException + * @throws HttpException on any error response from the backend */ @Override public Devices sendPartialMessage(OtrMessage msg, QualifiedId userId) throws HttpException { @@ -669,7 +667,7 @@ public boolean isMlsEnabled() { } try { - PublicKeysResponse publicKeysResponse = mlsPublicKeysResponse.readEntity(PublicKeysResponse.class); + mlsPublicKeysResponse.readEntity(PublicKeysResponse.class); } catch (Exception e) { Logger.error("isMlsEnabled - Public Keys Deserialization error: %s", e.getMessage()); return false; @@ -761,7 +759,7 @@ public byte[] getConversationGroupInfo(QualifiedId conversationId) throws Runtim .path(conversationId.domain) .path(conversationId.id.toString()) .path("groupinfo") - .request(MediaType.APPLICATION_JSON) + .request() .header(HttpHeaders.AUTHORIZATION, bearer(token)) .accept("message/mls") .get(); diff --git a/src/main/java/com/wire/helium/LoginClient.java b/src/main/java/com/wire/helium/LoginClient.java index 5884877..e1f497b 100644 --- a/src/main/java/com/wire/helium/LoginClient.java +++ b/src/main/java/com/wire/helium/LoginClient.java @@ -185,10 +185,11 @@ public String registerClient(String token, String password, ArrayList pr return response.readEntity(_Client.class).id; } - public Access renewAccessToken(Cookie cookie) throws HttpException { + public Access renewAccessToken(String clientId, Cookie cookie) throws HttpException { Invocation.Builder builder = accessPath - .request(MediaType.APPLICATION_JSON) - .cookie(cookie); + .queryParam("client_id", clientId) + .request(MediaType.APPLICATION_JSON) + .cookie(cookie); Response response = builder. post(Entity.entity(null, MediaType.APPLICATION_JSON)); diff --git a/src/test/java/com/wire/helium/End2EndTest.java b/src/test/java/com/wire/helium/End2EndTest.java index 8db557f..c69c32d 100644 --- a/src/test/java/com/wire/helium/End2EndTest.java +++ b/src/test/java/com/wire/helium/End2EndTest.java @@ -51,7 +51,7 @@ public void testAliceToAlice() throws Exception { CryptoDatabase aliceCrypto = new CryptoDatabase(aliceId, storage, rootFolder + "/testAliceToAlice/1"); CryptoDatabase aliceCrypto1 = new CryptoDatabase(aliceId, storage, rootFolder + "/testAliceToAlice/2"); - CryptoMlsClient cryptoMlsClient = new CryptoMlsClient(client1, client1 + "_db_key"); + CryptoMlsClient cryptoMlsClient = new CryptoMlsClient(client1, aliceId, client1 + "_db_key"); DummyAPI api = new DummyAPI(); api.addDevice(aliceId, client1, aliceCrypto1.box().newLastPreKey()); @@ -81,7 +81,7 @@ public void testAliceToBob() throws Exception { CryptoDatabase aliceCrypto = new CryptoDatabase(aliceId, storage, rootFolder + "/testAliceToBob"); CryptoDatabase bobCrypto = new CryptoDatabase(bobId, storage, rootFolder + "/testAliceToBob"); - CryptoMlsClient cryptoMlsClient = new CryptoMlsClient(client1, client1 + "_db_key"); + CryptoMlsClient cryptoMlsClient = new CryptoMlsClient(client1, bobId, client1 + "_db_key"); DummyAPI api = new DummyAPI(); api.addDevice(bobId, client1, bobCrypto.box().newLastPreKey()); @@ -116,7 +116,7 @@ public void testMultiDevicePostgres() throws Exception { CryptoDatabase aliceCrypto1 = new CryptoDatabase(aliceId, storage, rootFolder + "/testMultiDevicePostgres/alice/1"); CryptoDatabase bobCrypto1 = new CryptoDatabase(bobId, storage, rootFolder + "/testMultiDevicePostgres/bob/1"); CryptoDatabase bobCrypto2 = new CryptoDatabase(bobId, storage, rootFolder + "/testMultiDevicePostgres/bob/2"); - CryptoMlsClient cryptoMlsClient = new CryptoMlsClient(client1, client1 + "_db_key"); + CryptoMlsClient cryptoMlsClient = new CryptoMlsClient(client1, bobId, client1 + "_db_key"); DummyAPI api = new DummyAPI(); api.addDevice(bobId, client1, bobCrypto1.box().newLastPreKey());