Include ACI+Access Keys pairs with CDSI requests

This commit is contained in:
Fedor Indutny 2022-08-18 13:44:53 -07:00 committed by GitHub
parent 13046dc020
commit 757af2cbbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 145 additions and 144 deletions

View file

@ -13,6 +13,7 @@ import { HTTPError } from '../textsecure/Errors';
import { showToast } from './showToast';
import { strictAssert } from './assert';
import type { UUIDFetchStateKeyType } from './uuidFetchState';
import { getUuidsForE164s } from './getUuidsForE164s';
export type LookupConversationWithoutUuidActionsType = Readonly<{
lookupConversationWithoutUuid: typeof lookupConversationWithoutUuid;
@ -62,19 +63,22 @@ export async function lookupConversationWithoutUuid(
const { showUserNotFoundModal, setIsFetchingUUID } = options;
setIsFetchingUUID(identifier, true);
const { messaging } = window.textsecure;
if (!messaging) {
throw new Error('messaging is not available!');
const { server } = window.textsecure;
if (!server) {
throw new Error('server is not available!');
}
try {
let conversationId: string | undefined;
if (options.type === 'e164') {
const serverLookup = await messaging.getUuidsForE164s([options.e164]);
const serverLookup = await getUuidsForE164s(server, [options.e164]);
if (serverLookup[options.e164]) {
const maybePair = serverLookup.get(options.e164);
if (maybePair) {
const convo = window.ConversationController.maybeMergeContacts({
aci: serverLookup[options.e164] || undefined,
aci: maybePair.aci,
pni: maybePair.pni,
e164: options.e164,
reason: 'startNewConversationWithoutUuid(e164)',
});