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