@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
|
@@ -11,7 +11,7 @@ export interface ImageInfo {
|
|
|
11
11
|
alt_text?: string;
|
|
12
12
|
[key: string]: unknown;
|
|
13
13
|
}
|
|
14
|
-
export type OID4VCICredentialFormat = 'jwt_vc_json' | 'jwt_vc_json-ld' | 'ldp_vc';
|
|
14
|
+
export type OID4VCICredentialFormat = 'jwt_vc_json' | 'jwt_vc_json-ld' | 'ldp_vc' | 'vc+sd-jwt' | 'jwt_vc';
|
|
15
15
|
export interface NameAndLocale {
|
|
16
16
|
name?: string;
|
|
17
17
|
locale?: string;
|
|
@@ -47,8 +47,6 @@ export interface CredentialIssuerMetadata extends CredentialIssuerMetadataOpts,
|
|
|
47
47
|
credential_endpoint: string;
|
|
48
48
|
}
|
|
49
49
|
export interface CredentialSupportedBrief {
|
|
50
|
-
name?: string;
|
|
51
|
-
types: string[];
|
|
52
50
|
cryptographic_binding_methods_supported?: string[];
|
|
53
51
|
cryptographic_suites_supported?: string[];
|
|
54
52
|
}
|
|
@@ -56,38 +54,60 @@ export type CommonCredentialSupported = CredentialSupportedBrief & {
|
|
|
56
54
|
format: OID4VCICredentialFormat | string;
|
|
57
55
|
id?: string;
|
|
58
56
|
display?: CredentialsSupportedDisplay[];
|
|
59
|
-
/**
|
|
60
|
-
* following properties are non-mso_mdoc specific and we might wanna rethink them when we're going to support mso_mdoc
|
|
61
|
-
*/
|
|
62
|
-
credentialSubject?: IssuerCredentialSubject;
|
|
63
|
-
order?: string[];
|
|
64
57
|
};
|
|
65
58
|
export interface CredentialSupportedJwtVcJsonLdAndLdpVc extends CommonCredentialSupported {
|
|
59
|
+
types: string[];
|
|
66
60
|
'@context': ICredentialContextType[];
|
|
61
|
+
credentialSubject?: IssuerCredentialSubject;
|
|
62
|
+
order?: string[];
|
|
63
|
+
format: 'ldp_vc' | 'jwt_vc_json-ld';
|
|
67
64
|
}
|
|
68
65
|
export interface CredentialSupportedJwtVcJson extends CommonCredentialSupported {
|
|
69
|
-
|
|
66
|
+
types: string[];
|
|
67
|
+
credentialSubject?: IssuerCredentialSubject;
|
|
68
|
+
order?: string[];
|
|
69
|
+
format: 'jwt_vc_json' | 'jwt_vc';
|
|
70
70
|
}
|
|
71
|
-
export
|
|
72
|
-
|
|
71
|
+
export interface CredentialSupportedSdJwtVc extends CommonCredentialSupported {
|
|
72
|
+
format: 'vc+sd-jwt';
|
|
73
|
+
vct: string;
|
|
74
|
+
claims?: IssuerCredentialSubject;
|
|
75
|
+
order?: string[];
|
|
76
|
+
}
|
|
77
|
+
export type CredentialSupported = CommonCredentialSupported & (CredentialSupportedJwtVcJson | CredentialSupportedJwtVcJsonLdAndLdpVc | CredentialSupportedSdJwtVc);
|
|
78
|
+
export interface CommonCredentialOfferFormat {
|
|
73
79
|
format: OID4VCICredentialFormat | string;
|
|
80
|
+
}
|
|
81
|
+
export interface CredentialOfferFormatJwtVcJsonLdAndLdpVc extends CommonCredentialOfferFormat {
|
|
82
|
+
format: 'ldp_vc' | 'jwt_vc_json-ld';
|
|
83
|
+
credential_definition: JsonLdIssuerCredentialDefinition;
|
|
84
|
+
}
|
|
85
|
+
export interface CredentialOfferFormatJwtVcJson extends CommonCredentialOfferFormat {
|
|
86
|
+
format: 'jwt_vc_json' | 'jwt_vc';
|
|
74
87
|
types: string[];
|
|
75
88
|
}
|
|
89
|
+
export interface CredentialOfferFormatSdJwtVc extends CommonCredentialOfferFormat {
|
|
90
|
+
format: 'vc+sd-jwt';
|
|
91
|
+
vct: string;
|
|
92
|
+
claims?: IssuerCredentialSubject;
|
|
93
|
+
}
|
|
94
|
+
export type CredentialOfferFormat = CommonCredentialOfferFormat & (CredentialOfferFormatJwtVcJsonLdAndLdpVc | CredentialOfferFormatJwtVcJson | CredentialOfferFormatSdJwtVc);
|
|
76
95
|
/**
|
|
77
96
|
* Optional storage that can help the credential Data Supplier. For instance to store credential input data during offer creation, if no additional data can be supplied later on
|
|
78
97
|
*/
|
|
79
98
|
export type CredentialDataSupplierInput = any;
|
|
80
99
|
export type CreateCredentialOfferURIResult = {
|
|
81
100
|
uri: string;
|
|
101
|
+
qrCodeDataUri?: string;
|
|
82
102
|
session: CredentialOfferSession;
|
|
83
103
|
userPin?: string;
|
|
84
104
|
userPinLength?: number;
|
|
85
105
|
userPinRequired: boolean;
|
|
86
106
|
};
|
|
87
|
-
export interface
|
|
107
|
+
export interface JsonLdIssuerCredentialDefinition {
|
|
88
108
|
'@context': ICredentialContextType[];
|
|
89
109
|
types: string[];
|
|
90
|
-
credentialSubject
|
|
110
|
+
credentialSubject?: IssuerCredentialSubject;
|
|
91
111
|
}
|
|
92
112
|
export interface ErrorResponse extends Response {
|
|
93
113
|
error: string;
|
|
@@ -100,14 +120,19 @@ export interface CommonCredentialRequest {
|
|
|
100
120
|
format: OID4VCICredentialFormat;
|
|
101
121
|
proof?: ProofOfPossession;
|
|
102
122
|
}
|
|
103
|
-
export interface
|
|
104
|
-
format: 'jwt_vc_json' | '
|
|
123
|
+
export interface CredentialRequestJwtVcJson extends CommonCredentialRequest {
|
|
124
|
+
format: 'jwt_vc_json' | 'jwt_vc';
|
|
105
125
|
types: string[];
|
|
106
126
|
credentialSubject?: IssuerCredentialSubject;
|
|
107
127
|
}
|
|
108
|
-
export interface
|
|
109
|
-
format: 'ldp_vc';
|
|
110
|
-
credential_definition:
|
|
128
|
+
export interface CredentialRequestJwtVcJsonLdAndLdpVc extends CommonCredentialRequest {
|
|
129
|
+
format: 'ldp_vc' | 'jwt_vc_json-ld';
|
|
130
|
+
credential_definition: JsonLdIssuerCredentialDefinition;
|
|
131
|
+
}
|
|
132
|
+
export interface CredentialRequestSdJwtVc extends CommonCredentialRequest {
|
|
133
|
+
format: 'vc+sd-jwt';
|
|
134
|
+
vct: string;
|
|
135
|
+
claims?: IssuerCredentialSubject;
|
|
111
136
|
}
|
|
112
137
|
export interface CommonCredentialResponse {
|
|
113
138
|
format: string;
|
|
@@ -124,6 +149,10 @@ export interface CredentialResponseJwtVc {
|
|
|
124
149
|
format: 'jwt_vc_json' | 'jwt_vc_json-ld';
|
|
125
150
|
credential: string;
|
|
126
151
|
}
|
|
152
|
+
export interface CredentialResponseSdJwtVc {
|
|
153
|
+
format: 'vc+sd-jwt';
|
|
154
|
+
credential: string;
|
|
155
|
+
}
|
|
127
156
|
export type IssuerCredentialSubjectDisplay = CredentialSubjectDisplay & {
|
|
128
157
|
[key: string]: CredentialSubjectDisplay;
|
|
129
158
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Generic.types.d.ts","sourceRoot":"","sources":["../../lib/types/Generic.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAE7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE3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types/Generic.types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Generic.types.js","sourceRoot":"","sources":["../../lib/types/Generic.types.ts"],"names":[],"mappings":";;;AAqPa,QAAA,qBAAqB,GAAG,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export interface ComponentOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Component options for data/ECC.
|
|
5
|
+
*/
|
|
6
|
+
data?: {
|
|
7
|
+
/**
|
|
8
|
+
* Scale factor for data/ECC dots.
|
|
9
|
+
* @default 1
|
|
10
|
+
*/
|
|
11
|
+
scale?: number;
|
|
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
|
+
* Protector for timing patterns.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
protectors?: boolean;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Component options for alignment patterns.
|
|
30
|
+
*/
|
|
31
|
+
alignment?: {
|
|
32
|
+
/**
|
|
33
|
+
* Scale factor for alignment patterns.
|
|
34
|
+
* @default 1
|
|
35
|
+
*/
|
|
36
|
+
scale?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Protector for alignment patterns.
|
|
39
|
+
* @default false
|
|
40
|
+
*/
|
|
41
|
+
protectors?: boolean;
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Component options for alignment pattern on the bottom-right corner.
|
|
45
|
+
*/
|
|
46
|
+
cornerAlignment?: {
|
|
47
|
+
/**
|
|
48
|
+
* Scale factor for alignment pattern on the bottom-right corner.
|
|
49
|
+
* @default 1
|
|
50
|
+
*/
|
|
51
|
+
scale?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Protector for alignment pattern on the bottom-right corner.
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
protectors?: boolean;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
export interface QRCodeOpts {
|
|
60
|
+
/**
|
|
61
|
+
* Size of the QR code in pixel.
|
|
62
|
+
*
|
|
63
|
+
* @defaultValue 400
|
|
64
|
+
*/
|
|
65
|
+
size?: number;
|
|
66
|
+
/**
|
|
67
|
+
* Size of margins around the QR code body in pixel.
|
|
68
|
+
*
|
|
69
|
+
* @defaultValue 20
|
|
70
|
+
*/
|
|
71
|
+
margin?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Error correction level of the QR code.
|
|
74
|
+
*
|
|
75
|
+
* Accepts a value provided by _QRErrorCorrectLevel_.
|
|
76
|
+
*
|
|
77
|
+
* For more information, please refer to [https://www.qrcode.com/en/about/error_correction.html](https://www.qrcode.com/en/about/error_correction.html).
|
|
78
|
+
*
|
|
79
|
+
* @defaultValue 0
|
|
80
|
+
*/
|
|
81
|
+
correctLevel?: number;
|
|
82
|
+
/**
|
|
83
|
+
* **This is an advanced option.**
|
|
84
|
+
*
|
|
85
|
+
* Specify the mask pattern to be used in QR code encoding.
|
|
86
|
+
*
|
|
87
|
+
* Accepts a value provided by _QRMaskPattern_.
|
|
88
|
+
*
|
|
89
|
+
* 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)
|
|
90
|
+
*
|
|
91
|
+
* 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).
|
|
92
|
+
*/
|
|
93
|
+
maskPattern?: number;
|
|
94
|
+
/**
|
|
95
|
+
* **This is an advanced option.**
|
|
96
|
+
*
|
|
97
|
+
* Specify the version to be used in QR code encoding.
|
|
98
|
+
*
|
|
99
|
+
* Accepts an integer in range [1, 40].
|
|
100
|
+
*
|
|
101
|
+
* For more information, please refer to [https://www.qrcode.com/en/about/version.html](https://www.qrcode.com/en/about/version.html).
|
|
102
|
+
*/
|
|
103
|
+
version?: number;
|
|
104
|
+
/**
|
|
105
|
+
* Options to control components in the QR code.
|
|
106
|
+
*
|
|
107
|
+
* @deafultValue undefined
|
|
108
|
+
*/
|
|
109
|
+
components?: ComponentOptions;
|
|
110
|
+
/**
|
|
111
|
+
* Color of the blocks on the QR code.
|
|
112
|
+
*
|
|
113
|
+
* Accepts a CSS <color>.
|
|
114
|
+
*
|
|
115
|
+
* 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).
|
|
116
|
+
*
|
|
117
|
+
* @defaultValue "#000000"
|
|
118
|
+
*/
|
|
119
|
+
colorDark?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Color of the empty areas on the QR code.
|
|
122
|
+
*
|
|
123
|
+
* Accepts a CSS <color>.
|
|
124
|
+
*
|
|
125
|
+
* 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).
|
|
126
|
+
*
|
|
127
|
+
* @defaultValue "#ffffff"
|
|
128
|
+
*/
|
|
129
|
+
colorLight?: string;
|
|
130
|
+
/**
|
|
131
|
+
* Automatically calculate the _colorLight_ value from the QR code's background.
|
|
132
|
+
*
|
|
133
|
+
* @defaultValue true
|
|
134
|
+
*/
|
|
135
|
+
autoColor?: boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Background image to be used in the QR code.
|
|
138
|
+
*
|
|
139
|
+
* Accepts a `data:` string in web browsers or a Buffer in Node.js.
|
|
140
|
+
*
|
|
141
|
+
* @defaultValue undefined
|
|
142
|
+
*/
|
|
143
|
+
backgroundImage?: string | Buffer;
|
|
144
|
+
/**
|
|
145
|
+
* Color of the dimming mask above the background image.
|
|
146
|
+
*
|
|
147
|
+
* Accepts a CSS <color>.
|
|
148
|
+
*
|
|
149
|
+
* 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).
|
|
150
|
+
*
|
|
151
|
+
* @defaultValue "rgba(0, 0, 0, 0)"
|
|
152
|
+
*/
|
|
153
|
+
backgroundDimming?: string;
|
|
154
|
+
/**
|
|
155
|
+
* GIF background image to be used in the QR code.
|
|
156
|
+
*
|
|
157
|
+
* @defaultValue undefined
|
|
158
|
+
*/
|
|
159
|
+
gifBackground?: ArrayBuffer;
|
|
160
|
+
/**
|
|
161
|
+
* Use a white margin instead of a transparent one which reveals the background of the QR code on margins.
|
|
162
|
+
*
|
|
163
|
+
* @defaultValue true
|
|
164
|
+
*/
|
|
165
|
+
whiteMargin?: boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Logo image to be displayed at the center of the QR code.
|
|
168
|
+
*
|
|
169
|
+
* Accepts a `data:` string in web browsers or a Buffer in Node.js.
|
|
170
|
+
*
|
|
171
|
+
* When set to `undefined` or `null`, the logo is disabled.
|
|
172
|
+
*
|
|
173
|
+
* @defaultValue undefined
|
|
174
|
+
*/
|
|
175
|
+
logoImage?: string | Buffer;
|
|
176
|
+
/**
|
|
177
|
+
* Ratio of the logo size to the QR code size.
|
|
178
|
+
*
|
|
179
|
+
* @defaultValue 0.2
|
|
180
|
+
*/
|
|
181
|
+
logoScale?: number;
|
|
182
|
+
/**
|
|
183
|
+
* Size of margins around the logo image in pixels.
|
|
184
|
+
*
|
|
185
|
+
* @defaultValue 6
|
|
186
|
+
*/
|
|
187
|
+
logoMargin?: number;
|
|
188
|
+
/**
|
|
189
|
+
* Corner radius of the logo image in pixels.
|
|
190
|
+
*
|
|
191
|
+
* @defaultValue 8
|
|
192
|
+
*/
|
|
193
|
+
logoCornerRadius?: number;
|
|
194
|
+
/**
|
|
195
|
+
* @deprecated
|
|
196
|
+
*
|
|
197
|
+
* Ratio of the real size to the full size of the blocks.
|
|
198
|
+
*
|
|
199
|
+
* This can be helpful when you want to make more parts of the background visible.
|
|
200
|
+
*
|
|
201
|
+
* @deafultValue 0.4
|
|
202
|
+
*/
|
|
203
|
+
dotScale?: number;
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=QRCode.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QRCode.types.d.ts","sourceRoot":"","sources":["../../lib/types/QRCode.types.ts"],"names":[],"mappings":";AAAA,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,IAAI,CAAC,EAAE;QACL;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IAEF;;OAEG;IACH,MAAM,CAAC,EAAE;QACP;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QAEf;;;WAGG;QACH,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,CAAC;IAEF;;OAEG;IACH,SAAS,CAAC,EAAE;QACV;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QAEf;;;WAGG;QACH,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,CAAC;IAEF;;OAEG;IACH,eAAe,CAAC,EAAE;QAChB;;;WAGG;QACH,KAAK,CAAC,EAAE,MAAM,CAAC;QAEf;;;WAGG;QACH,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,CAAC;CACH;AAED,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;;;;OAQG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;;;;;;;;OAUG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAE9B;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAElC;;;;;;;;OAQG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;OAIG;IACH,aAAa,CAAC,EAAE,WAAW,CAAC;IAE5B;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE5B;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QRCode.types.js","sourceRoot":"","sources":["../../lib/types/QRCode.types.ts"],"names":[],"mappings":""}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC"}
|
package/dist/types/index.js
CHANGED
|
@@ -25,4 +25,5 @@ __exportStar(require("./OpenID4VCIErrors"), exports);
|
|
|
25
25
|
__exportStar(require("./OpenID4VCIVersions.types"), exports);
|
|
26
26
|
__exportStar(require("./StateManager.types"), exports);
|
|
27
27
|
__exportStar(require("./Token.types"), exports);
|
|
28
|
+
__exportStar(require("./QRCode.types"), exports);
|
|
28
29
|
//# sourceMappingURL=index.js.map
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,6DAA2C;AAC3C,kDAAgC;AAChC,kDAAgC;AAChC,kDAAgC;AAChC,kDAAgC;AAChC,mDAAiC;AACjC,qDAAmC;AACnC,6DAA2C;AAC3C,uDAAqC;AACrC,gDAA8B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,6DAA2C;AAC3C,kDAAgC;AAChC,kDAAgC;AAChC,kDAAgC;AAChC,kDAAgC;AAChC,mDAAiC;AACjC,qDAAmC;AACnC,6DAA2C;AAC3C,uDAAqC;AACrC,gDAA8B;AAC9B,iDAA+B"}
|
|
@@ -4,7 +4,7 @@ import { CredentialsSupportedDisplay, CredentialSupportedBrief, IssuerCredential
|
|
|
4
4
|
export interface CredentialRequestV1_0_08 {
|
|
5
5
|
type: string;
|
|
6
6
|
format: CredentialFormat;
|
|
7
|
-
proof
|
|
7
|
+
proof?: ProofOfPossession;
|
|
8
8
|
}
|
|
9
9
|
export interface IssuerMetadataV1_0_08 {
|
|
10
10
|
issuer?: string;
|
|
@@ -28,10 +28,14 @@ export interface CredentialOfferPayloadV1_0_08 {
|
|
|
28
28
|
export interface CredentialSupportedTypeV1_0_08 {
|
|
29
29
|
[credentialType: string]: CredentialSupportedV1_0_08;
|
|
30
30
|
}
|
|
31
|
+
export interface CredentialSupportedFormatV1_0_08 extends CredentialSupportedBrief {
|
|
32
|
+
name?: string;
|
|
33
|
+
types: string[];
|
|
34
|
+
}
|
|
31
35
|
export interface CredentialSupportedV1_0_08 {
|
|
32
36
|
display?: CredentialsSupportedDisplay[];
|
|
33
37
|
formats: {
|
|
34
|
-
[credentialFormat: string]:
|
|
38
|
+
[credentialFormat: string]: CredentialSupportedFormatV1_0_08;
|
|
35
39
|
};
|
|
36
40
|
claims?: IssuerCredentialSubject;
|
|
37
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v1_0_08.types.d.ts","sourceRoot":"","sources":["../../lib/types/v1_0_08.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,2BAA2B,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEjJ,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,gBAAgB,CAAC;IACzB,KAAK,EAAE,iBAAiB,CAAC;
|
|
1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AK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,EAAE,2BAA2B,EAAE,CAAC;IACxC,OAAO,EAAE;QAEP,CAAC,gBAAgB,EAAE,MAAM,GAAG,gCAAgC,CAAC;KAC9D,CAAC;IACF,MAAM,CAAC,EAAE,uBAAuB,CAAC;CAClC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AuthorizationDetailsJwtVcJson, CommonAuthorizationRequest } from './Authorization.types';
|
|
2
|
-
import { CommonCredentialRequest, CredentialDataSupplierInput, CredentialOfferFormat,
|
|
2
|
+
import { CommonCredentialRequest, CredentialDataSupplierInput, CredentialOfferFormat, CredentialRequestJwtVcJson, CredentialRequestJwtVcJsonLdAndLdpVc, CredentialRequestSdJwtVc, Grant } from './Generic.types';
|
|
3
|
+
import { QRCodeOpts } from './QRCode.types';
|
|
3
4
|
export interface CredentialOfferV1_0_11 {
|
|
4
5
|
credential_offer?: CredentialOfferPayloadV1_0_11;
|
|
5
6
|
credential_offer_uri?: string;
|
|
@@ -8,9 +9,10 @@ export interface CredentialOfferRESTRequest extends CredentialOfferV1_0_11 {
|
|
|
8
9
|
baseUri?: string;
|
|
9
10
|
scheme?: string;
|
|
10
11
|
pinLength?: number;
|
|
12
|
+
qrCodeOpts?: QRCodeOpts;
|
|
11
13
|
credentialDataSupplierInput?: CredentialDataSupplierInput;
|
|
12
14
|
}
|
|
13
|
-
export interface
|
|
15
|
+
export interface CredentialOfferPayloadV1_0_11 {
|
|
14
16
|
/**
|
|
15
17
|
* REQUIRED. The URL of the Credential Issuer, the Wallet is requested to obtain one or more Credentials from.
|
|
16
18
|
*/
|
|
@@ -35,19 +37,7 @@ export interface CommonCredentialOfferPayloadV1_0_11 {
|
|
|
35
37
|
*/
|
|
36
38
|
grants?: Grant;
|
|
37
39
|
}
|
|
38
|
-
export
|
|
39
|
-
/**
|
|
40
|
-
* REQUIRED. JSON object containing (and isolating) the detailed description of the credential type.
|
|
41
|
-
* This object MUST be processed using full JSON-LD processing. It consists of the following sub-claims:
|
|
42
|
-
* - @context: REQUIRED. JSON array as defined in Appendix E.1.3.2
|
|
43
|
-
* - types: REQUIRED. JSON array as defined in Appendix E.1.3.2.
|
|
44
|
-
* This claim contains the type values the Wallet shall request in the subsequent Credential Request
|
|
45
|
-
*/
|
|
46
|
-
credential_definition: IssuerCredentialDefinition;
|
|
47
|
-
}
|
|
48
|
-
export type CredentialOfferJwtVcV1_0_11 = CommonCredentialOfferPayloadV1_0_11;
|
|
49
|
-
export type CredentialOfferPayloadV1_0_11 = CommonCredentialOfferPayloadV1_0_11 & (CredentialOfferLdpVcV1_0_11 | CredentialOfferJwtVcV1_0_11);
|
|
50
|
-
export type CredentialRequestV1_0_11 = CommonCredentialRequest & (CredentialRequestJwtVc | CredentialRequestLdpVc);
|
|
40
|
+
export type CredentialRequestV1_0_11 = CommonCredentialRequest & (CredentialRequestJwtVcJson | CredentialRequestJwtVcJsonLdAndLdpVc | CredentialRequestSdJwtVc);
|
|
51
41
|
export interface AuthorizationRequestV1_0_11 extends AuthorizationDetailsJwtVcJson, AuthorizationDetailsJwtVcJson {
|
|
52
42
|
issuer_state?: string;
|
|
53
43
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v1_0_11.types.d.ts","sourceRoot":"","sources":["../../lib/types/v1_0_11.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"v1_0_11.types.d.ts","sourceRoot":"","sources":["../../lib/types/v1_0_11.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,qBAAqB,EACrB,0BAA0B,EAC1B,oCAAoC,EACpC,wBAAwB,EACxB,KAAK,EACN,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE5C,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,CAAC,EAAE,6BAA6B,CAAC;IACjD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,0BAA2B,SAAQ,sBAAsB;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,2BAA2B,CAAC,EAAE,2BAA2B,CAAC;CAC3D;AAED,MAAM,WAAW,6BAA6B;IAC5C;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;;;;;;;OAQG;IACH,WAAW,EAAE,CAAC,qBAAqB,GAAG,MAAM,CAAC,EAAE,CAAC;IAChD;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB;AAED,MAAM,MAAM,wBAAwB,GAAG,uBAAuB,GAC5D,CAAC,0BAA0B,GAAG,oCAAoC,GAAG,wBAAwB,CAAC,CAAC;AAEjG,MAAM,WAAW,2BAA4B,SAAQ,6BAA6B,EAAE,6BAA6B;IAC/G,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAGD,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAE1F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v1_0_11.types.js","sourceRoot":"","sources":["../../lib/types/v1_0_11.types.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"v1_0_11.types.js","sourceRoot":"","sources":["../../lib/types/v1_0_11.types.ts"],"names":[],"mappings":";;;AA2DA,qDAAqD;AACrD,SAAgB,6BAA6B,CAAC,OAAmC;IAC/E,OAAO,OAAO,IAAI,cAAc,IAAI,OAAO,CAAC;AAC9C,CAAC;AAFD,sEAEC"}
|
|
@@ -340,3 +340,30 @@ function recordVersion(currentVersion: OpenId4VCIVersion, matchingVersion: OpenI
|
|
|
340
340
|
`Invalid param. Some keys have been used from version: ${currentVersion} version while '${key}' is used from version: ${matchingVersion}`,
|
|
341
341
|
);
|
|
342
342
|
}
|
|
343
|
+
|
|
344
|
+
export function getTypesFromOffer(credentialOffer: UniformCredentialOfferPayload, opts?: { filterVerifiableCredential: boolean }) {
|
|
345
|
+
const types = credentialOffer.credentials.reduce<string[]>((prev, curr) => {
|
|
346
|
+
// FIXME returning the string value is wrong (as it's an id), but just matching the current behavior of this library
|
|
347
|
+
// The credential_type (from draft 8) and the actual 'type' value in a VC (from draft 11) are mixed up
|
|
348
|
+
// Fix for this here: https://github.com/Sphereon-Opensource/OID4VCI/pull/54
|
|
349
|
+
if (typeof curr === 'string') {
|
|
350
|
+
return [...prev, curr];
|
|
351
|
+
} else if (curr.format === 'jwt_vc_json-ld' || curr.format === 'ldp_vc') {
|
|
352
|
+
return [...prev, ...curr.credential_definition.types];
|
|
353
|
+
} else if (curr.format === 'jwt_vc_json' || curr.format === 'jwt_vc') {
|
|
354
|
+
return [...prev, ...curr.types];
|
|
355
|
+
} else if (curr.format === 'vc+sd-jwt') {
|
|
356
|
+
return [...prev, curr.vct];
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
return prev;
|
|
360
|
+
}, []);
|
|
361
|
+
|
|
362
|
+
if (!types || types.length === 0) {
|
|
363
|
+
throw Error('Could not deduce types from credential offer');
|
|
364
|
+
}
|
|
365
|
+
if (opts?.filterVerifiableCredential) {
|
|
366
|
+
return types.filter((type) => type !== 'VerifiableCredential');
|
|
367
|
+
}
|
|
368
|
+
return types;
|
|
369
|
+
}
|
|
@@ -1,7 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CredentialRequestV1_0_08, OpenId4VCIVersion, UniformCredentialRequest } from '../types';
|
|
2
|
+
|
|
3
|
+
import { getFormatForVersion } from './FormatUtils';
|
|
4
|
+
|
|
5
|
+
export function getTypesFromRequest(credentialRequest: UniformCredentialRequest, opts?: { filterVerifiableCredential: boolean }) {
|
|
6
|
+
let types: string[] = [];
|
|
7
|
+
if (credentialRequest.format === 'jwt_vc_json' || credentialRequest.format === 'jwt_vc') {
|
|
8
|
+
types = credentialRequest.types;
|
|
9
|
+
} else if (credentialRequest.format === 'jwt_vc_json-ld' || credentialRequest.format === 'ldp_vc') {
|
|
10
|
+
types = credentialRequest.credential_definition.types;
|
|
11
|
+
} else if (credentialRequest.format === 'vc+sd-jwt') {
|
|
12
|
+
types = [credentialRequest.vct];
|
|
13
|
+
}
|
|
2
14
|
|
|
3
|
-
export function getTypesFromRequest(credentialRequest: CredentialRequestV1_0_11, opts?: { filterVerifiableCredential: boolean }) {
|
|
4
|
-
const types = 'types' in credentialRequest ? credentialRequest.types : credentialRequest.credential_definition.types;
|
|
5
15
|
if (!types || types.length === 0) {
|
|
6
16
|
throw Error('Could not deduce types from credential request');
|
|
7
17
|
}
|
|
@@ -10,3 +20,21 @@ export function getTypesFromRequest(credentialRequest: CredentialRequestV1_0_11,
|
|
|
10
20
|
}
|
|
11
21
|
return types;
|
|
12
22
|
}
|
|
23
|
+
|
|
24
|
+
export function getCredentialRequestForVersion(
|
|
25
|
+
credentialRequest: UniformCredentialRequest,
|
|
26
|
+
version: OpenId4VCIVersion,
|
|
27
|
+
): UniformCredentialRequest | CredentialRequestV1_0_08 {
|
|
28
|
+
if (version === OpenId4VCIVersion.VER_1_0_08) {
|
|
29
|
+
const draft8Format = getFormatForVersion(credentialRequest.format, version);
|
|
30
|
+
const types = getTypesFromRequest(credentialRequest, { filterVerifiableCredential: true });
|
|
31
|
+
|
|
32
|
+
return {
|
|
33
|
+
format: draft8Format,
|
|
34
|
+
proof: credentialRequest.proof,
|
|
35
|
+
type: types[0],
|
|
36
|
+
} satisfies CredentialRequestV1_0_08;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return credentialRequest;
|
|
40
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { CredentialFormat } from '@sphereon/ssi-types';
|
|
2
|
+
|
|
3
|
+
import { OID4VCICredentialFormat, OpenId4VCIVersion } from '../types';
|
|
4
|
+
|
|
5
|
+
export function isFormat<T extends { format?: OID4VCICredentialFormat }, Format extends OID4VCICredentialFormat>(
|
|
6
|
+
formatObject: T,
|
|
7
|
+
format: Format,
|
|
8
|
+
): formatObject is T & { format: Format } {
|
|
9
|
+
return formatObject.format === format;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function isNotFormat<T extends { format?: OID4VCICredentialFormat }, Format extends OID4VCICredentialFormat>(
|
|
13
|
+
formatObject: T,
|
|
14
|
+
format: Format,
|
|
15
|
+
): formatObject is T & { format: Exclude<OID4VCICredentialFormat, Format> } {
|
|
16
|
+
return formatObject.format !== format;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const isUniformFormat = (format: string): format is OID4VCICredentialFormat => {
|
|
20
|
+
return ['jwt_vc_json', 'jwt_vc_json-ld', 'ldp_vc', 'vc+sd-jwt'].includes(format);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export function getUniformFormat(format: string | OID4VCICredentialFormat | CredentialFormat): OID4VCICredentialFormat {
|
|
24
|
+
// Already valid format
|
|
25
|
+
if (isUniformFormat(format)) {
|
|
26
|
+
return format;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Older formats
|
|
30
|
+
if (format === 'jwt_vc' || format === 'jwt') {
|
|
31
|
+
return 'jwt_vc';
|
|
32
|
+
}
|
|
33
|
+
if (format === 'ldp_vc' || format === 'ldp') {
|
|
34
|
+
return 'ldp_vc';
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
throw new Error(`Invalid format: ${format}`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function getFormatForVersion(format: string, version: OpenId4VCIVersion) {
|
|
41
|
+
const uniformFormat = isUniformFormat(format) ? format : getUniformFormat(format);
|
|
42
|
+
|
|
43
|
+
if (version === OpenId4VCIVersion.VER_1_0_08) {
|
|
44
|
+
if (uniformFormat === 'jwt_vc_json') {
|
|
45
|
+
return 'jwt_vc' as const;
|
|
46
|
+
} else if (uniformFormat === 'ldp_vc' || uniformFormat === 'jwt_vc_json-ld') {
|
|
47
|
+
return 'ldp_vc' as const;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return uniformFormat;
|
|
52
|
+
}
|
|
@@ -8,7 +8,7 @@ const debug = Debug('sphereon:openid4vci:http');
|
|
|
8
8
|
export const getJson = async <T>(
|
|
9
9
|
URL: string,
|
|
10
10
|
opts?: {
|
|
11
|
-
bearerToken?: string;
|
|
11
|
+
bearerToken?: (() => Promise<string>) | string;
|
|
12
12
|
contentType?: string;
|
|
13
13
|
accept?: string;
|
|
14
14
|
customHeaders?: Record<string, string>;
|
|
@@ -22,7 +22,7 @@ export const formPost = async <T>(
|
|
|
22
22
|
url: string,
|
|
23
23
|
body: BodyInit,
|
|
24
24
|
opts?: {
|
|
25
|
-
bearerToken?: string;
|
|
25
|
+
bearerToken?: (() => Promise<string>) | string;
|
|
26
26
|
contentType?: string;
|
|
27
27
|
accept?: string;
|
|
28
28
|
customHeaders?: Record<string, string>;
|
|
@@ -36,7 +36,7 @@ export const post = async <T>(
|
|
|
36
36
|
url: string,
|
|
37
37
|
body?: BodyInit,
|
|
38
38
|
opts?: {
|
|
39
|
-
bearerToken?: string;
|
|
39
|
+
bearerToken?: (() => Promise<string>) | string;
|
|
40
40
|
contentType?: string;
|
|
41
41
|
accept?: string;
|
|
42
42
|
customHeaders?: Record<string, string>;
|
|
@@ -51,7 +51,7 @@ const openIdFetch = async <T>(
|
|
|
51
51
|
body?: BodyInit,
|
|
52
52
|
opts?: {
|
|
53
53
|
method?: string;
|
|
54
|
-
bearerToken?: string;
|
|
54
|
+
bearerToken?: (() => Promise<string>) | string;
|
|
55
55
|
contentType?: string;
|
|
56
56
|
accept?: string;
|
|
57
57
|
customHeaders?: Record<string, string>;
|
|
@@ -60,7 +60,7 @@ const openIdFetch = async <T>(
|
|
|
60
60
|
): Promise<OpenIDResponse<T>> => {
|
|
61
61
|
const headers: Record<string, string> = opts?.customHeaders ?? {};
|
|
62
62
|
if (opts?.bearerToken) {
|
|
63
|
-
headers['Authorization'] = `Bearer ${opts.bearerToken}`;
|
|
63
|
+
headers['Authorization'] = `Bearer ${typeof opts.bearerToken === 'function' ? await opts.bearerToken() : opts.bearerToken}`;
|
|
64
64
|
}
|
|
65
65
|
const method = opts?.method ? opts.method : body ? 'POST' : 'GET';
|
|
66
66
|
const accept = opts?.accept ? opts.accept : 'application/json';
|