Add: LID support with lid-map and migrations of sessions (#1694)
* fix: add lid-map logic * fix: lint and simplified version * fix: single device migration * fix: lid map discovery * fix: lint * fix: lid migration in socket connection * fix: lint * fix: decode-wa-message consistency * fix: yarn lock * fix: lint * fix: retry logic * fix: logger level
This commit is contained in:
@@ -72,6 +72,7 @@ export type SignalDataTypeMap = {
|
||||
'sender-key-memory': { [jid: string]: boolean }
|
||||
'app-state-sync-key': proto.Message.IAppStateSyncKeyData
|
||||
'app-state-sync-version': LTHashState
|
||||
'lid-mapping': string
|
||||
}
|
||||
|
||||
export type SignalDataSet = { [T in keyof SignalDataTypeMap]?: { [id: string]: SignalDataTypeMap[T] | null } }
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { proto } from '../../WAProto/index.js'
|
||||
import type { LIDMappingStore } from '../Signal/lid-mapping'
|
||||
|
||||
type DecryptGroupSignalOpts = {
|
||||
group: string
|
||||
@@ -22,6 +23,12 @@ type EncryptMessageOpts = {
|
||||
data: Uint8Array
|
||||
}
|
||||
|
||||
type EncryptMessageWithWireOpts = {
|
||||
encryptionJid: string // JID used for session lookup (LID)
|
||||
wireJid: string // JID used for envelope (PN)
|
||||
data: Uint8Array
|
||||
}
|
||||
|
||||
type EncryptGroupMessageOpts = {
|
||||
group: string
|
||||
data: Uint8Array
|
||||
@@ -57,10 +64,21 @@ export type SignalRepository = {
|
||||
type: 'pkmsg' | 'msg'
|
||||
ciphertext: Uint8Array
|
||||
}>
|
||||
encryptMessageWithWire(opts: EncryptMessageWithWireOpts): Promise<{
|
||||
type: 'pkmsg' | 'msg'
|
||||
ciphertext: Uint8Array
|
||||
wireJid: string // Return the wire JID for envelope
|
||||
}>
|
||||
encryptGroupMessage(opts: EncryptGroupMessageOpts): Promise<{
|
||||
senderKeyDistributionMessage: Uint8Array
|
||||
ciphertext: Uint8Array
|
||||
}>
|
||||
injectE2ESession(opts: E2ESessionOpts): Promise<void>
|
||||
jidToSignalProtocolAddress(jid: string): string
|
||||
storeLIDPNMapping(lid: string, pn: string): Promise<void>
|
||||
getLIDMappingStore(): LIDMappingStore
|
||||
migrateSession(fromJid: string, toJid: string): Promise<void>
|
||||
validateSession(jid: string): Promise<{ exists: boolean; reason?: string }>
|
||||
deleteSession(jid: string): Promise<void>
|
||||
destroy(): void
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user