UNPKG

@identity.com/verifiable-presentations

Version:

Utility Library to securely handle verifiable presentations

66 lines (65 loc) 2.27 kB
import { ClaimCriteriaMap } from './VerifiablePresentationManager'; import { Credential } from './Credential'; export interface CredentialItemRequest { requestIndex?: number; identifier?: string; constraints?: any; } export interface VerifiableDataItem { credentialItemRequest?: CredentialItemRequest; credential?: Credential; requestStatus?: any[] | null; userId?: string | null; } export interface DSRResponse { verifiableData?: VerifiableDataItem[]; requestStatus?: any[] | null; userId?: string | null; } export interface Formatters { [key: string]: any; } /** * A class for extracting PII from a DSR Response based on a specific dsrRequest implementation, with a given mapping and formatters, * specific to that DSR */ export declare class PIIFactory { dsrRequest: object; mapping: ClaimCriteriaMap; formatters: Formatters; /** * @param {Object} dsrRequest * @param {ClaimCriteriaMap} mapping * @param {Formatters} formatters */ constructor(dsrRequest: object, mapping: ClaimCriteriaMap, formatters: object); /** * The client is asked for a list of documents that the provider is interested in (requestedDocuments) * It returns in the credential, a list of documents that it can provide. * Return the intersection between these two, to identify which documents are expected. * * @param evidenceProofs * @return {string[]} */ expectedDocumentsGivenEvidenceProofs(evidenceProofs?: any[]): any; /** * Validate the dsr response, extract the PII, and format it for the provider. * @param dsrResponse * @return {Promise<{evidenceProofs: *, formattedClaims: *}>} */ extractPII(dsrResponse: DSRResponse): Promise<{ formattedClaims: any; evidenceProofs: { name: string; proofs: any; }[]; }>; /** * Generate a DSR based on the template and evidence functions provided * @param {String} eventsURL * @param {String} idvDid * @param {Object} dsrResolver * @param {Function} urlGeneratorFn */ generateDSR(eventsURL: string, idvDid: string, dsrResolver: object, urlGeneratorFn: (evidenceName: string) => string): Promise<any>; }