package org.asamk.signal.manager;
import org.asamk.signal.manager.api.Device;
+import org.asamk.signal.manager.api.Group;
+import org.asamk.signal.manager.api.Identity;
import org.asamk.signal.manager.api.Message;
import org.asamk.signal.manager.api.RecipientIdentifier;
import org.asamk.signal.manager.api.SendGroupMessageResults;
import org.asamk.signal.manager.api.SendMessageResults;
import org.asamk.signal.manager.api.TypingAction;
+import org.asamk.signal.manager.api.UpdateGroup;
import org.asamk.signal.manager.config.ServiceConfig;
import org.asamk.signal.manager.config.ServiceEnvironment;
import org.asamk.signal.manager.groups.GroupId;
import org.asamk.signal.manager.groups.GroupInviteLinkUrl;
-import org.asamk.signal.manager.groups.GroupLinkState;
import org.asamk.signal.manager.groups.GroupNotFoundException;
-import org.asamk.signal.manager.groups.GroupPermission;
import org.asamk.signal.manager.groups.GroupSendingNotAllowedException;
import org.asamk.signal.manager.groups.LastGroupAdminException;
import org.asamk.signal.manager.groups.NotAGroupMemberException;
import org.asamk.signal.manager.storage.SignalAccount;
-import org.asamk.signal.manager.storage.groups.GroupInfo;
-import org.asamk.signal.manager.storage.identities.IdentityInfo;
import org.asamk.signal.manager.storage.identities.TrustNewIdentity;
import org.asamk.signal.manager.storage.recipients.Contact;
import org.asamk.signal.manager.storage.recipients.Profile;
-import org.asamk.signal.manager.storage.recipients.RecipientId;
+import org.asamk.signal.manager.storage.recipients.RecipientAddress;
import org.whispersystems.libsignal.IdentityKey;
import org.whispersystems.libsignal.InvalidKeyException;
import org.whispersystems.libsignal.util.Pair;
public interface Manager extends Closeable {
static Manager init(
- String username,
+ String number,
File settingsPath,
ServiceEnvironment serviceEnvironment,
String userAgent,
) throws IOException, NotRegisteredException {
var pathConfig = PathConfig.createDefault(settingsPath);
- if (!SignalAccount.userExists(pathConfig.getDataPath(), username)) {
+ if (!SignalAccount.userExists(pathConfig.getDataPath(), number)) {
throw new NotRegisteredException();
}
- var account = SignalAccount.load(pathConfig.getDataPath(), username, true, trustNewIdentity);
+ var account = SignalAccount.load(pathConfig.getDataPath(), number, true, trustNewIdentity);
if (!account.isRegistered()) {
throw new NotRegisteredException();
return new ManagerImpl(account, pathConfig, serviceEnvironmentConfig, userAgent);
}
- static List<String> getAllLocalUsernames(File settingsPath) {
+ static List<String> getAllLocalNumbers(File settingsPath) {
var pathConfig = PathConfig.createDefault(settingsPath);
final var dataPath = pathConfig.getDataPath();
final var files = dataPath.listFiles();
.collect(Collectors.toList());
}
- String getUsername();
-
- RecipientId getSelfRecipientId();
-
- int getDeviceId();
+ String getSelfNumber();
void checkAccountState() throws IOException;
void updateAccountAttributes(String deviceName) throws IOException;
+ void updateConfiguration(
+ final Boolean readReceipts,
+ final Boolean unidentifiedDeliveryIndicators,
+ final Boolean typingIndicators,
+ final Boolean linkPreviews
+ ) throws IOException, NotMasterDeviceException;
+
void setProfile(
String givenName, String familyName, String about, String aboutEmoji, Optional<File> avatar
) throws IOException;
List<Device> getLinkedDevices() throws IOException;
- void removeLinkedDevices(int deviceId) throws IOException;
+ void removeLinkedDevices(long deviceId) throws IOException;
void addDeviceLink(URI linkUri) throws IOException, InvalidKeyException;
void setRegistrationLockPin(Optional<String> pin) throws IOException, UnauthenticatedResponseException;
- Profile getRecipientProfile(RecipientId recipientId);
+ Profile getRecipientProfile(RecipientIdentifier.Single recipient) throws UnregisteredUserException;
- List<GroupInfo> getGroups();
+ List<Group> getGroups();
SendGroupMessageResults quitGroup(
GroupId groupId, Set<RecipientIdentifier.Single> groupAdmins
) throws IOException, AttachmentInvalidException;
SendGroupMessageResults updateGroup(
- GroupId groupId,
- String name,
- String description,
- Set<RecipientIdentifier.Single> members,
- Set<RecipientIdentifier.Single> removeMembers,
- Set<RecipientIdentifier.Single> admins,
- Set<RecipientIdentifier.Single> removeAdmins,
- boolean resetGroupLink,
- GroupLinkState groupLinkState,
- GroupPermission addMemberPermission,
- GroupPermission editDetailsPermission,
- File avatarFile,
- Integer expirationTimer,
- Boolean isAnnouncementGroup
+ final GroupId groupId, final UpdateGroup updateGroup
) throws IOException, GroupNotFoundException, AttachmentInvalidException, NotAGroupMemberException, GroupSendingNotAllowedException;
Pair<GroupId, SendGroupMessageResults> joinGroup(
void setGroupBlocked(
GroupId groupId, boolean blocked
- ) throws GroupNotFoundException, IOException;
+ ) throws GroupNotFoundException, IOException, NotMasterDeviceException;
void setExpirationTimer(
RecipientIdentifier.Single recipient, int messageExpirationTimer
void sendContacts() throws IOException;
- List<Pair<RecipientId, Contact>> getContacts();
+ List<Pair<RecipientAddress, Contact>> getContacts();
- String getContactOrProfileName(RecipientIdentifier.Single recipientIdentifier);
+ String getContactOrProfileName(RecipientIdentifier.Single recipient);
- GroupInfo getGroup(GroupId groupId);
+ Group getGroup(GroupId groupId);
- List<IdentityInfo> getIdentities();
+ List<Identity> getIdentities();
- List<IdentityInfo> getIdentities(RecipientIdentifier.Single recipient);
+ List<Identity> getIdentities(RecipientIdentifier.Single recipient);
boolean trustIdentityVerified(RecipientIdentifier.Single recipient, byte[] fingerprint);
String computeSafetyNumber(SignalServiceAddress theirAddress, IdentityKey theirIdentityKey);
- byte[] computeSafetyNumberForScanning(SignalServiceAddress theirAddress, IdentityKey theirIdentityKey);
-
SignalServiceAddress resolveSignalServiceAddress(SignalServiceAddress address);
- SignalServiceAddress resolveSignalServiceAddress(UUID uuid);
-
- SignalServiceAddress resolveSignalServiceAddress(RecipientId recipientId);
-
@Override
void close() throws IOException;