diff --git a/src/main/java/org/asamk/signal/manager/Manager.java b/src/main/java/org/asamk/signal/manager/Manager.java index 3642d6db..b8a0f57b 100644 --- a/src/main/java/org/asamk/signal/manager/Manager.java +++ b/src/main/java/org/asamk/signal/manager/Manager.java @@ -415,6 +415,9 @@ public class Manager implements Closeable { } public void setRegistrationLockPin(Optional pin) throws IOException, UnauthenticatedResponseException { + if (!account.isMasterDevice()) { + throw new RuntimeException("Only master device can set a PIN"); + } if (pin.isPresent()) { final MasterKey masterKey = account.getPinMasterKey() != null ? account.getPinMasterKey() diff --git a/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java b/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java index a6e243a8..cb6f7461 100644 --- a/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java +++ b/src/main/java/org/asamk/signal/manager/storage/SignalAccount.java @@ -505,6 +505,10 @@ public class SignalAccount implements Closeable { this.deviceId = deviceId; } + public boolean isMasterDevice() { + return deviceId == SignalServiceAddress.DEFAULT_DEVICE_ID; + } + public String getPassword() { return password; }