dcql 0.5.0-alpha-20250718124032 → 0.5.0-alpha-20250724114402

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/dist/index.mjs CHANGED
@@ -121,8 +121,11 @@ function isNonEmptyArray(array8) {
121
121
  }
122
122
  var vNonEmptyArray = (item) => {
123
123
  return v.pipe(
124
- v.array(item),
125
- v.custom((input) => input.length > 0)
124
+ v.array(item, (i) => `Expected input to be an array, but received '${i.received}'`),
125
+ v.custom(
126
+ (input) => input.length > 0,
127
+ "Array must be non-empty and have length of at least 1"
128
+ )
126
129
  );
127
130
  };
128
131
  var vIncludesAll = (subset) => {
@@ -197,60 +200,71 @@ var vStringToJson = v.rawTransform(({ dataset, addIssue, NEVER }) => {
197
200
  });
198
201
 
199
202
  // src/dcql-query/m-dcql-trusted-authorities.ts
200
- var getTrustedAuthorityParser = (trustedAuthority) => v2.object(
201
- {
202
- type: v2.literal(
203
- trustedAuthority.type,
204
- (i) => `Expected trusted authority type to be '${trustedAuthority.type}' but received ${typeof i.input === "string" ? `'${i.input}'` : i.input}`
205
- ),
206
- value: v2.union(
207
- trustedAuthority.values.map(
208
- (value) => v2.literal(
209
- value,
210
- (i) => `Expected trusted authority value to be '${value}' but received ${typeof i.input === "string" ? `'${i.input}'` : i.input}`
211
- )
203
+ var getTrustedAuthorityParser = (trustedAuthority) => v2.pipe(
204
+ v2.object(
205
+ {
206
+ type: v2.literal(
207
+ trustedAuthority.type,
208
+ (i) => `Expected trusted authority type to be '${trustedAuthority.type}' but received ${typeof i.input === "string" ? `'${i.input}'` : i.input}`
212
209
  ),
213
- (i) => `Expected trusted authority value to be '${trustedAuthority.values.join("' | '")}' but received ${typeof i.input === "string" ? `'${i.input}'` : i.input}`
214
- )
215
- },
216
- `Expected trusted authority object with type '${trustedAuthority.type}' to be defined, but received undefined`
210
+ // Some trusted authorities support an array as input type
211
+ values: v2.pipe(
212
+ vNonEmptyArray(v2.string()),
213
+ v2.someItem(
214
+ (item) => trustedAuthority.values.includes(item),
215
+ (i) => `Expected one of the trusted authority values to be '${trustedAuthority.values.join("' | '")}' but received '${i.input.join("' , '")}'`
216
+ )
217
+ )
218
+ },
219
+ `Expected trusted authority object with type '${trustedAuthority.type}' to be defined, but received undefined`
220
+ ),
221
+ v2.transform(({ values, ...rest }) => ({
222
+ ...rest,
223
+ value: values.find((value) => trustedAuthority.values.includes(value))
224
+ }))
217
225
  );
218
226
  var vAuthorityKeyIdentifier = v2.object({
219
227
  type: v2.literal("aki"),
220
- value: v2.pipe(
221
- v2.string(),
222
- vBase64url,
223
- v2.description(
224
- "Contains the KeyIdentifier of the AuthorityKeyIdentifier as defined in Section 4.2.1.1 of [RFC5280], encoded as base64url. The raw byte representation of this element MUST match with the AuthorityKeyIdentifier element of an X.509 certificate in the certificate chain present in the credential (e.g., in the header of an mdoc or SD-JWT). Note that the chain can consist of a single certificate and the credential can include the entire X.509 chain or parts of it."
228
+ values: vNonEmptyArray(
229
+ v2.pipe(
230
+ v2.string("aki trusted authority value must be a string"),
231
+ vBase64url,
232
+ v2.description(
233
+ "Contains a list of KeyIdentifier entries of the AuthorityKeyIdentifier as defined in Section 4.2.1.1 of [RFC5280], encoded as base64url. The raw byte representation of one of the elements MUST match with the AuthorityKeyIdentifier element of an X.509 certificate in the certificate chain present in the credential (e.g., in the header of an mdoc or SD-JWT). Note that the chain can consist of a single certificate and the credential can include the entire X.509 chain or parts of it."
234
+ )
225
235
  )
226
236
  )
227
237
  });
228
238
  var vEtsiTrustedList = v2.object({
229
239
  type: v2.literal("etsi_tl"),
230
- value: v2.pipe(
231
- v2.string(),
232
- v2.url(),
233
- v2.check(
234
- (url2) => url2.startsWith("http://") || url2.startsWith("https://"),
235
- "etsi_tl trusted authority value must be a valid https url"
236
- ),
237
- v2.description(
238
- "The identifier of a Trusted List as specified in ETSI TS 119 612 [ETSI.TL]. An ETSI Trusted List contains references to other Trusted Lists, creating a list of trusted lists, or entries for Trust Service Providers with corresponding service description and X.509 Certificates. The trust chain of a matching Credential MUST contain at least one X.509 Certificate that matches one of the entries of the Trusted List or its cascading Trusted Lists."
240
+ values: vNonEmptyArray(
241
+ v2.pipe(
242
+ v2.string("etsi_tl trusted authority value must be a string"),
243
+ v2.url("etsi_tl trusted authority value must be a valid https url"),
244
+ v2.check(
245
+ (url2) => url2.startsWith("http://") || url2.startsWith("https://"),
246
+ "etsi_tl trusted authority value must be a valid https url"
247
+ ),
248
+ v2.description(
249
+ "The identifier of a Trusted List as specified in ETSI TS 119 612 [ETSI.TL]. An ETSI Trusted List contains references to other Trusted Lists, creating a list of trusted lists, or entries for Trust Service Providers with corresponding service description and X.509 Certificates. The trust chain of a matching Credential MUST contain at least one X.509 Certificate that matches one of the entries of the Trusted List or its cascading Trusted Lists."
250
+ )
239
251
  )
240
252
  )
241
253
  });
242
254
  var vOpenidFederation = v2.object({
243
255
  type: v2.literal("openid_federation"),
244
- value: v2.pipe(
245
- v2.string(),
246
- v2.url(),
247
- // TODO: should we have a config similar to oid4vc-ts to support http for development?
248
- v2.check(
249
- (url2) => url2.startsWith("http://") || url2.startsWith("https://"),
250
- "openid_federation trusted authority value must be a valid https url"
251
- ),
252
- v2.description(
253
- "The Entity Identifier as defined in Section 1 of [OpenID.Federation] that is bound to an entity in a federation. While this Entity Identifier could be any entity in that ecosystem, this entity would usually have the Entity Configuration of a Trust Anchor. A valid trust path, including the given Entity Identifier, must be constructible from a matching credential."
256
+ values: vNonEmptyArray(
257
+ v2.pipe(
258
+ v2.string("openid_federation trusted authority value must be a string"),
259
+ v2.url("openid_federation trusted authority value must be a valid https url"),
260
+ // TODO: should we have a config similar to oid4vc-ts to support http for development?
261
+ v2.check(
262
+ (url2) => url2.startsWith("http://") || url2.startsWith("https://"),
263
+ "openid_federation trusted authority value must be a valid https url"
264
+ ),
265
+ v2.description(
266
+ "The Entity Identifier as defined in Section 1 of [OpenID.Federation] that is bound to an entity in a federation. While this Entity Identifier could be any entity in that ecosystem, this entity would usually have the Entity Configuration of a Trust Anchor. A valid trust path, including the given Entity Identifier, must be constructible from a matching credential."
267
+ )
254
268
  )
255
269
  )
256
270
  });
@@ -266,7 +280,7 @@ var DcqlTrustedAuthoritiesQuery;
266
280
  )
267
281
  ),
268
282
  values: v2.pipe(
269
- vNonEmptyArray(authority.entries.value),
283
+ vNonEmptyArray(authority.entries.values.item),
270
284
  v2.description(
271
285
  "REQUIRED. An array of strings, where each string (value) contains information specific to the used Trusted Authorities Query type that allows to identify an issuer, trust framework, or a federation that an issuer belongs to."
272
286
  )
@@ -1152,7 +1166,16 @@ var DcqlTrustedAuthoritiesResult;
1152
1166
  DcqlTrustedAuthoritiesResult2.vTrustedAuthorityEntrySuccessResult = v14.object({
1153
1167
  success: v14.literal(true),
1154
1168
  trusted_authority_index: v14.number(),
1155
- output: DcqlCredentialTrustedAuthority.vModel
1169
+ // We map from values (multiple options for a credential/query) to value (the matching option)
1170
+ output: v14.variant(
1171
+ "type",
1172
+ DcqlCredentialTrustedAuthority.vModel.options.map(
1173
+ (o) => v14.object({
1174
+ type: o.entries.type,
1175
+ value: o.entries.values.item
1176
+ })
1177
+ )
1178
+ )
1156
1179
  });
1157
1180
  DcqlTrustedAuthoritiesResult2.vTrustedAuthorityEntryFailureResult = v14.object({
1158
1181
  success: v14.literal(false),