Request our PNI along with group credential fetch

This commit is contained in:
Scott Nonnenberg 2022-07-25 12:12:07 -07:00
parent 41a7327b1f
commit 1062126077

View file

@ -126,12 +126,6 @@ export async function maybeFetchNewCredentials(): Promise<void> {
return;
}
const pni = window.textsecure.storage.user.getUuid(UUIDKind.PNI)?.toString();
if (!pni) {
log.info(`${logId}: no PNI, returning early`);
return;
}
const previous: CredentialsDataType | undefined =
window.storage.get('groupCredentials');
const requestDates = getDatesForRequest(previous);
@ -151,6 +145,13 @@ export async function maybeFetchNewCredentials(): Promise<void> {
`${logId}: fetching credentials for ${startDayInMs} through ${endDayInMs}`
);
// TODO(indutny): In the future we'd like to avoid this extra call all the time
const { pni } = await server.whoami();
if (!pni) {
log.info(`${logId}: no PNI, returning early`);
return;
}
const serverPublicParamsBase64 = window.getServerPublicParams();
const clientZKAuthOperations = getClientZkAuthOperations(
serverPublicParamsBase64