@pagopa/io-react-native-wallet 0.27.1 → 0.28.1

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.
Files changed (153) hide show
  1. package/lib/commonjs/client/generated/wallet-provider.js +27 -19
  2. package/lib/commonjs/client/generated/wallet-provider.js.map +1 -1
  3. package/lib/commonjs/credential/issuance/03-start-user-authorization.js +3 -0
  4. package/lib/commonjs/credential/issuance/03-start-user-authorization.js.map +1 -1
  5. package/lib/commonjs/credential/presentation/01-start-flow.js +14 -24
  6. package/lib/commonjs/credential/presentation/01-start-flow.js.map +1 -1
  7. package/lib/commonjs/credential/presentation/03-get-request-object.js +30 -42
  8. package/lib/commonjs/credential/presentation/03-get-request-object.js.map +1 -1
  9. package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js +32 -0
  10. package/lib/commonjs/credential/presentation/04-retrieve-rp-jwks.js.map +1 -0
  11. package/lib/commonjs/credential/presentation/05-verify-request-object.js +53 -0
  12. package/lib/commonjs/credential/presentation/05-verify-request-object.js.map +1 -0
  13. package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js +39 -0
  14. package/lib/commonjs/credential/presentation/06-fetch-presentation-definition.js.map +1 -0
  15. package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js +125 -0
  16. package/lib/commonjs/credential/presentation/07-evaluate-dcql-query.js.map +1 -0
  17. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js +289 -0
  18. package/lib/commonjs/credential/presentation/07-evaluate-input-descriptor.js.map +1 -0
  19. package/lib/commonjs/credential/presentation/08-send-authorization-response.js +170 -0
  20. package/lib/commonjs/credential/presentation/08-send-authorization-response.js.map +1 -0
  21. package/lib/commonjs/credential/presentation/errors.js +69 -1
  22. package/lib/commonjs/credential/presentation/errors.js.map +1 -1
  23. package/lib/commonjs/credential/presentation/index.js +29 -1
  24. package/lib/commonjs/credential/presentation/index.js.map +1 -1
  25. package/lib/commonjs/credential/presentation/types.js +124 -3
  26. package/lib/commonjs/credential/presentation/types.js.map +1 -1
  27. package/lib/commonjs/sd-jwt/index.js +41 -1
  28. package/lib/commonjs/sd-jwt/index.js.map +1 -1
  29. package/lib/commonjs/trust/chain.js +35 -50
  30. package/lib/commonjs/trust/chain.js.map +1 -1
  31. package/lib/commonjs/trust/index.js +139 -16
  32. package/lib/commonjs/trust/index.js.map +1 -1
  33. package/lib/commonjs/trust/types.js +36 -12
  34. package/lib/commonjs/trust/types.js.map +1 -1
  35. package/lib/commonjs/trust/utils.js +41 -0
  36. package/lib/commonjs/trust/utils.js.map +1 -0
  37. package/lib/commonjs/utils/jwk.js +5 -1
  38. package/lib/commonjs/utils/jwk.js.map +1 -1
  39. package/lib/commonjs/wallet-instance/index.js +10 -0
  40. package/lib/commonjs/wallet-instance/index.js.map +1 -1
  41. package/lib/module/client/generated/wallet-provider.js +22 -15
  42. package/lib/module/client/generated/wallet-provider.js.map +1 -1
  43. package/lib/module/credential/issuance/03-start-user-authorization.js +3 -0
  44. package/lib/module/credential/issuance/03-start-user-authorization.js.map +1 -1
  45. package/lib/module/credential/presentation/01-start-flow.js +14 -24
  46. package/lib/module/credential/presentation/01-start-flow.js.map +1 -1
  47. package/lib/module/credential/presentation/03-get-request-object.js +31 -43
  48. package/lib/module/credential/presentation/03-get-request-object.js.map +1 -1
  49. package/lib/module/credential/presentation/04-retrieve-rp-jwks.js +25 -0
  50. package/lib/module/credential/presentation/04-retrieve-rp-jwks.js.map +1 -0
  51. package/lib/module/credential/presentation/05-verify-request-object.js +46 -0
  52. package/lib/module/credential/presentation/05-verify-request-object.js.map +1 -0
  53. package/lib/module/credential/presentation/06-fetch-presentation-definition.js +32 -0
  54. package/lib/module/credential/presentation/06-fetch-presentation-definition.js.map +1 -0
  55. package/lib/module/credential/presentation/07-evaluate-dcql-query.js +117 -0
  56. package/lib/module/credential/presentation/07-evaluate-dcql-query.js.map +1 -0
  57. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js +278 -0
  58. package/lib/module/credential/presentation/07-evaluate-input-descriptor.js.map +1 -0
  59. package/lib/module/credential/presentation/08-send-authorization-response.js +158 -0
  60. package/lib/module/credential/presentation/08-send-authorization-response.js.map +1 -0
  61. package/lib/module/credential/presentation/errors.js +64 -0
  62. package/lib/module/credential/presentation/errors.js.map +1 -1
  63. package/lib/module/credential/presentation/index.js +6 -2
  64. package/lib/module/credential/presentation/index.js.map +1 -1
  65. package/lib/module/credential/presentation/types.js +121 -2
  66. package/lib/module/credential/presentation/types.js.map +1 -1
  67. package/lib/module/sd-jwt/index.js +40 -1
  68. package/lib/module/sd-jwt/index.js.map +1 -1
  69. package/lib/module/trust/chain.js +32 -46
  70. package/lib/module/trust/chain.js.map +1 -1
  71. package/lib/module/trust/index.js +139 -18
  72. package/lib/module/trust/index.js.map +1 -1
  73. package/lib/module/trust/types.js +34 -11
  74. package/lib/module/trust/types.js.map +1 -1
  75. package/lib/module/trust/utils.js +33 -0
  76. package/lib/module/trust/utils.js.map +1 -0
  77. package/lib/module/utils/jwk.js +3 -0
  78. package/lib/module/utils/jwk.js.map +1 -1
  79. package/lib/module/wallet-instance/index.js +9 -0
  80. package/lib/module/wallet-instance/index.js.map +1 -1
  81. package/lib/typescript/client/generated/wallet-provider.d.ts +91 -54
  82. package/lib/typescript/client/generated/wallet-provider.d.ts.map +1 -1
  83. package/lib/typescript/credential/issuance/03-start-user-authorization.d.ts.map +1 -1
  84. package/lib/typescript/credential/presentation/01-start-flow.d.ts +26 -5
  85. package/lib/typescript/credential/presentation/01-start-flow.d.ts.map +1 -1
  86. package/lib/typescript/credential/presentation/03-get-request-object.d.ts +7 -10
  87. package/lib/typescript/credential/presentation/03-get-request-object.d.ts.map +1 -1
  88. package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts +23 -0
  89. package/lib/typescript/credential/presentation/04-retrieve-rp-jwks.d.ts.map +1 -0
  90. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts +18 -0
  91. package/lib/typescript/credential/presentation/05-verify-request-object.d.ts.map +1 -0
  92. package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts +21 -0
  93. package/lib/typescript/credential/presentation/06-fetch-presentation-definition.d.ts.map +1 -0
  94. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts +20 -0
  95. package/lib/typescript/credential/presentation/07-evaluate-dcql-query.d.ts.map +1 -0
  96. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts +88 -0
  97. package/lib/typescript/credential/presentation/07-evaluate-input-descriptor.d.ts.map +1 -0
  98. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts +70 -0
  99. package/lib/typescript/credential/presentation/08-send-authorization-response.d.ts.map +1 -0
  100. package/lib/typescript/credential/presentation/errors.d.ts +44 -0
  101. package/lib/typescript/credential/presentation/errors.d.ts.map +1 -1
  102. package/lib/typescript/credential/presentation/index.d.ts +7 -3
  103. package/lib/typescript/credential/presentation/index.d.ts.map +1 -1
  104. package/lib/typescript/credential/presentation/types.d.ts +747 -10
  105. package/lib/typescript/credential/presentation/types.d.ts.map +1 -1
  106. package/lib/typescript/credential/status/types.d.ts +6 -6
  107. package/lib/typescript/sd-jwt/index.d.ts +31 -12
  108. package/lib/typescript/sd-jwt/index.d.ts.map +1 -1
  109. package/lib/typescript/sd-jwt/types.d.ts +6 -6
  110. package/lib/typescript/trust/chain.d.ts +4 -9
  111. package/lib/typescript/trust/chain.d.ts.map +1 -1
  112. package/lib/typescript/trust/index.d.ts +337 -61
  113. package/lib/typescript/trust/index.d.ts.map +1 -1
  114. package/lib/typescript/trust/types.d.ts +4074 -407
  115. package/lib/typescript/trust/types.d.ts.map +1 -1
  116. package/lib/typescript/trust/utils.d.ts +12 -0
  117. package/lib/typescript/trust/utils.d.ts.map +1 -0
  118. package/lib/typescript/utils/decoder.d.ts +1 -1
  119. package/lib/typescript/utils/decoder.d.ts.map +1 -1
  120. package/lib/typescript/utils/jwk.d.ts +137 -0
  121. package/lib/typescript/utils/jwk.d.ts.map +1 -1
  122. package/lib/typescript/wallet-instance/index.d.ts +8 -0
  123. package/lib/typescript/wallet-instance/index.d.ts.map +1 -1
  124. package/lib/typescript/wallet-instance-attestation/types.d.ts +36 -36
  125. package/package.json +5 -2
  126. package/src/client/generated/wallet-provider.ts +28 -19
  127. package/src/credential/issuance/03-start-user-authorization.ts +3 -0
  128. package/src/credential/presentation/01-start-flow.ts +19 -26
  129. package/src/credential/presentation/03-get-request-object.ts +35 -58
  130. package/src/credential/presentation/04-retrieve-rp-jwks.ts +34 -0
  131. package/src/credential/presentation/05-verify-request-object.ts +52 -0
  132. package/src/credential/presentation/06-fetch-presentation-definition.ts +48 -0
  133. package/src/credential/presentation/07-evaluate-dcql-query.ts +166 -0
  134. package/src/credential/presentation/07-evaluate-input-descriptor.ts +391 -0
  135. package/src/credential/presentation/08-send-authorization-response.ts +220 -0
  136. package/src/credential/presentation/errors.ts +64 -0
  137. package/src/credential/presentation/index.ts +22 -1
  138. package/src/credential/presentation/types.ts +133 -2
  139. package/src/sd-jwt/index.ts +49 -1
  140. package/src/trust/chain.ts +46 -66
  141. package/src/trust/index.ts +185 -20
  142. package/src/trust/types.ts +34 -10
  143. package/src/trust/utils.ts +35 -0
  144. package/src/utils/decoder.ts +1 -1
  145. package/src/utils/jwk.ts +8 -1
  146. package/src/wallet-instance/index.ts +13 -0
  147. package/lib/commonjs/credential/presentation/04-send-authorization-response.js +0 -138
  148. package/lib/commonjs/credential/presentation/04-send-authorization-response.js.map +0 -1
  149. package/lib/module/credential/presentation/04-send-authorization-response.js +0 -128
  150. package/lib/module/credential/presentation/04-send-authorization-response.js.map +0 -1
  151. package/lib/typescript/credential/presentation/04-send-authorization-response.d.ts +0 -34
  152. package/lib/typescript/credential/presentation/04-send-authorization-response.d.ts.map +0 -1
  153. package/src/credential/presentation/04-send-authorization-response.ts +0 -168
@@ -0,0 +1,289 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.prepareRemotePresentations = exports.findCredentialSdJwt = exports.evaluateInputDescriptors = exports.evaluateInputDescriptorForSdJwt4VC = void 0;
7
+ var _sdJwt = require("../../sd-jwt");
8
+ var _crypto = require("../../utils/crypto");
9
+ var _jsonpathPlus = require("jsonpath-plus");
10
+ var _errors = require("./errors");
11
+ var _ajv = _interopRequireDefault(require("ajv"));
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ const ajv = new _ajv.default({
14
+ allErrors: true
15
+ });
16
+ const INDEX_CLAIM_NAME = 1;
17
+ /**
18
+ * Transforms an array of DisclosureWithEncoded objects into a key-value map.
19
+ * @param disclosures - An array of DisclosureWithEncoded, each containing a decoded property with [?, claimName, claimValue].
20
+ * @returns An object mapping claim names to their corresponding values.
21
+ */
22
+ const mapDisclosuresToObject = disclosures => {
23
+ return disclosures.reduce((obj, _ref) => {
24
+ let {
25
+ decoded
26
+ } = _ref;
27
+ const [, claimName, claimValue] = decoded;
28
+ obj[claimName] = claimValue;
29
+ return obj;
30
+ }, {});
31
+ };
32
+
33
+ /**
34
+ * Finds a claim within the payload based on provided JSONPath expressions.
35
+ * @param paths - An array of JSONPath expressions to search for in the payload.
36
+ * @param payload - The object to search within using JSONPath.
37
+ * @returns A tuple with the first matched JSONPath and its corresponding value, or [undefined, undefined] if not found.
38
+ */
39
+ const findMatchedClaim = (paths, payload) => {
40
+ let matchedPath;
41
+ let matchedValue;
42
+ paths.some(singlePath => {
43
+ try {
44
+ const result = (0, _jsonpathPlus.JSONPath)({
45
+ path: singlePath,
46
+ json: payload
47
+ });
48
+ if (result.length > 0) {
49
+ matchedPath = singlePath;
50
+ matchedValue = result[0];
51
+ return true;
52
+ }
53
+ } catch (error) {
54
+ throw new _errors.MissingDataError(`JSONPath for "${singlePath}" does not match the provided payload.`);
55
+ }
56
+ return false;
57
+ });
58
+ return [matchedPath, matchedValue];
59
+ };
60
+
61
+ /**
62
+ * Extracts the claim name from a path that can be in one of the following formats:
63
+ * 1. $.propertyName
64
+ * 2. $["propertyName"] or $['propertyName']
65
+ *
66
+ * @param path - The path string containing the claim reference.
67
+ * @returns The extracted claim name if matched; otherwise, throws an exception.
68
+ */
69
+ const extractClaimName = path => {
70
+ // Define a regular expression that matches both formats:
71
+ // 1. $.propertyName
72
+ // 2. $["propertyName"] or $['propertyName']
73
+ const regex = /^\$\.(\w+)$|^\$\[(?:'|")(\w+)(?:'|")\]$/;
74
+ const match = path.match(regex);
75
+ if (match) {
76
+ // match[1] corresponds to the first capture group (\w+) after $.
77
+ // match[2] corresponds to the second capture group (\w+) inside [""] or ['']
78
+ return match[1] || match[2];
79
+ }
80
+
81
+ // If the input doesn't match any of the expected formats, return null
82
+
83
+ throw new Error(`Invalid input format: "${path}". Expected formats are "$.propertyName", "$['propertyName']", or '$["propertyName"]'.`);
84
+ };
85
+
86
+ /**
87
+ * Evaluates an InputDescriptor for an SD-JWT-based verifiable credential.
88
+ *
89
+ * - Checks each field in the InputDescriptor against the provided `payloadCredential`
90
+ * and `disclosures` (selectively disclosed claims).
91
+ * - Validates whether required fields are present (unless marked optional)
92
+ * and match any specified JSONPath.
93
+ * - If a field includes a JSON Schema filter, validates the claim value against that schema.
94
+ * - Enforces `limit_disclosure` rules by returning only disclosures, required and optional, matching the specified fields
95
+ * if set to "required". Otherwise also return the array unrequestedDisclosures with disclosures which can be passed for a particular use case.
96
+ * - Throws an error if a required field is invalid or missing.
97
+ *
98
+ * @param inputDescriptor - Describes constraints (fields, filters, etc.) that must be satisfied.
99
+ * @param payloadCredential - The credential payload to check against.
100
+ * @param disclosures - An array of DisclosureWithEncoded objects representing selective disclosures.
101
+ * @returns A filtered list of disclosures satisfying the descriptor constraints, or throws an error if not.
102
+ * @throws Will throw an error if any required constraint fails or if JSONPath lookups are invalid.
103
+ */
104
+ const evaluateInputDescriptorForSdJwt4VC = (inputDescriptor, payloadCredential, disclosures) => {
105
+ var _inputDescriptor$cons;
106
+ if (!(inputDescriptor !== null && inputDescriptor !== void 0 && (_inputDescriptor$cons = inputDescriptor.constraints) !== null && _inputDescriptor$cons !== void 0 && _inputDescriptor$cons.fields)) {
107
+ // No validation, all field are optional
108
+ return {
109
+ requiredDisclosures: [],
110
+ optionalDisclosures: [],
111
+ unrequestedDisclosures: disclosures
112
+ };
113
+ }
114
+ const requiredClaimNames = [];
115
+ const optionalClaimNames = [];
116
+
117
+ // Transform disclosures to find claim using JSONPath
118
+ const disclosuresAsPayload = mapDisclosuresToObject(disclosures);
119
+
120
+ // For each field, we need at least one matching path
121
+ // If we succeed, we push the matched disclosure in matchedDisclosures and stop checking further paths
122
+ const allFieldsValid = inputDescriptor.constraints.fields.every(field => {
123
+ // For Potential profile, selectively disclosed claims will always be built as an individual object property, by using a name-value pair.
124
+ // Hence that selective claim for array element and recursive disclosures are not supported by Potential for the first iteration of Piloting.
125
+ // We need to check inside disclosures or inside credential payload. Example path: "$.given_name"
126
+ let [matchedPath, matchedValue] = findMatchedClaim(field.path, disclosuresAsPayload);
127
+ if (!matchedPath) {
128
+ [matchedPath, matchedValue] = findMatchedClaim(field.path, payloadCredential);
129
+ if (!matchedPath) {
130
+ // Path could be optional, in this case no need to validate! continue to next field
131
+ return field === null || field === void 0 ? void 0 : field.optional;
132
+ }
133
+ } else {
134
+ // if match a disclouse we save which is required or optional
135
+ const claimName = extractClaimName(matchedPath);
136
+ if (claimName) {
137
+ (field !== null && field !== void 0 && field.optional ? optionalClaimNames : requiredClaimNames).push(claimName);
138
+ }
139
+ }
140
+
141
+ // FILTER validation
142
+ // If this field has a "filter" (JSON Schema), validate the claimValue
143
+ if (field.filter) {
144
+ try {
145
+ const validateSchema = ajv.compile(field.filter);
146
+ if (!validateSchema(matchedValue)) {
147
+ throw new _errors.MissingDataError(`Claim value "${matchedValue}" for path "${matchedPath}" does not match the provided JSON Schema.`);
148
+ }
149
+ } catch (error) {
150
+ return false;
151
+ }
152
+ }
153
+ // Submission Requirements validation
154
+ // TODO: [EUDIW-216] Read rule value if “all” o “pick” and validate
155
+
156
+ return true;
157
+ });
158
+ if (!allFieldsValid) {
159
+ throw new _errors.MissingDataError("Credential validation failed: Required fields are missing or do not match the input descriptor.");
160
+ }
161
+
162
+ // Categorizes disclosures into required and optional based on claim names and disclosure constraints.
163
+
164
+ const requiredDisclosures = disclosures.filter(disclosure => requiredClaimNames.includes(disclosure.decoded[INDEX_CLAIM_NAME]));
165
+ const optionalDisclosures = disclosures.filter(disclosure => optionalClaimNames.includes(disclosure.decoded[INDEX_CLAIM_NAME]));
166
+ const isNotLimitDisclosure = !(inputDescriptor.constraints.limit_disclosure === "required");
167
+ const unrequestedDisclosures = isNotLimitDisclosure ? disclosures.filter(disclosure => !optionalClaimNames.includes(disclosure.decoded[INDEX_CLAIM_NAME]) && !requiredClaimNames.includes(disclosure.decoded[INDEX_CLAIM_NAME])) : [];
168
+ return {
169
+ requiredDisclosures,
170
+ optionalDisclosures,
171
+ unrequestedDisclosures
172
+ };
173
+ };
174
+ exports.evaluateInputDescriptorForSdJwt4VC = evaluateInputDescriptorForSdJwt4VC;
175
+ /**
176
+ * Finds the first credential that satisfies the input descriptor constraints.
177
+ * @param inputDescriptor The input descriptor to evaluate.
178
+ * @param decodedSdJwtCredentials An array of decoded SD-JWT credentials.
179
+ * @returns An object containing the matched evaluation, keyTag, and credential.
180
+ */
181
+ const findCredentialSdJwt = (inputDescriptor, decodedSdJwtCredentials) => {
182
+ for (const {
183
+ keyTag,
184
+ credential,
185
+ sdJwt,
186
+ disclosures
187
+ } of decodedSdJwtCredentials) {
188
+ try {
189
+ const evaluatedDisclosure = evaluateInputDescriptorForSdJwt4VC(inputDescriptor, sdJwt.payload, disclosures);
190
+ return {
191
+ matchedEvaluation: evaluatedDisclosure,
192
+ matchedKeyTag: keyTag,
193
+ matchedCredential: credential
194
+ };
195
+ } catch {
196
+ // skip to next credential
197
+ continue;
198
+ }
199
+ }
200
+ throw new _errors.CredentialNotFoundError("None of the vc+sd-jwt credentials satisfy the requirements.");
201
+ };
202
+
203
+ /**
204
+ * Evaluates multiple input descriptors against provided SD-JWT and MDOC credentials.
205
+ *
206
+ * For each input descriptor, this function:
207
+ * - Checks the credential format.
208
+ * - Decodes the credential.
209
+ * - Evaluates the descriptor using the associated disclosures.
210
+ *
211
+ * @param inputDescriptors - An array of input descriptors.
212
+ * @param credentialsSdJwt - An array of tuples containing keyTag and SD-JWT credential.
213
+ * @returns An array of objects, each containing the evaluated disclosures,
214
+ * the input descriptor, the credential, and the keyTag.
215
+ * @throws {CredentialNotFoundError} When the credential format is unsupported.
216
+ */
217
+ exports.findCredentialSdJwt = findCredentialSdJwt;
218
+ const evaluateInputDescriptors = async (inputDescriptors, credentialsSdJwt) => {
219
+ // We need decode SD-JWT credentials for evaluation
220
+ const decodedSdJwtCredentials = (credentialsSdJwt === null || credentialsSdJwt === void 0 ? void 0 : credentialsSdJwt.map(_ref2 => {
221
+ let [keyTag, credential] = _ref2;
222
+ const {
223
+ sdJwt,
224
+ disclosures
225
+ } = (0, _sdJwt.decode)(credential);
226
+ return {
227
+ keyTag,
228
+ credential,
229
+ sdJwt,
230
+ disclosures
231
+ };
232
+ })) || [];
233
+ return Promise.all(inputDescriptors.map(async descriptor => {
234
+ var _descriptor$format;
235
+ if ((_descriptor$format = descriptor.format) !== null && _descriptor$format !== void 0 && _descriptor$format["vc+sd-jwt"]) {
236
+ if (!decodedSdJwtCredentials.length) {
237
+ throw new _errors.CredentialNotFoundError("vc+sd-jwt credential is not supported.");
238
+ }
239
+ const {
240
+ matchedEvaluation,
241
+ matchedKeyTag,
242
+ matchedCredential
243
+ } = findCredentialSdJwt(descriptor, decodedSdJwtCredentials);
244
+ return {
245
+ evaluatedDisclosure: matchedEvaluation,
246
+ inputDescriptor: descriptor,
247
+ credential: matchedCredential,
248
+ keyTag: matchedKeyTag
249
+ };
250
+ }
251
+ throw new _errors.CredentialNotFoundError(`${descriptor.format} format is not supported.`);
252
+ }));
253
+ };
254
+
255
+ /**
256
+ * Prepares remote presentations for a set of credentials based on input descriptors.
257
+ *
258
+ * For each credential and its corresponding input descriptor, this function:
259
+ * - Validates the credential format.
260
+ * - Generates a verifiable presentation token (vpToken) using the provided nonce and client identifier.
261
+ *
262
+ * @param credentialAndDescriptors - An array containing objects with requested claims,
263
+ * input descriptor, credential, and keyTag.
264
+ * @param nonce - A unique nonce for the verifiable presentation token.
265
+ * @param client_id - The client identifier.
266
+ * @returns A promise that resolves to an array of RemotePresentation objects.
267
+ * @throws {CredentialNotFoundError} When the credential format is unsupported.
268
+ */
269
+ exports.evaluateInputDescriptors = evaluateInputDescriptors;
270
+ const prepareRemotePresentations = async (credentialAndDescriptors, nonce, client_id) => {
271
+ return Promise.all(credentialAndDescriptors.map(async item => {
272
+ var _descriptor$format2;
273
+ const descriptor = item.inputDescriptor;
274
+ if ((_descriptor$format2 = descriptor.format) !== null && _descriptor$format2 !== void 0 && _descriptor$format2["vc+sd-jwt"]) {
275
+ const {
276
+ vp_token
277
+ } = await (0, _sdJwt.prepareVpToken)(nonce, client_id, [item.credential, item.requestedClaims, (0, _crypto.createCryptoContextFor)(item.keyTag)]);
278
+ return {
279
+ requestedClaims: item.requestedClaims,
280
+ inputDescriptor: descriptor,
281
+ vpToken: vp_token,
282
+ format: "vc+sd-jwt"
283
+ };
284
+ }
285
+ throw new _errors.CredentialNotFoundError(`${descriptor.format} format is not supported.`);
286
+ }));
287
+ };
288
+ exports.prepareRemotePresentations = prepareRemotePresentations;
289
+ //# sourceMappingURL=07-evaluate-input-descriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_sdJwt","require","_crypto","_jsonpathPlus","_errors","_ajv","_interopRequireDefault","obj","__esModule","default","ajv","Ajv","allErrors","INDEX_CLAIM_NAME","mapDisclosuresToObject","disclosures","reduce","_ref","decoded","claimName","claimValue","findMatchedClaim","paths","payload","matchedPath","matchedValue","some","singlePath","result","JSONPath","path","json","length","error","MissingDataError","extractClaimName","regex","match","Error","evaluateInputDescriptorForSdJwt4VC","inputDescriptor","payloadCredential","_inputDescriptor$cons","constraints","fields","requiredDisclosures","optionalDisclosures","unrequestedDisclosures","requiredClaimNames","optionalClaimNames","disclosuresAsPayload","allFieldsValid","every","field","optional","push","filter","validateSchema","compile","disclosure","includes","isNotLimitDisclosure","limit_disclosure","exports","findCredentialSdJwt","decodedSdJwtCredentials","keyTag","credential","sdJwt","evaluatedDisclosure","matchedEvaluation","matchedKeyTag","matchedCredential","CredentialNotFoundError","evaluateInputDescriptors","inputDescriptors","credentialsSdJwt","map","_ref2","decode","Promise","all","descriptor","_descriptor$format","format","prepareRemotePresentations","credentialAndDescriptors","nonce","client_id","item","_descriptor$format2","vp_token","prepareVpToken","requestedClaims","createCryptoContextFor","vpToken"],"sourceRoot":"../../../../src","sources":["credential/presentation/07-evaluate-input-descriptor.ts"],"mappings":";;;;;;AAEA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,IAAA,GAAAC,sBAAA,CAAAL,OAAA;AAAsB,SAAAK,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAEtB,MAAMG,GAAG,GAAG,IAAIC,YAAG,CAAC;EAAEC,SAAS,EAAE;AAAK,CAAC,CAAC;AACxC,MAAMC,gBAAgB,GAAG,CAAC;AAqC1B;AACA;AACA;AACA;AACA;AACA,MAAMC,sBAAsB,GAC1BC,WAAoC,IACR;EAC5B,OAAOA,WAAW,CAACC,MAAM,CACvB,CAACT,GAAG,EAAAU,IAAA,KAAkB;IAAA,IAAhB;MAAEC;IAAQ,CAAC,GAAAD,IAAA;IACf,MAAM,GAAGE,SAAS,EAAEC,UAAU,CAAC,GAAGF,OAAO;IACzCX,GAAG,CAACY,SAAS,CAAC,GAAGC,UAAU;IAC3B,OAAOb,GAAG;EACZ,CAAC,EACD,CAAC,CACH,CAAC;AACH,CAAC;;AAED;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0,0 +1,170 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.sendLegacyAuthorizationResponse = exports.sendAuthorizationResponse = exports.choosePublicKeyToEncrypt = exports.buildDirectPostJwtBody = exports.AuthorizationResponse = void 0;
7
+ var _ioReactNativeJwt = require("@pagopa/io-react-native-jwt");
8
+ var _reactNativeUuid = _interopRequireDefault(require("react-native-uuid"));
9
+ var _retrieveRpJwks = require("./04-retrieve-rp-jwks");
10
+ var _errors = require("./errors");
11
+ var _misc = require("../../utils/misc");
12
+ var z = _interopRequireWildcard(require("zod"));
13
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
14
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ const AuthorizationResponse = z.object({
17
+ status: z.string().optional(),
18
+ response_code: z.string() /**
19
+ FIXME: [SIW-627] we expect this value from every RP implementation
20
+ Actually some RP does not return the value
21
+ We make it optional to not break the flow.
22
+ */.optional(),
23
+ redirect_uri: z.string().optional()
24
+ });
25
+
26
+ /**
27
+ * Selects a public key (with `use = enc`) from the set of JWK keys
28
+ * offered by the Relying Party (RP) for encryption.
29
+ *
30
+ * @param rpJwkKeys - The array of JWKs retrieved from the RP entity configuration.
31
+ * @returns The first suitable public key found in the list.
32
+ * @throws {NoSuitableKeysFoundInEntityConfiguration} If no suitable encryption key is found.
33
+ */
34
+ exports.AuthorizationResponse = AuthorizationResponse;
35
+ const choosePublicKeyToEncrypt = rpJwkKeys => {
36
+ const encKey = rpJwkKeys.find(jwk => jwk.use === "enc");
37
+ if (encKey) {
38
+ return encKey;
39
+ }
40
+
41
+ // No suitable key found
42
+ throw new _errors.NoSuitableKeysFoundInEntityConfiguration("No suitable public key found for encryption.");
43
+ };
44
+
45
+ /**
46
+ * Builds a URL-encoded form body for a direct POST response using JWT encryption.
47
+ *
48
+ * @param jwkKeys - Array of JWKs from the Relying Party for encryption.
49
+ * @param requestObject - Contains state, nonce, and other relevant info.
50
+ * @param payload - Object that contains the VP token to encrypt and the mapping of the credential disclosures
51
+ * @returns A URL-encoded string for an `application/x-www-form-urlencoded` POST body, where `response` contains the encrypted JWE.
52
+ */
53
+ exports.choosePublicKeyToEncrypt = choosePublicKeyToEncrypt;
54
+ const buildDirectPostJwtBody = async (requestObject, rpConf, payload) => {
55
+ // Prepare the authorization response payload to be encrypted
56
+ const authzResponsePayload = JSON.stringify({
57
+ state: requestObject.state,
58
+ ...payload
59
+ });
60
+
61
+ // Choose a suitable public key for encryption
62
+ const {
63
+ keys
64
+ } = (0, _retrieveRpJwks.getJwksFromConfig)(rpConf.metadata);
65
+ const encPublicJwk = choosePublicKeyToEncrypt(keys);
66
+
67
+ // Encrypt the authorization payload
68
+ const {
69
+ authorization_encrypted_response_alg,
70
+ authorization_encrypted_response_enc
71
+ } = rpConf.metadata.openid_credential_verifier;
72
+ const encryptedResponse = await new _ioReactNativeJwt.EncryptJwe(authzResponsePayload, {
73
+ alg: authorization_encrypted_response_alg || "RSA-OAEP-256",
74
+ enc: authorization_encrypted_response_enc || "A256CBC-HS512",
75
+ kid: encPublicJwk.kid
76
+ }).encrypt(encPublicJwk);
77
+
78
+ // Build the x-www-form-urlencoded form body
79
+ const formBody = new URLSearchParams({
80
+ response: encryptedResponse,
81
+ ...(requestObject.state ? {
82
+ state: requestObject.state
83
+ } : {})
84
+ });
85
+ return formBody.toString();
86
+ };
87
+
88
+ /**
89
+ * Type definition for the function that sends the authorization response
90
+ * to the Relying Party, completing the presentation flow.
91
+ * Use with `presentation_definition`.
92
+ * @deprecated Use `sendAuthorizationResponse`
93
+ */
94
+ exports.buildDirectPostJwtBody = buildDirectPostJwtBody;
95
+ /**
96
+ * Sends the authorization response to the Relying Party (RP) using the specified `response_mode`.
97
+ * This function completes the presentation flow in an OpenID 4 Verifiable Presentations scenario.
98
+ *
99
+ * @param requestObject - The request details, including presentation requirements.
100
+ * @param presentationDefinition - The definition of the expected presentation.
101
+ * @param jwkKeys - Array of JWKs from the Relying Party for optional encryption.
102
+ * @param presentation - Tuple with verifiable credential, claims, and crypto context.
103
+ * @param context - Contains optional custom fetch implementation.
104
+ * @returns Parsed and validated authorization response from the Relying Party.
105
+ */
106
+ const sendLegacyAuthorizationResponse = async function (requestObject, presentationDefinitionId, remotePresentations, rpConf) {
107
+ var _remotePresentations$;
108
+ let {
109
+ appFetch = fetch
110
+ } = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
111
+ /**
112
+ * 1. Prepare the VP token and presentation submission
113
+ * If there is only one credential, `vpToken` is a single string.
114
+ * If there are multiple credential, `vpToken` is an array of string.
115
+ **/
116
+ const vp_token = (remotePresentations === null || remotePresentations === void 0 ? void 0 : remotePresentations.length) === 1 ? (_remotePresentations$ = remotePresentations[0]) === null || _remotePresentations$ === void 0 ? void 0 : _remotePresentations$.vpToken : remotePresentations.map(remotePresentation => remotePresentation.vpToken);
117
+ const descriptor_map = remotePresentations.map((remotePresentation, index) => ({
118
+ id: remotePresentation.inputDescriptor.id,
119
+ path: remotePresentations.length === 1 ? `$` : `$[${index}]`,
120
+ format: remotePresentation.format
121
+ }));
122
+ const presentation_submission = {
123
+ id: _reactNativeUuid.default.v4(),
124
+ definition_id: presentationDefinitionId,
125
+ descriptor_map
126
+ };
127
+ const requestBody = await buildDirectPostJwtBody(requestObject, rpConf, {
128
+ vp_token,
129
+ presentation_submission
130
+ });
131
+
132
+ // 3. Send the authorization response via HTTP POST and validate the response
133
+ return await appFetch(requestObject.response_uri, {
134
+ method: "POST",
135
+ headers: {
136
+ "Content-Type": "application/x-www-form-urlencoded"
137
+ },
138
+ body: requestBody
139
+ }).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(AuthorizationResponse.parse);
140
+ };
141
+
142
+ /**
143
+ * Type definition for the function that sends the authorization response
144
+ * to the Relying Party, completing the presentation flow.
145
+ * Use with DCQL queries.
146
+ */
147
+ exports.sendLegacyAuthorizationResponse = sendLegacyAuthorizationResponse;
148
+ const sendAuthorizationResponse = async function (requestObject, remotePresentations, rpConf) {
149
+ let {
150
+ appFetch = fetch
151
+ } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
152
+ // 1. Prepare the VP token as a JSON object with keys corresponding to the DCQL query credential IDs
153
+ const requestBody = await buildDirectPostJwtBody(requestObject, rpConf, {
154
+ vp_token: remotePresentations.reduce((acc, presentation) => ({
155
+ ...acc,
156
+ [presentation.credentialId]: presentation.vpToken
157
+ }), {})
158
+ });
159
+
160
+ // 2. Send the authorization response via HTTP POST and validate the response
161
+ return await appFetch(requestObject.response_uri, {
162
+ method: "POST",
163
+ headers: {
164
+ "Content-Type": "application/x-www-form-urlencoded"
165
+ },
166
+ body: requestBody
167
+ }).then((0, _misc.hasStatusOrThrow)(200)).then(res => res.json()).then(AuthorizationResponse.parse);
168
+ };
169
+ exports.sendAuthorizationResponse = sendAuthorizationResponse;
170
+ //# sourceMappingURL=08-send-authorization-response.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_ioReactNativeJwt","require","_reactNativeUuid","_interopRequireDefault","_retrieveRpJwks","_errors","_misc","z","_interopRequireWildcard","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","AuthorizationResponse","object","status","string","optional","response_code","redirect_uri","exports","choosePublicKeyToEncrypt","rpJwkKeys","encKey","find","jwk","use","NoSuitableKeysFoundInEntityConfiguration","buildDirectPostJwtBody","requestObject","rpConf","payload","authzResponsePayload","JSON","stringify","state","keys","getJwksFromConfig","metadata","encPublicJwk","authorization_encrypted_response_alg","authorization_encrypted_response_enc","openid_credential_verifier","encryptedResponse","EncryptJwe","alg","enc","kid","encrypt","formBody","URLSearchParams","response","toString","sendLegacyAuthorizationResponse","presentationDefinitionId","remotePresentations","_remotePresentations$","appFetch","fetch","arguments","length","undefined","vp_token","vpToken","map","remotePresentation","descriptor_map","index","id","inputDescriptor","path","format","presentation_submission","uuid","v4","definition_id","requestBody","response_uri","method","headers","body","then","hasStatusOrThrow","res","json","parse","sendAuthorizationResponse","reduce","acc","presentation","credentialId"],"sourceRoot":"../../../../src","sources":["credential/presentation/08-send-authorization-response.ts"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAEA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AAOA,IAAAM,CAAA,GAAAC,uBAAA,CAAAP,OAAA;AAAyB,SAAAQ,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAF,wBAAAM,GAAA,EAAAJ,WAAA,SAAAA,W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EAAE;MACP,cAAc,EAAE;IAClB,CAAC;IACDC,IAAI,EAAEJ;EACR,CAAC,CAAC,CACCK,IAAI,CAAC,IAAAC,sBAAgB,EAAC,GAAG,CAAC,CAAC,CAC3BD,IAAI,CAAEE,GAAG,IAAKA,GAAG,CAACC,IAAI,CAAC,CAAC,CAAC,CACzBH,IAAI,CAACpE,qBAAqB,CAACwE,KAAK,CAAC;AACtC,CAAC;AAACjE,OAAA,CAAAkE,yBAAA,GAAAA,yBAAA"}
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.NoSuitableKeysFoundInEntityConfiguration = exports.AuthRequestDecodeError = void 0;
6
+ exports.UnverifiedEntityError = exports.NoSuitableKeysFoundInEntityConfiguration = exports.MissingDataError = exports.InvalidQRCodeError = exports.CredentialNotFoundError = exports.AuthRequestDecodeError = void 0;
7
7
  var _errors = require("../../utils/errors");
8
8
  /**
9
9
  * An error subclass thrown when auth request decode fail
@@ -45,5 +45,73 @@ class NoSuitableKeysFoundInEntityConfiguration extends _errors.IoWalletError {
45
45
  super(message);
46
46
  }
47
47
  }
48
+
49
+ /**
50
+ * When a QR code is not valid.
51
+ *
52
+ */
48
53
  exports.NoSuitableKeysFoundInEntityConfiguration = NoSuitableKeysFoundInEntityConfiguration;
54
+ class InvalidQRCodeError extends _errors.IoWalletError {
55
+ code = "ERR_INVALID_QR_CODE";
56
+
57
+ /**
58
+ * @param detail A description of why the QR code is considered invalid.
59
+ */
60
+ constructor(detail) {
61
+ const message = `QR code is not valid: ${detail}.`;
62
+ super(message);
63
+ }
64
+ }
65
+
66
+ /**
67
+ * When the entity is unverified because the Relying Party is not trusted.
68
+ *
69
+ */
70
+ exports.InvalidQRCodeError = InvalidQRCodeError;
71
+ class UnverifiedEntityError extends _errors.IoWalletError {
72
+ code = "ERR_UNVERIFIED_RP_ENTITY";
73
+
74
+ /**
75
+ * @param reason A description of why the entity cannot be verified.
76
+ */
77
+ constructor(reason) {
78
+ const message = `Unverified entity: ${reason}.`;
79
+ super(message);
80
+ }
81
+ }
82
+
83
+ /**
84
+ * When some required data is missing to continue because certain attributes are not contained inside the wallet.
85
+ *
86
+ */
87
+ exports.UnverifiedEntityError = UnverifiedEntityError;
88
+ class MissingDataError extends _errors.IoWalletError {
89
+ code = "ERR_MISSING_DATA";
90
+
91
+ /**
92
+ * @param missingAttributes An array or description of the attributes that are missing.
93
+ */
94
+ constructor(missingAttributes) {
95
+ const message = `Some required data is missing: ${missingAttributes}.`;
96
+ super(message);
97
+ }
98
+ }
99
+
100
+ /**
101
+ * When a credential is not found in the wallet.
102
+ *
103
+ */
104
+ exports.MissingDataError = MissingDataError;
105
+ class CredentialNotFoundError extends _errors.IoWalletError {
106
+ code = "ERR_CREDENTIAL_NOT_FOUND";
107
+
108
+ /**
109
+ * @param credentialId The ID of the credential that was not found.
110
+ */
111
+ constructor(credentialId) {
112
+ const message = `Credential not found: ${credentialId}.`;
113
+ super(message);
114
+ }
115
+ }
116
+ exports.CredentialNotFoundError = CredentialNotFoundError;
49
117
  //# sourceMappingURL=errors.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_errors","require","AuthRequestDecodeError","IoWalletError","code","constructor","message","claim","arguments","length","undefined","reason","serializeAttrs","exports","NoSuitableKeysFoundInEntityConfiguration","scenario"],"sourceRoot":"../../../../src","sources":["credential/presentation/errors.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACO,MAAMC,sBAAsB,SAASC,qBAAa,CAAC;EACxDC,IAAI,GAAG,oDAAoD;;EAE3D;;EAGA;;EAGAC,WAAWA,CACTC,OAAe,EAGf;IAAA,IAFAC,KAAa,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IAAA,IAC7BG,MAAc,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IAE9B,KAAK,CAAC,IAAAI,sBAAc,EAAC;MAAEN,OAAO;MAAEC,KAAK;MAAEI;IAAO,CAAC,CAAC,CAAC;IACjD,IAAI,CAACJ,KAAK,GAAGA,KAAK;IAClB,IAAI,CAACI,MAAM,GAAGA,MAAM;EACtB;AACF;;AAEA;AACA;AACA;AACA;AAHAE,OAAA,CAAAX,sBAAA,GAAAA,sBAAA;AAIO,MAAMY,wCAAwC,SAASX,qBAAa,CAAC;EAC1EC,IAAI,GAAG,gCAAgC;;EAEvC;AACF;AACA;EACEC,WAAWA,CAACU,QAAgB,EAAE;IAC5B,MAAMT,OAAO,GAAI,0DAAyDS,QAAS,IAAG;IACtF,KAAK,CAACT,OAAO,CAAC;EAChB;AACF;AAACO,OAAA,CAAAC,wCAAA,GAAAA,wCAAA"}
1
+ {"version":3,"names":["_errors","require","AuthRequestDecodeError","IoWalletError","code","constructor","message","claim","arguments","length","undefined","reason","serializeAttrs","exports","NoSuitableKeysFoundInEntityConfiguration","scenario","InvalidQRCodeError","detail","UnverifiedEntityError","MissingDataError","missingAttributes","CredentialNotFoundError","credentialId"],"sourceRoot":"../../../../src","sources":["credential/presentation/errors.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACO,MAAMC,sBAAsB,SAASC,qBAAa,CAAC;EACxDC,IAAI,GAAG,oDAAoD;;EAE3D;;EAGA;;EAGAC,WAAWA,CACTC,OAAe,EAGf;IAAA,IAFAC,KAAa,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IAAA,IAC7BG,MAAc,GAAAH,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,aAAa;IAE9B,KAAK,CAAC,IAAAI,sBAAc,EAAC;MAAEN,OAAO;MAAEC,KAAK;MAAEI;IAAO,CAAC,CAAC,CAAC;IACjD,IAAI,CAACJ,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BAAuB,SAASlB,qBAAa,CAAC;EACzDC,IAAI,GAAG,0BAA0B;;EAEjC;AACF;AACA;EACEC,WAAWA,CAACiB,YAAoB,EAAE;IAChC,MAAMhB,OAAO,GAAI,yBAAwBgB,YAAa,GAAE;IACxD,KAAK,CAAChB,OAAO,CAAC;EAChB;AACF;AAACO,OAAA,CAAAQ,uBAAA,GAAAA,uBAAA"}
@@ -4,12 +4,30 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.Errors = void 0;
7
+ Object.defineProperty(exports, "evaluateInputDescriptorForSdJwt4VC", {
8
+ enumerable: true,
9
+ get: function () {
10
+ return _evaluateInputDescriptor.evaluateInputDescriptorForSdJwt4VC;
11
+ }
12
+ });
7
13
  Object.defineProperty(exports, "evaluateRelyingPartyTrust", {
8
14
  enumerable: true,
9
15
  get: function () {
10
16
  return _evaluateRpTrust.evaluateRelyingPartyTrust;
11
17
  }
12
18
  });
19
+ Object.defineProperty(exports, "fetchPresentDefinition", {
20
+ enumerable: true,
21
+ get: function () {
22
+ return _fetchPresentationDefinition.fetchPresentDefinition;
23
+ }
24
+ });
25
+ Object.defineProperty(exports, "getJwksFromConfig", {
26
+ enumerable: true,
27
+ get: function () {
28
+ return _retrieveRpJwks.getJwksFromConfig;
29
+ }
30
+ });
13
31
  Object.defineProperty(exports, "getRequestObject", {
14
32
  enumerable: true,
15
33
  get: function () {
@@ -28,10 +46,20 @@ Object.defineProperty(exports, "startFlowFromQR", {
28
46
  return _startFlow.startFlowFromQR;
29
47
  }
30
48
  });
49
+ Object.defineProperty(exports, "verifyRequestObject", {
50
+ enumerable: true,
51
+ get: function () {
52
+ return _verifyRequestObject.verifyRequestObject;
53
+ }
54
+ });
31
55
  var _startFlow = require("./01-start-flow");
32
56
  var _evaluateRpTrust = require("./02-evaluate-rp-trust");
33
57
  var _getRequestObject = require("./03-get-request-object");
34
- var _sendAuthorizationResponse = require("./04-send-authorization-response");
58
+ var _retrieveRpJwks = require("./04-retrieve-rp-jwks");
59
+ var _verifyRequestObject = require("./05-verify-request-object");
60
+ var _fetchPresentationDefinition = require("./06-fetch-presentation-definition");
61
+ var _evaluateInputDescriptor = require("./07-evaluate-input-descriptor");
62
+ var _sendAuthorizationResponse = require("./08-send-authorization-response");
35
63
  var Errors = _interopRequireWildcard(require("./errors"));
36
64
  exports.Errors = Errors;
37
65
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -1 +1 @@
1
- {"version":3,"names":["_startFlow","require","_evaluateRpTrust","_getRequestObject","_sendAuthorizationResponse","Errors","_interopRequireWildcard","exports","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../../../src","sources":["credential/presentation/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,gBAAA,GAAAD,OAAA;AAIA,IAAAE,iBAAA,GAAAF,OAAA;AAIA,IAAAG,0BAAA,GAAAH,OAAA;AAIA,IAAAI,MAAA,GAAAC,uBAAA,CAAAL,OAAA;AAAmCM,OAAA,CAAAF,MAAA,GAAAA,MAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAH,wBAAAO,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAAAL,GAAA,SAAAM,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAX,GAAA,QAAAW,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAd,GAAA,EAAAW,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAV,GAAA,EAAAW,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cAAA,CAAAH,MAAA,EAAAK,GAAA,EAAAI,IAAA,YAAAT,MAAA,CAAAK,GAAA,IAAAX,GAAA,CAAAW,GAAA,SAAAL,MAAA,CAAAJ,OAAA,GAAAF,GAAA,MAAAG,KAAA,IAAAA,KAAA,CAAAa,GAAA,CAAAhB,GAAA,EAAAM,MAAA,YAAAA,MAAA"}
1
+ {"version":3,"names":["_startFlow","require","_evaluateRpTrust","_getRequestObject","_retrieveRpJwks","_verifyRequestObject","_fetchPresentationDefinition","_evaluateInputDescriptor","_sendAuthorizationResponse","Errors","_interopRequireWildcard","exports","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","default","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set"],"sourceRoot":"../../../../src","sources":["credential/presentation/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,U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