@sphereon/oid4vci-common 0.15.2-unstable.8 → 0.16.1-next.13

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 (58) hide show
  1. package/dist/functions/CredentialRequestUtil.d.ts.map +1 -1
  2. package/dist/functions/CredentialRequestUtil.js +3 -0
  3. package/dist/functions/CredentialRequestUtil.js.map +1 -1
  4. package/dist/functions/FormatUtils.js +1 -1
  5. package/dist/functions/FormatUtils.js.map +1 -1
  6. package/dist/functions/HttpUtils.d.ts.map +1 -1
  7. package/dist/functions/HttpUtils.js +2 -1
  8. package/dist/functions/HttpUtils.js.map +1 -1
  9. package/dist/functions/IssuerMetadataUtils.js +1 -1
  10. package/dist/functions/IssuerMetadataUtils.js.map +1 -1
  11. package/dist/functions/ProofUtil.d.ts +4 -2
  12. package/dist/functions/ProofUtil.d.ts.map +1 -1
  13. package/dist/functions/ProofUtil.js +2 -1
  14. package/dist/functions/ProofUtil.js.map +1 -1
  15. package/dist/functions/RandomUtils.js +2 -5
  16. package/dist/functions/RandomUtils.js.map +1 -1
  17. package/dist/functions/TypeConversionUtils.d.ts +4 -4
  18. package/dist/functions/TypeConversionUtils.d.ts.map +1 -1
  19. package/dist/functions/TypeConversionUtils.js +6 -0
  20. package/dist/functions/TypeConversionUtils.js.map +1 -1
  21. package/dist/types/Authorization.types.d.ts +19 -3
  22. package/dist/types/Authorization.types.d.ts.map +1 -1
  23. package/dist/types/Authorization.types.js.map +1 -1
  24. package/dist/types/CredentialIssuance.types.d.ts +3 -37
  25. package/dist/types/CredentialIssuance.types.d.ts.map +1 -1
  26. package/dist/types/CredentialIssuance.types.js.map +1 -1
  27. package/dist/types/Generic.types.d.ts +23 -10
  28. package/dist/types/Generic.types.d.ts.map +1 -1
  29. package/dist/types/Generic.types.js.map +1 -1
  30. package/dist/types/ServerMetadata.d.ts +2 -0
  31. package/dist/types/ServerMetadata.d.ts.map +1 -1
  32. package/dist/types/ServerMetadata.js.map +1 -1
  33. package/dist/types/Token.types.d.ts +2 -1
  34. package/dist/types/Token.types.d.ts.map +1 -1
  35. package/dist/types/Token.types.js +1 -0
  36. package/dist/types/Token.types.js.map +1 -1
  37. package/dist/types/v1_0_09.types.d.ts +2 -2
  38. package/dist/types/v1_0_09.types.d.ts.map +1 -1
  39. package/dist/types/v1_0_11.types.d.ts +2 -2
  40. package/dist/types/v1_0_11.types.d.ts.map +1 -1
  41. package/dist/types/v1_0_13.types.d.ts +11 -6
  42. package/dist/types/v1_0_13.types.d.ts.map +1 -1
  43. package/lib/functions/CredentialRequestUtil.ts +2 -0
  44. package/lib/functions/FormatUtils.ts +1 -1
  45. package/lib/functions/HttpUtils.ts +2 -1
  46. package/lib/functions/IssuerMetadataUtils.ts +1 -1
  47. package/lib/functions/ProofUtil.ts +3 -3
  48. package/lib/functions/RandomUtils.ts +2 -2
  49. package/lib/functions/TypeConversionUtils.ts +23 -5
  50. package/lib/types/Authorization.types.ts +31 -3
  51. package/lib/types/CredentialIssuance.types.ts +3 -41
  52. package/lib/types/Generic.types.ts +35 -13
  53. package/lib/types/ServerMetadata.ts +4 -1
  54. package/lib/types/Token.types.ts +1 -0
  55. package/lib/types/v1_0_09.types.ts +2 -2
  56. package/lib/types/v1_0_11.types.ts +2 -2
  57. package/lib/types/v1_0_13.types.ts +15 -3
  58. package/package.json +9 -6
