libsignal,lid-mapping, etc.: Partially fix "No sessions" on hosted JIDs

This commit is contained in:
Rajeh Taher
2025-10-16 18:31:01 +03:00
parent d0feb240fa
commit e41a66b3c4
8 changed files with 37 additions and 30 deletions
+3 -3
View File
@@ -1,7 +1,7 @@
import { LRUCache } from 'lru-cache'
import type { LIDMapping, SignalKeyStoreWithTransaction } from '../Types'
import type { ILogger } from '../Utils/logger'
import { isJidHostedLidUser, isJidHostedPnUser, isLidUser, isPnUser, jidDecode, jidNormalizedUser } from '../WABinary'
import { isHostedLidUser, isHostedPnUser, isLidUser, isPnUser, jidDecode, jidNormalizedUser } from '../WABinary'
export class LIDMappingStore {
private readonly mappingCache = new LRUCache<string, string>({
@@ -93,7 +93,7 @@ export class LIDMappingStore {
// mapped from pn to lid mapping to prevent duplication in results later
const successfulPairs: { [_: string]: LIDMapping } = {}
for (const pn of pns) {
if (!isPnUser(pn)) continue
if (!isPnUser(pn) && !isHostedPnUser(pn)) continue
const decoded = jidDecode(pn)
if (!decoded) continue
@@ -114,7 +114,7 @@ export class LIDMappingStore {
this.logger.trace(`No LID mapping found for PN user ${pnUser}; batch getting from USync`)
const device = decoded.device || 0
let normalizedPn = jidNormalizedUser(pn)
if (isJidHostedLidUser(normalizedPn) || isJidHostedPnUser(normalizedPn)) {
if (isHostedLidUser(normalizedPn) || isHostedPnUser(normalizedPn)) {
normalizedPn = `${pnUser}@s.whatsapp.net`
}