-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy path@animo-id__credo-ts-core.patch
68 lines (68 loc) · 4.31 KB
/
@animo-id__credo-ts-core.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
diff --git a/build/crypto/JwsService.js b/build/crypto/JwsService.js
index 3e22a79bd52c03520af3331a19b7c640e9adff65..d61c965893e5456bd5b54da9156355a3dc154f50 100644
--- a/build/crypto/JwsService.js
+++ b/build/crypto/JwsService.js
@@ -159,9 +159,9 @@ let JwsService = class JwsService {
return { isValid: true, signerKeys, jws: jwsFlattened };
}
buildProtected(options) {
- if ([options.jwk, options.kid, options.x5c].filter(Boolean).length != 1) {
- throw new error_1.CredoError('Only one of JWK, kid or x5c can and must be provided.');
- }
+ // if ([options.jwk, options.kid, options.x5c].filter(Boolean).length != 1) {
+ // throw new error_1.CredoError('Only one of JWK, kid or x5c can and must be provided.');
+ // }
return {
...options,
alg: options.alg,
@@ -171,9 +171,9 @@ let JwsService = class JwsService {
}
async jwkFromJws(agentContext, options) {
const { protectedHeader, jwkResolver, jws, payload, trustedCertificates: trustedCertificatesFromOptions = [], } = options;
- if ([protectedHeader.jwk, protectedHeader.kid, protectedHeader.x5c].filter(Boolean).length > 1) {
- throw new error_1.CredoError('Only one of jwk, kid and x5c headers can and must be provided.');
- }
+ // if ([protectedHeader.jwk, protectedHeader.kid, protectedHeader.x5c].filter(Boolean).length > 1) {
+ // throw new error_1.CredoError('Only one of jwk, kid and x5c headers can and must be provided.');
+ // }
if (protectedHeader.x5c) {
if (!Array.isArray(protectedHeader.x5c) ||
protectedHeader.x5c.some((certificate) => typeof certificate !== 'string')) {
diff --git a/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js b/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js
index 3a1d05c2b03c38456d388d80537114478e0c067b..dff24a434191606ce05a3fb36ddbec032d9f8b96 100644
--- a/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js
+++ b/build/modules/dif-presentation-exchange/DifPresentationExchangeService.js
@@ -33,8 +33,15 @@ let DifPresentationExchangeService = class DifPresentationExchangeService {
this.pex = new pex_1.PEX({ hasher: crypto_1.Hasher.hash });
}
async getCredentialsForRequest(agentContext, presentationDefinition) {
- const credentialRecords = await this.queryCredentialForPresentationDefinition(agentContext, presentationDefinition);
- return (0, utils_2.getCredentialsForRequest)(this.pex, presentationDefinition, credentialRecords);
+ const _pd = {
+ ...presentationDefinition,
+ input_descriptors: presentationDefinition.input_descriptors.map(id => ({
+ ...id,
+ constraints: id.constraints ? { ...id.constraints, limit_disclosure: id.constraints.limit_disclosure ?? 'preferred' } : { limit_disclosure: 'preferred' }
+ }))
+ }
+ const credentialRecords = await this.queryCredentialForPresentationDefinition(agentContext, _pd);
+ return (0, utils_2.getCredentialsForRequest)(this.pex, _pd, credentialRecords);
}
/**
* Selects the credentials to use based on the output from `getCredentialsForRequest`
@@ -90,7 +97,14 @@ let DifPresentationExchangeService = class DifPresentationExchangeService {
.filter((r) => Boolean(r));
}
async createPresentation(agentContext, options) {
- const { presentationDefinition, domain, challenge, openid4vp } = options;
+ const { domain, challenge, openid4vp } = options;
+ const presentationDefinition = {
+ ...options.presentationDefinition,
+ input_descriptors: options.presentationDefinition.input_descriptors.map(id => ({
+ ...id,
+ constraints: id.constraints ? { ...id.constraints, limit_disclosure: id.constraints.limit_disclosure ?? 'preferred' } : { limit_disclosure: 'preferred' }
+ }))
+ }
const presentationSubmissionLocation = options.presentationSubmissionLocation ?? models_1.DifPresentationExchangeSubmissionLocation.PRESENTATION;
const verifiablePresentationResultsWithFormat = [];
const presentationsToCreate = (0, utils_2.getPresentationsToCreate)(options.credentialsForInputDescriptor);