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/signal.d.ts
1129 views
1
/// <reference types="node" />
2
import { proto } from '../../WAProto';
3
import { AuthenticationCreds, AuthenticationState, KeyPair, SignalAuthState, SignalIdentity, SignalKeyStore, SignedKeyPair } from '../Types/Auth';
4
import { BinaryNode, JidWithDevice } from '../WABinary';
5
export declare const jidToSignalProtocolAddress: (jid: string) => any;
6
export declare const jidToSignalSenderKeyName: (group: string, user: string) => string;
7
export declare const createSignalIdentity: (wid: string, accountSignatureKey: Uint8Array) => SignalIdentity;
8
export declare const getPreKeys: ({ get }: SignalKeyStore, min: number, limit: number) => Promise<{
9
[id: string]: KeyPair;
10
}>;
11
export declare const generateOrGetPreKeys: (creds: AuthenticationCreds, range: number) => {
12
newPreKeys: {
13
[id: number]: KeyPair;
14
};
15
lastPreKeyId: number;
16
preKeysRange: readonly [number, number];
17
};
18
export declare const xmppSignedPreKey: (key: SignedKeyPair) => BinaryNode;
19
export declare const xmppPreKey: (pair: KeyPair, id: number) => BinaryNode;
20
export declare const signalStorage: ({ creds, keys }: SignalAuthState) => {
21
loadSession: (id: string) => Promise<any>;
22
storeSession: (id: any, session: any) => Promise<void>;
23
isTrustedIdentity: () => boolean;
24
loadPreKey: (id: number | string) => Promise<{
25
privKey: Buffer;
26
pubKey: Buffer;
27
} | undefined>;
28
removePreKey: (id: number) => void | Promise<void>;
29
loadSignedPreKey: () => {
30
privKey: Buffer;
31
pubKey: Buffer;
32
};
33
loadSenderKey: (keyId: string) => Promise<any>;
34
storeSenderKey: (keyId: any, key: any) => Promise<void>;
35
getOurRegistrationId: () => number;
36
getOurIdentity: () => {
37
privKey: Buffer;
38
pubKey: Buffer | Uint8Array;
39
};
40
};
41
export declare const decryptGroupSignalProto: (group: string, user: string, msg: Buffer | Uint8Array, auth: SignalAuthState) => any;
42
export declare const processSenderKeyMessage: (authorJid: string, item: proto.Message.ISenderKeyDistributionMessage, auth: SignalAuthState) => Promise<void>;
43
export declare const decryptSignalProto: (user: string, type: 'pkmsg' | 'msg', msg: Buffer | Uint8Array, auth: SignalAuthState) => Promise<Buffer>;
44
export declare const encryptSignalProto: (user: string, buffer: Buffer, auth: SignalAuthState) => Promise<{
45
type: string;
46
ciphertext: Buffer;
47
}>;
48
export declare const encryptSenderKeyMsgSignalProto: (group: string, data: Uint8Array | Buffer, meId: string, auth: SignalAuthState) => Promise<{
49
ciphertext: Uint8Array;
50
senderKeyDistributionMessageKey: Buffer;
51
}>;
52
export declare const parseAndInjectE2ESessions: (node: BinaryNode, auth: SignalAuthState) => Promise<void>;
53
export declare const extractDeviceJids: (result: BinaryNode, myJid: string, excludeZeroDevices: boolean) => JidWithDevice[];
54
/**
55
* get the next N keys for upload or processing
56
* @param count number of pre-keys to get or generate
57
*/
58
export declare const getNextPreKeys: ({ creds, keys }: AuthenticationState, count: number) => Promise<{
59
update: Partial<AuthenticationCreds>;
60
preKeys: {
61
[id: string]: KeyPair;
62
};
63
}>;
64
export declare const getNextPreKeysNode: (state: AuthenticationState, count: number) => Promise<{
65
update: Partial<AuthenticationCreds>;
66
node: BinaryNode;
67
}>;
68
69