Replace MultiRecipientMessage parsing with libsignal's implementation

Co-authored-by: Jonathan Klabunde Tomer <jkt@signal.org>
This commit is contained in:
Jordan Rose
2023-12-08 08:52:47 -08:00
committed by GitHub
parent f20d3043d6
commit 2ab3c97ee8
8 changed files with 64 additions and 337 deletions

View File

@@ -7,6 +7,7 @@ package org.whispersystems.textsecuregcm.identity;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.UUID;
import org.signal.libsignal.protocol.ServiceId;
/**
* A "service identifier" is a tuple of a UUID and identity type that identifies an account and identity within the
@@ -70,4 +71,14 @@ public interface ServiceIdentifier {
return PniServiceIdentifier.fromBytes(bytes);
}
}
static ServiceIdentifier fromLibsignal(final ServiceId libsignalServiceId) {
if (libsignalServiceId instanceof ServiceId.Aci) {
return new AciServiceIdentifier(libsignalServiceId.getRawUUID());
}
if (libsignalServiceId instanceof ServiceId.Pni) {
return new PniServiceIdentifier(libsignalServiceId.getRawUUID());
}
throw new IllegalArgumentException("unknown libsignal ServiceId type");
}
}