Skip to content

Commit

Permalink
v0.14.1 (build 202)
Browse files Browse the repository at this point in the history
  • Loading branch information
finiasz committed May 15, 2023
1 parent 21fd618 commit 2c2a6b0
Show file tree
Hide file tree
Showing 28 changed files with 243 additions and 84 deletions.
9 changes: 7 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# Build 202 (0.14.1)
2023-05-15

- Bug fixes

# Build 201 (0.14.0)
2023-04-19

- dependency updates
- various fixes
- Dependency updates
- Various fixes

# ~~Build 200 (0.14.0)~~
2023-04-05
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ public void wasCommitted() {
if ((commitHookBits & HOOK_BIT_CHANNEL_CONFIRMED) != 0) {
// refresh members of groups owned by the remoteIdentity (useful after a backup restore)
channelManagerSession.identityDelegate.refreshMembersOfGroupsOwnedByGroupOwner(currentDeviceUid, remoteIdentity);
// reinvite members of groups owned (useful after a backup restore)
// re-invite members of groups owned (useful after a backup restore)
channelManagerSession.identityDelegate.pushMembersOfOwnedGroupsToContact(currentDeviceUid, remoteIdentity);
// resend a batch of all keys for common groups V2
channelManagerSession.identityDelegate.initiateGroupV2BatchKeysResend(currentDeviceUid, remoteIdentity, remoteDeviceUid);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,7 @@ public boolean reBlockForcefullyUnblockedContact(Session session, Identity owned


@Override
public void addDeviceForContactIdentity(Session session, Identity ownedIdentity, Identity contactIdentity, UID deviceUid) throws SQLException {
public boolean addDeviceForContactIdentity(Session session, Identity ownedIdentity, Identity contactIdentity, UID deviceUid) throws SQLException {
ContactIdentity contact = ContactIdentity.get(wrapSession(session), ownedIdentity, contactIdentity);
if (contact != null && contact.isActive()) {
ContactDevice contactDevice = ContactDevice.get(wrapSession(session), deviceUid, contactIdentity, ownedIdentity);
Expand All @@ -1604,8 +1604,10 @@ public void addDeviceForContactIdentity(Session session, Identity ownedIdentity,
if (contactDevice == null) {
throw new SQLException();
}
return true;
}
}
return false;
}

@Override
Expand Down Expand Up @@ -3359,6 +3361,15 @@ private void moveKeycloakMemberToPendingMember(IdentityManagerSession identityMa
});
}

// return true only if the identity is a PendingMember: if it is a GroupMember, it returns false
@Override
public boolean isIdentityAPendingGroupV2Member(Session session, Identity ownedIdentity, GroupV2.Identifier groupIdentifier, Identity identity) throws SQLException {
if (session == null || ownedIdentity == null || groupIdentifier == null || identity == null) {
return false;
}

return ContactGroupV2PendingMember.get(wrapSession(session), ownedIdentity, groupIdentifier, identity) != null;
}

// endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ public interface IdentityDelegate {
boolean forcefullyUnblockContact(Session session, Identity ownedIdentity, Identity contactIdentity) throws SQLException;
boolean reBlockForcefullyUnblockedContact(Session session, Identity ownedIdentity, Identity contactIdentity) throws SQLException;

void addDeviceForContactIdentity(Session session, Identity ownedIdentity, Identity contactIdentity, UID deviceUid) throws SQLException;
// return true if a device was indeed added, false if the device already existed, and throws an exception if adding the device failed
boolean addDeviceForContactIdentity(Session session, Identity ownedIdentity, Identity contactIdentity, UID deviceUid) throws SQLException;
void removeDeviceForContactIdentity(Session session, Identity ownedIdentity, Identity contactIdentity, UID deviceUid) throws SQLException;
void removeAllDevicesForContactIdentity(Session session, Identity ownedIdentity, Identity contactIdentity) throws SQLException;
UID[] getDeviceUidsOfContactIdentity(Session session, Identity ownedIdentity, Identity contactIdentity) throws SQLException;
Expand Down Expand Up @@ -223,7 +224,7 @@ public interface IdentityDelegate {
byte[] createKeycloakGroupV2(Session session, Identity ownedIdentity, GroupV2.Identifier groupIdentifier, KeycloakGroupBlob keycloakGroupBlob);
KeycloakGroupV2UpdateOutput updateKeycloakGroupV2WithNewBlob(Session session, Identity ownedIdentity, GroupV2.Identifier groupIdentifier, KeycloakGroupBlob keycloakGroupBlob) throws Exception;
void rePingOrDemoteContactFromAllKeycloakGroups(Session session, Identity ownedIdentity, Identity contactIdentity, boolean certifiedByOwnKeycloak, String lastKnownSerializedCertifiedDetails) throws SQLException;

boolean isIdentityAPendingGroupV2Member(Session session, Identity ownedIdentity, GroupV2.Identifier groupIdentifier, Identity obliviousChannelContactIdentity) throws SQLException;
// endregion


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -997,9 +997,16 @@ public ConcreteProtocolState executeStep() throws Exception {
return new CancelledState();
}

// add the contact deviceUid if not already there --> we no longer trigger a device discovery
// Add the contactDeviceUid to the contactIdentity if needed --> If the device was indeed added, trigger a device discovery
try {
protocolManagerSession.identityDelegate.addDeviceForContactIdentity(protocolManagerSession.session, getOwnedIdentity(), startState.contactIdentity, startState.contactDeviceUid);
if (protocolManagerSession.identityDelegate.addDeviceForContactIdentity(protocolManagerSession.session, getOwnedIdentity(), startState.contactIdentity, startState.contactDeviceUid)) {
CoreProtocolMessage coreProtocolMessage = new CoreProtocolMessage(SendChannelInfo.createLocalChannelInfo(getOwnedIdentity()),
ConcreteProtocol.DEVICE_DISCOVERY_PROTOCOL_ID,
new UID(getPrng()),
false);
ChannelMessageToSend messageToSend = new DeviceDiscoveryProtocol.InitialMessage(coreProtocolMessage, startState.contactIdentity).generateChannelProtocolMessageToSend();
protocolManagerSession.channelDelegate.post(protocolManagerSession.session, messageToSend, getPrng());
}
} catch (Exception e) {
Logger.w("Exception when adding a contact device");
}
Expand Down Expand Up @@ -1065,9 +1072,16 @@ public ConcreteProtocolState executeStep() throws Exception {
return new CancelledState();
}

// Add the contactDeviceUid to the contactIdentity if needed --> we no longer trigger a device discovery
// Add the contactDeviceUid to the contactIdentity if needed --> If the device was indeed added, trigger a device discovery
try {
protocolManagerSession.identityDelegate.addDeviceForContactIdentity(protocolManagerSession.session, getOwnedIdentity(), startState.contactIdentity, startState.contactDeviceUid);
if (protocolManagerSession.identityDelegate.addDeviceForContactIdentity(protocolManagerSession.session, getOwnedIdentity(), startState.contactIdentity, startState.contactDeviceUid)) {
CoreProtocolMessage coreProtocolMessage = new CoreProtocolMessage(SendChannelInfo.createLocalChannelInfo(getOwnedIdentity()),
ConcreteProtocol.DEVICE_DISCOVERY_PROTOCOL_ID,
new UID(getPrng()),
false);
ChannelMessageToSend messageToSend = new DeviceDiscoveryProtocol.InitialMessage(coreProtocolMessage, startState.contactIdentity).generateChannelProtocolMessageToSend();
protocolManagerSession.channelDelegate.post(protocolManagerSession.session, messageToSend, getPrng());
}
} catch (Exception e) {
Logger.w("Exception when adding a contact device");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2313,8 +2313,8 @@ public ConcreteProtocolState executeStep() throws Exception {
}

{
// check if we already have a more recent group version invitation
if (startState instanceof InvitationReceivedState) {
// if still in InvitationReceivedState, check the version and trigger a re-download if necessary
if (((InvitationReceivedState) startState).serverBlob.version >= groupVersion) {
return startState;
}
Expand Down Expand Up @@ -2349,14 +2349,36 @@ public ConcreteProtocolState executeStep() throws Exception {
}
}

// check if we already joined this group and have a larger group version
// check if we already joined this group
Integer dbGroupVersion = protocolManagerSession.identityDelegate.getGroupV2Version(protocolManagerSession.session, getOwnedIdentity(), groupIdentifier);
if (dbGroupVersion != null && dbGroupVersion >= groupVersion) {
// we already have a more recent version of this group, ignore the message
if (startState != null) {
return startState;
} else {
return new FinalState();
if (dbGroupVersion != null) {
// if we joined this group and the obliviousChannelContactIdentity is still a pending member, there is a problem! We send him a ping
if (dbGroupVersion <= groupVersion && obliviousChannelContactIdentity != null && protocolManagerSession.identityDelegate.isIdentityAPendingGroupV2Member(protocolManagerSession.session, getOwnedIdentity(), groupIdentifier, obliviousChannelContactIdentity)) {
byte[] ownGroupInvitationNonce = protocolManagerSession.identityDelegate.getGroupV2OwnGroupInvitationNonce(protocolManagerSession.session, getOwnedIdentity(), groupIdentifier);
if (ownGroupInvitationNonce != null) {
byte[] pingSignature = protocolManagerSession.identityDelegate.signGroupInvitationNonce(
protocolManagerSession.session,
Constants.SignatureContext.GROUP_JOIN_NONCE,
groupIdentifier,
ownGroupInvitationNonce,
obliviousChannelContactIdentity,
getOwnedIdentity(),
getPrng());

CoreProtocolMessage coreProtocolMessage = buildCoreProtocolMessage(SendChannelInfo.createAsymmetricBroadcastChannelInfo(obliviousChannelContactIdentity, getOwnedIdentity()));
ChannelMessageToSend messageToSend = new PingMessage(coreProtocolMessage, groupIdentifier, ownGroupInvitationNonce, pingSignature, false).generateChannelProtocolMessageToSend();
protocolManagerSession.channelDelegate.post(protocolManagerSession.session, messageToSend, getPrng());
}
}


if (dbGroupVersion >= groupVersion) {
// we already have a more recent version of this group, ignore the message
if (startState != null) {
return startState;
} else {
return new FinalState();
}
}
}

Expand Down Expand Up @@ -3037,6 +3059,7 @@ public static class InitiateBlobReDownloadStep extends ProtocolStep {
private final UUID dialogUuid;
private final GroupV2.InvitationCollectedData invitationCollectedData;
private final boolean propagationNeeded;
private final boolean repingAllGroupMembers;


@SuppressWarnings("unused")
Expand All @@ -3047,6 +3070,7 @@ public InitiateBlobReDownloadStep(InitialProtocolState startState, GroupReDownlo
this.dialogUuid = UUID.randomUUID();
this.invitationCollectedData = null;
this.propagationNeeded = true;
this.repingAllGroupMembers = true;
}

@SuppressWarnings("unused")
Expand All @@ -3057,6 +3081,7 @@ public InitiateBlobReDownloadStep(InitialProtocolState startState, InvitationRej
this.dialogUuid = UUID.randomUUID();
this.invitationCollectedData = null;
this.propagationNeeded = true;
this.repingAllGroupMembers = false;
}

@SuppressWarnings("unused")
Expand All @@ -3067,6 +3092,7 @@ public InitiateBlobReDownloadStep(InitialProtocolState startState, PropagateInvi
this.dialogUuid = UUID.randomUUID();
this.invitationCollectedData = null;
this.propagationNeeded = false;
this.repingAllGroupMembers = false;
}

@SuppressWarnings("unused")
Expand All @@ -3078,6 +3104,7 @@ public InitiateBlobReDownloadStep(InvitationReceivedState startState, Invitation
this.invitationCollectedData = new GroupV2.InvitationCollectedData();
this.invitationCollectedData.addBlobKeysCandidates(startState.inviterIdentity, startState.blobKeys);
this.propagationNeeded = true;
this.repingAllGroupMembers = false;
}

@SuppressWarnings("unused")
Expand All @@ -3089,6 +3116,7 @@ public InitiateBlobReDownloadStep(InvitationReceivedState startState, PropagateI
this.invitationCollectedData = new GroupV2.InvitationCollectedData();
this.invitationCollectedData.addBlobKeysCandidates(startState.inviterIdentity, startState.blobKeys);
this.propagationNeeded = false;
this.repingAllGroupMembers = false;
}


Expand Down Expand Up @@ -3129,6 +3157,31 @@ public ConcreteProtocolState executeStep() throws Exception {
}
}

if (repingAllGroupMembers) {
try {
// do not fail the step if sending the pings fails
byte[] ownGroupInvitationNonce = protocolManagerSession.identityDelegate.getGroupV2OwnGroupInvitationNonce(protocolManagerSession.session, getOwnedIdentity(), groupIdentifier);
if (ownGroupInvitationNonce != null) {
for (GroupV2.IdentityAndPermissions groupMember : protocolManagerSession.identityDelegate.getGroupV2OtherMembersAndPermissions(protocolManagerSession.session, getOwnedIdentity(), groupIdentifier)) {
byte[] pingSignature = protocolManagerSession.identityDelegate.signGroupInvitationNonce(
protocolManagerSession.session,
Constants.SignatureContext.GROUP_JOIN_NONCE,
groupIdentifier,
ownGroupInvitationNonce,
groupMember.identity,
getOwnedIdentity(),
getPrng());

CoreProtocolMessage coreProtocolMessage = buildCoreProtocolMessage(SendChannelInfo.createAsymmetricBroadcastChannelInfo(groupMember.identity, getOwnedIdentity()));
ChannelMessageToSend messageToSend = new PingMessage(coreProtocolMessage, groupIdentifier, ownGroupInvitationNonce, pingSignature, false).generateChannelProtocolMessageToSend();
protocolManagerSession.channelDelegate.post(protocolManagerSession.session, messageToSend, getPrng());
}
}
} catch (Exception e) {
e.printStackTrace();
}
}

protocolManagerSession.identityDelegate.freezeGroupV2(protocolManagerSession.session, getOwnedIdentity(), groupIdentifier);

byte[] serverQueryNonce = getPrng().bytes(16);
Expand Down
25 changes: 12 additions & 13 deletions obv_messenger/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ android {
applicationId "io.olvid.messenger"
minSdkVersion 21
targetSdk 33
versionCode 201
versionName "0.14.0"
versionCode 202
versionName "0.14.1"
vectorDrawables.useSupportLibrary true
multiDexEnabled true
resConfigs 'en', 'fr'
Expand Down Expand Up @@ -119,9 +119,9 @@ dependencies {
implementation project(':engine')


implementation 'com.google.android.material:material:1.8.0'
implementation 'com.google.android.material:material:1.9.0'

implementation 'androidx.core:core-ktx:1.9.0'
implementation 'androidx.core:core-ktx:1.10.1'
def composeBom = platform 'androidx.compose:compose-bom:2023.03.00'
implementation composeBom
implementation 'androidx.compose.material:material'
Expand All @@ -144,16 +144,16 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.emoji2:emoji2:1.3.0'
implementation 'androidx.emoji2:emoji2-bundled:1.3.0'
implementation 'androidx.activity:activity:1.7.0'
implementation 'androidx.activity:activity:1.7.1'
implementation 'androidx.biometric:biometric:1.1.0'
implementation 'androidx.camera:camera-camera2:1.2.2'
implementation 'androidx.camera:camera-lifecycle:1.2.2'
implementation 'androidx.camera:camera-view:1.2.2'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.core:core-splashscreen:1.0.0'
implementation 'androidx.core:core:1.9.0'
implementation 'androidx.core:core-splashscreen:1.0.1'
implementation 'androidx.core:core:1.10.1'
implementation 'androidx.exifinterface:exifinterface:1.3.6'
implementation 'androidx.fragment:fragment:1.5.6'
implementation 'androidx.fragment:fragment:1.5.7'
implementation 'androidx.media2:media2-player:1.2.1'
implementation 'androidx.media2:media2-session:1.2.1'
implementation 'androidx.media2:media2-widget:1.2.1'
Expand All @@ -168,7 +168,7 @@ dependencies {
implementation 'androidx.work:work-runtime:2.8.1'

implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
implementation 'org.jsoup:jsoup:1.15.4'
implementation 'org.jsoup:jsoup:1.16.1'

// webclient
implementation 'com.google.protobuf:protobuf-lite:3.0.1'
Expand All @@ -178,8 +178,7 @@ dependencies {
implementation 'org.bitbucket.b_c:jose4j:0.9.3'

// map libre integration
// WARNING: our code is not compatible with maplibre 10
implementation 'org.maplibre.gl:android-sdk:10.0.2'
implementation 'org.maplibre.gl:android-sdk:10.2.0'
implementation 'org.maplibre.gl:android-plugin-annotation-v9:1.0.0'

///////////
Expand All @@ -203,7 +202,7 @@ dependencies {

// Google Drive
fullImplementation 'com.google.android.gms:play-services-auth:20.5.0'
fullImplementation('com.google.http-client:google-http-client-gson:1.43.1') {
fullImplementation('com.google.http-client:google-http-client-gson:1.43.2') {
exclude group: 'org.apache.httpcomponents'
}
fullImplementation('com.google.api-client:google-api-client-android:2.2.0') {
Expand All @@ -214,7 +213,7 @@ dependencies {
}

// opensource license page
fullImplementation 'com.google.android.gms:play-services-oss-licenses:17.0.0'
fullImplementation 'com.google.android.gms:play-services-oss-licenses:17.0.1'

// ML kit QR-code scanning
fullImplementation 'com.google.mlkit:barcode-scanning:17.1.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@
import io.olvid.engine.Logger;
import io.olvid.engine.engine.types.EngineAPI;
import io.olvid.messenger.activities.ContactDetailsActivity;
import io.olvid.messenger.activities.GroupV2DetailsActivity;
import io.olvid.messenger.activities.GroupCreationActivity;
import io.olvid.messenger.activities.GroupDetailsActivity;
import io.olvid.messenger.activities.GroupV2DetailsActivity;
import io.olvid.messenger.activities.LockScreenActivity;
import io.olvid.messenger.activities.MessageDetailsActivity;
import io.olvid.messenger.activities.OwnedIdentityDetailsActivity;
Expand Down
Loading

0 comments on commit 2c2a6b0

Please sign in to comment.