Path: blob/master/node_modules/@adiwajshing/baileys/lib/Utils/chat-utils.d.ts
1129 views
/// <reference types="node" />1import type { Logger } from 'pino';2import { proto } from '../../WAProto';3import { BaileysEventEmitter, ChatModification, ChatMutation, Contact, InitialAppStateSyncOptions, LTHashState, WAPatchCreate, WAPatchName } from '../Types';4import { BinaryNode } from '../WABinary';5declare type FetchAppStateSyncKey = (keyId: string) => Promise<proto.Message.IAppStateSyncKeyData> | proto.Message.IAppStateSyncKeyData;6export declare const newLTHashState: () => LTHashState;7export declare const encodeSyncdPatch: ({ type, index, syncAction, apiVersion, operation }: WAPatchCreate, myAppStateKeyId: string, state: LTHashState, getAppStateSyncKey: FetchAppStateSyncKey) => Promise<{8patch: proto.ISyncdPatch;9state: LTHashState;10}>;11export declare const decodeSyncdMutations: (msgMutations: (proto.ISyncdMutation | proto.ISyncdRecord)[], initialState: LTHashState, getAppStateSyncKey: FetchAppStateSyncKey, onMutation: (mutation: ChatMutation) => void, validateMacs: boolean) => Promise<{12hash: Buffer;13indexValueMap: {14[indexMacBase64: string]: {15valueMac: Buffer | Uint8Array;16};17};18}>;19export declare const decodeSyncdPatch: (msg: proto.ISyncdPatch, name: WAPatchName, initialState: LTHashState, getAppStateSyncKey: FetchAppStateSyncKey, onMutation: (mutation: ChatMutation) => void, validateMacs: boolean) => Promise<{20hash: Buffer;21indexValueMap: {22[indexMacBase64: string]: {23valueMac: Buffer | Uint8Array;24};25};26}>;27export declare const extractSyncdPatches: (result: BinaryNode) => Promise<{28critical_block: {29patches: proto.ISyncdPatch[];30hasMorePatches: boolean;31snapshot?: proto.ISyncdSnapshot | undefined;32};33critical_unblock_low: {34patches: proto.ISyncdPatch[];35hasMorePatches: boolean;36snapshot?: proto.ISyncdSnapshot | undefined;37};38regular_high: {39patches: proto.ISyncdPatch[];40hasMorePatches: boolean;41snapshot?: proto.ISyncdSnapshot | undefined;42};43regular_low: {44patches: proto.ISyncdPatch[];45hasMorePatches: boolean;46snapshot?: proto.ISyncdSnapshot | undefined;47};48regular: {49patches: proto.ISyncdPatch[];50hasMorePatches: boolean;51snapshot?: proto.ISyncdSnapshot | undefined;52};53}>;54export declare const downloadExternalBlob: (blob: proto.IExternalBlobReference) => Promise<Buffer>;55export declare const downloadExternalPatch: (blob: proto.IExternalBlobReference) => Promise<proto.SyncdMutations>;56export declare const decodeSyncdSnapshot: (name: WAPatchName, snapshot: proto.ISyncdSnapshot, getAppStateSyncKey: FetchAppStateSyncKey, minimumVersionNumber: number | undefined, onMutation?: ((mutation: ChatMutation) => void) | undefined, validateMacs?: boolean) => Promise<{57state: LTHashState;58}>;59export declare const decodePatches: (name: WAPatchName, syncds: proto.ISyncdPatch[], initial: LTHashState, getAppStateSyncKey: FetchAppStateSyncKey, onMutation: (mut: ChatMutation) => void, minimumVersionNumber?: number, logger?: Logger, validateMacs?: boolean) => Promise<{60newMutations: ChatMutation[];61state: LTHashState;62}>;63export declare const chatModificationToAppPatch: (mod: ChatModification, jid: string) => WAPatchCreate;64export declare const processSyncAction: (syncAction: ChatMutation, ev: BaileysEventEmitter, me: Contact, initialSyncOpts?: InitialAppStateSyncOptions, logger?: Logger) => void;65export {};666768