/**
 * The TransportInterface is meant for communication to a different browser. 
 * This interface offers no guarantees about security or reliability.
 */
export interface TransportInterface {

    /**
     * @returns the data required to address the current user
     */
    getOwnAddress(): Promise<string>;

    /**
     * Adds a contact to send messages to
     * @param userId the id of the user to send to
     * @param address the data required to address the user
     */
    addContact(userId: string, address: any): Promise<void | string>;

    send(userIdTo: string, message: string): Promise<void>;
    addMessageListener(listener: (payload: any) => void): void | Promise<void>;

    /**
     * indicates, if a connection bootstrapping using a different transport is required
     * setting this to false causes the encryption layer to automatically call the getOwnAddress method and pass it to the addContact method on the other side
     * this allows for establishing a two-way connection in one message over an encrypted connection
     * If this is set to true, the user has to manually bootstrap the connection using a different transport
     */
    requiresBootstrap(): boolean;
}