@sphereon/oid4vci-common 0.8.1 → 0.8.2-next.26
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/dist/functions/CredentialOfferUtil.d.ts +3 -0
- package/dist/functions/CredentialOfferUtil.d.ts.map +1 -1
- package/dist/functions/CredentialOfferUtil.js +29 -1
- package/dist/functions/CredentialOfferUtil.js.map +1 -1
- package/dist/functions/CredentialRequestUtil.d.ts +3 -2
- package/dist/functions/CredentialRequestUtil.d.ts.map +1 -1
- package/dist/functions/CredentialRequestUtil.js +26 -2
- package/dist/functions/CredentialRequestUtil.js.map +1 -1
- package/dist/functions/FormatUtils.d.ts +15 -0
- package/dist/functions/FormatUtils.d.ts.map +1 -0
- package/dist/functions/FormatUtils.js +44 -0
- package/dist/functions/FormatUtils.js.map +1 -0
- package/dist/functions/HttpUtils.d.ts +3 -3
- package/dist/functions/HttpUtils.d.ts.map +1 -1
- package/dist/functions/HttpUtils.js +1 -1
- package/dist/functions/HttpUtils.js.map +1 -1
- package/dist/functions/IssuerMetadataUtils.d.ts +3 -0
- package/dist/functions/IssuerMetadataUtils.d.ts.map +1 -1
- package/dist/functions/IssuerMetadataUtils.js +27 -7
- package/dist/functions/IssuerMetadataUtils.js.map +1 -1
- package/dist/functions/index.d.ts +2 -0
- package/dist/functions/index.d.ts.map +1 -1
- package/dist/functions/index.js +2 -0
- package/dist/functions/index.js.map +1 -1
- package/dist/types/Authorization.types.d.ts +17 -6
- package/dist/types/Authorization.types.d.ts.map +1 -1
- package/dist/types/Authorization.types.js.map +1 -1
- package/dist/types/Generic.types.d.ts +47 -18
- package/dist/types/Generic.types.d.ts.map +1 -1
- package/dist/types/Generic.types.js.map +1 -1
- package/dist/types/QRCode.types.d.ts +205 -0
- package/dist/types/QRCode.types.d.ts.map +1 -0
- package/dist/types/QRCode.types.js +3 -0
- package/dist/types/QRCode.types.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/v1_0_08.types.d.ts +6 -2
- package/dist/types/v1_0_08.types.d.ts.map +1 -1
- package/dist/types/v1_0_11.types.d.ts +5 -15
- package/dist/types/v1_0_11.types.d.ts.map +1 -1
- package/dist/types/v1_0_11.types.js.map +1 -1
- package/lib/functions/CredentialOfferUtil.ts +27 -0
- package/lib/functions/CredentialRequestUtil.ts +31 -3
- package/lib/functions/FormatUtils.ts +52 -0
- package/lib/functions/HttpUtils.ts +5 -5
- package/lib/functions/IssuerMetadataUtils.ts +26 -4
- package/lib/functions/index.ts +2 -0
- package/lib/types/Authorization.types.ts +30 -6
- package/lib/types/Generic.types.ts +64 -16
- package/lib/types/QRCode.types.ts +227 -0
- package/lib/types/index.ts +1 -0
- package/lib/types/v1_0_08.types.ts +7 -2
- package/lib/types/v1_0_11.types.ts +8 -20
- package/package.json +3 -3
|
@@ -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
|
|
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
|
|
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.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,
|
package/lib/functions/index.ts
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { CredentialOfferPayload, UniformCredentialOffer } from './CredentialIssuance.types';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
ErrorResponse,
|
|
4
|
+
IssuerCredentialSubject,
|
|
5
|
+
JsonLdIssuerCredentialDefinition,
|
|
6
|
+
OID4VCICredentialFormat,
|
|
7
|
+
PRE_AUTH_CODE_LITERAL,
|
|
8
|
+
} from './Generic.types';
|
|
3
9
|
import { EndpointMetadata } from './ServerMetadata';
|
|
4
10
|
|
|
5
11
|
export interface CommonAuthorizationRequest {
|
|
@@ -64,9 +70,9 @@ export interface CommonAuthorizationRequest {
|
|
|
64
70
|
/**
|
|
65
71
|
* string type added for conformity with our previous code in the client
|
|
66
72
|
*/
|
|
67
|
-
export type AuthorizationDetails = AuthorizationDetailsJwtVcJson |
|
|
73
|
+
export type AuthorizationDetails = AuthorizationDetailsJwtVcJson | AuthorizationDetailsJwtVcJsonLdAndLdpVc | AuthorizationDetailsSdJwtVc | string;
|
|
68
74
|
|
|
69
|
-
export type AuthorizationRequest = AuthorizationRequestJwtVcJson |
|
|
75
|
+
export type AuthorizationRequest = AuthorizationRequestJwtVcJson | AuthorizationRequestJwtVcJsonLdAndLdpVc | AuthorizationRequestSdJwtVc;
|
|
70
76
|
|
|
71
77
|
export interface AuthorizationRequestJwtVcJson extends CommonAuthorizationRequest {
|
|
72
78
|
authorization_details?: AuthorizationDetailsJwtVcJson[];
|
|
@@ -76,6 +82,10 @@ export interface AuthorizationRequestJwtVcJsonLdAndLdpVc extends CommonAuthoriza
|
|
|
76
82
|
authorization_details?: AuthorizationDetailsJwtVcJsonLdAndLdpVc[];
|
|
77
83
|
}
|
|
78
84
|
|
|
85
|
+
export interface AuthorizationRequestSdJwtVc extends CommonAuthorizationRequest {
|
|
86
|
+
authorization_details?: AuthorizationDetailsSdJwtVc[];
|
|
87
|
+
}
|
|
88
|
+
|
|
79
89
|
export interface CommonAuthorizationDetails {
|
|
80
90
|
/**
|
|
81
91
|
* REQUIRED. JSON string that determines the authorization details type.
|
|
@@ -94,12 +104,14 @@ export interface CommonAuthorizationDetails {
|
|
|
94
104
|
* the authorization detail's locations common data field MUST be set to the Credential Issuer Identifier value.
|
|
95
105
|
*/
|
|
96
106
|
locations?: string[];
|
|
97
|
-
|
|
107
|
+
|
|
98
108
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
99
109
|
[key: string]: any;
|
|
100
110
|
}
|
|
101
111
|
|
|
102
112
|
export interface AuthorizationDetailsJwtVcJson extends CommonAuthorizationDetails {
|
|
113
|
+
format: 'jwt_vc_json' | 'jwt_vc'; // jwt_vc added for backward compat
|
|
114
|
+
|
|
103
115
|
/**
|
|
104
116
|
* A JSON object containing a list of key value pairs, where the key identifies the claim offered in the Credential.
|
|
105
117
|
* The value MAY be a dictionary, which allows to represent the full (potentially deeply nested) structure of the
|
|
@@ -107,9 +119,13 @@ export interface AuthorizationDetailsJwtVcJson extends CommonAuthorizationDetail
|
|
|
107
119
|
* credential to be issued.
|
|
108
120
|
*/
|
|
109
121
|
credentialSubject?: IssuerCredentialSubject;
|
|
122
|
+
|
|
123
|
+
types: string[]; // This claim contains the type values the Wallet requests authorization for at the issuer.
|
|
110
124
|
}
|
|
111
125
|
|
|
112
126
|
export interface AuthorizationDetailsJwtVcJsonLdAndLdpVc extends CommonAuthorizationDetails {
|
|
127
|
+
format: 'ldp_vc' | 'jwt_vc_json-ld';
|
|
128
|
+
|
|
113
129
|
/**
|
|
114
130
|
* REQUIRED. JSON object containing (and isolating) the detailed description of the credential type.
|
|
115
131
|
* This object MUST be processed using full JSON-LD processing. It consists of the following sub-claims:
|
|
@@ -117,7 +133,14 @@ export interface AuthorizationDetailsJwtVcJsonLdAndLdpVc extends CommonAuthoriza
|
|
|
117
133
|
* - types: REQUIRED. JSON array as defined in Appendix E.1.3.2.
|
|
118
134
|
* This claim contains the type values the Wallet shall request in the subsequent Credential Request
|
|
119
135
|
*/
|
|
120
|
-
credential_definition:
|
|
136
|
+
credential_definition: JsonLdIssuerCredentialDefinition;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export interface AuthorizationDetailsSdJwtVc extends CommonAuthorizationDetails {
|
|
140
|
+
format: 'vc+sd-jwt';
|
|
141
|
+
|
|
142
|
+
vct: string;
|
|
143
|
+
claims?: IssuerCredentialSubject;
|
|
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
|
|
180
|
+
credentialOffer?: UniformCredentialOffer;
|
|
181
|
+
credentialIssuer?: string;
|
|
158
182
|
asOpts?: AuthorizationServerOpts;
|
|
159
183
|
metadata?: EndpointMetadata;
|
|
160
184
|
codeVerifier?: string; // only required for authorization flow
|
|
@@ -15,7 +15,7 @@ export interface ImageInfo {
|
|
|
15
15
|
[key: string]: unknown;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
export type OID4VCICredentialFormat = 'jwt_vc_json' | 'jwt_vc_json-ld' | 'ldp_vc' /*| 'mso_mdoc'*/; // we do not support mdocs at this point
|
|
18
|
+
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
|
|
19
19
|
|
|
20
20
|
export interface NameAndLocale {
|
|
21
21
|
name?: string; // REQUIRED. String value of a display name for the Credential.
|
|
@@ -62,8 +62,6 @@ export interface CredentialIssuerMetadata extends CredentialIssuerMetadataOpts,
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
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
65
|
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
66
|
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
67
|
}
|
|
@@ -75,25 +73,63 @@ export type CommonCredentialSupported = CredentialSupportedBrief & {
|
|
|
75
73
|
/**
|
|
76
74
|
* following properties are non-mso_mdoc specific and we might wanna rethink them when we're going to support mso_mdoc
|
|
77
75
|
*/
|
|
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
76
|
};
|
|
81
77
|
|
|
82
78
|
export interface CredentialSupportedJwtVcJsonLdAndLdpVc extends CommonCredentialSupported {
|
|
79
|
+
types: string[]; // REQUIRED. JSON array designating the types a certain credential type supports
|
|
83
80
|
'@context': ICredentialContextType[]; // REQUIRED. JSON array as defined in [VC_DATA], Section 4.1.
|
|
81
|
+
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.
|
|
82
|
+
order?: string[]; //An array of claims.display.name values that lists them in the order they should be displayed by the Wallet.
|
|
83
|
+
format: 'ldp_vc' | 'jwt_vc_json-ld';
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
export interface CredentialSupportedJwtVcJson extends CommonCredentialSupported {
|
|
87
|
-
|
|
87
|
+
types: string[]; // REQUIRED. JSON array designating the types a certain credential type supports
|
|
88
|
+
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.
|
|
89
|
+
order?: string[]; //An array of claims.display.name values that lists them in the order they should be displayed by the Wallet.
|
|
90
|
+
format: 'jwt_vc_json' | 'jwt_vc'; // jwt_vc added for backwards compat
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface CredentialSupportedSdJwtVc extends CommonCredentialSupported {
|
|
94
|
+
format: 'vc+sd-jwt';
|
|
95
|
+
|
|
96
|
+
vct: string;
|
|
97
|
+
claims?: IssuerCredentialSubject;
|
|
98
|
+
|
|
99
|
+
order?: string[]; //An array of claims.display.name values that lists them in the order they should be displayed by the Wallet.
|
|
88
100
|
}
|
|
89
101
|
|
|
90
|
-
export type CredentialSupported = CommonCredentialSupported &
|
|
102
|
+
export type CredentialSupported = CommonCredentialSupported &
|
|
103
|
+
(CredentialSupportedJwtVcJson | CredentialSupportedJwtVcJsonLdAndLdpVc | CredentialSupportedSdJwtVc);
|
|
91
104
|
|
|
92
|
-
export interface
|
|
105
|
+
export interface CommonCredentialOfferFormat {
|
|
93
106
|
format: OID4VCICredentialFormat | string;
|
|
94
|
-
types: string[];
|
|
95
107
|
}
|
|
96
108
|
|
|
109
|
+
export interface CredentialOfferFormatJwtVcJsonLdAndLdpVc extends CommonCredentialOfferFormat {
|
|
110
|
+
format: 'ldp_vc' | 'jwt_vc_json-ld';
|
|
111
|
+
// REQUIRED. JSON object containing (and isolating) the detailed description of the credential type. This object MUST be processed using full JSON-LD processing.
|
|
112
|
+
credential_definition: JsonLdIssuerCredentialDefinition;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export interface CredentialOfferFormatJwtVcJson extends CommonCredentialOfferFormat {
|
|
116
|
+
format: 'jwt_vc_json' | 'jwt_vc'; // jwt_vc is added for backwards compat
|
|
117
|
+
types: string[]; // REQUIRED. JSON array as defined in Appendix E.1.1.2. This claim contains the type values the Wallet shall request in the subsequent Credential Request.
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// NOTE: the sd-jwt format is added to oid4vci in a later draft version than currently
|
|
121
|
+
// supported, so there's no defined offer format. However, based on the request structure
|
|
122
|
+
// we support sd-jwt for older drafts of oid4vci as well
|
|
123
|
+
export interface CredentialOfferFormatSdJwtVc extends CommonCredentialOfferFormat {
|
|
124
|
+
format: 'vc+sd-jwt';
|
|
125
|
+
|
|
126
|
+
vct: string;
|
|
127
|
+
claims?: IssuerCredentialSubject;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export type CredentialOfferFormat = CommonCredentialOfferFormat &
|
|
131
|
+
(CredentialOfferFormatJwtVcJsonLdAndLdpVc | CredentialOfferFormatJwtVcJson | CredentialOfferFormatSdJwtVc);
|
|
132
|
+
|
|
97
133
|
/**
|
|
98
134
|
* 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
|
|
99
135
|
*/
|
|
@@ -101,16 +137,17 @@ export type CredentialDataSupplierInput = any;
|
|
|
101
137
|
|
|
102
138
|
export type CreateCredentialOfferURIResult = {
|
|
103
139
|
uri: string;
|
|
140
|
+
qrCodeDataUri?: string;
|
|
104
141
|
session: CredentialOfferSession;
|
|
105
142
|
userPin?: string;
|
|
106
143
|
userPinLength?: number;
|
|
107
144
|
userPinRequired: boolean;
|
|
108
145
|
};
|
|
109
146
|
|
|
110
|
-
export interface
|
|
147
|
+
export interface JsonLdIssuerCredentialDefinition {
|
|
111
148
|
'@context': ICredentialContextType[];
|
|
112
149
|
types: string[];
|
|
113
|
-
credentialSubject
|
|
150
|
+
credentialSubject?: IssuerCredentialSubject;
|
|
114
151
|
}
|
|
115
152
|
|
|
116
153
|
export interface ErrorResponse extends Response {
|
|
@@ -127,15 +164,21 @@ export interface CommonCredentialRequest {
|
|
|
127
164
|
proof?: ProofOfPossession;
|
|
128
165
|
}
|
|
129
166
|
|
|
130
|
-
export interface
|
|
131
|
-
format: 'jwt_vc_json' | '
|
|
167
|
+
export interface CredentialRequestJwtVcJson extends CommonCredentialRequest {
|
|
168
|
+
format: 'jwt_vc_json' | 'jwt_vc'; // jwt_vc for backwards compat
|
|
132
169
|
types: string[];
|
|
133
170
|
credentialSubject?: IssuerCredentialSubject;
|
|
134
171
|
}
|
|
135
172
|
|
|
136
|
-
export interface
|
|
137
|
-
format: 'ldp_vc';
|
|
138
|
-
credential_definition:
|
|
173
|
+
export interface CredentialRequestJwtVcJsonLdAndLdpVc extends CommonCredentialRequest {
|
|
174
|
+
format: 'ldp_vc' | 'jwt_vc_json-ld';
|
|
175
|
+
credential_definition: JsonLdIssuerCredentialDefinition;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface CredentialRequestSdJwtVc extends CommonCredentialRequest {
|
|
179
|
+
format: 'vc+sd-jwt';
|
|
180
|
+
vct: string;
|
|
181
|
+
claims?: IssuerCredentialSubject;
|
|
139
182
|
}
|
|
140
183
|
|
|
141
184
|
export interface CommonCredentialResponse {
|
|
@@ -156,6 +199,11 @@ export interface CredentialResponseJwtVc {
|
|
|
156
199
|
credential: string;
|
|
157
200
|
}
|
|
158
201
|
|
|
202
|
+
export interface CredentialResponseSdJwtVc {
|
|
203
|
+
format: 'vc+sd-jwt';
|
|
204
|
+
credential: string;
|
|
205
|
+
}
|
|
206
|
+
|
|
159
207
|
// export type CredentialSubjectDisplay = NameAndLocale[];
|
|
160
208
|
|
|
161
209
|
export type IssuerCredentialSubjectDisplay = CredentialSubjectDisplay & { [key: string]: CredentialSubjectDisplay };
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
export interface ComponentOptions {
|
|
2
|
+
/**
|
|
3
|
+
* Component options for data/ECC.
|
|
4
|
+
*/
|
|
5
|
+
data?: {
|
|
6
|
+
/**
|
|
7
|
+
* Scale factor for data/ECC dots.
|
|
8
|
+
* @default 1
|
|
9
|
+
*/
|
|
10
|
+
scale?: number;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Component options for timing patterns.
|
|
15
|
+
*/
|
|
16
|
+
timing?: {
|
|
17
|
+
/**
|
|
18
|
+
* Scale factor for timing patterns.
|
|
19
|
+
* @default 1
|
|
20
|
+
*/
|
|
21
|
+
scale?: number;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Protector for timing patterns.
|
|
25
|
+
* @default false
|
|
26
|
+
*/
|
|
27
|
+
protectors?: boolean;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Component options for alignment patterns.
|
|
32
|
+
*/
|
|
33
|
+
alignment?: {
|
|
34
|
+
/**
|
|
35
|
+
* Scale factor for alignment patterns.
|
|
36
|
+
* @default 1
|
|
37
|
+
*/
|
|
38
|
+
scale?: number;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Protector for alignment patterns.
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
protectors?: boolean;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Component options for alignment pattern on the bottom-right corner.
|
|
49
|
+
*/
|
|
50
|
+
cornerAlignment?: {
|
|
51
|
+
/**
|
|
52
|
+
* Scale factor for alignment pattern on the bottom-right corner.
|
|
53
|
+
* @default 1
|
|
54
|
+
*/
|
|
55
|
+
scale?: number;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Protector for alignment pattern on the bottom-right corner.
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
protectors?: boolean;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface QRCodeOpts {
|
|
66
|
+
/**
|
|
67
|
+
* Size of the QR code in pixel.
|
|
68
|
+
*
|
|
69
|
+
* @defaultValue 400
|
|
70
|
+
*/
|
|
71
|
+
size?: number;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Size of margins around the QR code body in pixel.
|
|
75
|
+
*
|
|
76
|
+
* @defaultValue 20
|
|
77
|
+
*/
|
|
78
|
+
margin?: number;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Error correction level of the QR code.
|
|
82
|
+
*
|
|
83
|
+
* Accepts a value provided by _QRErrorCorrectLevel_.
|
|
84
|
+
*
|
|
85
|
+
* For more information, please refer to [https://www.qrcode.com/en/about/error_correction.html](https://www.qrcode.com/en/about/error_correction.html).
|
|
86
|
+
*
|
|
87
|
+
* @defaultValue 0
|
|
88
|
+
*/
|
|
89
|
+
correctLevel?: number;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* **This is an advanced option.**
|
|
93
|
+
*
|
|
94
|
+
* Specify the mask pattern to be used in QR code encoding.
|
|
95
|
+
*
|
|
96
|
+
* Accepts a value provided by _QRMaskPattern_.
|
|
97
|
+
*
|
|
98
|
+
* To find out all eight mask patterns, please refer to [https://en.wikipedia.org/wiki/File:QR_Code_Mask_Patterns.svg](https://en.wikipedia.org/wiki/File:QR_Code_Mask_Patterns.svg)
|
|
99
|
+
*
|
|
100
|
+
* For more information, please refer to [https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders#Masking](https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders#Masking).
|
|
101
|
+
*/
|
|
102
|
+
maskPattern?: number;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* **This is an advanced option.**
|
|
106
|
+
*
|
|
107
|
+
* Specify the version to be used in QR code encoding.
|
|
108
|
+
*
|
|
109
|
+
* Accepts an integer in range [1, 40].
|
|
110
|
+
*
|
|
111
|
+
* For more information, please refer to [https://www.qrcode.com/en/about/version.html](https://www.qrcode.com/en/about/version.html).
|
|
112
|
+
*/
|
|
113
|
+
version?: number;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Options to control components in the QR code.
|
|
117
|
+
*
|
|
118
|
+
* @deafultValue undefined
|
|
119
|
+
*/
|
|
120
|
+
components?: ComponentOptions;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Color of the blocks on the QR code.
|
|
124
|
+
*
|
|
125
|
+
* Accepts a CSS <color>.
|
|
126
|
+
*
|
|
127
|
+
* For more information about CSS <color>, please refer to [https://developer.mozilla.org/en-US/docs/Web/CSS/color_value](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
128
|
+
*
|
|
129
|
+
* @defaultValue "#000000"
|
|
130
|
+
*/
|
|
131
|
+
colorDark?: string;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Color of the empty areas on the QR code.
|
|
135
|
+
*
|
|
136
|
+
* Accepts a CSS <color>.
|
|
137
|
+
*
|
|
138
|
+
* For more information about CSS <color>, please refer to [https://developer.mozilla.org/en-US/docs/Web/CSS/color_value](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
139
|
+
*
|
|
140
|
+
* @defaultValue "#ffffff"
|
|
141
|
+
*/
|
|
142
|
+
colorLight?: string;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Automatically calculate the _colorLight_ value from the QR code's background.
|
|
146
|
+
*
|
|
147
|
+
* @defaultValue true
|
|
148
|
+
*/
|
|
149
|
+
autoColor?: boolean;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Background image to be used in the QR code.
|
|
153
|
+
*
|
|
154
|
+
* Accepts a `data:` string in web browsers or a Buffer in Node.js.
|
|
155
|
+
*
|
|
156
|
+
* @defaultValue undefined
|
|
157
|
+
*/
|
|
158
|
+
backgroundImage?: string | Buffer;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Color of the dimming mask above the background image.
|
|
162
|
+
*
|
|
163
|
+
* Accepts a CSS <color>.
|
|
164
|
+
*
|
|
165
|
+
* For more information about CSS <color>, please refer to [https://developer.mozilla.org/en-US/docs/Web/CSS/color_value](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value).
|
|
166
|
+
*
|
|
167
|
+
* @defaultValue "rgba(0, 0, 0, 0)"
|
|
168
|
+
*/
|
|
169
|
+
backgroundDimming?: string;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* GIF background image to be used in the QR code.
|
|
173
|
+
*
|
|
174
|
+
* @defaultValue undefined
|
|
175
|
+
*/
|
|
176
|
+
gifBackground?: ArrayBuffer;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Use a white margin instead of a transparent one which reveals the background of the QR code on margins.
|
|
180
|
+
*
|
|
181
|
+
* @defaultValue true
|
|
182
|
+
*/
|
|
183
|
+
whiteMargin?: boolean;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Logo image to be displayed at the center of the QR code.
|
|
187
|
+
*
|
|
188
|
+
* Accepts a `data:` string in web browsers or a Buffer in Node.js.
|
|
189
|
+
*
|
|
190
|
+
* When set to `undefined` or `null`, the logo is disabled.
|
|
191
|
+
*
|
|
192
|
+
* @defaultValue undefined
|
|
193
|
+
*/
|
|
194
|
+
logoImage?: string | Buffer;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Ratio of the logo size to the QR code size.
|
|
198
|
+
*
|
|
199
|
+
* @defaultValue 0.2
|
|
200
|
+
*/
|
|
201
|
+
logoScale?: number;
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Size of margins around the logo image in pixels.
|
|
205
|
+
*
|
|
206
|
+
* @defaultValue 6
|
|
207
|
+
*/
|
|
208
|
+
logoMargin?: number;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Corner radius of the logo image in pixels.
|
|
212
|
+
*
|
|
213
|
+
* @defaultValue 8
|
|
214
|
+
*/
|
|
215
|
+
logoCornerRadius?: number;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* @deprecated
|
|
219
|
+
*
|
|
220
|
+
* Ratio of the real size to the full size of the blocks.
|
|
221
|
+
*
|
|
222
|
+
* This can be helpful when you want to make more parts of the background visible.
|
|
223
|
+
*
|
|
224
|
+
* @deafultValue 0.4
|
|
225
|
+
*/
|
|
226
|
+
dotScale?: number;
|
|
227
|
+
}
|
package/lib/types/index.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { CredentialsSupportedDisplay, CredentialSupportedBrief, IssuerCredential
|
|
|
6
6
|
export interface CredentialRequestV1_0_08 {
|
|
7
7
|
type: string;
|
|
8
8
|
format: CredentialFormat;
|
|
9
|
-
proof
|
|
9
|
+
proof?: ProofOfPossession;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
export interface IssuerMetadataV1_0_08 {
|
|
@@ -34,11 +34,16 @@ export interface CredentialSupportedTypeV1_0_08 {
|
|
|
34
34
|
[credentialType: string]: CredentialSupportedV1_0_08;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
export interface CredentialSupportedFormatV1_0_08 extends CredentialSupportedBrief {
|
|
38
|
+
name?: string;
|
|
39
|
+
types: string[];
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
export interface CredentialSupportedV1_0_08 {
|
|
38
43
|
display?: CredentialsSupportedDisplay[];
|
|
39
44
|
formats: {
|
|
40
45
|
// 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]:
|
|
46
|
+
[credentialFormat: string]: CredentialSupportedFormatV1_0_08;
|
|
42
47
|
};
|
|
43
48
|
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
49
|
}
|
|
@@ -3,11 +3,12 @@ import {
|
|
|
3
3
|
CommonCredentialRequest,
|
|
4
4
|
CredentialDataSupplierInput,
|
|
5
5
|
CredentialOfferFormat,
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
CredentialRequestJwtVcJson,
|
|
7
|
+
CredentialRequestJwtVcJsonLdAndLdpVc,
|
|
8
|
+
CredentialRequestSdJwtVc,
|
|
8
9
|
Grant,
|
|
9
|
-
IssuerCredentialDefinition,
|
|
10
10
|
} from './Generic.types';
|
|
11
|
+
import { QRCodeOpts } from './QRCode.types';
|
|
11
12
|
|
|
12
13
|
export interface CredentialOfferV1_0_11 {
|
|
13
14
|
credential_offer?: CredentialOfferPayloadV1_0_11;
|
|
@@ -18,10 +19,11 @@ export interface CredentialOfferRESTRequest extends CredentialOfferV1_0_11 {
|
|
|
18
19
|
baseUri?: string;
|
|
19
20
|
scheme?: string;
|
|
20
21
|
pinLength?: number;
|
|
22
|
+
qrCodeOpts?: QRCodeOpts;
|
|
21
23
|
credentialDataSupplierInput?: CredentialDataSupplierInput;
|
|
22
24
|
}
|
|
23
25
|
|
|
24
|
-
export interface
|
|
26
|
+
export interface CredentialOfferPayloadV1_0_11 {
|
|
25
27
|
/**
|
|
26
28
|
* REQUIRED. The URL of the Credential Issuer, the Wallet is requested to obtain one or more Credentials from.
|
|
27
29
|
*/
|
|
@@ -48,22 +50,8 @@ export interface CommonCredentialOfferPayloadV1_0_11 {
|
|
|
48
50
|
grants?: Grant;
|
|
49
51
|
}
|
|
50
52
|
|
|
51
|
-
export
|
|
52
|
-
|
|
53
|
-
* REQUIRED. JSON object containing (and isolating) the detailed description of the credential type.
|
|
54
|
-
* This object MUST be processed using full JSON-LD processing. It consists of the following sub-claims:
|
|
55
|
-
* - @context: REQUIRED. JSON array as defined in Appendix E.1.3.2
|
|
56
|
-
* - types: REQUIRED. JSON array as defined in Appendix E.1.3.2.
|
|
57
|
-
* This claim contains the type values the Wallet shall request in the subsequent Credential Request
|
|
58
|
-
*/
|
|
59
|
-
credential_definition: IssuerCredentialDefinition;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export type CredentialOfferJwtVcV1_0_11 = CommonCredentialOfferPayloadV1_0_11;
|
|
63
|
-
|
|
64
|
-
export type CredentialOfferPayloadV1_0_11 = CommonCredentialOfferPayloadV1_0_11 & (CredentialOfferLdpVcV1_0_11 | CredentialOfferJwtVcV1_0_11);
|
|
65
|
-
|
|
66
|
-
export type CredentialRequestV1_0_11 = CommonCredentialRequest & (CredentialRequestJwtVc | CredentialRequestLdpVc);
|
|
53
|
+
export type CredentialRequestV1_0_11 = CommonCredentialRequest &
|
|
54
|
+
(CredentialRequestJwtVcJson | CredentialRequestJwtVcJsonLdAndLdpVc | CredentialRequestSdJwtVc);
|
|
67
55
|
|
|
68
56
|
export interface AuthorizationRequestV1_0_11 extends AuthorizationDetailsJwtVcJson, AuthorizationDetailsJwtVcJson {
|
|
69
57
|
issuer_state?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sphereon/oid4vci-common",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.2-next.26+7577e3d",
|
|
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.17.
|
|
13
|
+
"@sphereon/ssi-types": "0.17.6-unstable.69",
|
|
14
14
|
"cross-fetch": "^3.1.8",
|
|
15
15
|
"jwt-decode": "^3.1.2"
|
|
16
16
|
},
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"publishConfig": {
|
|
47
47
|
"access": "public"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "7577e3d8a4818fe0955fce944220d6fb415a58a7"
|
|
50
50
|
}
|