add an option to replace username ciphertext without rotating the link handle

This commit is contained in:
Jonathan Klabunde Tomer
2023-11-13 09:01:54 -08:00
committed by GitHub
parent a4a4204762
commit a83378a44e
7 changed files with 69 additions and 11 deletions

View File

@@ -267,7 +267,12 @@ public class AccountsGrpcService extends ReactorAccountsGrpc.AccountsImplBase {
.asRuntimeException());
}
final UUID linkHandle = UUID.randomUUID();
final UUID linkHandle;
if (request.getKeepLinkHandle() && account.getUsernameLinkHandle() != null) {
linkHandle = account.getUsernameLinkHandle();
} else {
linkHandle = UUID.randomUUID();
}
return Mono.fromFuture(() -> accountsManager.updateAsync(account, a -> a.setUsernameLinkDetails(linkHandle, request.getUsernameCiphertext().toByteArray())))
.thenReturn(linkHandle);