diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DeviceController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DeviceController.java index ec546723b..0d4f69036 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DeviceController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DeviceController.java @@ -203,7 +203,7 @@ public class DeviceController { device.setCreated(System.currentTimeMillis()); device.setCapabilities(accountAttributes.getCapabilities()); - accounts.update(account.get(), a -> { + final Account updatedAccount = accounts.update(account.get(), a -> { device.setId(a.getNextDeviceId()); messages.clear(a.getUuid(), device.getId()); a.addDevice(device); @@ -211,7 +211,7 @@ public class DeviceController { pendingDevices.remove(number); - return new DeviceResponse(device.getId()); + return new DeviceResponse(updatedAccount.getUuid(), updatedAccount.getPhoneNumberIdentifier(), device.getId()); } @Timed diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/entities/DeviceResponse.java b/service/src/main/java/org/whispersystems/textsecuregcm/entities/DeviceResponse.java index 908e5e9c4..4539ae2a0 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/entities/DeviceResponse.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/entities/DeviceResponse.java @@ -8,7 +8,14 @@ package org.whispersystems.textsecuregcm.entities; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.annotations.VisibleForTesting; +import java.util.UUID; + public class DeviceResponse { + @JsonProperty + private UUID uuid; + + @JsonProperty + private UUID pni; @JsonProperty private long deviceId; @@ -16,10 +23,20 @@ public class DeviceResponse { @VisibleForTesting public DeviceResponse() {} - public DeviceResponse(long deviceId) { + public DeviceResponse(UUID uuid, UUID pni, long deviceId) { + this.uuid = uuid; + this.pni = pni; this.deviceId = deviceId; } + public UUID getUuid() { + return uuid; + } + + public UUID getPni() { + return pni; + } + public long getDeviceId() { return deviceId; }