Convert Device.id from long to byte

This commit is contained in:
Chris Eager
2023-10-24 18:58:13 -05:00
committed by Chris Eager
parent 7299067829
commit 6a428b4da9
112 changed files with 1292 additions and 1094 deletions

View File

@@ -10,7 +10,7 @@ import java.util.Base64;
public class ProvisioningAddress extends WebsocketAddress {
public ProvisioningAddress(String address, int id) {
public ProvisioningAddress(String address, byte id) {
super(address, id);
}
@@ -26,6 +26,6 @@ public class ProvisioningAddress extends WebsocketAddress {
byte[] random = new byte[16];
new SecureRandom().nextBytes(random);
return new ProvisioningAddress(Base64.getUrlEncoder().withoutPadding().encodeToString(random), 0);
return new ProvisioningAddress(Base64.getUrlEncoder().withoutPadding().encodeToString(random), (byte) 0);
}
}

View File

@@ -10,9 +10,9 @@ import org.whispersystems.textsecuregcm.storage.PubSubAddress;
public class WebsocketAddress implements PubSubAddress {
private final String number;
private final long deviceId;
private final byte deviceId;
public WebsocketAddress(String number, long deviceId) {
public WebsocketAddress(String number, byte deviceId) {
this.number = number;
this.deviceId = deviceId;
}
@@ -26,7 +26,7 @@ public class WebsocketAddress implements PubSubAddress {
}
this.number = parts[0];
this.deviceId = Long.parseLong(parts[1]);
this.deviceId = Byte.parseByte(parts[1]);
} catch (NumberFormatException e) {
throw new InvalidWebsocketAddressException(e);
}
@@ -36,7 +36,7 @@ public class WebsocketAddress implements PubSubAddress {
return number;
}
public long getDeviceId() {
public byte getDeviceId() {
return deviceId;
}