@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
54 lines (50 loc) • 2.18 kB
JavaScript
import { asArray } from "../../../../utils/array.mjs";
import { JsonTransformer } from "../../../../utils/JsonTransformer.mjs";
import { IsInstanceOrArrayOfInstances } from "../../../../utils/validators.mjs";
import "../../../../utils/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 { ClaimFormat } from "../../models/ClaimFormat.mjs";
import { DataIntegrityProof } from "./DataIntegrityProof.mjs";
import { LinkedDataProof } from "./LinkedDataProof.mjs";
import { ProofTransformer } from "./ProofTransformer.mjs";
import { W3cPresentation } from "../../models/presentation/W3cPresentation.mjs";
import "../../models/index.mjs";
//#region src/modules/vc/data-integrity/models/W3cJsonLdVerifiablePresentation.ts
var W3cJsonLdVerifiablePresentation = class extends W3cPresentation {
constructor(options) {
super(options);
if (options) if (options.proof.cryptosuite) this.proof = new DataIntegrityProof(options.proof);
else this.proof = new LinkedDataProof(options.proof);
}
get proofTypes() {
return (asArray(this.proof) ?? []).map((proof) => proof.type);
}
get dataIntegrityCryptosuites() {
return (asArray(this.proof) ?? []).filter((proof) => proof.type === "DataIntegrityProof" && "cryptosuite" in proof).map((proof) => proof.cryptosuite);
}
toJson() {
return JsonTransformer.toJSON(this);
}
/**
* The {@link ClaimFormat} of the presentation. For JSON-LD credentials this is always `ldp_vp`.
*/
get claimFormat() {
return ClaimFormat.LdpVp;
}
/**
* Get the encoded variant of the W3C Verifiable Presentation. For JSON-LD presentations this is
* a JSON object.
*/
get encoded() {
return this.toJson();
}
};
__decorate([
ProofTransformer(),
IsInstanceOrArrayOfInstances({ classType: [LinkedDataProof, DataIntegrityProof] }),
__decorateMetadata("design:type", Object)
], W3cJsonLdVerifiablePresentation.prototype, "proof", void 0);
//#endregion
export { W3cJsonLdVerifiablePresentation };
//# sourceMappingURL=W3cJsonLdVerifiablePresentation.mjs.map