]> nmode's Git Repositories - signal-cli/blobdiff - lib/src/main/java/org/asamk/signal/manager/helper/PinHelper.java
Handle UnauthenticatedResponseException internally
[signal-cli] / lib / src / main / java / org / asamk / signal / manager / helper / PinHelper.java
index b0f66f15c1c8630db135ce019cce0d265a363b8d..888b86ce603fd221f71c958e3eb684e4d731030f 100644 (file)
@@ -23,18 +23,26 @@ public class PinHelper {
 
     public void setRegistrationLockPin(
             String pin, MasterKey masterKey
-    ) throws IOException, UnauthenticatedResponseException {
+    ) throws IOException {
         final var pinChangeSession = keyBackupService.newPinChangeSession();
         final var hashedPin = PinHashing.hashPin(pin, pinChangeSession);
 
-        pinChangeSession.setPin(hashedPin, masterKey);
+        try {
+            pinChangeSession.setPin(hashedPin, masterKey);
+        } catch (UnauthenticatedResponseException e) {
+            throw new IOException(e);
+        }
         pinChangeSession.enableRegistrationLock(masterKey);
     }
 
-    public void removeRegistrationLockPin() throws IOException, UnauthenticatedResponseException {
+    public void removeRegistrationLockPin() throws IOException {
         final var pinChangeSession = keyBackupService.newPinChangeSession();
         pinChangeSession.disableRegistrationLock();
-        pinChangeSession.removePin();
+        try {
+            pinChangeSession.removePin();
+        } catch (UnauthenticatedResponseException e) {
+            throw new IOException(e);
+        }
     }
 
     public KbsPinData getRegistrationLockData(