@openid4vc/openid4vp 0.3.0-alpha-20250320210854 → 0.3.0-alpha-20250320222745
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/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +14 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -12299,7 +12299,7 @@ declare const zOpenid4vpAuthorizationResponse: z.ZodObject<{
|
|
|
12299
12299
|
state: z.ZodOptional<z.ZodString>;
|
|
12300
12300
|
id_token: z.ZodOptional<z.ZodString>;
|
|
12301
12301
|
vp_token: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "atleastone">]>]>;
|
|
12302
|
-
presentation_submission: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
12302
|
+
presentation_submission: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodEffects<z.ZodString, any, string>]>>;
|
|
12303
12303
|
refresh_token: z.ZodOptional<z.ZodString>;
|
|
12304
12304
|
token_type: z.ZodOptional<z.ZodString>;
|
|
12305
12305
|
access_token: z.ZodOptional<z.ZodString>;
|
|
@@ -12308,7 +12308,7 @@ declare const zOpenid4vpAuthorizationResponse: z.ZodObject<{
|
|
|
12308
12308
|
state: z.ZodOptional<z.ZodString>;
|
|
12309
12309
|
id_token: z.ZodOptional<z.ZodString>;
|
|
12310
12310
|
vp_token: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "atleastone">]>]>;
|
|
12311
|
-
presentation_submission: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
12311
|
+
presentation_submission: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodEffects<z.ZodString, any, string>]>>;
|
|
12312
12312
|
refresh_token: z.ZodOptional<z.ZodString>;
|
|
12313
12313
|
token_type: z.ZodOptional<z.ZodString>;
|
|
12314
12314
|
access_token: z.ZodOptional<z.ZodString>;
|
|
@@ -12317,7 +12317,7 @@ declare const zOpenid4vpAuthorizationResponse: z.ZodObject<{
|
|
|
12317
12317
|
state: z.ZodOptional<z.ZodString>;
|
|
12318
12318
|
id_token: z.ZodOptional<z.ZodString>;
|
|
12319
12319
|
vp_token: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "atleastone">]>]>;
|
|
12320
|
-
presentation_submission: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
12320
|
+
presentation_submission: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodEffects<z.ZodString, any, string>]>>;
|
|
12321
12321
|
refresh_token: z.ZodOptional<z.ZodString>;
|
|
12322
12322
|
token_type: z.ZodOptional<z.ZodString>;
|
|
12323
12323
|
access_token: z.ZodOptional<z.ZodString>;
|
package/dist/index.d.ts
CHANGED
|
@@ -12299,7 +12299,7 @@ declare const zOpenid4vpAuthorizationResponse: z.ZodObject<{
|
|
|
12299
12299
|
state: z.ZodOptional<z.ZodString>;
|
|
12300
12300
|
id_token: z.ZodOptional<z.ZodString>;
|
|
12301
12301
|
vp_token: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "atleastone">]>]>;
|
|
12302
|
-
presentation_submission: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
12302
|
+
presentation_submission: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodEffects<z.ZodString, any, string>]>>;
|
|
12303
12303
|
refresh_token: z.ZodOptional<z.ZodString>;
|
|
12304
12304
|
token_type: z.ZodOptional<z.ZodString>;
|
|
12305
12305
|
access_token: z.ZodOptional<z.ZodString>;
|
|
@@ -12308,7 +12308,7 @@ declare const zOpenid4vpAuthorizationResponse: z.ZodObject<{
|
|
|
12308
12308
|
state: z.ZodOptional<z.ZodString>;
|
|
12309
12309
|
id_token: z.ZodOptional<z.ZodString>;
|
|
12310
12310
|
vp_token: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "atleastone">]>]>;
|
|
12311
|
-
presentation_submission: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
12311
|
+
presentation_submission: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodEffects<z.ZodString, any, string>]>>;
|
|
12312
12312
|
refresh_token: z.ZodOptional<z.ZodString>;
|
|
12313
12313
|
token_type: z.ZodOptional<z.ZodString>;
|
|
12314
12314
|
access_token: z.ZodOptional<z.ZodString>;
|
|
@@ -12317,7 +12317,7 @@ declare const zOpenid4vpAuthorizationResponse: z.ZodObject<{
|
|
|
12317
12317
|
state: z.ZodOptional<z.ZodString>;
|
|
12318
12318
|
id_token: z.ZodOptional<z.ZodString>;
|
|
12319
12319
|
vp_token: z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>, z.ZodUnion<[z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>, "atleastone">]>]>;
|
|
12320
|
-
presentation_submission: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
12320
|
+
presentation_submission: z.ZodOptional<z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodAny>, z.ZodEffects<z.ZodString, any, string>]>>;
|
|
12321
12321
|
refresh_token: z.ZodOptional<z.ZodString>;
|
|
12322
12322
|
token_type: z.ZodOptional<z.ZodString>;
|
|
12323
12323
|
access_token: z.ZodOptional<z.ZodString>;
|
package/dist/index.js
CHANGED
|
@@ -161,17 +161,6 @@ var zClientMetadata = import_zod3.z.object({
|
|
|
161
161
|
}).passthrough();
|
|
162
162
|
|
|
163
163
|
// src/authorization-request/z-authorization-request.ts
|
|
164
|
-
var zStringToJson = import_zod4.z.string().transform((string, ctx) => {
|
|
165
|
-
try {
|
|
166
|
-
return JSON.parse(string);
|
|
167
|
-
} catch (error) {
|
|
168
|
-
ctx.addIssue({
|
|
169
|
-
code: "custom",
|
|
170
|
-
message: "Expected a JSON string, but could not parse the string to JSON"
|
|
171
|
-
});
|
|
172
|
-
return import_zod4.z.NEVER;
|
|
173
|
-
}
|
|
174
|
-
});
|
|
175
164
|
var zOpenid4vpAuthorizationRequest = import_zod4.z.object({
|
|
176
165
|
response_type: import_zod4.z.literal("vp_token"),
|
|
177
166
|
client_id: import_zod4.z.string(),
|
|
@@ -183,9 +172,9 @@ var zOpenid4vpAuthorizationRequest = import_zod4.z.object({
|
|
|
183
172
|
nonce: import_zod4.z.string(),
|
|
184
173
|
wallet_nonce: import_zod4.z.string().optional(),
|
|
185
174
|
scope: import_zod4.z.string().optional(),
|
|
186
|
-
presentation_definition: import_zod4.z.record(import_zod4.z.any()).or(zStringToJson).optional(),
|
|
175
|
+
presentation_definition: import_zod4.z.record(import_zod4.z.any()).or(import_utils3.zStringToJson).optional(),
|
|
187
176
|
presentation_definition_uri: import_utils3.zHttpsUrl.optional(),
|
|
188
|
-
dcql_query: import_zod4.z.record(import_zod4.z.any()).or(zStringToJson).optional(),
|
|
177
|
+
dcql_query: import_zod4.z.record(import_zod4.z.any()).or(import_utils3.zStringToJson).optional(),
|
|
189
178
|
client_metadata: zClientMetadata.optional(),
|
|
190
179
|
client_metadata_uri: import_utils3.zHttpsUrl.optional(),
|
|
191
180
|
state: import_zod4.z.string().optional(),
|
|
@@ -203,10 +192,10 @@ var zOpenid4vpAuthorizationRequest = import_zod4.z.object({
|
|
|
203
192
|
}).passthrough();
|
|
204
193
|
var zOpenid4vpAuthorizationRequestFromUriParams = import_zod4.z.string().url().transform((url) => Object.fromEntries(new import_utils3.URL(url).searchParams)).pipe(
|
|
205
194
|
import_zod4.z.object({
|
|
206
|
-
presentation_definition: zStringToJson.optional(),
|
|
207
|
-
client_metadata: zStringToJson.optional(),
|
|
208
|
-
dcql_query: zStringToJson.optional(),
|
|
209
|
-
transaction_data: zStringToJson.optional()
|
|
195
|
+
presentation_definition: import_utils3.zStringToJson.optional(),
|
|
196
|
+
client_metadata: import_utils3.zStringToJson.optional(),
|
|
197
|
+
dcql_query: import_utils3.zStringToJson.optional(),
|
|
198
|
+
transaction_data: import_utils3.zStringToJson.optional()
|
|
210
199
|
}).passthrough()
|
|
211
200
|
);
|
|
212
201
|
|
|
@@ -1540,9 +1529,10 @@ function validateOpenid4vpAuthorizationResponsePayload(options) {
|
|
|
1540
1529
|
var import_oauth227 = require("@openid4vc/oauth2");
|
|
1541
1530
|
|
|
1542
1531
|
// src/authorization-response/parse-authorization-response-payload.ts
|
|
1543
|
-
var
|
|
1532
|
+
var import_utils20 = require("@openid4vc/utils");
|
|
1544
1533
|
|
|
1545
1534
|
// src/authorization-response/z-authorization-response.ts
|
|
1535
|
+
var import_utils19 = require("@openid4vc/utils");
|
|
1546
1536
|
var import_zod18 = require("zod");
|
|
1547
1537
|
|
|
1548
1538
|
// src/models/z-pex.ts
|
|
@@ -1555,7 +1545,7 @@ var zOpenid4vpAuthorizationResponse = import_zod18.z.object({
|
|
|
1555
1545
|
state: import_zod18.z.string().optional(),
|
|
1556
1546
|
id_token: import_zod18.z.string().optional(),
|
|
1557
1547
|
vp_token: zVpToken,
|
|
1558
|
-
presentation_submission: zPexPresentationSubmission.optional(),
|
|
1548
|
+
presentation_submission: zPexPresentationSubmission.or(import_utils19.zStringToJson).optional(),
|
|
1559
1549
|
refresh_token: import_zod18.z.string().optional(),
|
|
1560
1550
|
token_type: import_zod18.z.string().optional(),
|
|
1561
1551
|
access_token: import_zod18.z.string().optional(),
|
|
@@ -1564,7 +1554,7 @@ var zOpenid4vpAuthorizationResponse = import_zod18.z.object({
|
|
|
1564
1554
|
|
|
1565
1555
|
// src/authorization-response/parse-authorization-response-payload.ts
|
|
1566
1556
|
function parseOpenid4VpAuthorizationResponsePayload(payload) {
|
|
1567
|
-
return (0,
|
|
1557
|
+
return (0, import_utils20.parseWithErrorHandling)(
|
|
1568
1558
|
zOpenid4vpAuthorizationResponse,
|
|
1569
1559
|
payload,
|
|
1570
1560
|
"Failed to parse openid4vp authorization response."
|
|
@@ -1573,11 +1563,11 @@ function parseOpenid4VpAuthorizationResponsePayload(payload) {
|
|
|
1573
1563
|
|
|
1574
1564
|
// src/authorization-response/parse-jarm-authorization-response.ts
|
|
1575
1565
|
var import_oauth226 = require("@openid4vc/oauth2");
|
|
1576
|
-
var
|
|
1566
|
+
var import_utils21 = require("@openid4vc/utils");
|
|
1577
1567
|
var import_zod19 = __toESM(require("zod"));
|
|
1578
1568
|
async function parseJarmAuthorizationResponse(options) {
|
|
1579
1569
|
const { jarmResponseJwt, callbacks, authorizationRequestPayload, expectedClientId } = options;
|
|
1580
|
-
const jarmAuthorizationResponseJwt = (0,
|
|
1570
|
+
const jarmAuthorizationResponseJwt = (0, import_utils21.parseWithErrorHandling)(
|
|
1581
1571
|
import_zod19.default.union([import_oauth226.zCompactJwt, import_oauth226.zCompactJwe]),
|
|
1582
1572
|
jarmResponseJwt,
|
|
1583
1573
|
"Invalid jarm authorization response jwt."
|
|
@@ -1669,7 +1659,7 @@ var Openid4vpClient = class {
|
|
|
1669
1659
|
|
|
1670
1660
|
// src/transaction-data/verify-transaction-data.ts
|
|
1671
1661
|
var import_oauth228 = require("@openid4vc/oauth2");
|
|
1672
|
-
var
|
|
1662
|
+
var import_utils22 = require("@openid4vc/utils");
|
|
1673
1663
|
async function verifyTransactionData(options) {
|
|
1674
1664
|
const parsedTransactionData = parseTransactionData({
|
|
1675
1665
|
transactionData: options.transactionData
|
|
@@ -1696,7 +1686,7 @@ async function verifyTransactionDataEntry({
|
|
|
1696
1686
|
);
|
|
1697
1687
|
const hashes = {};
|
|
1698
1688
|
for (const alg of supportedAlgs) {
|
|
1699
|
-
hashes[alg] = (0,
|
|
1689
|
+
hashes[alg] = (0, import_utils22.encodeToBase64Url)(await callbacks.hash((0, import_utils22.decodeUtf8String)(entry.encoded), alg));
|
|
1700
1690
|
}
|
|
1701
1691
|
for (const credentialId of entry.transactionData.credential_ids) {
|
|
1702
1692
|
const transactionDataHashesCredential = credentials[credentialId];
|