diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/entities/PreKeyState.java b/service/src/main/java/org/whispersystems/textsecuregcm/entities/PreKeyState.java index 8b17d4da7..dfd25e703 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/entities/PreKeyState.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/entities/PreKeyState.java @@ -9,58 +9,65 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.google.common.annotations.VisibleForTesting; import io.swagger.v3.oas.annotations.media.Schema; -import java.util.ArrayList; -import java.util.List; +import org.signal.libsignal.protocol.IdentityKey; +import org.whispersystems.textsecuregcm.util.IdentityKeyAdapter; + import javax.validation.Valid; import javax.validation.constraints.AssertTrue; import javax.validation.constraints.NotNull; -import org.signal.libsignal.protocol.IdentityKey; -import org.whispersystems.textsecuregcm.util.IdentityKeyAdapter; +import java.util.ArrayList; +import java.util.List; public class PreKeyState { @JsonProperty @Valid - @Schema(description="A list of unsigned elliptic-curve prekeys to use for this device. " + - "If present and not empty, replaces all stored unsigned EC prekeys for the device; " + - "if absent or empty, any stored unsigned EC prekeys for the device are not deleted.") + @Schema(description = """ + A list of unsigned elliptic-curve prekeys to use for this device. If present and not empty, replaces all stored + unsigned EC prekeys for the device; if absent or empty, any stored unsigned EC prekeys for the device are not + deleted. + """) private List<@Valid ECPreKey> preKeys; @JsonProperty @Valid - @Schema(description="An optional signed elliptic-curve prekey to use for this device. " + - "If present, replaces the stored signed elliptic-curve prekey for the device; " + - "if absent, the stored signed prekey is not deleted. " + - "If present, must have a valid signature from the identity key in this request.") + @Schema(description = """ + An optional signed elliptic-curve prekey to use for this device. If present, replaces the stored signed + elliptic-curve prekey for the device; if absent, the stored signed prekey is not deleted. If present, must have a + valid signature from the identity key in this request. + """) private ECSignedPreKey signedPreKey; @JsonProperty @Valid - @Schema(description="A list of signed post-quantum one-time prekeys to use for this device. " + - "Each key must have a valid signature from the identity key in this request. " + - "If present and not empty, replaces all stored unsigned PQ prekeys for the device; " + - "if absent or empty, any stored unsigned PQ prekeys for the device are not deleted.") + @Schema(description = """ + A list of signed post-quantum one-time prekeys to use for this device. Each key must have a valid signature from + the identity key in this request. If present and not empty, replaces all stored unsigned PQ prekeys for the + device; if absent or empty, any stored unsigned PQ prekeys for the device are not deleted. + """) private List<@Valid KEMSignedPreKey> pqPreKeys; @JsonProperty @Valid - @Schema(description="An optional signed last-resort post-quantum prekey to use for this device. " + - "If present, replaces the stored signed post-quantum last-resort prekey for the device; " + - "if absent, a stored last-resort prekey will *not* be deleted. " + - "If present, must have a valid signature from the identity key in this request.") + @Schema(description = """ + An optional signed last-resort post-quantum prekey to use for this device. If present, replaces the stored signed + post-quantum last-resort prekey for the device; if absent, a stored last-resort prekey will *not* be deleted. If + present, must have a valid signature from the identity key in this request. + """) private KEMSignedPreKey pqLastResortPreKey; @JsonProperty @JsonSerialize(using = IdentityKeyAdapter.Serializer.class) @JsonDeserialize(using = IdentityKeyAdapter.Deserializer.class) @NotNull - @Schema(description="Required. " + - "The public identity key for this identity (account or phone-number identity). " + - "If this device is not the primary device for the account, " + - "must match the existing stored identity key for this identity.") + @Schema(description = """ + Required. The public identity key for this identity (account or phone-number identity). If this device is not the + primary device for the account, must match the existing stored identity key for this identity. + """) private IdentityKey identityKey; - public PreKeyState() {} + public PreKeyState() { + } @VisibleForTesting public PreKeyState(IdentityKey identityKey, ECSignedPreKey signedPreKey, List keys) { @@ -68,7 +75,8 @@ public class PreKeyState { } @VisibleForTesting - public PreKeyState(IdentityKey identityKey, ECSignedPreKey signedPreKey, List keys, List pqKeys, KEMSignedPreKey pqLastResortKey) { + public PreKeyState(IdentityKey identityKey, ECSignedPreKey signedPreKey, List keys, + List pqKeys, KEMSignedPreKey pqLastResortKey) { this.identityKey = identityKey; this.signedPreKey = signedPreKey; this.preKeys = keys;