@openid4vc/openid4vp 0.3.0-alpha-20251017121147 → 0.3.0-alpha-20251017122507
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 +1908 -30646
- package/dist/index.d.ts +1909 -30647
- package/dist/index.js +37 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +37 -37
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -191,27 +191,27 @@ const zJarmClientMetadataParsed = zJarmClientMetadata.transform((client_metadata
|
|
|
191
191
|
//#region src/models/z-vp-formats-supported.ts
|
|
192
192
|
const zVpFormatsSupported = z.object({
|
|
193
193
|
"dc+sd-jwt": z.optional(z.object({
|
|
194
|
-
"sd-jwt_alg_values": z.optional(z.
|
|
195
|
-
"kb-jwt_alg_values": z.optional(z.
|
|
196
|
-
}).
|
|
197
|
-
jwt_vc_json: z.optional(z.object({ alg_values: z.optional(z.
|
|
194
|
+
"sd-jwt_alg_values": z.optional(z.tuple([z.string()], z.string())),
|
|
195
|
+
"kb-jwt_alg_values": z.optional(z.tuple([z.string()], z.string()))
|
|
196
|
+
}).loose()),
|
|
197
|
+
jwt_vc_json: z.optional(z.object({ alg_values: z.optional(z.tuple([z.string()], z.string())) }).loose()),
|
|
198
198
|
ldp_vc: z.optional(z.object({
|
|
199
|
-
proof_type_values: z.optional(z.
|
|
200
|
-
cryptosuite_values: z.optional(z.
|
|
201
|
-
}).
|
|
199
|
+
proof_type_values: z.optional(z.tuple([z.string()], z.string())),
|
|
200
|
+
cryptosuite_values: z.optional(z.tuple([z.string()], z.string()))
|
|
201
|
+
}).loose()),
|
|
202
202
|
mso_mdoc: z.optional(z.object({
|
|
203
|
-
issuer_signed_alg_values: z.optional(z.
|
|
204
|
-
device_signed_alg_values: z.optional(z.
|
|
205
|
-
issuerauth_alg_values: z.optional(z.
|
|
206
|
-
deviceauth_alg_values: z.optional(z.
|
|
207
|
-
}).
|
|
208
|
-
}).
|
|
209
|
-
const zLegacyVpFormats = z.record(z.string(), z.object({ alg_values_supported: z.optional(z.array(z.string())) }).
|
|
203
|
+
issuer_signed_alg_values: z.optional(z.tuple([z.number()], z.number())),
|
|
204
|
+
device_signed_alg_values: z.optional(z.tuple([z.number()], z.number())),
|
|
205
|
+
issuerauth_alg_values: z.optional(z.tuple([z.number()], z.number())),
|
|
206
|
+
deviceauth_alg_values: z.optional(z.tuple([z.number()], z.number()))
|
|
207
|
+
}).loose())
|
|
208
|
+
}).loose().catchall(z.object({}).loose());
|
|
209
|
+
const zLegacyVpFormats = z.record(z.string(), z.object({ alg_values_supported: z.optional(z.array(z.string())) }).loose());
|
|
210
210
|
|
|
211
211
|
//#endregion
|
|
212
212
|
//#region src/models/z-client-metadata.ts
|
|
213
213
|
const zClientMetadata = z.object({
|
|
214
|
-
jwks_uri: z.
|
|
214
|
+
jwks_uri: z.url().optional(),
|
|
215
215
|
jwks: z.optional(zJwkSet),
|
|
216
216
|
vp_formats: z.optional(zLegacyVpFormats),
|
|
217
217
|
vp_formats_supported: z.optional(zVpFormatsSupported),
|
|
@@ -219,13 +219,13 @@ const zClientMetadata = z.object({
|
|
|
219
219
|
...zJarmClientMetadata.shape,
|
|
220
220
|
logo_uri: zHttpsUrl.optional(),
|
|
221
221
|
client_name: z.string().optional()
|
|
222
|
-
}).
|
|
222
|
+
}).loose();
|
|
223
223
|
|
|
224
224
|
//#endregion
|
|
225
225
|
//#region src/models/z-verifier-attestations.ts
|
|
226
226
|
const zVerifierAttestation = z$1.object({
|
|
227
227
|
format: z$1.string(),
|
|
228
|
-
data: z$1.record(z$1.unknown()).or(z$1.string()),
|
|
228
|
+
data: z$1.record(z$1.string(), z$1.unknown()).or(z$1.string()),
|
|
229
229
|
credential_ids: z$1.array(z$1.string()).optional()
|
|
230
230
|
});
|
|
231
231
|
const zVerifierAttestations = z$1.array(zVerifierAttestation);
|
|
@@ -243,14 +243,14 @@ const zOpenid4vpAuthorizationRequest = z.object({
|
|
|
243
243
|
nonce: z.string(),
|
|
244
244
|
wallet_nonce: z.string().optional(),
|
|
245
245
|
scope: z.string().optional(),
|
|
246
|
-
presentation_definition: z.record(z.any()).or(zStringToJson).optional(),
|
|
246
|
+
presentation_definition: z.record(z.string(), z.any()).or(zStringToJson).optional(),
|
|
247
247
|
presentation_definition_uri: zHttpsUrl.optional(),
|
|
248
|
-
dcql_query: z.record(z.any()).or(zStringToJson).optional(),
|
|
248
|
+
dcql_query: z.record(z.string(), z.any()).or(zStringToJson).optional(),
|
|
249
249
|
client_metadata: zClientMetadata.optional(),
|
|
250
250
|
client_metadata_uri: zHttpsUrl.optional(),
|
|
251
251
|
state: z.string().optional(),
|
|
252
|
-
transaction_data: z.array(z.
|
|
253
|
-
trust_chain: z.
|
|
252
|
+
transaction_data: z.array(z.base64url()).optional(),
|
|
253
|
+
trust_chain: z.tuple([z.string()], z.string()).optional(),
|
|
254
254
|
client_id_scheme: z.enum([
|
|
255
255
|
"pre-registered",
|
|
256
256
|
"redirect_uri",
|
|
@@ -263,15 +263,15 @@ const zOpenid4vpAuthorizationRequest = z.object({
|
|
|
263
263
|
]).optional(),
|
|
264
264
|
verifier_attestations: zVerifierAttestations.optional(),
|
|
265
265
|
verifier_info: zVerifierAttestations.optional()
|
|
266
|
-
}).
|
|
267
|
-
const zOpenid4vpAuthorizationRequestFromUriParams = z.
|
|
266
|
+
}).loose();
|
|
267
|
+
const zOpenid4vpAuthorizationRequestFromUriParams = z.url().transform((url) => Object.fromEntries(new URL(url).searchParams)).pipe(z.object({
|
|
268
268
|
presentation_definition: zStringToJson.optional(),
|
|
269
269
|
client_metadata: zStringToJson.optional(),
|
|
270
270
|
dcql_query: zStringToJson.optional(),
|
|
271
271
|
transaction_data: zStringToJson.optional(),
|
|
272
272
|
verifier_attestations: zStringToJson.optional(),
|
|
273
273
|
verifier_info: zStringToJson.optional()
|
|
274
|
-
}).
|
|
274
|
+
}).loose());
|
|
275
275
|
|
|
276
276
|
//#endregion
|
|
277
277
|
//#region src/authorization-request/z-authorization-request-dc-api.ts
|
|
@@ -388,7 +388,7 @@ const zJarAuthorizationRequest = z.object({
|
|
|
388
388
|
request_uri: z.optional(zHttpsUrl),
|
|
389
389
|
request_uri_method: z.optional(z.string()),
|
|
390
390
|
client_id: z.optional(z.string())
|
|
391
|
-
}).
|
|
391
|
+
}).loose();
|
|
392
392
|
function validateJarRequestParams(options) {
|
|
393
393
|
const { jarRequestParams } = options;
|
|
394
394
|
if (jarRequestParams.request && jarRequestParams.request_uri) throw new Oauth2ServerErrorResponseError({
|
|
@@ -857,7 +857,7 @@ async function fetchJarRequestObject(options) {
|
|
|
857
857
|
const zJarRequestObjectPayload = z.object({
|
|
858
858
|
...zJwtPayload.shape,
|
|
859
859
|
client_id: z.string()
|
|
860
|
-
}).
|
|
860
|
+
}).loose();
|
|
861
861
|
|
|
862
862
|
//#endregion
|
|
863
863
|
//#region src/jar/handle-jar-request/verify-jar-request.ts
|
|
@@ -1005,9 +1005,9 @@ async function verifyJarRequestObject(options) {
|
|
|
1005
1005
|
//#region src/transaction-data/z-transaction-data.ts
|
|
1006
1006
|
const zTransactionEntry = z.object({
|
|
1007
1007
|
type: z.string(),
|
|
1008
|
-
credential_ids: z.
|
|
1009
|
-
transaction_data_hashes_alg: z.
|
|
1010
|
-
}).
|
|
1008
|
+
credential_ids: z.tuple([z.string()], z.string()),
|
|
1009
|
+
transaction_data_hashes_alg: z.tuple([z.string()], z.string()).optional()
|
|
1010
|
+
}).loose();
|
|
1011
1011
|
const zTransactionData = z.array(zTransactionEntry);
|
|
1012
1012
|
|
|
1013
1013
|
//#endregion
|
|
@@ -1290,14 +1290,14 @@ async function createOpenid4vpAuthorizationResponse(options) {
|
|
|
1290
1290
|
|
|
1291
1291
|
//#endregion
|
|
1292
1292
|
//#region src/models/z-pex.ts
|
|
1293
|
-
const zPexPresentationDefinition = z.record(z.any());
|
|
1294
|
-
const zPexPresentationSubmission = z.record(z.any());
|
|
1293
|
+
const zPexPresentationDefinition = z.record(z.string(), z.any());
|
|
1294
|
+
const zPexPresentationSubmission = z.record(z.string(), z.any());
|
|
1295
1295
|
|
|
1296
1296
|
//#endregion
|
|
1297
1297
|
//#region src/vp-token/z-vp-token.ts
|
|
1298
|
-
const zVpTokenPresentationEntry = z.union([z.string(), z.record(z.any())], { message: "vp_token presentation entry must be string or object" });
|
|
1299
|
-
const zVpTokenPex = z.union([zVpTokenPresentationEntry, z.
|
|
1300
|
-
const zVpTokenDcql = z.record(z.union([z.
|
|
1298
|
+
const zVpTokenPresentationEntry = z.union([z.string(), z.record(z.string(), z.any())], { message: "vp_token presentation entry must be string or object" });
|
|
1299
|
+
const zVpTokenPex = z.union([zVpTokenPresentationEntry, z.tuple([zVpTokenPresentationEntry], zVpTokenPresentationEntry, "Must have at least entry in vp_token array")], { message: "pex vp_token must be a string, object or non-empty array of strings and objects" });
|
|
1300
|
+
const zVpTokenDcql = z.record(z.string(), z.union([z.tuple([zVpTokenPresentationEntry], zVpTokenPresentationEntry), zVpTokenPresentationEntry]), { message: "dcql vp_token must be an object with keys referencing the dcql credential query id, and values a non-empty array of strings and objects, or string, or object" });
|
|
1301
1301
|
const zVpToken = zVpTokenDcql.or(zVpTokenPex);
|
|
1302
1302
|
|
|
1303
1303
|
//#endregion
|
|
@@ -1311,7 +1311,7 @@ const zOpenid4vpAuthorizationResponse = z.object({
|
|
|
1311
1311
|
token_type: z.string().optional(),
|
|
1312
1312
|
access_token: z.string().optional(),
|
|
1313
1313
|
expires_in: z.coerce.number().optional()
|
|
1314
|
-
}).
|
|
1314
|
+
}).loose();
|
|
1315
1315
|
|
|
1316
1316
|
//#endregion
|
|
1317
1317
|
//#region src/authorization-response/parse-authorization-response-payload.ts
|
|
@@ -1334,11 +1334,11 @@ const zJarmAuthorizationResponse = z.object({
|
|
|
1334
1334
|
exp: true
|
|
1335
1335
|
}).required().shape,
|
|
1336
1336
|
state: z.optional(z.string())
|
|
1337
|
-
}).
|
|
1337
|
+
}).loose();
|
|
1338
1338
|
const zJarmAuthorizationResponseEncryptedOnly = z.object({
|
|
1339
1339
|
...zJwtPayload.shape,
|
|
1340
1340
|
state: z.optional(z.string())
|
|
1341
|
-
}).
|
|
1341
|
+
}).loose();
|
|
1342
1342
|
|
|
1343
1343
|
//#endregion
|
|
1344
1344
|
//#region src/jarm/jarm-authorization-response/jarm-validate-authorization-response.ts
|