diff --git a/lib/src/main/java/org/asamk/signal/manager/Manager.java b/lib/src/main/java/org/asamk/signal/manager/Manager.java index edc162856..d6cf01d88 100644 --- a/lib/src/main/java/org/asamk/signal/manager/Manager.java +++ b/lib/src/main/java/org/asamk/signal/manager/Manager.java @@ -44,7 +44,7 @@ import org.asamk.signal.manager.api.UpdateProfile; import org.asamk.signal.manager.api.UserStatus; 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.LoggerFactory; import org.whispersystems.signalservice.api.util.PhoneNumberFormatter; @@ -127,7 +127,7 @@ void updateAccountAttributes( void startChangeNumber( String newNumber, boolean voiceVerification, String captcha - ) throws RateLimitException, IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, NotPrimaryDeviceException, VerificationMethoNotAvailableException; + ) throws RateLimitException, IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, NotPrimaryDeviceException, VerificationMethodNotAvailableException; void finishChangeNumber( String newNumber, String verificationCode, String pin @@ -138,8 +138,7 @@ void finishChangeNumber( void deleteAccount() throws IOException; void submitRateLimitRecaptchaChallenge( - String challenge, - String captcha + String challenge, String captcha ) throws IOException, CaptchaRejectedException; List getLinkedDevices() throws IOException; diff --git a/lib/src/main/java/org/asamk/signal/manager/RegistrationManager.java b/lib/src/main/java/org/asamk/signal/manager/RegistrationManager.java index 75a91dc97..5660bb13b 100644 --- a/lib/src/main/java/org/asamk/signal/manager/RegistrationManager.java +++ b/lib/src/main/java/org/asamk/signal/manager/RegistrationManager.java @@ -5,7 +5,7 @@ import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException; import org.asamk.signal.manager.api.PinLockedException; 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.IOException; @@ -14,7 +14,7 @@ public interface RegistrationManager extends Closeable { void register( boolean voiceVerification, String captcha, final boolean forceRegister - ) throws IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, RateLimitException, VerificationMethoNotAvailableException; + ) throws IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, RateLimitException, VerificationMethodNotAvailableException; void verifyAccount( String verificationCode, String pin diff --git a/lib/src/main/java/org/asamk/signal/manager/api/VerificationMethoNotAvailableException.java b/lib/src/main/java/org/asamk/signal/manager/api/VerificationMethoNotAvailableException.java deleted file mode 100644 index 172e44e49..000000000 --- a/lib/src/main/java/org/asamk/signal/manager/api/VerificationMethoNotAvailableException.java +++ /dev/null @@ -1,8 +0,0 @@ -package org.asamk.signal.manager.api; - -public class VerificationMethoNotAvailableException extends Exception { - - public VerificationMethoNotAvailableException() { - super("Invalid verification method"); - } -} diff --git a/lib/src/main/java/org/asamk/signal/manager/api/VerificationMethodNotAvailableException.java b/lib/src/main/java/org/asamk/signal/manager/api/VerificationMethodNotAvailableException.java new file mode 100644 index 000000000..9ffdb68f6 --- /dev/null +++ b/lib/src/main/java/org/asamk/signal/manager/api/VerificationMethodNotAvailableException.java @@ -0,0 +1,8 @@ +package org.asamk.signal.manager.api; + +public class VerificationMethodNotAvailableException extends Exception { + + public VerificationMethodNotAvailableException() { + super("Invalid verification method"); + } +} diff --git a/lib/src/main/java/org/asamk/signal/manager/helper/AccountHelper.java b/lib/src/main/java/org/asamk/signal/manager/helper/AccountHelper.java index 0e21d8b50..299ce4d3a 100644 --- a/lib/src/main/java/org/asamk/signal/manager/helper/AccountHelper.java +++ b/lib/src/main/java/org/asamk/signal/manager/helper/AccountHelper.java @@ -7,7 +7,7 @@ import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException; import org.asamk.signal.manager.api.PinLockedException; 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.jobs.SyncStorageJob; import org.asamk.signal.manager.storage.SignalAccount; @@ -165,7 +165,7 @@ public void setPni( public void startChangeNumber( 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()); String sessionId = NumberVerificationUtils.handleVerificationSession(accountManager, account.getSessionId(newNumber), diff --git a/lib/src/main/java/org/asamk/signal/manager/internal/ManagerImpl.java b/lib/src/main/java/org/asamk/signal/manager/internal/ManagerImpl.java index 35ad4d3ca..47a5bc031 100644 --- a/lib/src/main/java/org/asamk/signal/manager/internal/ManagerImpl.java +++ b/lib/src/main/java/org/asamk/signal/manager/internal/ManagerImpl.java @@ -65,7 +65,7 @@ import org.asamk.signal.manager.api.UpdateProfile; import org.asamk.signal.manager.api.UserStatus; 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.helper.AccountFileUpdater; import org.asamk.signal.manager.helper.Context; @@ -380,7 +380,7 @@ public void deleteUsername() throws IOException { @Override public void startChangeNumber( String newNumber, boolean voiceVerification, String captcha - ) throws RateLimitException, IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, NotPrimaryDeviceException, VerificationMethoNotAvailableException { + ) throws RateLimitException, IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, NotPrimaryDeviceException, VerificationMethodNotAvailableException { if (!account.isPrimaryDevice()) { throw new NotPrimaryDeviceException(); } diff --git a/lib/src/main/java/org/asamk/signal/manager/internal/RegistrationManagerImpl.java b/lib/src/main/java/org/asamk/signal/manager/internal/RegistrationManagerImpl.java index b0725cbd2..597b15c06 100644 --- a/lib/src/main/java/org/asamk/signal/manager/internal/RegistrationManagerImpl.java +++ b/lib/src/main/java/org/asamk/signal/manager/internal/RegistrationManagerImpl.java @@ -24,7 +24,7 @@ import org.asamk.signal.manager.api.PinLockedException; import org.asamk.signal.manager.api.RateLimitException; 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.ServiceEnvironmentConfig; import org.asamk.signal.manager.helper.AccountFileUpdater; @@ -105,7 +105,7 @@ public RegistrationManagerImpl( @Override public void register( boolean voiceVerification, String captcha, final boolean forceRegister - ) throws IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, RateLimitException, VerificationMethoNotAvailableException { + ) throws IOException, CaptchaRequiredException, NonNormalizedPhoneNumberException, RateLimitException, VerificationMethodNotAvailableException { if (account.isRegistered() && account.getServiceEnvironment() != null && account.getServiceEnvironment() != serviceEnvironmentConfig.type()) { diff --git a/lib/src/main/java/org/asamk/signal/manager/util/NumberVerificationUtils.java b/lib/src/main/java/org/asamk/signal/manager/util/NumberVerificationUtils.java index 9eb01cdbd..f96e79d37 100644 --- a/lib/src/main/java/org/asamk/signal/manager/util/NumberVerificationUtils.java +++ b/lib/src/main/java/org/asamk/signal/manager/util/NumberVerificationUtils.java @@ -6,7 +6,7 @@ import org.asamk.signal.manager.api.Pair; import org.asamk.signal.manager.api.PinLockedException; 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.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -35,7 +35,7 @@ public static String handleVerificationSession( Consumer sessionIdSaver, boolean voiceVerification, String captcha - ) throws CaptchaRequiredException, IOException, RateLimitException, VerificationMethoNotAvailableException { + ) throws CaptchaRequiredException, IOException, RateLimitException, VerificationMethodNotAvailableException { RegistrationSessionMetadataResponse sessionResponse; try { sessionResponse = getValidSession(accountManager, sessionId); @@ -63,7 +63,7 @@ public static String handleVerificationSession( ? sessionResponse.getBody().getNextCall() : sessionResponse.getBody().getNextSms(); if (nextAttempt == null) { - throw new VerificationMethoNotAvailableException(); + throw new VerificationMethodNotAvailableException(); } else if (nextAttempt > 0) { final var timestamp = sessionResponse.getHeaders().getTimestamp() + nextAttempt * 1000; throw new RateLimitException(timestamp); diff --git a/src/main/java/org/asamk/signal/commands/RegisterCommand.java b/src/main/java/org/asamk/signal/commands/RegisterCommand.java index 2f03cbb3b..cd361218d 100644 --- a/src/main/java/org/asamk/signal/commands/RegisterCommand.java +++ b/src/main/java/org/asamk/signal/commands/RegisterCommand.java @@ -15,7 +15,7 @@ import org.asamk.signal.manager.api.CaptchaRequiredException; import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException; 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.util.CommandUtil; @@ -84,7 +84,7 @@ private void register( } catch (IOException e) { throw new IOErrorException("Failed to register: %s (%s)".formatted(e.getMessage(), e.getClass().getSimpleName()), e); - } catch (VerificationMethoNotAvailableException e) { + } catch (VerificationMethodNotAvailableException e) { throw new UserErrorException("Failed to register: " + e.getMessage() + ( voiceVerification ? ": Before requesting voice verification you need to request SMS verification and wait a minute." diff --git a/src/main/java/org/asamk/signal/commands/StartChangeNumberCommand.java b/src/main/java/org/asamk/signal/commands/StartChangeNumberCommand.java index 823a0c928..84fcf527e 100644 --- a/src/main/java/org/asamk/signal/commands/StartChangeNumberCommand.java +++ b/src/main/java/org/asamk/signal/commands/StartChangeNumberCommand.java @@ -13,7 +13,7 @@ import org.asamk.signal.manager.api.NonNormalizedPhoneNumberException; import org.asamk.signal.manager.api.NotPrimaryDeviceException; 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.util.CommandUtil; @@ -60,7 +60,7 @@ public void handleCommand( } catch (IOException e) { throw new IOErrorException("Failed to change number: %s (%s)".formatted(e.getMessage(), e.getClass().getSimpleName()), e); - } catch (VerificationMethoNotAvailableException e) { + } catch (VerificationMethodNotAvailableException e) { throw new UserErrorException("Failed to register: " + e.getMessage() + ( voiceVerification ? ": Before requesting voice verification you need to request SMS verification and wait a minute." diff --git a/src/main/java/org/asamk/signal/dbus/DbusSignalControlImpl.java b/src/main/java/org/asamk/signal/dbus/DbusSignalControlImpl.java index ddf25cd18..def343a9f 100644 --- a/src/main/java/org/asamk/signal/dbus/DbusSignalControlImpl.java +++ b/src/main/java/org/asamk/signal/dbus/DbusSignalControlImpl.java @@ -13,7 +13,7 @@ import org.asamk.signal.manager.api.PinLockedException; import org.asamk.signal.manager.api.RateLimitException; 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.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -74,7 +74,7 @@ public void registerWithCaptcha( throw new Error.InvalidNumber(e.getMessage()); } catch (OverlappingFileLockException e) { 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()); } }