Align `KeyTransparencySearchResponse` with distinguished counterpart and update `DistinguishedResponse` field names
This commit is contained in:
parent
f3b22e04e8
commit
d335b7a033
|
@ -123,10 +123,7 @@ public class KeyTransparencyController {
|
||||||
KEY_TRANSPARENCY_RPC_TIMEOUT)
|
KEY_TRANSPARENCY_RPC_TIMEOUT)
|
||||||
.thenApply(searchResponse ->
|
.thenApply(searchResponse ->
|
||||||
new KeyTransparencySearchResponse(
|
new KeyTransparencySearchResponse(
|
||||||
searchResponse.getTreeHead().toByteArray(),
|
searchResponse.toByteArray())
|
||||||
searchResponse.getAci().toByteArray(),
|
|
||||||
searchResponse.hasE164() ? Optional.of(searchResponse.getE164().toByteArray()) : Optional.empty(),
|
|
||||||
searchResponse.hasUsernameHash() ? Optional.of(searchResponse.getUsernameHash().toByteArray()) : Optional.empty())
|
|
||||||
).join();
|
).join();
|
||||||
} catch (final CancellationException exception) {
|
} catch (final CancellationException exception) {
|
||||||
LOGGER.error("Unexpected cancellation from key transparency service", exception);
|
LOGGER.error("Unexpected cancellation from key transparency service", exception);
|
||||||
|
|
|
@ -15,6 +15,6 @@ public record KeyTransparencyDistinguishedKeyResponse(
|
||||||
@NotNull
|
@NotNull
|
||||||
@JsonSerialize(using = ByteArrayAdapter.Serializing.class)
|
@JsonSerialize(using = ByteArrayAdapter.Serializing.class)
|
||||||
@JsonDeserialize(using = ByteArrayAdapter.Deserializing.class)
|
@JsonDeserialize(using = ByteArrayAdapter.Deserializing.class)
|
||||||
@Schema(description = "The response for the distinguished tree head encoded in standard un-padded base64")
|
@Schema(description = "The serialized `DistinguishedResponse` encoded in standard un-padded base64")
|
||||||
byte[] distinguishedKeyResponse
|
byte[] distinguishedKeyResponse
|
||||||
) {}
|
) {}
|
||||||
|
|
|
@ -17,22 +17,6 @@ public record KeyTransparencySearchResponse(
|
||||||
@NotNull
|
@NotNull
|
||||||
@JsonSerialize(using = ByteArrayAdapter.Serializing.class)
|
@JsonSerialize(using = ByteArrayAdapter.Serializing.class)
|
||||||
@JsonDeserialize(using = ByteArrayAdapter.Deserializing.class)
|
@JsonDeserialize(using = ByteArrayAdapter.Deserializing.class)
|
||||||
@Schema(description = "The `FullTreeHead` protobuf encoded in standard un-padded base64. This should be used across all identifiers.")
|
@Schema(description = "The serialized `SearchResponse` encoded in standard un-padded base64.")
|
||||||
byte[] fullTreeHead,
|
byte[] serializedResponse
|
||||||
|
|
||||||
@NotNull
|
|
||||||
@JsonSerialize(using = ByteArrayAdapter.Serializing.class)
|
|
||||||
@JsonDeserialize(using = ByteArrayAdapter.Deserializing.class)
|
|
||||||
@Schema(description = "The `TreeSearchResponse` protobuf for the ACI identifier encoded in standard un-padded base64")
|
|
||||||
byte[] aciSearchResponse,
|
|
||||||
|
|
||||||
@JsonSerialize(contentUsing = ByteArrayAdapter.Serializing.class)
|
|
||||||
@JsonDeserialize(contentUsing = ByteArrayAdapter.Deserializing.class)
|
|
||||||
@Schema(description = "The `TreeSearchResponse` protobuf for the E164 encoded in standard un-padded base64")
|
|
||||||
Optional<byte[]> e164SearchResponse,
|
|
||||||
|
|
||||||
@JsonSerialize(contentUsing = ByteArrayAdapter.Serializing.class)
|
|
||||||
@JsonDeserialize(contentUsing = ByteArrayAdapter.Deserializing.class)
|
|
||||||
@Schema(description = "The `TreeSearchResponse` protobuf for the username hash encoded in standard un-padded base64")
|
|
||||||
Optional<byte[]> usernameHashSearchResponse
|
|
||||||
) {}
|
) {}
|
||||||
|
|
|
@ -152,11 +152,11 @@ message DistinguishedResponse {
|
||||||
* A signed representation of the log tree's current state along with some
|
* A signed representation of the log tree's current state along with some
|
||||||
* additional information necessary for validation such as a consistency proof and an auditor-signed tree head.
|
* additional information necessary for validation such as a consistency proof and an auditor-signed tree head.
|
||||||
*/
|
*/
|
||||||
FullTreeHead full_tree_head = 1;
|
FullTreeHead tree_head = 1;
|
||||||
/**
|
/**
|
||||||
* This search response is always provided.
|
* This search response is always provided.
|
||||||
*/
|
*/
|
||||||
TreeSearchResponse distinguished_response = 2;
|
TreeSearchResponse distinguished = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
message TreeSearchResponse {
|
message TreeSearchResponse {
|
||||||
|
|
|
@ -172,13 +172,8 @@ public class KeyTransparencyControllerTest {
|
||||||
|
|
||||||
final KeyTransparencySearchResponse keyTransparencySearchResponse = response.readEntity(
|
final KeyTransparencySearchResponse keyTransparencySearchResponse = response.readEntity(
|
||||||
KeyTransparencySearchResponse.class);
|
KeyTransparencySearchResponse.class);
|
||||||
assertNotNull(keyTransparencySearchResponse.fullTreeHead());
|
assertNotNull(keyTransparencySearchResponse.serializedResponse());
|
||||||
assertNotNull(keyTransparencySearchResponse.aciSearchResponse());
|
assertEquals(aciSearchResponse, SearchResponse.parseFrom(keyTransparencySearchResponse.serializedResponse()).getAci());
|
||||||
|
|
||||||
assertEquals(aciSearchResponse, TreeSearchResponse.parseFrom(keyTransparencySearchResponse.aciSearchResponse()));
|
|
||||||
|
|
||||||
e164.ifPresent(ignored -> assertNotNull(keyTransparencySearchResponse.e164SearchResponse()));
|
|
||||||
usernameHash.ifPresent(ignored -> assertNotNull(keyTransparencySearchResponse.usernameHashSearchResponse()));
|
|
||||||
|
|
||||||
ArgumentCaptor<ByteString> aciArgument = ArgumentCaptor.forClass(ByteString.class);
|
ArgumentCaptor<ByteString> aciArgument = ArgumentCaptor.forClass(ByteString.class);
|
||||||
ArgumentCaptor<ByteString> aciIdentityKeyArgument = ArgumentCaptor.forClass(ByteString.class);
|
ArgumentCaptor<ByteString> aciIdentityKeyArgument = ArgumentCaptor.forClass(ByteString.class);
|
||||||
|
|
Loading…
Reference in New Issue