@openid4vc/openid4vci 0.3.1-alpha-20251121092859 → 0.3.1-alpha-20251124151046
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.cjs +33 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +23 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -44,7 +44,7 @@ const zCredentialOfferObjectDraft11To14 = z.object({
|
|
|
44
44
|
user_pin_required: z.optional(z.boolean())
|
|
45
45
|
}).loose().optional()
|
|
46
46
|
}))
|
|
47
|
-
}).loose().transform(({ credentials, grants
|
|
47
|
+
}).loose().transform(({ credentials, grants, ...rest }) => {
|
|
48
48
|
const v14 = {
|
|
49
49
|
...rest,
|
|
50
50
|
credential_configuration_ids: credentials
|
|
@@ -52,7 +52,7 @@ const zCredentialOfferObjectDraft11To14 = z.object({
|
|
|
52
52
|
if (grants) {
|
|
53
53
|
v14.grants = { ...grants };
|
|
54
54
|
if (grants[preAuthorizedCodeGrantIdentifier]) {
|
|
55
|
-
const { user_pin_required
|
|
55
|
+
const { user_pin_required, ...restGrants } = grants[preAuthorizedCodeGrantIdentifier];
|
|
56
56
|
v14.grants[preAuthorizedCodeGrantIdentifier] = { ...restGrants };
|
|
57
57
|
if (user_pin_required) v14.grants[preAuthorizedCodeGrantIdentifier].tx_code = { input_mode: "text" };
|
|
58
58
|
}
|
|
@@ -101,7 +101,7 @@ function determineAuthorizationServerForCredentialOffer(options) {
|
|
|
101
101
|
return authorizationServer;
|
|
102
102
|
}
|
|
103
103
|
async function createCredentialOffer(options) {
|
|
104
|
-
const { [preAuthorizedCodeGrantIdentifier]: preAuthorizedCodeGrant, [authorizationCodeGrantIdentifier]: authorizationCodeGrant
|
|
104
|
+
const { [preAuthorizedCodeGrantIdentifier]: preAuthorizedCodeGrant, [authorizationCodeGrantIdentifier]: authorizationCodeGrant, ...restGrants } = options.grants;
|
|
105
105
|
const grants = { ...restGrants };
|
|
106
106
|
if (authorizationCodeGrant) {
|
|
107
107
|
determineAuthorizationServerForCredentialOffer({
|
|
@@ -492,14 +492,14 @@ const zJwtVcJsonCredentialIssuerMetadataDraft11 = z.object({
|
|
|
492
492
|
types: z.tuple([z.string()], z.string()),
|
|
493
493
|
credentialSubject: zW3cVcCredentialSubjectDraft14.optional()
|
|
494
494
|
}).loose();
|
|
495
|
-
const zJwtVcJsonCredentialIssuerMetadataDraft11To14 = zJwtVcJsonCredentialIssuerMetadataDraft11.transform(({ types, credentialSubject
|
|
495
|
+
const zJwtVcJsonCredentialIssuerMetadataDraft11To14 = zJwtVcJsonCredentialIssuerMetadataDraft11.transform(({ types, credentialSubject, ...rest }) => ({
|
|
496
496
|
...rest,
|
|
497
497
|
credential_definition: {
|
|
498
498
|
type: types,
|
|
499
499
|
...credentialSubject ? { credentialSubject } : {}
|
|
500
500
|
}
|
|
501
501
|
}));
|
|
502
|
-
const zJwtVcJsonCredentialIssuerMetadataDraft14To11 = zJwtVcJsonCredentialIssuerMetadataDraft14.loose().transform(({ credential_definition: { type
|
|
502
|
+
const zJwtVcJsonCredentialIssuerMetadataDraft14To11 = zJwtVcJsonCredentialIssuerMetadataDraft14.loose().transform(({ credential_definition: { type, ...credentialDefinition }, ...rest }) => ({
|
|
503
503
|
...rest,
|
|
504
504
|
types: type,
|
|
505
505
|
...credentialDefinition
|
|
@@ -513,7 +513,7 @@ const zJwtVcJsonCredentialRequestDraft11 = z.object({
|
|
|
513
513
|
types: z.tuple([z.string()], z.string()),
|
|
514
514
|
credentialSubject: z.optional(zW3cVcCredentialSubjectDraft14)
|
|
515
515
|
}).loose();
|
|
516
|
-
const zJwtVcJsonCredentialRequestDraft11To14 = zJwtVcJsonCredentialRequestDraft11.transform(({ types, credentialSubject
|
|
516
|
+
const zJwtVcJsonCredentialRequestDraft11To14 = zJwtVcJsonCredentialRequestDraft11.transform(({ types, credentialSubject, ...rest }) => {
|
|
517
517
|
return {
|
|
518
518
|
...rest,
|
|
519
519
|
credential_definition: {
|
|
@@ -522,7 +522,7 @@ const zJwtVcJsonCredentialRequestDraft11To14 = zJwtVcJsonCredentialRequestDraft1
|
|
|
522
522
|
}
|
|
523
523
|
};
|
|
524
524
|
});
|
|
525
|
-
const zJwtVcJsonCredentialRequestDraft14To11 = zJwtVcJsonCredentialRequestFormatDraft14.loose().transform(({ credential_definition: { type
|
|
525
|
+
const zJwtVcJsonCredentialRequestDraft14To11 = zJwtVcJsonCredentialRequestFormatDraft14.loose().transform(({ credential_definition: { type, ...credentialDefinition }, ...rest }) => ({
|
|
526
526
|
...rest,
|
|
527
527
|
types: type,
|
|
528
528
|
...credentialDefinition
|
|
@@ -554,7 +554,7 @@ const zJwtVcJsonLdCredentialIssuerMetadataDraft11 = z.object({
|
|
|
554
554
|
types: z.tuple([z.string()], z.string()),
|
|
555
555
|
credentialSubject: zW3cVcCredentialSubjectDraft14.optional()
|
|
556
556
|
}).loose();
|
|
557
|
-
const zJwtVcJsonLdCredentialIssuerMetadataDraft11To14 = zJwtVcJsonLdCredentialIssuerMetadataDraft11.transform(({ "@context": context, types, credentialSubject
|
|
557
|
+
const zJwtVcJsonLdCredentialIssuerMetadataDraft11To14 = zJwtVcJsonLdCredentialIssuerMetadataDraft11.transform(({ "@context": context, types, credentialSubject, ...rest }) => ({
|
|
558
558
|
...rest,
|
|
559
559
|
credential_definition: {
|
|
560
560
|
"@context": context,
|
|
@@ -562,7 +562,7 @@ const zJwtVcJsonLdCredentialIssuerMetadataDraft11To14 = zJwtVcJsonLdCredentialIs
|
|
|
562
562
|
...credentialSubject ? { credentialSubject } : {}
|
|
563
563
|
}
|
|
564
564
|
}));
|
|
565
|
-
const zJwtVcJsonLdCredentialIssuerMetadataDraft14To11 = zJwtVcJsonLdCredentialIssuerMetadataDraft14.loose().transform(({ credential_definition: { type
|
|
565
|
+
const zJwtVcJsonLdCredentialIssuerMetadataDraft14To11 = zJwtVcJsonLdCredentialIssuerMetadataDraft14.loose().transform(({ credential_definition: { type, ...credentialDefinition }, ...rest }) => ({
|
|
566
566
|
...rest,
|
|
567
567
|
...credentialDefinition,
|
|
568
568
|
types: type
|
|
@@ -579,14 +579,14 @@ const zJwtVcJsonLdCredentialRequestDraft11 = z.object({
|
|
|
579
579
|
credentialSubject: z.optional(zW3cVcCredentialSubjectDraft14)
|
|
580
580
|
}).loose()
|
|
581
581
|
}).loose();
|
|
582
|
-
const zJwtVcJsonLdCredentialRequestDraft11To14 = zJwtVcJsonLdCredentialRequestDraft11.transform(({ credential_definition: { types
|
|
582
|
+
const zJwtVcJsonLdCredentialRequestDraft11To14 = zJwtVcJsonLdCredentialRequestDraft11.transform(({ credential_definition: { types, ...restCredentialDefinition }, ...rest }) => ({
|
|
583
583
|
...rest,
|
|
584
584
|
credential_definition: {
|
|
585
585
|
...restCredentialDefinition,
|
|
586
586
|
type: types
|
|
587
587
|
}
|
|
588
588
|
}));
|
|
589
|
-
const zJwtVcJsonLdCredentialRequestDraft14To11 = zJwtVcJsonLdCredentialRequestFormatDraft14.loose().transform(({ credential_definition: { type
|
|
589
|
+
const zJwtVcJsonLdCredentialRequestDraft14To11 = zJwtVcJsonLdCredentialRequestFormatDraft14.loose().transform(({ credential_definition: { type, ...restCredentialDefinition }, ...rest }) => ({
|
|
590
590
|
...rest,
|
|
591
591
|
credential_definition: {
|
|
592
592
|
...restCredentialDefinition,
|
|
@@ -620,7 +620,7 @@ const zLdpVcCredentialIssuerMetadataDraft11 = z.object({
|
|
|
620
620
|
types: z.tuple([z.string()], z.string()),
|
|
621
621
|
credentialSubject: zW3cVcCredentialSubjectDraft14.optional()
|
|
622
622
|
}).loose();
|
|
623
|
-
const zLdpVcCredentialIssuerMetadataDraft11To14 = zLdpVcCredentialIssuerMetadataDraft11.transform(({ "@context": context, types, credentialSubject
|
|
623
|
+
const zLdpVcCredentialIssuerMetadataDraft11To14 = zLdpVcCredentialIssuerMetadataDraft11.transform(({ "@context": context, types, credentialSubject, ...rest }) => ({
|
|
624
624
|
...rest,
|
|
625
625
|
credential_definition: {
|
|
626
626
|
"@context": context,
|
|
@@ -628,7 +628,7 @@ const zLdpVcCredentialIssuerMetadataDraft11To14 = zLdpVcCredentialIssuerMetadata
|
|
|
628
628
|
...credentialSubject ? { credentialSubject } : {}
|
|
629
629
|
}
|
|
630
630
|
}));
|
|
631
|
-
const zLdpVcCredentialIssuerMetadataDraft14To11 = zLdpVcCredentialIssuerMetadataDraft14.loose().transform(({ credential_definition: { type
|
|
631
|
+
const zLdpVcCredentialIssuerMetadataDraft14To11 = zLdpVcCredentialIssuerMetadataDraft14.loose().transform(({ credential_definition: { type, ...credentialDefinition }, ...rest }) => ({
|
|
632
632
|
...rest,
|
|
633
633
|
...credentialDefinition,
|
|
634
634
|
types: type
|
|
@@ -645,14 +645,14 @@ const zLdpVcCredentialRequestDraft11 = z.object({
|
|
|
645
645
|
credentialSubject: zW3cVcCredentialSubjectDraft14.optional()
|
|
646
646
|
})
|
|
647
647
|
}).loose();
|
|
648
|
-
const zLdpVcCredentialRequestDraft11To14 = zLdpVcCredentialRequestDraft11.transform(({ credential_definition: { types
|
|
648
|
+
const zLdpVcCredentialRequestDraft11To14 = zLdpVcCredentialRequestDraft11.transform(({ credential_definition: { types, ...restCredentialDefinition }, ...rest }) => ({
|
|
649
649
|
...rest,
|
|
650
650
|
credential_definition: {
|
|
651
651
|
...restCredentialDefinition,
|
|
652
652
|
type: types
|
|
653
653
|
}
|
|
654
654
|
}));
|
|
655
|
-
const zLdpVcCredentialRequestDraft14To11 = zLdpVcCredentialRequestFormatDraft14.loose().transform(({ credential_definition: { type
|
|
655
|
+
const zLdpVcCredentialRequestDraft14To11 = zLdpVcCredentialRequestFormatDraft14.loose().transform(({ credential_definition: { type, ...restCredentialDefinition }, ...rest }) => ({
|
|
656
656
|
...rest,
|
|
657
657
|
credential_definition: {
|
|
658
658
|
...restCredentialDefinition,
|
|
@@ -750,13 +750,13 @@ const zCredentialConfigurationSupportedDraft11ToV1 = z.object({
|
|
|
750
750
|
background_image: z.object({ url: zHttpsUrl.or(zDataUrl).optional() }).loose().optional()
|
|
751
751
|
}).loose()).optional(),
|
|
752
752
|
claims: z.any().optional()
|
|
753
|
-
}).loose().transform(({ cryptographic_suites_supported, display, claims, id, format
|
|
753
|
+
}).loose().transform(({ cryptographic_suites_supported, display, claims, id, format, ...rest }) => ({
|
|
754
754
|
...rest,
|
|
755
755
|
format,
|
|
756
756
|
...cryptographic_suites_supported ? { credential_signing_alg_values_supported: format === zMsoMdocFormatIdentifier.value ? jwaSignatureAlgorithmArrayToFullySpecifiedCoseAlgorithmArray(cryptographic_suites_supported) : cryptographic_suites_supported } : {},
|
|
757
757
|
...claims || display ? { credential_metadata: {
|
|
758
758
|
...claims ? { claims } : {},
|
|
759
|
-
...display ? { display: display.map(({ logo, background_image
|
|
759
|
+
...display ? { display: display.map(({ logo, background_image, ...displayRest }) => ({
|
|
760
760
|
...displayRest,
|
|
761
761
|
...logo?.url ? { logo: { uri: logo.url } } : {},
|
|
762
762
|
...background_image?.url ? { background_image: { uri: background_image.url } } : {}
|
|
@@ -777,16 +777,16 @@ const zCredentialConfigurationSupportedDraft11ToV1 = z.object({
|
|
|
777
777
|
});
|
|
778
778
|
return z.NEVER;
|
|
779
779
|
}).pipe(zCredentialConfigurationSupportedWithFormats);
|
|
780
|
-
const zCredentialConfigurationSupportedV1ToDraft11 = zCredentialConfigurationSupportedWithFormats.transform(({ credential_metadata
|
|
780
|
+
const zCredentialConfigurationSupportedV1ToDraft11 = zCredentialConfigurationSupportedWithFormats.transform(({ credential_metadata, ...rest }) => ({
|
|
781
781
|
...credential_metadata,
|
|
782
782
|
...rest
|
|
783
|
-
})).and(z.object({ id: z.string() }).loose()).transform(({ id, credential_signing_alg_values_supported, display, proof_types_supported, scope, format
|
|
783
|
+
})).and(z.object({ id: z.string() }).loose()).transform(({ id, credential_signing_alg_values_supported, display, proof_types_supported, scope, format, ...rest }) => ({
|
|
784
784
|
...rest,
|
|
785
785
|
format,
|
|
786
786
|
...credential_signing_alg_values_supported ? { cryptographic_suites_supported: format === zMsoMdocFormatIdentifier.value && typeof credential_signing_alg_values_supported[0] === "number" ? fullySpecifiedCoseAlgorithmArrayToJwaSignatureAlgorithmArray(credential_signing_alg_values_supported) : credential_signing_alg_values_supported } : {},
|
|
787
|
-
...display ? { display: display.map(({ logo, background_image
|
|
788
|
-
const { uri: logoUri
|
|
789
|
-
const { uri: backgroundImageUri
|
|
787
|
+
...display ? { display: display.map(({ logo, background_image, ...displayRest }) => {
|
|
788
|
+
const { uri: logoUri, ...logoRest } = logo ?? {};
|
|
789
|
+
const { uri: backgroundImageUri, ...backgroundImageRest } = background_image ?? {};
|
|
790
790
|
return {
|
|
791
791
|
...displayRest,
|
|
792
792
|
...logoUri ? { logo: {
|
|
@@ -813,7 +813,7 @@ const zCredentialConfigurationSupportedV1ToDraft11 = zCredentialConfigurationSup
|
|
|
813
813
|
const zCredentialIssuerMetadataDraft11ToV1 = z.object({
|
|
814
814
|
authorization_server: z.string().optional(),
|
|
815
815
|
credentials_supported: z.array(z.object({ id: z.string().optional() }).loose())
|
|
816
|
-
}).loose().transform(({ authorization_server, credentials_supported
|
|
816
|
+
}).loose().transform(({ authorization_server, credentials_supported, ...rest }) => {
|
|
817
817
|
return {
|
|
818
818
|
...rest,
|
|
819
819
|
...authorization_server ? { authorization_servers: [authorization_server] } : {},
|