UNPKG

@fnlb-project/fnbr

Version:

A library to interact with Epic Games' Fortnite HTTP and XMPP services

84 lines (83 loc) 2.8 kB
import { ConversationType } from '../../resources/enums'; import Base from '../Base'; import type { ChatMessagePayload } from '../../resources/structs'; /** * Represent's the client's chat manager (dm, party chat) via eos. */ declare class ChatManager extends Base { /** * DM conversations cache map (account id -> conversation id) */ private dmConversations; /** * The private key for signing messages */ private privateKey?; /** * The public key for verifying messages */ private publicKey?; /** * The public key data registered on epic's servers */ private publicKeyData?; /** * Whether the keypair for message signing exists */ get keypairExists(): boolean; /** * Whether the keypair has been registered on epic's servers */ get keypairRegistered(): boolean; /** * Returns the chat namespace, this is the eos deployment id */ get namespace(): string; /** * Sends a private message to the specified user * @param user the account id or displayname * @param message the message object * @returns the message id * @throws {UserNotFoundError} When the specified user was not found * @throws {EpicgamesAPIError} When the api request failed */ whisperUser(user: string, message: ChatMessagePayload): Promise<string>; /** * Sends a message in the specified conversation (e.g. party chat) * @param conversationId the conversation id, usually `p-[PARTYID]` * @param message the message object * @param allowedRecipients the account ids, that should receive the message * @returns the message id * @throws {EpicgamesAPIError} */ sendMessageInConversation(conversationId: string, message: ChatMessagePayload, allowedRecipients: string[], conversationType: ConversationType): Promise<string>; createDMConversation(recepientId: string, createIfExists?: boolean): Promise<{ conversationId: string; }>; /** * Ensures that message signing is possible */ ensureMessageSigning(): Promise<void>; /** * Resolves the conversation id for a dm with the specified user * @param recepientId The account id of the recepient * @returns The conversation id */ private getDMConversationId; /** * Signs a message for the specified conversation * @param conversationId The conversation id * @param content The message content * @param type The signed message type */ private createSignedMessage; /** * Generates a ed25519 keypair for message signing */ private generateKeypair; /** * Registers the public key on epic's servers */ private registerKeypair; } export default ChatManager;