diff --git a/integration-tests/src/main/java/org/signal/integration/Operations.java b/integration-tests/src/main/java/org/signal/integration/Operations.java
index 88c037bea4e350a7b5959aadc1963a48a6d96f53..e631bfd40cbe5aeadb196ea9181d185e5b9ecc98 100644
--- a/integration-tests/src/main/java/org/signal/integration/Operations.java
+++ b/integration-tests/src/main/java/org/signal/integration/Operations.java
@@ -88,9 +88,9 @@ public final class Operations {
     user.setPniUuid(registrationResponse.pni());
 
     // upload pre-key
-    final TestUser.PreKeySetPublicView preKeySetPublicView = user.preKeys(Device.MASTER_ID, false);
+    final TestUser.PreKeySetPublicView preKeySetPublicView = user.preKeys(Device.PRIMARY_ID, false);
     apiPut("/v2/keys", preKeySetPublicView)
-        .authorized(user, Device.MASTER_ID)
+        .authorized(user, Device.PRIMARY_ID)
         .executeExpectSuccess();
 
     return user;
@@ -233,7 +233,7 @@ public final class Operations {
     }
 
     public RequestBuilder authorized(final TestUser user) {
-      return authorized(user, Device.MASTER_ID);
+      return authorized(user, Device.PRIMARY_ID);
     }
 
     public RequestBuilder authorized(final TestUser user, final long deviceId) {
diff --git a/integration-tests/src/main/java/org/signal/integration/TestUser.java b/integration-tests/src/main/java/org/signal/integration/TestUser.java
index 8925ba5b5de693e3ecca13a0df577c008faf0495..2b71a79ff7ef4a29f4783518ed066ced1d76ede5 100644
--- a/integration-tests/src/main/java/org/signal/integration/TestUser.java
+++ b/integration-tests/src/main/java/org/signal/integration/TestUser.java
@@ -82,7 +82,7 @@ public class TestUser {
     this.unidentifiedAccessKey = unidentifiedAccessKey;
     this.accountPassword = accountPassword;
     this.registrationPassword = registrationPassword;
-    devices.put(Device.MASTER_ID, TestDevice.create(Device.MASTER_ID, aciIdentityKey, pniIdentityKey));
+    devices.put(Device.PRIMARY_ID, TestDevice.create(Device.PRIMARY_ID, aciIdentityKey, pniIdentityKey));
   }
 
   public int registrationId() {
diff --git a/integration-tests/src/test/java/org/signal/integration/MessagingTest.java b/integration-tests/src/test/java/org/signal/integration/MessagingTest.java
index 634e550666f8c7f6bbfac4974327ca31bed7ec90..cf2af5e14a85dd7bbf0b78e3b496ca947401b2b7 100644
--- a/integration-tests/src/test/java/org/signal/integration/MessagingTest.java
+++ b/integration-tests/src/test/java/org/signal/integration/MessagingTest.java
@@ -38,7 +38,7 @@ public class MessagingTest {
     try {
       final byte[] expectedContent = "Hello, World!".getBytes(StandardCharsets.UTF_8);
       final String contentBase64 = Base64.getEncoder().encodeToString(expectedContent);
-      final IncomingMessage message = new IncomingMessage(1, Device.MASTER_ID, userB.registrationId(), contentBase64);
+      final IncomingMessage message = new IncomingMessage(1, Device.PRIMARY_ID, userB.registrationId(), contentBase64);
       final IncomingMessageList messages = new IncomingMessageList(List.of(message), false, true, System.currentTimeMillis());
 
       final Pair<Integer, SendMessageResponse> sendMessage = Operations
diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/auth/BaseAccountAuthenticator.java b/service/src/main/java/org/whispersystems/textsecuregcm/auth/BaseAccountAuthenticator.java
index be4ee98a579a6cf426af7a17d887350b696a17c8..d1def356d4ddaabe5a56b9fb0bc6b03196f82507 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/auth/BaseAccountAuthenticator.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/auth/BaseAccountAuthenticator.java
@@ -60,7 +60,7 @@ public class BaseAccountAuthenticator {
 
     if (deviceIdSeparatorIndex == -1) {
       identifier = basicUsername;
-      deviceId = Device.MASTER_ID;
+      deviceId = Device.PRIMARY_ID;
     } else {
       identifier = basicUsername.substring(0, deviceIdSeparatorIndex);
       deviceId = Long.parseLong(basicUsername.substring(deviceIdSeparatorIndex + 1));
@@ -113,7 +113,7 @@ public class BaseAccountAuthenticator {
       } else {
         Metrics.counter(ENABLED_NOT_REQUIRED_AUTHENTICATION_COUNTER_NAME,
                 ENABLED_TAG_NAME, String.valueOf(device.get().isEnabled() && account.get().isEnabled()),
-                IS_PRIMARY_DEVICE_TAG, String.valueOf(device.get().isMaster()))
+                IS_PRIMARY_DEVICE_TAG, String.valueOf(device.get().isPrimary()))
             .increment();
       }
 
@@ -162,7 +162,7 @@ public class BaseAccountAuthenticator {
     //   (1) each account will only update last-seen at most once per day
     //   (2) these updates will occur throughout the day rather than all occurring at UTC midnight.
     if (device.getLastSeen() < todayInMillisWithOffset) {
-      Metrics.summary(DAYS_SINCE_LAST_SEEN_DISTRIBUTION_NAME, IS_PRIMARY_DEVICE_TAG, String.valueOf(device.isMaster()))
+      Metrics.summary(DAYS_SINCE_LAST_SEEN_DISTRIBUTION_NAME, IS_PRIMARY_DEVICE_TAG, String.valueOf(device.isPrimary()))
           .record(Duration.ofMillis(todayInMillisWithOffset - device.getLastSeen()).toDays());
 
       return accountsManager.updateDeviceLastSeen(account, device, Util.todayInMillis(clock));
diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/auth/grpc/AuthenticationUtil.java b/service/src/main/java/org/whispersystems/textsecuregcm/auth/grpc/AuthenticationUtil.java
index 424b1ab2e2ab548faf14bb79cc83ee3bf045d900..68c57552a702c2f4a2310d37b5184f6d7d201af5 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/auth/grpc/AuthenticationUtil.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/auth/grpc/AuthenticationUtil.java
@@ -53,7 +53,7 @@ public class AuthenticationUtil {
   public static AuthenticatedDevice requireAuthenticatedPrimaryDevice() {
     final AuthenticatedDevice authenticatedDevice = requireAuthenticatedDevice();
 
-    if (authenticatedDevice.deviceId() != Device.MASTER_ID) {
+    if (authenticatedDevice.deviceId() != Device.PRIMARY_ID) {
       throw Status.PERMISSION_DENIED.asRuntimeException();
     }
 
diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountControllerV2.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountControllerV2.java
index 6051f81ce880a840130755f7cb05a40d32a172c9..350e3950fe3a74a0cb37cc07bdcba913e7a806c4 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountControllerV2.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/AccountControllerV2.java
@@ -94,7 +94,7 @@ public class AccountControllerV2 {
       @NotNull @Valid final ChangeNumberRequest request, @HeaderParam(HttpHeaders.USER_AGENT) final String userAgent)
       throws RateLimitExceededException, InterruptedException {
 
-    if (!authenticatedAccount.getAuthenticatedDevice().isMaster()) {
+    if (!authenticatedAccount.getAuthenticatedDevice().isPrimary()) {
       throw new ForbiddenException();
     }
 
@@ -170,7 +170,7 @@ public class AccountControllerV2 {
   public AccountIdentityResponse distributePhoneNumberIdentityKeys(@Auth final AuthenticatedAccount authenticatedAccount,
       @NotNull @Valid final PhoneNumberIdentityKeyDistributionRequest request) {
 
-    if (!authenticatedAccount.getAuthenticatedDevice().isMaster()) {
+    if (!authenticatedAccount.getAuthenticatedDevice().isPrimary()) {
       throw new ForbiddenException();
     }
 
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 e0c424fe544eb0378d393b7203dd395689c4d1bd..41b44c209f0b76fe11a904b4394c148c3b8bcf0e 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DeviceController.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/DeviceController.java
@@ -137,11 +137,11 @@ public class DeviceController {
   @ChangesDeviceEnabledState
   public void removeDevice(@Auth AuthenticatedAccount auth, @PathParam("device_id") long deviceId) {
     Account account = auth.getAccount();
-    if (auth.getAuthenticatedDevice().getId() != Device.MASTER_ID) {
+    if (auth.getAuthenticatedDevice().getId() != Device.PRIMARY_ID) {
       throw new WebApplicationException(Response.Status.UNAUTHORIZED);
     }
 
-    if (deviceId == Device.MASTER_ID) {
+    if (deviceId == Device.PRIMARY_ID) {
       throw new ForbiddenException();
     }
 
@@ -175,7 +175,7 @@ public class DeviceController {
       throw new DeviceLimitExceededException(account.getDevices().size(), MAX_DEVICES);
     }
 
-    if (auth.getAuthenticatedDevice().getId() != Device.MASTER_ID) {
+    if (auth.getAuthenticatedDevice().getId() != Device.PRIMARY_ID) {
       throw new WebApplicationException(Response.Status.UNAUTHORIZED);
     }
 
diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/KeysController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/KeysController.java
index 11a2f4bb464db067463033409025adf7ada5bbe8..31a407ad3dd7bce1b49533395c3b113e093b2315 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/KeysController.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/KeysController.java
@@ -154,7 +154,7 @@ public class KeysController {
           .and(HAS_IDENTITY_KEY_TAG_NAME, String.valueOf(hasIdentityKey))
           .and(IDENTITY_TYPE_TAG_NAME, usePhoneNumberIdentity ? "pni" : "aci");
 
-      if (!device.isMaster()) {
+      if (!device.isPrimary()) {
         Metrics.counter(IDENTITY_KEY_CHANGE_FORBIDDEN_COUNTER_NAME, tags).increment();
 
         throw new ForbiddenException();
diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/MessageController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/MessageController.java
index 0136b4fbe6c5c23559e9ee1368a093fc9279e9b8..060c9c377281b42ee7947a8dda9c0ae488b0d1e9 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/MessageController.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/MessageController.java
@@ -693,7 +693,7 @@ public class MessageController {
 
       messageSender.sendMessage(destinationAccount, destinationDevice, envelope, online);
     } catch (NotPushRegisteredException e) {
-      if (destinationDevice.isMaster()) throw new NoSuchUserException(e);
+      if (destinationDevice.isPrimary()) throw new NoSuchUserException(e);
       else                              logger.debug("Not registered", e);
     }
   }
@@ -727,7 +727,7 @@ public class MessageController {
 
       messageSender.sendMessage(destinationAccount, destinationDevice, messageBuilder.build(), online);
     } catch (NotPushRegisteredException e) {
-      if (destinationDevice.isMaster()) {
+      if (destinationDevice.isPrimary()) {
         throw new NoSuchUserException(e);
       } else {
         logger.debug("Not registered", e);
diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RegistrationController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RegistrationController.java
index 0ef2eb5e67574bdc216644fa8c8e91b5804adc3b..4ab1a3bce25eb409a40b4f4ed6916d1248a65683 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RegistrationController.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RegistrationController.java
@@ -158,7 +158,7 @@ public class RegistrationController {
         a.setIdentityKey(registrationRequest.aciIdentityKey().get());
         a.setPhoneNumberIdentityKey(registrationRequest.pniIdentityKey().get());
 
-        final Device device = a.getMasterDevice().orElseThrow();
+        final Device device = a.getPrimaryDevice().orElseThrow();
 
         device.setSignedPreKey(registrationRequest.deviceActivationRequest().aciSignedPreKey().get());
         device.setPhoneNumberIdentitySignedPreKey(registrationRequest.deviceActivationRequest().pniSignedPreKey().get());
@@ -173,13 +173,13 @@ public class RegistrationController {
 
         CompletableFuture.allOf(
                 keysManager.storeEcSignedPreKeys(a.getUuid(),
-                    Map.of(Device.MASTER_ID, registrationRequest.deviceActivationRequest().aciSignedPreKey().get())),
+                    Map.of(Device.PRIMARY_ID, registrationRequest.deviceActivationRequest().aciSignedPreKey().get())),
                 keysManager.storePqLastResort(a.getUuid(),
-                    Map.of(Device.MASTER_ID, registrationRequest.deviceActivationRequest().aciPqLastResortPreKey().get())),
+                    Map.of(Device.PRIMARY_ID, registrationRequest.deviceActivationRequest().aciPqLastResortPreKey().get())),
                 keysManager.storeEcSignedPreKeys(a.getPhoneNumberIdentifier(),
-                    Map.of(Device.MASTER_ID, registrationRequest.deviceActivationRequest().pniSignedPreKey().get())),
+                    Map.of(Device.PRIMARY_ID, registrationRequest.deviceActivationRequest().pniSignedPreKey().get())),
                 keysManager.storePqLastResort(a.getPhoneNumberIdentifier(),
-                    Map.of(Device.MASTER_ID, registrationRequest.deviceActivationRequest().pniPqLastResortPreKey().get())))
+                    Map.of(Device.PRIMARY_ID, registrationRequest.deviceActivationRequest().pniPqLastResortPreKey().get())))
             .join();
       });
     }
diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/grpc/DevicesGrpcService.java b/service/src/main/java/org/whispersystems/textsecuregcm/grpc/DevicesGrpcService.java
index aa3d0250cb2229da6b8302d3c7e72dd3aadecb2d..449cf9426040f8eadcc91ef9b57c361aaf42a59b 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/grpc/DevicesGrpcService.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/grpc/DevicesGrpcService.java
@@ -75,7 +75,7 @@ public class DevicesGrpcService extends ReactorDevicesGrpc.DevicesImplBase {
 
   @Override
   public Mono<RemoveDeviceResponse> removeDevice(final RemoveDeviceRequest request) {
-    if (request.getId() == Device.MASTER_ID) {
+    if (request.getId() == Device.PRIMARY_ID) {
       throw Status.INVALID_ARGUMENT.withDescription("Cannot remove primary device").asRuntimeException();
     }
 
@@ -181,7 +181,7 @@ public class DevicesGrpcService extends ReactorDevicesGrpc.DevicesImplBase {
         .map(maybeAccount -> maybeAccount.orElseThrow(Status.UNAUTHENTICATED::asRuntimeException))
         .flatMap(account -> Mono.fromFuture(() -> accountsManager.updateDeviceAsync(account, authenticatedDevice.deviceId(), device -> {
           if (StringUtils.isNotBlank(device.getApnId()) || StringUtils.isNotBlank(device.getVoipApnId())) {
-            device.setUserAgent(device.isMaster() ? "OWI" : "OWP");
+            device.setUserAgent(device.isPrimary() ? "OWI" : "OWP");
           } else if (StringUtils.isNotBlank(device.getGcmId())) {
             device.setUserAgent("OWA");
           }
diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/limits/PushChallengeManager.java b/service/src/main/java/org/whispersystems/textsecuregcm/limits/PushChallengeManager.java
index 4ec20570d6ce5c12b683780d2c522c5aa08cfea1..6443ce180442c644bb71e9eb25d78ffafdfc9409 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/limits/PushChallengeManager.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/limits/PushChallengeManager.java
@@ -45,7 +45,7 @@ public class PushChallengeManager {
   }
 
   public void sendChallenge(final Account account) throws NotPushRegisteredException {
-    final Device masterDevice = account.getMasterDevice().orElseThrow(NotPushRegisteredException::new);
+    final Device primaryDevice = account.getPrimaryDevice().orElseThrow(NotPushRegisteredException::new);
 
     final byte[] token = new byte[CHALLENGE_TOKEN_LENGTH];
     random.nextBytes(token);
@@ -58,9 +58,9 @@ public class PushChallengeManager {
 
       sent = true;
 
-      if (StringUtils.isNotBlank(masterDevice.getGcmId())) {
+      if (StringUtils.isNotBlank(primaryDevice.getGcmId())) {
         platform = ClientPlatform.ANDROID.name().toLowerCase();
-      } else if (StringUtils.isNotBlank(masterDevice.getApnId())) {
+      } else if (StringUtils.isNotBlank(primaryDevice.getApnId())) {
         platform = ClientPlatform.IOS.name().toLowerCase();
       } else {
         // This should never happen; if the account has neither an APN nor FCM token, sending the challenge will result
@@ -86,10 +86,10 @@ public class PushChallengeManager {
     } catch (final IllegalArgumentException ignored) {
     }
 
-    final String platform = account.getMasterDevice().map(masterDevice -> {
-      if (StringUtils.isNotBlank(masterDevice.getGcmId())) {
+    final String platform = account.getPrimaryDevice().map(primaryDevice -> {
+      if (StringUtils.isNotBlank(primaryDevice.getGcmId())) {
         return ClientPlatform.IOS.name().toLowerCase();
-      } else if (StringUtils.isNotBlank(masterDevice.getApnId())) {
+      } else if (StringUtils.isNotBlank(primaryDevice.getApnId())) {
         return ClientPlatform.ANDROID.name().toLowerCase();
       } else {
         return "unknown";
diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/push/PushNotificationManager.java b/service/src/main/java/org/whispersystems/textsecuregcm/push/PushNotificationManager.java
index 8fdb6171ca7fdf55baa0c3eda89f7804b34fa200..8d48e518921b317c454bb80034100e8e5229d249 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/push/PushNotificationManager.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/push/PushNotificationManager.java
@@ -62,7 +62,7 @@ public class PushNotificationManager {
   public void sendRateLimitChallengeNotification(final Account destination, final String challengeToken)
       throws NotPushRegisteredException {
 
-    final Device device = destination.getDevice(Device.MASTER_ID).orElseThrow(NotPushRegisteredException::new);
+    final Device device = destination.getDevice(Device.PRIMARY_ID).orElseThrow(NotPushRegisteredException::new);
     final Pair<String, PushNotification.TokenType> tokenAndType = getToken(device);
 
     sendNotification(new PushNotification(tokenAndType.first(), tokenAndType.second(),
@@ -70,7 +70,7 @@ public class PushNotificationManager {
   }
 
   public void sendAttemptLoginNotification(final Account destination, final String context) throws NotPushRegisteredException {
-    final Device device = destination.getDevice(Device.MASTER_ID).orElseThrow(NotPushRegisteredException::new);
+    final Device device = destination.getDevice(Device.PRIMARY_ID).orElseThrow(NotPushRegisteredException::new);
     final Pair<String, PushNotification.TokenType> tokenAndType = getToken(device);
 
     sendNotification(new PushNotification(tokenAndType.first(), tokenAndType.second(),
diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/storage/Account.java b/service/src/main/java/org/whispersystems/textsecuregcm/storage/Account.java
index 38d8f9ddf782362ae5dcd52774b02e3359d53b3c..0686307b10ba396229c586b3f82d19fce988c1d4 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/storage/Account.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/storage/Account.java
@@ -232,10 +232,10 @@ public class Account {
     return devices;
   }
 
-  public Optional<Device> getMasterDevice() {
+  public Optional<Device> getPrimaryDevice() {
     requireNotStale();
 
-    return getDevice(Device.MASTER_ID);
+    return getDevice(Device.PRIMARY_ID);
   }
 
   public Optional<Device> getDevice(final long deviceId) {
@@ -253,7 +253,7 @@ public class Account {
   public boolean isTransferSupported() {
     requireNotStale();
 
-    return getMasterDevice().map(Device::getCapabilities).map(Device.DeviceCapabilities::transfer).orElse(false);
+    return getPrimaryDevice().map(Device::getCapabilities).map(Device.DeviceCapabilities::transfer).orElse(false);
   }
 
   public boolean isPniSupported() {
@@ -275,13 +275,13 @@ public class Account {
   public boolean isEnabled() {
     requireNotStale();
 
-    return getMasterDevice().map(Device::isEnabled).orElse(false);
+    return getPrimaryDevice().map(Device::isEnabled).orElse(false);
   }
 
   public long getNextDeviceId() {
     requireNotStale();
 
-    long candidateId = Device.MASTER_ID + 1;
+    long candidateId = Device.PRIMARY_ID + 1;
 
     while (getDevice(candidateId).isPresent()) {
       candidateId++;
diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountsManager.java b/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountsManager.java
index 1536c74b8c4f6ad1ced267b64f428cae288f3e67..427dfbc5632244c4f919ffe03975ee0d36426bbd 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountsManager.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/storage/AccountsManager.java
@@ -186,7 +186,7 @@ public class AccountsManager {
 
       accountLockManager.withLock(List.of(number), () -> {
         Device device = new Device();
-        device.setId(Device.MASTER_ID);
+        device.setId(Device.PRIMARY_ID);
         device.setAuthTokenHash(SaltedTokenHash.generateFor(password));
         device.setFetchesMessages(accountAttributes.getFetchesMessages());
         device.setRegistrationId(accountAttributes.getRegistrationId());
@@ -423,13 +423,13 @@ public class AccountsManager {
       throw new IllegalArgumentException("Signed pre-keys and registration IDs must both be null or both be non-null");
     }
 
-    // Check that all including master ID are in signed pre-keys
+    // Check that all including primary ID are in signed pre-keys
     DestinationDeviceValidator.validateCompleteDeviceList(
         account,
         pniSignedPreKeys.keySet(),
         Collections.emptySet());
 
-    // Check that all including master ID are in Pq pre-keys
+    // Check that all including primary ID are in Pq pre-keys
     if (pniPqLastResortPreKeys != null) {
       DestinationDeviceValidator.validateCompleteDeviceList(
           account,
diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/storage/ChangeNumberManager.java b/service/src/main/java/org/whispersystems/textsecuregcm/storage/ChangeNumberManager.java
index d16ab858a304d749a05fb30ca6543ce0893565f2..d5e8a3549b1a89a3529395d134d0ae3740828b45 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/storage/ChangeNumberManager.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/storage/ChangeNumberManager.java
@@ -100,11 +100,11 @@ public class ChangeNumberManager {
 
   private void validateDeviceMessages(final Account account,
       final List<IncomingMessage> deviceMessages) throws MismatchedDevicesException, StaleDevicesException {
-    // Check that all except master ID are in device messages
+    // Check that all except primary ID are in device messages
     DestinationDeviceValidator.validateCompleteDeviceList(
         account,
         deviceMessages.stream().map(IncomingMessage::destinationDeviceId).collect(Collectors.toSet()),
-        Set.of(Device.MASTER_ID));
+        Set.of(Device.PRIMARY_ID));
 
     // check that all sync messages are to the current registration ID for the matching device
     DestinationDeviceValidator.validateRegistrationIds(
@@ -140,7 +140,7 @@ public class ChangeNumberManager {
           .setDestinationUuid(new AciServiceIdentifier(sourceAndDestinationAccount.getUuid()).toServiceIdentifierString())
           .setContent(ByteString.copyFrom(contents.get()))
           .setSourceUuid(new AciServiceIdentifier(sourceAndDestinationAccount.getUuid()).toServiceIdentifierString())
-          .setSourceDevice((int) Device.MASTER_ID)
+          .setSourceDevice((int) Device.PRIMARY_ID)
           .setUpdatedPni(sourceAndDestinationAccount.getPhoneNumberIdentifier().toString())
           .setUrgent(true)
           .build();
diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/storage/Device.java b/service/src/main/java/org/whispersystems/textsecuregcm/storage/Device.java
index dbad027c95bd34a7706231f1ed6922e8666c0213..06b61a71995045b5a24f1783a17bf5dded13b12a 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/storage/Device.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/storage/Device.java
@@ -19,7 +19,7 @@ import org.whispersystems.textsecuregcm.util.Util;
 
 public class Device {
 
-  public static final long MASTER_ID = 1;
+  public static final long PRIMARY_ID = 1;
   public static final int MAXIMUM_DEVICE_ID = 256;
   public static final int MAX_REGISTRATION_ID = 0x3FFF;
   public static final List<Long> ALL_POSSIBLE_DEVICE_IDS = LongStream.range(1, MAXIMUM_DEVICE_ID).boxed().collect(Collectors.toList());
@@ -199,8 +199,8 @@ public class Device {
   public boolean isEnabled() {
     boolean hasChannel = fetchesMessages || !Util.isEmpty(getApnId()) || !Util.isEmpty(getGcmId());
 
-    return (id == MASTER_ID && hasChannel && signedPreKey != null) ||
-           (id != MASTER_ID && hasChannel && signedPreKey != null && lastSeen > (System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30)));
+    return (id == PRIMARY_ID && hasChannel && signedPreKey != null) ||
+           (id != PRIMARY_ID && hasChannel && signedPreKey != null && lastSeen > (System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30)));
   }
 
   public boolean getFetchesMessages() {
@@ -211,8 +211,8 @@ public class Device {
     this.fetchesMessages = fetchesMessages;
   }
 
-  public boolean isMaster() {
-    return getId() == MASTER_ID;
+  public boolean isPrimary() {
+    return getId() == PRIMARY_ID;
   }
 
   public int getRegistrationId() {
diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/websocket/WebSocketConnection.java b/service/src/main/java/org/whispersystems/textsecuregcm/websocket/WebSocketConnection.java
index e81a1446afdbd78f0c44931fbbf34844a5b87d93..57da2415d88d0e725c8f4fa6a00e6bcdea902ee8 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/websocket/WebSocketConnection.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/websocket/WebSocketConnection.java
@@ -256,7 +256,7 @@ public class WebSocketConnection implements MessageAvailabilityListener, Displac
   public static void recordMessageDeliveryDuration(long timestamp, Device messageDestinationDevice) {
     final long messageDeliveryDuration = System.currentTimeMillis() - timestamp;
     messageTime.update(messageDeliveryDuration);
-    if (messageDestinationDevice.isMaster()) {
+    if (messageDestinationDevice.isPrimary()) {
       primaryDeviceMessageTime.update(messageDeliveryDuration);
     }
   }
diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/workers/UnlinkDeviceCommand.java b/service/src/main/java/org/whispersystems/textsecuregcm/workers/UnlinkDeviceCommand.java
index 045465cb1587849c66102c64b327b64298d812ef..8140017640aa8105d177a87adf32d311ce6ffc1a 100644
--- a/service/src/main/java/org/whispersystems/textsecuregcm/workers/UnlinkDeviceCommand.java
+++ b/service/src/main/java/org/whispersystems/textsecuregcm/workers/UnlinkDeviceCommand.java
@@ -64,7 +64,7 @@ public class UnlinkDeviceCommand extends EnvironmentCommand<WhisperServerConfigu
       Account account = deps.accountsManager().getByAccountIdentifier(aci)
           .orElseThrow(() -> new IllegalArgumentException("account id " + aci + " does not exist"));
 
-      if (deviceIds.contains(Device.MASTER_ID)) {
+      if (deviceIds.contains(Device.PRIMARY_ID)) {
         throw new IllegalArgumentException("cannot delete primary device");
       }
 
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/auth/AuthEnablementRefreshRequirementProviderTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/auth/AuthEnablementRefreshRequirementProviderTest.java
index 617eea77ef1f41f3c06f4597131c4bcf7f1870e5..3c8be9118dbb60dbeefcdc85548352dea6c525fd 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/auth/AuthEnablementRefreshRequirementProviderTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/auth/AuthEnablementRefreshRequirementProviderTest.java
@@ -171,7 +171,7 @@ class AuthEnablementRefreshRequirementProviderTest {
   void testDeviceEnabledChanged(final Map<Long, Boolean> initialEnabled, final Map<Long, Boolean> finalEnabled) {
     assert initialEnabled.size() == finalEnabled.size();
 
-    assert account.getMasterDevice().orElseThrow().isEnabled();
+    assert account.getPrimaryDevice().orElseThrow().isEnabled();
 
     initialEnabled.forEach((deviceId, enabled) ->
         DevicesHelper.setEnabled(account.getDevice(deviceId).orElseThrow(), enabled));
@@ -211,7 +211,7 @@ class AuthEnablementRefreshRequirementProviderTest {
 
   @Test
   void testDeviceAdded() {
-    assert account.getMasterDevice().orElseThrow().isEnabled();
+    assert account.getPrimaryDevice().orElseThrow().isEnabled();
 
     final int initialDeviceCount = account.getDevices().size();
 
@@ -235,7 +235,7 @@ class AuthEnablementRefreshRequirementProviderTest {
   @ParameterizedTest
   @ValueSource(ints = {1, 2})
   void testDeviceRemoved(final int removedDeviceCount) {
-    assert account.getMasterDevice().orElseThrow().isEnabled();
+    assert account.getPrimaryDevice().orElseThrow().isEnabled();
 
     final List<Long> initialDeviceIds = account.getDevices().stream().map(Device::getId).collect(Collectors.toList());
 
@@ -266,8 +266,8 @@ class AuthEnablementRefreshRequirementProviderTest {
   }
 
   @Test
-  void testMasterDeviceDisabledAndDeviceRemoved() {
-    assert account.getMasterDevice().orElseThrow().isEnabled();
+  void testPrimaryDeviceDisabledAndDeviceRemoved() {
+    assert account.getPrimaryDevice().orElseThrow().isEnabled();
 
     final Set<Long> initialDeviceIds = account.getDevices().stream().map(Device::getId).collect(Collectors.toSet());
 
@@ -275,7 +275,7 @@ class AuthEnablementRefreshRequirementProviderTest {
     assertTrue(initialDeviceIds.remove(deletedDeviceId));
 
     final Response response = resources.getJerseyTest()
-        .target("/v1/test/account/disableMasterDeviceAndDeleteDevice/" + deletedDeviceId)
+        .target("/v1/test/account/disablePrimaryDeviceAndDeleteDevice/" + deletedDeviceId)
         .request()
         .header("Authorization",
             "Basic " + Base64.getEncoder().encodeToString("user:pass".getBytes(StandardCharsets.UTF_8)))
@@ -415,7 +415,7 @@ class AuthEnablementRefreshRequirementProviderTest {
     @ChangesDeviceEnabledState
     public String setAccountEnabled(@Auth TestPrincipal principal, @PathParam("enabled") final boolean enabled) {
 
-      final Device device = principal.getAccount().getMasterDevice().orElseThrow();
+      final Device device = principal.getAccount().getPrimaryDevice().orElseThrow();
 
       DevicesHelper.setEnabled(device, enabled);
 
@@ -469,11 +469,11 @@ class AuthEnablementRefreshRequirementProviderTest {
     }
 
     @POST
-    @Path("/account/disableMasterDeviceAndDeleteDevice/{deviceId}")
+    @Path("/account/disablePrimaryDeviceAndDeleteDevice/{deviceId}")
     @ChangesDeviceEnabledState
-    public String disableMasterDeviceAndRemoveDevice(@Auth TestPrincipal auth, @PathParam("deviceId") long deviceId) {
+    public String disablePrimaryDeviceAndRemoveDevice(@Auth TestPrincipal auth, @PathParam("deviceId") long deviceId) {
 
-      DevicesHelper.setEnabled(auth.getAccount().getMasterDevice().orElseThrow(), false);
+      DevicesHelper.setEnabled(auth.getAccount().getPrimaryDevice().orElseThrow(), false);
 
       auth.getAccount().removeDevice(deviceId);
 
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/auth/BaseAccountAuthenticatorTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/auth/BaseAccountAuthenticatorTest.java
index fb9a2e8c212e08df399570748132d4c93b2d2009..4312965731ab489bbe737c24632e718c84a10efe 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/auth/BaseAccountAuthenticatorTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/auth/BaseAccountAuthenticatorTest.java
@@ -68,7 +68,7 @@ class BaseAccountAuthenticatorTest {
 
   private static Device generateTestDevice(final long lastSeen) {
     final Device device = new Device();
-    device.setId(Device.MASTER_ID);
+    device.setId(Device.PRIMARY_ID);
     device.setLastSeen(lastSeen);
 
     return device;
@@ -374,8 +374,8 @@ class BaseAccountAuthenticatorTest {
 
   private static Stream<Arguments> testGetIdentifierAndDeviceId() {
     return Stream.of(
-        Arguments.of("", "", Device.MASTER_ID),
-        Arguments.of("test", "test", Device.MASTER_ID),
+        Arguments.of("", "", Device.PRIMARY_ID),
+        Arguments.of("test", "test", Device.PRIMARY_ID),
         Arguments.of("test.7", "test", 7));
   }
 
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/auth/BasicAuthorizationHeaderTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/auth/BasicAuthorizationHeaderTest.java
index ddee2832004cdf9d79cb37c9acdc1b8a04b731a0..241e0d19a5afb3c2bb4d40fbfabe3fa84e32f3cc 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/auth/BasicAuthorizationHeaderTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/auth/BasicAuthorizationHeaderTest.java
@@ -26,7 +26,7 @@ class BasicAuthorizationHeaderTest {
 
       assertEquals("aladdin", header.getUsername());
       assertEquals("opensesame", header.getPassword());
-      assertEquals(Device.MASTER_ID, header.getDeviceId());
+      assertEquals(Device.PRIMARY_ID, header.getDeviceId());
     }
 
     {
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/auth/PhoneNumberChangeRefreshRequirementProviderTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/auth/PhoneNumberChangeRefreshRequirementProviderTest.java
index 5e04da7004ed84a648315758ff71b5572f7b07fb..2341c5ee673f28235db23faf8d989d103197f900 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/auth/PhoneNumberChangeRefreshRequirementProviderTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/auth/PhoneNumberChangeRefreshRequirementProviderTest.java
@@ -49,7 +49,7 @@ class PhoneNumberChangeRefreshRequirementProviderTest {
     when(account.getUuid()).thenReturn(ACCOUNT_UUID);
     when(account.getNumber()).thenReturn(NUMBER);
     when(account.getDevices()).thenReturn(List.of(device));
-    when(device.getId()).thenReturn(Device.MASTER_ID);
+    when(device.getId()).thenReturn(Device.PRIMARY_ID);
 
     request = mock(ContainerRequest.class);
 
@@ -81,7 +81,7 @@ class PhoneNumberChangeRefreshRequirementProviderTest {
 
     provider.handleRequestFiltered(requestEvent);
     when(account.getNumber()).thenReturn(CHANGED_NUMBER);
-    assertEquals(List.of(new Pair<>(ACCOUNT_UUID, Device.MASTER_ID)), provider.handleRequestFinished(requestEvent));
+    assertEquals(List.of(new Pair<>(ACCOUNT_UUID, Device.PRIMARY_ID)), provider.handleRequestFinished(requestEvent));
   }
 
   @Test
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/auth/RegistrationLockVerificationManagerTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/auth/RegistrationLockVerificationManagerTest.java
index 44e3b66e25257966aa41e48485c6e55b5c26b0a4..ed67c07e1ed1527eb36bffbe2f449d45208b9675 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/auth/RegistrationLockVerificationManagerTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/auth/RegistrationLockVerificationManagerTest.java
@@ -69,7 +69,7 @@ class RegistrationLockVerificationManagerTest {
         .thenReturn(mock(ExternalServiceCredentials.class));
 
     final Device device = mock(Device.class);
-    when(device.getId()).thenReturn(Device.MASTER_ID);
+    when(device.getId()).thenReturn(Device.PRIMARY_ID);
 
     AccountsHelper.setupMockUpdate(accountsManager);
 
@@ -104,7 +104,7 @@ class RegistrationLockVerificationManagerTest {
             } else {
               verify(registrationRecoveryPasswordsManager, never()).removeForNumber(account.getNumber());
             }
-            verify(clientPresenceManager).disconnectAllPresences(account.getUuid(), List.of(Device.MASTER_ID));
+            verify(clientPresenceManager).disconnectAllPresences(account.getUuid(), List.of(Device.PRIMARY_ID));
             try {
               verify(pushNotificationManager).sendAttemptLoginNotification(any(), eq("failedRegistrationLock"));
             } catch (NotPushRegisteredException npre) {}
@@ -127,7 +127,7 @@ class RegistrationLockVerificationManagerTest {
             verify(pushNotificationManager, never()).sendAttemptLoginNotification(any(), eq("failedRegistrationLock"));
           } catch (NotPushRegisteredException npre) {}
           verify(registrationRecoveryPasswordsManager, never()).removeForNumber(account.getNumber());
-          verify(clientPresenceManager, never()).disconnectAllPresences(account.getUuid(), List.of(Device.MASTER_ID));
+          verify(clientPresenceManager, never()).disconnectAllPresences(account.getUuid(), List.of(Device.PRIMARY_ID));
         });
       }
     };
@@ -165,7 +165,7 @@ class RegistrationLockVerificationManagerTest {
 
     verify(account, never()).lockAuthTokenHash();
     verify(registrationRecoveryPasswordsManager, never()).removeForNumber(account.getNumber());
-    verify(clientPresenceManager, never()).disconnectAllPresences(account.getUuid(), List.of(Device.MASTER_ID));
+    verify(clientPresenceManager, never()).disconnectAllPresences(account.getUuid(), List.of(Device.PRIMARY_ID));
   }
 
   static Stream<Arguments> testSuccess() {
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/auth/grpc/BasicCredentialAuthenticationInterceptorTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/auth/grpc/BasicCredentialAuthenticationInterceptorTest.java
index 16eadcd35f77de319375de8e83b6590dab0fc0a6..c064c158622b7617e6151846408e03796f03c4a8 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/auth/grpc/BasicCredentialAuthenticationInterceptorTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/auth/grpc/BasicCredentialAuthenticationInterceptorTest.java
@@ -85,7 +85,7 @@ class BasicCredentialAuthenticationInterceptorTest {
       when(account.getUuid()).thenReturn(UUID.randomUUID());
 
       final Device device = mock(Device.class);
-      when(device.getId()).thenReturn(Device.MASTER_ID);
+      when(device.getId()).thenReturn(Device.PRIMARY_ID);
 
       when(baseAccountAuthenticator.authenticate(any(), anyBoolean()))
           .thenReturn(Optional.of(new AuthenticatedAccount(() -> new Pair<>(account, device))));
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/controllers/DeviceControllerTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/controllers/DeviceControllerTest.java
index 0d02c6268ac3c97b1be7b295450be54afd5890b5..a4905fa30e1062632fcb3a1221a707443715d2b6 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/controllers/DeviceControllerTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/controllers/DeviceControllerTest.java
@@ -92,7 +92,7 @@ class DeviceControllerTest {
   private static RedisAdvancedClusterCommands<String, String> commands = mock(RedisAdvancedClusterCommands.class);
   private static Account account = mock(Account.class);
   private static Account maxedAccount = mock(Account.class);
-  private static Device masterDevice = mock(Device.class);
+  private static Device primaryDevice = mock(Device.class);
   private static ClientPresenceManager clientPresenceManager = mock(ClientPresenceManager.class);
   private static Map<String, Integer> deviceConfiguration = new HashMap<>();
   private static TestClock testClock = TestClock.now();
@@ -132,7 +132,7 @@ class DeviceControllerTest {
     when(rateLimiters.getAllocateDeviceLimiter()).thenReturn(rateLimiter);
     when(rateLimiters.getVerifyDeviceLimiter()).thenReturn(rateLimiter);
 
-    when(masterDevice.getId()).thenReturn(1L);
+    when(primaryDevice.getId()).thenReturn(1L);
 
     when(account.getNextDeviceId()).thenReturn(42L);
     when(account.getNumber()).thenReturn(AuthHelper.VALID_NUMBER);
@@ -165,7 +165,7 @@ class DeviceControllerTest {
         commands,
         account,
         maxedAccount,
-        masterDevice,
+        primaryDevice,
         clientPresenceManager
     );
 
@@ -175,7 +175,7 @@ class DeviceControllerTest {
   @Test
   void validDeviceRegisterTest() {
     final Device existingDevice = mock(Device.class);
-    when(existingDevice.getId()).thenReturn(Device.MASTER_ID);
+    when(existingDevice.getId()).thenReturn(Device.PRIMARY_ID);
     when(existingDevice.isEnabled()).thenReturn(true);
     when(AuthHelper.VALID_ACCOUNT.getDevices()).thenReturn(List.of(existingDevice));
 
@@ -205,7 +205,7 @@ class DeviceControllerTest {
     when(accountsManager.getByAccountIdentifier(AuthHelper.VALID_UUID)).thenReturn(Optional.of(account));
 
     final Device existingDevice = mock(Device.class);
-    when(existingDevice.getId()).thenReturn(Device.MASTER_ID);
+    when(existingDevice.getId()).thenReturn(Device.PRIMARY_ID);
     when(AuthHelper.VALID_ACCOUNT.getDevices()).thenReturn(List.of(existingDevice));
 
     final String verificationToken = deviceController.generateVerificationToken(AuthHelper.VALID_UUID);
@@ -228,7 +228,7 @@ class DeviceControllerTest {
     when(accountsManager.getByAccountIdentifier(AuthHelper.VALID_UUID)).thenReturn(Optional.of(AuthHelper.VALID_ACCOUNT));
 
     final Device existingDevice = mock(Device.class);
-    when(existingDevice.getId()).thenReturn(Device.MASTER_ID);
+    when(existingDevice.getId()).thenReturn(Device.PRIMARY_ID);
     when(AuthHelper.VALID_ACCOUNT.getDevices()).thenReturn(List.of(existingDevice));
 
     VerificationCode deviceCode = resources.getJerseyTest()
@@ -272,7 +272,7 @@ class DeviceControllerTest {
                         final Optional<String> expectedGcmToken) {
 
     final Device existingDevice = mock(Device.class);
-    when(existingDevice.getId()).thenReturn(Device.MASTER_ID);
+    when(existingDevice.getId()).thenReturn(Device.PRIMARY_ID);
     when(AuthHelper.VALID_ACCOUNT.getDevices()).thenReturn(List.of(existingDevice));
 
     VerificationCode deviceCode = resources.getJerseyTest()
@@ -358,7 +358,7 @@ class DeviceControllerTest {
     when(accountsManager.getByAccountIdentifier(AuthHelper.VALID_UUID)).thenReturn(Optional.of(account));
 
     final Device existingDevice = mock(Device.class);
-    when(existingDevice.getId()).thenReturn(Device.MASTER_ID);
+    when(existingDevice.getId()).thenReturn(Device.PRIMARY_ID);
     when(AuthHelper.VALID_ACCOUNT.getDevices()).thenReturn(List.of(existingDevice));
 
     final Optional<ECSignedPreKey> aciSignedPreKey;
@@ -405,7 +405,7 @@ class DeviceControllerTest {
     when(accountsManager.getByAccountIdentifier(AuthHelper.VALID_UUID)).thenReturn(Optional.of(AuthHelper.VALID_ACCOUNT));
 
     final Device existingDevice = mock(Device.class);
-    when(existingDevice.getId()).thenReturn(Device.MASTER_ID);
+    when(existingDevice.getId()).thenReturn(Device.PRIMARY_ID);
     when(AuthHelper.VALID_ACCOUNT.getDevices()).thenReturn(List.of(existingDevice));
 
     VerificationCode deviceCode = resources.getJerseyTest()
@@ -466,7 +466,7 @@ class DeviceControllerTest {
     when(accountsManager.getByAccountIdentifier(AuthHelper.VALID_UUID)).thenReturn(Optional.of(AuthHelper.VALID_ACCOUNT));
 
     final Device existingDevice = mock(Device.class);
-    when(existingDevice.getId()).thenReturn(Device.MASTER_ID);
+    when(existingDevice.getId()).thenReturn(Device.PRIMARY_ID);
     when(AuthHelper.VALID_ACCOUNT.getDevices()).thenReturn(List.of(existingDevice));
 
     VerificationCode deviceCode = resources.getJerseyTest()
@@ -524,7 +524,7 @@ class DeviceControllerTest {
     when(accountsManager.getByAccountIdentifier(AuthHelper.VALID_UUID)).thenReturn(Optional.of(AuthHelper.VALID_ACCOUNT));
 
     final Device existingDevice = mock(Device.class);
-    when(existingDevice.getId()).thenReturn(Device.MASTER_ID);
+    when(existingDevice.getId()).thenReturn(Device.PRIMARY_ID);
     when(AuthHelper.VALID_ACCOUNT.getDevices()).thenReturn(List.of(existingDevice));
 
     VerificationCode deviceCode = resources.getJerseyTest()
@@ -765,7 +765,7 @@ class DeviceControllerTest {
 
     try (final Response response = resources
         .getJerseyTest()
-        .target("/v1/devices/" + Device.MASTER_ID)
+        .target("/v1/devices/" + Device.PRIMARY_ID)
         .request()
         .header("Authorization", AuthHelper.getAuthHeader(AuthHelper.VALID_UUID, AuthHelper.VALID_PASSWORD))
         .header(HttpHeaders.USER_AGENT, "Signal-Android/5.42.8675309 Android/30")
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/controllers/KeysControllerTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/controllers/KeysControllerTest.java
index d05df2ce5d2de06e008135bb0a7408a8918f1a8c..b36d443c393d130e83644859fe599644dfe81f08 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/controllers/KeysControllerTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/controllers/KeysControllerTest.java
@@ -285,7 +285,7 @@ class KeysControllerTest {
     verify(AuthHelper.VALID_DEVICE).setSignedPreKey(eq(test));
     verify(AuthHelper.VALID_DEVICE, never()).setPhoneNumberIdentitySignedPreKey(any());
     verify(accounts).updateDevice(eq(AuthHelper.VALID_ACCOUNT), anyLong(), any());
-    verify(KEYS).storeEcSignedPreKeys(AuthHelper.VALID_UUID, Map.of(Device.MASTER_ID, test));
+    verify(KEYS).storeEcSignedPreKeys(AuthHelper.VALID_UUID, Map.of(Device.PRIMARY_ID, test));
   }
 
   @Test
@@ -304,7 +304,7 @@ class KeysControllerTest {
     verify(AuthHelper.VALID_DEVICE).setPhoneNumberIdentitySignedPreKey(eq(replacementKey));
     verify(AuthHelper.VALID_DEVICE, never()).setSignedPreKey(any());
     verify(accounts).updateDevice(eq(AuthHelper.VALID_ACCOUNT), anyLong(), any());
-    verify(KEYS).storeEcSignedPreKeys(AuthHelper.VALID_PNI, Map.of(Device.MASTER_ID, replacementKey));
+    verify(KEYS).storeEcSignedPreKeys(AuthHelper.VALID_PNI, Map.of(Device.PRIMARY_ID, replacementKey));
   }
 
   @Test
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/controllers/RegistrationControllerTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/controllers/RegistrationControllerTest.java
index 4fee853d5d0b8fc5b45baa6262daa444a4814de8..97f3e25b7fa4f8f10929b306a86955a4a71d18da 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/controllers/RegistrationControllerTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/controllers/RegistrationControllerTest.java
@@ -684,7 +684,7 @@ class RegistrationControllerTest {
     final Account account = MockUtils.buildMock(Account.class, a -> {
       when(a.getUuid()).thenReturn(accountIdentifier);
       when(a.getPhoneNumberIdentifier()).thenReturn(phoneNumberIdentifier);
-      when(a.getMasterDevice()).thenReturn(Optional.of(device));
+      when(a.getPrimaryDevice()).thenReturn(Optional.of(device));
     });
 
     when(accountsManager.create(any(), any(), any(), any(), any())).thenReturn(account);
@@ -715,10 +715,10 @@ class RegistrationControllerTest {
     verify(device).setSignedPreKey(expectedAciSignedPreKey);
     verify(device).setPhoneNumberIdentitySignedPreKey(expectedPniSignedPreKey);
 
-    verify(keysManager).storeEcSignedPreKeys(accountIdentifier, Map.of(Device.MASTER_ID, expectedAciSignedPreKey));
-    verify(keysManager).storeEcSignedPreKeys(phoneNumberIdentifier, Map.of(Device.MASTER_ID, expectedPniSignedPreKey));
-    verify(keysManager).storePqLastResort(accountIdentifier, Map.of(Device.MASTER_ID, expectedAciPqLastResortPreKey));
-    verify(keysManager).storePqLastResort(phoneNumberIdentifier, Map.of(Device.MASTER_ID, expectedPniPqLastResortPreKey));
+    verify(keysManager).storeEcSignedPreKeys(accountIdentifier, Map.of(Device.PRIMARY_ID, expectedAciSignedPreKey));
+    verify(keysManager).storeEcSignedPreKeys(phoneNumberIdentifier, Map.of(Device.PRIMARY_ID, expectedPniSignedPreKey));
+    verify(keysManager).storePqLastResort(accountIdentifier, Map.of(Device.PRIMARY_ID, expectedAciPqLastResortPreKey));
+    verify(keysManager).storePqLastResort(phoneNumberIdentifier, Map.of(Device.PRIMARY_ID, expectedPniPqLastResortPreKey));
 
     expectedApnsToken.ifPresentOrElse(expectedToken -> verify(device).setApnId(expectedToken),
         () -> verify(device, never()).setApnId(any()));
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/entities/OutgoingMessageEntityTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/entities/OutgoingMessageEntityTest.java
index 5c62c7e19f15af56e21f5420701405428f55d5c8..9448870d749e4fb00d5a30cd6d28db8e348196d3 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/entities/OutgoingMessageEntityTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/entities/OutgoingMessageEntityTest.java
@@ -40,7 +40,7 @@ class OutgoingMessageEntityTest {
         MessageProtos.Envelope.Type.CIPHERTEXT_VALUE,
         messageTimestamp,
         sourceIdentifier,
-        sourceIdentifier != null ? (int) Device.MASTER_ID : 0,
+        sourceIdentifier != null ? (int) Device.PRIMARY_ID : 0,
         destinationIdentifier,
         updatedPni,
         messageContent,
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/grpc/DevicesGrpcServiceTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/grpc/DevicesGrpcServiceTest.java
index b5a5e673c2bf5b11ee46d1fb6533521a0d8bbb83..052c4674ce847124ad1534e79089f219d4e3a6f5 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/grpc/DevicesGrpcServiceTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/grpc/DevicesGrpcServiceTest.java
@@ -113,14 +113,14 @@ class DevicesGrpcServiceTest extends SimpleBaseGrpcTest<DevicesGrpcService, Devi
     final Instant linkedDeviceLastSeen = linkedDeviceCreated.plus(Duration.ofHours(7));
 
     final Device primaryDevice = mock(Device.class);
-    when(primaryDevice.getId()).thenReturn(Device.MASTER_ID);
+    when(primaryDevice.getId()).thenReturn(Device.PRIMARY_ID);
     when(primaryDevice.getCreated()).thenReturn(primaryDeviceCreated.toEpochMilli());
     when(primaryDevice.getLastSeen()).thenReturn(primaryDeviceLastSeen.toEpochMilli());
 
     final String linkedDeviceName = "A linked device";
 
     final Device linkedDevice = mock(Device.class);
-    when(linkedDevice.getId()).thenReturn(Device.MASTER_ID + 1);
+    when(linkedDevice.getId()).thenReturn(Device.PRIMARY_ID + 1);
     when(linkedDevice.getCreated()).thenReturn(linkedDeviceCreated.toEpochMilli());
     when(linkedDevice.getLastSeen()).thenReturn(linkedDeviceLastSeen.toEpochMilli());
     when(linkedDevice.getName())
@@ -130,12 +130,12 @@ class DevicesGrpcServiceTest extends SimpleBaseGrpcTest<DevicesGrpcService, Devi
 
     final GetDevicesResponse expectedResponse = GetDevicesResponse.newBuilder()
         .addDevices(GetDevicesResponse.LinkedDevice.newBuilder()
-            .setId(Device.MASTER_ID)
+            .setId(Device.PRIMARY_ID)
             .setCreated(primaryDeviceCreated.toEpochMilli())
             .setLastSeen(primaryDeviceLastSeen.toEpochMilli())
             .build())
         .addDevices(GetDevicesResponse.LinkedDevice.newBuilder()
-            .setId(Device.MASTER_ID + 1)
+            .setId(Device.PRIMARY_ID + 1)
             .setCreated(linkedDeviceCreated.toEpochMilli())
             .setLastSeen(linkedDeviceLastSeen.toEpochMilli())
             .setName(ByteString.copyFrom(linkedDeviceName.getBytes(StandardCharsets.UTF_8)))
@@ -167,14 +167,14 @@ class DevicesGrpcServiceTest extends SimpleBaseGrpcTest<DevicesGrpcService, Devi
 
   @Test
   void removeDeviceNonPrimaryAuthenticated() {
-    mockAuthenticationInterceptor().setAuthenticatedDevice(AUTHENTICATED_ACI, Device.MASTER_ID + 1);
+    mockAuthenticationInterceptor().setAuthenticatedDevice(AUTHENTICATED_ACI, Device.PRIMARY_ID + 1);
     assertStatusException(Status.PERMISSION_DENIED, () -> authenticatedServiceStub().removeDevice(RemoveDeviceRequest.newBuilder()
         .setId(17)
         .build()));
   }
 
   @ParameterizedTest
-  @ValueSource(longs = {Device.MASTER_ID, Device.MASTER_ID + 1})
+  @ValueSource(longs = {Device.PRIMARY_ID, Device.PRIMARY_ID + 1})
   void setDeviceName(final long deviceId) {
     mockAuthenticationInterceptor().setAuthenticatedDevice(AUTHENTICATED_ACI, deviceId);
 
@@ -238,7 +238,7 @@ class DevicesGrpcServiceTest extends SimpleBaseGrpcTest<DevicesGrpcService, Devi
 
     final Stream.Builder<Arguments> streamBuilder = Stream.builder();
 
-    for (final long deviceId : new long[] { Device.MASTER_ID, Device.MASTER_ID + 1 }) {
+    for (final long deviceId : new long[] { Device.PRIMARY_ID, Device.PRIMARY_ID + 1 }) {
       streamBuilder.add(Arguments.of(deviceId,
           SetPushTokenRequest.newBuilder()
               .setApnsTokenRequest(SetPushTokenRequest.ApnsTokenRequest.newBuilder()
@@ -352,7 +352,7 @@ class DevicesGrpcServiceTest extends SimpleBaseGrpcTest<DevicesGrpcService, Devi
 
     final Device device = mock(Device.class);
     when(device.getId()).thenReturn(deviceId);
-    when(device.isMaster()).thenReturn(deviceId == Device.MASTER_ID);
+    when(device.isPrimary()).thenReturn(deviceId == Device.PRIMARY_ID);
     when(device.getApnId()).thenReturn(apnsToken);
     when(device.getVoipApnId()).thenReturn(apnsVoipToken);
     when(device.getGcmId()).thenReturn(fcmToken);
@@ -374,22 +374,22 @@ class DevicesGrpcServiceTest extends SimpleBaseGrpcTest<DevicesGrpcService, Devi
 
   private static Stream<Arguments> clearPushToken() {
     return Stream.of(
-        Arguments.of(Device.MASTER_ID, "apns-token", null, null, "OWI"),
-        Arguments.of(Device.MASTER_ID, "apns-token", "apns-voip-token", null, "OWI"),
-        Arguments.of(Device.MASTER_ID, null, "apns-voip-token", null, "OWI"),
-        Arguments.of(Device.MASTER_ID, null, null, "fcm-token", "OWA"),
-        Arguments.of(Device.MASTER_ID, null, null, null, null),
-        Arguments.of(Device.MASTER_ID + 1, "apns-token", null, null, "OWP"),
-        Arguments.of(Device.MASTER_ID + 1, "apns-token", "apns-voip-token", null, "OWP"),
-        Arguments.of(Device.MASTER_ID + 1, null, "apns-voip-token", null, "OWP"),
-        Arguments.of(Device.MASTER_ID + 1, null, null, "fcm-token", "OWA"),
-        Arguments.of(Device.MASTER_ID + 1, null, null, null, null)
+        Arguments.of(Device.PRIMARY_ID, "apns-token", null, null, "OWI"),
+        Arguments.of(Device.PRIMARY_ID, "apns-token", "apns-voip-token", null, "OWI"),
+        Arguments.of(Device.PRIMARY_ID, null, "apns-voip-token", null, "OWI"),
+        Arguments.of(Device.PRIMARY_ID, null, null, "fcm-token", "OWA"),
+        Arguments.of(Device.PRIMARY_ID, null, null, null, null),
+        Arguments.of(Device.PRIMARY_ID + 1, "apns-token", null, null, "OWP"),
+        Arguments.of(Device.PRIMARY_ID + 1, "apns-token", "apns-voip-token", null, "OWP"),
+        Arguments.of(Device.PRIMARY_ID + 1, null, "apns-voip-token", null, "OWP"),
+        Arguments.of(Device.PRIMARY_ID + 1, null, null, "fcm-token", "OWA"),
+        Arguments.of(Device.PRIMARY_ID + 1, null, null, null, null)
     );
   }
 
   @CartesianTest
   void setCapabilities(
-      @CartesianTest.Values(longs = {Device.MASTER_ID, Device.MASTER_ID + 1}) final long deviceId,
+      @CartesianTest.Values(longs = {Device.PRIMARY_ID, Device.PRIMARY_ID + 1}) final long deviceId,
       @CartesianTest.Values(booleans = {true, false}) final boolean storage,
       @CartesianTest.Values(booleans = {true, false}) final boolean transfer,
       @CartesianTest.Values(booleans = {true, false}) final boolean pni,
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/grpc/KeysAnonymousGrpcServiceTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/grpc/KeysAnonymousGrpcServiceTest.java
index 2c2e3cc1daf3f3a6e23ef31d70605b8431513deb..ab6bf3826df1ffeb0710e482f7cfd7fdb36a3c3d 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/grpc/KeysAnonymousGrpcServiceTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/grpc/KeysAnonymousGrpcServiceTest.java
@@ -83,9 +83,9 @@ class KeysAnonymousGrpcServiceTest extends SimpleBaseGrpcTest<KeysAnonymousGrpcS
     final byte[] unidentifiedAccessKey = new byte[UnidentifiedAccessUtil.UNIDENTIFIED_ACCESS_KEY_LENGTH];
     new SecureRandom().nextBytes(unidentifiedAccessKey);
 
-    when(targetDevice.getId()).thenReturn(Device.MASTER_ID);
+    when(targetDevice.getId()).thenReturn(Device.PRIMARY_ID);
     when(targetDevice.isEnabled()).thenReturn(true);
-    when(targetAccount.getDevice(Device.MASTER_ID)).thenReturn(Optional.of(targetDevice));
+    when(targetAccount.getDevice(Device.PRIMARY_ID)).thenReturn(Optional.of(targetDevice));
 
     when(targetAccount.getUnidentifiedAccessKey()).thenReturn(Optional.of(unidentifiedAccessKey));
     when(targetAccount.getIdentifier(IdentityType.ACI)).thenReturn(identifier);
@@ -97,8 +97,8 @@ class KeysAnonymousGrpcServiceTest extends SimpleBaseGrpcTest<KeysAnonymousGrpcS
     final ECSignedPreKey ecSignedPreKey = KeysHelper.signedECPreKey(2, identityKeyPair);
     final KEMSignedPreKey kemSignedPreKey = KeysHelper.signedKEMPreKey(3, identityKeyPair);
 
-    when(keysManager.takeEC(identifier, Device.MASTER_ID)).thenReturn(CompletableFuture.completedFuture(Optional.of(ecPreKey)));
-    when(keysManager.takePQ(identifier, Device.MASTER_ID)).thenReturn(CompletableFuture.completedFuture(Optional.of(kemSignedPreKey)));
+    when(keysManager.takeEC(identifier, Device.PRIMARY_ID)).thenReturn(CompletableFuture.completedFuture(Optional.of(ecPreKey)));
+    when(keysManager.takePQ(identifier, Device.PRIMARY_ID)).thenReturn(CompletableFuture.completedFuture(Optional.of(kemSignedPreKey)));
     when(targetDevice.getSignedPreKey(IdentityType.ACI)).thenReturn(ecSignedPreKey);
 
     final GetPreKeysResponse response = unauthenticatedServiceStub().getPreKeys(GetPreKeysAnonymousRequest.newBuilder()
@@ -108,13 +108,13 @@ class KeysAnonymousGrpcServiceTest extends SimpleBaseGrpcTest<KeysAnonymousGrpcS
                 .setIdentityType(org.signal.chat.common.IdentityType.IDENTITY_TYPE_ACI)
                 .setUuid(UUIDUtil.toByteString(identifier))
                 .build())
-            .setDeviceId(Device.MASTER_ID)
+            .setDeviceId(Device.PRIMARY_ID)
             .build())
         .build());
 
     final GetPreKeysResponse expectedResponse = GetPreKeysResponse.newBuilder()
         .setIdentityKey(ByteString.copyFrom(identityKey.serialize()))
-        .putPreKeys(Device.MASTER_ID, GetPreKeysResponse.PreKeyBundle.newBuilder()
+        .putPreKeys(Device.PRIMARY_ID, GetPreKeysResponse.PreKeyBundle.newBuilder()
             .setEcOneTimePreKey(EcPreKey.newBuilder()
                 .setKeyId(ecPreKey.keyId())
                 .setPublicKey(ByteString.copyFrom(ecPreKey.serializedPublicKey()))
@@ -158,7 +158,7 @@ class KeysAnonymousGrpcServiceTest extends SimpleBaseGrpcTest<KeysAnonymousGrpcS
                 .setIdentityType(org.signal.chat.common.IdentityType.IDENTITY_TYPE_ACI)
                 .setUuid(UUIDUtil.toByteString(identifier))
                 .build())
-            .setDeviceId(Device.MASTER_ID)
+            .setDeviceId(Device.PRIMARY_ID)
             .build())
         .build()));
   }
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/grpc/SimpleBaseGrpcTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/grpc/SimpleBaseGrpcTest.java
index f9064fae6ffc4a619c5f6844f35f3c7ffb00a9c3..2c9baedc5e8ef5673fad4648b947e2b653fdd478 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/grpc/SimpleBaseGrpcTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/grpc/SimpleBaseGrpcTest.java
@@ -55,7 +55,7 @@ public abstract class SimpleBaseGrpcTest<SERVICE extends BindableService, STUB e
 
   protected static final UUID AUTHENTICATED_ACI = UUID.randomUUID();
 
-  protected static final long AUTHENTICATED_DEVICE_ID = Device.MASTER_ID;
+  protected static final long AUTHENTICATED_DEVICE_ID = Device.PRIMARY_ID;
 
   private AutoCloseable mocksCloseable;
 
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/push/PushNotificationManagerTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/push/PushNotificationManagerTest.java
index e3cdcf9a9264167d012f6b5ed3a1ba648fa087d8..e0e82d1253d63cadcccd75000a56441118bc713e 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/push/PushNotificationManagerTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/push/PushNotificationManagerTest.java
@@ -60,14 +60,14 @@ class PushNotificationManagerTest {
 
     final String deviceToken = "token";
 
-    when(device.getId()).thenReturn(Device.MASTER_ID);
+    when(device.getId()).thenReturn(Device.PRIMARY_ID);
     when(device.getGcmId()).thenReturn(deviceToken);
-    when(account.getDevice(Device.MASTER_ID)).thenReturn(Optional.of(device));
+    when(account.getDevice(Device.PRIMARY_ID)).thenReturn(Optional.of(device));
 
     when(fcmSender.sendNotification(any()))
         .thenReturn(CompletableFuture.completedFuture(new SendPushNotificationResult(true, null, false)));
 
-    pushNotificationManager.sendNewMessageNotification(account, Device.MASTER_ID, urgent);
+    pushNotificationManager.sendNewMessageNotification(account, Device.PRIMARY_ID, urgent);
     verify(fcmSender).sendNotification(new PushNotification(deviceToken, PushNotification.TokenType.FCM, PushNotification.NotificationType.NOTIFICATION, null, account, device, urgent));
   }
 
@@ -91,9 +91,9 @@ class PushNotificationManagerTest {
     final String deviceToken = "token";
     final String challengeToken = "challenge";
 
-    when(device.getId()).thenReturn(Device.MASTER_ID);
+    when(device.getId()).thenReturn(Device.PRIMARY_ID);
     when(device.getApnId()).thenReturn(deviceToken);
-    when(account.getDevice(Device.MASTER_ID)).thenReturn(Optional.of(device));
+    when(account.getDevice(Device.PRIMARY_ID)).thenReturn(Optional.of(device));
 
     when(apnSender.sendNotification(any()))
         .thenReturn(CompletableFuture.completedFuture(new SendPushNotificationResult(true, null, false)));
@@ -110,7 +110,7 @@ class PushNotificationManagerTest {
 
     final String deviceToken = "token";
 
-    when(device.getId()).thenReturn(Device.MASTER_ID);
+    when(device.getId()).thenReturn(Device.PRIMARY_ID);
     if (isApn) {
       when(device.getApnId()).thenReturn(deviceToken);
       when(apnSender.sendNotification(any()))
@@ -122,7 +122,7 @@ class PushNotificationManagerTest {
       when(fcmSender.sendNotification(any()))
           .thenReturn(CompletableFuture.completedFuture(new SendPushNotificationResult(true, null, false)));
     }
-    when(account.getDevice(Device.MASTER_ID)).thenReturn(Optional.of(device));
+    when(account.getDevice(Device.PRIMARY_ID)).thenReturn(Optional.of(device));
 
     pushNotificationManager.sendAttemptLoginNotification(account, "someContext");
 
@@ -142,8 +142,8 @@ class PushNotificationManagerTest {
     final Account account = mock(Account.class);
     final Device device = mock(Device.class);
 
-    when(device.getId()).thenReturn(Device.MASTER_ID);
-    when(account.getDevice(Device.MASTER_ID)).thenReturn(Optional.of(device));
+    when(device.getId()).thenReturn(Device.PRIMARY_ID);
+    when(account.getDevice(Device.PRIMARY_ID)).thenReturn(Optional.of(device));
 
     final PushNotification pushNotification = new PushNotification(
         "token", PushNotification.TokenType.FCM, PushNotification.NotificationType.NOTIFICATION, null, account, device, urgent);
@@ -155,7 +155,7 @@ class PushNotificationManagerTest {
 
     verify(fcmSender).sendNotification(pushNotification);
     verifyNoInteractions(apnSender);
-    verify(accountsManager, never()).updateDevice(eq(account), eq(Device.MASTER_ID), any());
+    verify(accountsManager, never()).updateDevice(eq(account), eq(Device.PRIMARY_ID), any());
     verify(device, never()).setUninstalledFeedbackTimestamp(Util.todayInMillis());
     verifyNoInteractions(apnPushNotificationScheduler);
   }
@@ -166,8 +166,8 @@ class PushNotificationManagerTest {
     final Account account = mock(Account.class);
     final Device device = mock(Device.class);
 
-    when(device.getId()).thenReturn(Device.MASTER_ID);
-    when(account.getDevice(Device.MASTER_ID)).thenReturn(Optional.of(device));
+    when(device.getId()).thenReturn(Device.PRIMARY_ID);
+    when(account.getDevice(Device.PRIMARY_ID)).thenReturn(Optional.of(device));
 
     final PushNotification pushNotification = new PushNotification(
         "token", PushNotification.TokenType.APN, PushNotification.NotificationType.NOTIFICATION, null, account, device, urgent);
@@ -199,8 +199,8 @@ class PushNotificationManagerTest {
     final Account account = mock(Account.class);
     final Device device = mock(Device.class);
 
-    when(device.getId()).thenReturn(Device.MASTER_ID);
-    when(account.getDevice(Device.MASTER_ID)).thenReturn(Optional.of(device));
+    when(device.getId()).thenReturn(Device.PRIMARY_ID);
+    when(account.getDevice(Device.PRIMARY_ID)).thenReturn(Optional.of(device));
 
     final PushNotification pushNotification = new PushNotification(
         "token", PushNotification.TokenType.APN_VOIP, PushNotification.NotificationType.NOTIFICATION, null, account, device, urgent);
@@ -213,7 +213,7 @@ class PushNotificationManagerTest {
     verify(apnSender).sendNotification(pushNotification);
 
     verifyNoInteractions(fcmSender);
-    verify(accountsManager, never()).updateDevice(eq(account), eq(Device.MASTER_ID), any());
+    verify(accountsManager, never()).updateDevice(eq(account), eq(Device.PRIMARY_ID), any());
     verify(device, never()).setUninstalledFeedbackTimestamp(Util.todayInMillis());
     verify(apnPushNotificationScheduler).scheduleRecurringVoipNotification(account, device);
     verify(apnPushNotificationScheduler, never()).scheduleBackgroundNotification(any(), any());
@@ -224,9 +224,9 @@ class PushNotificationManagerTest {
     final Account account = mock(Account.class);
     final Device device = mock(Device.class);
 
-    when(device.getId()).thenReturn(Device.MASTER_ID);
+    when(device.getId()).thenReturn(Device.PRIMARY_ID);
     when(device.getGcmId()).thenReturn("token");
-    when(account.getDevice(Device.MASTER_ID)).thenReturn(Optional.of(device));
+    when(account.getDevice(Device.PRIMARY_ID)).thenReturn(Optional.of(device));
 
     final PushNotification pushNotification = new PushNotification(
         "token", PushNotification.TokenType.FCM, PushNotification.NotificationType.NOTIFICATION, null, account, device, true);
@@ -236,7 +236,7 @@ class PushNotificationManagerTest {
 
     pushNotificationManager.sendNotification(pushNotification);
 
-    verify(accountsManager).updateDevice(eq(account), eq(Device.MASTER_ID), any());
+    verify(accountsManager).updateDevice(eq(account), eq(Device.PRIMARY_ID), any());
     verify(device).setUninstalledFeedbackTimestamp(Util.todayInMillis());
     verifyNoInteractions(apnSender);
     verifyNoInteractions(apnPushNotificationScheduler);
@@ -247,8 +247,8 @@ class PushNotificationManagerTest {
     final Account account = mock(Account.class);
     final Device device = mock(Device.class);
 
-    when(device.getId()).thenReturn(Device.MASTER_ID);
-    when(account.getDevice(Device.MASTER_ID)).thenReturn(Optional.of(device));
+    when(device.getId()).thenReturn(Device.PRIMARY_ID);
+    when(account.getDevice(Device.PRIMARY_ID)).thenReturn(Optional.of(device));
 
     final PushNotification pushNotification = new PushNotification(
         "token", PushNotification.TokenType.APN_VOIP, PushNotification.NotificationType.NOTIFICATION, null, account, device, true);
@@ -262,7 +262,7 @@ class PushNotificationManagerTest {
     pushNotificationManager.sendNotification(pushNotification);
 
     verifyNoInteractions(fcmSender);
-    verify(accountsManager, never()).updateDevice(eq(account), eq(Device.MASTER_ID), any());
+    verify(accountsManager, never()).updateDevice(eq(account), eq(Device.PRIMARY_ID), any());
     verify(device, never()).setUninstalledFeedbackTimestamp(Util.todayInMillis());
     verify(apnPushNotificationScheduler).cancelScheduledNotifications(account, device);
   }
@@ -275,14 +275,14 @@ class PushNotificationManagerTest {
     final String userAgent = HttpHeaders.USER_AGENT;
 
     when(account.getUuid()).thenReturn(accountIdentifier);
-    when(device.getId()).thenReturn(Device.MASTER_ID);
+    when(device.getId()).thenReturn(Device.PRIMARY_ID);
 
     when(apnPushNotificationScheduler.cancelScheduledNotifications(account, device))
         .thenReturn(CompletableFuture.completedFuture(null));
 
     pushNotificationManager.handleMessagesRetrieved(account, device, userAgent);
 
-    verify(pushLatencyManager).recordQueueRead(accountIdentifier, Device.MASTER_ID, userAgent);
+    verify(pushLatencyManager).recordQueueRead(accountIdentifier, Device.PRIMARY_ID, userAgent);
     verify(apnPushNotificationScheduler).cancelScheduledNotifications(account, device);
   }
 }
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/redis/RedisClusterExtension.java b/service/src/test/java/org/whispersystems/textsecuregcm/redis/RedisClusterExtension.java
index 4d1ca048d903068a1cdb110730b9175ed1c84aa3..453aea38f507f8332a2db730128cc537404bfca0 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/redis/RedisClusterExtension.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/redis/RedisClusterExtension.java
@@ -171,7 +171,7 @@ public class RedisClusterExtension implements BeforeAllCallback, BeforeEachCallb
         final StatefulRedisConnection<String, String> connection = waitClient.connect()) {
       // CLUSTER INFO gives us a big blob of key-value pairs, but the one we're interested in is `cluster_state`.
       // According to https://redis.io/commands/cluster-info, `cluster_state:ok` means that the node is ready to
-      // receive queries, all slots are assigned, and a majority of master nodes are reachable.
+      // receive queries, all slots are assigned, and a majority of leader nodes are reachable.
 
       final int sleepMillis = 500;
       int tries = 0;
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountTest.java
index 0ff085f436c25e17de1a2d764981ab7ddbac942d..e7bef84ab44f5eb3b4c7e5c72e3f21ea27ea631a 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountTest.java
@@ -35,8 +35,8 @@ import org.whispersystems.textsecuregcm.util.TestClock;
 
 class AccountTest {
 
-  private final Device oldMasterDevice = mock(Device.class);
-  private final Device recentMasterDevice = mock(Device.class);
+  private final Device oldPrimaryDevice = mock(Device.class);
+  private final Device recentPrimaryDevice = mock(Device.class);
   private final Device agingSecondaryDevice = mock(Device.class);
   private final Device recentSecondaryDevice = mock(Device.class);
   private final Device oldSecondaryDevice = mock(Device.class);
@@ -71,13 +71,13 @@ class AccountTest {
 
   @BeforeEach
   void setup() {
-    when(oldMasterDevice.getLastSeen()).thenReturn(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(366));
-    when(oldMasterDevice.isEnabled()).thenReturn(true);
-    when(oldMasterDevice.getId()).thenReturn(Device.MASTER_ID);
+    when(oldPrimaryDevice.getLastSeen()).thenReturn(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(366));
+    when(oldPrimaryDevice.isEnabled()).thenReturn(true);
+    when(oldPrimaryDevice.getId()).thenReturn(Device.PRIMARY_ID);
 
-    when(recentMasterDevice.getLastSeen()).thenReturn(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(1));
-    when(recentMasterDevice.isEnabled()).thenReturn(true);
-    when(recentMasterDevice.getId()).thenReturn(Device.MASTER_ID);
+    when(recentPrimaryDevice.getLastSeen()).thenReturn(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(1));
+    when(recentPrimaryDevice.isEnabled()).thenReturn(true);
+    when(recentPrimaryDevice.getId()).thenReturn(Device.PRIMARY_ID);
 
     when(agingSecondaryDevice.getLastSeen()).thenReturn(System.currentTimeMillis() - TimeUnit.DAYS.toMillis(31));
     when(agingSecondaryDevice.isEnabled()).thenReturn(false);
@@ -178,69 +178,69 @@ class AccountTest {
 
   @Test
   void testIsEnabled() {
-    final Device enabledMasterDevice = mock(Device.class);
+    final Device enabledPrimaryDevice = mock(Device.class);
     final Device enabledLinkedDevice = mock(Device.class);
-    final Device disabledMasterDevice = mock(Device.class);
+    final Device disabledPrimaryDevice = mock(Device.class);
     final Device disabledLinkedDevice = mock(Device.class);
 
-    when(enabledMasterDevice.isEnabled()).thenReturn(true);
+    when(enabledPrimaryDevice.isEnabled()).thenReturn(true);
     when(enabledLinkedDevice.isEnabled()).thenReturn(true);
-    when(disabledMasterDevice.isEnabled()).thenReturn(false);
+    when(disabledPrimaryDevice.isEnabled()).thenReturn(false);
     when(disabledLinkedDevice.isEnabled()).thenReturn(false);
 
-    when(enabledMasterDevice.getId()).thenReturn(1L);
+    when(enabledPrimaryDevice.getId()).thenReturn(1L);
     when(enabledLinkedDevice.getId()).thenReturn(2L);
-    when(disabledMasterDevice.getId()).thenReturn(1L);
+    when(disabledPrimaryDevice.getId()).thenReturn(1L);
     when(disabledLinkedDevice.getId()).thenReturn(2L);
 
-    assertTrue(AccountsHelper.generateTestAccount("+14151234567", List.of(enabledMasterDevice)).isEnabled());
-    assertTrue(AccountsHelper.generateTestAccount("+14151234567", List.of(enabledMasterDevice, enabledLinkedDevice)).isEnabled());
-    assertTrue(AccountsHelper.generateTestAccount("+14151234567", List.of(enabledMasterDevice, disabledLinkedDevice)).isEnabled());
-    assertFalse(AccountsHelper.generateTestAccount("+14151234567", List.of(disabledMasterDevice)).isEnabled());
-    assertFalse(AccountsHelper.generateTestAccount("+14151234567", List.of(disabledMasterDevice, enabledLinkedDevice)).isEnabled());
-    assertFalse(AccountsHelper.generateTestAccount("+14151234567", List.of(disabledMasterDevice, disabledLinkedDevice)).isEnabled());
+    assertTrue(AccountsHelper.generateTestAccount("+14151234567", List.of(enabledPrimaryDevice)).isEnabled());
+    assertTrue(AccountsHelper.generateTestAccount("+14151234567", List.of(enabledPrimaryDevice, enabledLinkedDevice)).isEnabled());
+    assertTrue(AccountsHelper.generateTestAccount("+14151234567", List.of(enabledPrimaryDevice, disabledLinkedDevice)).isEnabled());
+    assertFalse(AccountsHelper.generateTestAccount("+14151234567", List.of(disabledPrimaryDevice)).isEnabled());
+    assertFalse(AccountsHelper.generateTestAccount("+14151234567", List.of(disabledPrimaryDevice, enabledLinkedDevice)).isEnabled());
+    assertFalse(AccountsHelper.generateTestAccount("+14151234567", List.of(disabledPrimaryDevice, disabledLinkedDevice)).isEnabled());
   }
 
   @Test
   void testIsTransferSupported() {
-    final Device transferCapableMasterDevice = mock(Device.class);
-    final Device nonTransferCapableMasterDevice = mock(Device.class);
+    final Device transferCapablePrimaryDevice = mock(Device.class);
+    final Device nonTransferCapablePrimaryDevice = mock(Device.class);
     final Device transferCapableLinkedDevice = mock(Device.class);
 
     final DeviceCapabilities transferCapabilities = mock(DeviceCapabilities.class);
     final DeviceCapabilities nonTransferCapabilities = mock(DeviceCapabilities.class);
 
-    when(transferCapableMasterDevice.getId()).thenReturn(1L);
-    when(transferCapableMasterDevice.isMaster()).thenReturn(true);
-    when(transferCapableMasterDevice.getCapabilities()).thenReturn(transferCapabilities);
+    when(transferCapablePrimaryDevice.getId()).thenReturn(1L);
+    when(transferCapablePrimaryDevice.isPrimary()).thenReturn(true);
+    when(transferCapablePrimaryDevice.getCapabilities()).thenReturn(transferCapabilities);
 
-    when(nonTransferCapableMasterDevice.getId()).thenReturn(1L);
-    when(nonTransferCapableMasterDevice.isMaster()).thenReturn(true);
-    when(nonTransferCapableMasterDevice.getCapabilities()).thenReturn(nonTransferCapabilities);
+    when(nonTransferCapablePrimaryDevice.getId()).thenReturn(1L);
+    when(nonTransferCapablePrimaryDevice.isPrimary()).thenReturn(true);
+    when(nonTransferCapablePrimaryDevice.getCapabilities()).thenReturn(nonTransferCapabilities);
 
     when(transferCapableLinkedDevice.getId()).thenReturn(2L);
-    when(transferCapableLinkedDevice.isMaster()).thenReturn(false);
+    when(transferCapableLinkedDevice.isPrimary()).thenReturn(false);
     when(transferCapableLinkedDevice.getCapabilities()).thenReturn(transferCapabilities);
 
     when(transferCapabilities.transfer()).thenReturn(true);
     when(nonTransferCapabilities.transfer()).thenReturn(false);
 
     {
-      final Account transferableMasterAccount =
-              AccountsHelper.generateTestAccount("+14152222222", UUID.randomUUID(), UUID.randomUUID(), List.of(transferCapableMasterDevice), "1234".getBytes());
+      final Account transferablePrimaryAccount =
+              AccountsHelper.generateTestAccount("+14152222222", UUID.randomUUID(), UUID.randomUUID(), List.of(transferCapablePrimaryDevice), "1234".getBytes());
 
-      assertTrue(transferableMasterAccount.isTransferSupported());
+      assertTrue(transferablePrimaryAccount.isTransferSupported());
     }
 
     {
-      final Account nonTransferableMasterAccount =
-              AccountsHelper.generateTestAccount("+14152222222", UUID.randomUUID(), UUID.randomUUID(), List.of(nonTransferCapableMasterDevice), "1234".getBytes());
+      final Account nonTransferablePrimaryAccount =
+              AccountsHelper.generateTestAccount("+14152222222", UUID.randomUUID(), UUID.randomUUID(), List.of(nonTransferCapablePrimaryDevice), "1234".getBytes());
 
-      assertFalse(nonTransferableMasterAccount.isTransferSupported());
+      assertFalse(nonTransferablePrimaryAccount.isTransferSupported());
     }
 
     {
-      final Account transferableLinkedAccount = AccountsHelper.generateTestAccount("+14152222222", UUID.randomUUID(), UUID.randomUUID(), List.of(nonTransferCapableMasterDevice, transferCapableLinkedDevice), "1234".getBytes());
+      final Account transferableLinkedAccount = AccountsHelper.generateTestAccount("+14152222222", UUID.randomUUID(), UUID.randomUUID(), List.of(nonTransferCapablePrimaryDevice, transferCapableLinkedDevice), "1234".getBytes());
 
       assertFalse(transferableLinkedAccount.isTransferSupported());
     }
@@ -248,7 +248,7 @@ class AccountTest {
 
   @Test
   void testDiscoverableByPhoneNumber() {
-    final Account account = AccountsHelper.generateTestAccount("+14152222222", UUID.randomUUID(), UUID.randomUUID(), List.of(recentMasterDevice),
+    final Account account = AccountsHelper.generateTestAccount("+14152222222", UUID.randomUUID(), UUID.randomUUID(), List.of(recentPrimaryDevice),
         "1234".getBytes());
 
     assertTrue(account.isDiscoverableByPhoneNumber(),
@@ -303,7 +303,7 @@ class AccountTest {
   @Test
   void getNextDeviceId() {
 
-    final List<Device> devices = List.of(createDevice(Device.MASTER_ID));
+    final List<Device> devices = List.of(createDevice(Device.PRIMARY_ID));
 
     final Account account = AccountsHelper.generateTestAccount("+14151234567", UUID.randomUUID(), UUID.randomUUID(), devices, new byte[0]);
 
@@ -326,8 +326,8 @@ class AccountTest {
 
   @Test
   void replaceDevice() {
-    final Device firstDevice = createDevice(Device.MASTER_ID);
-    final Device secondDevice = createDevice(Device.MASTER_ID);
+    final Device firstDevice = createDevice(Device.PRIMARY_ID);
+    final Device secondDevice = createDevice(Device.PRIMARY_ID);
     final Account account = AccountsHelper.generateTestAccount("+14151234567", UUID.randomUUID(), UUID.randomUUID(), List.of(firstDevice), new byte[0]);
 
     assertEquals(List.of(firstDevice), account.getDevices());
@@ -339,7 +339,7 @@ class AccountTest {
 
   @Test
   void addAndRemoveBadges() {
-    final Account account = AccountsHelper.generateTestAccount("+14151234567", UUID.randomUUID(), UUID.randomUUID(), List.of(createDevice(Device.MASTER_ID)), new byte[0]);
+    final Account account = AccountsHelper.generateTestAccount("+14151234567", UUID.randomUUID(), UUID.randomUUID(), List.of(createDevice(Device.PRIMARY_ID)), new byte[0]);
     final Clock clock = TestClock.pinned(Instant.ofEpochSecond(40));
 
     account.addBadge(clock, new AccountBadge("foo", Instant.ofEpochSecond(42), false));
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerChangeNumberIntegrationTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerChangeNumberIntegrationTest.java
index 40b5b1c25cbc714113d4b0811f4d6e9c4fd5b84c..d455df7fdd64347e8950e040ad0b8347f803017c 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerChangeNumberIntegrationTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerChangeNumberIntegrationTest.java
@@ -175,14 +175,14 @@ class AccountsManagerChangeNumberIntegrationTest {
 
     final AccountAttributes accountAttributes = new AccountAttributes(true, rotatedPniRegistrationId + 1, "test", null, true, new Device.DeviceCapabilities(false, false, false, false));
     final Account account = accountsManager.create(originalNumber, "password", null, accountAttributes, new ArrayList<>());
-    account.getMasterDevice().orElseThrow().setSignedPreKey(KeysHelper.signedECPreKey(1, pniIdentityKeyPair));
+    account.getPrimaryDevice().orElseThrow().setSignedPreKey(KeysHelper.signedECPreKey(1, pniIdentityKeyPair));
 
     final UUID originalUuid = account.getUuid();
     final UUID originalPni = account.getPhoneNumberIdentifier();
 
     final IdentityKey pniIdentityKey = new IdentityKey(pniIdentityKeyPair.getPublicKey());
-    final Map<Long, ECSignedPreKey> preKeys = Map.of(Device.MASTER_ID, rotatedSignedPreKey);
-    final Map<Long, Integer> registrationIds = Map.of(Device.MASTER_ID, rotatedPniRegistrationId);
+    final Map<Long, ECSignedPreKey> preKeys = Map.of(Device.PRIMARY_ID, rotatedSignedPreKey);
+    final Map<Long, Integer> registrationIds = Map.of(Device.PRIMARY_ID, rotatedPniRegistrationId);
 
     final Account updatedAccount = accountsManager.changeNumber(account, secondNumber, pniIdentityKey, preKeys, null, registrationIds);
 
@@ -200,9 +200,9 @@ class AccountsManagerChangeNumberIntegrationTest {
     assertEquals(pniIdentityKey, updatedAccount.getIdentityKey(IdentityType.PNI));
 
     assertEquals(OptionalInt.of(rotatedPniRegistrationId),
-        updatedAccount.getMasterDevice().orElseThrow().getPhoneNumberIdentityRegistrationId());
+        updatedAccount.getPrimaryDevice().orElseThrow().getPhoneNumberIdentityRegistrationId());
 
-    assertEquals(rotatedSignedPreKey, updatedAccount.getMasterDevice().orElseThrow().getSignedPreKey(IdentityType.PNI));
+    assertEquals(rotatedSignedPreKey, updatedAccount.getPrimaryDevice().orElseThrow().getSignedPreKey(IdentityType.PNI));
   }
 
   @Test
@@ -249,7 +249,7 @@ class AccountsManagerChangeNumberIntegrationTest {
 
     assertEquals(secondNumber, accountsManager.getByAccountIdentifier(originalUuid).map(Account::getNumber).orElseThrow());
 
-    verify(clientPresenceManager).disconnectPresence(existingAccountUuid, Device.MASTER_ID);
+    verify(clientPresenceManager).disconnectPresence(existingAccountUuid, Device.PRIMARY_ID);
 
     assertEquals(Optional.of(existingAccountUuid), accountsManager.findRecentlyDeletedAccountIdentifier(originalNumber));
     assertEquals(Optional.empty(), accountsManager.findRecentlyDeletedAccountIdentifier(secondNumber));
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerConcurrentModificationIntegrationTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerConcurrentModificationIntegrationTest.java
index 16d6a541f008067b0e14d570dbe82e2f603a9a1e..d3fd89e4cfcc07a1f1885330e7dfe43f21f7a64c 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerConcurrentModificationIntegrationTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerConcurrentModificationIntegrationTest.java
@@ -168,8 +168,8 @@ class AccountsManagerConcurrentModificationIntegrationTest {
         modifyAccount(uuid, account -> account.setUnidentifiedAccessKey(unidentifiedAccessKey)),
         modifyAccount(uuid, account -> account.setRegistrationLock(credentials.hash(), credentials.salt())),
         modifyAccount(uuid, account -> account.setUnrestrictedUnidentifiedAccess(unrestrictedUnidentifiedAccess)),
-        modifyDevice(uuid, Device.MASTER_ID, device -> device.setLastSeen(lastSeen)),
-        modifyDevice(uuid, Device.MASTER_ID, device -> device.setName("deviceName"))
+        modifyDevice(uuid, Device.PRIMARY_ID, device -> device.setLastSeen(lastSeen)),
+        modifyDevice(uuid, Device.PRIMARY_ID, device -> device.setName("deviceName"))
     ).join();
 
     final Account managerAccount = accountsManager.getByAccountIdentifier(uuid).orElseThrow();
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerTest.java
index 54db1e888aa3705cc6e4c5a497158290f433e28f..385f6de2ea2639e817765e0642d23975687522fa 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/AccountsManagerTest.java
@@ -1530,8 +1530,8 @@ class AccountsManagerTest {
 
     assertEquals(originalAccount.getDevices().size(), parsedAccount.getDevices().size());
 
-    final Device originalDevice = originalAccount.getMasterDevice().orElseThrow();
-    final Device parsedDevice = parsedAccount.getMasterDevice().orElseThrow();
+    final Device originalDevice = originalAccount.getPrimaryDevice().orElseThrow();
+    final Device parsedDevice = parsedAccount.getPrimaryDevice().orElseThrow();
 
     assertEquals(originalDevice.getId(), parsedDevice.getId());
     assertEquals(originalDevice.getSignedPreKey(IdentityType.ACI), parsedDevice.getSignedPreKey(IdentityType.ACI));
@@ -1549,7 +1549,7 @@ class AccountsManagerTest {
 
   private static Device generateTestDevice(final long lastSeen) {
     final Device device = new Device();
-    device.setId(Device.MASTER_ID);
+    device.setId(Device.PRIMARY_ID);
     device.setFetchesMessages(true);
     device.setSignedPreKey(KeysHelper.signedECPreKey(1, Curve.generateKeyPair()));
     device.setLastSeen(lastSeen);
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/ChangeNumberManagerTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/ChangeNumberManagerTest.java
index 7ce758211536c6d6592755d79f14ec897c60d392..5463988e88178eb004e54018350b219099e47f46 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/ChangeNumberManagerTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/ChangeNumberManagerTest.java
@@ -158,7 +158,7 @@ public class ChangeNumberManagerTest {
 
     assertEquals(aci, UUID.fromString(envelope.getDestinationUuid()));
     assertEquals(aci, UUID.fromString(envelope.getSourceUuid()));
-    assertEquals(Device.MASTER_ID, envelope.getSourceDevice());
+    assertEquals(Device.PRIMARY_ID, envelope.getSourceDevice());
     assertEquals(updatedPhoneNumberIdentifiersByAccount.get(account), UUID.fromString(envelope.getUpdatedPni()));
   }
 
@@ -203,7 +203,7 @@ public class ChangeNumberManagerTest {
 
     assertEquals(aci, UUID.fromString(envelope.getDestinationUuid()));
     assertEquals(aci, UUID.fromString(envelope.getSourceUuid()));
-    assertEquals(Device.MASTER_ID, envelope.getSourceDevice());
+    assertEquals(Device.PRIMARY_ID, envelope.getSourceDevice());
     assertEquals(updatedPhoneNumberIdentifiersByAccount.get(account), UUID.fromString(envelope.getUpdatedPni()));
   }
 
@@ -246,7 +246,7 @@ public class ChangeNumberManagerTest {
 
     assertEquals(aci, UUID.fromString(envelope.getDestinationUuid()));
     assertEquals(aci, UUID.fromString(envelope.getSourceUuid()));
-    assertEquals(Device.MASTER_ID, envelope.getSourceDevice());
+    assertEquals(Device.PRIMARY_ID, envelope.getSourceDevice());
     assertFalse(updatedPhoneNumberIdentifiersByAccount.containsKey(account));
   }
 
@@ -286,7 +286,7 @@ public class ChangeNumberManagerTest {
 
     assertEquals(aci, UUID.fromString(envelope.getDestinationUuid()));
     assertEquals(aci, UUID.fromString(envelope.getSourceUuid()));
-    assertEquals(Device.MASTER_ID, envelope.getSourceDevice());
+    assertEquals(Device.PRIMARY_ID, envelope.getSourceDevice());
     assertFalse(updatedPhoneNumberIdentifiersByAccount.containsKey(account));
   }
 
@@ -327,7 +327,7 @@ public class ChangeNumberManagerTest {
 
     assertEquals(aci, UUID.fromString(envelope.getDestinationUuid()));
     assertEquals(aci, UUID.fromString(envelope.getSourceUuid()));
-    assertEquals(Device.MASTER_ID, envelope.getSourceDevice());
+    assertEquals(Device.PRIMARY_ID, envelope.getSourceDevice());
     assertFalse(updatedPhoneNumberIdentifiersByAccount.containsKey(account));
   }
 
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/storage/DeviceTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/storage/DeviceTest.java
index 44f25921ac68d5a439e4055445777877b26f45dd..9a0f1b569f1f802c365d7992376cbd45bb845692 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/storage/DeviceTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/storage/DeviceTest.java
@@ -19,13 +19,13 @@ class DeviceTest {
 
   @ParameterizedTest
   @MethodSource
-  void testIsEnabled(final boolean master, final boolean fetchesMessages, final String apnId, final String gcmId,
+  void testIsEnabled(final boolean primary, final boolean fetchesMessages, final String apnId, final String gcmId,
       final ECSignedPreKey signedPreKey, final Duration timeSinceLastSeen, final boolean expectEnabled) {
 
     final long lastSeen = System.currentTimeMillis() - timeSinceLastSeen.toMillis();
 
     final Device device = new Device();
-    device.setId(master ? Device.MASTER_ID : Device.MASTER_ID + 1);
+    device.setId(primary ? Device.PRIMARY_ID : Device.PRIMARY_ID + 1);
     device.setFetchesMessages(fetchesMessages);
     device.setApnId(apnId);
     device.setGcmId(gcmId);
@@ -38,7 +38,7 @@ class DeviceTest {
 
   private static Stream<Arguments> testIsEnabled() {
     return Stream.of(
-        //             master fetchesMessages apnId     gcmId     signedPreKey              lastSeen             expectEnabled
+        //             primary fetchesMessages apnId     gcmId     signedPreKey              lastSeen             expectEnabled
         Arguments.of(true, false, null, null, null, Duration.ofDays(60), false),
         Arguments.of(true, false, null, null, null, Duration.ofDays(1), false),
         Arguments.of(true, false, null, null, mock(ECSignedPreKey.class), Duration.ofDays(60), false),
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/tests/util/AccountsHelper.java b/service/src/test/java/org/whispersystems/textsecuregcm/tests/util/AccountsHelper.java
index b1ff2f2db43acd1b371c5dc80de521049f753b59..480f4ea4e890d06b53680a3597278df4d544f22d 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/tests/util/AccountsHelper.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/tests/util/AccountsHelper.java
@@ -117,7 +117,7 @@ public class AccountsHelper {
           case "getUsernameHash" -> when(updatedAccount.getUsernameHash()).thenAnswer(stubbing);
           case "getDevices" -> when(updatedAccount.getDevices()).thenAnswer(stubbing);
           case "getDevice" -> when(updatedAccount.getDevice(stubbing.getInvocation().getArgument(0))).thenAnswer(stubbing);
-          case "getMasterDevice" -> when(updatedAccount.getMasterDevice()).thenAnswer(stubbing);
+          case "getPrimaryDevice" -> when(updatedAccount.getPrimaryDevice()).thenAnswer(stubbing);
           case "isEnabled" -> when(updatedAccount.isEnabled()).thenAnswer(stubbing);
           case "isDiscoverableByPhoneNumber" -> when(updatedAccount.isDiscoverableByPhoneNumber()).thenAnswer(stubbing);
           case "getNextDeviceId" -> when(updatedAccount.getNextDeviceId()).thenAnswer(stubbing);
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/tests/util/AuthHelper.java b/service/src/test/java/org/whispersystems/textsecuregcm/tests/util/AuthHelper.java
index 59abd528de7d0c957a377c95beb6d0f7b00529aa..951af15903512a17998c17acf3518352e437dbbe 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/tests/util/AuthHelper.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/tests/util/AuthHelper.java
@@ -105,12 +105,12 @@ public class AuthHelper {
     when(DISABLED_DEVICE.getAuthTokenHash()).thenReturn(DISABLED_CREDENTIALS);
     when(UNDISCOVERABLE_DEVICE.getAuthTokenHash()).thenReturn(UNDISCOVERABLE_CREDENTIALS);
 
-    when(VALID_DEVICE.isMaster()).thenReturn(true);
-    when(VALID_DEVICE_TWO.isMaster()).thenReturn(true);
-    when(DISABLED_DEVICE.isMaster()).thenReturn(true);
-    when(UNDISCOVERABLE_DEVICE.isMaster()).thenReturn(true);
-    when(VALID_DEVICE_3_PRIMARY.isMaster()).thenReturn(true);
-    when(VALID_DEVICE_3_LINKED.isMaster()).thenReturn(false);
+    when(VALID_DEVICE.isPrimary()).thenReturn(true);
+    when(VALID_DEVICE_TWO.isPrimary()).thenReturn(true);
+    when(DISABLED_DEVICE.isPrimary()).thenReturn(true);
+    when(UNDISCOVERABLE_DEVICE.isPrimary()).thenReturn(true);
+    when(VALID_DEVICE_3_PRIMARY.isPrimary()).thenReturn(true);
+    when(VALID_DEVICE_3_LINKED.isPrimary()).thenReturn(false);
 
     when(VALID_DEVICE.getId()).thenReturn(1L);
     when(VALID_DEVICE_TWO.getId()).thenReturn(1L);
@@ -122,20 +122,20 @@ public class AuthHelper {
     when(VALID_DEVICE.isEnabled()).thenReturn(true);
     when(VALID_DEVICE_TWO.isEnabled()).thenReturn(true);
     when(DISABLED_DEVICE.isEnabled()).thenReturn(false);
-    when(UNDISCOVERABLE_DEVICE.isMaster()).thenReturn(true);
+    when(UNDISCOVERABLE_DEVICE.isPrimary()).thenReturn(true);
     when(VALID_DEVICE_3_PRIMARY.isEnabled()).thenReturn(true);
     when(VALID_DEVICE_3_LINKED.isEnabled()).thenReturn(true);
 
     when(VALID_ACCOUNT.getDevice(1L)).thenReturn(Optional.of(VALID_DEVICE));
-    when(VALID_ACCOUNT.getMasterDevice()).thenReturn(Optional.of(VALID_DEVICE));
+    when(VALID_ACCOUNT.getPrimaryDevice()).thenReturn(Optional.of(VALID_DEVICE));
     when(VALID_ACCOUNT_TWO.getDevice(eq(1L))).thenReturn(Optional.of(VALID_DEVICE_TWO));
-    when(VALID_ACCOUNT_TWO.getMasterDevice()).thenReturn(Optional.of(VALID_DEVICE_TWO));
+    when(VALID_ACCOUNT_TWO.getPrimaryDevice()).thenReturn(Optional.of(VALID_DEVICE_TWO));
     when(DISABLED_ACCOUNT.getDevice(eq(1L))).thenReturn(Optional.of(DISABLED_DEVICE));
-    when(DISABLED_ACCOUNT.getMasterDevice()).thenReturn(Optional.of(DISABLED_DEVICE));
+    when(DISABLED_ACCOUNT.getPrimaryDevice()).thenReturn(Optional.of(DISABLED_DEVICE));
     when(UNDISCOVERABLE_ACCOUNT.getDevice(eq(1L))).thenReturn(Optional.of(UNDISCOVERABLE_DEVICE));
-    when(UNDISCOVERABLE_ACCOUNT.getMasterDevice()).thenReturn(Optional.of(UNDISCOVERABLE_DEVICE));
+    when(UNDISCOVERABLE_ACCOUNT.getPrimaryDevice()).thenReturn(Optional.of(UNDISCOVERABLE_DEVICE));
     when(VALID_ACCOUNT_3.getDevice(1L)).thenReturn(Optional.of(VALID_DEVICE_3_PRIMARY));
-    when(VALID_ACCOUNT_3.getMasterDevice()).thenReturn(Optional.of(VALID_DEVICE_3_PRIMARY));
+    when(VALID_ACCOUNT_3.getPrimaryDevice()).thenReturn(Optional.of(VALID_DEVICE_3_PRIMARY));
     when(VALID_ACCOUNT_3.getDevice(2L)).thenReturn(Optional.of(VALID_DEVICE_3_LINKED));
 
     when(VALID_ACCOUNT_TWO.getEnabledDeviceCount()).thenReturn(6);
@@ -250,11 +250,11 @@ public class AuthHelper {
     private void setup(final AccountsManager accountsManager) {
       when(saltedTokenHash.verify(password)).thenReturn(true);
       when(device.getAuthTokenHash()).thenReturn(saltedTokenHash);
-      when(device.isMaster()).thenReturn(true);
+      when(device.isPrimary()).thenReturn(true);
       when(device.getId()).thenReturn(1L);
       when(device.isEnabled()).thenReturn(true);
       when(account.getDevice(1L)).thenReturn(Optional.of(device));
-      when(account.getMasterDevice()).thenReturn(Optional.of(device));
+      when(account.getPrimaryDevice()).thenReturn(Optional.of(device));
       when(account.getNumber()).thenReturn(number);
       when(account.getUuid()).thenReturn(uuid);
       when(account.isEnabled()).thenReturn(true);
diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/util/DestinationDeviceValidatorTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/util/DestinationDeviceValidatorTest.java
index 2ad4e7837b89179b22abdaa3055c24e3b73cd980..288b32afd030c67a6b02eede0d6a38c50b2d43af 100644
--- a/service/src/test/java/org/whispersystems/textsecuregcm/util/DestinationDeviceValidatorTest.java
+++ b/service/src/test/java/org/whispersystems/textsecuregcm/util/DestinationDeviceValidatorTest.java
@@ -192,24 +192,24 @@ class DestinationDeviceValidatorTest {
 
   @Test
   void testDuplicateDeviceIds() {
-    final Account account = mockAccountWithDeviceAndRegId(Map.of(Device.MASTER_ID, 17));
+    final Account account = mockAccountWithDeviceAndRegId(Map.of(Device.PRIMARY_ID, 17));
     try {
       DestinationDeviceValidator.validateRegistrationIds(account,
-          Stream.of(new Pair<>(Device.MASTER_ID, 16), new Pair<>(Device.MASTER_ID, 17)), false);
+          Stream.of(new Pair<>(Device.PRIMARY_ID, 16), new Pair<>(Device.PRIMARY_ID, 17)), false);
       Assertions.fail("duplicate devices should throw StaleDevicesException");
     } catch (StaleDevicesException e) {
-      Assertions.assertThat(e.getStaleDevices()).hasSameElementsAs(Collections.singletonList(Device.MASTER_ID));
+      Assertions.assertThat(e.getStaleDevices()).hasSameElementsAs(Collections.singletonList(Device.PRIMARY_ID));
     }
   }
 
   @Test
   void testValidatePniRegistrationIds() {
     final Device device = mock(Device.class);
-    when(device.getId()).thenReturn(Device.MASTER_ID);
+    when(device.getId()).thenReturn(Device.PRIMARY_ID);
 
     final Account account = mock(Account.class);
     when(account.getDevices()).thenReturn(List.of(device));
-    when(account.getDevice(Device.MASTER_ID)).thenReturn(Optional.of(device));
+    when(account.getDevice(Device.PRIMARY_ID)).thenReturn(Optional.of(device));
 
     final int aciRegistrationId = 17;
     final int pniRegistrationId = 89;
@@ -220,33 +220,33 @@ class DestinationDeviceValidatorTest {
 
     assertDoesNotThrow(
         () -> DestinationDeviceValidator.validateRegistrationIds(account,
-            Stream.of(new Pair<>(Device.MASTER_ID, aciRegistrationId)), false));
+            Stream.of(new Pair<>(Device.PRIMARY_ID, aciRegistrationId)), false));
     assertDoesNotThrow(
         () -> DestinationDeviceValidator.validateRegistrationIds(account,
-            Stream.of(new Pair<>(Device.MASTER_ID, pniRegistrationId)),
+            Stream.of(new Pair<>(Device.PRIMARY_ID, pniRegistrationId)),
             true));
     assertThrows(StaleDevicesException.class,
         () -> DestinationDeviceValidator.validateRegistrationIds(account,
-            Stream.of(new Pair<>(Device.MASTER_ID, aciRegistrationId)),
+            Stream.of(new Pair<>(Device.PRIMARY_ID, aciRegistrationId)),
             true));
     assertThrows(StaleDevicesException.class,
         () -> DestinationDeviceValidator.validateRegistrationIds(account,
-            Stream.of(new Pair<>(Device.MASTER_ID, pniRegistrationId)),
+            Stream.of(new Pair<>(Device.PRIMARY_ID, pniRegistrationId)),
             false));
 
     when(device.getPhoneNumberIdentityRegistrationId()).thenReturn(OptionalInt.empty());
 
     assertDoesNotThrow(
         () -> DestinationDeviceValidator.validateRegistrationIds(account,
-            Stream.of(new Pair<>(Device.MASTER_ID, aciRegistrationId)),
+            Stream.of(new Pair<>(Device.PRIMARY_ID, aciRegistrationId)),
             false));
     assertDoesNotThrow(
         () -> DestinationDeviceValidator.validateRegistrationIds(account,
-            Stream.of(new Pair<>(Device.MASTER_ID, aciRegistrationId)),
+            Stream.of(new Pair<>(Device.PRIMARY_ID, aciRegistrationId)),
             true));
     assertThrows(StaleDevicesException.class, () -> DestinationDeviceValidator.validateRegistrationIds(account,
-        Stream.of(new Pair<>(Device.MASTER_ID, incorrectRegistrationId)), true));
+        Stream.of(new Pair<>(Device.PRIMARY_ID, incorrectRegistrationId)), true));
     assertThrows(StaleDevicesException.class, () -> DestinationDeviceValidator.validateRegistrationIds(account,
-        Stream.of(new Pair<>(Device.MASTER_ID, incorrectRegistrationId)), false));
+        Stream.of(new Pair<>(Device.PRIMARY_ID, incorrectRegistrationId)), false));
   }
 }