import type { APIClient } from '@wireapp/api-client/lib/APIClient'; import type { PreKey, Context } from '@wireapp/api-client/lib/auth'; import { NewConversation, QualifiedOTRRecipients, QualifiedUserClients } from '@wireapp/api-client/lib/conversation'; import type { ConversationOtrMessageAddEvent } from '@wireapp/api-client/lib/event'; import type { QualifiedId, QualifiedUserPreKeyBundleMap } from '@wireapp/api-client/lib/user'; import { CRUDEngine } from '@wireapp/store-engine'; import { CryptoClient } from './CryptoClient'; import type { AddUsersToProteusConversationParams, ProteusServiceConfig, SendProteusMessageParams } from './ProteusService.types'; import { ProteusCreateConversationResponse, SendResult, ProteusAddUsersResponse } from '../../../conversation'; import { HandledEventPayload } from '../../../notification'; export type EncryptionResult = { /** the encrypted payloads for the clients that have a valid sessions */ payloads: QualifiedOTRRecipients; /** user-client that do not have prekeys on backend (deleted clients) */ unknowns?: QualifiedUserClients; /** users for whom we could retrieve a prekey and, thus, for which we could not encrypt the message */ failed?: QualifiedId[]; }; export declare class ProteusService { private readonly apiClient; private readonly cryptoClient; private readonly config; private readonly storeEngine; private readonly messageService; private readonly logger; private readonly dbName; constructor(apiClient: APIClient, cryptoClient: CryptoClient, config: ProteusServiceConfig, storeEngine: CRUDEngine); handleOtrMessageAddEvent(event: ConversationOtrMessageAddEvent): Promise; initClient(context: Context): Promise; createClient(entropy?: Uint8Array): Promise; /** * Get the fingerprint of the local client. */ getLocalFingerprint(): Promise; constructSessionId(userId: QualifiedId, clientId: string): string; /** * Get the fingerprint of a remote client * @param userId ID of user * @param clientId ID of client * @param prekey A prekey can be given to create a session if it doesn't already exist. * If not provided and the session doesn't exists it will fetch a new prekey from the backend */ getRemoteFingerprint(userId: QualifiedId, clientId: string, prekey?: PreKey): Promise; createConversation(conversationData: NewConversation): Promise; /** * Tries to add all the given users to the given conversation. * If some users are not reachable, it will try to add the remaining users and list them in the `failedToAdd` property of the response. */ addUsersToConversation({ conversationId, qualifiedUsers, }: AddUsersToProteusConversationParams): Promise; sendMessage({ userIds, conversationId, nativePush, targetMode, payload, onClientMismatch, }: SendProteusMessageParams): Promise; decrypt(encryptedText: Uint8Array, userId: QualifiedId, clientId: string): Promise; consumePrekey(): Promise; deleteSession(userId: QualifiedId, clientId: string): Promise; encrypt(plainText: Uint8Array, recipients: QualifiedUserPreKeyBundleMap | QualifiedUserClients): Promise; wipe(): Promise; } //# sourceMappingURL=ProteusService.d.ts.map