@sphereon/oid4vci-common 0.8.2-next.6 → 0.8.2-unstable.16

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 (49) hide show
  1. package/dist/functions/CredentialOfferUtil.d.ts +3 -0
  2. package/dist/functions/CredentialOfferUtil.d.ts.map +1 -1
  3. package/dist/functions/CredentialOfferUtil.js +29 -1
  4. package/dist/functions/CredentialOfferUtil.js.map +1 -1
  5. package/dist/functions/CredentialRequestUtil.d.ts +3 -2
  6. package/dist/functions/CredentialRequestUtil.d.ts.map +1 -1
  7. package/dist/functions/CredentialRequestUtil.js +26 -2
  8. package/dist/functions/CredentialRequestUtil.js.map +1 -1
  9. package/dist/functions/FormatUtils.d.ts +15 -0
  10. package/dist/functions/FormatUtils.d.ts.map +1 -0
  11. package/dist/functions/FormatUtils.js +44 -0
  12. package/dist/functions/FormatUtils.js.map +1 -0
  13. package/dist/functions/HttpUtils.d.ts +3 -3
  14. package/dist/functions/HttpUtils.d.ts.map +1 -1
  15. package/dist/functions/HttpUtils.js +1 -1
  16. package/dist/functions/HttpUtils.js.map +1 -1
  17. package/dist/functions/IssuerMetadataUtils.d.ts +3 -0
  18. package/dist/functions/IssuerMetadataUtils.d.ts.map +1 -1
  19. package/dist/functions/IssuerMetadataUtils.js +27 -7
  20. package/dist/functions/IssuerMetadataUtils.js.map +1 -1
  21. package/dist/functions/index.d.ts +2 -0
  22. package/dist/functions/index.d.ts.map +1 -1
  23. package/dist/functions/index.js +2 -0
  24. package/dist/functions/index.js.map +1 -1
  25. package/dist/types/Authorization.types.d.ts +16 -6
  26. package/dist/types/Authorization.types.d.ts.map +1 -1
  27. package/dist/types/Authorization.types.js.map +1 -1
  28. package/dist/types/Generic.types.d.ts +47 -18
  29. package/dist/types/Generic.types.d.ts.map +1 -1
  30. package/dist/types/Generic.types.js.map +1 -1
  31. package/dist/types/QRCode.types.js +0 -2
  32. package/dist/types/QRCode.types.js.map +1 -1
  33. package/dist/types/v1_0_08.types.d.ts +6 -2
  34. package/dist/types/v1_0_08.types.d.ts.map +1 -1
  35. package/dist/types/v1_0_11.types.d.ts +3 -15
  36. package/dist/types/v1_0_11.types.d.ts.map +1 -1
  37. package/dist/types/v1_0_11.types.js.map +1 -1
  38. package/lib/functions/CredentialOfferUtil.ts +27 -0
  39. package/lib/functions/CredentialRequestUtil.ts +31 -3
  40. package/lib/functions/FormatUtils.ts +52 -0
  41. package/lib/functions/HttpUtils.ts +5 -5
  42. package/lib/functions/IssuerMetadataUtils.ts +26 -4
  43. package/lib/functions/index.ts +2 -0
  44. package/lib/types/Authorization.types.ts +30 -6
  45. package/lib/types/Generic.types.ts +61 -16
  46. package/lib/types/QRCode.types.ts +2 -2
  47. package/lib/types/v1_0_08.types.ts +7 -2
  48. package/lib/types/v1_0_11.types.ts +6 -20
  49. package/package.json +3 -3
@@ -11,7 +11,7 @@ export interface ImageInfo {
11
11
  alt_text?: string;
12
12
  [key: string]: unknown;
13
13
  }
14
- export type OID4VCICredentialFormat = 'jwt_vc_json' | 'jwt_vc_json-ld' | 'ldp_vc';
14
+ export type OID4VCICredentialFormat = 'jwt_vc_json' | 'jwt_vc_json-ld' | 'ldp_vc' | 'vc+sd-jwt' | 'jwt_vc';
15
15
  export interface NameAndLocale {
16
16
  name?: string;
17
17
  locale?: string;
@@ -47,8 +47,6 @@ export interface CredentialIssuerMetadata extends CredentialIssuerMetadataOpts,
47
47
  credential_endpoint: string;
48
48
  }
49
49
  export interface CredentialSupportedBrief {
50
- name?: string;
51
- types: string[];
52
50
  cryptographic_binding_methods_supported?: string[];
53
51
  cryptographic_suites_supported?: string[];
54
52
  }
