@sphereon/oid4vci-common 0.10.3 → 0.10.4-next.119

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 (101) hide show
  1. package/dist/events/index.d.ts +17 -0
  2. package/dist/events/index.d.ts.map +1 -0
  3. package/dist/events/index.js +21 -0
  4. package/dist/events/index.js.map +1 -0
  5. package/dist/experimental/holder-vci.d.ts +13 -0
  6. package/dist/experimental/holder-vci.d.ts.map +1 -0
  7. package/dist/experimental/holder-vci.js +9 -0
  8. package/dist/experimental/holder-vci.js.map +1 -0
  9. package/dist/functions/CredentialOfferUtil.d.ts +3 -3
  10. package/dist/functions/CredentialOfferUtil.d.ts.map +1 -1
  11. package/dist/functions/CredentialOfferUtil.js +71 -28
  12. package/dist/functions/CredentialOfferUtil.js.map +1 -1
  13. package/dist/functions/CredentialRequestUtil.d.ts +3 -3
  14. package/dist/functions/CredentialRequestUtil.d.ts.map +1 -1
  15. package/dist/functions/CredentialRequestUtil.js +13 -4
  16. package/dist/functions/CredentialRequestUtil.js.map +1 -1
  17. package/dist/functions/CredentialResponseUtil.d.ts +3 -1
  18. package/dist/functions/CredentialResponseUtil.d.ts.map +1 -1
  19. package/dist/functions/CredentialResponseUtil.js +1 -1
  20. package/dist/functions/CredentialResponseUtil.js.map +1 -1
  21. package/dist/functions/Encoding.d.ts +7 -6
  22. package/dist/functions/Encoding.d.ts.map +1 -1
  23. package/dist/functions/Encoding.js +9 -8
  24. package/dist/functions/Encoding.js.map +1 -1
  25. package/dist/functions/IssuerMetadataUtils.d.ts +19 -12
  26. package/dist/functions/IssuerMetadataUtils.d.ts.map +1 -1
  27. package/dist/functions/IssuerMetadataUtils.js +155 -88
  28. package/dist/functions/IssuerMetadataUtils.js.map +1 -1
  29. package/dist/functions/ProofUtil.d.ts +38 -0
  30. package/dist/functions/ProofUtil.d.ts.map +1 -0
  31. package/dist/functions/ProofUtil.js +141 -0
  32. package/dist/functions/ProofUtil.js.map +1 -0
  33. package/dist/functions/index.d.ts +1 -0
  34. package/dist/functions/index.d.ts.map +1 -1
  35. package/dist/functions/index.js +1 -0
  36. package/dist/functions/index.js.map +1 -1
  37. package/dist/index.d.ts +5 -0
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +6 -0
  40. package/dist/index.js.map +1 -1
  41. package/dist/types/Authorization.types.d.ts +26 -4
  42. package/dist/types/Authorization.types.d.ts.map +1 -1
  43. package/dist/types/Authorization.types.js +7 -1
  44. package/dist/types/Authorization.types.js.map +1 -1
  45. package/dist/types/CredentialIssuance.types.d.ts +17 -10
  46. package/dist/types/CredentialIssuance.types.d.ts.map +1 -1
  47. package/dist/types/CredentialIssuance.types.js.map +1 -1
  48. package/dist/types/Generic.types.d.ts +104 -17
  49. package/dist/types/Generic.types.d.ts.map +1 -1
  50. package/dist/types/Generic.types.js.map +1 -1
  51. package/dist/types/OpenID4VCIErrors.d.ts +1 -0
  52. package/dist/types/OpenID4VCIErrors.d.ts.map +1 -1
  53. package/dist/types/OpenID4VCIErrors.js +2 -1
  54. package/dist/types/OpenID4VCIErrors.js.map +1 -1
  55. package/dist/types/OpenID4VCIVersions.types.d.ts +1 -0
  56. package/dist/types/OpenID4VCIVersions.types.d.ts.map +1 -1
  57. package/dist/types/OpenID4VCIVersions.types.js +1 -0
  58. package/dist/types/OpenID4VCIVersions.types.js.map +1 -1
  59. package/dist/types/ServerMetadata.d.ts +0 -7
  60. package/dist/types/ServerMetadata.d.ts.map +1 -1
  61. package/dist/types/ServerMetadata.js.map +1 -1
  62. package/dist/types/StateManager.types.d.ts +1 -0
  63. package/dist/types/StateManager.types.d.ts.map +1 -1
  64. package/dist/types/StateManager.types.js.map +1 -1
  65. package/dist/types/index.d.ts +1 -0
  66. package/dist/types/index.d.ts.map +1 -1
  67. package/dist/types/index.js +1 -0
  68. package/dist/types/index.js.map +1 -1
  69. package/dist/types/v1_0_11.types.d.ts +35 -5
  70. package/dist/types/v1_0_11.types.d.ts.map +1 -1
  71. package/dist/types/v1_0_11.types.js.map +1 -1
  72. package/dist/types/v1_0_12.types.d.ts +30 -1
  73. package/dist/types/v1_0_12.types.d.ts.map +1 -1
  74. package/dist/types/v1_0_13.types.d.ts +120 -0
  75. package/dist/types/v1_0_13.types.d.ts.map +1 -0
  76. package/dist/types/v1_0_13.types.js +3 -0
  77. package/dist/types/v1_0_13.types.js.map +1 -0
  78. package/lib/__tests__/CredentialOfferUtil.spec.ts +25 -9
  79. package/lib/__tests__/IssuerMetadataUtils.spec.ts +38 -0
  80. package/lib/events/index.ts +20 -0
  81. package/lib/experimental/holder-vci.ts +19 -0
  82. package/lib/functions/CredentialOfferUtil.ts +78 -26
  83. package/lib/functions/CredentialRequestUtil.ts +23 -8
  84. package/lib/functions/CredentialResponseUtil.ts +4 -4
  85. package/lib/functions/Encoding.ts +10 -8
  86. package/lib/functions/IssuerMetadataUtils.ts +164 -93
  87. package/lib/functions/ProofUtil.ts +185 -0
  88. package/lib/functions/index.ts +1 -0
  89. package/lib/index.ts +7 -0
  90. package/lib/types/Authorization.types.ts +31 -4
  91. package/lib/types/CredentialIssuance.types.ts +26 -10
  92. package/lib/types/Generic.types.ts +150 -27
  93. package/lib/types/OpenID4VCIErrors.ts +1 -0
  94. package/lib/types/OpenID4VCIVersions.types.ts +1 -0
  95. package/lib/types/ServerMetadata.ts +0 -10
  96. package/lib/types/StateManager.types.ts +1 -0
  97. package/lib/types/index.ts +1 -0
  98. package/lib/types/v1_0_11.types.ts +41 -4
  99. package/lib/types/v1_0_12.types.ts +39 -1
  100. package/lib/types/v1_0_13.types.ts +158 -0
  101. package/package.json +3 -11
