@bedrock/vc-delivery 7.13.3 → 7.14.0

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.
@@ -12,11 +12,10 @@ const vcContext = {
12
12
  minItems: 1,
13
13
  // the first context must be the VC context
14
14
  items: [{
15
- oneOf: [{
16
- const: VC_CONTEXT_1
17
- }, {
18
- const: VC_CONTEXT_2
19
- }]
15
+ oneOf: [
16
+ {const: VC_CONTEXT_1},
17
+ {const: VC_CONTEXT_2}
18
+ ]
20
19
  }],
21
20
  // additional contexts maybe strings or objects
22
21
  additionalItems: {
@@ -31,9 +30,7 @@ const vcContext2StringOrArray = {
31
30
  type: 'array',
32
31
  minItems: 1,
33
32
  // the first context must be the VC 2.0 context
34
- items: [{
35
- const: VC_CONTEXT_2
36
- }],
33
+ items: [{const: VC_CONTEXT_2}],
37
34
  // additional contexts maybe strings or objects
38
35
  additionalItems: {
39
36
  anyOf: [{type: 'string'}, {type: 'object'}]
@@ -102,18 +99,10 @@ const envelopedVerifiableCredential = {
102
99
  additionalProperties: true,
103
100
  properties: {
104
101
  '@context': vcContext2StringOrArray,
105
- id: {
106
- type: 'string'
107
- },
108
- type: {
109
- const: 'EnvelopedVerifiableCredential'
110
- }
102
+ id: {type: 'string'},
103
+ type: {const: 'EnvelopedVerifiableCredential'}
111
104
  },
112
- required: [
113
- '@context',
114
- 'id',
115
- 'type'
116
- ]
105
+ required: ['@context', 'id', 'type']
117
106
  };
118
107
 
119
108
  const envelopedVerifiablePresentation = {
@@ -122,18 +111,10 @@ const envelopedVerifiablePresentation = {
122
111
  additionalProperties: true,
123
112
  properties: {
124
113
  '@context': vcContext2StringOrArray,
125
- id: {
126
- type: 'string'
127
- },
128
- type: {
129
- const: 'EnvelopedVerifiablePresentation'
130
- }
114
+ id: {type: 'string'},
115
+ type: {const: 'EnvelopedVerifiablePresentation'}
131
116
  },
132
- required: [
133
- '@context',
134
- 'id',
135
- 'type'
136
- ]
117
+ required: ['@context', 'id', 'type']
137
118
  };
138
119
 
139
120
  const jwkKeyPair = {
@@ -141,12 +122,8 @@ const jwkKeyPair = {
141
122
  additionalProperties: false,
142
123
  required: ['privateKeyJwk', 'publicKeyJwk'],
143
124
  properties: {
144
- privateKeyJwk: {
145
- type: 'object'
146
- },
147
- publicKeyJwk: {
148
- type: 'object'
149
- }
125
+ privateKeyJwk: {type: 'object'},
126
+ publicKeyJwk: {type: 'object'}
150
127
  }
151
128
  };
152
129
 
@@ -173,9 +150,7 @@ export function verifiablePresentation() {
173
150
  additionalProperties: true,
174
151
  properties: {
175
152
  '@context': vcContext,
176
- id: {
177
- type: 'string'
178
- },
153
+ id: {type: 'string'},
179
154
  type: {
180
155
  type: 'array',
181
156
  minItems: 1,
@@ -204,65 +179,78 @@ const credentialDefinition = {
204
179
  '@context': {
205
180
  type: 'array',
206
181
  minItems: 1,
207
- item: {
208
- type: 'string'
209
- }
182
+ item: {type: 'string'}
210
183
  },
211
184
  type: {
212
185
  type: 'array',
213
186
  minItems: 1,
214
- item: {
215
- type: 'string'
216
- }
187
+ item: {type: 'string'}
217
188
  },
218
189
  // allow `types` to be flexible for OID4VCI draft 20 implementers
219
190
  types: {
220
191
  type: 'array',
221
192
  minItems: 1,
222
- item: {
223
- type: 'string'
224
- }
193
+ item: {type: 'string'}
225
194
  }
226
195
  }
227
196
  };
228
197
 
229
- const expectedCredentialRequest = {
230
- type: 'object',
231
- additionalProperties: false,
232
- required: ['credential_definition'],
233
- properties: {
234
- credential_definition: credentialDefinition,
235
- format: {
236
- type: 'string',
237
- enum: ['di_vc', 'ldp_vc', 'jwt_vc_json-ld', 'jwt_vc_json']
198
+ function credentialConfiguration() {
199
+ return {
200
+ title: 'OID4VCI Credential Configuration',
201
+ type: 'object',
202
+ required: ['credential_definition', 'format'],
203
+ additionalProperties: false,
204
+ properties: {
205
+ credential_definition: credentialDefinition,
206
+ format: {
207
+ type: 'string',
208
+ enum: ['di_vc', 'ldp_vc', 'jwt_vc_json-ld', 'jwt_vc_json']
209
+ },
210
+ proof_types_supported: {
211
+ type: 'object',
212
+ required: ['proof_signing_al_values_supported'],
213
+ additionalProperties: false,
214
+ properties: {
215
+ proof_signing_alg_values_supported: {
216
+ type: 'array',
217
+ minItems: 1,
218
+ items: {type: 'string'}
219
+ }
220
+ }
221
+ }
238
222
  }
239
- }
240
- };
223
+ };
224
+ }
241
225
 
242
226
  const openIdExchangeOptions = {
243
227
  title: 'OpenID Exchange options',
244
228
  type: 'object',
245
229
  additionalProperties: false,
246
- required: ['expectedCredentialRequests', 'preAuthorizedCode', 'oauth2'],
230
+ required: ['preAuthorizedCode', 'oauth2'],
247
231
  properties: {
232
+ // deprecated; for backwards compatibility only, use
233
+ // `supportedCredentialConfigurations` in each `issuerInstance` instead
248
234
  expectedCredentialRequests: {
249
235
  title: 'OpenID Expected Credential Requests',
250
236
  type: 'array',
251
237
  minItems: 1,
252
- items: expectedCredentialRequest
253
- },
254
- preAuthorizedCode: {
255
- type: 'string'
238
+ items: {
239
+ ...credentialConfiguration(),
240
+ // only `credential_definition` is required here as `format` is
241
+ // auto-populated in backwards compatibility mode
242
+ required: ['credential_definition']
243
+ }
256
244
  },
245
+ preAuthorizedCode: {type: 'string'},
257
246
  oauth2: {
258
247
  title: 'OpenID Exchange OAuth2 Options',
259
248
  type: 'object',
260
249
  additionalProperties: false,
261
- oneOf: [{
262
- required: ['keyPair']
263
- }, {
264
- required: ['generateKeyPair']
265
- }],
250
+ oneOf: [
251
+ {required: ['keyPair']},
252
+ {required: ['generateKeyPair']}
253
+ ],
266
254
  properties: {
267
255
  generateKeyPair: {
268
256
  type: 'object',
@@ -275,9 +263,7 @@ const openIdExchangeOptions = {
275
263
  }
276
264
  },
277
265
  keyPair: jwkKeyPair,
278
- maxClockSkew: {
279
- type: 'number'
280
- }
266
+ maxClockSkew: {type: 'number'}
281
267
  }
282
268
  }
283
269
  }
@@ -291,9 +277,7 @@ export function createExchangeBody() {
291
277
  // optionally use either `expires` or `ttl`, but NOT both
292
278
  not: {required: ['ttl', 'expires']},
293
279
  properties: {
294
- ttl: {
295
- type: 'number'
296
- },
280
+ ttl: {type: 'number'},
297
281
  expires: schemas.w3cDateTime(),
298
282
  variables: {
299
283
  type: 'object',
@@ -310,16 +294,12 @@ const typedTemplate = {
310
294
  required: ['type', 'template'],
311
295
  additionalProperties: false,
312
296
  properties: {
313
- id: {
314
- type: 'string'
315
- },
297
+ id: {type: 'string'},
316
298
  type: {
317
299
  type: 'string',
318
300
  enum: ['jsonata']
319
301
  },
320
- template: {
321
- type: 'string'
322
- }
302
+ template: {type: 'string'}
323
303
  }
324
304
  };
325
305
 
@@ -348,23 +328,48 @@ const vcFormats = {
348
328
  }
349
329
  };
350
330
 
331
+ const vcMediaTypes = {
332
+ title: 'Verifiable Credential Media Types',
333
+ type: 'array',
334
+ minItems: 1,
335
+ items: {
336
+ type: 'string'
337
+ }
338
+ };
339
+
351
340
  const issuerInstance = {
352
341
  title: 'Issuer Instance',
353
342
  type: 'object',
354
- required: ['supportedFormats', 'zcapReferenceIds'],
343
+ // use only one of: `supportedMediaTypes` (preferred) or
344
+ // `supportedFormats` (deprecated)
345
+ oneOf: [
346
+ {required: ['supportedMediaTypes', 'zcapReferenceIds']},
347
+ {required: ['supportedFormats', 'zcapReferenceIds']}
348
+ ],
355
349
  additionalProperties: false,
356
350
  properties: {
357
- id: {
358
- type: 'string'
351
+ id: {type: 'string'},
352
+ oid4vci: {
353
+ type: 'object',
354
+ required: ['supportedCredentialConfigurations'],
355
+ additionalProperties: false,
356
+ properties: {
357
+ supportedCredentialConfigurations: {
358
+ type: 'object',
359
+ additionalProperties: false,
360
+ patternProperties: {
361
+ '^.*$': credentialConfiguration()
362
+ }
363
+ }
364
+ }
359
365
  },
360
366
  supportedFormats: vcFormats,
367
+ supportedMediaTypes: vcMediaTypes,
361
368
  zcapReferenceIds: {
362
369
  ...zcapReferenceIds,
363
370
  required: ['issue'],
364
371
  properties: {
365
- issue: {
366
- type: 'string'
367
- }
372
+ issue: {type: 'string'}
368
373
  }
369
374
  }
370
375
  }
@@ -390,17 +395,21 @@ const issueRequestParameters = {
390
395
  }],
391
396
  additionalProperties: false,
392
397
  properties: {
393
- credentialTemplateId: {
394
- type: 'string'
395
- },
396
- credentialTemplateIndex: {
397
- type: 'number'
398
+ // optionally explicitly reference an issuer instance to use
399
+ issuerInstanceId: {type: 'string'},
400
+ credentialTemplateId: {type: 'string'},
401
+ credentialTemplateIndex: {type: 'number'},
402
+ oid4vci: {
403
+ type: 'object',
404
+ required: ['credentialConfigurationId'],
405
+ additionalProperties: false,
406
+ properties: {
407
+ credentialConfigurationId: {type: 'string'}
408
+ }
398
409
  },
399
410
  // optional specify where to store the issued VCs instead of automatically
400
411
  // including it in a VP to be returned to the client
401
- result: {
402
- type: 'string'
403
- },
412
+ result: {type: 'string'},
404
413
  // optionally specify different variables
405
414
  variables: {
406
415
  oneOf: [{type: 'string'}, {type: 'object'}]
@@ -415,15 +424,9 @@ export function inviteResponseBody() {
415
424
  additionalProperties: false,
416
425
  required: ['url', 'purpose'],
417
426
  properties: {
418
- url: {
419
- type: 'string'
420
- },
421
- purpose: {
422
- type: 'string'
423
- },
424
- referenceId: {
425
- type: 'string'
426
- }
427
+ url: {type: 'string'},
428
+ purpose: {type: 'string'},
429
+ referenceId: {type: 'string'}
427
430
  }
428
431
  };
429
432
  }
@@ -533,55 +536,22 @@ export function oid4vpClientProfiles() {
533
536
  };
534
537
  }
535
538
 
536
- function step() {
539
+ function computedStep() {
537
540
  return {
538
- title: 'Exchange Step',
541
+ title: 'Computed Exchange Step',
539
542
  type: 'object',
540
- minProperties: 1,
541
543
  additionalProperties: false,
542
- // step can either use a template so it will be generated using variables
543
- // associated with the exchange, or static values can be provided
544
- oneOf: [{
545
- // `stepTemplate` must be present and nothing else
546
- required: ['stepTemplate'],
547
- not: {
548
- required: [
549
- 'allowUnprotectedPresentation',
550
- 'callback',
551
- 'createChallenge',
552
- 'issueRequests',
553
- 'jwtDidProofRequest',
554
- 'nextStep',
555
- 'openId',
556
- 'presentationSchema',
557
- 'redirectUrl',
558
- 'verifiablePresentation',
559
- 'verifiablePresentationRequest'
560
- ]
561
- }
562
- }, {
563
- // anything except `stepTemplate` can be used
564
- not: {
565
- required: ['stepTemplate']
566
- }
567
- }],
568
544
  properties: {
569
- allowUnprotectedPresentation: {
570
- type: 'boolean'
571
- },
545
+ allowUnprotectedPresentation: {type: 'boolean'},
572
546
  callback: {
573
547
  type: 'object',
574
548
  required: ['url'],
575
549
  additionalProperties: false,
576
550
  properties: {
577
- url: {
578
- type: 'string'
579
- }
551
+ url: {type: 'string'}
580
552
  }
581
553
  },
582
- createChallenge: {
583
- type: 'boolean'
584
- },
554
+ createChallenge: {type: 'boolean'},
585
555
  // issue request parameters for VCs that are to be issued and delivered
586
556
  // during this step
587
557
  issueRequests: {
@@ -602,9 +572,7 @@ function step() {
602
572
  type: 'object',
603
573
  additionalProperties: false,
604
574
  properties: {
605
- method: {
606
- type: 'string'
607
- }
575
+ method: {type: 'string'}
608
576
  }
609
577
  }
610
578
  },
@@ -612,17 +580,12 @@ function step() {
612
580
  title: 'Allowed JWT Algorithms',
613
581
  type: 'array',
614
582
  minItems: 1,
615
- items: {
616
- type: 'string'
617
- }
583
+ items: {type: 'string'}
618
584
  }
619
585
  }
620
586
  },
621
- nextStep: {
622
- type: 'string'
623
- },
587
+ nextStep: {type: 'string'},
624
588
  // required to support OID4VP
625
- // (but can be provided by step template instead)
626
589
  openId: {
627
590
  // either a single top-level client profile is specified here or
628
591
  // `clientProfiles` is specified with nested client profiles
@@ -642,18 +605,11 @@ function step() {
642
605
  required: ['type', 'jsonSchema'],
643
606
  additionalProperties: false,
644
607
  properties: {
645
- type: {
646
- type: 'string'
647
- },
648
- jsonSchema: {
649
- type: 'object'
650
- }
608
+ type: {type: 'string'},
609
+ jsonSchema: {type: 'object'}
651
610
  }
652
611
  },
653
- redirectUrl: {
654
- type: 'string'
655
- },
656
- stepTemplate: typedTemplate,
612
+ redirectUrl: {type: 'string'},
657
613
  // the base verifiable presentation to use in this step; any VCs that
658
614
  // are issued in this step (see: `issueRequests`) will be added to this
659
615
  // VP, in which case any proofs on it will be invalidated; VCs that were
@@ -679,26 +635,43 @@ function step() {
679
635
  required: ['type', 'jsonSchema'],
680
636
  additionalProperties: false,
681
637
  properties: {
682
- type: {
683
- type: 'string'
684
- },
685
- jsonSchema: {
686
- type: 'object'
687
- }
638
+ type: {type: 'string'},
639
+ jsonSchema: {type: 'object'}
688
640
  }
689
641
  }
690
642
  }
691
643
  };
692
644
  }
693
645
 
646
+ function templatedStep() {
647
+ return {
648
+ title: 'Templated Exchange Step',
649
+ type: 'object',
650
+ minProperties: 1,
651
+ additionalProperties: false,
652
+ required: ['stepTemplate'],
653
+ properties: {
654
+ stepTemplate: typedTemplate,
655
+ }
656
+ };
657
+ }
658
+
659
+ function step() {
660
+ return {
661
+ title: 'Exchange Step',
662
+ // step can either use a template so it will be generated using variables
663
+ // associated with the exchange, or static values can be provided that
664
+ // would be the same as those computed from a template
665
+ oneOf: [templatedStep(), computedStep()]
666
+ };
667
+ }
668
+
694
669
  export function steps() {
695
670
  return {
696
671
  title: 'Exchange Steps',
697
672
  type: 'object',
698
673
  additionalProperties: false,
699
- patternProperties: {
700
- '^.*$': step()
701
- }
674
+ patternProperties: {'^.*$': step()}
702
675
  };
703
676
  }
704
677
 
@@ -727,9 +700,9 @@ export function useExchangeBody() {
727
700
  };
728
701
  }
729
702
 
730
- function openIdCredentialRequest() {
703
+ function openIdCredentialRequestDraft13() {
731
704
  return {
732
- title: 'OpenID Credential Request',
705
+ title: 'OID4VCI-draft13 Credential Request',
733
706
  type: 'object',
734
707
  additionalProperties: false,
735
708
  required: ['credential_definition', 'format'],
@@ -739,9 +712,7 @@ function openIdCredentialRequest() {
739
712
  type: 'string',
740
713
  enum: ['di_vc', 'ldp_vc', 'jwt_vc_json-ld', 'jwt_vc_json']
741
714
  },
742
- did: {
743
- type: 'string'
744
- },
715
+ did: {type: 'string'},
745
716
  proof: {
746
717
  title: 'DID Authn Proof JWT',
747
718
  type: 'object',
@@ -752,8 +723,46 @@ function openIdCredentialRequest() {
752
723
  type: 'string',
753
724
  enum: ['jwt']
754
725
  },
726
+ jwt: {type: 'string'}
727
+ }
728
+ }
729
+ }
730
+ };
731
+ }
732
+
733
+ function openIdCredentialRequestVersion1() {
734
+ return {
735
+ title: 'OID4VCI-1.0 Credential Request',
736
+ type: 'object',
737
+ additionalProperties: false,
738
+ oneOf: [
739
+ // FIXME: only support `credential_identifier`;
740
+ // `credential_configuration_id` is for scope-identified credentials,
741
+ // which is not supported
742
+ {required: ['credential_identifier']}//,
743
+ //{required: ['credential_configuration_id']}
744
+ ],
745
+ properties: {
746
+ credential_identifier: {type: 'string'},
747
+ // FIXME: remove me
748
+ //credential_configuration_id: {type: 'string'},
749
+ proofs: {
750
+ type: 'object',
751
+ additionalProperties: false,
752
+ oneOf: [
753
+ {required: ['jwt']},
754
+ {required: ['di_vp']}
755
+ ],
756
+ properties: {
755
757
  jwt: {
756
- type: 'string'
758
+ type: 'array',
759
+ minItems: 1,
760
+ items: {type: 'string'}
761
+ },
762
+ di_vp: {
763
+ type: 'array',
764
+ minItems: 1,
765
+ items: verifiablePresentation()
757
766
  }
758
767
  }
759
768
  }
@@ -761,20 +770,47 @@ function openIdCredentialRequest() {
761
770
  };
762
771
  }
763
772
 
773
+ function openIdCredentialRequest() {
774
+ return {
775
+ title: 'OID4VCI Credential Request',
776
+ oneOf: [
777
+ openIdCredentialRequestVersion1(),
778
+ openIdCredentialRequestDraft13()
779
+ ]
780
+ };
781
+ }
782
+
764
783
  export const openIdCredentialBody = openIdCredentialRequest;
765
784
 
766
785
  export function openIdBatchCredentialBody() {
767
786
  return {
768
- title: 'OpenID Batch Credential Request',
787
+ title: 'OID4VCI-draft13 Batch Credential Request',
769
788
  type: 'object',
770
789
  additionalProperties: false,
771
790
  required: ['credential_requests'],
772
791
  properties: {
773
792
  credential_requests: {
774
- title: 'OpenID Credential Requests',
793
+ title: 'OID4VCI-draft13 Credential Requests',
775
794
  type: 'array',
776
795
  minItems: 1,
777
- items: openIdCredentialRequest()
796
+ items: openIdCredentialRequestDraft13()
797
+ }
798
+ }
799
+ };
800
+ }
801
+
802
+ export function authorizationDetails() {
803
+ return {
804
+ title: 'Authorization Details Request',
805
+ type: 'array',
806
+ minItems: 1,
807
+ items: {
808
+ type: 'object',
809
+ required: ['type', 'credential_configuration_id'],
810
+ additionalProperties: false,
811
+ properties: {
812
+ type: {const: 'openid_credential'},
813
+ credential_configuration_id: {type: 'string'}
778
814
  }
779
815
  }
780
816
  };
@@ -793,6 +829,10 @@ export function openIdTokenBody() {
793
829
  'pre-authorized_code': {
794
830
  type: 'string'
795
831
  },
832
+ // expressed as JSON, must be parsed elsewhere
833
+ authorization_details: {
834
+ type: 'string'
835
+ },
796
836
  // FIXME: there is no implementation for using these fields yet:
797
837
  // user_pin: {
798
838
  // type: 'string'