import { ClaimIdentifier, CredentialIdentifier, Credential } from './Credential';
import { PresentationVerifier, VerifyFunction } from './PresentationVerifier';
/**
 * Used to setup VerifiablePresentationManager global behavior
 */
export interface VPMOptions {
    /**
     * disable the verification when adding new items to manager control. default, false.
     */
    skipAddVerify?: boolean;
    /**
     * disable the verification when getting managed values. default, false.
     */
    skipGetVerify?: boolean;
    /**
     * Allow to get values if both verifications are disabled. default, false.
     */
    allowGetUnverified?: boolean;
    /**
     *  Avoid to throw exceptions. Useful for batch operation but is not a good practice. default, false.
     */
    notThrow?: boolean;
}
/**
 * An unique reference to a managed presentation
 */
export interface PresentationReference {
    /**
     * see [[CredentialIdentifier]]
     */
    identifier: CredentialIdentifier;
    /**
     * an unique key
     */
    uid: string;
}
/**
 * An unique reference to a managed claim
 */
export interface AvailableClaim {
    /**
     * see [[ClaimIdentifier]]
     */
    identifier: ClaimIdentifier;
    /**
     * see [[PresentationReference]]
     */
    credentialRef: PresentationReference;
    /**
     * the structure path here to find the claim values
     */
    claimPath: string;
}
/**
 * A search criteria to find managed claim
 */
export interface SearchClaimCriteria {
    identifier?: ClaimIdentifier;
    credentialRef?: PresentationReference;
    claimPath?: string;
}
/**
 * A mapping from key (an identifier) to a search claim criteria
 */
export interface ClaimCriteriaMap {
    [key: string]: SearchClaimCriteria;
}
/**
 * A mapping from key (an identifier) to claim value (an object)
 */
export interface ClaimValueMap {
    [key: string]: any;
}
/**
 * An Manager to secure handle Verifiable Presentations and Evidences.
 *
 * A Verifiable Presentation is a filtered credential that doesn't have all the expected claims for
 * an Verifiable Credential of the type but still holds all verification properties for the claims
 * presented in the shared JSON structure.
 *
 * An Evidence is data collect during the validation process that is present as a Verifiable Claim
 * but can be linked to a claim. Making it possible to verify if that data was the same used to issue
 * the credential. This is useful for document images, selfies, etc...
 */
/**
 * Evidence representation
 */
export interface Evidence {
    /**
     * The Evidence content ("selfie", "idDocumentBack", "idDocumentFront")
     */
    content: string;
    /**
     * The Evidence content-type
     */
    contentType: string;
    /**
     * The Evidence sha256
     */
    sha256: string;
    /**
     * The base 64 encoded representation of the evidence
     */
    base64Encoded: string;
}
/**
 * Optional sets of Verifiable Presentations and/or Evidences in a JSONformat
 */
export interface CredentialArtifacts {
    /**
     * an array of JSONs with Verifiable (Credentials or Presentation)
     */
    presentations?: Credential[];
    /**
     * an array of JSONs with Evidences (Credentials or Presentation)
     */
    evidences?: Evidence[];
}
/**
 * Summary of the VerifiablePresentationManager status exposing the current configuration
 * and an aggregation of it managed state
 */
export interface VerifiablePresentationManagerStatus {
    config: VPMOptions;
    verifiedPresentations: number;
    totalPresentations: number;
    verifiedEvidences: number;
    totalEvidences: number;
}
/**
 * JSON contain a DSR
 */
export declare type DSRJSON = string;
/**
 * Abstract all complexity about the Verifiable Credentials handling by providing utility methods
 * to access user verified data in a secure way unless the security behavior is explicit flexed.
 *
 * By Default the only check not performed is the blockchain anchor check that must be explicit enable
 * by providing a verification plugin that can handle the verification in a async way.
 */
