import { BLOCKCHAINS, ExplorerAPI, IBlockchainObject, TransactionData } from '@blockcerts/explorer-lookup'; import { HashlinkVerifier } from '@blockcerts/hashlink-verifier'; import { IDidDocumentPublicKey } from '@decentralized-identity/did-common-typescript'; export declare enum VERIFICATION_STATUSES { DEFAULT = "standby", FAILURE = "failure", STARTING = "starting", SUCCESS = "success" } export declare class VerificationSubstep { code: string; label: string; labelPending: string; parentStep: string | VerificationSteps; status: VERIFICATION_STATUSES; constructor(parentStepKey: string | VerificationSteps, subStepKey: string); } export interface IVerificationMapItemSuite { proofType: string; subSteps: VerificationSubstep[]; } export interface IVerificationMapItem { code: VerificationSteps; label: string; labelPending: string; subSteps?: VerificationSubstep[]; status?: VERIFICATION_STATUSES; suites?: IVerificationMapItemSuite[]; } declare const final = "final"; declare enum VerificationSteps { formatValidation = "formatValidation", proofVerification = "proofVerification", identityVerification = "identityVerification", statusCheck = "statusCheck", final = "final" } declare enum SUB_STEPS { checkImagesIntegrity = "checkImagesIntegrity", checkRevokedStatus = "checkRevokedStatus", checkExpiresDate = "checkExpiresDate", controlVerificationMethod = "controlVerificationMethod", verifyIssuerProfile = "verifyIssuerProfile", ensureValidityPeriodStarted = "ensureValidityPeriodStarted", checkCredentialSchemaConformity = "checkCredentialSchemaConformity", validateDateFormat = "validateDateFormat" } export type TVerificationStepsList = { [key in VerificationSteps]?: IVerificationMapItem; }; declare const verificationMap: { formatValidation: SUB_STEPS[]; proofVerification: any[]; identityVerification: SUB_STEPS[]; statusCheck: SUB_STEPS[]; }; declare function getParentVerificationSteps(): TVerificationStepsList; export interface MerklePath { left?: string; right?: string; } export interface MerkleProof2017 { type: string[]; merkleRoot: string; targetHash: string; proof: MerklePath[]; anchors: MerkleProof2017Anchor[]; } export interface MerkleProof2017Anchor { sourceId: string; type: string; chain?: string; } export interface RecipientProfile { type: string[]; name: string; publicKey: string; } export interface BlockcertsV2 { "@context": JsonLDContext; type: string; id: string; recipient?: { type: string; identity: string; hashed: boolean; /** * @deprecated v2 alpha only */ recipientProfile?: RecipientProfile; }; recipientProfile?: RecipientProfile; badge?: { type: string; id?: string; name?: string; subtitle?: string; description?: string; image?: string; criteria?: any; issuer: { type?: string; id?: string; name?: string; url?: string; image?: string; email?: string; revocationList?: string; }; signatureLines?: Array<{ type?: string[]; jobTitle?: string; image?: string; }>; }; verification?: { type: string[]; publicKey?: string; /** * @deprecated v2 alpha only */ creator?: string; }; issuedOn?: string; metadataJson?: string; displayHtml?: string; expires?: string; nonce?: string; universalIdentifier?: string; signature: MerkleProof2017; } export interface IDidContext { "@base": string; } export interface IServiceEndpoint { serviceEndpoint?: string; type?: string; id?: string; } export interface IDidDocument { id?: string; "@context": Array; verificationMethod?: IDidDocumentPublicKey[]; authentication?: Array; assertionMethod?: string[]; service?: IServiceEndpoint[]; capabilityDelegation?: string[]; keyAgreement?: IDidDocumentPublicKey[]; publicKey?: IDidDocumentPublicKey[]; } export interface IVerificationMethod extends IDidDocumentPublicKey { expires?: string; revoked?: string; } export interface KeyObjectV1 { date: string; key: string; invalidated?: string; } export interface KeyObjectV2 { id: string; created: string; expires?: string; revoked?: string; } export interface Issuer { "@context"?: string[]; type?: string; id?: string; name?: string; url?: string; image?: string; email?: string; revocationList?: string; publicKey?: string[] | KeyObjectV2[]; introductionURL?: string; introductionAuthenticationMethod?: string; introductionSuccessURL?: string; introductionErrorURL?: string; analyticsURL?: string; issuingEstimateAuth?: string; issuingEstimateUrl?: string; didDocument?: IDidDocument; verificationMethod?: IVerificationMethod[]; issuer?: Issuer; proof?: VCProof; publicKeys?: string[] | KeyObjectV2[]; issuer_key?: KeyObjectV1[]; revocation_key?: KeyObjectV1[]; issuerKeys?: KeyObjectV1[]; revocationKeys?: KeyObjectV1[]; } export declare enum CONTENT_MEDIA_TYPES { TEXT_HTML = "text/html", IMAGE_PNG = "image/png", IMAGE_JPEG = "image/jpeg", IMAGE_GIF = "image/gif", IMAGE_BMP = "image/bmp", APPLICATION_PDF = "application/pdf" } export interface VCProof { type: string; created: string; proofValue?: string; jws?: string; proofPurpose: string; domain?: string; challenge?: string; verificationMethod: string; chainedProofType?: string; previousProof?: any; cryptosuite?: string; } export declare function isVerifiablePresentation(credential: BlockcertsV3 | VerifiablePresentation): credential is VerifiablePresentation; export interface MultilingualVcField { "@value": string; "@language": string; "@direction"?: string; } export interface VerifiablePresentation { "@context": JsonLDContext; id?: string; type: string[]; verifiableCredential?: BlockcertsV3[]; holder?: string; } export interface VCObject { type: string; id?: string; } export interface VerifiableCredential { "@context": JsonLDContext; id: string; type: string[]; credentialStatus?: VCCredentialStatus | VCCredentialStatus[]; credentialSchema?: VCCredentialSchema | VCCredentialSchema[]; issuer: string | Issuer; credentialSubject?: any | any[]; expirationDate?: string; evidence?: VCObject | VCObject[]; holder?: { type?: string; id?: string; }; issued?: string; issuanceDate?: string; refreshService?: VCObject | VCObject[]; termsOfUse?: VCObject | VCObject[]; proof: VCProof | VCProof[]; validFrom?: string; validUntil?: string; name?: string | MultilingualVcField[]; description?: string | MultilingualVcField[]; } export interface BlockcertsV3Display { contentMediaType: CONTENT_MEDIA_TYPES; content: string; contentEncoding?: string; } export interface VCCredentialStatus { id: string; type: string; statusPurpose: string; statusListIndex: string; statusListCredential: string; } export interface VCCredentialSchema { type: string; id: string; } export interface BlockcertsV3BasicCredentialSubject { id?: string; publicKey?: string; name?: string; type?: string; claim?: { type?: string; id?: string; name?: string; description?: string; criteria?: string; }; } export interface BlockcertsV3 extends VerifiableCredential { credentialSubject: BlockcertsV3BasicCredentialSubject | BlockcertsV3BasicCredentialSubject[]; metadata?: string; display?: BlockcertsV3Display; nonce?: string; /** * @deprecated v3 alpha only */ metadataJson?: string; } export type Blockcerts = BlockcertsV2 | BlockcertsV3; export type CustomJsonLDContextDefinition = Record; export type JsonLDContext = Array; export interface Receipt { path?: MerklePath[]; merkleRoot?: string; targetHash?: string; anchors?: string[] | MerkleProof2017Anchor[]; type?: string[]; proof?: MerklePath[]; } export interface SuiteAPI { executeStep: (step: string, action: () => any, verificationSuite?: string) => Promise; document: Blockcerts; explorerAPIs?: ExplorerAPI[]; proof: VCProof | MerkleProof2017; issuer: Issuer; proofPurpose?: string; proofDomain?: string | string[]; proofChallenge?: string; } declare abstract class Suite { abstract type: string; constructor(props: SuiteAPI); abstract init(): Promise; abstract verifyProof(): Promise; abstract verifyIdentity(): Promise; abstract getProofVerificationSteps(parentStepKey: string): VerificationSubstep[]; abstract getIdentityVerificationSteps(parentStepKey: string): VerificationSubstep[]; abstract getIssuerPublicKey(): string; abstract getIssuerName(): string; abstract getIssuerProfileDomain(): string; abstract getIssuerProfileUrl(): string; abstract getSigningDate(): string; getChain?(): IBlockchainObject; getReceipt?(): Receipt; getTransactionIdString?(): string; getTransactionLink?(): string; getRawTransactionLink?(): string; abstract executeStep(step: string, action: any, verificationSuite: string): Promise; } export interface IVerificationStepCallbackAPI { code: string; label: string; status: VERIFICATION_STATUSES; errorMessage?: string; parentStep: string; } export type IVerificationStepCallbackFn = (update: IVerificationStepCallbackAPI) => any; export type TVerifierProofMap = Map; export interface IFinalVerificationStatus { code: VerificationSteps.final; status: VERIFICATION_STATUSES; message: string; errors?: IFinalVerificationStatus[]; } declare enum SupportedVerificationSuites { MerkleProof2017 = "MerkleProof2017", MerkleProof2019 = "MerkleProof2019", Ed25519Signature2020 = "Ed25519Signature2020", EcdsaSecp256k1Signature2019 = "EcdsaSecp256k1Signature2019", EcdsaSd2023 = "EcdsaSd2023", EddsaRdfc2022 = "EddsaRdfc2022" } export interface VerifierAPI { certificateJson: Blockcerts; expires: string; validFrom?: string; id: string; issuer: Issuer; hashlinkVerifier: HashlinkVerifier; revocationKey: string; explorerAPIs?: ExplorerAPI[]; proofPurpose?: string; proofDomain?: string | string[]; proofChallenge?: string; } declare class Verifier { expires: string; validFrom: string; id: string; issuer: Issuer; revocationKey: string; documentToVerify: Blockcerts; explorerAPIs: ExplorerAPI[]; txData: TransactionData; private _stepsStatuses; private readonly hashlinkVerifier; verificationSteps: IVerificationMapItem[]; supportedVerificationSuites: { [key in SupportedVerificationSuites]: Suite; }; proofVerifiers: Suite[]; verificationProcess: SUB_STEPS[]; proofMap: TVerifierProofMap; proofPurpose?: string; proofDomain?: string | string[]; proofChallenge?: string; constructor({ certificateJson, expires, hashlinkVerifier, id, issuer, revocationKey, explorerAPIs, validFrom, proofPurpose, proofDomain, proofChallenge }: VerifierAPI); getVerificationSteps(): IVerificationMapItem[]; getSignersData(): Signers[]; init(): Promise; verifyProof(): Promise; verify(stepCallback?: IVerificationStepCallbackFn): Promise; private convertCryptosuiteToType; private getRevocationListUrl; private getProofTypes; private getProofMap; private instantiateProofVerifiers; private loadRequiredVerificationSuites; private prepareVerificationProcess; private registerSignatureVerificationSteps; private getSuiteSubsteps; private registerIdentityVerificationSteps; private executeStep; private _stepCallback; private checkImagesIntegrity; private checkRevokedStatus; private checkExpiresDate; private ensureValidityPeriodStarted; private validateDateFormat; private checkCredentialSchemaConformity; private controlVerificationMethod; private verifyIssuerProfile; private findStepFromVerificationProcess; private _failed; private _isFailing; private _succeed; private _setFinalStep; private _updateStatusCallback; } export declare class SignatureImage { image: string; jobTitle: string; name: string; constructor(image: string, jobTitle: string, name: string); } export interface CertificateOptions { locale?: string; explorerAPIs?: ExplorerAPI[]; didResolverUrl?: string; proofPurpose?: string; domain?: string | string[]; challenge?: string; } export interface Signers { chain?: IBlockchainObject; issuerName?: string; issuerProfileDomain?: string; issuerProfileUrl?: string; issuerPublicKey: string; rawTransactionLink?: string; signatureSuiteType: string; signingDate: string; transactionId?: string; transactionLink?: string; } export declare class Certificate { certificateImage?: string; certificateJson: Blockcerts; description?: string; display?: BlockcertsV3Display; expires: string; validFrom: string; explorerAPIs: ExplorerAPI[]; id: string; isFormatValid: boolean; isVerifiablePresentation: boolean; issuedOn: string; issuer: Issuer; locale: string; metadataJson: any; name?: string; options: CertificateOptions; proofPurpose: string; proofDomain?: string | string[]; proofChallenge?: string; recipientFullName: string; recordLink: string; revocationKey: string; sealImage?: string; signature?: string; signatureImage?: SignatureImage[]; signers: Signers[]; subtitle?: string; hashlinkVerifier: HashlinkVerifier; hasHashlinks: boolean; verifiableCredentials: Certificate[]; verificationSteps: IVerificationMapItem[]; verifier: Verifier; verificationStatus: IFinalVerificationStatus; constructor(certificateDefinition: Blockcerts | string, options?: CertificateOptions); init(): Promise; verify(stepCallback?: IVerificationStepCallbackFn): Promise; private parseJson; private setSigners; private _setOptions; private _setProperties; parseHashlinksInDisplay(display: BlockcertsV3Display): Promise; } export function getSupportedLanguages(): string[]; declare enum Versions { V1_1 = "1.1", V1_2 = "1.2", V2_0 = "2.0", V3_0_alpha = "3.0-alpha", V3_0_beta = "3.0-beta", V3_0 = "3.0" } export interface BlockcertsVersion { versionNumber: number; version: Versions; } export declare function retrieveBlockcertsVersion(context: JsonLDContext | string): BlockcertsVersion; declare namespace STEPS { export { SUB_STEPS, TVerificationStepsList, VerificationSteps, final, getParentVerificationSteps as default, verificationMap }; } export { BLOCKCHAINS, STEPS, Versions as CERTIFICATE_VERSIONS, }; export {};