import { TransportInterface } from '../communication-interface/TransportInterface';
import { PersistentTransport } from '../communication-interface/PersistentTransport';
import { ContactManager } from '../contact-management/ContactManager';
import { DBFactory } from '../db/DBFactory';
import { BaseDto } from '../db/DBAccess';
interface ExistingTransportParameterMap {
    'handshake': {
        originalFrom?: string;
        fromPK: string;
        pkSignature: string;
        webRTCAddressBundle: string;
        bootstrapAddress?: string;
    };
    'handshakeResponse': {
        originalFrom?: string;
        fromPK: string;
        pkSignature: string;
        webRTCAddressBundle: string;
    };
}
interface WebRtcTransportParameterMap {
    'connectionEstablished': {
        fromPK: string;
        pkSignature: string;
    };
}
export declare class EcdheAesGcmKeyDto implements BaseDto {
    id: string;
    encryptionKey: string;
    signingKey: string;
    rsaPrivateKey: string;
    rsaPublicKey: string;
    timestamp: number;
    static get dbName(): string;
    constructor(encryptionKey: string, signingKey: string, rsaPrivateKey: string, rsaPublicKey: string);
}
export declare class DhtTransportManager implements TransportInterface {
    private _db;
    private _initPromise;
    private contactManager;
    private existingTransport;
    private existingTransportMessage?;
    private webRTCTransport?;
    private ecdheMessageWebRTCTransport?;
    private rsaOaepAesMessage?;
    private existingMessageAsyncRF?;
    private webRTCAsyncRF?;
    private dhtTransport?;
    private dhtTransportResolver?;
    private dhtTransportPromise;
    constructor(_existingTransport: PersistentTransport, _contactManager: ContactManager, _db: DBFactory);
    getKeyInformation(): Promise<any>;
    getOwnUserId(): Promise<string>;
    requiresBootstrap(): boolean;
    private init;
    bootstrap(): Promise<void>;
    private initDhtTransport;
    getOwnAddress(): Promise<string>;
    addContact(_: string, address: any): Promise<string | void>;
    send(userIdTo: string, message: string): Promise<void>;
    private _webRTCConnectionPromiseResolvers;
    private _webRTCConnectionPromises;
    sendHandshakeRequest(userIdTo: string): Promise<void>;
    onHandshakeRequest(message: {
        from?: string;
        fromPK?: string;
        pkSignature?: string;
        transportAddress?: string;
        hr?: boolean;
    }): Promise<void>;
    connectWebRTC(userId: string): Promise<void>;
    /**
     * Processes a webRTC connection "offer"
     * @param fromId the userId of the party aiming to connect
     * @param otherAddress the webRTC address of the party aiming to connect
     * @returns a message to return to the party aiming to connect
     */
    _r_handshake(fromId: string, { originalFrom, webRTCAddressBundle, bootstrapAddress, fromPK, pkSignature }: ExistingTransportParameterMap['handshake']): Promise<void>;
    _r_handshakeResponse(fromId: string, { originalFrom, fromPK, pkSignature, webRTCAddressBundle }: ExistingTransportParameterMap['handshakeResponse']): Promise<void>;
    _r_connectionEstablished(fromId: string, { fromPK, pkSignature }: WebRtcTransportParameterMap['connectionEstablished']): Promise<void>;
    private _messageCallbacks;
    addMessageListener(listener: ((message: string) => void)): void | Promise<void>;
    private _connectionEstablishedCallbacks;
    addConnectionEstablishedListener(listener: ((userId: string) => void)): void | Promise<void>;
    private onMessage;
    /**
     * get a list of clients directly connected via webRTC
     * @returns the user ids that currently have an established webRTC connection
     */
    getRTCConnectedUsers(): Promise<string[]>;
}
export {};
//# sourceMappingURL=DhtTransportManager.d.ts.map