@@ -0,0 +1,158 @@
1
+ import { ExperimentalSubjectIssuance } from '../experimental/holder-vci';
2
+
3
+ import { JWK, ProofOfPossession } from './CredentialIssuance.types';
4
+ import {
5
+ AlgValue,
6
+ CredentialDataSupplierInput,
7
+ CredentialRequestJwtVcJson,
8
+ CredentialRequestJwtVcJsonLdAndLdpVc,
9
+ CredentialRequestSdJwtVc,
10
+ CredentialsSupportedDisplay,
11
+ CredentialSupplierConfig,
12
+ EncValue,
13
+ Grant,
14
+ IssuerCredentialSubject,
15
+ KeyProofType,
16
+ MetadataDisplay,
17
+ OID4VCICredentialFormat,
18
+ ProofType,
19
+ ResponseEncryption,
20
+ } from './Generic.types';
21
+ import { QRCodeOpts } from './QRCode.types';
22
+ import { AuthorizationServerMetadata, AuthorizationServerType, EndpointMetadata } from './ServerMetadata';
23
+
24
+ export interface IssuerMetadataV1_0_13 {
25
+ issuer?: string;
26
+ credential_configurations_supported: Record<string, CredentialConfigurationSupportedV1_0_13>; // REQUIRED. A JSON object containing a list of key value pairs, where the key is a string serving as an abstract identifier of the Credential. This identifier is RECOMMENDED to be collision resistant - it can be globally unique, but does not have to be when naming conflicts are unlikely to arise in a given use case. The value is a JSON object. The JSON object MUST conform to the structure of the Section 11.2.1.
27
+ credential_issuer: string; // A Credential Issuer is identified by a case sensitive URL using the https scheme that contains scheme, host and, optionally, port number and path components, but no query or fragment components.
28
+ credential_endpoint: string; // REQUIRED. URL of the OP's Credential Endpoint. This URL MUST use the https scheme and MAY contain port, path and query parameter components.
29
+ authorization_servers?: string[];
30
+ batch_credential_endpoint?: string;
31
+ deferred_credential_endpoint?: string;
32
+ notification_endpoint?: string;
33
+ credential_response_encryption?: ResponseEncryption;
34
+ token_endpoint?: string;
35
+ display?: MetadataDisplay[];
36
+
37
+ [x: string]: unknown;
38
+ }
39
+
40
+ export type CredentialDefinitionV1_0_13 = {
41
+ type?: string[];
42
+ credentialSubject?: IssuerCredentialSubject;
43
+ };
44
+
45
+ export type CredentialConfigurationSupportedV1_0_13 = {
46
+ credential_definition: CredentialDefinitionV1_0_13;
47
+ /**
48
+ * TODO: These two (vct and id) are solely added because of backward compatibility with sd-jwt. as soons as we have a clear understanding of the new sd-jwt issuer protocol we can remove this
49
+ */
50
+ vct?: string;
51
+ id?: string;
52
+ claims?: IssuerCredentialSubject;
53
+ format: OID4VCICredentialFormat; //REQUIRED. A JSON string identifying the format of this credential, e.g. jwt_vc_json or ldp_vc.
54
+ scope?: string; // OPTIONAL. A JSON string identifying the scope value that this Credential Issuer supports for this particular Credential. The value can be the same across multiple credential_configurations_supported objects. The Authorization Server MUST be able to uniquely identify the Credential Issuer based on the scope value. The Wallet can use this value in the Authorization Request as defined in Section 5.1.2. Scope values in this Credential Issuer metadata MAY duplicate those in the scopes_supported parameter of the Authorization Server.
55
+ cryptographic_binding_methods_supported?: string[];
56
+ credential_signing_alg_values_supported?: string[];
57
+ proof_types_supported?: Record<KeyProofType, ProofType>;
58
+ display?: CredentialsSupportedDisplay[]; // OPTIONAL. An array of objects, where each object contains the display properties of the supported credential for a certain language
59
+ [x: string]: unknown;
60
+ };
61
+
62
+ export type CredentialRequestV1_0_13 =
63
+ | (ExperimentalSubjectIssuance & {
64
+ // We add them here to keep existing other request versions happy. They cannot co-exists with an identifier
65
+ format?: OID4VCICredentialFormat /* | OID4VCICredentialFormat[];*/; // for now it seems only one is supported in the spec
66
+ proof?: ProofOfPossession;
67
+
68
+ credential_identifier?: string;
69
+ credential_response_encryption?: {
70
+ jwk: JWK;
71
+ alg: AlgValue;
72
+ enc: EncValue;
73
+ };
74
+ })
75
+ | (CredentialRequestJwtVcJson | CredentialRequestJwtVcJsonLdAndLdpVc | CredentialRequestSdJwtVc);
76
+
77
+ export interface CredentialOfferV1_0_13 {
78
+ credential_offer?: CredentialOfferPayloadV1_0_13;
79
+ credential_offer_uri?: string;
80
+ }
81
+
82
+ export interface CredentialOfferRESTRequest extends CredentialOfferV1_0_13 {
83
+ baseUri?: string;
84
+ scheme?: string;
85
+ pinLength?: number;
86
+ qrCodeOpts?: QRCodeOpts;
87
+ credentialDataSupplierInput?: CredentialDataSupplierInput;
88
+ }
89
+
90
+ export interface CredentialOfferPayloadV1_0_13 {
91
+ /**
92
+ * REQUIRED. The URL of the Credential Issuer, as defined in Section 11.2.1, from which the Wallet is requested to
93
+ * obtain one or more Credentials. The Wallet uses it to obtain the Credential Issuer's Metadata following the steps
94
+ * defined in Section 11.2.2.
95
+ */
96
+ credential_issuer: string;
97
+
98
+ /**
99
+ * REQUIRED. Array of unique strings that each identify one of the keys in the name/value pairs stored in
100
+ * the credential_configurations_supported Credential Issuer metadata. The Wallet uses these string values
101
+ * to obtain the respective object that contains information about the Credential being offered as defined
102
+ * in Section 11.2.3. For example, these string values can be used to obtain scope values to be used in
103
+ * the Authorization Request.
104
+ */
105
+ credential_configuration_ids: string[];
106
+ /**
107
+ * OPTIONAL. A JSON object indicating to the Wallet the Grant Types the Credential Issuer's AS is prepared
108
+ * to process for this credential offer. Every grant is represented by a key and an object.
109
+ * The key value is the Grant Type identifier, the object MAY contain parameters either determining the way
110
+ * the Wallet MUST use the particular grant and/or parameters the Wallet MUST send with the respective request(s).
111
+ * If grants is not present or empty, the Wallet MUST determine the Grant Types the Credential Issuer's AS supports
112
+ * using the respective metadata. When multiple grants are present, it's at the Wallet's discretion which one to use.
113
+ */
114
+ grants?: Grant;
115
+
116
+ /**
117
+ * Some implementations might include a client_id in the offer. For instance EBSI in a same-device flow. (Cross-device tucks it in the state JWT)
118
+ */
119
+ client_id?: string;
120
+ }
121
+
122
+ export interface CredentialIssuerMetadataOptsV1_0_13 {
123
+ 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.
124
+ 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.
125
+ deferred_credential_endpoint?: string; // OPTIONAL. URL of the Credential Issuer's Deferred Credential Endpoint, as defined in Section 9. 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 Deferred Credential Endpoint.
126
+ notification_endpoint?: string; // OPTIONAL. URL of the Credential Issuer's Notification Endpoint, as defined in Section 10. 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 Notification Endpoint.
127
+ credential_response_encryption?: ResponseEncryption; // OPTIONAL. Object containing information about whether the Credential Issuer supports encryption of the Credential and Batch Credential Response on top of TLS.
128
+ credential_identifiers_supported?: boolean; // OPTIONAL. Boolean value specifying whether the Credential Issuer supports returning credential_identifiers parameter in the authorization_details Token Response parameter, with true indicating support. If omitted, the default value is false.
129
+ credential_configurations_supported: Record<string, CredentialConfigurationSupportedV1_0_13>; // REQUIRED. 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.
130
+ credential_issuer: string; // REQUIRED. The Credential Issuer's identifier.
131
+ authorization_servers?: string[]; // OPTIONAL. Array of strings that identify the OAuth 2.0 Authorization Servers (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].
132
+ signed_metadata?: string; // OPTIONAL. String that is a signed JWT. This JWT contains Credential Issuer metadata parameters as claims.
133
+ display?: MetadataDisplay[]; // An array of objects, where each object contains display properties of a Credential Issuer for a certain language. Below is a non-exhaustive list of valid parameters that MAY be included:
134
+
135
+ //todo: these two are not mentioned in the spec
136
+ token_endpoint?: string;
137
+ credential_supplier_config?: CredentialSupplierConfig;
138
+ }
139
+
140
+ export interface EndpointMetadataResultV1_0_13 extends EndpointMetadata {
141
+ // The EndpointMetadata are snake-case so they can easily be used in payloads/JSON.
142
+ // The values below should not end up in requests/responses directly, so they are using our normal CamelCase convention
143
+ authorizationServerType: AuthorizationServerType;
144
+ authorizationServerMetadata?: AuthorizationServerMetadata;
145
+ credentialIssuerMetadata?: Partial<AuthorizationServerMetadata> & IssuerMetadataV1_0_13;
146
+ }
147
+
148
+ // 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
149
+ export interface CredentialIssuerMetadataV1_0_13 extends CredentialIssuerMetadataOptsV1_0_13, Partial<AuthorizationServerMetadata> {
150
+ authorization_servers?: string[]; // OPTIONAL. Array of strings that identify the OAuth 2.0 Authorization Servers (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].
151
+ 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.
152
+ credential_configurations_supported: Record<string, CredentialConfigurationSupportedV1_0_13>; // REQUIRED. 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.
153
+ credential_issuer: string; // REQUIRED. The Credential Issuer's identifier.
154
+ credential_response_encryption_alg_values_supported?: string; // OPTIONAL. Array containing a list of the JWE [RFC7516] encryption algorithms (alg values) [RFC7518] supported by the Credential and/or Batch Credential Endpoint to encode the Credential or Batch Credential Response in a JWT [RFC7519].
155
+ credential_response_encryption_enc_values_supported?: string; //OPTIONAL. Array containing a list of the JWE [RFC7516] encryption algorithms (enc values) [RFC7518] supported by the Credential and/or Batch Credential Endpoint to encode the Credential or Batch Credential Response in a JWT [RFC7519].
156
+ require_credential_response_encryption?: boolean; //OPTIONAL. Boolean value specifying whether the Credential Issuer requires additional encryption on top of TLS for the Credential Response and expects encryption parameters to be present in the Credential Request and/or Batch Credential Request, with true indicating support. When the value is true, credential_response_encryption_alg_values_supported parameter MUST also be provided. If omitted, the default value is false.
157
+ credential_identifiers_supported?: boolean; // OPTIONAL. Boolean value specifying whether the Credential Issuer supports returning credential_identifiers parameter in the authorization_details Token Response parameter, with true indicating support. If omitted, the default value is false.
158
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphereon/oid4vci-common",
3
- "version": "0.10.3",
3
+ "version": "0.10.4-next.119+a0d8ad3",
4
4
  "description": "OpenID 4 Verifiable Credential Issuance Common Types",
5
5
  "source": "lib/index.ts",
6
6
  "main": "dist/index.js",
@@ -10,7 +10,7 @@
10
10
  "build:clean": "tsc --build --clean && tsc --build"
11
11
  },
12
12
  "dependencies": {
13
- "@sphereon/ssi-types": "^0.23.0",
13
+ "@sphereon/ssi-types": "0.25.1-unstable.87",
14
14
  "cross-fetch": "^3.1.8",
15
15
  "jwt-decode": "^3.1.2",
16
16
  "sha.js": "^2.4.11",
@@ -21,14 +21,6 @@
21
21
  "@types/sha.js": "^2.4.4",
22
22
  "typescript": "5.4.5"
23
23
  },
24
- "peerDependencies": {
25
- "msrcrypto": "^1.5.8"
26
- },
27
- "peerDependenciesMeta": {
28
- "msrcrypto": {
29
- "optional": true
30
- }
31
- },
32
24
  "engines": {
33
25
  "node": ">=18"
34
26
  },
@@ -57,5 +49,5 @@
57
49
  "publishConfig": {
58
50
  "access": "public"
59
51
  },
60
- "gitHead": "4d46a7282a475c4e78d496f82f24114f700ee5e0"
52
+ "gitHead": "a0d8ad364f228b98c1b4e8aa4350652bd676eec5"
61
53
  }