Only allow setting PIN by master device

This commit is contained in:
AsamK 2021-01-18 20:29:01 +01:00
parent f4ed9a01b7
commit 80e15ad54e
2 changed files with 7 additions and 0 deletions

View file

@ -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()

View file

@ -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;
}