@periskope/baileys
Version:
WhatsApp API
47 lines • 2.41 kB
TypeScript
import type { SignalRepository } from '../Types/index.js';
import type { AuthenticationCreds, AuthenticationState, KeyPair, SignalIdentity, SignalKeyStore, SignedKeyPair } from '../Types/Auth.js';
import { type BinaryNode, type JidWithDevice } from '../WABinary/index.js';
import type { USyncQueryResultList } from '../WAUSync/index.js';
export declare const createSignalIdentity: (wid: string, accountSignatureKey: Uint8Array) => SignalIdentity;
export declare const getPreKeys: ({ get }: SignalKeyStore, min: number, limit: number) => Promise<{
[id: string]: KeyPair;
}>;
export declare const generateOrGetPreKeys: (creds: AuthenticationCreds, range: number) => {
newPreKeys: {
[id: number]: KeyPair;
};
lastPreKeyId: number;
preKeysRange: readonly [number, number];
};
export declare const xmppSignedPreKey: (key: SignedKeyPair) => BinaryNode;
export declare const xmppPreKey: (pair: KeyPair, id: number) => BinaryNode;
export declare const parseAndInjectE2ESessions: (node: BinaryNode, repository: SignalRepository) => Promise<void>;
/**
* Fetch prekeys for specified JIDs from WhatsApp servers
* Inspired by whatsmeow's fetchPreKeys implementation
* @param jids Array of JIDs to fetch prekeys for
* @param queryFn Function to send IQ queries to WhatsApp servers
* @param signalRepository Signal repository for session injection
* @param logger Logger instance for debugging
* @returns Promise<boolean> indicating if prekeys were successfully fetched
*/
export declare const fetchPreKeys: (jids: string[], queryFn: (node: BinaryNode) => Promise<BinaryNode>, signalRepository: SignalRepository, logger?: {
debug: (msg: any, extra?: any) => void;
error: (msg: any, extra?: any) => void;
}) => Promise<boolean>;
export declare const extractDeviceJids: (result: USyncQueryResultList[], myJid: string, excludeZeroDevices: boolean) => JidWithDevice[];
/**
* get the next N keys for upload or processing
* @param count number of pre-keys to get or generate
*/
export declare const getNextPreKeys: ({ creds, keys }: AuthenticationState, count: number) => Promise<{
update: Partial<AuthenticationCreds>;
preKeys: {
[id: string]: KeyPair;
};
}>;
export declare const getNextPreKeysNode: (state: AuthenticationState, count: number) => Promise<{
update: Partial<AuthenticationCreds>;
node: BinaryNode;
}>;
//# sourceMappingURL=signal.d.ts.map