Search in sources :

Example 6 with GroupExternalCredential

use of org.signal.storageservice.protos.groups.GroupExternalCredential in project Signal-Android by signalapp.

the class SignalCallManager method requestMembershipProof.

@Override
public void requestMembershipProof(@NonNull final GroupCall groupCall) {
    Log.i(TAG, "requestMembershipProof():");
    Recipient recipient = serviceState.getCallInfoState().getCallRecipient();
    if (!recipient.isPushV2Group()) {
        Log.i(TAG, "Request membership proof for non-group");
        return;
    }
    GroupCall currentGroupCall = serviceState.getCallInfoState().getGroupCall();
    if (currentGroupCall == null || currentGroupCall.hashCode() != groupCall.hashCode()) {
        Log.i(TAG, "Skipping group membership proof request, requested group call does not match current group call");
        return;
    }
    networkExecutor.execute(() -> {
        try {
            GroupExternalCredential credential = GroupManager.getGroupExternalCredential(context, recipient.getGroupId().get().requireV2());
            process((s, p) -> p.handleGroupRequestMembershipProof(s, groupCall.hashCode(), credential.getTokenBytes().toByteArray()));
        } catch (IOException e) {
            Log.w(TAG, "Unable to get group membership proof from service", e);
            onEnded(groupCall, GroupCall.GroupCallEndReason.SFU_CLIENT_FAILED_TO_JOIN);
        } catch (VerificationFailedException e) {
            Log.w(TAG, "Unable to verify group membership proof", e);
            onEnded(groupCall, GroupCall.GroupCallEndReason.DEVICE_EXPLICITLY_DISCONNECTED);
        }
    });
}
Also used : GroupCall(org.signal.ringrtc.GroupCall) Recipient(org.thoughtcrime.securesms.recipients.Recipient) IOException(java.io.IOException) GroupExternalCredential(org.signal.storageservice.protos.groups.GroupExternalCredential) VerificationFailedException(org.signal.zkgroup.VerificationFailedException)

Aggregations

IOException (java.io.IOException)6 GroupCall (org.signal.ringrtc.GroupCall)6 GroupExternalCredential (org.signal.storageservice.protos.groups.GroupExternalCredential)6 VerificationFailedException (org.signal.zkgroup.VerificationFailedException)6 Application (android.app.Application)4 Context (android.content.Context)4 Intent (android.content.Intent)4 Build (android.os.Build)4 ResultReceiver (android.os.ResultReceiver)4 NonNull (androidx.annotation.NonNull)4 Nullable (androidx.annotation.Nullable)4 Stream (com.annimon.stream.Stream)4 Collection (java.util.Collection)4 Collections (java.util.Collections)4 LinkedList (java.util.LinkedList)4 List (java.util.List)4 Set (java.util.Set)4 UUID (java.util.UUID)4 Executor (java.util.concurrent.Executor)4 ExecutorService (java.util.concurrent.ExecutorService)4