@@ -17,7 +17,7 @@ import {
17
17
  export type InputCharSet = 'numeric' | 'text';
18
18
  export type KeyProofType = 'jwt' | 'cwt' | 'ldp_vp';
19
19
 
20
- export type PoPMode = 'pop' | 'JWT'; // Proof of posession, or regular JWT
20
+ export type PoPMode = 'pop' | 'JWT'; // Proof of possession, or regular JWT
21
21
 
22
22
  /**
23
23
  * Important Note: please be aware that these Common interfaces are based on versions v1_0.11 and v1_0.09
@@ -29,7 +29,7 @@ export interface ImageInfo {
29
29
  [key: string]: unknown;
30
30
  }
31
31
 
32
- export type OID4VCICredentialFormat = 'jwt_vc_json' | 'jwt_vc_json-ld' | 'ldp_vc' | 'vc+sd-jwt' | 'jwt_vc'; // jwt_vc is added for backwards compat /*| 'mso_mdoc'*/; // we do not support mdocs at this point
32
+ export type OID4VCICredentialFormat = 'jwt_vc_json' | 'jwt_vc_json-ld' | 'ldp_vc' | 'vc+sd-jwt' | 'jwt_vc' | 'mso_mdoc'; // jwt_vc is added for backwards compat
33
33
 
34
34
  export interface NameAndLocale {
35
35
  name?: string; // REQUIRED. String value of a display name for the Credential.
@@ -62,7 +62,7 @@ export interface CredentialSupplierConfig {
62
62
  export interface CredentialIssuerMetadataOpts {
63
63
  credential_endpoint?: string; // REQUIRED. URL of the Credential Issuer's Credential Endpoint. This URL MUST use the https scheme and MAY contain port, path and query parameter components.
64
64
  batch_credential_endpoint?: string; // OPTIONAL. URL of the Credential Issuer's Batch Credential Endpoint. This URL MUST use the https scheme and MAY contain port, path and query parameter components. If omitted, the Credential Issuer does not support the Batch Credential Endpoint.
65
- credentials_supported?: CredentialConfigurationSupported[]; // REQUIRED in versions below 13. A JSON array containing a list of JSON objects, each of them representing metadata about a separate credential type that the Credential Issuer can issue. The JSON objects in the array MUST conform to the structure of the Section 10.2.3.1.
65
+ credentials_supported: CredentialsSupportedLegacy[]; // REQUIRED in versions below 13. A JSON array containing a list of JSON objects, each of them representing metadata about a separate credential type that the Credential Issuer can issue. The JSON objects in the array MUST conform to the structure of the Section 10.2.3.1.
66
66
  credential_issuer: string; // REQUIRED. The Credential Issuer's identifier.
67
67
  authorization_server?: string; // OPTIONAL. Identifier of the OAuth 2.0 Authorization Server (as defined in [RFC8414]) the Credential Issuer relies on for authorization. If this element is omitted, the entity providing the Credential Issuer is also acting as the AS, i.e. the Credential Issuer's identifier is used as the OAuth 2.0 Issuer value to obtain the Authorization Server metadata as per [RFC8414].
68
68
  token_endpoint?: string;
@@ -116,7 +116,7 @@ export interface CredentialIssuerMetadata extends CredentialIssuerMetadataOpts,
116
116
 
117
117
  export interface CredentialSupportedBrief {
118
118
  cryptographic_binding_methods_supported?: string[]; // OPTIONAL. Array of case sensitive strings that identify how the Credential is bound to the identifier of the End-User who possesses the Credential
119
- credential_signing_alg_values_supported?: string[]; // OPTIONAL. Array of case sensitive strings that identify the cryptographic suites that are supported for the cryptographic_binding_methods_supported
119
+ cryptographic_suites_supported?: string[]; // OPTIONAL. Array of case sensitive strings that identify the cryptographic suites that are supported for the cryptographic_binding_methods_supported
120
120
  }
121
121
 
122
122
  export interface ProofType {
@@ -164,12 +164,22 @@ export interface CredentialSupportedSdJwtVc extends CommonCredentialSupported {
164
164
  order?: string[]; //An array of claims.display.name values that lists them in the order they should be displayed by the Wallet.
165
165
  }
166
166
 
167
+ export interface CredentialSupportedMsoMdoc extends CommonCredentialSupported {
168
+ format: 'mso_mdoc';
169
+
170
+ doctype: string;
171
+ claims?: IssuerCredentialSubject;
172
+
173
+ order?: string[]; //An array of claims.display.name values that lists them in the order they should be displayed by the Wallet.
174
+ }
175
+
167
176
  export type CredentialConfigurationSupported =
168
177
  | CredentialConfigurationSupportedV1_0_13
169
- | (CommonCredentialSupported & (CredentialSupportedJwtVcJson | CredentialSupportedJwtVcJsonLdAndLdpVc | CredentialSupportedSdJwtVc));
178
+ | (CommonCredentialSupported &
179
+ (CredentialSupportedJwtVcJson | CredentialSupportedJwtVcJsonLdAndLdpVc | CredentialSupportedSdJwtVc | CredentialSupportedMsoMdoc));
170
180
 
171
181
  export type CredentialsSupportedLegacy = CommonCredentialSupported &
172
- (CredentialSupportedJwtVcJson | CredentialSupportedJwtVcJsonLdAndLdpVc | CredentialSupportedSdJwtVc);
182
+ (CredentialSupportedJwtVcJson | CredentialSupportedJwtVcJsonLdAndLdpVc | CredentialSupportedSdJwtVc | CredentialSupportedMsoMdoc);
173
183
 
174
184
  export interface CommonCredentialOfferFormat {
175
185
  format: OID4VCICredentialFormat | string;
@@ -196,8 +206,18 @@ export interface CredentialOfferFormatSdJwtVc extends CommonCredentialOfferForma
196
206
  claims?: IssuerCredentialSubject;
197
207
  }
198
208
 
199
- export type CredentialOfferFormat = CommonCredentialOfferFormat &
200
- (CredentialOfferFormatJwtVcJsonLdAndLdpVc | CredentialOfferFormatJwtVcJson | CredentialOfferFormatSdJwtVc);
209
+ // NOTE: the sd-jwt format is added to oid4vci in a later draft version than currently
210
+ // supported, so there's no defined offer format. However, based on the request structure
211
+ // we support sd-jwt for older drafts of oid4vci as well
212
+ export interface CredentialOfferFormatMsoMdoc extends CommonCredentialOfferFormat {
213
+ format: 'mso_mdoc';
214
+
215
+ doctype: string;
216
+ claims?: IssuerCredentialSubject;
217
+ }
218
+
219
+ export type CredentialOfferFormatV1_0_11 = CommonCredentialOfferFormat &
220
+ (CredentialOfferFormatJwtVcJsonLdAndLdpVc | CredentialOfferFormatJwtVcJson | CredentialOfferFormatSdJwtVc | CredentialOfferFormatMsoMdoc);
201
221
 
202
222
  /**
203
223
  * 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
@@ -218,7 +238,7 @@ export interface JsonLdIssuerCredentialDefinition {
218
238
  credentialSubject?: IssuerCredentialSubject;
219
239
  }
220
240
 
221
- export interface ErrorResponse extends Response {
241
+ export interface ErrorResponse {
222
242
  error: string;
223
243
  error_description?: string;
224
244
  error_uri?: string;
@@ -249,6 +269,12 @@ export interface CredentialRequestSdJwtVc extends CommonCredentialRequest {
249
269
  claims?: IssuerCredentialSubject;
250
270
  }
251
271
 
272
+ export interface CredentialRequestMsoMdoc extends CommonCredentialRequest {
273
+ format: 'mso_mdoc';
274
+ doctype: string;
275
+ claims?: IssuerCredentialSubject;
276
+ }
277
+
252
278
  export interface CommonCredentialResponse extends ExperimentalSubjectIssuance {
253
279
  // format: string; TODO do we still need this for previous version support?
254
280
  credential?: W3CVerifiableCredential;
@@ -398,7 +424,3 @@ export type NotificationResult = {
398
424
  export interface NotificationErrorResponse {
399
425
  error: NotificationError | string;
400
426
  }
401
-
402
- export interface IssuerSessionIdRequestOpts {
403
- sessionEndpoint: string
404
- }
@@ -1,3 +1,5 @@
1
+ import { SigningAlgo } from '@sphereon/oid4vc-common';
2
+
1
3
  export interface AuthorizationServerMetadata {
2
4
  issuer: string;
3
5
  authorization_endpoint?: string;
@@ -27,7 +29,8 @@ export interface AuthorizationServerMetadata {
27
29
  // Note that the presence of pushed_authorization_request_endpoint is sufficient for a client to determine that it may use the PAR flow. A request_uri value obtained from the PAR endpoint is usable at the authorization endpoint regardless of other authorization server metadata such as request_uri_parameter_supported or require_request_uri_registration
28
30
  require_pushed_authorization_requests?: boolean; // Boolean parameter indicating whether Indicates whether the client is required to use PAR to initiate authorization. If omitted, the default value is false.
29
31
  'pre-authorized_grant_anonymous_access_supported': boolean; // OPTIONAL. A JSON Boolean indicating whether the issuer accepts a Token Request with a Pre-Authorized Code but without a client id. The default is false
30
-
32
+ // A JSON array containing a list of the JWS alg values (from the [IANA.JOSE.ALGS] registry) supported by the authorization server for DPoP proof JWTs.
33
+ dpop_signing_alg_values_supported?: (string | SigningAlgo)[];
31
34
  // OIDC values
32
35
  frontchannel_logout_supported?: boolean;
33
36
  frontchannel_logout_session_supported?: boolean;
@@ -3,6 +3,7 @@ export enum TokenErrorResponse {
3
3
  invalid_grant = 'invalid_grant',
4
4
  invalid_client = 'invalid_client', // this code has been added only in v1_0-11, but I've added this to the common interface. @nklomp is this ok?
5
5
  invalid_scope = 'invalid_scope',
6
+ invalid_dpop_proof = 'invalid_dpop_proof',
6
7
  }
7
8
 
8
9
  export class TokenError extends Error {
@@ -1,5 +1,5 @@
1
1
  import { CommonAuthorizationRequest } from './Authorization.types';
2
- import { CredentialOfferFormat } from './Generic.types';
2
+ import { CredentialOfferFormatV1_0_11 } from './Generic.types';
3
3
 
4
4
  export interface CredentialOfferV1_0_09 {
5
5
  credential_offer: CredentialOfferPayloadV1_0_09;
@@ -20,7 +20,7 @@ export interface CredentialOfferPayloadV1_0_09 {
20
20
  * credentials_supported Credential Issuer metadata parameter.
21
21
  * When processing, the Wallet MUST resolve this string value to the respective object.
22
22
  */
23
- credentials: (CredentialOfferFormat | string)[];
23
+ credentials: (CredentialOfferFormatV1_0_11 | string)[];
24
24
  'pre-authorized_code'?: string; //CONDITIONAL the code representing the issuer's authorization for the Wallet to obtain Credentials of a certain type. This code MUST be short-lived and single-use. MUST be present in a pre-authorized code flow.
25
25
  user_pin_required?: boolean | string; //OPTIONAL Boolean value specifying whether the issuer expects presentation of a user PIN along with the Token Request in a pre-authorized code flow. Default is false.
26
26
  op_state?: string; //(JWT) OPTIONAL String value created by the Credential Issuer and opaque to the Wallet that is used to bind the subsequent authentication request with the Credential Issuer to a context set up during previous steps
@@ -4,7 +4,7 @@ import {
4
4
  CommonCredentialRequest,
5
5
  CredentialDataSupplierInput,
6
6
  CredentialIssuerMetadataOpts,
7
- CredentialOfferFormat,
7
+ CredentialOfferFormatV1_0_11,
8
8
  CredentialRequestJwtVcJson,
9
9
  CredentialRequestJwtVcJsonLdAndLdpVc,
10
10
  CredentialRequestSdJwtVc,
@@ -62,7 +62,7 @@ export interface CredentialOfferPayloadV1_0_11 {
62
62
  * credentials_supported Credential Issuer metadata parameter.
63
63
  * When processing, the Wallet MUST resolve this string value to the respective object.
64
64
  */
65
- credentials: (CredentialOfferFormat | string)[];
65
+ credentials: (CredentialOfferFormatV1_0_11 | string)[];
66
66
  /**
67
67
  * OPTIONAL. A JSON object indicating to the Wallet the Grant Types the Credential Issuer's AS is prepared
68
68
  * to process for this credential offer. Every grant is represented by a key and an object.
@@ -1,10 +1,13 @@
1
+ import { JWK } from '@sphereon/oid4vc-common';
2
+
1
3
  import { ExperimentalSubjectIssuance } from '../experimental/holder-vci';
2
4
 
3
- import { JWK, ProofOfPossession } from './CredentialIssuance.types';
5
+ import { ProofOfPossession } from './CredentialIssuance.types';
4
6
  import {
5
7
  AlgValue,
6
8
  CommonCredentialRequest,
7
9
  CredentialDataSupplierInput,
10
+ CredentialRequestMsoMdoc,
8
11
  CredentialRequestSdJwtVc,
9
12
  CredentialsSupportedDisplay,
10
13
  CredentialSupplierConfig,
@@ -30,7 +33,6 @@ export interface IssuerMetadataV1_0_13 {
30
33
  notification_endpoint?: string;
31
34
  credential_response_encryption?: ResponseEncryption;
32
35
  token_endpoint?: string;
33
- session_endpoint?: string;
34
36
  display?: MetadataDisplay[];
35
37
 
36
38
  [x: string]: unknown;
@@ -52,6 +54,7 @@ export type CredentialConfigurationSupportedV1_0_13 = CredentialConfigurationSup
52
54
  | CredentialConfigurationSupportedSdJwtVcV1_0_13
53
55
  | CredentialConfigurationSupportedJwtVcJsonV1_0_13
54
56
  | CredentialConfigurationSupportedJwtVcJsonLdAndLdpVcV1_0_13
57
+ | CredentialConfigurationSupportedMsoMdocV1_0_13
55
58
  );
56
59
 
57
60
  // Base type covering credential configurations supported
@@ -74,6 +77,15 @@ export interface CredentialConfigurationSupportedSdJwtVcV1_0_13 extends Credenti
74
77
  order?: string[]; //An array of claims.display.name values that lists them in the order they should be displayed by the Wallet.
75
78
  }
76
79
 
80
+ export interface CredentialConfigurationSupportedMsoMdocV1_0_13 extends CredentialConfigurationSupportedCommonV1_0_13 {
81
+ format: 'mso_mdoc';
82
+
83
+ doctype: string;
84
+ claims?: IssuerCredentialSubject;
85
+
86
+ order?: string[]; //An array of claims.display.name values that lists them in the order they should be displayed by the Wallet.
87
+ }
88
+
77
89
  export interface CredentialConfigurationSupportedJwtVcJsonV1_0_13 extends CredentialConfigurationSupportedCommonV1_0_13 {
78
90
  format: 'jwt_vc_json' | 'jwt_vc';
79
91
  credential_definition: CredentialDefinitionJwtVcJsonV1_0_13;
@@ -102,6 +114,7 @@ export type CredentialRequestV1_0_13 = CredentialRequestV1_0_13Common &
102
114
  | CredentialRequestJwtVcJsonV1_0_13
103
115
  | CredentialRequestJwtVcJsonLdAndLdpVcV1_0_13
104
116
  | CredentialRequestSdJwtVc
117
+ | CredentialRequestMsoMdoc
105
118
  | CredentialRequestV1_0_13CredentialIdentifier
106
119
  );
107
120
 
@@ -190,7 +203,6 @@ export interface EndpointMetadataResultV1_0_13 extends EndpointMetadata {
190
203
  authorizationServerType: AuthorizationServerType;
191
204
  authorizationServerMetadata?: AuthorizationServerMetadata;
192
205
  credentialIssuerMetadata?: Partial<AuthorizationServerMetadata> & IssuerMetadataV1_0_13;
193
- session_endpoint?: string;
194
206
  }
195
207
 
196
208
  // For now we extend the opts above. Only difference is that the credential endpoint is optional in the Opts, as it can come from other sources. The value is however required in the eventual Issuer Metadata
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphereon/oid4vci-common",
3
- "version": "0.15.2-unstable.8+bdd7117",
3
+ "version": "0.16.1-next.13+282e7a1",
4
4
  "description": "OpenID 4 Verifiable Credential Issuance Common Types",
5
5
  "source": "lib/index.ts",
6
6
  "main": "dist/index.js",
@@ -10,15 +10,18 @@
10
10
  "build:clean": "tsc --build --clean && tsc --build"
11
11
  },
12
12
  "dependencies": {
13
- "@sphereon/ssi-types": "0.28.0",
13
+ "@sphereon/oid4vc-common": "0.16.1-next.13+282e7a1",
14
+ "@sphereon/ssi-types": "0.29.0",
14
15
  "cross-fetch": "^3.1.8",
16
+ "debug": "^4.3.5",
15
17
  "jwt-decode": "^4.0.0",
16
- "sha.js": "^2.4.11",
17
- "uint8arrays": "3.1.1"
18
+ "uint8arrays": "3.1.1",
19
+ "uuid": "^9.0.0"
18
20
  },
19
21
  "devDependencies": {
22
+ "@types/debug": "^4.1.12",
20
23
  "@types/jest": "^29.5.12",
21
- "@types/sha.js": "^2.4.4",
24
+ "@types/uuid": "^9.0.1",
22
25
  "typescript": "5.4.5"
23
26
  },
24
27
  "engines": {
@@ -49,5 +52,5 @@
49
52
  "publishConfig": {
50
53
  "access": "public"
51
54
  },
52
- "gitHead": "bdd711734c65ba2a33b14ee5eacd0a9d619d800e"
55
+ "gitHead": "282e7a1c6b9becaf12b81302a5c84d34f525ae7a"
53
56
  }