mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-21 18:28:01 +01:00
Encapsulate device ID in ProvisioningAddress
This commit is contained in:
@@ -47,7 +47,7 @@ public class ProvisioningController {
|
||||
|
||||
rateLimiters.getMessagesLimiter().validate(auth.getAccount().getUuid());
|
||||
|
||||
if (!provisioningManager.sendProvisioningMessage(new ProvisioningAddress(destinationName, (byte) 0),
|
||||
if (!provisioningManager.sendProvisioningMessage(ProvisioningAddress.create(destinationName),
|
||||
Base64.getMimeDecoder().decode(message.body()))) {
|
||||
throw new WebApplicationException(Response.Status.NOT_FOUND);
|
||||
}
|
||||
|
||||
@@ -10,8 +10,14 @@ import java.util.Base64;
|
||||
|
||||
public class ProvisioningAddress extends WebsocketAddress {
|
||||
|
||||
public ProvisioningAddress(String address, byte id) {
|
||||
super(address, id);
|
||||
public static byte DEVICE_ID = 0;
|
||||
|
||||
public static ProvisioningAddress create(String address) {
|
||||
return new ProvisioningAddress(address, DEVICE_ID);
|
||||
}
|
||||
|
||||
private ProvisioningAddress(String address, byte deviceId) {
|
||||
super(address, deviceId);
|
||||
}
|
||||
|
||||
public ProvisioningAddress(String serialized) throws InvalidWebsocketAddressException {
|
||||
@@ -26,6 +32,6 @@ public class ProvisioningAddress extends WebsocketAddress {
|
||||
byte[] random = new byte[16];
|
||||
new SecureRandom().nextBytes(random);
|
||||
|
||||
return new ProvisioningAddress(Base64.getUrlEncoder().withoutPadding().encodeToString(random), (byte) 0);
|
||||
return create(Base64.getUrlEncoder().withoutPadding().encodeToString(random));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user