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