mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 02:20:39 +00:00
Fix typo
This commit is contained in:
parent
aebe64571d
commit
5e17fe8414
11 changed files with 28 additions and 29 deletions
|
@ -44,7 +44,7 @@ import org.asamk.signal.manager.api.UpdateGroup;
|
||||||
import org.asamk.signal.manager.api.UpdateProfile;
|
import org.asamk.signal.manager.api.UpdateProfile;
|
||||||
import org.asamk.signal.manager.api.UserStatus;
|
import org.asamk.signal.manager.api.UserStatus;
|
||||||
import org.asamk.signal.manager.api.UsernameLinkUrl;
|
import org.asamk.signal.manager.api.UsernameLinkUrl;
|
||||||
import org.asamk.signal.manager.api.VerificationMethoNotAvailableException;
|
import org.asamk.signal.manager.api.VerificationMethodNotAvailableException;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
|
import org.whispersystems.signalservice.api.util.PhoneNumberFormatter;
|
||||||
|
@ -127,7 +127,7 @@ public interface Manager extends Closeable {
|
||||||
|
|
||||||
void startChangeNumber(
|
void startChangeNumber(
|
||||||
String newNumber, boolean voiceVerification, String captcha
|
String newNumber, boolean voiceVerification, String captcha
|
||||||
) throws RateLimitException, IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, NotPrimaryDeviceException, VerificationMethoNotAvailableException;
|
) throws RateLimitException, IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, NotPrimaryDeviceException, VerificationMethodNotAvailableException;
|
||||||
|
|
||||||
void finishChangeNumber(
|
void finishChangeNumber(
|
||||||
String newNumber, String verificationCode, String pin
|
String newNumber, String verificationCode, String pin
|
||||||
|
@ -138,8 +138,7 @@ public interface Manager extends Closeable {
|
||||||
void deleteAccount() throws IOException;
|
void deleteAccount() throws IOException;
|
||||||
|
|
||||||
void submitRateLimitRecaptchaChallenge(
|
void submitRateLimitRecaptchaChallenge(
|
||||||
String challenge,
|
String challenge, String captcha
|
||||||
String captcha
|
|
||||||
) throws IOException, CaptchaRejectedException;
|
) throws IOException, CaptchaRejectedException;
|
||||||
|
|
||||||
List<Device> getLinkedDevices() throws IOException;
|
List<Device> getLinkedDevices() throws IOException;
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.asamk.signal.manager.api.IncorrectPinException;
|
||||||
import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException;
|
import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException;
|
||||||
import org.asamk.signal.manager.api.PinLockedException;
|
import org.asamk.signal.manager.api.PinLockedException;
|
||||||
import org.asamk.signal.manager.api.RateLimitException;
|
import org.asamk.signal.manager.api.RateLimitException;
|
||||||
import org.asamk.signal.manager.api.VerificationMethoNotAvailableException;
|
import org.asamk.signal.manager.api.VerificationMethodNotAvailableException;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -14,7 +14,7 @@ public interface RegistrationManager extends Closeable {
|
||||||
|
|
||||||
void register(
|
void register(
|
||||||
boolean voiceVerification, String captcha, final boolean forceRegister
|
boolean voiceVerification, String captcha, final boolean forceRegister
|
||||||
) throws IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, RateLimitException, VerificationMethoNotAvailableException;
|
) throws IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, RateLimitException, VerificationMethodNotAvailableException;
|
||||||
|
|
||||||
void verifyAccount(
|
void verifyAccount(
|
||||||
String verificationCode, String pin
|
String verificationCode, String pin
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
package org.asamk.signal.manager.api;
|
|
||||||
|
|
||||||
public class VerificationMethoNotAvailableException extends Exception {
|
|
||||||
|
|
||||||
public VerificationMethoNotAvailableException() {
|
|
||||||
super("Invalid verification method");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
package org.asamk.signal.manager.api;
|
||||||
|
|
||||||
|
public class VerificationMethodNotAvailableException extends Exception {
|
||||||
|
|
||||||
|
public VerificationMethodNotAvailableException() {
|
||||||
|
super("Invalid verification method");
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,7 +7,7 @@ import org.asamk.signal.manager.api.InvalidDeviceLinkException;
|
||||||
import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException;
|
import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException;
|
||||||
import org.asamk.signal.manager.api.PinLockedException;
|
import org.asamk.signal.manager.api.PinLockedException;
|
||||||
import org.asamk.signal.manager.api.RateLimitException;
|
import org.asamk.signal.manager.api.RateLimitException;
|
||||||
import org.asamk.signal.manager.api.VerificationMethoNotAvailableException;
|
import org.asamk.signal.manager.api.VerificationMethodNotAvailableException;
|
||||||
import org.asamk.signal.manager.internal.SignalDependencies;
|
import org.asamk.signal.manager.internal.SignalDependencies;
|
||||||
import org.asamk.signal.manager.jobs.SyncStorageJob;
|
import org.asamk.signal.manager.jobs.SyncStorageJob;
|
||||||
import org.asamk.signal.manager.storage.SignalAccount;
|
import org.asamk.signal.manager.storage.SignalAccount;
|
||||||
|
@ -165,7 +165,7 @@ public class AccountHelper {
|
||||||
|
|
||||||
public void startChangeNumber(
|
public void startChangeNumber(
|
||||||
String newNumber, boolean voiceVerification, String captcha
|
String newNumber, boolean voiceVerification, String captcha
|
||||||
) throws IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, RateLimitException, VerificationMethoNotAvailableException {
|
) throws IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, RateLimitException, VerificationMethodNotAvailableException {
|
||||||
final var accountManager = dependencies.createUnauthenticatedAccountManager(newNumber, account.getPassword());
|
final var accountManager = dependencies.createUnauthenticatedAccountManager(newNumber, account.getPassword());
|
||||||
String sessionId = NumberVerificationUtils.handleVerificationSession(accountManager,
|
String sessionId = NumberVerificationUtils.handleVerificationSession(accountManager,
|
||||||
account.getSessionId(newNumber),
|
account.getSessionId(newNumber),
|
||||||
|
|
|
@ -65,7 +65,7 @@ import org.asamk.signal.manager.api.UpdateGroup;
|
||||||
import org.asamk.signal.manager.api.UpdateProfile;
|
import org.asamk.signal.manager.api.UpdateProfile;
|
||||||
import org.asamk.signal.manager.api.UserStatus;
|
import org.asamk.signal.manager.api.UserStatus;
|
||||||
import org.asamk.signal.manager.api.UsernameLinkUrl;
|
import org.asamk.signal.manager.api.UsernameLinkUrl;
|
||||||
import org.asamk.signal.manager.api.VerificationMethoNotAvailableException;
|
import org.asamk.signal.manager.api.VerificationMethodNotAvailableException;
|
||||||
import org.asamk.signal.manager.config.ServiceEnvironmentConfig;
|
import org.asamk.signal.manager.config.ServiceEnvironmentConfig;
|
||||||
import org.asamk.signal.manager.helper.AccountFileUpdater;
|
import org.asamk.signal.manager.helper.AccountFileUpdater;
|
||||||
import org.asamk.signal.manager.helper.Context;
|
import org.asamk.signal.manager.helper.Context;
|
||||||
|
@ -380,7 +380,7 @@ public class ManagerImpl implements Manager {
|
||||||
@Override
|
@Override
|
||||||
public void startChangeNumber(
|
public void startChangeNumber(
|
||||||
String newNumber, boolean voiceVerification, String captcha
|
String newNumber, boolean voiceVerification, String captcha
|
||||||
) throws RateLimitException, IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, NotPrimaryDeviceException, VerificationMethoNotAvailableException {
|
) throws RateLimitException, IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, NotPrimaryDeviceException, VerificationMethodNotAvailableException {
|
||||||
if (!account.isPrimaryDevice()) {
|
if (!account.isPrimaryDevice()) {
|
||||||
throw new NotPrimaryDeviceException();
|
throw new NotPrimaryDeviceException();
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException;
|
||||||
import org.asamk.signal.manager.api.PinLockedException;
|
import org.asamk.signal.manager.api.PinLockedException;
|
||||||
import org.asamk.signal.manager.api.RateLimitException;
|
import org.asamk.signal.manager.api.RateLimitException;
|
||||||
import org.asamk.signal.manager.api.UpdateProfile;
|
import org.asamk.signal.manager.api.UpdateProfile;
|
||||||
import org.asamk.signal.manager.api.VerificationMethoNotAvailableException;
|
import org.asamk.signal.manager.api.VerificationMethodNotAvailableException;
|
||||||
import org.asamk.signal.manager.config.ServiceConfig;
|
import org.asamk.signal.manager.config.ServiceConfig;
|
||||||
import org.asamk.signal.manager.config.ServiceEnvironmentConfig;
|
import org.asamk.signal.manager.config.ServiceEnvironmentConfig;
|
||||||
import org.asamk.signal.manager.helper.AccountFileUpdater;
|
import org.asamk.signal.manager.helper.AccountFileUpdater;
|
||||||
|
@ -105,7 +105,7 @@ public class RegistrationManagerImpl implements RegistrationManager {
|
||||||
@Override
|
@Override
|
||||||
public void register(
|
public void register(
|
||||||
boolean voiceVerification, String captcha, final boolean forceRegister
|
boolean voiceVerification, String captcha, final boolean forceRegister
|
||||||
) throws IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, RateLimitException, VerificationMethoNotAvailableException {
|
) throws IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, RateLimitException, VerificationMethodNotAvailableException {
|
||||||
if (account.isRegistered()
|
if (account.isRegistered()
|
||||||
&& account.getServiceEnvironment() != null
|
&& account.getServiceEnvironment() != null
|
||||||
&& account.getServiceEnvironment() != serviceEnvironmentConfig.type()) {
|
&& account.getServiceEnvironment() != serviceEnvironmentConfig.type()) {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException;
|
||||||
import org.asamk.signal.manager.api.Pair;
|
import org.asamk.signal.manager.api.Pair;
|
||||||
import org.asamk.signal.manager.api.PinLockedException;
|
import org.asamk.signal.manager.api.PinLockedException;
|
||||||
import org.asamk.signal.manager.api.RateLimitException;
|
import org.asamk.signal.manager.api.RateLimitException;
|
||||||
import org.asamk.signal.manager.api.VerificationMethoNotAvailableException;
|
import org.asamk.signal.manager.api.VerificationMethodNotAvailableException;
|
||||||
import org.asamk.signal.manager.helper.PinHelper;
|
import org.asamk.signal.manager.helper.PinHelper;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -35,7 +35,7 @@ public class NumberVerificationUtils {
|
||||||
Consumer<String> sessionIdSaver,
|
Consumer<String> sessionIdSaver,
|
||||||
boolean voiceVerification,
|
boolean voiceVerification,
|
||||||
String captcha
|
String captcha
|
||||||
) throws CaptchaRequiredException, IOException, RateLimitException, VerificationMethoNotAvailableException {
|
) throws CaptchaRequiredException, IOException, RateLimitException, VerificationMethodNotAvailableException {
|
||||||
RegistrationSessionMetadataResponse sessionResponse;
|
RegistrationSessionMetadataResponse sessionResponse;
|
||||||
try {
|
try {
|
||||||
sessionResponse = getValidSession(accountManager, sessionId);
|
sessionResponse = getValidSession(accountManager, sessionId);
|
||||||
|
@ -63,7 +63,7 @@ public class NumberVerificationUtils {
|
||||||
? sessionResponse.getBody().getNextCall()
|
? sessionResponse.getBody().getNextCall()
|
||||||
: sessionResponse.getBody().getNextSms();
|
: sessionResponse.getBody().getNextSms();
|
||||||
if (nextAttempt == null) {
|
if (nextAttempt == null) {
|
||||||
throw new VerificationMethoNotAvailableException();
|
throw new VerificationMethodNotAvailableException();
|
||||||
} else if (nextAttempt > 0) {
|
} else if (nextAttempt > 0) {
|
||||||
final var timestamp = sessionResponse.getHeaders().getTimestamp() + nextAttempt * 1000;
|
final var timestamp = sessionResponse.getHeaders().getTimestamp() + nextAttempt * 1000;
|
||||||
throw new RateLimitException(timestamp);
|
throw new RateLimitException(timestamp);
|
||||||
|
|
|
@ -15,7 +15,7 @@ import org.asamk.signal.manager.RegistrationManager;
|
||||||
import org.asamk.signal.manager.api.CaptchaRequiredException;
|
import org.asamk.signal.manager.api.CaptchaRequiredException;
|
||||||
import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException;
|
import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException;
|
||||||
import org.asamk.signal.manager.api.RateLimitException;
|
import org.asamk.signal.manager.api.RateLimitException;
|
||||||
import org.asamk.signal.manager.api.VerificationMethoNotAvailableException;
|
import org.asamk.signal.manager.api.VerificationMethodNotAvailableException;
|
||||||
import org.asamk.signal.output.JsonWriter;
|
import org.asamk.signal.output.JsonWriter;
|
||||||
import org.asamk.signal.util.CommandUtil;
|
import org.asamk.signal.util.CommandUtil;
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ public class RegisterCommand implements RegistrationCommand, JsonRpcRegistration
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IOErrorException("Failed to register: %s (%s)".formatted(e.getMessage(),
|
throw new IOErrorException("Failed to register: %s (%s)".formatted(e.getMessage(),
|
||||||
e.getClass().getSimpleName()), e);
|
e.getClass().getSimpleName()), e);
|
||||||
} catch (VerificationMethoNotAvailableException e) {
|
} catch (VerificationMethodNotAvailableException e) {
|
||||||
throw new UserErrorException("Failed to register: " + e.getMessage() + (
|
throw new UserErrorException("Failed to register: " + e.getMessage() + (
|
||||||
voiceVerification
|
voiceVerification
|
||||||
? ": Before requesting voice verification you need to request SMS verification and wait a minute."
|
? ": Before requesting voice verification you need to request SMS verification and wait a minute."
|
||||||
|
|
|
@ -13,7 +13,7 @@ import org.asamk.signal.manager.api.CaptchaRequiredException;
|
||||||
import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException;
|
import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException;
|
||||||
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
|
import org.asamk.signal.manager.api.NotPrimaryDeviceException;
|
||||||
import org.asamk.signal.manager.api.RateLimitException;
|
import org.asamk.signal.manager.api.RateLimitException;
|
||||||
import org.asamk.signal.manager.api.VerificationMethoNotAvailableException;
|
import org.asamk.signal.manager.api.VerificationMethodNotAvailableException;
|
||||||
import org.asamk.signal.output.OutputWriter;
|
import org.asamk.signal.output.OutputWriter;
|
||||||
import org.asamk.signal.util.CommandUtil;
|
import org.asamk.signal.util.CommandUtil;
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ public class StartChangeNumberCommand implements JsonRpcLocalCommand {
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new IOErrorException("Failed to change number: %s (%s)".formatted(e.getMessage(),
|
throw new IOErrorException("Failed to change number: %s (%s)".formatted(e.getMessage(),
|
||||||
e.getClass().getSimpleName()), e);
|
e.getClass().getSimpleName()), e);
|
||||||
} catch (VerificationMethoNotAvailableException e) {
|
} catch (VerificationMethodNotAvailableException e) {
|
||||||
throw new UserErrorException("Failed to register: " + e.getMessage() + (
|
throw new UserErrorException("Failed to register: " + e.getMessage() + (
|
||||||
voiceVerification
|
voiceVerification
|
||||||
? ": Before requesting voice verification you need to request SMS verification and wait a minute."
|
? ": Before requesting voice verification you need to request SMS verification and wait a minute."
|
||||||
|
|
|
@ -13,7 +13,7 @@ import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException;
|
||||||
import org.asamk.signal.manager.api.PinLockedException;
|
import org.asamk.signal.manager.api.PinLockedException;
|
||||||
import org.asamk.signal.manager.api.RateLimitException;
|
import org.asamk.signal.manager.api.RateLimitException;
|
||||||
import org.asamk.signal.manager.api.UserAlreadyExistsException;
|
import org.asamk.signal.manager.api.UserAlreadyExistsException;
|
||||||
import org.asamk.signal.manager.api.VerificationMethoNotAvailableException;
|
import org.asamk.signal.manager.api.VerificationMethodNotAvailableException;
|
||||||
import org.freedesktop.dbus.DBusPath;
|
import org.freedesktop.dbus.DBusPath;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -74,7 +74,7 @@ public class DbusSignalControlImpl implements org.asamk.SignalControl {
|
||||||
throw new Error.InvalidNumber(e.getMessage());
|
throw new Error.InvalidNumber(e.getMessage());
|
||||||
} catch (OverlappingFileLockException e) {
|
} catch (OverlappingFileLockException e) {
|
||||||
throw new SignalControl.Error.Failure("Account is already in use");
|
throw new SignalControl.Error.Failure("Account is already in use");
|
||||||
} catch (IOException | VerificationMethoNotAvailableException e) {
|
} catch (IOException | VerificationMethodNotAvailableException e) {
|
||||||
throw new SignalControl.Error.Failure(e.getClass().getSimpleName() + " " + e.getMessage());
|
throw new SignalControl.Error.Failure(e.getClass().getSimpleName() + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue