@credo-ts/didcomm 0.7.3-alpha-20261022191151 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/modules/credentials/formats/jsonld/DidCommJsonLdCredentialFormatService.d.mts +4 -4
- package/build/modules/credentials/formats/jsonld/DidCommJsonLdCredentialFormatService.d.mts.map +1 -1
- package/build/modules/credentials/formats/jsonld/DidCommJsonLdCredentialFormatService.mjs +24 -13
- package/build/modules/credentials/formats/jsonld/DidCommJsonLdCredentialFormatService.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -20,7 +20,7 @@ export declare class DidCommJsonLdCredentialFormatService implements DidCommCred
|
|
|
20
20
|
* @param options the options needed to accept the proposal
|
|
21
21
|
*/
|
|
22
22
|
processProposal(_agentContext: AgentContext, { attachment }: DidCommCredentialFormatProcessOptions): Promise<void>;
|
|
23
|
-
acceptProposal(
|
|
23
|
+
acceptProposal(agentContext: AgentContext, { attachmentId, proposalAttachment }: DidCommCredentialFormatAcceptProposalOptions<DidCommJsonLdCredentialFormat>): Promise<DidCommCredentialFormatCreateOfferReturn>;
|
|
24
24
|
/**
|
|
25
25
|
* Create a {@link AttachmentFormats} object dependent on the message type.
|
|
26
26
|
*
|
|
@@ -28,7 +28,7 @@ export declare class DidCommJsonLdCredentialFormatService implements DidCommCred
|
|
|
28
28
|
* @returns object containing associated attachment, formats and offersAttach elements
|
|
29
29
|
*
|
|
30
30
|
*/
|
|
31
|
-
createOffer(
|
|
31
|
+
createOffer(agentContext: AgentContext, { credentialFormats, attachmentId }: DidCommCredentialFormatCreateOfferOptions<DidCommJsonLdCredentialFormat>): Promise<DidCommCredentialFormatCreateOfferReturn>;
|
|
32
32
|
processOffer(_agentContext: AgentContext, { attachment }: DidCommCredentialFormatProcessOptions): Promise<void>;
|
|
33
33
|
acceptOffer(_agentContext: AgentContext, { attachmentId, offerAttachment }: DidCommCredentialFormatAcceptOfferOptions<DidCommJsonLdCredentialFormat>): Promise<DidCommCredentialFormatCreateReturn>;
|
|
34
34
|
/**
|
|
@@ -42,8 +42,8 @@ export declare class DidCommJsonLdCredentialFormatService implements DidCommCred
|
|
|
42
42
|
processRequest(_agentContext: AgentContext, { attachment }: DidCommCredentialFormatProcessOptions): Promise<void>;
|
|
43
43
|
acceptRequest(agentContext: AgentContext, { credentialFormats, attachmentId, requestAttachment }: DidCommCredentialFormatAcceptRequestOptions<DidCommJsonLdCredentialFormat>): Promise<DidCommCredentialFormatCreateReturn>;
|
|
44
44
|
/**
|
|
45
|
-
* Derive a verification method using the issuer from the given
|
|
46
|
-
* @param
|
|
45
|
+
* Derive a verification method using the issuer from the given credential
|
|
46
|
+
* @param credential the credential we want to sign
|
|
47
47
|
* @return the verification method derived from this credential and its associated issuer did, keys etc.
|
|
48
48
|
*/
|
|
49
49
|
private deriveVerificationMethod;
|
package/build/modules/credentials/formats/jsonld/DidCommJsonLdCredentialFormatService.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DidCommJsonLdCredentialFormatService.d.mts","names":[],"sources":["../../../../../src/modules/credentials/formats/jsonld/DidCommJsonLdCredentialFormatService.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"DidCommJsonLdCredentialFormatService.d.mts","names":[],"sources":["../../../../../src/modules/credentials/formats/jsonld/DidCommJsonLdCredentialFormatService.ts"],"mappings":";;;;;;qBA+Ca,gDACA,+BAA+B;WAE1B;WACA;;;;;;;;EASH,eACX,eAAe,gBACb,qBAAqB,6CAA6C,iCACnE,QAAQ;;;;;EAsBE,gBACX,eAAe,gBACb,cAAc,wCACf;EAWU,eACX,cAAc,gBACZ,cAAc,sBAAsB,6CAA6C,iCAClF,QAAQ;;;;;;;;EAiCE,YACX,cAAc,gBACZ,mBAAmB,gBAAgB,0CAA0C,iCAC9E,QAAQ;EA6BE,aAAa,eAAe,gBAAgB,cAAc,wCAAqC;EAU/F,YACX,eAAe,gBACb,cAAc,mBAAmB,0CAA0C,iCAC5E,QAAQ;;;;;;;;EAsBE,cACX,eAAe,gBACb,qBAAqB,4CAA4C,iCAClE,QAAQ;EAmBE,eACX,eAAe,gBACb,cAAc,wCACf;EAWU,cACX,cAAc,gBAEZ,mBACA,cACA,qBACC,4CAA4C,iCAC9C,QAAQ;;;;;;UA8CG;;;;;;EAoCD,kBACX,cAAc,gBACZ,0BAA0B,YAAY,qBAAqB,kDAC5D;UA0BK;;;;;;UAmDA;EAYD,eAAe;EAMT,qBAAqB,cAAc,cAAc,6BAA6B;EAMpF,sBAAuB,UAAU,mBAAmB,UAAU;EAOxD,4BACX,eAAe,gBACb,iBAAiB,sBAAsB,oDAAiD;EAK/E,yBACX,eAAe,gBACb,iBAAiB,sBAAsB,iDAA8C;EAK5E,2BACX,eAAe,gBACb,iBAAiB,qBAAqB,mDAAgD;EAK7E,8BACX,cAAc,gBACZ,mBAAmB,wBAAwB,sDAAmD;;;;;;;;UAwB1F"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { DidCommAttachment, DidCommAttachmentData } from "../../../../decorators/attachment/DidCommAttachment.mjs";
|
|
2
2
|
import { DidCommCredentialFormatSpec } from "../../models/DidCommCredentialFormatSpec.mjs";
|
|
3
3
|
import { DidCommJsonLdCredentialDetail } from "./DidCommJsonLdCredentialDetail.mjs";
|
|
4
|
-
import { ClaimFormat, CredoError, DidResolverService, JsonEncoder, JsonTransformer, SignatureSuiteRegistry, W3cCredential, W3cCredentialRecord, W3cCredentialService, W3cJsonLdCredentialService, W3cJsonLdVerifiableCredential, utils } from "@credo-ts/core";
|
|
4
|
+
import { ClaimFormat, CredoError, DidResolverService, JsonEncoder, JsonTransformer, SignatureSuiteRegistry, W3cCredential, W3cCredentialRecord, W3cCredentialService, W3cJsonLdCredentialService, W3cJsonLdCredentialSigningNotSupportedError, W3cJsonLdVerifiableCredential, utils } from "@credo-ts/core";
|
|
5
5
|
//#region src/modules/credentials/formats/jsonld/DidCommJsonLdCredentialFormatService.ts
|
|
6
6
|
const JSONLD_VC_DETAIL = "aries/ld-proof-vc-detail@v1.0";
|
|
7
7
|
const JSONLD_VC = "aries/ld-proof-vc@v1.0";
|
|
@@ -41,13 +41,20 @@ var DidCommJsonLdCredentialFormatService = class {
|
|
|
41
41
|
if (!credProposalJson) throw new CredoError("Missing jsonld credential proposal data payload");
|
|
42
42
|
JsonTransformer.fromJSON(credProposalJson, DidCommJsonLdCredentialDetail);
|
|
43
43
|
}
|
|
44
|
-
async acceptProposal(
|
|
44
|
+
async acceptProposal(agentContext, { attachmentId, proposalAttachment }) {
|
|
45
45
|
const format = new DidCommCredentialFormatSpec({
|
|
46
46
|
attachmentId,
|
|
47
47
|
format: JSONLD_VC_DETAIL
|
|
48
48
|
});
|
|
49
49
|
const credentialProposal = proposalAttachment.getDataAsJson();
|
|
50
50
|
JsonTransformer.fromJSON(credentialProposal, DidCommJsonLdCredentialDetail);
|
|
51
|
+
const credential = JsonTransformer.fromJSON(credentialProposal.credential, W3cCredential);
|
|
52
|
+
const verificationMethod = await this.deriveVerificationMethod(agentContext, credential, credentialProposal);
|
|
53
|
+
await agentContext.dependencyManager.resolve(W3cJsonLdCredentialService).assertCanSignCredential(agentContext, {
|
|
54
|
+
proofType: credentialProposal.options.proofType,
|
|
55
|
+
verificationMethod,
|
|
56
|
+
controller: credential.issuerId
|
|
57
|
+
});
|
|
51
58
|
const offerData = credentialProposal;
|
|
52
59
|
return {
|
|
53
60
|
format,
|
|
@@ -61,7 +68,7 @@ var DidCommJsonLdCredentialFormatService = class {
|
|
|
61
68
|
* @returns object containing associated attachment, formats and offersAttach elements
|
|
62
69
|
*
|
|
63
70
|
*/
|
|
64
|
-
async createOffer(
|
|
71
|
+
async createOffer(agentContext, { credentialFormats, attachmentId }) {
|
|
65
72
|
const format = new DidCommCredentialFormatSpec({
|
|
66
73
|
attachmentId,
|
|
67
74
|
format: JSONLD_VC_DETAIL
|
|
@@ -69,6 +76,13 @@ var DidCommJsonLdCredentialFormatService = class {
|
|
|
69
76
|
const jsonLdFormat = credentialFormats?.jsonld;
|
|
70
77
|
if (!jsonLdFormat) throw new CredoError("Missing jsonld payload in createOffer");
|
|
71
78
|
JsonTransformer.fromJSON(jsonLdFormat.credential, DidCommJsonLdCredentialDetail);
|
|
79
|
+
const credential = JsonTransformer.fromJSON(jsonLdFormat.credential, W3cCredential);
|
|
80
|
+
const verificationMethod = await this.deriveVerificationMethod(agentContext, credential, jsonLdFormat);
|
|
81
|
+
await agentContext.dependencyManager.resolve(W3cJsonLdCredentialService).assertCanSignCredential(agentContext, {
|
|
82
|
+
proofType: jsonLdFormat.options.proofType,
|
|
83
|
+
verificationMethod,
|
|
84
|
+
controller: credential.issuerId
|
|
85
|
+
});
|
|
72
86
|
return {
|
|
73
87
|
format,
|
|
74
88
|
attachment: this.getFormatData(jsonLdFormat, format.attachmentId)
|
|
@@ -116,7 +130,8 @@ var DidCommJsonLdCredentialFormatService = class {
|
|
|
116
130
|
async acceptRequest(agentContext, { credentialFormats, attachmentId, requestAttachment }) {
|
|
117
131
|
const w3cJsonLdCredentialService = agentContext.dependencyManager.resolve(W3cJsonLdCredentialService);
|
|
118
132
|
const credentialRequest = requestAttachment.getDataAsJson();
|
|
119
|
-
const
|
|
133
|
+
const credential = JsonTransformer.fromJSON(credentialRequest.credential, W3cCredential);
|
|
134
|
+
const verificationMethod = credentialFormats?.jsonld?.verificationMethod ?? await this.deriveVerificationMethod(agentContext, credential, credentialRequest);
|
|
120
135
|
if (!verificationMethod) throw new CredoError("Missing verification method in credential data");
|
|
121
136
|
const format = new DidCommCredentialFormatSpec({
|
|
122
137
|
attachmentId,
|
|
@@ -130,7 +145,6 @@ var DidCommJsonLdCredentialFormatService = class {
|
|
|
130
145
|
"created"
|
|
131
146
|
].filter((field) => options[field] !== void 0);
|
|
132
147
|
if (foundFields.length > 0) throw new CredoError(`Some fields are not currently supported in credential options: ${foundFields.join(", ")}`);
|
|
133
|
-
const credential = JsonTransformer.fromJSON(credentialRequest.credential, W3cCredential);
|
|
134
148
|
const verifiableCredential = await w3cJsonLdCredentialService.signCredential(agentContext, {
|
|
135
149
|
format: ClaimFormat.LdpVc,
|
|
136
150
|
credential,
|
|
@@ -143,21 +157,18 @@ var DidCommJsonLdCredentialFormatService = class {
|
|
|
143
157
|
};
|
|
144
158
|
}
|
|
145
159
|
/**
|
|
146
|
-
* Derive a verification method using the issuer from the given
|
|
147
|
-
* @param
|
|
160
|
+
* Derive a verification method using the issuer from the given credential
|
|
161
|
+
* @param credential the credential we want to sign
|
|
148
162
|
* @return the verification method derived from this credential and its associated issuer did, keys etc.
|
|
149
163
|
*/
|
|
150
|
-
async deriveVerificationMethod(agentContext,
|
|
164
|
+
async deriveVerificationMethod(agentContext, credential, credentialRequest) {
|
|
151
165
|
const didResolver = agentContext.dependencyManager.resolve(DidResolverService);
|
|
152
166
|
const w3cJsonLdCredentialService = agentContext.dependencyManager.resolve(W3cJsonLdCredentialService);
|
|
153
|
-
|
|
154
|
-
if (typeof issuerDid !== "string") issuerDid = issuerDid.id;
|
|
155
|
-
const issuerDidDocument = await didResolver.resolveDidDocument(agentContext, issuerDid);
|
|
167
|
+
const issuerDidDocument = await didResolver.resolveDidDocument(agentContext, credential.issuerId);
|
|
156
168
|
const proofType = credentialRequest.options.proofType;
|
|
157
169
|
const keyType = w3cJsonLdCredentialService.getVerificationMethodTypesByProofType(proofType);
|
|
158
|
-
if (!keyType || keyType.length === 0) throw new CredoError(`No Key Type found for proofType ${proofType}`);
|
|
159
170
|
const verificationMethod = issuerDidDocument.findVerificationMethodsByTypeAndPurpose(keyType, ["assertionMethod", "verificationMethod"])[0];
|
|
160
|
-
if (!verificationMethod) throw new
|
|
171
|
+
if (!verificationMethod) throw new W3cJsonLdCredentialSigningNotSupportedError(`Missing verification method for key type ${keyType}`, "no-compatible-verification-method");
|
|
161
172
|
return verificationMethod.id;
|
|
162
173
|
}
|
|
163
174
|
/**
|
package/build/modules/credentials/formats/jsonld/DidCommJsonLdCredentialFormatService.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DidCommJsonLdCredentialFormatService.mjs","names":[],"sources":["../../../../../src/modules/credentials/formats/jsonld/DidCommJsonLdCredentialFormatService.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\nimport {\n ClaimFormat,\n CredoError,\n DidResolverService,\n JsonEncoder,\n JsonTransformer,\n SignatureSuiteRegistry,\n utils,\n W3cCredential,\n W3cCredentialRecord,\n W3cCredentialService,\n W3cJsonLdCredentialService,\n W3cJsonLdVerifiableCredential,\n} from '@credo-ts/core'\nimport { DidCommAttachment, DidCommAttachmentData } from '../../../../decorators/attachment/DidCommAttachment'\nimport { DidCommCredentialFormatSpec } from '../../models/DidCommCredentialFormatSpec'\nimport type { DidCommCredentialFormatService } from '../DidCommCredentialFormatService'\nimport type {\n DidCommCredentialFormatAcceptOfferOptions,\n DidCommCredentialFormatAcceptProposalOptions,\n DidCommCredentialFormatAcceptRequestOptions,\n DidCommCredentialFormatAutoRespondCredentialOptions,\n DidCommCredentialFormatAutoRespondOfferOptions,\n DidCommCredentialFormatAutoRespondProposalOptions,\n DidCommCredentialFormatAutoRespondRequestOptions,\n DidCommCredentialFormatCreateOfferOptions,\n DidCommCredentialFormatCreateOfferReturn,\n DidCommCredentialFormatCreateProposalOptions,\n DidCommCredentialFormatCreateProposalReturn,\n DidCommCredentialFormatCreateRequestOptions,\n DidCommCredentialFormatCreateReturn,\n DidCommCredentialFormatProcessCredentialOptions,\n DidCommCredentialFormatProcessOptions,\n} from '../DidCommCredentialFormatServiceOptions'\nimport { DidCommJsonLdCredentialDetail } from './DidCommJsonLdCredentialDetail'\nimport type {\n DidCommJsonLdCredentialFormat,\n JsonCredential,\n JsonLdFormatDataCredentialDetail,\n JsonLdFormatDataVerifiableCredential,\n} from './DidCommJsonLdCredentialFormat'\n\nconst JSONLD_VC_DETAIL = 'aries/ld-proof-vc-detail@v1.0'\nconst JSONLD_VC = 'aries/ld-proof-vc@v1.0'\n\nexport class DidCommJsonLdCredentialFormatService\n implements DidCommCredentialFormatService<DidCommJsonLdCredentialFormat>\n{\n public readonly formatKey = 'jsonld' as const\n public readonly credentialRecordType = 'w3c' as const\n\n /**\n * Create a {@link AttachmentFormats} object dependent on the message type.\n *\n * @param options The object containing all the options for the proposed credential\n * @returns object containing associated attachment, formats and filtersAttach elements\n *\n */\n public async createProposal(\n _agentContext: AgentContext,\n { credentialFormats }: DidCommCredentialFormatCreateProposalOptions<DidCommJsonLdCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateProposalReturn> {\n const format = new DidCommCredentialFormatSpec({\n format: JSONLD_VC_DETAIL,\n })\n\n const jsonLdFormat = credentialFormats.jsonld\n if (!jsonLdFormat) {\n throw new CredoError('Missing jsonld payload in createProposal')\n }\n\n // this does the validation\n JsonTransformer.fromJSON(jsonLdFormat.credential, DidCommJsonLdCredentialDetail)\n\n // jsonLdFormat is now of type JsonLdFormatDataCredentialDetail\n const attachment = this.getFormatData(jsonLdFormat, format.attachmentId)\n return { format, attachment }\n }\n\n /**\n * Method called on reception of a propose credential message\n * @param options the options needed to accept the proposal\n */\n public async processProposal(\n _agentContext: AgentContext,\n { attachment }: DidCommCredentialFormatProcessOptions\n ): Promise<void> {\n const credProposalJson = attachment.getDataAsJson<JsonLdFormatDataCredentialDetail>()\n\n if (!credProposalJson) {\n throw new CredoError('Missing jsonld credential proposal data payload')\n }\n\n // validation is done in here\n JsonTransformer.fromJSON(credProposalJson, DidCommJsonLdCredentialDetail)\n }\n\n public async acceptProposal(\n _agentContext: AgentContext,\n { attachmentId, proposalAttachment }: DidCommCredentialFormatAcceptProposalOptions<DidCommJsonLdCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateOfferReturn> {\n // if the offer has an attachment Id use that, otherwise the generated id of the formats object\n const format = new DidCommCredentialFormatSpec({\n attachmentId,\n format: JSONLD_VC_DETAIL,\n })\n\n const credentialProposal = proposalAttachment.getDataAsJson<JsonLdFormatDataCredentialDetail>()\n JsonTransformer.fromJSON(credentialProposal, DidCommJsonLdCredentialDetail)\n\n const offerData = credentialProposal\n\n const attachment = this.getFormatData(offerData, format.attachmentId)\n\n return { format, attachment }\n }\n\n /**\n * Create a {@link AttachmentFormats} object dependent on the message type.\n *\n * @param options The object containing all the options for the credential offer\n * @returns object containing associated attachment, formats and offersAttach elements\n *\n */\n public async createOffer(\n _agentContext: AgentContext,\n { credentialFormats, attachmentId }: DidCommCredentialFormatCreateOfferOptions<DidCommJsonLdCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateOfferReturn> {\n // if the offer has an attachment Id use that, otherwise the generated id of the formats object\n const format = new DidCommCredentialFormatSpec({\n attachmentId,\n format: JSONLD_VC_DETAIL,\n })\n\n const jsonLdFormat = credentialFormats?.jsonld\n if (!jsonLdFormat) {\n throw new CredoError('Missing jsonld payload in createOffer')\n }\n\n // validate\n JsonTransformer.fromJSON(jsonLdFormat.credential, DidCommJsonLdCredentialDetail)\n\n const attachment = this.getFormatData(jsonLdFormat, format.attachmentId)\n\n return { format, attachment }\n }\n\n public async processOffer(_agentContext: AgentContext, { attachment }: DidCommCredentialFormatProcessOptions) {\n const credentialOfferJson = attachment.getDataAsJson<JsonLdFormatDataCredentialDetail>()\n\n if (!credentialOfferJson) {\n throw new CredoError('Missing jsonld credential offer data payload')\n }\n\n JsonTransformer.fromJSON(credentialOfferJson, DidCommJsonLdCredentialDetail)\n }\n\n public async acceptOffer(\n _agentContext: AgentContext,\n { attachmentId, offerAttachment }: DidCommCredentialFormatAcceptOfferOptions<DidCommJsonLdCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateReturn> {\n const credentialOffer = offerAttachment.getDataAsJson<JsonLdFormatDataCredentialDetail>()\n\n // validate\n JsonTransformer.fromJSON(credentialOffer, DidCommJsonLdCredentialDetail)\n\n const format = new DidCommCredentialFormatSpec({\n attachmentId,\n format: JSONLD_VC_DETAIL,\n })\n\n const attachment = this.getFormatData(credentialOffer, format.attachmentId)\n return { format, attachment }\n }\n\n /**\n * Create a credential attachment format for a credential request.\n *\n * @param options The object containing all the options for the credential request is derived\n * @returns object containing associated attachment, formats and requestAttach elements\n *\n */\n public async createRequest(\n _agentContext: AgentContext,\n { credentialFormats }: DidCommCredentialFormatCreateRequestOptions<DidCommJsonLdCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateReturn> {\n const jsonLdFormat = credentialFormats?.jsonld\n\n const format = new DidCommCredentialFormatSpec({\n format: JSONLD_VC_DETAIL,\n })\n\n if (!jsonLdFormat) {\n throw new CredoError('Missing jsonld payload in createRequest')\n }\n\n // this does the validation\n JsonTransformer.fromJSON(jsonLdFormat.credential, DidCommJsonLdCredentialDetail)\n\n const attachment = this.getFormatData(jsonLdFormat, format.attachmentId)\n\n return { format, attachment }\n }\n\n public async processRequest(\n _agentContext: AgentContext,\n { attachment }: DidCommCredentialFormatProcessOptions\n ): Promise<void> {\n const requestJson = attachment.getDataAsJson<JsonLdFormatDataCredentialDetail>()\n\n if (!requestJson) {\n throw new CredoError('Missing jsonld credential request data payload')\n }\n\n // validate\n JsonTransformer.fromJSON(requestJson, DidCommJsonLdCredentialDetail)\n }\n\n public async acceptRequest(\n agentContext: AgentContext,\n {\n credentialFormats,\n attachmentId,\n requestAttachment,\n }: DidCommCredentialFormatAcceptRequestOptions<DidCommJsonLdCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateReturn> {\n const w3cJsonLdCredentialService = agentContext.dependencyManager.resolve(W3cJsonLdCredentialService)\n\n // sign credential here. credential to be signed is received as the request attachment\n // (attachment in the request message from holder to issuer)\n const credentialRequest = requestAttachment.getDataAsJson<JsonLdFormatDataCredentialDetail>()\n\n const verificationMethod =\n credentialFormats?.jsonld?.verificationMethod ??\n (await this.deriveVerificationMethod(agentContext, credentialRequest.credential, credentialRequest))\n\n if (!verificationMethod) {\n throw new CredoError('Missing verification method in credential data')\n }\n const format = new DidCommCredentialFormatSpec({\n attachmentId,\n format: JSONLD_VC,\n })\n\n const options = credentialRequest.options\n\n // Get a list of fields found in the options that are not supported at the moment\n const unsupportedFields = ['challenge', 'domain', 'credentialStatus', 'created'] as const\n const foundFields = unsupportedFields.filter((field) => options[field] !== undefined)\n\n if (foundFields.length > 0) {\n throw new CredoError(`Some fields are not currently supported in credential options: ${foundFields.join(', ')}`)\n }\n\n const credential = JsonTransformer.fromJSON(credentialRequest.credential, W3cCredential)\n\n const verifiableCredential = await w3cJsonLdCredentialService.signCredential(agentContext, {\n format: ClaimFormat.LdpVc,\n credential,\n proofType: credentialRequest.options.proofType,\n verificationMethod: verificationMethod,\n })\n\n const attachment = this.getFormatData(JsonTransformer.toJSON(verifiableCredential), format.attachmentId)\n return { format, attachment }\n }\n\n /**\n * Derive a verification method using the issuer from the given verifiable credential\n * @param credentialAsJson the verifiable credential we want to sign\n * @return the verification method derived from this credential and its associated issuer did, keys etc.\n */\n private async deriveVerificationMethod(\n agentContext: AgentContext,\n credentialAsJson: JsonCredential,\n credentialRequest: JsonLdFormatDataCredentialDetail\n ): Promise<string> {\n const didResolver = agentContext.dependencyManager.resolve(DidResolverService)\n const w3cJsonLdCredentialService = agentContext.dependencyManager.resolve(W3cJsonLdCredentialService)\n\n const credential = JsonTransformer.fromJSON(credentialAsJson, W3cCredential)\n\n // extract issuer from vc (can be string or Issuer)\n let issuerDid = credential.issuer\n\n if (typeof issuerDid !== 'string') {\n issuerDid = issuerDid.id\n }\n // this will throw an error if the issuer did is invalid\n const issuerDidDocument = await didResolver.resolveDidDocument(agentContext, issuerDid)\n\n // find first key which matches proof type\n const proofType = credentialRequest.options.proofType\n\n // actually gets the key type(s)\n const keyType = w3cJsonLdCredentialService.getVerificationMethodTypesByProofType(proofType)\n\n if (!keyType || keyType.length === 0) {\n throw new CredoError(`No Key Type found for proofType ${proofType}`)\n }\n\n const verificationMethod = issuerDidDocument.findVerificationMethodsByTypeAndPurpose(keyType, [\n 'assertionMethod',\n 'verificationMethod',\n ])[0]\n\n if (!verificationMethod) {\n throw new CredoError(`Missing verification method for key type ${keyType}`)\n }\n\n return verificationMethod.id\n }\n /**\n * Processes an incoming credential - retrieve metadata, retrieve payload and store it in the Indy wallet\n * @param options the issue credential message wrapped inside this object\n * @param credentialExchangeRecord the credential exchange record for this credential\n */\n public async processCredential(\n agentContext: AgentContext,\n { credentialExchangeRecord, attachment, requestAttachment }: DidCommCredentialFormatProcessCredentialOptions\n ): Promise<void> {\n const w3cCredentialService = agentContext.dependencyManager.resolve(W3cCredentialService)\n\n const credentialAsJson = attachment.getDataAsJson()\n const credential = JsonTransformer.fromJSON(credentialAsJson, W3cJsonLdVerifiableCredential)\n const requestAsJson = requestAttachment.getDataAsJson<JsonLdFormatDataCredentialDetail>()\n\n // Verify the credential request matches the credential\n this.verifyReceivedCredentialMatchesRequest(agentContext, credential, requestAsJson)\n\n // verify signatures of the credential\n const result = await w3cCredentialService.verifyCredential(agentContext, { credential })\n if (result && !result.isValid) {\n throw new CredoError(`Failed to validate credential, error = ${result.error}`)\n }\n\n const verifiableCredential = await w3cCredentialService.storeCredential(agentContext, {\n record: W3cCredentialRecord.fromCredential(credential),\n })\n\n credentialExchangeRecord.credentials.push({\n credentialRecordType: this.credentialRecordType,\n credentialRecordId: verifiableCredential.id,\n })\n }\n\n private verifyReceivedCredentialMatchesRequest(\n agentContext: AgentContext,\n credential: W3cJsonLdVerifiableCredential,\n request: JsonLdFormatDataCredentialDetail\n ): void {\n const jsonCredential = JsonTransformer.toJSON(credential)\n jsonCredential.proof = undefined\n\n if (Array.isArray(credential.proof)) {\n throw new CredoError('Credential proof arrays are not supported')\n }\n\n if (request.options.created && credential.proof.created !== request.options.created) {\n throw new CredoError('Received credential proof created does not match created from credential request')\n }\n\n if (credential.proof.domain !== request.options.domain) {\n throw new CredoError('Received credential proof domain does not match domain from credential request')\n }\n\n if (credential.proof.challenge !== request.options.challenge) {\n throw new CredoError('Received credential proof challenge does not match challenge from credential request')\n }\n\n if (credential.proof.type !== request.options.proofType) {\n throw new CredoError('Received credential proof type does not match proof type from credential request')\n }\n\n if (credential.proof.proofPurpose !== request.options.proofPurpose) {\n throw new CredoError('Received credential proof purpose does not match proof purpose from credential request')\n }\n\n // Check whether the received credential (minus the proof) matches the credential request. A\n // signature suite is required to add its own `@context` to the document it signs when the\n // document does not already carry a compatible one, so the issuer adding exactly that context\n // url is an expected difference rather than a mismatch.\n if (\n !utils.areObjectsEqual(jsonCredential, request.credential) &&\n !utils.areObjectsEqual(jsonCredential, this.withSuiteContext(agentContext, request))\n ) {\n throw new CredoError('Received credential does not match credential request')\n }\n\n // TODO: add check for the credentialStatus once this is supported in Credo\n }\n\n /**\n * Returns the requested credential with the `@context` of the agreed proof type's signature suite\n * appended, mirroring what the issuer's suite does when signing. Returns the requested credential\n * unchanged if the context is already present or the suite declares no context url.\n */\n private withSuiteContext(agentContext: AgentContext, request: JsonLdFormatDataCredentialDetail): JsonCredential {\n const signatureSuiteRegistry = agentContext.dependencyManager.resolve(SignatureSuiteRegistry)\n const suiteContextUrl = signatureSuiteRegistry.findContextUrlByProofType(request.options.proofType)\n\n const existingContext = request.credential['@context']\n if (!suiteContextUrl || !Array.isArray(existingContext) || existingContext.includes(suiteContextUrl)) {\n return request.credential\n }\n\n return { ...request.credential, '@context': [...existingContext, suiteContextUrl] }\n }\n\n public supportsFormat(format: string): boolean {\n const supportedFormats = [JSONLD_VC_DETAIL, JSONLD_VC]\n\n return supportedFormats.includes(format)\n }\n\n public async deleteCredentialById(agentContext: AgentContext, credentialRecordId: string): Promise<void> {\n const w3cCredentialService = agentContext.dependencyManager.resolve(W3cCredentialService)\n\n await w3cCredentialService.removeCredentialRecord(agentContext, credentialRecordId)\n }\n\n public areCredentialsEqual = (message1: DidCommAttachment, message2: DidCommAttachment): boolean => {\n const obj1 = message1.getDataAsJson()\n const obj2 = message2.getDataAsJson()\n\n return utils.areObjectsEqual(obj1, obj2)\n }\n\n public async shouldAutoRespondToProposal(\n _agentContext: AgentContext,\n { offerAttachment, proposalAttachment }: DidCommCredentialFormatAutoRespondProposalOptions\n ) {\n return this.areCredentialsEqual(proposalAttachment, offerAttachment)\n }\n\n public async shouldAutoRespondToOffer(\n _agentContext: AgentContext,\n { offerAttachment, proposalAttachment }: DidCommCredentialFormatAutoRespondOfferOptions\n ) {\n return this.areCredentialsEqual(proposalAttachment, offerAttachment)\n }\n\n public async shouldAutoRespondToRequest(\n _agentContext: AgentContext,\n { offerAttachment, requestAttachment }: DidCommCredentialFormatAutoRespondRequestOptions\n ) {\n return this.areCredentialsEqual(offerAttachment, requestAttachment)\n }\n\n public async shouldAutoRespondToCredential(\n agentContext: AgentContext,\n { requestAttachment, credentialAttachment }: DidCommCredentialFormatAutoRespondCredentialOptions\n ) {\n const credentialJson = credentialAttachment.getDataAsJson<JsonLdFormatDataVerifiableCredential>()\n const w3cCredential = JsonTransformer.fromJSON(credentialJson, W3cJsonLdVerifiableCredential)\n const request = requestAttachment.getDataAsJson<JsonLdFormatDataCredentialDetail>()\n\n try {\n // This check is also done in the processCredential method, but we do it here as well\n // to be certain we don't skip the check\n this.verifyReceivedCredentialMatchesRequest(agentContext, w3cCredential, request)\n\n return true\n } catch (_error) {\n return false\n }\n }\n\n /**\n * Returns an object of type {@link DidCommAttachment} for use in credential exchange messages.\n * It looks up the correct format identifier and encodes the data as a base64 attachment.\n *\n * @param data The data to include in the attach object\n * @param id the attach id from the formats component of the message\n */\n private getFormatData(data: unknown, id: string): DidCommAttachment {\n const attachment = new DidCommAttachment({\n id,\n mimeType: 'application/json',\n data: new DidCommAttachmentData({\n base64: JsonEncoder.toBase64(data),\n }),\n })\n\n return attachment\n }\n}\n"],"mappings":";;;;;AA2CA,MAAM,mBAAmB;AACzB,MAAM,YAAY;AAElB,IAAa,uCAAb,MAEA;;EACE,KAAgB,YAAY;EAC5B,KAAgB,uBAAuB;EAoXvC,KAAO,uBAAuB,UAA6B,aAAyC;GAClG,MAAM,OAAO,SAAS,cAAc;GACpC,MAAM,OAAO,SAAS,cAAc;GAEpC,OAAO,MAAM,gBAAgB,MAAM,IAAI;EACzC;;;;;;;;;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Ae,GACjG,OAAO,QAAQ;EAGjB,OAAO;GAAE,GAAG,QAAQ;GAAY,YAAY,CAAC,GAAG,iBAAiB,eAAe;EAAE;CACpF;CAEA,eAAsB,QAAyB;EAG7C,OAAO,CAFmB,kBAAkB,SAEtB,CAAC,CAAC,SAAS,MAAM;CACzC;CAEA,MAAa,qBAAqB,cAA4B,oBAA2C;EAGvG,MAF6B,aAAa,kBAAkB,QAAQ,oBAE3C,CAAC,CAAC,uBAAuB,cAAc,kBAAkB;CACpF;CASA,MAAa,4BACX,eACA,EAAE,iBAAiB,sBACnB;EACA,OAAO,KAAK,oBAAoB,oBAAoB,eAAe;CACrE;CAEA,MAAa,yBACX,eACA,EAAE,iBAAiB,sBACnB;EACA,OAAO,KAAK,oBAAoB,oBAAoB,eAAe;CACrE;CAEA,MAAa,2BACX,eACA,EAAE,iBAAiB,qBACnB;EACA,OAAO,KAAK,oBAAoB,iBAAiB,iBAAiB;CACpE;CAEA,MAAa,8BACX,cACA,EAAE,mBAAmB,wBACrB;EACA,MAAM,iBAAiB,qBAAqB,cAAoD;EAChG,MAAM,gBAAgB,gBAAgB,SAAS,gBAAgB,6BAA6B;EAC5F,MAAM,UAAU,kBAAkB,cAAgD;EAElF,IAAI;GAGF,KAAK,uCAAuC,cAAc,eAAe,OAAO;GAEhF,OAAO;EACT,SAAS,QAAQ;GACf,OAAO;EACT;CACF;;;;;;;;CASA,cAAsB,MAAe,IAA+B;EASlE,OAAO,IARgB,kBAAkB;GACvC;GACA,UAAU;GACV,MAAM,IAAI,sBAAsB,EAC9B,QAAQ,YAAY,SAAS,IAAI,EACnC,CAAC;EACH,CAEgB;CAClB;AACF"}
|
|
1
|
+
{"version":3,"file":"DidCommJsonLdCredentialFormatService.mjs","names":[],"sources":["../../../../../src/modules/credentials/formats/jsonld/DidCommJsonLdCredentialFormatService.ts"],"sourcesContent":["import type { AgentContext } from '@credo-ts/core'\nimport {\n ClaimFormat,\n CredoError,\n DidResolverService,\n JsonEncoder,\n JsonTransformer,\n SignatureSuiteRegistry,\n utils,\n W3cCredential,\n W3cCredentialRecord,\n W3cCredentialService,\n W3cJsonLdCredentialService,\n W3cJsonLdCredentialSigningNotSupportedError,\n W3cJsonLdVerifiableCredential,\n} from '@credo-ts/core'\nimport { DidCommAttachment, DidCommAttachmentData } from '../../../../decorators/attachment/DidCommAttachment'\nimport { DidCommCredentialFormatSpec } from '../../models/DidCommCredentialFormatSpec'\nimport type { DidCommCredentialFormatService } from '../DidCommCredentialFormatService'\nimport type {\n DidCommCredentialFormatAcceptOfferOptions,\n DidCommCredentialFormatAcceptProposalOptions,\n DidCommCredentialFormatAcceptRequestOptions,\n DidCommCredentialFormatAutoRespondCredentialOptions,\n DidCommCredentialFormatAutoRespondOfferOptions,\n DidCommCredentialFormatAutoRespondProposalOptions,\n DidCommCredentialFormatAutoRespondRequestOptions,\n DidCommCredentialFormatCreateOfferOptions,\n DidCommCredentialFormatCreateOfferReturn,\n DidCommCredentialFormatCreateProposalOptions,\n DidCommCredentialFormatCreateProposalReturn,\n DidCommCredentialFormatCreateRequestOptions,\n DidCommCredentialFormatCreateReturn,\n DidCommCredentialFormatProcessCredentialOptions,\n DidCommCredentialFormatProcessOptions,\n} from '../DidCommCredentialFormatServiceOptions'\nimport { DidCommJsonLdCredentialDetail } from './DidCommJsonLdCredentialDetail'\nimport type {\n DidCommJsonLdCredentialFormat,\n JsonCredential,\n JsonLdFormatDataCredentialDetail,\n JsonLdFormatDataVerifiableCredential,\n} from './DidCommJsonLdCredentialFormat'\n\nconst JSONLD_VC_DETAIL = 'aries/ld-proof-vc-detail@v1.0'\nconst JSONLD_VC = 'aries/ld-proof-vc@v1.0'\n\nexport class DidCommJsonLdCredentialFormatService\n implements DidCommCredentialFormatService<DidCommJsonLdCredentialFormat>\n{\n public readonly formatKey = 'jsonld' as const\n public readonly credentialRecordType = 'w3c' as const\n\n /**\n * Create a {@link AttachmentFormats} object dependent on the message type.\n *\n * @param options The object containing all the options for the proposed credential\n * @returns object containing associated attachment, formats and filtersAttach elements\n *\n */\n public async createProposal(\n _agentContext: AgentContext,\n { credentialFormats }: DidCommCredentialFormatCreateProposalOptions<DidCommJsonLdCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateProposalReturn> {\n const format = new DidCommCredentialFormatSpec({\n format: JSONLD_VC_DETAIL,\n })\n\n const jsonLdFormat = credentialFormats.jsonld\n if (!jsonLdFormat) {\n throw new CredoError('Missing jsonld payload in createProposal')\n }\n\n // this does the validation\n JsonTransformer.fromJSON(jsonLdFormat.credential, DidCommJsonLdCredentialDetail)\n\n // jsonLdFormat is now of type JsonLdFormatDataCredentialDetail\n const attachment = this.getFormatData(jsonLdFormat, format.attachmentId)\n return { format, attachment }\n }\n\n /**\n * Method called on reception of a propose credential message\n * @param options the options needed to accept the proposal\n */\n public async processProposal(\n _agentContext: AgentContext,\n { attachment }: DidCommCredentialFormatProcessOptions\n ): Promise<void> {\n const credProposalJson = attachment.getDataAsJson<JsonLdFormatDataCredentialDetail>()\n\n if (!credProposalJson) {\n throw new CredoError('Missing jsonld credential proposal data payload')\n }\n\n // validation is done in here\n JsonTransformer.fromJSON(credProposalJson, DidCommJsonLdCredentialDetail)\n }\n\n public async acceptProposal(\n agentContext: AgentContext,\n { attachmentId, proposalAttachment }: DidCommCredentialFormatAcceptProposalOptions<DidCommJsonLdCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateOfferReturn> {\n // if the offer has an attachment Id use that, otherwise the generated id of the formats object\n const format = new DidCommCredentialFormatSpec({\n attachmentId,\n format: JSONLD_VC_DETAIL,\n })\n\n const credentialProposal = proposalAttachment.getDataAsJson<JsonLdFormatDataCredentialDetail>()\n JsonTransformer.fromJSON(credentialProposal, DidCommJsonLdCredentialDetail)\n\n const credential = JsonTransformer.fromJSON(credentialProposal.credential, W3cCredential)\n const verificationMethod = await this.deriveVerificationMethod(agentContext, credential, credentialProposal)\n const w3cJsonLdCredentialService = agentContext.dependencyManager.resolve(W3cJsonLdCredentialService)\n await w3cJsonLdCredentialService.assertCanSignCredential(agentContext, {\n proofType: credentialProposal.options.proofType,\n verificationMethod,\n controller: credential.issuerId,\n })\n\n const offerData = credentialProposal\n\n const attachment = this.getFormatData(offerData, format.attachmentId)\n\n return { format, attachment }\n }\n\n /**\n * Create a {@link AttachmentFormats} object dependent on the message type.\n *\n * @param options The object containing all the options for the credential offer\n * @returns object containing associated attachment, formats and offersAttach elements\n *\n */\n public async createOffer(\n agentContext: AgentContext,\n { credentialFormats, attachmentId }: DidCommCredentialFormatCreateOfferOptions<DidCommJsonLdCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateOfferReturn> {\n // if the offer has an attachment Id use that, otherwise the generated id of the formats object\n const format = new DidCommCredentialFormatSpec({\n attachmentId,\n format: JSONLD_VC_DETAIL,\n })\n\n const jsonLdFormat = credentialFormats?.jsonld\n if (!jsonLdFormat) {\n throw new CredoError('Missing jsonld payload in createOffer')\n }\n\n // validate\n JsonTransformer.fromJSON(jsonLdFormat.credential, DidCommJsonLdCredentialDetail)\n\n const credential = JsonTransformer.fromJSON(jsonLdFormat.credential, W3cCredential)\n const verificationMethod = await this.deriveVerificationMethod(agentContext, credential, jsonLdFormat)\n const w3cJsonLdCredentialService = agentContext.dependencyManager.resolve(W3cJsonLdCredentialService)\n await w3cJsonLdCredentialService.assertCanSignCredential(agentContext, {\n proofType: jsonLdFormat.options.proofType,\n verificationMethod,\n controller: credential.issuerId,\n })\n\n const attachment = this.getFormatData(jsonLdFormat, format.attachmentId)\n\n return { format, attachment }\n }\n\n public async processOffer(_agentContext: AgentContext, { attachment }: DidCommCredentialFormatProcessOptions) {\n const credentialOfferJson = attachment.getDataAsJson<JsonLdFormatDataCredentialDetail>()\n\n if (!credentialOfferJson) {\n throw new CredoError('Missing jsonld credential offer data payload')\n }\n\n JsonTransformer.fromJSON(credentialOfferJson, DidCommJsonLdCredentialDetail)\n }\n\n public async acceptOffer(\n _agentContext: AgentContext,\n { attachmentId, offerAttachment }: DidCommCredentialFormatAcceptOfferOptions<DidCommJsonLdCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateReturn> {\n const credentialOffer = offerAttachment.getDataAsJson<JsonLdFormatDataCredentialDetail>()\n\n // validate\n JsonTransformer.fromJSON(credentialOffer, DidCommJsonLdCredentialDetail)\n\n const format = new DidCommCredentialFormatSpec({\n attachmentId,\n format: JSONLD_VC_DETAIL,\n })\n\n const attachment = this.getFormatData(credentialOffer, format.attachmentId)\n return { format, attachment }\n }\n\n /**\n * Create a credential attachment format for a credential request.\n *\n * @param options The object containing all the options for the credential request is derived\n * @returns object containing associated attachment, formats and requestAttach elements\n *\n */\n public async createRequest(\n _agentContext: AgentContext,\n { credentialFormats }: DidCommCredentialFormatCreateRequestOptions<DidCommJsonLdCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateReturn> {\n const jsonLdFormat = credentialFormats?.jsonld\n\n const format = new DidCommCredentialFormatSpec({\n format: JSONLD_VC_DETAIL,\n })\n\n if (!jsonLdFormat) {\n throw new CredoError('Missing jsonld payload in createRequest')\n }\n\n // this does the validation\n JsonTransformer.fromJSON(jsonLdFormat.credential, DidCommJsonLdCredentialDetail)\n\n const attachment = this.getFormatData(jsonLdFormat, format.attachmentId)\n\n return { format, attachment }\n }\n\n public async processRequest(\n _agentContext: AgentContext,\n { attachment }: DidCommCredentialFormatProcessOptions\n ): Promise<void> {\n const requestJson = attachment.getDataAsJson<JsonLdFormatDataCredentialDetail>()\n\n if (!requestJson) {\n throw new CredoError('Missing jsonld credential request data payload')\n }\n\n // validate\n JsonTransformer.fromJSON(requestJson, DidCommJsonLdCredentialDetail)\n }\n\n public async acceptRequest(\n agentContext: AgentContext,\n {\n credentialFormats,\n attachmentId,\n requestAttachment,\n }: DidCommCredentialFormatAcceptRequestOptions<DidCommJsonLdCredentialFormat>\n ): Promise<DidCommCredentialFormatCreateReturn> {\n const w3cJsonLdCredentialService = agentContext.dependencyManager.resolve(W3cJsonLdCredentialService)\n\n // sign credential here. credential to be signed is received as the request attachment\n // (attachment in the request message from holder to issuer)\n const credentialRequest = requestAttachment.getDataAsJson<JsonLdFormatDataCredentialDetail>()\n const credential = JsonTransformer.fromJSON(credentialRequest.credential, W3cCredential)\n\n const verificationMethod =\n credentialFormats?.jsonld?.verificationMethod ??\n (await this.deriveVerificationMethod(agentContext, credential, credentialRequest))\n\n if (!verificationMethod) {\n throw new CredoError('Missing verification method in credential data')\n }\n const format = new DidCommCredentialFormatSpec({\n attachmentId,\n format: JSONLD_VC,\n })\n\n const options = credentialRequest.options\n\n // Get a list of fields found in the options that are not supported at the moment\n const unsupportedFields = ['challenge', 'domain', 'credentialStatus', 'created'] as const\n const foundFields = unsupportedFields.filter((field) => options[field] !== undefined)\n\n if (foundFields.length > 0) {\n throw new CredoError(`Some fields are not currently supported in credential options: ${foundFields.join(', ')}`)\n }\n\n const verifiableCredential = await w3cJsonLdCredentialService.signCredential(agentContext, {\n format: ClaimFormat.LdpVc,\n credential,\n proofType: credentialRequest.options.proofType,\n verificationMethod: verificationMethod,\n })\n\n const attachment = this.getFormatData(JsonTransformer.toJSON(verifiableCredential), format.attachmentId)\n return { format, attachment }\n }\n\n /**\n * Derive a verification method using the issuer from the given credential\n * @param credential the credential we want to sign\n * @return the verification method derived from this credential and its associated issuer did, keys etc.\n */\n private async deriveVerificationMethod(\n agentContext: AgentContext,\n credential: W3cCredential,\n credentialRequest: { options: { proofType: string } }\n ): Promise<string> {\n const didResolver = agentContext.dependencyManager.resolve(DidResolverService)\n const w3cJsonLdCredentialService = agentContext.dependencyManager.resolve(W3cJsonLdCredentialService)\n\n // this will throw an error if the issuer did is invalid\n const issuerDidDocument = await didResolver.resolveDidDocument(agentContext, credential.issuerId)\n\n // find first key which matches proof type\n const proofType = credentialRequest.options.proofType\n\n // actually gets the key type(s)\n const keyType = w3cJsonLdCredentialService.getVerificationMethodTypesByProofType(proofType)\n\n const verificationMethod = issuerDidDocument.findVerificationMethodsByTypeAndPurpose(keyType, [\n 'assertionMethod',\n 'verificationMethod',\n ])[0]\n\n if (!verificationMethod) {\n throw new W3cJsonLdCredentialSigningNotSupportedError(\n `Missing verification method for key type ${keyType}`,\n 'no-compatible-verification-method'\n )\n }\n\n return verificationMethod.id\n }\n /**\n * Processes an incoming credential - retrieve metadata, retrieve payload and store it in the Indy wallet\n * @param options the issue credential message wrapped inside this object\n * @param credentialExchangeRecord the credential exchange record for this credential\n */\n public async processCredential(\n agentContext: AgentContext,\n { credentialExchangeRecord, attachment, requestAttachment }: DidCommCredentialFormatProcessCredentialOptions\n ): Promise<void> {\n const w3cCredentialService = agentContext.dependencyManager.resolve(W3cCredentialService)\n\n const credentialAsJson = attachment.getDataAsJson()\n const credential = JsonTransformer.fromJSON(credentialAsJson, W3cJsonLdVerifiableCredential)\n const requestAsJson = requestAttachment.getDataAsJson<JsonLdFormatDataCredentialDetail>()\n\n // Verify the credential request matches the credential\n this.verifyReceivedCredentialMatchesRequest(agentContext, credential, requestAsJson)\n\n // verify signatures of the credential\n const result = await w3cCredentialService.verifyCredential(agentContext, { credential })\n if (result && !result.isValid) {\n throw new CredoError(`Failed to validate credential, error = ${result.error}`)\n }\n\n const verifiableCredential = await w3cCredentialService.storeCredential(agentContext, {\n record: W3cCredentialRecord.fromCredential(credential),\n })\n\n credentialExchangeRecord.credentials.push({\n credentialRecordType: this.credentialRecordType,\n credentialRecordId: verifiableCredential.id,\n })\n }\n\n private verifyReceivedCredentialMatchesRequest(\n agentContext: AgentContext,\n credential: W3cJsonLdVerifiableCredential,\n request: JsonLdFormatDataCredentialDetail\n ): void {\n const jsonCredential = JsonTransformer.toJSON(credential)\n jsonCredential.proof = undefined\n\n if (Array.isArray(credential.proof)) {\n throw new CredoError('Credential proof arrays are not supported')\n }\n\n if (request.options.created && credential.proof.created !== request.options.created) {\n throw new CredoError('Received credential proof created does not match created from credential request')\n }\n\n if (credential.proof.domain !== request.options.domain) {\n throw new CredoError('Received credential proof domain does not match domain from credential request')\n }\n\n if (credential.proof.challenge !== request.options.challenge) {\n throw new CredoError('Received credential proof challenge does not match challenge from credential request')\n }\n\n if (credential.proof.type !== request.options.proofType) {\n throw new CredoError('Received credential proof type does not match proof type from credential request')\n }\n\n if (credential.proof.proofPurpose !== request.options.proofPurpose) {\n throw new CredoError('Received credential proof purpose does not match proof purpose from credential request')\n }\n\n // Check whether the received credential (minus the proof) matches the credential request. A\n // signature suite is required to add its own `@context` to the document it signs when the\n // document does not already carry a compatible one, so the issuer adding exactly that context\n // url is an expected difference rather than a mismatch.\n if (\n !utils.areObjectsEqual(jsonCredential, request.credential) &&\n !utils.areObjectsEqual(jsonCredential, this.withSuiteContext(agentContext, request))\n ) {\n throw new CredoError('Received credential does not match credential request')\n }\n\n // TODO: add check for the credentialStatus once this is supported in Credo\n }\n\n /**\n * Returns the requested credential with the `@context` of the agreed proof type's signature suite\n * appended, mirroring what the issuer's suite does when signing. Returns the requested credential\n * unchanged if the context is already present or the suite declares no context url.\n */\n private withSuiteContext(agentContext: AgentContext, request: JsonLdFormatDataCredentialDetail): JsonCredential {\n const signatureSuiteRegistry = agentContext.dependencyManager.resolve(SignatureSuiteRegistry)\n const suiteContextUrl = signatureSuiteRegistry.findContextUrlByProofType(request.options.proofType)\n\n const existingContext = request.credential['@context']\n if (!suiteContextUrl || !Array.isArray(existingContext) || existingContext.includes(suiteContextUrl)) {\n return request.credential\n }\n\n return { ...request.credential, '@context': [...existingContext, suiteContextUrl] }\n }\n\n public supportsFormat(format: string): boolean {\n const supportedFormats = [JSONLD_VC_DETAIL, JSONLD_VC]\n\n return supportedFormats.includes(format)\n }\n\n public async deleteCredentialById(agentContext: AgentContext, credentialRecordId: string): Promise<void> {\n const w3cCredentialService = agentContext.dependencyManager.resolve(W3cCredentialService)\n\n await w3cCredentialService.removeCredentialRecord(agentContext, credentialRecordId)\n }\n\n public areCredentialsEqual = (message1: DidCommAttachment, message2: DidCommAttachment): boolean => {\n const obj1 = message1.getDataAsJson()\n const obj2 = message2.getDataAsJson()\n\n return utils.areObjectsEqual(obj1, obj2)\n }\n\n public async shouldAutoRespondToProposal(\n _agentContext: AgentContext,\n { offerAttachment, proposalAttachment }: DidCommCredentialFormatAutoRespondProposalOptions\n ) {\n return this.areCredentialsEqual(proposalAttachment, offerAttachment)\n }\n\n public async shouldAutoRespondToOffer(\n _agentContext: AgentContext,\n { offerAttachment, proposalAttachment }: DidCommCredentialFormatAutoRespondOfferOptions\n ) {\n return this.areCredentialsEqual(proposalAttachment, offerAttachment)\n }\n\n public async shouldAutoRespondToRequest(\n _agentContext: AgentContext,\n { offerAttachment, requestAttachment }: DidCommCredentialFormatAutoRespondRequestOptions\n ) {\n return this.areCredentialsEqual(offerAttachment, requestAttachment)\n }\n\n public async shouldAutoRespondToCredential(\n agentContext: AgentContext,\n { requestAttachment, credentialAttachment }: DidCommCredentialFormatAutoRespondCredentialOptions\n ) {\n const credentialJson = credentialAttachment.getDataAsJson<JsonLdFormatDataVerifiableCredential>()\n const w3cCredential = JsonTransformer.fromJSON(credentialJson, W3cJsonLdVerifiableCredential)\n const request = requestAttachment.getDataAsJson<JsonLdFormatDataCredentialDetail>()\n\n try {\n // This check is also done in the processCredential method, but we do it here as well\n // to be certain we don't skip the check\n this.verifyReceivedCredentialMatchesRequest(agentContext, w3cCredential, request)\n\n return true\n } catch (_error) {\n return false\n }\n }\n\n /**\n * Returns an object of type {@link DidCommAttachment} for use in credential exchange messages.\n * It looks up the correct format identifier and encodes the data as a base64 attachment.\n *\n * @param data The data to include in the attach object\n * @param id the attach id from the formats component of the message\n */\n private getFormatData(data: unknown, id: string): DidCommAttachment {\n const attachment = new DidCommAttachment({\n id,\n mimeType: 'application/json',\n data: new DidCommAttachmentData({\n base64: JsonEncoder.toBase64(data),\n }),\n })\n\n return attachment\n }\n}\n"],"mappings":";;;;;AA4CA,MAAM,mBAAmB;AACzB,MAAM,YAAY;AAElB,IAAa,uCAAb,MAEA;;EACE,KAAgB,YAAY;EAC5B,KAAgB,uBAAuB;EA4XvC,KAAO,uBAAuB,UAA6B,aAAyC;GAClG,MAAM,OAA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AQ;GACf,OAAO;EACT;CACF;;;;;;;;CASA,cAAsB,MAAe,IAA+B;EASlE,OAAO,IARgB,kBAAkB;GACvC;GACA,UAAU;GACV,MAAM,IAAI,sBAAsB,EAC9B,QAAQ,YAAY,SAAS,IAAI,EACnC,CAAC;EACH,CAEgB;CAClB;AACF"}
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
".": "./build/index.mjs",
|
|
5
5
|
"./package.json": "./package.json"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.7.3
|
|
7
|
+
"version": "0.7.3",
|
|
8
8
|
"files": [
|
|
9
9
|
"build"
|
|
10
10
|
],
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"luxon": "^3.7.2",
|
|
25
25
|
"query-string": "^9.3.1",
|
|
26
26
|
"rxjs": "^7.8.2",
|
|
27
|
-
"@credo-ts/core": "0.7.3
|
|
27
|
+
"@credo-ts/core": "0.7.3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@animo-id/pex": "^6.1.1",
|