Add PNIs to account creation and `whoami` responses
This commit is contained in:
parent
5164e92538
commit
1dae05651f
|
@ -390,7 +390,10 @@ public class AccountController {
|
||||||
.record(Instant.now().toEpochMilli() - storedVerificationCode.get().getTimestamp(), TimeUnit.MILLISECONDS);
|
.record(Instant.now().toEpochMilli() - storedVerificationCode.get().getTimestamp(), TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new AccountCreationResult(account.getUuid(), account.getNumber(), existingAccount.map(Account::isStorageSupported).orElse(false));
|
return new AccountCreationResult(account.getUuid(),
|
||||||
|
account.getNumber(),
|
||||||
|
account.getPhoneNumberIdentifier().orElse(null),
|
||||||
|
existingAccount.map(Account::isStorageSupported).orElse(false));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Timed
|
@Timed
|
||||||
|
@ -601,7 +604,10 @@ public class AccountController {
|
||||||
@Path("/whoami")
|
@Path("/whoami")
|
||||||
@Produces(MediaType.APPLICATION_JSON)
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
public AccountCreationResult whoAmI(@Auth AuthenticatedAccount auth) {
|
public AccountCreationResult whoAmI(@Auth AuthenticatedAccount auth) {
|
||||||
return new AccountCreationResult(auth.getAccount().getUuid(), auth.getAccount().getNumber(), auth.getAccount().isStorageSupported());
|
return new AccountCreationResult(auth.getAccount().getUuid(),
|
||||||
|
auth.getAccount().getNumber(),
|
||||||
|
auth.getAccount().getPhoneNumberIdentifier().orElse(null),
|
||||||
|
auth.getAccount().isStorageSupported());
|
||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
|
|
|
@ -8,29 +8,25 @@ package org.whispersystems.textsecuregcm.entities;
|
||||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
import org.whispersystems.textsecuregcm.auth.ExternalServiceCredentials;
|
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class AccountCreationResult {
|
public class AccountCreationResult {
|
||||||
|
|
||||||
@JsonProperty
|
|
||||||
private final UUID uuid;
|
private final UUID uuid;
|
||||||
|
|
||||||
@JsonProperty
|
|
||||||
private final String number;
|
private final String number;
|
||||||
|
private final UUID pni;
|
||||||
@JsonProperty
|
|
||||||
private final boolean storageCapable;
|
private final boolean storageCapable;
|
||||||
|
|
||||||
@JsonCreator
|
@JsonCreator
|
||||||
public AccountCreationResult(
|
public AccountCreationResult(
|
||||||
@JsonProperty("uuid") final UUID uuid,
|
@JsonProperty("uuid") final UUID uuid,
|
||||||
@JsonProperty("number") final String number,
|
@JsonProperty("number") final String number,
|
||||||
|
@JsonProperty("pni") final UUID pni,
|
||||||
@JsonProperty("storageCapable") final boolean storageCapable) {
|
@JsonProperty("storageCapable") final boolean storageCapable) {
|
||||||
|
|
||||||
this.uuid = uuid;
|
this.uuid = uuid;
|
||||||
this.number = number;
|
this.number = number;
|
||||||
|
this.pni = pni;
|
||||||
this.storageCapable = storageCapable;
|
this.storageCapable = storageCapable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +38,10 @@ public class AccountCreationResult {
|
||||||
return number;
|
return number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UUID getPni() {
|
||||||
|
return pni;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isStorageCapable() {
|
public boolean isStorageCapable() {
|
||||||
return storageCapable;
|
return storageCapable;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue