mirror of
https://github.com/signalapp/Signal-Server
synced 2026-04-23 16:28:04 +01:00
Replace TreeSearchResponse with CondensedTreeSearchResponse
This commit is contained in:
@@ -121,10 +121,7 @@ public class KeyTransparencyController {
|
||||
request.lastTreeHeadSize(),
|
||||
request.distinguishedTreeHeadSize(),
|
||||
KEY_TRANSPARENCY_RPC_TIMEOUT)
|
||||
.thenApply(searchResponse ->
|
||||
new KeyTransparencySearchResponse(
|
||||
searchResponse.toByteArray())
|
||||
).join();
|
||||
.thenApply(KeyTransparencySearchResponse::new).join();
|
||||
} catch (final CancellationException exception) {
|
||||
LOGGER.error("Unexpected cancellation from key transparency service", exception);
|
||||
throw new ServerErrorException(Response.Status.SERVICE_UNAVAILABLE, exception);
|
||||
|
||||
@@ -31,7 +31,6 @@ import org.signal.keytransparency.client.KeyTransparencyQueryServiceGrpc;
|
||||
import org.signal.keytransparency.client.MonitorKey;
|
||||
import org.signal.keytransparency.client.MonitorRequest;
|
||||
import org.signal.keytransparency.client.SearchRequest;
|
||||
import org.signal.keytransparency.client.SearchResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.whispersystems.textsecuregcm.metrics.MetricsUtil;
|
||||
@@ -113,7 +112,7 @@ public class KeyTransparencyServiceClient implements Managed {
|
||||
}
|
||||
|
||||
@SuppressWarnings("OptionalUsedAsFieldOrParameterType")
|
||||
public CompletableFuture<SearchResponse> search(
|
||||
public CompletableFuture<byte[]> search(
|
||||
final ByteString aci,
|
||||
final ByteString aciIdentityKey,
|
||||
final Optional<ByteString> usernameHash,
|
||||
@@ -121,21 +120,22 @@ public class KeyTransparencyServiceClient implements Managed {
|
||||
final Optional<Long> lastTreeHeadSize,
|
||||
final long distinguishedTreeHeadSize,
|
||||
final Duration timeout) {
|
||||
final SearchRequest.Builder searchKeysRequestBuilder = SearchRequest.newBuilder()
|
||||
final SearchRequest.Builder searchRequestBuilder = SearchRequest.newBuilder()
|
||||
.setAci(aci)
|
||||
.setAciIdentityKey(aciIdentityKey);
|
||||
|
||||
usernameHash.ifPresent(searchKeysRequestBuilder::setUsernameHash);
|
||||
e164SearchRequest.ifPresent(searchKeysRequestBuilder::setE164SearchRequest);
|
||||
usernameHash.ifPresent(searchRequestBuilder::setUsernameHash);
|
||||
e164SearchRequest.ifPresent(searchRequestBuilder::setE164SearchRequest);
|
||||
|
||||
final ConsistencyParameters.Builder consistency = ConsistencyParameters.newBuilder()
|
||||
.setDistinguished(distinguishedTreeHeadSize);
|
||||
lastTreeHeadSize.ifPresent(consistency::setLast);
|
||||
|
||||
searchKeysRequestBuilder.setConsistency(consistency.build());
|
||||
searchRequestBuilder.setConsistency(consistency.build());
|
||||
|
||||
return CompletableFutureUtil.toCompletableFuture(stub.withDeadline(toDeadline(timeout))
|
||||
.search(searchKeysRequestBuilder.build()), callbackExecutor);
|
||||
.search(searchRequestBuilder.build()), callbackExecutor)
|
||||
.thenApply(AbstractMessageLite::toByteArray);
|
||||
}
|
||||
|
||||
public CompletableFuture<byte[]> monitor(final List<MonitorKey> monitorKeys,
|
||||
|
||||
@@ -89,7 +89,7 @@ message SearchResponse {
|
||||
/**
|
||||
* The ACI search response is always provided.
|
||||
*/
|
||||
TreeSearchResponse aci = 2;
|
||||
CondensedTreeSearchResponse aci = 2;
|
||||
/**
|
||||
* This response is only provided if all of the conditions are met:
|
||||
* - the E164 exists in the log
|
||||
@@ -97,12 +97,12 @@ message SearchResponse {
|
||||
* - the account associated with the ACI is discoverable
|
||||
* - the unidentified access key provided in E164SearchRequest matches the one on the account
|
||||
*/
|
||||
optional TreeSearchResponse e164 = 3;
|
||||
optional CondensedTreeSearchResponse e164 = 3;
|
||||
/**
|
||||
* This response is only provided if the username hash exists in the log and
|
||||
* its mapped ACI matches the one provided in the request.
|
||||
*/
|
||||
optional TreeSearchResponse username_hash = 4;
|
||||
optional CondensedTreeSearchResponse username_hash = 4;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -152,10 +152,10 @@ message DistinguishedResponse {
|
||||
/**
|
||||
* This search response is always provided.
|
||||
*/
|
||||
TreeSearchResponse distinguished = 2;
|
||||
CondensedTreeSearchResponse distinguished = 2;
|
||||
}
|
||||
|
||||
message TreeSearchResponse {
|
||||
message CondensedTreeSearchResponse {
|
||||
/**
|
||||
* A proof that is combined with the original requested identifier and the VRF public key
|
||||
* and outputs whether the proof is valid, and if so, the commitment index.
|
||||
|
||||
Reference in New Issue
Block a user