@@ -56,23 +54,46 @@ export type CommonCredentialSupported = CredentialSupportedBrief & {
56
54
  format: OID4VCICredentialFormat | string;
57
55
  id?: string;
58
56
  display?: CredentialsSupportedDisplay[];
59
- /**
60
- * following properties are non-mso_mdoc specific and we might wanna rethink them when we're going to support mso_mdoc
61
- */
62
- credentialSubject?: IssuerCredentialSubject;
63
- order?: string[];
64
57
  };
65
58
  export interface CredentialSupportedJwtVcJsonLdAndLdpVc extends CommonCredentialSupported {
59
+ types: string[];
66
60
  '@context': ICredentialContextType[];
61
+ credentialSubject?: IssuerCredentialSubject;
62
+ order?: string[];
63
+ format: 'ldp_vc' | 'jwt_vc_json-ld';
67
64
  }
68
65
  export interface CredentialSupportedJwtVcJson extends CommonCredentialSupported {
69
- format: 'jwt_vc_json';
66
+ types: string[];
67
+ credentialSubject?: IssuerCredentialSubject;
68
+ order?: string[];
69
+ format: 'jwt_vc_json' | 'jwt_vc';
70
70
  }
71
- export type CredentialSupported = CommonCredentialSupported & (CredentialSupportedJwtVcJson | CredentialSupportedJwtVcJsonLdAndLdpVc);
72
- export interface CredentialOfferFormat {
71
+ export interface SdJwtVcCredentialDefinition {
72
+ vct: string;
73
+ claims?: IssuerCredentialSubject;
74
+ }
75
+ export interface CredentialSupportedSdJwtVc extends CommonCredentialSupported {
76
+ format: 'vc+sd-jwt';
77
+ credential_definition: SdJwtVcCredentialDefinition;
78
+ order?: string[];
79
+ }
80
+ export type CredentialSupported = CommonCredentialSupported & (CredentialSupportedJwtVcJson | CredentialSupportedJwtVcJsonLdAndLdpVc | CredentialSupportedSdJwtVc);
81
+ export interface CommonCredentialOfferFormat {
73
82
  format: OID4VCICredentialFormat | string;
83
+ }
84
+ export interface CredentialOfferFormatJwtVcJsonLdAndLdpVc extends CommonCredentialOfferFormat {
85
+ format: 'ldp_vc' | 'jwt_vc_json-ld';
86
+ credential_definition: JsonLdIssuerCredentialDefinition;
87
+ }
88
+ export interface CredentialOfferFormatJwtVcJson extends CommonCredentialOfferFormat {
89
+ format: 'jwt_vc_json' | 'jwt_vc';
74
90
  types: string[];
75
91
  }
92
+ export interface CredentialOfferFormatSdJwtVc extends CommonCredentialOfferFormat {
93
+ format: 'vc+sd-jwt';
94
+ credential_definition: SdJwtVcCredentialDefinition;
95
+ }
96
+ export type CredentialOfferFormat = CommonCredentialOfferFormat & (CredentialOfferFormatJwtVcJsonLdAndLdpVc | CredentialOfferFormatJwtVcJson | CredentialOfferFormatSdJwtVc);
76
97
  /**
77
98
  * Optional storage that can help the credential Data Supplier. For instance to store credential input data during offer creation, if no additional data can be supplied later on
78
99
  */
@@ -85,10 +106,10 @@ export type CreateCredentialOfferURIResult = {
85
106
  userPinLength?: number;
86
107
  userPinRequired: boolean;
87
108
  };
88
- export interface IssuerCredentialDefinition {
109
+ export interface JsonLdIssuerCredentialDefinition {
89
110
  '@context': ICredentialContextType[];
90
111
  types: string[];
91
- credentialSubject: IssuerCredentialSubject;
112
+ credentialSubject?: IssuerCredentialSubject;
92
113
  }
93
114
  export interface ErrorResponse extends Response {
94
115
  error: string;
@@ -101,14 +122,18 @@ export interface CommonCredentialRequest {
101
122
  format: OID4VCICredentialFormat;
102
123
  proof?: ProofOfPossession;
103
124
  }
104
- export interface CredentialRequestJwtVc extends CommonCredentialRequest {
105
- format: 'jwt_vc_json' | 'jwt_vc_json-ld';
125
+ export interface CredentialRequestJwtVcJson extends CommonCredentialRequest {
126
+ format: 'jwt_vc_json' | 'jwt_vc';
106
127
  types: string[];
107
128
  credentialSubject?: IssuerCredentialSubject;
108
129
  }
109
- export interface CredentialRequestLdpVc extends CommonCredentialRequest {
110
- format: 'ldp_vc';
111
- credential_definition: IssuerCredentialDefinition;
130
+ export interface CredentialRequestJwtVcJsonLdAndLdpVc extends CommonCredentialRequest {
131
+ format: 'ldp_vc' | 'jwt_vc_json-ld';
132
+ credential_definition: JsonLdIssuerCredentialDefinition;
133
+ }
134
+ export interface CredentialRequestSdJwtVc extends CommonCredentialRequest {
135
+ format: 'vc+sd-jwt';
136
+ credential_definition: SdJwtVcCredentialDefinition;
112
137
  }
113
138
  export interface CommonCredentialResponse {
114
139
  format: string;
@@ -125,6 +150,10 @@ export interface CredentialResponseJwtVc {
125
150
  format: 'jwt_vc_json' | 'jwt_vc_json-ld';
126
151
  credential: string;
127
152
  }
153
+ export interface CredentialResponseSdJwtVc {
154
+ format: 'vc+sd-jwt';
155
+ credential: string;
156
+ }
128
157
  export type IssuerCredentialSubjectDisplay = CredentialSubjectDisplay & {
129
158
  [key: string]: CredentialSubjectDisplay;
130
159
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Generic.types.d.ts","sourceRoot":"","sources":["../../lib/types/Generic.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,MAAM,uBAAuB,GAAG,aAAa,GAAG,gBAAgB,GAAG,QAAQ,CAAkB;AAEnG,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,2BAA2B,GAAG,aAAa,GACrD,YAAY,GAAG;IACb,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAC9B,CAAC;AAEJ,MAAM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AAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,aAAa,GAAG,gBAAgB,CAAC;IACzC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,WAAW,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;CACpB;AAID,MAAM,MAAM,8BAA8B,GAAG,wBAAwB,GAAG;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,wBAAwB,CAAA;CAAE,CAAC;AAEpH,MAAM,WAAW,wBAAwB;IACvC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,uBAAuB;IACtC,CAAC,GAAG,EAAE,MAAM,GAAG,8BAA8B,CAAC;CAC/C;AAED,MAAM,WAAW,KAAK;IACpB,kBAAkB,CAAC,EAAE,sBAAsB,CAAC;IAC5C,sDAAsD,CAAC,EAAE,YAAY,CAAC;CACvE;AAED,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,qBAAqB,EAAE,MAAM,CAAC;IAC9B;;;OAGG;IACH,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,eAAO,MAAM,qBAAqB,wBAAwB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Generic.types.js","sourceRoot":"","sources":["../../lib/types/Generic.types.ts"],"names":[],"mappings":";;;AAsMa,QAAA,qBAAqB,GAAG,qBAAqB,CAAC"}
1
+ {"version":3,"file":"Generic.types.js","sourceRoot":"","sources":["../../lib/types/Generic.types.ts"],"names":[],"mappings":";;;AAmPa,QAAA,qBAAqB,GAAG,qBAAqB,CAAC"}
@@ -1,5 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- ;
4
- ;
5
3
  //# sourceMappingURL=QRCode.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"QRCode.types.js","sourceRoot":"","sources":["../../lib/types/QRCode.types.ts"],"names":[],"mappings":";;AA8DC,CAAC;AAoKD,CAAC"}
1
+ {"version":3,"file":"QRCode.types.js","sourceRoot":"","sources":["../../lib/types/QRCode.types.ts"],"names":[],"mappings":""}
@@ -4,7 +4,7 @@ import { CredentialsSupportedDisplay, CredentialSupportedBrief, IssuerCredential
4
4
  export interface CredentialRequestV1_0_08 {
5
5
  type: string;
6
6
  format: CredentialFormat;
7
- proof: ProofOfPossession;
7
+ proof?: ProofOfPossession;
8
8
  }
9
9
  export interface IssuerMetadataV1_0_08 {
10
10
  issuer?: string;
@@ -28,10 +28,14 @@ export interface CredentialOfferPayloadV1_0_08 {
28
28
  export interface CredentialSupportedTypeV1_0_08 {
29
29
  [credentialType: string]: CredentialSupportedV1_0_08;
30
30
  }
31
+ export interface CredentialSupportedFormatV1_0_08 extends CredentialSupportedBrief {
32
+ name?: string;
33
+ types: string[];
34
+ }
31
35
  export interface CredentialSupportedV1_0_08 {
32
36
  display?: CredentialsSupportedDisplay[];
33
37
  formats: {
34
- [credentialFormat: string]: CredentialSupportedBrief;
38
+ [credentialFormat: string]: CredentialSupportedFormatV1_0_08;
35
39
  };
36
40
  claims?: IssuerCredentialSubject;
37
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"v1_0_08.types.d.ts","sourceRoot":"","sources":["../../lib/types/v1_0_08.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEjJ,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,gB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JwtVcJson, CommonAuthorizationRequest } from './Authorization.types';
2
- import { CommonCredentialRequest, CredentialDataSupplierInput, CredentialOfferFormat, CredentialRequestJwtVc, CredentialRequestLdpVc, Grant, IssuerCredentialDefinition } from './Generic.types';
2
+ import { CommonCredentialRequest, CredentialDataSupplierInput, CredentialOfferFormat, CredentialRequestJwtVcJson, CredentialRequestJwtVcJsonLdAndLdpVc, CredentialRequestSdJwtVc, Grant } from './Generic.types';
3
3
  import { QRCodeOpts } from './QRCode.types';
4
4
  export interface CredentialOfferV1_0_11 {
5
5
  credential_offer?: CredentialOfferPayloadV1_0_11;
@@ -12,7 +12,7 @@ export interface CredentialOfferRESTRequest extends CredentialOfferV1_0_11 {
12
12
  qrCodeOpts?: QRCodeOpts;
13
13
  credentialDataSupplierInput?: CredentialDataSupplierInput;
14
14
  }
15
- export interface CommonCredentialOfferPayloadV1_0_11 {
15
+ export interface CredentialOfferPayloadV1_0_11 {
16
16
  /**
17
17
  * REQUIRED. The URL of the Credential Issuer, the Wallet is requested to obtain one or more Credentials from.
18
18
  */
@@ -37,19 +37,7 @@ export interface CommonCredentialOfferPayloadV1_0_11 {
37
37
  */
38
38
  grants?: Grant;
39
39
  }
40
- export interface CredentialOfferLdpVcV1_0_11 extends CommonCredentialOfferPayloadV1_0_11 {
41
- /**
42
- * REQUIRED. JSON object containing (and isolating) the detailed description of the credential type.
43
- * This object MUST be processed using full JSON-LD processing. It consists of the following sub-claims:
44
- * - @context: REQUIRED. JSON array as defined in Appendix E.1.3.2
45
- * - types: REQUIRED. JSON array as defined in Appendix E.1.3.2.
46
- * This claim contains the type values the Wallet shall request in the subsequent Credential Request
47
- */
48
- credential_definition: IssuerCredentialDefinition;
49
- }
50
- export type CredentialOfferJwtVcV1_0_11 = CommonCredentialOfferPayloadV1_0_11;
51
- export type CredentialOfferPayloadV1_0_11 = CommonCredentialOfferPayloadV1_0_11 & (CredentialOfferLdpVcV1_0_11 | CredentialOfferJwtVcV1_0_11);
52
- export type CredentialRequestV1_0_11 = CommonCredentialRequest & (CredentialRequestJwtVc | CredentialRequestLdpVc);
40
+ export type CredentialRequestV1_0_11 = CommonCredentialRequest & (CredentialRequestJwtVcJson | CredentialRequestJwtVcJsonLdAndLdpVc | CredentialRequestSdJwtVc);
53
41
  export interface AuthorizationRequestV1_0_11 extends AuthorizationDetailsJwtVcJson, AuthorizationDetailsJwtVcJson {
54
42
  issuer_state?: string;
55
43
  }
@@ -1 +1 @@
1
- {"version":3,"file":"v1_0_11.types.d.ts","sourceRoot":"","sources":["../../lib/types/v1_0_11.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,EACL,0BAA0B,EAC3B,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,CAAC,EAAE,6BAA6B,CAAC;IACjD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,0BAA2B,SAAQ,sBAAsB;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,2BAA2B,CAAC,EAAE,2BAA2B,CAAC;CAC3D;AAED,MAAM,WAAW,mCAAmC;IAClD;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;;;;;;;OAQG;IACH,WAAW,EAAE,CAAC,qBAAqB,GAAG,MAAM,CAAC,EAAE,CAAC;IAChD;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB;AAED,MAAM,WAAW,2BAA4B,SAAQ,mCAAmC;IACtF;;;;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AAW,EAAE,CAAC,qBAAqB,GAAG,MAAM,CAAC,EAAE,CAAC;IAChD;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB;AAED,MAAM,MAAM,wBAAwB,GAAG,uBAAuB,GAC5D,CAAC,0BAA0B,GAAG,oCAAoC,GAAG,wBAAwB,CAAC,CAAC;AAEjG,MAAM,WAAW,2BAA4B,SAAQ,6BAA6B,EAAE,6BAA6B;IAC/G,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAGD,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAE1F"}
@@ -1 +1 @@
1
- {"version":3,"file":"v1_0_11.types.js","sourceRoot":"","sources":["../../lib/types/v1_0_11.types.ts"],"names":[],"mappings":";;;AAyEA,qDAAqD;AACrD,SAAgB,6BAA6B,CAAC,OAAmC;IAC/E,OAAO,OAAO,IAAI,cAAc,IAAI,OAAO,CAAC;AAC9C,CAAC;AAFD,sEAEC"}
1
+ {"version":3,"file":"v1_0_11.types.js","sourceRoot":"","sources":["../../lib/types/v1_0_11.types.ts"],"names":[],"mappings":";;;AA2DA,qDAAqD;AACrD,SAAgB,6BAA6B,CAAC,OAAmC;IAC/E,OAAO,OAAO,IAAI,cAAc,IAAI,OAAO,CAAC;AAC9C,CAAC;AAFD,sEAEC"}
@@ -340,3 +340,30 @@ function recordVersion(currentVersion: OpenId4VCIVersion, matchingVersion: OpenI
340
340
  `Invalid param. Some keys have been used from version: ${currentVersion} version while '${key}' is used from version: ${matchingVersion}`,
341
341
  );
342
342
  }
343
+
344
+ export function getTypesFromOffer(credentialOffer: UniformCredentialOfferPayload, opts?: { filterVerifiableCredential: boolean }) {
345
+ const types = credentialOffer.credentials.reduce<string[]>((prev, curr) => {
346
+ // FIXME returning the string value is wrong (as it's an id), but just matching the current behavior of this library
347
+ // The credential_type (from draft 8) and the actual 'type' value in a VC (from draft 11) are mixed up
348
+ // Fix for this here: https://github.com/Sphereon-Opensource/OID4VCI/pull/54
349
+ if (typeof curr === 'string') {
350
+ return [...prev, curr];
351
+ } else if (curr.format === 'jwt_vc_json-ld' || curr.format === 'ldp_vc') {
352
+ return [...prev, ...curr.credential_definition.types];
353
+ } else if (curr.format === 'jwt_vc_json' || curr.format === 'jwt_vc') {
354
+ return [...prev, ...curr.types];
355
+ } else if (curr.format === 'vc+sd-jwt') {
356
+ return [...prev, curr.credential_definition.vct];
357
+ }
358
+
359
+ return prev;
360
+ }, []);
361
+
362
+ if (!types || types.length === 0) {
363
+ throw Error('Could not deduce types from credential offer');
364
+ }
365
+ if (opts?.filterVerifiableCredential) {
366
+ return types.filter((type) => type !== 'VerifiableCredential');
367
+ }
368
+ return types;
369
+ }
@@ -1,7 +1,17 @@
1
- import { CredentialRequestV1_0_11 } from '../types';
1
+ import { CredentialRequestV1_0_08, OpenId4VCIVersion, UniformCredentialRequest } from '../types';
2
+
3
+ import { getFormatForVersion } from './FormatUtils';
4
+
5
+ export function getTypesFromRequest(credentialRequest: UniformCredentialRequest, opts?: { filterVerifiableCredential: boolean }) {
6
+ let types: string[] = [];
7
+ if (credentialRequest.format === 'jwt_vc_json' || credentialRequest.format === 'jwt_vc') {
8
+ types = credentialRequest.types;
9
+ } else if (credentialRequest.format === 'jwt_vc_json-ld' || credentialRequest.format === 'ldp_vc') {
10
+ types = credentialRequest.credential_definition.types;
11
+ } else if (credentialRequest.format === 'vc+sd-jwt') {
12
+ types = [credentialRequest.credential_definition.vct];
13
+ }
2
14
 
3
- export function getTypesFromRequest(credentialRequest: CredentialRequestV1_0_11, opts?: { filterVerifiableCredential: boolean }) {
4
- const types = 'types' in credentialRequest ? credentialRequest.types : credentialRequest.credential_definition.types;
5
15
  if (!types || types.length === 0) {
6
16
  throw Error('Could not deduce types from credential request');
7
17
  }
@@ -10,3 +20,21 @@ export function getTypesFromRequest(credentialRequest: CredentialRequestV1_0_11,
10
20
  }
11
21
  return types;
12
22
  }
23
+
24
+ export function getCredentialRequestForVersion(
25
+ credentialRequest: UniformCredentialRequest,
26
+ version: OpenId4VCIVersion,
27
+ ): UniformCredentialRequest | CredentialRequestV1_0_08 {
28
+ if (version === OpenId4VCIVersion.VER_1_0_08) {
29
+ const draft8Format = getFormatForVersion(credentialRequest.format, version);
30
+ const types = getTypesFromRequest(credentialRequest, { filterVerifiableCredential: true });
31
+
32
+ return {
33
+ format: draft8Format,
34
+ proof: credentialRequest.proof,
35
+ type: types[0],
36
+ } satisfies CredentialRequestV1_0_08;
37
+ }
38
+
39
+ return credentialRequest;
40
+ }
@@ -0,0 +1,52 @@
1
+ import { CredentialFormat } from '@sphereon/ssi-types';
2
+
3
+ import { OID4VCICredentialFormat, OpenId4VCIVersion } from '../types';
4
+
5
+ export function isFormat<T extends { format?: OID4VCICredentialFormat }, Format extends OID4VCICredentialFormat>(
6
+ formatObject: T,
7
+ format: Format,
8
+ ): formatObject is T & { format: Format } {
9
+ return formatObject.format === format;
10
+ }
11
+
12
+ export function isNotFormat<T extends { format?: OID4VCICredentialFormat }, Format extends OID4VCICredentialFormat>(
13
+ formatObject: T,
14
+ format: Format,
15
+ ): formatObject is T & { format: Exclude<OID4VCICredentialFormat, Format> } {
16
+ return formatObject.format !== format;
17
+ }
18
+
19
+ const isUniformFormat = (format: string): format is OID4VCICredentialFormat => {
20
+ return ['jwt_vc_json', 'jwt_vc_json-ld', 'ldp_vc', 'vc+sd-jwt'].includes(format);
21
+ };
22
+
23
+ export function getUniformFormat(format: string | OID4VCICredentialFormat | CredentialFormat): OID4VCICredentialFormat {
24
+ // Already valid format
25
+ if (isUniformFormat(format)) {
26
+ return format;
27
+ }
28
+
29
+ // Older formats
30
+ if (format === 'jwt_vc' || format === 'jwt') {
31
+ return 'jwt_vc';
32
+ }
33
+ if (format === 'ldp_vc' || format === 'ldp') {
34
+ return 'ldp_vc';
35
+ }
36
+
37
+ throw new Error(`Invalid format: ${format}`);
38
+ }
39
+
40
+ export function getFormatForVersion(format: string, version: OpenId4VCIVersion) {
41
+ const uniformFormat = isUniformFormat(format) ? format : getUniformFormat(format);
42
+
43
+ if (version === OpenId4VCIVersion.VER_1_0_08) {
44
+ if (uniformFormat === 'jwt_vc_json') {
45
+ return 'jwt_vc' as const;
46
+ } else if (uniformFormat === 'ldp_vc' || uniformFormat === 'jwt_vc_json-ld') {
47
+ return 'ldp_vc' as const;
48
+ }
49
+ }
50
+
51
+ return uniformFormat;
52
+ }
@@ -8,7 +8,7 @@ const debug = Debug('sphereon:openid4vci:http');
8
8
  export const getJson = async <T>(
9
9
  URL: string,
10
10
  opts?: {
11
- bearerToken?: string;
11
+ bearerToken?: (() => Promise<string>) | string;
12
12
  contentType?: string;
13
13
  accept?: string;
14
14
  customHeaders?: Record<string, string>;
@@ -22,7 +22,7 @@ export const formPost = async <T>(
22
22
  url: string,
23
23
  body: BodyInit,
24
24
  opts?: {
25
- bearerToken?: string;
25
+ bearerToken?: (() => Promise<string>) | string;
26
26
  contentType?: string;
27
27
  accept?: string;
28
28
  customHeaders?: Record<string, string>;
@@ -36,7 +36,7 @@ export const post = async <T>(
36
36
  url: string,
37
37
  body?: BodyInit,
38
38
  opts?: {
39
- bearerToken?: string;
39
+ bearerToken?: (() => Promise<string>) | string;
40
40
  contentType?: string;
41
41
  accept?: string;
42
42
  customHeaders?: Record<string, string>;
@@ -51,7 +51,7 @@ const openIdFetch = async <T>(
51
51
  body?: BodyInit,
52
52
  opts?: {
53
53
  method?: string;
54
- bearerToken?: string;
54
+ bearerToken?: (() => Promise<string>) | string;
55
55
  contentType?: string;
56
56
  accept?: string;
57
57
  customHeaders?: Record<string, string>;
@@ -60,7 +60,7 @@ const openIdFetch = async <T>(
60
60
  ): Promise<OpenIDResponse<T>> => {
61
61
  const headers: Record<string, string> = opts?.customHeaders ?? {};
62
62
  if (opts?.bearerToken) {
63
- headers['Authorization'] = `Bearer ${opts.bearerToken}`;
63
+ headers['Authorization'] = `Bearer ${typeof opts.bearerToken === 'function' ? await opts.bearerToken() : opts.bearerToken}`;
64
64
  }
65
65
  const method = opts?.method ? opts.method : body ? 'POST' : 'GET';
66
66
  const accept = opts?.accept ? opts.accept : 'application/json';
@@ -43,7 +43,7 @@ export function getSupportedCredential(opts?: {
43
43
  }
44
44
  const { version, types } = opts ?? { version: OpenId4VCIVersion.VER_1_0_11 };
45
45
  if (version === OpenId4VCIVersion.VER_1_0_08 || !Array.isArray(issuerMetadata.credentials_supported)) {
46
- credentialsSupported = credentialsSupportedV8ToV11((issuerMetadata as IssuerMetadataV1_0_08).credentials_supported);
46
+ credentialsSupported = credentialsSupportedV8ToV11((issuerMetadata as IssuerMetadataV1_0_08).credentials_supported ?? {});
47
47
  } else {
48
48
  credentialsSupported = (issuerMetadata as CredentialIssuerMetadata).credentials_supported;
49
49
  }
@@ -73,7 +73,7 @@ export function getSupportedCredential(opts?: {
73
73
  if ((opts?.types && typeof opts?.types === 'string') || opts?.types?.length === 1) {
74
74
  const types = Array.isArray(opts.types) ? opts.types[0] : opts.types;
75
75
  const supported = credentialsSupported.filter(
76
- (sup) => sup.id === types || (initiationTypes && arrayEqualsIgnoreOrder(sup.types, initiationTypes)),
76
+ (sup) => sup.id === types || (initiationTypes && arrayEqualsIgnoreOrder(getTypesFromCredentialSupported(sup), initiationTypes)),
77
77
  );
78
78
  if (supported) {
79
79
  credentialSupportedOverlap.push(...supported);
@@ -86,7 +86,7 @@ export function getSupportedCredential(opts?: {
86
86
  initiationTypes.push('VerifiableCredential');
87
87
  }
88
88
  const supported = credentialsSupported.filter((sup) => {
89
- const supTypes = sup.types;
89
+ const supTypes = getTypesFromCredentialSupported(sup);
90
90
  if (!supTypes.includes('VerifiableCredential')) {
91
91
  supTypes.push('VerifiableCredential');
92
92
  }
@@ -99,6 +99,28 @@ export function getSupportedCredential(opts?: {
99
99
  return credentialSupportedOverlap;
100
100
  }
101
101
 
102
+ export function getTypesFromCredentialSupported(credentialSupported: CredentialSupported, opts?: { filterVerifiableCredential: boolean }) {
103
+ let types: string[] = [];
104
+ if (
105
+ credentialSupported.format === 'jwt_vc_json' ||
106
+ credentialSupported.format === 'jwt_vc' ||
107
+ credentialSupported.format === 'jwt_vc_json-ld' ||
108
+ credentialSupported.format === 'ldp_vc'
109
+ ) {
110
+ types = credentialSupported.types;
111
+ } else if (credentialSupported.format === 'vc+sd-jwt') {
112
+ types = [credentialSupported.credential_definition.vct];
113
+ }
114
+
115
+ if (!types || types.length === 0) {
116
+ throw Error('Could not deduce types from credential supported');
117
+ }
118
+ if (opts?.filterVerifiableCredential) {
119
+ return types.filter((type) => type !== 'VerifiableCredential');
120
+ }
121
+ return types;
122
+ }
123
+
102
124
  function arrayEqualsIgnoreOrder(a: string[], b: string[]) {
103
125
  if (a.length !== b.length) return false;
104
126
  const uniqueValues = new Set([...a, ...b]);
@@ -127,7 +149,7 @@ export function credentialSupportedV8ToV11(key: string, supportedV8: CredentialS
127
149
  }
128
150
  let credentialSupport: Partial<CredentialSupported> = {};
129
151
  credentialSupport = {
130
- format,
152
+ format: format as OID4VCICredentialFormat,
131
153
  display: supportedV8.display,
132
154
  ...credentialSupportBrief,
133
155
  credentialSubject: supportedV8.claims,
@@ -2,3 +2,5 @@ export * from './CredentialRequestUtil';
2
2
  export * from './CredentialOfferUtil';
3
3
  export * from './Encoding';
4
4
  export * from './TypeConversionUtils';
5
+ export * from './IssuerMetadataUtils';
6
+ export * from './FormatUtils';
@@ -1,5 +1,12 @@
1
1
  import { CredentialOfferPayload, UniformCredentialOffer } from './CredentialIssuance.types';
2
- import { ErrorResponse, IssuerCredentialDefinition, IssuerCredentialSubject, OID4VCICredentialFormat, PRE_AUTH_CODE_LITERAL } from './Generic.types';
2
+ import {
3
+ ErrorResponse,
4
+ IssuerCredentialSubject,
5
+ JsonLdIssuerCredentialDefinition,
6
+ OID4VCICredentialFormat,
7
+ PRE_AUTH_CODE_LITERAL,
8
+ SdJwtVcCredentialDefinition,
9
+ } from './Generic.types';
3
10
  import { EndpointMetadata } from './ServerMetadata';
4
11
 
5
12
  export interface CommonAuthorizationRequest {
@@ -64,9 +71,9 @@ export interface CommonAuthorizationRequest {
64
71
  /**
65
72
  * string type added for conformity with our previous code in the client
66
73
  */
67
- export type AuthorizationDetails = AuthorizationDetailsJwtVcJson | AuthorizationRequestJwtVcJsonLdAndLdpVc | string;
74
+ export type AuthorizationDetails = AuthorizationDetailsJwtVcJson | AuthorizationDetailsJwtVcJsonLdAndLdpVc | AuthorizationDetailsSdJwtVc | string;
68
75
 
69
- export type AuthorizationRequest = AuthorizationRequestJwtVcJson | AuthorizationDetailsJwtVcJsonLdAndLdpVc;
76
+ export type AuthorizationRequest = AuthorizationRequestJwtVcJson | AuthorizationRequestJwtVcJsonLdAndLdpVc | AuthorizationRequestSdJwtVc;
70
77
 
71
78
  export interface AuthorizationRequestJwtVcJson extends CommonAuthorizationRequest {
72
79
  authorization_details?: AuthorizationDetailsJwtVcJson[];
@@ -76,6 +83,10 @@ export interface AuthorizationRequestJwtVcJsonLdAndLdpVc extends CommonAuthoriza
76
83
  authorization_details?: AuthorizationDetailsJwtVcJsonLdAndLdpVc[];
77
84
  }
78
85
 
86
+ export interface AuthorizationRequestSdJwtVc extends CommonAuthorizationRequest {
87
+ authorization_details?: AuthorizationDetailsSdJwtVc[];
88
+ }
89
+
79
90
  export interface CommonAuthorizationDetails {
80
91
  /**
81
92
  * REQUIRED. JSON string that determines the authorization details type.
@@ -94,12 +105,14 @@ export interface CommonAuthorizationDetails {
94
105
  * the authorization detail's locations common data field MUST be set to the Credential Issuer Identifier value.
95
106
  */
96
107
  locations?: string[];
97
- types: string[]; // This claim contains the type values the Wallet requests authorization for at the issuer.
108
+
98
109
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
99
110
  [key: string]: any;
100
111
  }
101
112
 
102
113
  export interface AuthorizationDetailsJwtVcJson extends CommonAuthorizationDetails {
114
+ format: 'jwt_vc_json' | 'jwt_vc'; // jwt_vc added for backward compat
115
+
103
116
  /**
104
117
  * A JSON object containing a list of key value pairs, where the key identifies the claim offered in the Credential.
105
118
  * The value MAY be a dictionary, which allows to represent the full (potentially deeply nested) structure of the
@@ -107,9 +120,13 @@ export interface AuthorizationDetailsJwtVcJson extends CommonAuthorizationDetail
107
120
  * credential to be issued.
108
121
  */
109
122
  credentialSubject?: IssuerCredentialSubject;
123
+
124
+ types: string[]; // This claim contains the type values the Wallet requests authorization for at the issuer.
110
125
  }
111
126
 
112
127
  export interface AuthorizationDetailsJwtVcJsonLdAndLdpVc extends CommonAuthorizationDetails {
128
+ format: 'ldp_vc' | 'jwt_vc_json-ld';
129
+
113
130
  /**
114
131
  * REQUIRED. JSON object containing (and isolating) the detailed description of the credential type.
115
132
  * This object MUST be processed using full JSON-LD processing. It consists of the following sub-claims:
@@ -117,7 +134,13 @@ export interface AuthorizationDetailsJwtVcJsonLdAndLdpVc extends CommonAuthoriza
117
134
  * - types: REQUIRED. JSON array as defined in Appendix E.1.3.2.
118
135
  * This claim contains the type values the Wallet shall request in the subsequent Credential Request
119
136
  */
120
- credential_definition: IssuerCredentialDefinition;
137
+ credential_definition: JsonLdIssuerCredentialDefinition;
138
+ }
139
+
140
+ export interface AuthorizationDetailsSdJwtVc extends CommonAuthorizationDetails {
141
+ format: 'vc+sd-jwt';
142
+
143
+ credential_definition: SdJwtVcCredentialDefinition;
121
144
  }
122
145
 
123
146
  export enum GrantTypes {
@@ -154,7 +177,8 @@ export interface IssuerOpts {
154
177
  }
155
178
 
156
179
  export interface AccessTokenRequestOpts {
157
- credentialOffer: UniformCredentialOffer;
180
+ credentialOffer?: UniformCredentialOffer;
181
+ credentialIssuer?: string;
158
182
  asOpts?: AuthorizationServerOpts;
159
183
  metadata?: EndpointMetadata;
160
184
  codeVerifier?: string; // only required for authorization flow