The binary is available at *build/native-image/signal-cli*
-## Troubleshooting
-If you use a version of the Oracle JRE and get an InvalidKeyException you need to enable unlimited strength crypto. See https://stackoverflow.com/questions/6481627/java-security-illegal-key-size-or-default-parameters for instructions.
+## FAQ and Troubleshooting
+For frequently asked questions and issues have a look at the [wiki](https://github.com/AsamK/signal-cli/wiki/FAQ)
## License
import java.net.URI;
import java.net.URISyntaxException;
-import static org.asamk.signal.util.ErrorUtils.handleAssertionError;
-
public class AddDeviceCommand implements LocalCommand {
private final static Logger logger = LoggerFactory.getLogger(AddDeviceCommand.class);
} catch (InvalidKeyException e) {
logger.error("Add device link failed", e);
throw new UnexpectedErrorException("Add device link failed.");
- } catch (AssertionError e) {
- handleAssertionError(e);
- throw e;
}
}
}
import java.io.IOException;
-import static org.asamk.signal.util.ErrorUtils.handleAssertionError;
import static org.asamk.signal.util.ErrorUtils.handleTimestampAndSendMessageResults;
public class JoinGroupCommand implements LocalCommand {
writer.println("Joined group \"{}\"", newGroupId.toBase64());
}
handleTimestampAndSendMessageResults(writer, 0, results.second());
- } catch (AssertionError e) {
- handleAssertionError(e);
- throw e;
} catch (GroupPatchNotAcceptedException e) {
throw new UserErrorException("Failed to join group, maybe already a member");
} catch (IOException e) {
import java.io.IOException;
import java.util.concurrent.TimeoutException;
-import static org.asamk.signal.util.ErrorUtils.handleAssertionError;
-
public class LinkCommand implements ProvisioningCommand {
private final static Logger logger = LoggerFactory.getLogger(LinkCommand.class);
throw new UserErrorException("Link request timed out, please try again.");
} catch (IOException e) {
throw new IOErrorException("Link request error: " + e.getMessage());
- } catch (AssertionError e) {
- handleAssertionError(e);
- throw e;
} catch (InvalidKeyException e) {
logger.debug("Finish device link failed", e);
throw new UnexpectedErrorException("Invalid key: " + e.getMessage());
import java.io.IOException;
-import static org.asamk.signal.util.ErrorUtils.handleAssertionError;
import static org.asamk.signal.util.ErrorUtils.handleTimestampAndSendMessageResults;
public class QuitGroupCommand implements LocalCommand {
handleTimestampAndSendMessageResults(writer, results.first(), results.second());
} catch (IOException e) {
throw new IOErrorException("Failed to send message: " + e.getMessage());
- } catch (AssertionError e) {
- handleAssertionError(e);
- throw e;
- } catch (GroupNotFoundException e) {
- throw new UserErrorException("Failed to send to group: " + e.getMessage());
- } catch (NotAGroupMemberException e) {
+ } catch (GroupNotFoundException | NotAGroupMemberException e) {
throw new UserErrorException("Failed to send to group: " + e.getMessage());
}
}
import java.util.Set;
import java.util.concurrent.TimeUnit;
-import static org.asamk.signal.util.ErrorUtils.handleAssertionError;
-
public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
private final static Logger logger = LoggerFactory.getLogger(ReceiveCommand.class);
handler);
} catch (IOException e) {
throw new IOErrorException("Error while receiving messages: " + e.getMessage());
- } catch (AssertionError e) {
- handleAssertionError(e);
- throw e;
}
}
}
import java.util.List;
-import static org.asamk.signal.util.ErrorUtils.handleAssertionError;
-
public class RemoteDeleteCommand implements DbusCommand {
@Override
.required(true)
.type(long.class)
.help("Specify the timestamp of the message to delete.");
- subparser.addArgument("-g", "--group")
- .help("Specify the recipient group ID.");
- subparser.addArgument("recipient")
- .help("Specify the recipients' phone number.").nargs("*");
+ subparser.addArgument("-g", "--group").help("Specify the recipient group ID.");
+ subparser.addArgument("recipient").help("Specify the recipients' phone number.").nargs("*");
}
@Override
timestamp = signal.sendRemoteDeleteMessage(targetTimestamp, recipients);
}
writer.println("{}", timestamp);
- } catch (AssertionError e) {
- handleAssertionError(e);
- throw e;
} catch (UnknownObject e) {
throw new UserErrorException("Failed to find dbus object, maybe missing the -u flag: " + e.getMessage());
} catch (Signal.Error.InvalidNumber e) {
import java.nio.charset.Charset;
import java.util.List;
-import static org.asamk.signal.util.ErrorUtils.handleAssertionError;
-
public class SendCommand implements DbusCommand {
private final static Logger logger = LoggerFactory.getLogger(SendCommand.class);
try {
signal.sendEndSessionMessage(recipients);
return;
- } catch (AssertionError e) {
- handleAssertionError(e);
- throw e;
} catch (Signal.Error.UntrustedIdentity e) {
throw new UntrustedKeyErrorException("Failed to send message: " + e.getMessage());
} catch (DBusExecutionException e) {
var timestamp = signal.sendGroupMessage(messageText, attachments, groupId);
writer.println("{}", timestamp);
return;
- } catch (AssertionError e) {
- handleAssertionError(e);
- throw e;
} catch (DBusExecutionException e) {
throw new UnexpectedErrorException("Failed to send group message: " + e.getMessage());
}
var timestamp = signal.sendNoteToSelfMessage(messageText, attachments);
writer.println("{}", timestamp);
return;
- } catch (AssertionError e) {
- handleAssertionError(e);
- throw e;
} catch (Signal.Error.UntrustedIdentity e) {
throw new UntrustedKeyErrorException("Failed to send message: " + e.getMessage());
} catch (DBusExecutionException e) {
try {
var timestamp = signal.sendMessage(messageText, attachments, recipients);
writer.println("{}", timestamp);
- } catch (AssertionError e) {
- handleAssertionError(e);
- throw e;
} catch (UnknownObject e) {
throw new UserErrorException("Failed to find dbus object, maybe missing the -u flag: " + e.getMessage());
} catch (Signal.Error.UntrustedIdentity e) {
import java.util.List;
-import static org.asamk.signal.util.ErrorUtils.handleAssertionError;
-
public class SendReactionCommand implements DbusCommand {
@Override
timestamp = signal.sendMessageReaction(emoji, isRemove, targetAuthor, targetTimestamp, recipients);
}
writer.println("{}", timestamp);
- } catch (AssertionError e) {
- handleAssertionError(e);
- throw e;
} catch (UnknownObject e) {
throw new UserErrorException("Failed to find dbus object, maybe missing the -u flag: " + e.getMessage());
} catch (Signal.Error.InvalidNumber e) {
import java.util.Base64;
import java.util.List;
-import static org.asamk.signal.util.ErrorUtils.handleAssertionError;
-
public class UpdateGroupCommand implements DbusCommand {
private final static Logger logger = LoggerFactory.getLogger(UpdateGroupCommand.class);
if (groupId.length != newGroupId.length) {
writer.println("Created new group: \"{}\"", Base64.getEncoder().encodeToString(newGroupId));
}
- } catch (AssertionError e) {
- handleAssertionError(e);
- throw e;
} catch (Signal.Error.AttachmentInvalid e) {
throw new UserErrorException("Failed to add avatar attachment for group\": " + e.getMessage());
} catch (DBusExecutionException e) {
private ErrorUtils() {
}
- public static void handleAssertionError(AssertionError e) {
- logger.warn("If you use an Oracle JRE please check if you have unlimited strength crypto enabled, see README");
- }
-
public static void handleTimestampAndSendMessageResults(
PlainTextWriter writer, long timestamp, List<SendMessageResult> results
) throws CommandException {