Only allow setting PIN by master device

This commit is contained in:
AsamK committed 2021-01-18 20:29:01 +01:00
1 parent f4ed9a01b7
commit 80e15ad54e
2 files changed
+7

No files matched your search

@@ -415,6 +415,9 @@ public class Manager implements Closeable {
}
public void setRegistrationLockPin(Optional<String> 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()
@@ -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;
}