}
}
- public static AccountAttributes.Capabilities getCapabilities() {
- return capabilities;
- }
-
public static KeyStore getIasKeyStore() {
return iasKeyStore;
}
GroupLinkPassword.fromBytes(group.getInviteLinkPassword().toByteArray()));
}
- public static boolean isGroupLink(String urlString) {
- return getGroupUrl(urlString) != null;
- }
-
/**
* @return null iff not a group url.
* @throws InvalidGroupLinkException If group url, but cannot be parsed.
this.url = createUrl(groupMasterKey, password);
}
- protected static String createUrl(GroupMasterKey groupMasterKey, GroupLinkPassword password) {
+ private static String createUrl(GroupMasterKey groupMasterKey, GroupLinkPassword password) {
var groupInviteLink = GroupInviteLink.newBuilder()
.setV1Contents(GroupInviteLink.GroupInviteLinkContentsV1.newBuilder()
.setGroupMasterKey(ByteString.copyFrom(groupMasterKey.serialize()))
import org.signal.zkgroup.InvalidInputException;
import org.signal.zkgroup.groups.GroupMasterKey;
import org.signal.zkgroup.groups.GroupSecretParams;
-import org.whispersystems.libsignal.kdf.HKDFv3;
+import org.whispersystems.libsignal.kdf.HKDF;
import org.whispersystems.signalservice.api.messages.SignalServiceDataMessage;
import org.whispersystems.signalservice.api.messages.SignalServiceGroup;
import org.whispersystems.signalservice.api.messages.SignalServiceGroupContext;
private static GroupMasterKey deriveV2MigrationMasterKey(GroupIdV1 groupIdV1) {
try {
- return new GroupMasterKey(new HKDFv3().deriveSecrets(groupIdV1.serialize(),
+ return new GroupMasterKey(HKDF.deriveSecrets(groupIdV1.serialize(),
"GV2 Migration".getBytes(),
GroupMasterKey.SIZE));
} catch (InvalidInputException e) {
save();
}
- public String getRegistrationLockPin() {
- return registrationLockPin;
- }
-
public void setRegistrationLockPin(final String registrationLockPin, final MasterKey pinMasterKey) {
this.registrationLockPin = registrationLockPin;
this.pinMasterKey = pinMasterKey;
public Date getDateAdded() {
return this.added;
}
-
- public byte[] getFingerprint() {
- return identityKey.getPublicKey().serialize();
- }
}
return new SignedPreKeyRecord(signedPreKeyId, System.currentTimeMillis(), keyPair, signature);
}
- public static String createSignalingKey() {
- return getSecret(52);
- }
-
public static ProfileKey createProfileKey() {
try {
return new ProfileKey(getSecretBytes(32));
emptyIfNull(about),
emptyIfNull(aboutEmoji),
avatar == null ? "" : avatar.map(File::getPath).orElse(""),
- avatar != null && !avatar.isPresent());
+ avatar != null && avatar.isEmpty());
}
@Override
private void notifyMessageHandlers(final MessageEnvelope envelope) {
synchronized (messageHandlers) {
- Stream.concat(messageHandlers.stream(), weakHandlers.stream()).forEach(h -> {
- h.handleMessage(envelope, null);
- });
+ Stream.concat(messageHandlers.stream(), weakHandlers.stream())
+ .forEach(h -> h.handleMessage(envelope, null));
}
}
public class DbusReceiveMessageHandler implements Manager.ReceiveMessageHandler {
- private final Manager m;
private final DBusConnection conn;
private final String objectPath;
- public DbusReceiveMessageHandler(Manager m, DBusConnection conn, final String objectPath) {
- this.m = m;
+ public DbusReceiveMessageHandler(DBusConnection conn, final String objectPath) {
this.conn = conn;
this.objectPath = objectPath;
}
var attachments = message.attachments()
.stream()
.filter(a -> a.id().isPresent())
- .map(a -> getAttachmentMap(m, a))
+ .map(this::getAttachmentMap)
.collect(Collectors.toList());
extras.put("attachments", new Variant<>(attachments, "aa{sv}"));
}
}
private Map<String, Variant<?>> getAttachmentMap(
- final Manager m, final MessageEnvelope.Data.Attachment a
+ final MessageEnvelope.Data.Attachment a
) {
final var map = new HashMap<String, Variant<?>>();
if (a.id().isPresent()) {
@Override
public void subscribeReceive() {
if (dbusMessageHandler == null) {
- dbusMessageHandler = new DbusReceiveMessageHandler(m, connection, objectPath);
+ dbusMessageHandler = new DbusReceiveMessageHandler(connection, objectPath);
m.addReceiveHandler(dbusMessageHandler);
}
subscriberCount++;
final var size = attachment.size().orElse(null);
return new JsonAttachment(attachment.contentType(), filename, id, size);
}
-
- static JsonAttachment from(String filename) {
- return new JsonAttachment(filename, null, null, null);
- }
}
import com.fasterxml.jackson.annotation.JsonInclude;
-import org.asamk.Signal;
import org.asamk.signal.manager.api.MessageEnvelope;
import java.util.List;
contacts,
groupInfo);
}
-
- static JsonDataMessage from(Signal.MessageReceived messageReceived) {
- return new JsonDataMessage(messageReceived.getTimestamp(),
- messageReceived.getMessage(),
- // TODO Replace these with the proper commands
- null,
- null,
- null,
- null,
- null,
- null,
- messageReceived.getAttachments().stream().map(JsonAttachment::from).collect(Collectors.toList()),
- null,
- null,
- null,
- messageReceived.getGroupId().length > 0 ? JsonGroupInfo.from(messageReceived.getGroupId()) : null);
- }
-
- static JsonDataMessage from(Signal.SyncMessageReceived messageReceived) {
- return new JsonDataMessage(messageReceived.getTimestamp(),
- messageReceived.getMessage(),
- // TODO Replace these with the proper commands
- null,
- null,
- null,
- null,
- null,
- null,
- messageReceived.getAttachments().stream().map(JsonAttachment::from).collect(Collectors.toList()),
- null,
- null,
- null,
- messageReceived.getGroupId().length > 0 ? JsonGroupInfo.from(messageReceived.getGroupId()) : null);
- }
}
import org.asamk.signal.manager.api.MessageEnvelope;
-import java.util.Base64;
-
record JsonGroupInfo(String groupId, String type) {
static JsonGroupInfo from(MessageEnvelope.Data.GroupContext groupContext) {
return new JsonGroupInfo(groupContext.groupId().toBase64(),
groupContext.isGroupUpdate() ? "UPDATE" : "DELIVER");
}
-
- static JsonGroupInfo from(byte[] groupId) {
- return new JsonGroupInfo(Base64.getEncoder().encodeToString(groupId), "DELIVER");
- }
}
import org.asamk.signal.manager.api.ProofRequiredException;
import org.asamk.signal.manager.api.RecipientIdentifier;
import org.asamk.signal.manager.api.SendMessageResult;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Collection;
public class ErrorUtils {
- private final static Logger logger = LoggerFactory.getLogger(ErrorUtils.class);
-
private ErrorUtils() {
}