import { PrivateVASP, VASP, CallbackFunction } from "."; import { SessionRequest } from "./messages"; import Web3 from "web3"; import { provider } from "web3-core"; import { SetIntervalAsyncTimer } from "set-interval-async/dynamic"; export default class WhisperTransport { web3: Web3; timers: { [key: string]: SetIntervalAsyncTimer; }; constructor(_provider: provider); private waitForMessage; /** * Wait for Session Requests * * @param originator VASP waiting for session request * @param cb Function to call when SessionRequest message arrives * @returns waitId. Needed to finish listening. */ waitForSessionRequest(originator: PrivateVASP, cb: CallbackFunction): Promise; /** * Wait for Topic Message * * @param topic Topic to listen to * @param sharedKey Shared key previously agreed * @param cb Function to call when message arrives * @returns waitId. Needed to finish listening. */ waitForTopicMessage(topic: string, sharedKey: string, cb: CallbackFunction): Promise; /** * Stop waiting for messages * @param ids */ stopWaiting(_id: string): Promise; /** * Send Session Request Message. * * @param beneficiary BeneficiaryVASP destination of the message * @param sessionRequestMsg SessionRequest message to send * @returns Hash of message */ sendSessionRequest(beneficiary: VASP, sessionRequestMsg: SessionRequest): Promise; /** * Send message to specific topic * * @param topic Topic where to send message * @param sharedKey Shared key previously agreed * @param message Message to send * @returns hash */ sendToTopic(topic: string, sharedKey: string, message: string): Promise; /** * Generate Whisper Keypairs * * The Tools.generateKeyPaid does the same but in pure JS. No Whisper node query. */ newKeyPair(): Promise<{ publicKey: string; privateKey: string; }>; }