mirror of
https://github.com/AsamK/signal-cli
synced 2025-08-29 10:30:38 +00:00
Only allow setting PIN by master device
This commit is contained in:
parent
f4ed9a01b7
commit
80e15ad54e
2 changed files with 7 additions and 0 deletions
|
@ -415,6 +415,9 @@ public class Manager implements Closeable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRegistrationLockPin(Optional<String> pin) throws IOException, UnauthenticatedResponseException {
|
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()) {
|
if (pin.isPresent()) {
|
||||||
final MasterKey masterKey = account.getPinMasterKey() != null
|
final MasterKey masterKey = account.getPinMasterKey() != null
|
||||||
? account.getPinMasterKey()
|
? account.getPinMasterKey()
|
||||||
|
|
|
@ -505,6 +505,10 @@ public class SignalAccount implements Closeable {
|
||||||
this.deviceId = deviceId;
|
this.deviceId = deviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isMasterDevice() {
|
||||||
|
return deviceId == SignalServiceAddress.DEFAULT_DEVICE_ID;
|
||||||
|
}
|
||||||
|
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
return password;
|
return password;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue