import { PrivateKey, PublicKey } from '@textile/threads-crypto';
import CID from 'cids';
import { Closer, ThreadKey, LogID, LogInfo, LogRecord, Multiaddr, Network as Interface, ThreadID, ThreadRecord, ThreadInfo, Identity, NewThreadOptions } from '@textile/threads-core';
import { Client } from '@textile/threads-network-client';
import { Datastore } from 'interface-datastore';
import { LogStore } from './store';
/**
 * Network is the Network interface for Thread orchestration.
 */
export declare class Network implements Interface {
    readonly client: Client;
    identity?: Identity | undefined;
    store: LogStore;
    /**
     * Create a new network Network.
     * @param store The store to use for caching keys and log information.
     * @param client A client connected to a remote network peer.
     * @param identity Identity represents an entity with a public key capable of signing a message.
     * @note If an identity is not provided, the a random PKI identity is used. This might not be what you want!
     * It is not easy/possible to migrate identities after the fact. Please supply an identity argument if
     * you wish to persist/retrieve user data later.
     */
    constructor(store: LogStore | Datastore, client: Client, identity?: Identity | undefined);
    /**
     * Obtain a token for interacting with the remote network API. Will attempt to return a cached token if available.
     * @param identity The generic identity to use for signing and validation. Will default to the  identity specified
     * at construction if available, otherwise a new Identity is required here.
     */
    getToken(identity?: Identity | undefined): Promise<string>;
    /**
     * getHostID returns the network's (remote) host peer ID.
     */
    getHostID(): Promise<string>;
    /**
     * createThread with id.
     * This will overwrite any existing thread information.
     * @param id The Thread id.
     * @param opts The set of keys to use when creating the Thread. All keys are "optional", though if no replicator key
     * is provided, one will be created. Similarly, if no log key is provided, then the "host" Peer ID will be used.
     * If no ReadKey is provided, the network will be unable to write records (but it may be able to return records).
     */
    createThread(id: ThreadID, opts?: NewThreadOptions): Promise<ThreadInfo>;
    /**
     * addThread from a multiaddress.
     * @param addr The Thread multiaddress.
     * @param opts The set of keys to use when adding the Thread.
     */
    addThread(addr: Multiaddr, opts?: NewThreadOptions): Promise<ThreadInfo>;
    /**
     * getThread with id.
     * @param id The Thread ID.
     */
    getThread(id: ThreadID): Promise<{
        id: ThreadID;
        logs?: Set<LogInfo> | undefined;
        key?: ThreadKey | undefined;
        addrs?: Set<Multiaddr> | undefined;
    }>;
    /**
     * pullThread for new records.
     * Logs owned by this host are traversed on the (possibly remote) network client. Remotely addressed logs are pulled
     * from the network on the (possible remote) client and forwarded to this peer.
     * @param id The Thread ID.
     */
    pullThread(id: ThreadID): Promise<void>;
    /**
     * deleteThread with id.
     * @param id The Thread ID.
     */
    deleteThread(id: ThreadID): Promise<void>;
    /**
     * addReplicator to a thread.
     * @param id The Thread ID.
     * @param addr The multiaddress of the replicator peer.
     */
    addReplicator(id: ThreadID, addr: Multiaddr): Promise<string>;
    /**
     * createRecord with body.
     * @param id The Thread ID.
     * @param body The body to add as content.
     */
    createRecord(id: ThreadID, body: any): Promise<ThreadRecord>;
    /**
     * addRecord to the given log.
     * @param id The Thread ID.
     * @param logID The Log ID.
     * @param rec The log record to add.
     */
    addRecord(id: ThreadID, logID: LogID, rec: LogRecord): Promise<void>;
    /**
     * getRecord returns the record at cid.
     * @param id The Thread ID.
     * @param rec The record's CID.
     */
    getRecord(id: ThreadID, rec: CID): Promise<LogRecord>;
    /**
     * subscribe to new record events in the given threads.
     * @param cb The callback to call on each new thread record.
     * @param threads The variadic set of threads to subscribe to.
     */
    subscribe(cb: (rec?: ThreadRecord, err?: Error) => void, threads?: ThreadID[]): Closer;
    /**
     * deriveLogKeys returns a set of log keys from the given inputs.
     * @param key Optional public or private log key.
     */
    deriveLogKeys(key?: PublicKey | PrivateKey): Promise<LogInfo>;
    /**
     * getOwnLog returns the local peers log. If the given log does not yet exist and create is true, a new log is
     * created, otherwise (i.e., if create is false), undefined is returned.
     * @param id
     * @param create
     */
    getOwnLog(info: ThreadInfo, create?: true): Promise<LogInfo>;
    getOwnLog(info: ThreadInfo, create?: false): Promise<LogInfo | undefined>;
}
