UNPKG

@credo-ts/core

Version:

<p align="center"> <br /> <img alt="Credo Logo" src="https://github.com/openwallet-foundation/credo-ts/blob/c7886cb8377ceb8ee4efe8d264211e561a75072d/images/credo-logo.png" height="250px" /> </p> <h1 align="center"><b>Credo - Core</b></h1

90 lines • 4.18 kB
import { Query, QueryOptions } from "../../storage/StorageService.mjs"; import { MdocRecord } from "./repository/MdocRecord.mjs"; import { MdocVerificationSessionRecord } from "./repository/MdocVerificationSessionRecord.mjs"; import "./repository/index.mjs"; import { MdocDcApiCreateResponseOptions, MdocDcApiCreateVerificationSessionOptions, MdocDcApiResolveRequestOptions, MdocDcApiResolvedRequest, MdocDcApiVerifyResponseOptions, MdocDeleteVerificationSessionOptions, MdocSignOptions, MdocStoreOptions, MdocVerifyOptions } from "./MdocOptions.mjs"; import { MdocDeviceResponse } from "./MdocDeviceResponse.mjs"; import { MdocDcApiService } from "./MdocDcApiService.mjs"; import { MdocService } from "./MdocService.mjs"; import { Mdoc } from "./Mdoc.mjs"; import { AgentContext } from "../../agent/context/AgentContext.mjs"; import "../../agent/index.mjs"; //#region src/modules/mdoc/MdocApi.d.ts /** * @public */ export declare class MdocApi { private agentContext; private mdocService; private mdocDcApiService; constructor(agentContext: AgentContext, mdocService: MdocService, mdocDcApiService: MdocDcApiService); /** * Create a new Mdoc, with a spcific doctype, namespace, and validity info. */ sign(options: MdocSignOptions): Promise<Mdoc>; /** * * Verify an incoming mdoc. It will check whether everything is valid, but also returns parts of the validation. * * For example, you might still want to continue with a flow if not all the claims are included, but the signature is valid. * */ verify(mdoc: Mdoc, options: MdocVerifyOptions): Promise<{ isValid: true; } | { isValid: false; error: string; }>; /** * Create a Mdoc class from a base64url encoded Mdoc Issuer-Signed structure */ fromBase64Url(base64Url: string): Mdoc; store(options: MdocStoreOptions): Promise<MdocRecord>; getById(id: string): Promise<MdocRecord>; getAll(): Promise<Array<MdocRecord>>; findAllByQuery(query: Query<MdocRecord>, queryOptions?: QueryOptions): Promise<Array<MdocRecord>>; deleteById(id: string): Promise<void>; update(mdocRecord: MdocRecord): Promise<void>; /** * Get an mdoc verification session by id, for any of the mdoc presentation protocols. */ getVerificationSessionById(verificationSessionId: string): Promise<MdocVerificationSessionRecord>; findVerificationSessionsByQuery(query: Query<MdocVerificationSessionRecord>, queryOptions?: QueryOptions): Promise<Array<MdocVerificationSessionRecord>>; /** * Delete an mdoc verification session. By default the ephemeral session key created for the * session is deleted along with it; it is not deleted at any other point in the session * lifecycle. */ deleteVerificationSessionById(verificationSessionId: string, options?: MdocDeleteVerificationSessionOptions): Promise<void>; /** * Create an ISO 18013-7 Annex C (`org-iso-mdoc`) DC API request and the verification session * tracking it. The returned request can be passed to `navigator.credentials.get()` as the * `data` of a `org-iso-mdoc` protocol request. */ createDcApiVerificationSession(options: MdocDcApiCreateVerificationSessionOptions): Promise<{ verificationSession: MdocVerificationSessionRecord; request: import("@owf/mdoc").IsoMdocDcApiRequest; }>; /** * Decrypt and verify an `org-iso-mdoc` DC API response for a verification session. */ verifyDcApiResponse(options: MdocDcApiVerifyResponseOptions): Promise<{ verificationSession: MdocVerificationSessionRecord; deviceResponse: MdocDeviceResponse; deviceRequestMatch: import("@owf/mdoc").DeviceRequestMatchSuccess; origin: string; }>; /** * Parse an incoming `org-iso-mdoc` DC API request, verify reader authentication where present, * and match the requested documents against the stored mdocs. */ resolveDcApiRequest(options: MdocDcApiResolveRequestOptions): Promise<MdocDcApiResolvedRequest>; /** * Create the encrypted `org-iso-mdoc` DC API response for a resolved request. */ createDcApiResponse(options: MdocDcApiCreateResponseOptions): Promise<{ response: string; }>; } //#endregion //# sourceMappingURL=MdocApi.d.mts.map