@sphereon/oid4vci-common 0.4.1-next.285
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/LICENSE +201 -0
- package/dist/functions/CredentialOfferUtil.d.ts +25 -0
- package/dist/functions/CredentialOfferUtil.d.ts.map +1 -0
- package/dist/functions/CredentialOfferUtil.js +303 -0
- package/dist/functions/CredentialOfferUtil.js.map +1 -0
- package/dist/functions/CredentialRequestUtil.d.ts +3 -0
- package/dist/functions/CredentialRequestUtil.d.ts.map +1 -0
- package/dist/functions/CredentialRequestUtil.js +8 -0
- package/dist/functions/CredentialRequestUtil.js.map +1 -0
- package/dist/functions/Encoding.d.ts +20 -0
- package/dist/functions/Encoding.d.ts.map +1 -0
- package/dist/functions/Encoding.js +164 -0
- package/dist/functions/Encoding.js.map +1 -0
- package/dist/functions/HttpUtils.d.ts +33 -0
- package/dist/functions/HttpUtils.d.ts.map +1 -0
- package/dist/functions/HttpUtils.js +146 -0
- package/dist/functions/HttpUtils.js.map +1 -0
- package/dist/functions/IssuerMetadataUtils.d.ts +10 -0
- package/dist/functions/IssuerMetadataUtils.d.ts.map +1 -0
- package/dist/functions/IssuerMetadataUtils.js +89 -0
- package/dist/functions/IssuerMetadataUtils.js.map +1 -0
- package/dist/functions/TypeConversionUtils.d.ts +2 -0
- package/dist/functions/TypeConversionUtils.d.ts.map +1 -0
- package/dist/functions/TypeConversionUtils.js +8 -0
- package/dist/functions/TypeConversionUtils.js.map +1 -0
- package/dist/functions/index.d.ts +4 -0
- package/dist/functions/index.d.ts.map +1 -0
- package/dist/functions/index.js +20 -0
- package/dist/functions/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/types/Authorization.types.d.ts +198 -0
- package/dist/types/Authorization.types.d.ts.map +1 -0
- package/dist/types/Authorization.types.js +40 -0
- package/dist/types/Authorization.types.js.map +1 -0
- package/dist/types/CredentialIssuance.types.d.ts +139 -0
- package/dist/types/CredentialIssuance.types.d.ts.map +1 -0
- package/dist/types/CredentialIssuance.types.js +10 -0
- package/dist/types/CredentialIssuance.types.js.map +1 -0
- package/dist/types/Generic.types.d.ts +156 -0
- package/dist/types/Generic.types.d.ts.map +1 -0
- package/dist/types/Generic.types.js +11 -0
- package/dist/types/Generic.types.js.map +1 -0
- package/dist/types/OAuth2ASMetadata.d.ts +41 -0
- package/dist/types/OAuth2ASMetadata.d.ts.map +1 -0
- package/dist/types/OAuth2ASMetadata.js +3 -0
- package/dist/types/OAuth2ASMetadata.js.map +1 -0
- package/dist/types/OpenID4VCIErrors.d.ts +34 -0
- package/dist/types/OpenID4VCIErrors.d.ts.map +1 -0
- package/dist/types/OpenID4VCIErrors.js +38 -0
- package/dist/types/OpenID4VCIErrors.js.map +1 -0
- package/dist/types/OpenID4VCIServerMetadata.d.ts +4 -0
- package/dist/types/OpenID4VCIServerMetadata.d.ts.map +1 -0
- package/dist/types/OpenID4VCIServerMetadata.js +17 -0
- package/dist/types/OpenID4VCIServerMetadata.js.map +1 -0
- package/dist/types/OpenID4VCIVersions.types.d.ts +11 -0
- package/dist/types/OpenID4VCIVersions.types.d.ts.map +1 -0
- package/dist/types/OpenID4VCIVersions.types.js +16 -0
- package/dist/types/OpenID4VCIVersions.types.js.map +1 -0
- package/dist/types/StateManager.types.d.ts +33 -0
- package/dist/types/StateManager.types.d.ts.map +1 -0
- package/dist/types/StateManager.types.js +3 -0
- package/dist/types/StateManager.types.js.map +1 -0
- package/dist/types/Token.types.d.ts +15 -0
- package/dist/types/Token.types.d.ts.map +1 -0
- package/dist/types/Token.types.js +30 -0
- package/dist/types/Token.types.js.map +1 -0
- package/dist/types/index.d.ts +13 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +29 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/v1_0_08.types.d.ts +38 -0
- package/dist/types/v1_0_08.types.d.ts.map +1 -0
- package/dist/types/v1_0_08.types.js +3 -0
- package/dist/types/v1_0_08.types.js.map +1 -0
- package/dist/types/v1_0_09.types.d.ts +29 -0
- package/dist/types/v1_0_09.types.d.ts.map +1 -0
- package/dist/types/v1_0_09.types.js +9 -0
- package/dist/types/v1_0_09.types.js.map +1 -0
- package/dist/types/v1_0_11.types.d.ts +49 -0
- package/dist/types/v1_0_11.types.d.ts.map +1 -0
- package/dist/types/v1_0_11.types.js +9 -0
- package/dist/types/v1_0_11.types.js.map +1 -0
- package/lib/__tests__/CredentialOfferUtil.spec.ts +55 -0
- package/lib/functions/CredentialOfferUtil.ts +338 -0
- package/lib/functions/CredentialRequestUtil.ts +5 -0
- package/lib/functions/Encoding.ts +166 -0
- package/lib/functions/HttpUtils.ts +168 -0
- package/lib/functions/IssuerMetadataUtils.ts +101 -0
- package/lib/functions/TypeConversionUtils.ts +3 -0
- package/lib/functions/index.ts +3 -0
- package/lib/index.ts +2 -0
- package/lib/types/Authorization.types.ts +234 -0
- package/lib/types/CredentialIssuance.types.ts +167 -0
- package/lib/types/Generic.types.ts +234 -0
- package/lib/types/OAuth2ASMetadata.ts +49 -0
- package/lib/types/OpenID4VCIErrors.ts +35 -0
- package/lib/types/OpenID4VCIServerMetadata.ts +20 -0
- package/lib/types/OpenID4VCIVersions.types.ts +11 -0
- package/lib/types/StateManager.types.ts +45 -0
- package/lib/types/Token.types.ts +29 -0
- package/lib/types/index.ts +12 -0
- package/lib/types/v1_0_08.types.ts +44 -0
- package/lib/types/v1_0_09.types.ts +36 -0
- package/lib/types/v1_0_11.types.ts +68 -0
- package/package.json +49 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { ICredentialContextType, IVerifiableCredential, W3CVerifiableCredential } from '@sphereon/ssi-types';
|
|
2
|
+
|
|
3
|
+
import { ProofOfPossession } from './CredentialIssuance.types';
|
|
4
|
+
import { Oauth2ASWithOID4VCIMetadata } from './OpenID4VCIServerMetadata';
|
|
5
|
+
import { IssuerMetadataV1_0_08 } from './v1_0_08.types';
|
|
6
|
+
import { CredentialRequestV1_0_11 } from './v1_0_11.types';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Important Note: please be aware that these Common interfaces are based on versions v1_0.11 and v1_0.09
|
|
10
|
+
*/
|
|
11
|
+
export interface CredentialLogo {
|
|
12
|
+
url?: string;
|
|
13
|
+
alt_text?: string;
|
|
14
|
+
|
|
15
|
+
[key: string]: unknown;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type OID4VCICredentialFormat = 'jwt_vc_json' | 'jwt_vc_json-ld' | 'ldp_vc' /*| 'mso_mdoc'*/; // we do not support mdocs at this point
|
|
19
|
+
|
|
20
|
+
export interface NameAndLocale {
|
|
21
|
+
name?: string; // REQUIRED. String value of a display name for the Credential.
|
|
22
|
+
locale?: string; // OPTIONAL. String value that identifies the language of this object represented as a language tag taken from values defined in BCP47 [RFC5646]. Multiple display objects MAY be included for separate languages. There MUST be only one object with the same language identifier.
|
|
23
|
+
[key: string]: unknown;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface LogoAndColor {
|
|
27
|
+
logo?: CredentialLogo; // OPTIONAL. A JSON object with information about the logo of the Credential with a following non-exhaustive list of parameters that MAY be included:
|
|
28
|
+
description?: string; // OPTIONAL. String value of a description of the Credential.
|
|
29
|
+
background_color?: string; //OPTIONAL. String value of a background color of the Credential represented as numerical color values defined in CSS Color Module Level 37 [CSS-Color].
|
|
30
|
+
text_color?: string; // OPTIONAL. String value of a text color of the Credential represented as numerical color values defined in CSS Color Module Level 37 [CSS-Color].
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type CredentialsSupportedDisplay = NameAndLocale &
|
|
34
|
+
LogoAndColor & {
|
|
35
|
+
name: string; // REQUIRED. String value of a display name for the Credential.
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type MetadataDisplay = NameAndLocale &
|
|
39
|
+
LogoAndColor & {
|
|
40
|
+
name?: string; //OPTIONAL. String value of a display name for the Credential Issuer.
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export interface CredentialIssuerMetadataOpts {
|
|
44
|
+
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.
|
|
45
|
+
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.
|
|
46
|
+
credentials_supported: CredentialSupported[]; // 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.
|
|
47
|
+
credential_issuer: string; // REQUIRED. The Credential Issuer's identifier.
|
|
48
|
+
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].
|
|
49
|
+
token_endpoint?: string;
|
|
50
|
+
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:
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// 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
|
|
54
|
+
export interface CredentialIssuerMetadata extends CredentialIssuerMetadataOpts {
|
|
55
|
+
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.
|
|
56
|
+
/*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.
|
|
57
|
+
credentials_supported: CredentialSupported[]; // 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.
|
|
58
|
+
credential_issuer: string; // REQUIRED. The Credential Issuer's identifier.
|
|
59
|
+
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].
|
|
60
|
+
token_endpoint?: string;
|
|
61
|
+
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:*/
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface CredentialSupportedBrief {
|
|
65
|
+
name?: string; // fixme: Probably should not be here, is part of the display object
|
|
66
|
+
types: string[]; // REQUIRED. JSON array designating the types a certain credential type supports
|
|
67
|
+
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
|
|
68
|
+
cryptographic_suites_supported?: string[]; // OPTIONAL. Array of case sensitive strings that identify the cryptographic suites that are supported for the cryptographic_binding_methods_supported
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export type CommonCredentialSupported = CredentialSupportedBrief & {
|
|
72
|
+
format: OID4VCICredentialFormat | string; //REQUIRED. A JSON string identifying the format of this credential, e.g. jwt_vc_json or ldp_vc.
|
|
73
|
+
id?: string; // OPTIONAL. A JSON string identifying the respective object. The value MUST be unique across all credentials_supported entries in the Credential Issuer Metadata
|
|
74
|
+
display?: CredentialsSupportedDisplay[]; // OPTIONAL. An array of objects, where each object contains the display properties of the supported credential for a certain language
|
|
75
|
+
/**
|
|
76
|
+
* following properties are non-mso_mdoc specific and we might wanna rethink them when we're going to support mso_mdoc
|
|
77
|
+
*/
|
|
78
|
+
credentialSubject?: IssuerCredentialSubject; // OPTIONAL. A JSON object containing a list of key value pairs, where the key identifies the claim offered in the Credential. The value MAY be a dictionary, which allows to represent the full (potentially deeply nested) structure of the verifiable credential to be issued.
|
|
79
|
+
order?: string[]; //An array of claims.display.name values that lists them in the order they should be displayed by the Wallet.
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export interface CredentialSupportedJwtVcJsonLdAndLdpVc extends CommonCredentialSupported {
|
|
83
|
+
'@context': ICredentialContextType[]; // REQUIRED. JSON array as defined in [VC_DATA], Section 4.1.
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface CredentialSupportedJwtVcJson extends CommonCredentialSupported {
|
|
87
|
+
format: 'jwt_vc_json';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export type CredentialSupported = CommonCredentialSupported & (CredentialSupportedJwtVcJson | CredentialSupportedJwtVcJsonLdAndLdpVc);
|
|
91
|
+
|
|
92
|
+
export interface CredentialOfferFormat {
|
|
93
|
+
format: OID4VCICredentialFormat | string;
|
|
94
|
+
types: string[];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface IssuerCredentialDefinition {
|
|
98
|
+
'@context': ICredentialContextType[];
|
|
99
|
+
types: string[];
|
|
100
|
+
credentialSubject: IssuerCredentialSubject;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/*
|
|
104
|
+
export interface CredentialOfferCredentialDefinition {
|
|
105
|
+
'@context': ICredentialContextType[];
|
|
106
|
+
types: string[];
|
|
107
|
+
credentialSubject?: IssuerCredentialSubject;
|
|
108
|
+
order?: string[]; // An array of claims.display.name values that lists them in the order they should be displayed by the Wallet.
|
|
109
|
+
}
|
|
110
|
+
*/
|
|
111
|
+
|
|
112
|
+
// export type GrantType = GrantTypes;
|
|
113
|
+
|
|
114
|
+
/*
|
|
115
|
+
export interface CommonAccessTokenRequest {
|
|
116
|
+
client_id?: string;
|
|
117
|
+
code?: string;
|
|
118
|
+
code_verifier?: string;
|
|
119
|
+
grant_type: GrantType;
|
|
120
|
+
'pre-authorized_code'?: string;
|
|
121
|
+
redirect_uri?: string;
|
|
122
|
+
scope?: string;
|
|
123
|
+
user_pin?: string;
|
|
124
|
+
}
|
|
125
|
+
*/
|
|
126
|
+
|
|
127
|
+
/*
|
|
128
|
+
export interface CommonAccessTokenResponse {
|
|
129
|
+
access_token: string;
|
|
130
|
+
scope?: string;
|
|
131
|
+
token_type?: string;
|
|
132
|
+
expires_in?: number; // in seconds
|
|
133
|
+
c_nonce?: string;
|
|
134
|
+
c_nonce_expires_in?: number; // in seconds
|
|
135
|
+
authorization_pending?: boolean;
|
|
136
|
+
interval?: number; // in seconds
|
|
137
|
+
}
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
export interface ErrorResponse extends Response {
|
|
141
|
+
error: string;
|
|
142
|
+
error_description?: string;
|
|
143
|
+
error_uri?: string;
|
|
144
|
+
state?: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export type UniformCredentialRequest = CredentialRequestV1_0_11;
|
|
148
|
+
|
|
149
|
+
export interface CommonCredentialRequest {
|
|
150
|
+
format: OID4VCICredentialFormat /* | OID4VCICredentialFormat[];*/; // for now it seems only one is supported in the spec
|
|
151
|
+
proof?: ProofOfPossession;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface CredentialRequestJwtVcJson extends CommonCredentialRequest {
|
|
155
|
+
format: 'jwt_vc_json';
|
|
156
|
+
types: string[];
|
|
157
|
+
credentialSubject?: IssuerCredentialSubject;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface CredentialRequestJwtVcJsonLdAndLdpVc extends CommonCredentialRequest {
|
|
161
|
+
format: 'jwt_vc_json-ld' | 'ldp_vc';
|
|
162
|
+
credential_definition: IssuerCredentialDefinition;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface CommonCredentialResponse {
|
|
166
|
+
format: string;
|
|
167
|
+
credential?: W3CVerifiableCredential;
|
|
168
|
+
acceptance_token?: string;
|
|
169
|
+
c_nonce?: string;
|
|
170
|
+
c_nonce_expires_in?: string;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export interface CredentialResponseJwtVcJsonLdAndLdpVc extends CommonCredentialResponse {
|
|
174
|
+
format: 'jwt_vc_json-ld' | 'ldp_vc';
|
|
175
|
+
credential: IVerifiableCredential;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface CredentialResponseJwtVcJson {
|
|
179
|
+
credential: string;
|
|
180
|
+
}
|
|
181
|
+
// export type CredentialSubjectDisplay = NameAndLocale[];
|
|
182
|
+
|
|
183
|
+
export type IssuerCredentialSubjectDisplay = CredentialSubjectDisplay & { [key: string]: CredentialSubjectDisplay };
|
|
184
|
+
|
|
185
|
+
export interface CredentialSubjectDisplay {
|
|
186
|
+
mandatory?: boolean; // OPTIONAL. Boolean which when set to true indicates the claim MUST be present in the issued Credential. If the mandatory property is omitted its default should be assumed to be false.
|
|
187
|
+
value_type?: string; // OPTIONAL. String value determining type of value of the claim. A non-exhaustive list of valid values defined by this specification are string, number, and image media types such as image/jpeg as defined in IANA media type registry for images
|
|
188
|
+
display?: NameAndLocale[]; // OPTIONAL. An array of objects, where each object contains display properties of a certain claim in the Credential for a certain language. Below is a non-exhaustive list of valid parameters that MAY be included:
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface IssuerCredentialSubject {
|
|
192
|
+
[key: string]: IssuerCredentialSubjectDisplay;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface Grant {
|
|
196
|
+
authorization_code?: GrantAuthorizationCode;
|
|
197
|
+
'urn:ietf:params:oauth:grant-type:pre-authorized_code'?: GrantUrnIetf;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface GrantAuthorizationCode {
|
|
201
|
+
/**
|
|
202
|
+
* OPTIONAL. String value created by the Credential Issuer and opaque to the Wallet that is used to bind the subsequent
|
|
203
|
+
* Authorization Request with the Credential Issuer to a context set up during previous steps.
|
|
204
|
+
*/
|
|
205
|
+
issuer_state?: string;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface GrantUrnIetf {
|
|
209
|
+
/**
|
|
210
|
+
* REQUIRED. The code representing the Credential Issuer's authorization for the Wallet to obtain Credentials of a certain type.
|
|
211
|
+
*/
|
|
212
|
+
'pre-authorized_code': string;
|
|
213
|
+
/**
|
|
214
|
+
* OPTIONAL. Boolean value specifying whether the Credential Issuer expects presentation of a user PIN along with the Token Request
|
|
215
|
+
* in a Pre-Authorized Code Flow. Default is false.
|
|
216
|
+
*/
|
|
217
|
+
user_pin_required: boolean;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
export const PRE_AUTH_CODE_LITERAL = 'pre-authorized_code';
|
|
221
|
+
|
|
222
|
+
export enum WellKnownEndpoints {
|
|
223
|
+
OPENID_CONFIGURATION = '/.well-known/openid-configuration',
|
|
224
|
+
OAUTH_AS = '/.well-known/oauth-authorization-server',
|
|
225
|
+
OPENID4VCI_ISSUER = '/.well-known/openid-credential-issuer',
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export interface EndpointMetadata {
|
|
229
|
+
issuer: string;
|
|
230
|
+
token_endpoint: string;
|
|
231
|
+
credential_endpoint: string;
|
|
232
|
+
authorization_endpoint?: string;
|
|
233
|
+
issuerMetadata?: CredentialIssuerMetadata | Oauth2ASWithOID4VCIMetadata | IssuerMetadataV1_0_08;
|
|
234
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface OAuth2ASMetadata {
|
|
2
|
+
issuer: string;
|
|
3
|
+
authorization_endpoint?: string;
|
|
4
|
+
token_endpoint?: string;
|
|
5
|
+
token_endpoint_auth_methods_supported?: string[];
|
|
6
|
+
token_endpoint_auth_signing_alg_values_supported?: string[];
|
|
7
|
+
|
|
8
|
+
jwks_uri?: string;
|
|
9
|
+
registration_endpoint?: string;
|
|
10
|
+
scopes_supported?: string[];
|
|
11
|
+
response_types_supported: string[];
|
|
12
|
+
response_modes_supported?: string[];
|
|
13
|
+
grant_types_supported?: string[];
|
|
14
|
+
service_documentation?: string;
|
|
15
|
+
ui_locales_supported?: string[];
|
|
16
|
+
op_policy_uri?: string;
|
|
17
|
+
op_tos_uri?: string;
|
|
18
|
+
|
|
19
|
+
revocation_endpoint?: string;
|
|
20
|
+
revocation_endpoint_auth_methods_supported?: string[];
|
|
21
|
+
revocation_endpoint_auth_signing_alg_values_supported?: string[];
|
|
22
|
+
|
|
23
|
+
introspection_endpoint?: string;
|
|
24
|
+
code_challenge_methods_supported?: string[];
|
|
25
|
+
|
|
26
|
+
pushed_authorization_request_endpoint?: string; // The URL of the pushed authorization request endpoint at which a client can post an authorization request to exchange for a request_uri value usable at the authorization server
|
|
27
|
+
// 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
|
+
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
|
+
'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
|
+
|
|
31
|
+
// OIDC values
|
|
32
|
+
frontchannel_logout_supported?: boolean;
|
|
33
|
+
frontchannel_logout_session_supported?: boolean;
|
|
34
|
+
backchannel_logout_supported?: boolean;
|
|
35
|
+
backchannel_logout_session_supported?: boolean;
|
|
36
|
+
userinfo_endpoint?: string;
|
|
37
|
+
check_session_iframe?: string;
|
|
38
|
+
end_session_endpoint?: string;
|
|
39
|
+
acr_values_supported?: string[];
|
|
40
|
+
subject_types_supported?: string[];
|
|
41
|
+
request_object_signing_alg_values_supported?: string[];
|
|
42
|
+
display_values_supported?: string[];
|
|
43
|
+
claim_types_supported?: string[];
|
|
44
|
+
claims_supported?: string[];
|
|
45
|
+
claims_parameter_supported?: boolean;
|
|
46
|
+
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
+
[x: string]: any; //We use any, so you can access properties if you know the structure
|
|
49
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Alg } from './CredentialIssuance.types';
|
|
2
|
+
|
|
3
|
+
export const BAD_PARAMS = 'Wrong parameters provided';
|
|
4
|
+
export const URL_NOT_VALID = 'Request url is not valid';
|
|
5
|
+
export const JWS_NOT_VALID = 'JWS is not valid';
|
|
6
|
+
export const PROOF_CANT_BE_CONSTRUCTED = "Proof can't be constructed.";
|
|
7
|
+
export const NO_JWT_PROVIDED = 'No JWT provided';
|
|
8
|
+
export const TYP_ERROR = 'Typ must be "openid4vci-proof+jwt"';
|
|
9
|
+
export const ALG_ERROR = `Algorithm is a required field and must be one of: ${Object.keys(Alg).join(', ')}`;
|
|
10
|
+
export const KID_JWK_X5C_ERROR = 'Only one must be present: kid, jwk or x5c';
|
|
11
|
+
export const AUD_ERROR = 'aud must be the URL of the credential issuer';
|
|
12
|
+
export const IAT_ERROR = 'iat must be the time at which the proof was issued';
|
|
13
|
+
export const NONCE_ERROR = 'nonce must be c_nonce provided by the credential issuer';
|
|
14
|
+
export const JWT_VERIFY_CONFIG_ERROR = 'JWT verify callback not configured correctly.';
|
|
15
|
+
export const ISSUER_CONFIG_ERROR = 'Issuer not configured correctly.';
|
|
16
|
+
export const UNKNOWN_CLIENT_ERROR = 'The client is not known by the issuer';
|
|
17
|
+
export const NO_ISS_IN_AUTHORIZATION_CODE_CONTEXT = 'iss missing in authorization-code context';
|
|
18
|
+
export const ISS_PRESENT_IN_PRE_AUTHORIZED_CODE_CONTEXT = 'iss should be omitted in pre-authorized-code context';
|
|
19
|
+
export const ISS_MUST_BE_CLIENT_ID = 'iss must be the client id';
|
|
20
|
+
export const GRANTS_MUST_NOT_BE_UNDEFINED = 'Grants must not be undefined';
|
|
21
|
+
export const STATE_MISSING_ERROR = 'issuer state or pre-authorized key not found';
|
|
22
|
+
export const CREDENTIAL_MISSING_ERROR = 'Credential must be present in response';
|
|
23
|
+
export const UNSUPPORTED_GRANT_TYPE_ERROR = 'unsupported grant_type';
|
|
24
|
+
export const PRE_AUTHORIZED_CODE_REQUIRED_ERROR = 'pre-authorized_code is required';
|
|
25
|
+
export const USER_PIN_REQUIRED_ERROR = 'User pin is required';
|
|
26
|
+
export const USER_PIN_NOT_REQUIRED_ERROR = 'User pin is not required';
|
|
27
|
+
export const PIN_VALIDATION_ERROR = 'PIN must consist of maximum 8 numeric characters';
|
|
28
|
+
export const PIN_NOT_MATCH_ERROR = 'PIN is invalid';
|
|
29
|
+
export const INVALID_PRE_AUTHORIZED_CODE = 'pre-authorized_code is invalid';
|
|
30
|
+
export const EXPIRED_PRE_AUTHORIZED_CODE = 'pre-authorized_code is expired';
|
|
31
|
+
export const JWT_SIGNER_CALLBACK_REQUIRED_ERROR = 'JWT signer callback function is required';
|
|
32
|
+
export const STATE_MANAGER_REQUIRED_ERROR = 'StateManager instance is required';
|
|
33
|
+
export const NONCE_STATE_MANAGER_REQUIRED_ERROR = 'NonceStateManager instance is required';
|
|
34
|
+
export const PIN_NOT_MATCHING_ERROR = 'PIN does not match';
|
|
35
|
+
export const ACCESS_TOKEN_ISSUER_REQUIRED_ERROR = 'access token issuer is required';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { CredentialIssuerMetadata } from './Generic.types';
|
|
2
|
+
import { OAuth2ASMetadata } from './OAuth2ASMetadata';
|
|
3
|
+
|
|
4
|
+
export type Oauth2ASWithOID4VCIMetadata = OAuth2ASMetadata & CredentialIssuerMetadata;
|
|
5
|
+
|
|
6
|
+
// export type OpenID4VCICredentialFormatTypes = CredentialFormat | 'mdl_iso' | 'ac_vc' | string;
|
|
7
|
+
|
|
8
|
+
/*export interface CredentialFormatSupport {
|
|
9
|
+
types: string[]; //REQUIRED. Array of strings representing a format specific type of a Credential. This value corresponds to type in W3C [VC_DATA] and a doctype in ISO/IEC 18013-5 (mobile Driving License).
|
|
10
|
+
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 as defined in Section 9.1. A non-exhaustive list of valid values defined by this specification are did, jwk, and mso.
|
|
11
|
+
cryptographic_suites_supported?: string[]; //OPTIONAL. Array of case sensitive strings that identify the cryptographic suites that are supported for the cryptographic_binding_methods_supported. Cryptosuites for Credentials in jwt_vc format should use algorithm names defined in IANA JOSE Algorithms Registry. Cryptosuites for Credentials in ldp_vc format should use signature suites names defined in Linked Data Cryptographic Suite Registry.
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
+
[x: string]: any; //We use any, so you can access properties if you know the structure
|
|
14
|
+
}*/
|
|
15
|
+
/*
|
|
16
|
+
|
|
17
|
+
export type Formats = {
|
|
18
|
+
[format in OpenID4VCICredentialFormatTypes]: CredentialFormatSupport;
|
|
19
|
+
};
|
|
20
|
+
*/
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export enum OpenId4VCIVersion {
|
|
2
|
+
VER_1_0_08 = 1008,
|
|
3
|
+
VER_1_0_09 = 1009,
|
|
4
|
+
VER_1_0_11 = 1011,
|
|
5
|
+
VER_UNKNOWN = Number.MIN_VALUE,
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export enum DefaultURISchemes {
|
|
9
|
+
INITIATE_ISSUANCE = 'openid-initiate-issuance',
|
|
10
|
+
CREDENTIAL_OFFER = 'openid-credential-offer',
|
|
11
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AssertedUniformCredentialOffer } from './CredentialIssuance.types';
|
|
2
|
+
|
|
3
|
+
export interface StateType {
|
|
4
|
+
createdAt: number;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface CredentialOfferSession extends StateType {
|
|
8
|
+
clientId?: string;
|
|
9
|
+
credentialOffer: AssertedUniformCredentialOffer;
|
|
10
|
+
userPin?: string;
|
|
11
|
+
issuerState?: string; //todo: Probably good to hash it here, since it would come in from the client and we could match the hash and thus use the client value
|
|
12
|
+
preAuthorizedCode?: string; //todo: Probably good to hash it here, since it would come in from the client and we could match the hash and thus use the client value
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface CNonceState extends StateType {
|
|
16
|
+
cNonce: string;
|
|
17
|
+
issuerState?: string;
|
|
18
|
+
preAuthorizedCode?: string; //todo: Probably good to hash it here, since it would come in from the client and we could match the hash and thus use the client value
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface URIState extends StateType {
|
|
22
|
+
issuerState?: string; //todo: Probably good to hash it here, since it would come in from the client and we could match the hash and thus use the client value
|
|
23
|
+
preAuthorizedCode?: string; //todo: Probably good to hash it here, since it would come in from the client and we could match the hash and thus use the client value
|
|
24
|
+
uri: string; //todo: Probably good to hash it here, since it would come in from the client and we could match the hash and thus use the client value
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface IStateManager<T extends StateType> {
|
|
28
|
+
set(id: string, stateValue: T): Promise<void>;
|
|
29
|
+
|
|
30
|
+
get(id: string): Promise<T | undefined>;
|
|
31
|
+
|
|
32
|
+
has(id: string): Promise<boolean>;
|
|
33
|
+
|
|
34
|
+
delete(id: string): Promise<boolean>;
|
|
35
|
+
|
|
36
|
+
clearExpired(timestamp?: number): Promise<void>; // clears all expired states compared against timestamp if provided, otherwise current timestamp
|
|
37
|
+
|
|
38
|
+
clearAll(): Promise<void>; // clears all states
|
|
39
|
+
|
|
40
|
+
getAsserted(id: string): Promise<T>;
|
|
41
|
+
|
|
42
|
+
startCleanupRoutine(timeout?: number): Promise<void>;
|
|
43
|
+
|
|
44
|
+
stopCleanupRoutine(): Promise<void>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export enum TokenErrorResponse {
|
|
2
|
+
invalid_request = 'invalid_request',
|
|
3
|
+
invalid_grant = 'invalid_grant',
|
|
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
|
+
invalid_scope = 'invalid_scope',
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export class TokenError extends Error {
|
|
9
|
+
private readonly _statusCode: number;
|
|
10
|
+
private readonly _responseError: TokenErrorResponse;
|
|
11
|
+
constructor(statusCode: number, responseError: TokenErrorResponse, message: string) {
|
|
12
|
+
super(message);
|
|
13
|
+
this._statusCode = statusCode;
|
|
14
|
+
this._responseError = responseError;
|
|
15
|
+
|
|
16
|
+
// 👇️ because we are extending a built-in class
|
|
17
|
+
Object.setPrototypeOf(this, TokenError.prototype);
|
|
18
|
+
}
|
|
19
|
+
get statusCode(): number {
|
|
20
|
+
return this._statusCode;
|
|
21
|
+
}
|
|
22
|
+
get responseError(): TokenErrorResponse {
|
|
23
|
+
return this._responseError;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
getDescription() {
|
|
27
|
+
return this.message;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './Authorization.types';
|
|
2
|
+
export * from './CredentialIssuance.types';
|
|
3
|
+
export * from './Generic.types';
|
|
4
|
+
export * from './v1_0_08.types';
|
|
5
|
+
export * from './v1_0_09.types';
|
|
6
|
+
export * from './v1_0_11.types';
|
|
7
|
+
export * from './OAuth2ASMetadata';
|
|
8
|
+
export * from './OpenID4VCIErrors';
|
|
9
|
+
export * from './OpenID4VCIServerMetadata';
|
|
10
|
+
export * from './OpenID4VCIVersions.types';
|
|
11
|
+
export * from './StateManager.types';
|
|
12
|
+
export * from './Token.types';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CredentialFormat } from '@sphereon/ssi-types';
|
|
2
|
+
|
|
3
|
+
import { ProofOfPossession } from './CredentialIssuance.types';
|
|
4
|
+
import { CredentialsSupportedDisplay, CredentialSupportedBrief, IssuerCredentialSubject, MetadataDisplay, NameAndLocale } from './Generic.types';
|
|
5
|
+
|
|
6
|
+
export interface CredentialRequestV1_0_08 {
|
|
7
|
+
type: string;
|
|
8
|
+
format: CredentialFormat;
|
|
9
|
+
proof: ProofOfPossession;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface IssuerMetadataV1_0_08 {
|
|
13
|
+
issuer?: string;
|
|
14
|
+
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.
|
|
15
|
+
credentials_supported: CredentialSupportedTypeV1_0_08; // 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.
|
|
16
|
+
credential_issuer?: {
|
|
17
|
+
// OPTIONAL. A JSON object containing display properties for the Credential issuer.
|
|
18
|
+
display: NameAndLocale | NameAndLocale[]; // OPTIONAL. 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:
|
|
19
|
+
};
|
|
20
|
+
authorization_server?: string;
|
|
21
|
+
token_endpoint?: string;
|
|
22
|
+
display?: MetadataDisplay[];
|
|
23
|
+
[x: string]: unknown;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface CredentialOfferPayloadV1_0_08 {
|
|
27
|
+
issuer: string; //(url) REQUIRED The issuer URL of the Credential issuer, the Wallet is requested to obtain one or more Credentials from.
|
|
28
|
+
credential_type: string[] | string; //(url) REQUIRED A JSON string denoting the type of the Credential the Wallet shall request
|
|
29
|
+
'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.
|
|
30
|
+
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.
|
|
31
|
+
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
|
|
32
|
+
}
|
|
33
|
+
export interface CredentialSupportedTypeV1_0_08 {
|
|
34
|
+
[credentialType: string]: CredentialSupportedV1_0_08;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface CredentialSupportedV1_0_08 {
|
|
38
|
+
display?: CredentialsSupportedDisplay[];
|
|
39
|
+
formats: {
|
|
40
|
+
// REQUIRED. A JSON object containing a list of key value pairs, where the key is a string identifying the format of the Credential. Below is a non-exhaustive list of valid key values defined by this specification:
|
|
41
|
+
[credentialFormat: string]: CredentialSupportedBrief;
|
|
42
|
+
};
|
|
43
|
+
claims?: IssuerCredentialSubject; // REQUIRED. A JSON object containing a list of key value pairs, where the key identifies the claim offered in the Credential. The value is a JSON object detailing the specifics about the support for the claim with a following non-exhaustive list of parameters that MAY be included:
|
|
44
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { CommonAuthorizationRequest } from './Authorization.types';
|
|
2
|
+
import { CredentialOfferFormat } from './Generic.types';
|
|
3
|
+
|
|
4
|
+
export interface CredentialOfferV1_0_09 {
|
|
5
|
+
credential_offer: CredentialOfferPayloadV1_0_09;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
// https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0-09.html#name-issuance-initiation-request
|
|
9
|
+
export interface CredentialOfferPayloadV1_0_09 {
|
|
10
|
+
/**
|
|
11
|
+
* REQUIRED. The URL of the Credential Issuer, the Wallet is requested to obtain one or more Credentials from.
|
|
12
|
+
*/
|
|
13
|
+
issuer: string;
|
|
14
|
+
/**
|
|
15
|
+
* REQUIRED. A JSON array, where every entry is a JSON object or a JSON string. If the entry is an object,
|
|
16
|
+
* the object contains the data related to a certain credential type the Wallet MAY request.
|
|
17
|
+
* Each object MUST contain a format Claim determining the format of the credential to be requested and
|
|
18
|
+
* further parameters characterising the type of the credential to be requested as defined in Appendix E.
|
|
19
|
+
* If the entry is a string, the string value MUST be one of the id values in one of the objects in the
|
|
20
|
+
* credentials_supported Credential Issuer metadata parameter.
|
|
21
|
+
* When processing, the Wallet MUST resolve this string value to the respective object.
|
|
22
|
+
*/
|
|
23
|
+
credentials: (CredentialOfferFormat | string)[];
|
|
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
|
+
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
|
+
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
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface AuthorizationRequestV1_0_09 extends CommonAuthorizationRequest {
|
|
30
|
+
op_state?: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// todo https://sphereon.atlassian.net/browse/VDX-185
|
|
34
|
+
export function isAuthorizationRequestV1_0_09(request: CommonAuthorizationRequest): boolean {
|
|
35
|
+
return request && 'op_state' in request;
|
|
36
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { AuthorizationDetailsJwtVcJson, CommonAuthorizationRequest } from './Authorization.types';
|
|
2
|
+
import {
|
|
3
|
+
CommonCredentialRequest,
|
|
4
|
+
CredentialOfferFormat,
|
|
5
|
+
CredentialRequestJwtVcJson,
|
|
6
|
+
CredentialRequestJwtVcJsonLdAndLdpVc,
|
|
7
|
+
Grant,
|
|
8
|
+
IssuerCredentialDefinition,
|
|
9
|
+
} from './Generic.types';
|
|
10
|
+
|
|
11
|
+
export interface CredentialOfferV1_0_11 {
|
|
12
|
+
credential_offer?: CredentialOfferPayloadV1_0_11;
|
|
13
|
+
credential_offer_uri?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface CommonCredentialOfferPayloadV1_0_11 {
|
|
17
|
+
/**
|
|
18
|
+
* REQUIRED. The URL of the Credential Issuer, the Wallet is requested to obtain one or more Credentials from.
|
|
19
|
+
*/
|
|
20
|
+
credential_issuer: string;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* REQUIRED. A JSON array, where every entry is a JSON object or a JSON string. If the entry is an object,
|
|
24
|
+
* the object contains the data related to a certain credential type the Wallet MAY request.
|
|
25
|
+
* Each object MUST contain a format Claim determining the format of the credential to be requested and
|
|
26
|
+
* further parameters characterising the type of the credential to be requested as defined in Appendix E.
|
|
27
|
+
* If the entry is a string, the string value MUST be one of the id values in one of the objects in the
|
|
28
|
+
* credentials_supported Credential Issuer metadata parameter.
|
|
29
|
+
* When processing, the Wallet MUST resolve this string value to the respective object.
|
|
30
|
+
*/
|
|
31
|
+
credentials: (CredentialOfferFormat | string)[];
|
|
32
|
+
/**
|
|
33
|
+
* OPTIONAL. A JSON object indicating to the Wallet the Grant Types the Credential Issuer's AS is prepared
|
|
34
|
+
* to process for this credential offer. Every grant is represented by a key and an object.
|
|
35
|
+
* The key value is the Grant Type identifier, the object MAY contain parameters either determining the way
|
|
36
|
+
* the Wallet MUST use the particular grant and/or parameters the Wallet MUST send with the respective request(s).
|
|
37
|
+
* If grants is not present or empty, the Wallet MUST determine the Grant Types the Credential Issuer's AS supports
|
|
38
|
+
* using the respective metadata. When multiple grants are present, it's at the Wallet's discretion which one to use.
|
|
39
|
+
*/
|
|
40
|
+
grants?: Grant;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface CredentialOfferJwtVcJsonLdAndLdpVcV1_0_11 extends CommonCredentialOfferPayloadV1_0_11 {
|
|
44
|
+
/**
|
|
45
|
+
* REQUIRED. JSON object containing (and isolating) the detailed description of the credential type.
|
|
46
|
+
* This object MUST be processed using full JSON-LD processing. It consists of the following sub-claims:
|
|
47
|
+
* - @context: REQUIRED. JSON array as defined in Appendix E.1.3.2
|
|
48
|
+
* - types: REQUIRED. JSON array as defined in Appendix E.1.3.2.
|
|
49
|
+
* This claim contains the type values the Wallet shall request in the subsequent Credential Request
|
|
50
|
+
*/
|
|
51
|
+
credential_definition: IssuerCredentialDefinition;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type CredentialOfferJwtVcJsonV1_0_11 = CommonCredentialOfferPayloadV1_0_11;
|
|
55
|
+
|
|
56
|
+
export type CredentialOfferPayloadV1_0_11 = CommonCredentialOfferPayloadV1_0_11 &
|
|
57
|
+
(CredentialOfferJwtVcJsonLdAndLdpVcV1_0_11 | CredentialOfferJwtVcJsonV1_0_11);
|
|
58
|
+
|
|
59
|
+
export type CredentialRequestV1_0_11 = CommonCredentialRequest & (CredentialRequestJwtVcJson | CredentialRequestJwtVcJsonLdAndLdpVc);
|
|
60
|
+
|
|
61
|
+
export interface AuthorizationRequestV1_0_11 extends AuthorizationDetailsJwtVcJson, AuthorizationDetailsJwtVcJson {
|
|
62
|
+
issuer_state?: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// todo https://sphereon.atlassian.net/browse/VDX-185
|
|
66
|
+
export function isAuthorizationRequestV1_0_11(request: CommonAuthorizationRequest): boolean {
|
|
67
|
+
return request && 'issuer_state' in request;
|
|
68
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sphereon/oid4vci-common",
|
|
3
|
+
"version": "0.4.1-next.285+47fec82",
|
|
4
|
+
"description": "OpenID 4 Verifiable Credential Issuance Common Types",
|
|
5
|
+
"source": "lib/index.ts",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "tsc"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@sphereon/ssi-types": "^0.9.0",
|
|
13
|
+
"cross-fetch": "^3.1.6",
|
|
14
|
+
"jwt-decode": "^3.1.2"
|
|
15
|
+
},
|
|
16
|
+
"devDependencies": {
|
|
17
|
+
"@types/jest": "^29.5.0",
|
|
18
|
+
"typescript": "5.0.4"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=16"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"lib/**/*",
|
|
25
|
+
"dist/**/*"
|
|
26
|
+
],
|
|
27
|
+
"prettier": {
|
|
28
|
+
"singleQuote": true,
|
|
29
|
+
"printWidth": 150
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"Sphereon",
|
|
33
|
+
"Verifiable Credentials",
|
|
34
|
+
"OpenID",
|
|
35
|
+
"OpenID for Verifiable Credential Issuance",
|
|
36
|
+
"OAuth2",
|
|
37
|
+
"SSI",
|
|
38
|
+
"OpenID4VCI",
|
|
39
|
+
"OIDC4VCI",
|
|
40
|
+
"OID4VCI"
|
|
41
|
+
],
|
|
42
|
+
"author": "Sphereon",
|
|
43
|
+
"license": "Apache-2.0",
|
|
44
|
+
"private": false,
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"gitHead": "47fec82924b0d4a32f25737d7ba7379903fdb4f0"
|
|
49
|
+
}
|