Skip to content

Commit

Permalink
v2.0.1 (build 234)
Browse files Browse the repository at this point in the history
  • Loading branch information
finiasz committed Mar 20, 2024
1 parent f1684d1 commit 5ef3301
Show file tree
Hide file tree
Showing 35 changed files with 1,844 additions and 425 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Built 234 (2.0.1)
2024-03-20

- Several improvements to the video calls UI
- Fix a api key registration bug on first Keycloak binding
- Minor improvements to OpenStreetMaps integration
- Redesign of the message upload coordinator for improved performances when sending many messages

# Build 233 (2.0)
2024-03-14

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public abstract class Constants {

public static final int DEFAULT_ATTACHMENT_CHUNK_LENGTH = 4*2048*1024;
public static final int MAX_MESSAGE_EXTENDED_CONTENT_LENGTH = 50 * 1024;
public static final int MAX_UPLOAD_MESSAGE_BATCH_SIZE = 50;

public static final UID BROADCAST_UID = new UID(new byte[]{(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff});

Expand All @@ -110,6 +111,7 @@ public abstract class Constants {
// prefixes for various types of signature

public static final int SIGNATURE_PADDING_LENGTH = 16;

public enum SignatureContext {
SERVER_AUTHENTICATION,
MUTUAL_SCAN,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Olvid for Android
* Copyright © 2019-2024 Olvid SAS
*
* This file is part of Olvid for Android.
*
* Olvid is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License, version 3,
* as published by the Free Software Foundation.
*
* Olvid is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Olvid. If not, see <https://www.gnu.org/licenses/>.
*/

package io.olvid.engine.datatypes.containers;


import java.nio.charset.StandardCharsets;

import io.olvid.engine.crypto.Hash;
import io.olvid.engine.crypto.Suite;
import io.olvid.engine.datatypes.UID;

public class StringAndBoolean {
public final String string;
public final boolean bool;

public StringAndBoolean(String string, boolean bool) {
this.string = string;
this.bool = bool;
}

@Override
public boolean equals(Object o) {
if (!(o instanceof StringAndBoolean)) {
return false;
}
StringAndBoolean other = (StringAndBoolean) o;
return string.equals(other.string) && bool == other.bool;
}

@Override
public int hashCode() {
return string.hashCode() * 31 + Boolean.hashCode(bool);
}

public static UID computeUniqueUid(String string, boolean bool) {
Hash sha256 = Suite.getHash(Hash.SHA256);
byte[] input = new byte[string.getBytes(StandardCharsets.UTF_8).length + 1];
System.arraycopy(string.getBytes(StandardCharsets.UTF_8), 0, input, 0, input.length - 1);
input[input.length - 1] = bool ? (byte) 0x01 : (byte) 0x00;
return new UID(sha256.digest(input));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -672,7 +672,7 @@ public RegisterApiKeyResult registerOwnedIdentityApiKeyOnServer(byte[] bytesOwne
byte[] serverSessionToken = fetchManager.getServerAuthenticationToken(ownedIdentity);
if (serverSessionToken == null) {
fetchManager.createServerSession(ownedIdentity);
return RegisterApiKeyResult.FAILED;
return RegisterApiKeyResult.WAIT_FOR_SERVER_SESSION;
}

StandaloneServerQueryOperation standaloneServerQueryOperation = new StandaloneServerQueryOperation(new ServerQuery(null, ownedIdentity, new ServerQuery.RegisterApiKeyQuery(ownedIdentity, serverSessionToken, Logger.getUuidString(apiKey))));
Expand All @@ -693,7 +693,7 @@ public RegisterApiKeyResult registerOwnedIdentityApiKeyOnServer(byte[] bytesOwne
}
case StandaloneServerQueryOperation.RFC_INVALID_SERVER_SESSION: {
recreateServerSession(bytesOwnedIdentity);
break;
return RegisterApiKeyResult.WAIT_FOR_SERVER_SESSION;
}
case StandaloneServerQueryOperation.RFC_UNSUPPORTED_SERVER_QUERY_TYPE:
case StandaloneServerQueryOperation.RFC_NETWORK_ERROR:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ public enum RegisterApiKeyResult {
SUCCESS,
INVALID_KEY,
FAILED,
WAIT_FOR_SERVER_SESSION,
}
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ public void initialisationComplete() {
protocolStarterDelegate.startDeviceDiscoveryProtocolWithinTransaction(identityManagerSession.session, contactIdentity.getOwnedIdentity(), contactIdentity.getContactIdentity());
}
}
identityManagerSession.session.commit();
}
} catch (Exception e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public class ContactDevice implements ObvDatabase {
static final String OWNED_IDENTITY = "owned_identity";
private byte[] serializedDeviceCapabilities;
static final String SERIALIZED_DEVICE_CAPABILITIES = "serialized_device_capabilities";
// TODO: add a last ping sent timestamp to limit useless contact discoveries

public UID getUid() {
return uid;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,14 @@ public void initialQueueing() {
PendingDeleteFromServer.create(fetchManagerSession, inboxMessage.getOwnedIdentity(), inboxMessage.getUid());
}
}
fetchManagerSession.session.commit();

// check all decrypted messages, with attachments, that are not yet marked as listed on the server
InboxMessage[] messagesToMarkAsListedOnServer = InboxMessage.getMessagesThatCanBeMarkedAsListedOnServer(fetchManagerSession);
for (InboxMessage inboxMessage : messagesToMarkAsListedOnServer) {
fetchManagerSession.markAsListedOnServerListener.messageCanBeMarkedAsListedOnServer(inboxMessage.getOwnedIdentity(), inboxMessage.getUid());
}

} catch (SQLException e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ public void post(Session session, MessageToSend messageToSend) {
messageToSend.getEncryptedContent(),
messageToSend.getEncryptedExtendedContent(),
messageToSend.isApplicationMessage(),
messageToSend.isVoipMessage()
messageToSend.isVoipMessage(),
messageToSend.getAttachments() != null && messageToSend.getAttachments().length != 0
);

if (messageToSend.getHeaders() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import io.olvid.engine.datatypes.PriorityOperation;
import io.olvid.engine.datatypes.PriorityOperationQueue;
import io.olvid.engine.datatypes.UID;
import io.olvid.engine.datatypes.containers.IdentityAndUid;
import io.olvid.engine.datatypes.containers.IdentityAndUidAndNumber;
import io.olvid.engine.datatypes.notifications.IdentityNotifications;
import io.olvid.engine.datatypes.notifications.UploadNotifications;
Expand Down Expand Up @@ -287,4 +288,8 @@ public long getInitialPriority() {
return initialPriority;
}
}

public interface MessageBatchProvider {
IdentityAndUid[] getBatchOFMessageUids();
}
}
Loading

0 comments on commit 5ef3301

Please sign in to comment.