export declare class VerifiablePresentationManager {
    options: VPMOptions;
    artifacts: CredentialArtifacts;
    presentations: PresentationReference[];
    claims: AvailableClaim[];
    status: VerifiablePresentationManagerStatus;
    verifier: PresentationVerifier;
    /**
     * @param options - Defines the global behavior and security of VerifiablePresentationManager
     * @param verifyAnchor - An async function that is able to verify the presentation anchor in a public Blockchain
     */
    constructor(options: VPMOptions, verifyAnchor?: VerifyFunction);
    /**
     * Adds a set of Verifiable Presentations and Evidences to the manager control
     *
     * if neither `skipAddVerify` or `notThrow` are true, it throws an acception
     * once it process one invalid artifact.
     *
     * @param artifacts
     *
     */
    addCredentialArtifacts(artifacts: CredentialArtifacts): Promise<VerifiablePresentationManagerStatus>;
    /**
     * List managed presentations returning in accordance with the config
     *
     * if `allowGetUnverified` is true, presentations that were not verified yet will be returned.
     * but known invalid presentations are never returned
     *
     */
    listPresentations(): Promise<PresentationReference[]>;
    /**
     * List managed claim returning in accordance with the config
     *
     * if `allowGetUnverified` is true, claim that were not verified yet will be returned.
     * but known invalid presentations are never returned
     *
     */
    listClaims(): Promise<AvailableClaim[]>;
    /**
     * List managed claim of a given Credential type returning in accordance with the config
     *
     * if `allowGetUnverified` is true, claim that were not verified yet will be returned.
     * but known invalid presentations are never returned
     *
     */
    listPresentationClaims(presentationRef: PresentationReference): Promise<AvailableClaim[]>;
    /**
     * Search for a valid claim that matches the criterias.
     * if `allowGetUnverified` is true the search also include claim not verified yet.
     * the search never includes known invalid claims
     */
    findClaims(criteria: SearchClaimCriteria): Promise<AvailableClaim[] | null>;
    /**
     * Get a mapping from key to a claim search criteria and resolve the claim search criterias,
     * returning a mapping from the same keys to the relative claim value.
     * if `allowGetUnverified` is true, then the search also includes claims not verified yet.
     * if no claim matches a claim criteria, the value for the relative key will be null.
     */
    mapClaimValues(claimCriteriaMap: ClaimCriteriaMap, flatten?: boolean): Promise<ClaimValueMap>;
    /**
     * return the STRING value of a valid avaliable claim.
     * if `allowGetUnverified` is true it returns unverified values.
     * if `notThrow` is true return null for known invalid claims
     */
    getClaimValue(availableClaim: AvailableClaim): Promise<any | null>;
    /**
     * List managed evidences
     * if `allowGetUnverified` is true it return unverified values.
     */
    listEvidences(): Promise<Evidence[]>;
    /**
     * Verify all artifacts and return a status of all presentations and evidences
     *
     * if neither `skipAddVerify` or `notThrow` are true, it throws an acception
     * once it process one invalid artifact.
     */
    verifyAllArtifacts(): Promise<VerifiablePresentationManagerStatus>;
    /**
     * Verify if a presentation was GRANTED for a specific DSR
     *
     * Verify if the presentation was shared with user consent and signatures
     *
     * @param presentationRef the managed presentation to verify
     * @param originalRequestDSR the original Dynamic Scope Request that receive the presentation as result
     */
    wasGrantedForDSR(presentationRef: PresentationReference, originalRequestDSR: DSRJSON): Promise<any>;
    /**
     * Return true if all artifacts are verified, otherwise return false
     *
     * if neither `skipGetVerify` or `notThrow` are true, it throws an acception
     */
    isAllArtifactsVerified(): Promise<boolean>;
    /**
     * Remove the invalid artifacts and return a status of the resultant artifacts
     */
    purgeInvalidArtifacts(): Promise<VerifiablePresentationManagerStatus>;
    private getPresentation;
    private getClaimPresentation;
    private findEvidencePresentation;
    private aggregateCredentialArtifacts;
    private getPresentationReference;
    private getAvailableClaims;
    private verifyPresentation;
    private verifyPresentations;
    private verifyEvidence;
    private verifyEvidences;
    private getVerifiedPresentationRefs;
}
