@openid4vc/openid4vci 0.3.0-alpha-20250820113635 → 0.3.0-alpha-20250825150235
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 +1595 -488
- package/dist/index.d.ts +1595 -488
- package/dist/index.js +193 -153
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +193 -153
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -274,7 +274,7 @@ var import_utils5 = require("@openid4vc/utils");
|
|
|
274
274
|
// src/metadata/credential-issuer/z-credential-issuer-metadata.ts
|
|
275
275
|
var import_oauth24 = require("@openid4vc/oauth2");
|
|
276
276
|
var import_utils4 = require("@openid4vc/utils");
|
|
277
|
-
var
|
|
277
|
+
var import_zod13 = __toESM(require("zod"));
|
|
278
278
|
|
|
279
279
|
// src/formats/credential/mso-mdoc/z-mso-mdoc.ts
|
|
280
280
|
var import_zod5 = __toESM(require("zod"));
|
|
@@ -433,25 +433,28 @@ var zMsoMdocCredentialRequestFormatDraft14 = import_zod5.default.object({
|
|
|
433
433
|
|
|
434
434
|
// src/formats/credential/sd-jwt-vc/z-sd-jwt-vc.ts
|
|
435
435
|
var import_zod6 = __toESM(require("zod"));
|
|
436
|
-
var
|
|
437
|
-
var
|
|
436
|
+
var zLegacySdJwtVcFormatIdentifier = import_zod6.default.literal("vc+sd-jwt");
|
|
437
|
+
var zLegacySdJwtVcCredentialIssuerMetadataDraft16 = zCredentialConfigurationSupportedCommon.extend({
|
|
438
438
|
vct: import_zod6.default.string(),
|
|
439
|
-
format:
|
|
439
|
+
format: zLegacySdJwtVcFormatIdentifier,
|
|
440
440
|
order: import_zod6.default.optional(import_zod6.default.array(import_zod6.default.string())),
|
|
441
441
|
credential_metadata: zCredentialConfigurationSupportedCommonCredentialMetadata.extend({
|
|
442
442
|
claims: import_zod6.default.array(zCredentialConfigurationSupportedClaimsDraft14).optional()
|
|
443
|
-
}).optional()
|
|
443
|
+
}).optional(),
|
|
444
|
+
credential_definition: import_zod6.default.optional(import_zod6.default.never())
|
|
444
445
|
});
|
|
445
|
-
var
|
|
446
|
+
var zLegacySdJwtVcCredentialIssuerMetadataDraft14 = zCredentialConfigurationSupportedCommonDraft15.extend({
|
|
446
447
|
vct: import_zod6.default.string(),
|
|
447
|
-
format:
|
|
448
|
+
format: zLegacySdJwtVcFormatIdentifier,
|
|
448
449
|
claims: import_zod6.default.optional(zCredentialConfigurationSupportedClaimsDraft14),
|
|
449
|
-
order: import_zod6.default.optional(import_zod6.default.array(import_zod6.default.string()))
|
|
450
|
+
order: import_zod6.default.optional(import_zod6.default.array(import_zod6.default.string())),
|
|
451
|
+
credential_definition: import_zod6.default.optional(import_zod6.default.never())
|
|
450
452
|
});
|
|
451
|
-
var
|
|
452
|
-
format:
|
|
453
|
+
var zLegacySdJwtVcCredentialRequestFormatDraft14 = import_zod6.default.object({
|
|
454
|
+
format: zLegacySdJwtVcFormatIdentifier,
|
|
453
455
|
vct: import_zod6.default.string(),
|
|
454
|
-
claims: import_zod6.default.optional(zCredentialConfigurationSupportedClaimsDraft14)
|
|
456
|
+
claims: import_zod6.default.optional(zCredentialConfigurationSupportedClaimsDraft14),
|
|
457
|
+
credential_definition: import_zod6.default.optional(import_zod6.default.never())
|
|
455
458
|
});
|
|
456
459
|
|
|
457
460
|
// src/formats/credential/sd-jwt-dc/z-sd-jwt-dc.ts
|
|
@@ -493,7 +496,7 @@ var zClaimValueSchemaDraft14 = import_zod8.default.union([
|
|
|
493
496
|
var zW3cVcCredentialSubjectDraft14 = import_zod8.default.record(import_zod8.default.string(), zClaimValueSchemaDraft14);
|
|
494
497
|
var zW3cVcJsonLdCredentialDefinition = import_zod8.default.object({
|
|
495
498
|
"@context": import_zod8.default.array(import_zod8.default.string()),
|
|
496
|
-
type: import_zod8.default.array(import_zod8.default.string())
|
|
499
|
+
type: import_zod8.default.array(import_zod8.default.string()).nonempty()
|
|
497
500
|
}).passthrough();
|
|
498
501
|
var zW3cVcJsonLdCredentialDefinitionDraft14 = zW3cVcJsonLdCredentialDefinition.extend({
|
|
499
502
|
credentialSubject: zW3cVcCredentialSubjectDraft14.optional()
|
|
@@ -652,7 +655,7 @@ var zJwtVcJsonLdCredentialRequestDraft14To11 = zJwtVcJsonLdCredentialRequestForm
|
|
|
652
655
|
var import_zod11 = __toESM(require("zod"));
|
|
653
656
|
var zJwtVcJsonFormatIdentifier = import_zod11.default.literal("jwt_vc_json");
|
|
654
657
|
var zJwtVcJsonCredentialDefinition = import_zod11.default.object({
|
|
655
|
-
type: import_zod11.default.array(import_zod11.default.string())
|
|
658
|
+
type: import_zod11.default.array(import_zod11.default.string()).nonempty()
|
|
656
659
|
}).passthrough();
|
|
657
660
|
var zJwtVcJsonCredentialDefinitionDraft14 = zJwtVcJsonCredentialDefinition.extend({
|
|
658
661
|
credentialSubject: zW3cVcCredentialSubjectDraft14.optional()
|
|
@@ -726,6 +729,28 @@ var zJwtVcJsonCredentialRequestDraft14To11 = zJwtVcJsonCredentialRequestFormatDr
|
|
|
726
729
|
...credentialDefinition
|
|
727
730
|
})).pipe(zJwtVcJsonCredentialRequestDraft11);
|
|
728
731
|
|
|
732
|
+
// src/formats/credential/w3c-vc/z-w3c-sd-jwt-vc.ts
|
|
733
|
+
var import_zod12 = __toESM(require("zod"));
|
|
734
|
+
var zSdJwtW3VcFormatIdentifier = import_zod12.default.literal("vc+sd-jwt");
|
|
735
|
+
var zSdJwtW3VcCredentialDefinition = import_zod12.default.object({
|
|
736
|
+
type: import_zod12.default.array(import_zod12.default.string()).nonempty()
|
|
737
|
+
}).passthrough();
|
|
738
|
+
var zSdJwtW3VcCredentialIssuerMetadata = zCredentialConfigurationSupportedCommon.extend({
|
|
739
|
+
format: zSdJwtW3VcFormatIdentifier,
|
|
740
|
+
credential_definition: zSdJwtW3VcCredentialDefinition,
|
|
741
|
+
credential_metadata: zCredentialConfigurationSupportedCommonCredentialMetadata.extend({
|
|
742
|
+
claims: zIssuerMetadataClaimsDescription.optional()
|
|
743
|
+
}).optional(),
|
|
744
|
+
// FIXME(vc+sd-jwt): remove when dropping support for legacy vc+sd-jwt. Allows type narrowing.
|
|
745
|
+
vct: import_zod12.default.optional(import_zod12.default.never())
|
|
746
|
+
});
|
|
747
|
+
var zSdJwtW3VcCredentialRequestFormatDraft14 = import_zod12.default.object({
|
|
748
|
+
format: zSdJwtW3VcFormatIdentifier,
|
|
749
|
+
credential_definition: zSdJwtW3VcCredentialDefinition,
|
|
750
|
+
// FIXME(vc+sd-jwt): remove when dropping support for legacy vc+sd-jwt. Allows type narrowing.
|
|
751
|
+
vct: import_zod12.default.optional(import_zod12.default.never())
|
|
752
|
+
});
|
|
753
|
+
|
|
729
754
|
// src/metadata/credential-issuer/z-credential-issuer-metadata.ts
|
|
730
755
|
var allCredentialIssuerMetadataFormats = [
|
|
731
756
|
zSdJwtDcCredentialIssuerMetadata,
|
|
@@ -733,14 +758,15 @@ var allCredentialIssuerMetadataFormats = [
|
|
|
733
758
|
zJwtVcJsonLdCredentialIssuerMetadata,
|
|
734
759
|
zLdpVcCredentialIssuerMetadata,
|
|
735
760
|
zJwtVcJsonCredentialIssuerMetadata,
|
|
736
|
-
|
|
761
|
+
zSdJwtW3VcCredentialIssuerMetadata,
|
|
762
|
+
zLegacySdJwtVcCredentialIssuerMetadataDraft16,
|
|
737
763
|
zSdJwtDcCredentialIssuerMetadataDraft15,
|
|
738
764
|
zMsoMdocCredentialIssuerMetadataDraft15,
|
|
739
765
|
zJwtVcJsonLdCredentialIssuerMetadataDraft15,
|
|
740
766
|
zLdpVcCredentialIssuerMetadataDraft15,
|
|
741
767
|
zJwtVcJsonCredentialIssuerMetadataDraft15,
|
|
742
768
|
zMsoMdocCredentialIssuerMetadataDraft14,
|
|
743
|
-
|
|
769
|
+
zLegacySdJwtVcCredentialIssuerMetadataDraft14,
|
|
744
770
|
zJwtVcJsonLdCredentialIssuerMetadataDraft14,
|
|
745
771
|
zLdpVcCredentialIssuerMetadataDraft14,
|
|
746
772
|
zJwtVcJsonCredentialIssuerMetadataDraft14
|
|
@@ -748,13 +774,13 @@ var allCredentialIssuerMetadataFormats = [
|
|
|
748
774
|
var allCredentialIssuerMetadataFormatIdentifiers = allCredentialIssuerMetadataFormats.map(
|
|
749
775
|
(format) => format.shape.format.value
|
|
750
776
|
);
|
|
751
|
-
var zCredentialConfigurationSupportedWithFormats =
|
|
777
|
+
var zCredentialConfigurationSupportedWithFormats = import_zod13.default.union([zCredentialConfigurationSupportedCommon, zCredentialConfigurationSupportedCommonDraft15]).transform((data, ctx) => {
|
|
752
778
|
if (!allCredentialIssuerMetadataFormatIdentifiers.includes(data.format)) return data;
|
|
753
779
|
const validators = allCredentialIssuerMetadataFormats.filter(
|
|
754
780
|
(formatValidator) => formatValidator.shape.format.value === data.format
|
|
755
781
|
);
|
|
756
|
-
const result =
|
|
757
|
-
validators.length > 1 ?
|
|
782
|
+
const result = import_zod13.default.object({}).passthrough().and(
|
|
783
|
+
validators.length > 1 ? import_zod13.default.union(
|
|
758
784
|
validators
|
|
759
785
|
) : validators[0]
|
|
760
786
|
).safeParse(data);
|
|
@@ -764,52 +790,52 @@ var zCredentialConfigurationSupportedWithFormats = import_zod12.default.union([z
|
|
|
764
790
|
for (const issue of result.error.issues) {
|
|
765
791
|
ctx.addIssue(issue);
|
|
766
792
|
}
|
|
767
|
-
return
|
|
793
|
+
return import_zod13.default.NEVER;
|
|
768
794
|
});
|
|
769
|
-
var zCredentialIssuerMetadataDisplayEntry =
|
|
770
|
-
name:
|
|
771
|
-
locale:
|
|
772
|
-
logo:
|
|
795
|
+
var zCredentialIssuerMetadataDisplayEntry = import_zod13.default.object({
|
|
796
|
+
name: import_zod13.default.string().optional(),
|
|
797
|
+
locale: import_zod13.default.string().optional(),
|
|
798
|
+
logo: import_zod13.default.object({
|
|
773
799
|
// FIXME: make required again, but need to support draft 11 first
|
|
774
|
-
uri:
|
|
775
|
-
alt_text:
|
|
800
|
+
uri: import_zod13.default.string().optional(),
|
|
801
|
+
alt_text: import_zod13.default.string().optional()
|
|
776
802
|
}).passthrough().optional()
|
|
777
803
|
}).passthrough();
|
|
778
|
-
var zCredentialIssuerMetadataDraft14Draft15Draft16 =
|
|
804
|
+
var zCredentialIssuerMetadataDraft14Draft15Draft16 = import_zod13.default.object({
|
|
779
805
|
credential_issuer: import_utils4.zHttpsUrl,
|
|
780
|
-
authorization_servers:
|
|
806
|
+
authorization_servers: import_zod13.default.array(import_utils4.zHttpsUrl).optional(),
|
|
781
807
|
credential_endpoint: import_utils4.zHttpsUrl,
|
|
782
808
|
deferred_credential_endpoint: import_utils4.zHttpsUrl.optional(),
|
|
783
809
|
notification_endpoint: import_utils4.zHttpsUrl.optional(),
|
|
784
810
|
// Added after draft 14, but needed for proper
|
|
785
811
|
nonce_endpoint: import_utils4.zHttpsUrl.optional(),
|
|
786
|
-
credential_response_encryption:
|
|
787
|
-
alg_values_supported:
|
|
788
|
-
enc_values_supported:
|
|
789
|
-
encryption_required:
|
|
812
|
+
credential_response_encryption: import_zod13.default.object({
|
|
813
|
+
alg_values_supported: import_zod13.default.array(import_zod13.default.string()),
|
|
814
|
+
enc_values_supported: import_zod13.default.array(import_zod13.default.string()),
|
|
815
|
+
encryption_required: import_zod13.default.boolean()
|
|
790
816
|
}).passthrough().optional(),
|
|
791
|
-
batch_credential_issuance:
|
|
792
|
-
batch_size:
|
|
817
|
+
batch_credential_issuance: import_zod13.default.object({
|
|
818
|
+
batch_size: import_zod13.default.number().positive()
|
|
793
819
|
}).passthrough().optional(),
|
|
794
820
|
signed_metadata: import_oauth24.zCompactJwt.optional(),
|
|
795
|
-
display:
|
|
796
|
-
credential_configurations_supported:
|
|
821
|
+
display: import_zod13.default.array(zCredentialIssuerMetadataDisplayEntry).optional(),
|
|
822
|
+
credential_configurations_supported: import_zod13.default.record(import_zod13.default.string(), zCredentialConfigurationSupportedWithFormats)
|
|
797
823
|
}).passthrough();
|
|
798
|
-
var zCredentialConfigurationSupportedDraft11To16 =
|
|
799
|
-
id:
|
|
800
|
-
format:
|
|
801
|
-
cryptographic_suites_supported:
|
|
802
|
-
display:
|
|
803
|
-
|
|
804
|
-
logo:
|
|
805
|
-
url:
|
|
824
|
+
var zCredentialConfigurationSupportedDraft11To16 = import_zod13.default.object({
|
|
825
|
+
id: import_zod13.default.string().optional(),
|
|
826
|
+
format: import_zod13.default.string(),
|
|
827
|
+
cryptographic_suites_supported: import_zod13.default.array(import_zod13.default.string()).optional(),
|
|
828
|
+
display: import_zod13.default.array(
|
|
829
|
+
import_zod13.default.object({
|
|
830
|
+
logo: import_zod13.default.object({
|
|
831
|
+
url: import_zod13.default.string().url().optional()
|
|
806
832
|
}).passthrough().optional(),
|
|
807
|
-
background_image:
|
|
808
|
-
url:
|
|
833
|
+
background_image: import_zod13.default.object({
|
|
834
|
+
url: import_zod13.default.string().url().optional()
|
|
809
835
|
}).passthrough().optional()
|
|
810
836
|
}).passthrough()
|
|
811
837
|
).optional(),
|
|
812
|
-
claims:
|
|
838
|
+
claims: import_zod13.default.any().optional()
|
|
813
839
|
}).passthrough().transform(({ cryptographic_suites_supported, display, claims, id, ...rest }) => ({
|
|
814
840
|
...rest,
|
|
815
841
|
...cryptographic_suites_supported ? { credential_signing_alg_values_supported: cryptographic_suites_supported } : {},
|
|
@@ -852,7 +878,7 @@ var zCredentialConfigurationSupportedDraft11To16 = import_zod12.default.object({
|
|
|
852
878
|
for (const issue of result.error.issues) {
|
|
853
879
|
ctx.addIssue(issue);
|
|
854
880
|
}
|
|
855
|
-
return
|
|
881
|
+
return import_zod13.default.NEVER;
|
|
856
882
|
}).pipe(zCredentialConfigurationSupportedWithFormats);
|
|
857
883
|
var zCredentialConfigurationSupportedDraft16To15 = zCredentialConfigurationSupportedWithFormats.transform(
|
|
858
884
|
({ credential_metadata, ...rest }) => ({
|
|
@@ -861,8 +887,8 @@ var zCredentialConfigurationSupportedDraft16To15 = zCredentialConfigurationSuppo
|
|
|
861
887
|
})
|
|
862
888
|
);
|
|
863
889
|
var zCredentialConfigurationSupportedDraft16To11 = zCredentialConfigurationSupportedDraft16To15.and(
|
|
864
|
-
|
|
865
|
-
id:
|
|
890
|
+
import_zod13.default.object({
|
|
891
|
+
id: import_zod13.default.string()
|
|
866
892
|
}).passthrough()
|
|
867
893
|
).transform(({ id, credential_signing_alg_values_supported, display, proof_types_supported, scope, ...rest }) => ({
|
|
868
894
|
...rest,
|
|
@@ -882,15 +908,15 @@ var zCredentialConfigurationSupportedDraft16To11 = zCredentialConfigurationSuppo
|
|
|
882
908
|
} : {},
|
|
883
909
|
id
|
|
884
910
|
})).pipe(
|
|
885
|
-
|
|
911
|
+
import_zod13.default.union([
|
|
886
912
|
zLdpVcCredentialIssuerMetadataDraft14To11,
|
|
887
913
|
zJwtVcJsonCredentialIssuerMetadataDraft14To11,
|
|
888
914
|
zJwtVcJsonLdCredentialIssuerMetadataDraft14To11,
|
|
889
915
|
// To handle unrecognized formats and not error immediately we allow the common format as well
|
|
890
916
|
// but they can't use any of the format identifiers that have a specific transformation. This way if a format is
|
|
891
917
|
// has a transformation it NEEDS to use the format specific transformation, and otherwise we fall back to the common validation
|
|
892
|
-
|
|
893
|
-
format:
|
|
918
|
+
import_zod13.default.object({
|
|
919
|
+
format: import_zod13.default.string().refine(
|
|
894
920
|
(input) => ![
|
|
895
921
|
zLdpVcFormatIdentifier.value,
|
|
896
922
|
zJwtVcJsonFormatIdentifier.value,
|
|
@@ -900,11 +926,11 @@ var zCredentialConfigurationSupportedDraft16To11 = zCredentialConfigurationSuppo
|
|
|
900
926
|
}).passthrough()
|
|
901
927
|
])
|
|
902
928
|
);
|
|
903
|
-
var zCredentialIssuerMetadataDraft11To16 =
|
|
904
|
-
authorization_server:
|
|
905
|
-
credentials_supported:
|
|
906
|
-
|
|
907
|
-
id:
|
|
929
|
+
var zCredentialIssuerMetadataDraft11To16 = import_zod13.default.object({
|
|
930
|
+
authorization_server: import_zod13.default.string().optional(),
|
|
931
|
+
credentials_supported: import_zod13.default.array(
|
|
932
|
+
import_zod13.default.object({
|
|
933
|
+
id: import_zod13.default.string().optional()
|
|
908
934
|
}).passthrough()
|
|
909
935
|
)
|
|
910
936
|
}).passthrough().transform(({ authorization_server, credentials_supported, ...rest }) => {
|
|
@@ -917,9 +943,9 @@ var zCredentialIssuerMetadataDraft11To16 = import_zod12.default.object({
|
|
|
917
943
|
)
|
|
918
944
|
};
|
|
919
945
|
}).pipe(
|
|
920
|
-
|
|
946
|
+
import_zod13.default.object({
|
|
921
947
|
// Update from v11 structure to v14 structure
|
|
922
|
-
credential_configurations_supported:
|
|
948
|
+
credential_configurations_supported: import_zod13.default.record(import_zod13.default.string(), zCredentialConfigurationSupportedDraft11To16)
|
|
923
949
|
}).passthrough()
|
|
924
950
|
).pipe(zCredentialIssuerMetadataDraft14Draft15Draft16);
|
|
925
951
|
var zCredentialIssuerMetadataWithDraft11 = zCredentialIssuerMetadataDraft14Draft15Draft16.transform((issuerMetadata) => ({
|
|
@@ -931,16 +957,16 @@ var zCredentialIssuerMetadataWithDraft11 = zCredentialIssuerMetadataDraft14Draft
|
|
|
931
957
|
}))
|
|
932
958
|
})).pipe(
|
|
933
959
|
zCredentialIssuerMetadataDraft14Draft15Draft16.extend({
|
|
934
|
-
credentials_supported:
|
|
960
|
+
credentials_supported: import_zod13.default.array(zCredentialConfigurationSupportedDraft16To11)
|
|
935
961
|
})
|
|
936
962
|
);
|
|
937
|
-
var zCredentialIssuerMetadata =
|
|
963
|
+
var zCredentialIssuerMetadata = import_zod13.default.union([
|
|
938
964
|
// First prioritize draft 16/15/14 (and 13)
|
|
939
965
|
zCredentialIssuerMetadataDraft14Draft15Draft16,
|
|
940
966
|
// Then try parsing draft 11 and transform into draft 16
|
|
941
967
|
zCredentialIssuerMetadataDraft11To16
|
|
942
968
|
]);
|
|
943
|
-
var zCredentialIssuerMetadataWithDraftVersion =
|
|
969
|
+
var zCredentialIssuerMetadataWithDraftVersion = import_zod13.default.union([
|
|
944
970
|
zCredentialIssuerMetadataDraft14Draft15Draft16.transform((credentialIssuerMetadata) => {
|
|
945
971
|
const credentialConfigurations = Object.values(credentialIssuerMetadata.credential_configurations_supported);
|
|
946
972
|
const isDraft15 = credentialConfigurations.some((configuration) => {
|
|
@@ -1015,7 +1041,12 @@ function getCredentialConfigurationsMatchingRequestFormat({
|
|
|
1015
1041
|
return (0, import_utils6.arrayEqualsIgnoreOrder)(r.credential_definition.type, c.credential_definition.type);
|
|
1016
1042
|
}
|
|
1017
1043
|
if (c.format === "vc+sd-jwt" && r.format === c.format) {
|
|
1018
|
-
|
|
1044
|
+
if (r.vct && c.vct) {
|
|
1045
|
+
return r.vct === c.vct;
|
|
1046
|
+
}
|
|
1047
|
+
if (c.credential_definition && r.credential_definition) {
|
|
1048
|
+
return (0, import_utils6.arrayEqualsIgnoreOrder)(r.credential_definition.type, c.credential_definition.type);
|
|
1049
|
+
}
|
|
1019
1050
|
}
|
|
1020
1051
|
if (c.format === "mso_mdoc" && r.format === c.format) {
|
|
1021
1052
|
return r.doctype === c.doctype;
|
|
@@ -1159,7 +1190,7 @@ function getCredentialRequestFormatPayloadForCredentialConfigurationId(options)
|
|
|
1159
1190
|
options.issuerMetadata.credentialIssuer.credential_configurations_supported,
|
|
1160
1191
|
options.credentialConfigurationId
|
|
1161
1192
|
);
|
|
1162
|
-
if ((0, import_utils10.zIs)(
|
|
1193
|
+
if ((0, import_utils10.zIs)(zLegacySdJwtVcCredentialIssuerMetadataDraft16, credentialConfiguration) || (0, import_utils10.zIs)(zLegacySdJwtVcCredentialIssuerMetadataDraft14, credentialConfiguration)) {
|
|
1163
1194
|
return {
|
|
1164
1195
|
format: credentialConfiguration.format,
|
|
1165
1196
|
vct: credentialConfiguration.vct
|
|
@@ -1199,9 +1230,17 @@ function getCredentialRequestFormatPayloadForCredentialConfigurationId(options)
|
|
|
1199
1230
|
}
|
|
1200
1231
|
if ((0, import_utils10.zIs)(zSdJwtDcCredentialIssuerMetadata, credentialConfiguration)) {
|
|
1201
1232
|
throw new Openid4vciError(
|
|
1202
|
-
`Credential configuration id '${options.credentialConfigurationId}' with format ${
|
|
1233
|
+
`Credential configuration id '${options.credentialConfigurationId}' with format ${zLegacySdJwtVcFormatIdentifier.value} does not support credential request based on 'format'. Use 'credential_configuration_id' directly.`
|
|
1203
1234
|
);
|
|
1204
1235
|
}
|
|
1236
|
+
if ((0, import_utils10.zIs)(zSdJwtW3VcCredentialIssuerMetadata, credentialConfiguration)) {
|
|
1237
|
+
return {
|
|
1238
|
+
format: credentialConfiguration.format,
|
|
1239
|
+
credential_definition: {
|
|
1240
|
+
type: credentialConfiguration.credential_definition.type
|
|
1241
|
+
}
|
|
1242
|
+
};
|
|
1243
|
+
}
|
|
1205
1244
|
throw new Openid4vciError(
|
|
1206
1245
|
`Unknown format '${credentialConfiguration.format}' in credential configuration with id '${options.credentialConfigurationId}' for credential issuer '${options.issuerMetadata.credentialIssuer.credential_issuer}'`
|
|
1207
1246
|
);
|
|
@@ -1213,33 +1252,33 @@ var import_utils12 = require("@openid4vc/utils");
|
|
|
1213
1252
|
|
|
1214
1253
|
// src/credential-request/z-credential-request.ts
|
|
1215
1254
|
var import_oauth212 = require("@openid4vc/oauth2");
|
|
1216
|
-
var
|
|
1255
|
+
var import_zod17 = __toESM(require("zod"));
|
|
1217
1256
|
|
|
1218
1257
|
// src/credential-request/z-credential-request-common.ts
|
|
1219
1258
|
var import_oauth211 = require("@openid4vc/oauth2");
|
|
1220
|
-
var
|
|
1259
|
+
var import_zod16 = __toESM(require("zod"));
|
|
1221
1260
|
|
|
1222
1261
|
// src/formats/proof-type/jwt/z-jwt-proof-type.ts
|
|
1223
1262
|
var import_oauth29 = require("@openid4vc/oauth2");
|
|
1224
1263
|
var import_utils11 = require("@openid4vc/utils");
|
|
1225
|
-
var
|
|
1226
|
-
var zJwtProofTypeIdentifier =
|
|
1264
|
+
var import_zod14 = __toESM(require("zod"));
|
|
1265
|
+
var zJwtProofTypeIdentifier = import_zod14.default.literal("jwt");
|
|
1227
1266
|
var jwtProofTypeIdentifier = zJwtProofTypeIdentifier.value;
|
|
1228
|
-
var zCredentialRequestProofJwt =
|
|
1267
|
+
var zCredentialRequestProofJwt = import_zod14.default.object({
|
|
1229
1268
|
proof_type: zJwtProofTypeIdentifier,
|
|
1230
1269
|
jwt: import_oauth29.zCompactJwt
|
|
1231
1270
|
});
|
|
1232
1271
|
var zCredentialRequestJwtProofTypeHeader = import_oauth29.zJwtHeader.merge(
|
|
1233
|
-
|
|
1234
|
-
key_attestation:
|
|
1235
|
-
typ:
|
|
1272
|
+
import_zod14.default.object({
|
|
1273
|
+
key_attestation: import_zod14.default.optional(import_oauth29.zCompactJwt),
|
|
1274
|
+
typ: import_zod14.default.literal("openid4vci-proof+jwt")
|
|
1236
1275
|
})
|
|
1237
1276
|
).passthrough().refine(({ kid, jwk }) => jwk === void 0 || kid === void 0, {
|
|
1238
1277
|
message: `Both 'jwk' and 'kid' are defined. Only one is allowed`
|
|
1239
1278
|
}).refine(({ trust_chain, kid }) => !trust_chain || !kid, {
|
|
1240
1279
|
message: `When 'trust_chain' is provided, 'kid' is required`
|
|
1241
1280
|
});
|
|
1242
|
-
var zCredentialRequestJwtProofTypePayload =
|
|
1281
|
+
var zCredentialRequestJwtProofTypePayload = import_zod14.default.object({
|
|
1243
1282
|
...import_oauth29.zJwtPayload.shape,
|
|
1244
1283
|
aud: import_utils11.zHttpsUrl,
|
|
1245
1284
|
iat: import_utils11.zInteger
|
|
@@ -1247,40 +1286,40 @@ var zCredentialRequestJwtProofTypePayload = import_zod13.default.object({
|
|
|
1247
1286
|
|
|
1248
1287
|
// src/formats/proof-type/attestation/z-attestation-proof-type.ts
|
|
1249
1288
|
var import_oauth210 = require("@openid4vc/oauth2");
|
|
1250
|
-
var
|
|
1251
|
-
var zAttestationProofTypeIdentifier =
|
|
1289
|
+
var import_zod15 = __toESM(require("zod"));
|
|
1290
|
+
var zAttestationProofTypeIdentifier = import_zod15.default.literal("attestation");
|
|
1252
1291
|
var attestationProofTypeIdentifier = zAttestationProofTypeIdentifier.value;
|
|
1253
|
-
var zCredentialRequestProofAttestation =
|
|
1292
|
+
var zCredentialRequestProofAttestation = import_zod15.default.object({
|
|
1254
1293
|
proof_type: zAttestationProofTypeIdentifier,
|
|
1255
1294
|
attestation: import_oauth210.zCompactJwt
|
|
1256
1295
|
});
|
|
1257
1296
|
var zCredentialRequestAttestationProofTypePayload = zKeyAttestationJwtPayloadForUse("proof_type.attestation");
|
|
1258
1297
|
|
|
1259
1298
|
// src/credential-request/z-credential-request-common.ts
|
|
1260
|
-
var zCredentialRequestProofCommon =
|
|
1261
|
-
proof_type:
|
|
1299
|
+
var zCredentialRequestProofCommon = import_zod16.default.object({
|
|
1300
|
+
proof_type: import_zod16.default.string()
|
|
1262
1301
|
}).passthrough();
|
|
1263
1302
|
var allCredentialRequestProofs = [zCredentialRequestProofJwt, zCredentialRequestProofAttestation];
|
|
1264
|
-
var zCredentialRequestProof =
|
|
1303
|
+
var zCredentialRequestProof = import_zod16.default.union([
|
|
1265
1304
|
zCredentialRequestProofCommon,
|
|
1266
|
-
|
|
1305
|
+
import_zod16.default.discriminatedUnion("proof_type", allCredentialRequestProofs)
|
|
1267
1306
|
]);
|
|
1268
|
-
var zCredentialRequestProofsCommon =
|
|
1269
|
-
var zCredentialRequestProofs =
|
|
1270
|
-
[zJwtProofTypeIdentifier.value]:
|
|
1271
|
-
[zAttestationProofTypeIdentifier.value]:
|
|
1307
|
+
var zCredentialRequestProofsCommon = import_zod16.default.record(import_zod16.default.string(), import_zod16.default.array(import_zod16.default.unknown()));
|
|
1308
|
+
var zCredentialRequestProofs = import_zod16.default.object({
|
|
1309
|
+
[zJwtProofTypeIdentifier.value]: import_zod16.default.optional(import_zod16.default.array(zCredentialRequestProofJwt.shape.jwt)),
|
|
1310
|
+
[zAttestationProofTypeIdentifier.value]: import_zod16.default.optional(import_zod16.default.array(zCredentialRequestProofAttestation.shape.attestation))
|
|
1272
1311
|
});
|
|
1273
|
-
var zCredentialRequestCommon =
|
|
1312
|
+
var zCredentialRequestCommon = import_zod16.default.object({
|
|
1274
1313
|
proof: zCredentialRequestProof.optional(),
|
|
1275
|
-
proofs:
|
|
1276
|
-
|
|
1314
|
+
proofs: import_zod16.default.optional(
|
|
1315
|
+
import_zod16.default.intersection(zCredentialRequestProofsCommon, zCredentialRequestProofs).refine((proofs) => Object.values(proofs).length === 1, {
|
|
1277
1316
|
message: `The 'proofs' object in a credential request should contain exactly one attribute`
|
|
1278
1317
|
})
|
|
1279
1318
|
),
|
|
1280
|
-
credential_response_encryption:
|
|
1319
|
+
credential_response_encryption: import_zod16.default.object({
|
|
1281
1320
|
jwk: import_oauth211.zJwk,
|
|
1282
|
-
alg:
|
|
1283
|
-
enc:
|
|
1321
|
+
alg: import_zod16.default.string(),
|
|
1322
|
+
enc: import_zod16.default.string()
|
|
1284
1323
|
}).passthrough().optional()
|
|
1285
1324
|
}).passthrough().refine(({ proof, proofs }) => !(proof !== void 0 && proofs !== void 0), {
|
|
1286
1325
|
message: `Both 'proof' and 'proofs' are defined. Only one is allowed`
|
|
@@ -1288,50 +1327,51 @@ var zCredentialRequestCommon = import_zod15.default.object({
|
|
|
1288
1327
|
|
|
1289
1328
|
// src/credential-request/z-credential-request.ts
|
|
1290
1329
|
var allCredentialRequestFormats = [
|
|
1291
|
-
|
|
1330
|
+
zSdJwtW3VcCredentialRequestFormatDraft14,
|
|
1292
1331
|
zMsoMdocCredentialRequestFormatDraft14,
|
|
1293
1332
|
zLdpVcCredentialRequestFormatDraft14,
|
|
1294
1333
|
zJwtVcJsonLdCredentialRequestFormatDraft14,
|
|
1295
|
-
zJwtVcJsonCredentialRequestFormatDraft14
|
|
1334
|
+
zJwtVcJsonCredentialRequestFormatDraft14,
|
|
1335
|
+
zLegacySdJwtVcCredentialRequestFormatDraft14
|
|
1296
1336
|
];
|
|
1297
1337
|
var allCredentialRequestFormatIdentifiers = allCredentialRequestFormats.map(
|
|
1298
1338
|
(format) => format.shape.format.value
|
|
1299
1339
|
);
|
|
1300
|
-
var zCredentialRequestCredentialConfigurationId =
|
|
1301
|
-
credential_configuration_id:
|
|
1302
|
-
format:
|
|
1303
|
-
credential_identifier:
|
|
1340
|
+
var zCredentialRequestCredentialConfigurationId = import_zod17.default.object({
|
|
1341
|
+
credential_configuration_id: import_zod17.default.string(),
|
|
1342
|
+
format: import_zod17.default.never({ message: "'format' cannot be defined when 'credential_configuration_id' is set." }).optional(),
|
|
1343
|
+
credential_identifier: import_zod17.default.never({ message: "'credential_identifier' cannot be defined when 'credential_configuration_id' is set." }).optional()
|
|
1304
1344
|
});
|
|
1305
|
-
var zAuthorizationDetailsCredentialRequest =
|
|
1306
|
-
credential_identifier:
|
|
1307
|
-
credential_configuration_id:
|
|
1345
|
+
var zAuthorizationDetailsCredentialRequest = import_zod17.default.object({
|
|
1346
|
+
credential_identifier: import_zod17.default.string(),
|
|
1347
|
+
credential_configuration_id: import_zod17.default.never({ message: "'credential_configuration_id' cannot be defined when 'credential_identifier' is set." }).optional(),
|
|
1308
1348
|
// Cannot be present if credential identifier is present
|
|
1309
|
-
format:
|
|
1349
|
+
format: import_zod17.default.never({ message: "'format' cannot be defined when 'credential_identifier' is set." }).optional()
|
|
1310
1350
|
});
|
|
1311
|
-
var zCredentialRequestFormat =
|
|
1312
|
-
format:
|
|
1313
|
-
credential_identifier:
|
|
1314
|
-
credential_configuration_id:
|
|
1351
|
+
var zCredentialRequestFormat = import_zod17.default.object({
|
|
1352
|
+
format: import_zod17.default.string(),
|
|
1353
|
+
credential_identifier: import_zod17.default.never({ message: "'credential_identifier' cannot be defined when 'format' is set." }).optional(),
|
|
1354
|
+
credential_configuration_id: import_zod17.default.never({ message: "'credential_configuration_id' cannot be defined when 'format' is set." }).optional()
|
|
1315
1355
|
}).passthrough();
|
|
1316
1356
|
var zCredentialRequestDraft14WithFormat = zCredentialRequestCommon.and(zCredentialRequestFormat).transform((data, ctx) => {
|
|
1317
1357
|
if (!allCredentialRequestFormatIdentifiers.includes(
|
|
1318
1358
|
data.format
|
|
1319
1359
|
))
|
|
1320
1360
|
return data;
|
|
1321
|
-
const result =
|
|
1361
|
+
const result = import_zod17.default.object({}).passthrough().and(import_zod17.default.union(allCredentialRequestFormats)).safeParse(data);
|
|
1322
1362
|
if (result.success) {
|
|
1323
1363
|
return result.data;
|
|
1324
1364
|
}
|
|
1325
1365
|
for (const issue of result.error.issues) {
|
|
1326
1366
|
ctx.addIssue(issue);
|
|
1327
1367
|
}
|
|
1328
|
-
return
|
|
1368
|
+
return import_zod17.default.NEVER;
|
|
1329
1369
|
});
|
|
1330
|
-
var zCredentialRequestDraft15 =
|
|
1370
|
+
var zCredentialRequestDraft15 = import_zod17.default.union([
|
|
1331
1371
|
zCredentialRequestCommon.and(zAuthorizationDetailsCredentialRequest),
|
|
1332
1372
|
zCredentialRequestCommon.and(zCredentialRequestCredentialConfigurationId)
|
|
1333
1373
|
]);
|
|
1334
|
-
var zCredentialRequestDraft14 =
|
|
1374
|
+
var zCredentialRequestDraft14 = import_zod17.default.union([
|
|
1335
1375
|
zCredentialRequestDraft14WithFormat,
|
|
1336
1376
|
zCredentialRequestCommon.and(zAuthorizationDetailsCredentialRequest)
|
|
1337
1377
|
]);
|
|
@@ -1348,7 +1388,7 @@ var zCredentialRequestDraft11To14 = zCredentialRequestCommon.and(zCredentialRequ
|
|
|
1348
1388
|
for (const issue of result.error.issues) {
|
|
1349
1389
|
ctx.addIssue(issue);
|
|
1350
1390
|
}
|
|
1351
|
-
return
|
|
1391
|
+
return import_zod17.default.NEVER;
|
|
1352
1392
|
}).pipe(zCredentialRequestDraft14);
|
|
1353
1393
|
var zCredentialRequestDraft14To11 = zCredentialRequestDraft14.refine(
|
|
1354
1394
|
(data) => data.credential_identifier === void 0,
|
|
@@ -1366,27 +1406,27 @@ var zCredentialRequestDraft14To11 = zCredentialRequestDraft14.refine(
|
|
|
1366
1406
|
for (const issue of result.error.issues) {
|
|
1367
1407
|
ctx.addIssue(issue);
|
|
1368
1408
|
}
|
|
1369
|
-
return
|
|
1409
|
+
return import_zod17.default.NEVER;
|
|
1370
1410
|
});
|
|
1371
|
-
var zCredentialRequest =
|
|
1411
|
+
var zCredentialRequest = import_zod17.default.union([
|
|
1372
1412
|
zCredentialRequestDraft15,
|
|
1373
1413
|
zCredentialRequestDraft14,
|
|
1374
1414
|
zCredentialRequestDraft11To14
|
|
1375
1415
|
]);
|
|
1376
|
-
var zDeferredCredentialRequest =
|
|
1377
|
-
transaction_id:
|
|
1378
|
-
credential_response_encryption:
|
|
1416
|
+
var zDeferredCredentialRequest = import_zod17.default.object({
|
|
1417
|
+
transaction_id: import_zod17.default.string().nonempty(),
|
|
1418
|
+
credential_response_encryption: import_zod17.default.object({
|
|
1379
1419
|
jwk: import_oauth212.zJwk,
|
|
1380
|
-
alg:
|
|
1381
|
-
enc:
|
|
1420
|
+
alg: import_zod17.default.string(),
|
|
1421
|
+
enc: import_zod17.default.string()
|
|
1382
1422
|
}).passthrough().optional()
|
|
1383
1423
|
});
|
|
1384
1424
|
|
|
1385
1425
|
// src/credential-request/z-credential-response.ts
|
|
1386
|
-
var
|
|
1426
|
+
var import_zod19 = __toESM(require("zod"));
|
|
1387
1427
|
|
|
1388
1428
|
// ../oauth2/src/common/z-oauth2-error.ts
|
|
1389
|
-
var
|
|
1429
|
+
var import_zod18 = __toESM(require("zod"));
|
|
1390
1430
|
var Oauth2ErrorCodes = /* @__PURE__ */ ((Oauth2ErrorCodes4) => {
|
|
1391
1431
|
Oauth2ErrorCodes4["ServerError"] = "server_error";
|
|
1392
1432
|
Oauth2ErrorCodes4["InvalidTarget"] = "invalid_target";
|
|
@@ -1426,49 +1466,49 @@ var Oauth2ErrorCodes = /* @__PURE__ */ ((Oauth2ErrorCodes4) => {
|
|
|
1426
1466
|
Oauth2ErrorCodes4["WalletUnavailable"] = "wallet_unavailable";
|
|
1427
1467
|
return Oauth2ErrorCodes4;
|
|
1428
1468
|
})(Oauth2ErrorCodes || {});
|
|
1429
|
-
var zOauth2ErrorResponse =
|
|
1430
|
-
error:
|
|
1431
|
-
error_description:
|
|
1432
|
-
error_uri:
|
|
1469
|
+
var zOauth2ErrorResponse = import_zod18.default.object({
|
|
1470
|
+
error: import_zod18.default.union([import_zod18.default.nativeEnum(Oauth2ErrorCodes), import_zod18.default.string()]),
|
|
1471
|
+
error_description: import_zod18.default.string().optional(),
|
|
1472
|
+
error_uri: import_zod18.default.string().optional()
|
|
1433
1473
|
}).passthrough();
|
|
1434
1474
|
|
|
1435
1475
|
// src/credential-request/z-credential-response.ts
|
|
1436
|
-
var zCredentialEncoding =
|
|
1437
|
-
var zBaseCredentialResponse =
|
|
1438
|
-
credentials:
|
|
1439
|
-
interval:
|
|
1440
|
-
notification_id:
|
|
1476
|
+
var zCredentialEncoding = import_zod19.default.union([import_zod19.default.string(), import_zod19.default.record(import_zod19.default.string(), import_zod19.default.any())]);
|
|
1477
|
+
var zBaseCredentialResponse = import_zod19.default.object({
|
|
1478
|
+
credentials: import_zod19.default.optional(import_zod19.default.array(zCredentialEncoding)),
|
|
1479
|
+
interval: import_zod19.default.number().int().positive().optional(),
|
|
1480
|
+
notification_id: import_zod19.default.string().optional()
|
|
1441
1481
|
}).passthrough();
|
|
1442
1482
|
var zCredentialResponse = zBaseCredentialResponse.extend({
|
|
1443
|
-
credential:
|
|
1444
|
-
transaction_id:
|
|
1445
|
-
c_nonce:
|
|
1446
|
-
c_nonce_expires_in:
|
|
1483
|
+
credential: import_zod19.default.optional(zCredentialEncoding),
|
|
1484
|
+
transaction_id: import_zod19.default.string().optional(),
|
|
1485
|
+
c_nonce: import_zod19.default.string().optional(),
|
|
1486
|
+
c_nonce_expires_in: import_zod19.default.number().int().optional()
|
|
1447
1487
|
}).passthrough().superRefine((value, ctx) => {
|
|
1448
1488
|
const { credential, credentials, transaction_id, interval, notification_id } = value;
|
|
1449
1489
|
if ([credential, credentials, transaction_id].filter((i) => i !== void 0).length !== 1) {
|
|
1450
1490
|
ctx.addIssue({
|
|
1451
|
-
code:
|
|
1491
|
+
code: import_zod19.default.ZodIssueCode.custom,
|
|
1452
1492
|
message: `Exactly one of 'credential', 'credentials', or 'transaction_id' MUST be defined.`
|
|
1453
1493
|
});
|
|
1454
1494
|
}
|
|
1455
1495
|
if (transaction_id && !interval) {
|
|
1456
1496
|
ctx.addIssue({
|
|
1457
|
-
code:
|
|
1497
|
+
code: import_zod19.default.ZodIssueCode.custom,
|
|
1458
1498
|
message: `'interval' MUST be defined when 'transaction_id' is defined.`
|
|
1459
1499
|
});
|
|
1460
1500
|
}
|
|
1461
1501
|
if (notification_id && !(credentials || credential)) {
|
|
1462
1502
|
ctx.addIssue({
|
|
1463
|
-
code:
|
|
1503
|
+
code: import_zod19.default.ZodIssueCode.custom,
|
|
1464
1504
|
message: `'notification_id' MUST NOT be defined when 'credential' or 'credentials' are not defined.`
|
|
1465
1505
|
});
|
|
1466
1506
|
}
|
|
1467
1507
|
});
|
|
1468
|
-
var zCredentialErrorResponse =
|
|
1508
|
+
var zCredentialErrorResponse = import_zod19.default.object({
|
|
1469
1509
|
...zOauth2ErrorResponse.shape,
|
|
1470
|
-
c_nonce:
|
|
1471
|
-
c_nonce_expires_in:
|
|
1510
|
+
c_nonce: import_zod19.default.string().optional(),
|
|
1511
|
+
c_nonce_expires_in: import_zod19.default.number().int().optional()
|
|
1472
1512
|
}).passthrough();
|
|
1473
1513
|
var zDeferredCredentialResponse = zBaseCredentialResponse.refine(
|
|
1474
1514
|
(value) => {
|
|
@@ -1621,7 +1661,7 @@ async function retrieveDeferredCredentials(options) {
|
|
|
1621
1661
|
deferredCredentialErrorResponseResult
|
|
1622
1662
|
};
|
|
1623
1663
|
}
|
|
1624
|
-
const deferredCredentialResponseResult = (0, import_utils12.isResponseContentType)(import_utils12.ContentType.Json, resourceResponse.response) ?
|
|
1664
|
+
const deferredCredentialResponseResult = (0, import_utils12.isResponseContentType)(import_utils12.ContentType.Json, resourceResponse.response) ? zDeferredCredentialResponse.safeParse(await resourceResponse.response.clone().json()) : void 0;
|
|
1625
1665
|
if (!deferredCredentialResponseResult?.success) {
|
|
1626
1666
|
return {
|
|
1627
1667
|
...resourceResponse,
|
|
@@ -1766,10 +1806,10 @@ var import_utils16 = require("@openid4vc/utils");
|
|
|
1766
1806
|
|
|
1767
1807
|
// src/nonce/z-nonce.ts
|
|
1768
1808
|
var import_utils15 = require("@openid4vc/utils");
|
|
1769
|
-
var
|
|
1770
|
-
var zNonceResponse =
|
|
1771
|
-
c_nonce:
|
|
1772
|
-
c_nonce_expires_in:
|
|
1809
|
+
var import_zod20 = __toESM(require("zod"));
|
|
1810
|
+
var zNonceResponse = import_zod20.default.object({
|
|
1811
|
+
c_nonce: import_zod20.default.string(),
|
|
1812
|
+
c_nonce_expires_in: import_zod20.default.optional(import_utils15.zInteger)
|
|
1773
1813
|
}).passthrough();
|
|
1774
1814
|
|
|
1775
1815
|
// src/nonce/nonce-request.ts
|
|
@@ -1809,15 +1849,15 @@ var import_oauth218 = require("@openid4vc/oauth2");
|
|
|
1809
1849
|
var import_utils17 = require("@openid4vc/utils");
|
|
1810
1850
|
|
|
1811
1851
|
// src/notification/z-notification.ts
|
|
1812
|
-
var
|
|
1813
|
-
var zNotificationEvent =
|
|
1814
|
-
var zNotificationRequest =
|
|
1815
|
-
notification_id:
|
|
1852
|
+
var import_zod21 = __toESM(require("zod"));
|
|
1853
|
+
var zNotificationEvent = import_zod21.default.enum(["credential_accepted", "credential_failure", "credential_deleted"]);
|
|
1854
|
+
var zNotificationRequest = import_zod21.default.object({
|
|
1855
|
+
notification_id: import_zod21.default.string(),
|
|
1816
1856
|
event: zNotificationEvent,
|
|
1817
|
-
event_description:
|
|
1857
|
+
event_description: import_zod21.default.optional(import_zod21.default.string())
|
|
1818
1858
|
}).passthrough();
|
|
1819
|
-
var zNotificationErrorResponse =
|
|
1820
|
-
error:
|
|
1859
|
+
var zNotificationErrorResponse = import_zod21.default.object({
|
|
1860
|
+
error: import_zod21.default.enum(["invalid_notification_id", "invalid_notification_request"])
|
|
1821
1861
|
}).passthrough();
|
|
1822
1862
|
|
|
1823
1863
|
// src/notification/notification.ts
|
|
@@ -2287,7 +2327,7 @@ function createDeferredCredentialResponse(options) {
|
|
|
2287
2327
|
|
|
2288
2328
|
// src/credential-request/parse-credential-request.ts
|
|
2289
2329
|
var import_utils19 = require("@openid4vc/utils");
|
|
2290
|
-
var
|
|
2330
|
+
var import_zod22 = __toESM(require("zod"));
|
|
2291
2331
|
function parseCredentialRequest(options) {
|
|
2292
2332
|
const credentialRequest = (0, import_utils19.parseWithErrorHandling)(
|
|
2293
2333
|
zCredentialRequest,
|
|
@@ -2299,7 +2339,7 @@ function parseCredentialRequest(options) {
|
|
|
2299
2339
|
if (knownProofs.success) {
|
|
2300
2340
|
proofs = knownProofs.data;
|
|
2301
2341
|
}
|
|
2302
|
-
const knownProof =
|
|
2342
|
+
const knownProof = import_zod22.default.union(allCredentialRequestProofs).safeParse(credentialRequest.proof);
|
|
2303
2343
|
if (knownProof.success && knownProof.data.proof_type === jwtProofTypeIdentifier) {
|
|
2304
2344
|
proofs = { [jwtProofTypeIdentifier]: [knownProof.data.jwt] };
|
|
2305
2345
|
} else if (knownProof.success && knownProof.data.proof_type === attestationProofTypeIdentifier) {
|
|
@@ -2333,7 +2373,7 @@ function parseCredentialRequest(options) {
|
|
|
2333
2373
|
return {
|
|
2334
2374
|
// Removes all claims that are not specific to this format
|
|
2335
2375
|
format: (0, import_utils19.parseWithErrorHandling)(
|
|
2336
|
-
|
|
2376
|
+
import_zod22.default.union(allCredentialRequestFormats),
|
|
2337
2377
|
credentialRequest,
|
|
2338
2378
|
"Unable to validate format specific properties from credential request"
|
|
2339
2379
|
),
|