import { Logger } from '@evan.network/dbcp';
import { Container, ContainerConfig, ContainerOptions } from './container';
import { Profile } from '../../profile/profile';
/**
 * possible entry types for entries in index
 */
export declare enum DigitalIdentityEntryType {
    AccountId = 0,
    ContainerContract = 1,
    FileHash = 2,
    GenericContract = 3,
    Hash = 4,
    IndexContract = 5,
}
/**
 * config for digital identity
 */
export interface DigitalIdentityConfig {
    /** account id of user, that interacts with digital identity */
    accountId: string;
    /** address of a ``DigitalIdentity`` instance, can be ENS or contract address */
    containerConfig: ContainerConfig;
    /** address of a ``DigitalIdentity`` instance, can be ENS or contract address */
    address?: string;
    /** description has to be passed to ``.create`` to apply it to to contract */
    description?: any;
    /** factory address can be passed to ``.create`` for customer digital identity factory*/
    factoryAddress?: string;
}
/**
 * container for digital identity entry values
 */
export interface DigitalIdentityIndexEntry {
    /** type of entry in index */
    entryType?: DigitalIdentityEntryType;
    /** raw value (``bytes32`` hash) */
    raw?: any;
    /** decrypted/loaded value */
    value?: any;
}
/**
 * data for verifications for digital identities
 */
export interface DigitalIdentityVerificationEntry {
    /** name of the verification (full path) */
    topic: string;
    /** domain of the verification, this is a subdomain under 'verifications.evan', so passing 'example' will link verifications */
    descriptionDomain?: string;
    /** if true, verifications created under  this path are invalid, defaults to ``false`` */
    disableSubverifications?: boolean;
    /** expiration date, for the verification, defaults to `0` (does not expire) */
    expirationDate?: number;
    /** json object which will be stored in the verification */
    verificationValue?: string;
}
/**
 * options for DigitalIdentity constructor (uses same properties as ContainerOptions)
 */
export interface DigitalIdentityOptions extends ContainerOptions {
    profile: Profile;
}
/**
 * helper class for managing digital identities
 *
 * @class      DigitalIdentity (name)
 */
export declare class DigitalIdentity extends Logger {
    static defaultDescription: {
        name: string;
        description: string;
        author: string;
        version: string;
        dbcpVersion: number;
    };
    private config;
    private contract;
    private options;
    private mutexes;
    /**
     * Create digital identity contract.
     *
     * @param      {DigitalIdentityOptions}  options  identity runtime options
     * @param      {DigitalIdentityConfig}   config   configuration for the new identity instance
     */
    static create(options: DigitalIdentityOptions, config: DigitalIdentityConfig): Promise<DigitalIdentity>;
    /**
     * Gets bookmarked identities from profile.
     *
     * @param      {DigitalIdentityOptions}  options  identity runtime options
     */
    static getFavorites(options: DigitalIdentityOptions): Promise<Array<string>>;
    /**
     * Check if a valid contract is located under the specified address, which allows to check for
     * identities before actually loading them.
     *
     * @param      {DigitalIdentityOptions}  options     identity runtime options
     * @param      {string}                  ensAddress  ens address that should be checked
     */
    static getValidity(options: DigitalIdentityOptions, ensAddress: string): Promise<{
        valid: boolean;
        exists: boolean;
        error: Error;
    }>;
    /**
     * Create new DititalIdentity instance. This will not create a smart contract contract but is used
     * to load existing containers. To create a new contract, use the static ``create`` function.
     *
     * @param      {DigitalIdentityOptions}  options  runtime-like object with required modules
     * @param      {DigitalIdentityConfig}   config   digital identity related config
     */
    constructor(options: DigitalIdentityOptions, config: DigitalIdentityConfig);
    /**
     * Add the digital identity with given address to profile.
     */
    addAsFavorite(): Promise<void>;
    /**
     * Add verifications to this identity; this will also add verifications to contract description
     *
     * @param      {DigitalIdentityVerificationEntry[]}  verifications  list of verifications to add
     */
    addVerifications(verifications: DigitalIdentityVerificationEntry[]): Promise<void>;
    /**
     * Create new `Container` instances and add them as entry to identity.
     *
     * @param      {{ [id: string]: Partial<ContainerConfig> }}  containers  object with containers to
     *                                                                       create, name is used as
     *                                                                       entry name in identity
     */
    createContainers(containers: {
        [id: string]: Partial<ContainerConfig>;
    }): Promise<{
        [id: string]: Container;
    }>;
    /**
     * Check if digital identity contract already has been loaded, load from address / ENS if required
     * and throw an error, when no contract exists or the description doesn't match the identity
     * specifications.
     */
    ensureContract(): Promise<void>;
    /**
     * Get contract address of underlying IndexContract.
     */
    getContractAddress(): Promise<string>;
    /**
     * Returns description from digital identity.
     */
    getDescription(): Promise<any>;
    /**
     * Get all entries from index contract.
     */
    getEntries(): Promise<{
        [id: string]: DigitalIdentityIndexEntry;
    }>;
    /**
     * Get single entry from index contract.
     *
     * @param      {string}  name    entry name
     */
    getEntry(name: string): Promise<DigitalIdentityIndexEntry>;
    /**
     * Gets verifications from description and fetches list of verifications for each of them.
     */
    getVerifications(): Promise<any[]>;
    /**
     * Check if this digital identity is bookmarked in profile.
     */
    isFavorite(): Promise<boolean>;
    /**
     * Removes the current identity from the favorites in profile.
     */
    removeFromFavorites(): Promise<void>;
    /**
     * Write given description to digital identities DBCP.
     *
     * @param      {any}  description  description to set (`public` part)
     */
    setDescription(description: any): Promise<void>;
    /**
     * Set multiple entries at index contract.
     *
     * @param      {{[id: string]: DigitalIdentityIndexEntry}}  entries  entries to set
     */
    setEntries(entries: {
        [id: string]: DigitalIdentityIndexEntry;
    }): Promise<void>;
    /**
     * Set entry in index contract; entries are unique, setting the same name a second time will
     * overwrite the first value.
     *
     * @param      {string}                    name       entry name
     * @param      {string}                    value      value to set
     * @param      {DigitalIdentityEntryType}  entryType  type of given value
     */
    setEntry(name: string, value: string | Container, entryType: DigitalIdentityEntryType): Promise<void>;
    /**
     * get mutex for keyword, this can be used to lock several sections during updates
     *
     * @param      {string}  name    name of a section; e.g. 'sharings', 'schema'
     * @return     {Mutex}   Mutex instance
     */
    private getMutex(name);
    /**
     * add type and value from raw value to entry
     *
     * @param      {DigitalIdentityIndexEntry}  entry   The entry
     */
    private processEntry(entry);
}
