/// <reference types="node" />
import { Datastore } from 'interface-datastore';
import { Closer, ThreadID, LogID } from '@textile/threads-core';
import { PrivateKey, PublicKey } from '@textile/threads-crypto';
/**
 * KeyBook stores Thread/Log keys.
 */
export declare class KeyBook implements Closer {
    private datastore;
    constructor(datastore: Datastore<Buffer>);
    /**
     * pubKey retrieves the public key of a log.
     * @param id The Thread ID.
     * @param log The Log ID.
     */
    pubKey(id: ThreadID, log: LogID): Promise<PublicKey | undefined>;
    /**
     * addPubKey adds a public key under a log.
     * @param id The Thread ID.
     * @param log The Log ID.
     * @param pubKey The public key from a symmetric key pair.
     */
    addPubKey(id: ThreadID, log: LogID, pubKey: PublicKey): Promise<void>;
    /**
     * privKey retrieves the private key of a log.
     * @param id The Thread ID.
     * @param log The Log ID.
     */
    privKey(id: ThreadID, log: LogID): Promise<PrivateKey | undefined>;
    /**
     * addPrivKey adds a private key under a log.
     * @param id The Thread ID.
     * @param log The Log ID.
     * @param privKey The private key from a symmetric key pair.
     */
    addPrivKey(id: ThreadID, log: LogID, privKey: PrivateKey): Promise<void>;
    /**
     * readKey retrieves the read key of a log.
     * @param id The Thread ID.
     */
    readKey(id: ThreadID): Promise<Buffer | undefined>;
    /**
     * addReadKey adds a read key under a thread.
     * @param id The Thread ID.
     * @param key The asymmetric read key, of length 44 bytes.
     */
    addReadKey(id: ThreadID, key: Uint8Array): Promise<void>;
    /**
     * serviceKey retrieves the replicator key of a thread.
     */
    serviceKey(id: ThreadID): Promise<Buffer | undefined>;
    /**
     * addServiceKey adds a replicator key under a given thread.
     * @param id The Thread ID.
     * @param key The asymmetric replicator key, of length 44 bytes.
     */
    addServiceKey(id: ThreadID, key: Uint8Array): Promise<void>;
    threads(): Promise<Set<ThreadID>>;
    logs(id: ThreadID): Promise<Set<LogID>>;
    /**
     * clearThreadKeys deletes all keys under a given thread.
     * @param id Thread ID.
     */
    clearThreadKeys(id: ThreadID): Promise<void>;
    /**
     * clearLogKeys deletes all keys under a given log.
     * @param id Thread ID.
     * @param log: Log ID.
     */
    clearLogKeys(id: ThreadID, log: LogID): Promise<void>;
    close(): Promise<void>;
}
