import { AccountStore, ContractLoader, Description, Executor, Logger, LoggerOptions, NameResolver, DfsInterface } from '@evan.network/dbcp';
export declare enum VerificationsStatus {
    /**
     * issued by a non-issuer parent verification holder, self issued state is 0
     */
    Issued = 0,
    /**
     * issued by a non-issuer parent verification holder, self issued state is 0
     */
    Confirmed = 1,
    /**
     * verification rejected status
     */
    Rejected = 2
}
export interface VerificationsOptions extends LoggerOptions {
    accountStore: AccountStore;
    config: any;
    contractLoader: ContractLoader;
    description: Description;
    dfs: DfsInterface;
    executor: Executor;
    nameResolver: NameResolver;
    storage?: string;
}
/**
 * Verifications helper
 *
 * @class      Verifications (name)
 */
export declare class Verifications extends Logger {
    cachedIdentities: any;
    contracts: any;
    encodingEnvelope: string;
    options: VerificationsOptions;
    subjectTypes: any;
    /**
     * check if currently the storage is ensuring, if yes, dont run it twice
     */
    storageEnsuring: Promise<any>;
    /**
     * backup already loaded verification descriptions
     */
    verificationDescriptions: any;
    /**
     * cache all the verifications using an object of promises, to be sure, that the verification is
     * loaded only once
     */
    verificationCache: any;
    /**
     * cache all the ens owners
     */
    ensOwners: any;
    constructor(options: VerificationsOptions);
    /**
     * Takes an array of verifications and combines all the states for one quick view.
     *
     * {
     *   verifications: verifications,
     *   creationDate: null,
     *   displayName: topic.split('/').pop() || 'evan',
     *   loading: verifications.filter(verification => verification.loading).length > 0,
     *   name: topic,
     *   status: -1,
     *   subjects: [ ],
     *   warnings: [ ], // have a look at getNestedVerifications
     * }
     *
     * @param      {string}      topic          topic of all the verifications
     * @param      {Array<any>}  verifications  all verifications of a specific topic
     * @return     {any}         computed verification including latest creationDate, combined color,
     *                           displayName
     */
    computeVerifications(topic: string, verifications: Array<any>): Promise<any>;
    /**
     * confirms a verification; this can be done, if a verification has been issued for a subject and
     * the subject wants to confirm it
     *
     * @param      {string}   accountId       account, that performs the action
     * @param      {string}   subject         verification subject
     * @param      {string}   verificationId  id of a verification to confirm
     * @param      {boolean}  isIdentity      (optional): ``true`` if given ``subject`` is an
     *                                        identity, defaults to ``false``
     * @return     {Promise<void>}  resolved when done
     */
    confirmVerification(accountId: string, subject: string, verificationId: string, isIdentity?: boolean): Promise<void>;
    /**
     * Creates a new identity for account or contract and registers them on the storage. Returned
     * identity is either a 40B contract address (for account identities) or a 32B idenity hash
     * contract identities
     *
     * @param      {string}  accountId          account that runs transaction, receiver of identity
     *                                          when omitting the other arguments
     * @param      {string}  contractId         (optional) contract address to create the identity
     *                                          for, creates account identity for ``accountId`` if
     *                                          omitted
     * @param      {bool}    updateDescription  (optional) update description of contract, defaults to
     *                                          ``true``
     * @param      {bool}    linkContract       link contract address to its idenity
     * @return     {Promise<string>}  new identity (40Bytes for accounts, 32Bytes for other)
     */
    createIdentity(accountId: string, contractId?: string, updateDescription?: boolean, linkContract?: boolean): Promise<string>;
    /**
     * Delete a single entry from the verification cache object using subject and topic
     *
     * @param      {string}  subject  the subject that should be removed
     * @param      {string}  topic    the topic that should be removed
     * @return     {void}
     */
    deleteFromVerificationCache(subject: string, topic: string): void;
    /**
     * delete a verification. This requires the accountId to have permissions for the parent
     * verification (if verification name seen as a path, the parent 'folder'). Subjects of a
     * verification may only delete it, if they are the issuer as well. If not, they can only react to
     * it by confirming or rejecting the verification.
     *
     * @param      {string}   accountId       account, that performs the action
     * @param      {string}   subject         the subject of the verification
     * @param      {string}   verificationId  id of a verification to delete
     * @param      {boolean}  isIdentity      (optional): ``true`` if given ``subject`` is an
     *                                        identity, defaults to ``false``
     * @return     {Promise<void>}  resolved when done
     */
    deleteVerification(accountId: string, subject: string, verificationId: string, isIdentity?: boolean): Promise<void>;
    /**
     * Gets and sets the default description for a verification if it does not exists.
     *
     * @param      {any}     verification  the verification that should be checked
     */
    ensureVerificationDescription(verification: any): Promise<void>;
    /**
     * Loads a list of verifications for a topic and a subject and combines to a single view for a
     * simple verification status check.
     *
     * @param      {string}   subject     subject, that performs the description loading
     * @param      {string}   topic       topic of all the verifications
     * @param      {boolean}  isIdentity  optional indicates if the subject is already a identity
     * @return     {any}      computed verification including latest creationDate, combined color,
     *                        displayName
     */
    getComputedVerification(subject: string, topic: string, isIdentity?: boolean): Promise<any>;
    /**
     * gets the identity contract for a given account id or contract
     *
     * @param      {string}        subject      the subject for the identity contract
     * @param      {boolean}       onlyAddress  should only the identity address
     * @return     {Promise<any>}  the identity contract instance
     */
    getIdentityForAccount(subject: string, onlyAddress?: boolean): Promise<any>;
    /**
     * Get all the verifications for a specific subject.
     *
     * @param      {string}      subject     subject to load the verifications for.
     * @param      {string}      topic       topic to load the verifications for.
     * @param      {boolean}     isIdentity  optional indicates if the subject is already a identity
     * @return     {Promise<Array<any>>}  all the verifications with the following properties.
     *   {
     *     id: '...',
     *     // creator of the verification
     *     issuer: '0x1813587e095cDdfd174DdB595372Cb738AA2753A',
     *     // topic of the verification
     *     name: '/company/b-s-s/employee/swo',
     *     // -1: Not issued => no verification was issued
     *     // 0: Issued => status = 0, warning.length > 0
     *     // 1: Confirmed => issued by both, self issued state is 2, values match
     *     // 2: Rejected => reject by the creator / subject
     *     status: 2,
     *     // verification for account id / contract id
     *     subject: subject,
     *     // ???
     *     value: '',
     *     // ???
     *     uri: '',
     *     // ???
     *     signature: ''
     *     // icon for cards display
     *     icon: 'icon to display',
     *     // if the verification was rejected, a reject reason could be applied
     *     rejectReason: '' || { },
     *     // subjec type
     *     subjectType: 'account' || 'contract',
     *     // if it's a contract, it can be an contract
     *     subjectOwner: 'account' || 'contract',
     *     // warnings
     *     [
     *       // parent verification does not allow subverifications
     *       'disableSubVerifications',
     *       // verification has expired
     *       'expired',
     *       // signature does not match requirements, this could be because it hasn't been signed by
     *       // correct account or underlying checksum does not match
     *       // ``subject``, ``topic`` and ``data``
     *       'invalid',
     *       // verification has been issued, but not accepted or rejected by subject
     *       'issued',
     *       // verification has not been issued
     *       'missing',
     *       // given subject has no identity
     *       'noIdentity',
     *       // verification path has a trusted root verification topic, but this verification is not
     *       // signed by a trusted instance
     *       'notEnsRootOwner',
     *       // parent verification is missing in path
     *       'parentMissing',
     *       // verification path cannot be traced back to a trusted root verification
     *       'parentUntrusted',
     *       // verification has been issued and then rejected by subject
     *       'rejected',
     *       // verification issuer is the same account as the subject
     *       'selfIssued',
     *     ],
     *     parents: [ ... ],
     *     parentComputed: [ ... ]
     *   }
     */
    getNestedVerifications(subject: string, topic: string, isIdentity?: boolean): Promise<any>;
    /**
     * Map the topic of a verification to it's default ens domain
     *
     * @param      {string}  topic   the verification name / topic
     * @return     {string}  The verification ens address
     */
    getVerificationEnsAddress(topic: string): string;
    /**
     * gets verification information for a verification name from a given account; results has the
     * following properties: creationBlock, creationDate, data, description, expired, expirationDate,
     * id, issuer, name, signature, status, subject, topic, uri, valid
     *
     * @param      {string}          subject     subject of the verifications
     * @param      {string}          topic       name (/path) of a verification
     * @param      {boolean}         isIdentity  (optional) indicates if the subject is already an
     *                                           identity
     * @return     {Promise<any[]>}  verification info array
     */
    getVerifications(subject: string, topic: string, isIdentity?: boolean): Promise<any[]>;
    /**
     * checks if a account has already a identity contract
     *
     * @param      {string}            subject  the target subject
     * @return     {Promise<boolean>}  true if identity exists, otherwise false
     */
    identityAvailable(subject: string): Promise<any>;
    /**
     * reject a Verification. This verification will be marked as rejected but not deleted. This is
     * important for tracking reasons. You can also optionally add a reject reason as JSON object to
     * track additional informations about the rejection. Issuer and Subject can reject a special
     * verification.
     *
     * @param      {string}         accountId       account, that performs the action
     * @param      {string}         subject         account, that rejects the verification
     * @param      {string}         verificationId  id of a verification to reject
     * @param      {any}            rejectReason    (optional) rejectReason object
     * @return     {Promise<void>}  resolved when done
     */
    rejectVerification(accountId: string, subject: string, verificationId: string, rejectReason?: any, isIdentity?: boolean): Promise<void>;
    /**
     * Sets or creates a verification; this requires the issuer to have permissions for the parent
     * verification (if verification name seen as a path, the parent 'folder').
     *
     * @param      {string}           issuer                   issuer of the verification
     * @param      {string}           subject                  subject of the verification and the
     *                                                         owner of the verification node
     * @param      {string}           topic                    name of the verification (full path)
     * @param      {number}           expirationDate           expiration date, for the verification,
     *                                                         defaults to `0` (≈does not expire)
     * @param      {any}              verificationValue        json object which will be stored in the
     *                                                         verification
     * @param      {string}           descriptionDomain        domain of the verification, this is a
     *                                                         subdomain under 'verifications.evan',
     *                                                         so passing 'example' will link
     *                                                         verifications description to
     *                                                         'example.verifications.evan'
     * @param      {boolean}          disabelSubVerifications  if true, verifications created under
     *                                                         this path are invalid
     * @return     {Promise<string>}  verificationId
     */
    setVerification(issuer: string, subject: string, topic: string, expirationDate?: number, verificationValue?: any, descriptionDomain?: string, disabelSubVerifications?: boolean, isIdentity?: boolean): Promise<string>;
    /**
     * set description for a verification under a domain owned by given account
     *
     * @param      {string}  accountId    accountId, that performs the description update
     * @param      {string}  topic        name of the verification (full path) to set description
     * @param      {string}  domain       domain of the verification, this is a subdomain under
     *                                    'verifications.evan', so passing `example` will link
     *                                    verifications description to 'example.verifications.evan'
     * @param      {any}     description  description of the verification; can be an Envelope but only
     *                                    public properties are used
     * @return     {Promise<void>}  resolved when done
     */
    setVerificationDescription(accountId: string, topic: string, domain: string, description: any): Promise<void>;
    /**
     * validates a given verificationId in case of integrity
     *
     * @param      {string}   subject         the subject of the verification
     * @param      {string}   verificationId  verification identifier
     * @param      {boolean}  isIdentity      optional indicates if the subject is already an identity
     * @return     {Promise<boolean>}  resolves with true if the verification is valid, otherwise false
     */
    validateVerification(subject: string, verificationId: string, isIdentity?: boolean): Promise<boolean>;
    /**
     * execute contract call on identity, checks if account or contract identity is used and if given
     * subject is alraedy an identity
     *
     * @param      {string}        subject     account/contract with identity or an identity of it
     * @param      {boolean}       isIdentity  true if given subject is an identity
     * @param      {string}        fun         function to call
     * @param      {any[]}         args        arguments for function (exluding the identity (for
     *                                         VerificationsRegistry functions))
     * @return     {Promise<any>}  result of called function
     */
    private callOnIdentity;
    /**
     * Checks if a storage was initialized before, if not, load the default one.
     *
     * @return     {Promise<void>}  resolved when storage exists or storage was loaded
     */
    private ensureStorage;
    /**
     * run given data (serialized contract tx) with given users identity
     *
     * @param      {string}        accountId        account execute given tx on own identity
     * @param      {string}        data             serialized function data
     * @param      {any}           eventInfo        (optional) object with properties: 'eventName' and
     *                                              'contract' (web3 contract instance, that triggers
     *                                              event)
     * @param      {Function}      getEventResults  (optional) function with arguments event and
     *                                              eventArges, that returns result of
     *                                              `executeAndHandleEventResult` call
     * @return     {Promise<any>}  if `eventInfo` and `getEventResults`, result of `getEventResults`,
     *                             otherwise void
     */
    private executeAndHandleEventResult;
    /**
     * execute contract transaction on identity, checks if account or contract identity is used and if
     * given subject is alraedy an identity
     *
     * @param      {string}        subject  account/contract with identity or an identity of it
     * @param      {string}        fun      function to call
     * @param      {any}           options  options for transaction
     * @param      {any[]}         args     arguments for function (exluding the identity (for
     *                                      VerificationsRegistry functions))
     * @return     {Promise<any>}  result of called function
     */
    private executeOnIdentity;
    /**
     * returns full domain for description
     *
     * @param      {string}  topic              verification topic
     * @param      {string}  descriptionDomain  domain of description
     * @return     {string}  full domain
     */
    private getFullDescriptionDomainWithHash;
    /**
     * checks if given given subject belongs to an account to a contract
     *
     * @param      {string}           subject     verification subject
     * @param      {boolean}          isIdentity  true if given subject is an identity
     * @return     {Promise<string>}  resolves to 'account' or 'contract'
     */
    private getSubjectType;
}
