mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-20 17:38:04 +01:00
Replace MultiRecipientMessage parsing with libsignal's implementation
Co-authored-by: Jonathan Klabunde Tomer <jkt@signal.org>
This commit is contained in:
@@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user