@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
63 lines (59 loc) • 2.31 kB
JavaScript
import { AgentContext } from "../../agent/context/AgentContext.mjs";
import { injectable } from "../../plugins/index.mjs";
import { __decorateMetadata } from "../../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorateMetadata.mjs";
import { __decorate } from "../../_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.mjs";
import "../../agent/index.mjs";
import { Mdoc } from "./Mdoc.mjs";
import { MdocService } from "./MdocService.mjs";
//#region src/modules/mdoc/MdocApi.ts
var _ref, _ref2;
let MdocApi = class MdocApi {
constructor(agentContext, mdocService) {
this.agentContext = agentContext;
this.mdocService = mdocService;
}
/**
* Create a new Mdoc, with a spcific doctype, namespace, and validity info.
*/
async sign(options) {
return await this.mdocService.signMdoc(this.agentContext, options);
}
/**
*
* 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.
*
*/
async verify(mdoc, options) {
return await this.mdocService.verifyMdoc(this.agentContext, mdoc, options);
}
/**
* Create a Mdoc class from a base64url encoded Mdoc Issuer-Signed structure
*/
fromBase64Url(base64Url) {
return Mdoc.fromBase64Url(base64Url);
}
async store(options) {
return await this.mdocService.store(this.agentContext, options);
}
async getById(id) {
return await this.mdocService.getById(this.agentContext, id);
}
async getAll() {
return await this.mdocService.getAll(this.agentContext);
}
async findAllByQuery(query, queryOptions) {
return await this.mdocService.findByQuery(this.agentContext, query, queryOptions);
}
async deleteById(id) {
return await this.mdocService.deleteById(this.agentContext, id);
}
async update(mdocRecord) {
return await this.mdocService.update(this.agentContext, mdocRecord);
}
};
MdocApi = __decorate([injectable(), __decorateMetadata("design:paramtypes", [typeof (_ref = typeof AgentContext !== "undefined" && AgentContext) === "function" ? _ref : Object, typeof (_ref2 = typeof MdocService !== "undefined" && MdocService) === "function" ? _ref2 : Object])], MdocApi);
//#endregion
export { MdocApi };
//# sourceMappingURL=MdocApi.mjs.map