Convert RegistrationLock to a record

This commit is contained in:
Jon Chambers
2025-10-22 08:38:11 -04:00
committed by Jon Chambers
parent 342c8a1b28
commit 88d458cf79
2 changed files with 2 additions and 20 deletions

View File

@@ -177,7 +177,7 @@ public class AccountController {
@Produces(MediaType.APPLICATION_JSON)
@Path("/registration_lock")
public void setRegistrationLock(@Auth AuthenticatedDevice auth, @NotNull @Valid RegistrationLock accountLock) {
final SaltedTokenHash credentials = SaltedTokenHash.generateFor(accountLock.getRegistrationLock());
final SaltedTokenHash credentials = SaltedTokenHash.generateFor(accountLock.registrationLock());
final Account account = accounts.getByAccountIdentifier(auth.accountIdentifier())
.orElseThrow(() -> new WebApplicationException(Status.UNAUTHORIZED));

View File

@@ -6,26 +6,8 @@
package org.whispersystems.textsecuregcm.entities;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.annotations.VisibleForTesting;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.Size;
public class RegistrationLock {
@JsonProperty
@Size(min=64, max=64)
@NotEmpty
private String registrationLock;
public RegistrationLock() {}
@VisibleForTesting
public RegistrationLock(String registrationLock) {
this.registrationLock = registrationLock;
}
public String getRegistrationLock() {
return registrationLock;
}
public record RegistrationLock(@JsonProperty @Size(min = 64, max = 64) @NotEmpty String registrationLock) {
}