import { Attestation, IPv8API } from '../ipv8/IPv8API'; import { Attribute } from '../ipv8/types/Attribute'; import { Dict } from '../ipv8/types/Dict'; import { IVerifieeService } from '../ipv8/types/IVerifieeService'; import { ServerDescriptor } from "../server/IAttestationServerRESTAPI"; import { AttributeDescription, ClientProcedure, Credential, PeerId } from '../types/types'; export declare class AttestationClient { private me; private api; verifieeService: IVerifieeService; private logger; config: { maxAttemptsToPollStagedAttributes: number; pollStagedAttributesEveryMillis: number; pollAttestationRequestEveryMillis: number; allowVerificationTimeoutMillis: number; }; constructor(me: PeerId, api: IPv8API, verifieeService: IVerifieeService, logger?: (...args: any[]) => any); stop(): void; getServerDetails(http_address: string): Promise; /** * Run an OWAttestationProcedure * @param procedure The procedure description * @param credential_values The values of all required credentials */ execute(procedure: ClientProcedure, credential_values: Dict, userConsentOnData?: (data: Attribute[]) => Promise, onStatusChange?: (status: Status) => any): Promise; /** Fetch the hashes from the client's IPv8 belonging to specific attributes. */ protected fetchLocalCredentials(credential_names: string[], values: Dict): Promise; /** * Check that we have an attestation for a given attribute. * @throws If an attribute hash is missing. */ protected fetchCredentialHashOrThrow(attribute_name: string): Promise; /** * Request the OWAttestationServer to stage our attributes and * verify our credentials if needed, passing the credential data. */ protected fetchDataAtProvider(procedure: ClientProcedure, credentials: Credential[]): Promise; /** * Allow incoming verification requests from the Provider for the given attributes. */ grantVerificationOfCredentials(mid_b64: string, attributeNames: string[]): Promise; /** * We don't trust the data provided by the server. Hence first validate it. */ protected validateReceivedDataOrThrow(procedure: ClientProcedure, receivedData: any): Attribute[]; protected requestAndAwaitAttestations(procedure: ClientProcedure): Promise; /** Request the attestation */ protected requestAttestation(procedure: ClientProcedure, attribute: AttributeDescription): Promise; protected awaitAllAttestations(procedure: ClientProcedure): Promise>; /** Await the receipt of attestations */ protected awaitAttestation(attr_name: string): Promise; protected log(...args: any[]): void; } export interface OWResponse { data: Attribute[]; attestations: Attestation[]; } export declare enum Status { FETCHING_LOCAL_CREDENTIALS = "FETCHING_LOCAL_CREDENTIALS", FETCHING_DATA = "FETCHING_DATA", REQUESTING_ATTESTATION = "REQUESTING_ATTESTATION", COMPLETE = "COMPLETE" }