diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/grpc/AccountsGrpcService.java b/service/src/main/java/org/whispersystems/textsecuregcm/grpc/AccountsGrpcService.java index 2ffa22c51..afe0a8bb8 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/grpc/AccountsGrpcService.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/grpc/AccountsGrpcService.java @@ -94,6 +94,10 @@ public class AccountsGrpcService extends SimpleAccountsGrpc.AccountsImplBase { account.getUsernameHash().ifPresent(usernameHash -> accountIdentifiersBuilder.setUsernameHash(ByteString.copyFrom(usernameHash))); + if (account.getUsernameLinkHandle() != null) { + accountIdentifiersBuilder.setUsernameLinkHandle(UUIDUtil.toByteString(account.getUsernameLinkHandle())); + } + return GetAccountIdentityResponse.newBuilder() .setAccountIdentifiers(accountIdentifiersBuilder) .build(); diff --git a/service/src/main/proto/org/signal/chat/common.proto b/service/src/main/proto/org/signal/chat/common.proto index 91cd753d8..4e49ae536 100644 --- a/service/src/main/proto/org/signal/chat/common.proto +++ b/service/src/main/proto/org/signal/chat/common.proto @@ -30,11 +30,15 @@ message AccountIdentifiers { repeated ServiceIdentifier service_identifiers = 1; // The phone number associated with the identified account. - string e164 = 2; + string e164 = 2 [(org.signal.chat.require.e164) = true]; // The username hash (if any) associated with the identified account. May be // empty if no username is associated with the identified account. - bytes username_hash = 3; + bytes username_hash = 3 [(org.signal.chat.require.exactlySize) = 0, (org.signal.chat.require.exactlySize) = 32]; + + // The username link handle UUID associated with the identified account. + // May be empty if no username is associated with the identified account. + bytes username_link_handle = 4 [(org.signal.chat.require.exactlySize) = 0, (org.signal.chat.require.exactlySize) = 16]; } message EcPreKey { diff --git a/service/src/test/java/org/whispersystems/textsecuregcm/grpc/AccountsGrpcServiceTest.java b/service/src/test/java/org/whispersystems/textsecuregcm/grpc/AccountsGrpcServiceTest.java index 765ddec1f..1ae033e1d 100644 --- a/service/src/test/java/org/whispersystems/textsecuregcm/grpc/AccountsGrpcServiceTest.java +++ b/service/src/test/java/org/whispersystems/textsecuregcm/grpc/AccountsGrpcServiceTest.java @@ -121,12 +121,14 @@ class AccountsGrpcServiceTest extends SimpleBaseGrpcTest