@openid4vc/openid4vci 0.3.0-alpha-20250320203319 → 0.3.0-alpha-20250320210854
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.js +149 -172
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +96 -119
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -40,11 +40,11 @@ __export(src_exports, {
|
|
|
40
40
|
credentialsSupportedToCredentialConfigurationsSupported: () => credentialsSupportedToCredentialConfigurationsSupported,
|
|
41
41
|
extractScopesForCredentialConfigurationIds: () => extractScopesForCredentialConfigurationIds,
|
|
42
42
|
getCredentialConfigurationsMatchingRequestFormat: () => getCredentialConfigurationsMatchingRequestFormat,
|
|
43
|
-
getGlobalConfig: () =>
|
|
44
|
-
setGlobalConfig: () =>
|
|
43
|
+
getGlobalConfig: () => import_utils20.getGlobalConfig,
|
|
44
|
+
setGlobalConfig: () => import_utils20.setGlobalConfig
|
|
45
45
|
});
|
|
46
46
|
module.exports = __toCommonJS(src_exports);
|
|
47
|
-
var
|
|
47
|
+
var import_utils20 = require("@openid4vc/utils");
|
|
48
48
|
|
|
49
49
|
// src/credential-request/credential-request-configurations.ts
|
|
50
50
|
var import_utils4 = require("@openid4vc/utils");
|
|
@@ -712,69 +712,46 @@ var import_oauth218 = require("@openid4vc/oauth2");
|
|
|
712
712
|
|
|
713
713
|
// src/credential-offer/credential-offer.ts
|
|
714
714
|
var import_oauth26 = require("@openid4vc/oauth2");
|
|
715
|
-
var
|
|
715
|
+
var import_utils7 = require("@openid4vc/utils");
|
|
716
716
|
|
|
717
717
|
// src/credential-offer/z-credential-offer.ts
|
|
718
718
|
var import_oauth25 = require("@openid4vc/oauth2");
|
|
719
|
-
var
|
|
720
|
-
|
|
721
|
-
// ../utils/src/validation.ts
|
|
719
|
+
var import_utils6 = require("@openid4vc/utils");
|
|
722
720
|
var import_zod10 = __toESM(require("zod"));
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
};
|
|
728
|
-
function getGlobalConfig() {
|
|
729
|
-
return GLOBAL_CONFIG;
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
// ../utils/src/validation.ts
|
|
733
|
-
var zHttpsUrl2 = import_zod10.default.string().url().refine(
|
|
734
|
-
(url) => {
|
|
735
|
-
const { allowInsecureUrls } = getGlobalConfig();
|
|
736
|
-
return allowInsecureUrls ? url.startsWith("http://") || url.startsWith("https://") : url.startsWith("https://");
|
|
737
|
-
},
|
|
738
|
-
{ message: "url must be an https:// url" }
|
|
739
|
-
);
|
|
740
|
-
var zInteger2 = import_zod10.default.number().int();
|
|
741
|
-
var zHttpMethod = import_zod10.default.enum(["GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "TRACE", "CONNECT", "PATCH"]);
|
|
742
|
-
|
|
743
|
-
// src/credential-offer/z-credential-offer.ts
|
|
744
|
-
var zTxCode = import_zod11.default.object({
|
|
745
|
-
input_mode: import_zod11.default.union([import_zod11.default.literal("numeric"), import_zod11.default.literal("text")]).optional(),
|
|
746
|
-
length: import_zod11.default.number().int().optional(),
|
|
747
|
-
description: import_zod11.default.string().max(300).optional()
|
|
721
|
+
var zTxCode = import_zod10.default.object({
|
|
722
|
+
input_mode: import_zod10.default.union([import_zod10.default.literal("numeric"), import_zod10.default.literal("text")]).optional(),
|
|
723
|
+
length: import_zod10.default.number().int().optional(),
|
|
724
|
+
description: import_zod10.default.string().max(300).optional()
|
|
748
725
|
}).passthrough();
|
|
749
|
-
var zCredentialOfferGrants =
|
|
750
|
-
authorization_code:
|
|
751
|
-
issuer_state:
|
|
752
|
-
authorization_server:
|
|
726
|
+
var zCredentialOfferGrants = import_zod10.default.object({
|
|
727
|
+
authorization_code: import_zod10.default.object({
|
|
728
|
+
issuer_state: import_zod10.default.string().optional(),
|
|
729
|
+
authorization_server: import_utils6.zHttpsUrl.optional()
|
|
753
730
|
}).passthrough().optional(),
|
|
754
|
-
[import_oauth25.preAuthorizedCodeGrantIdentifier]:
|
|
755
|
-
"pre-authorized_code":
|
|
731
|
+
[import_oauth25.preAuthorizedCodeGrantIdentifier]: import_zod10.default.object({
|
|
732
|
+
"pre-authorized_code": import_zod10.default.string(),
|
|
756
733
|
tx_code: zTxCode.optional(),
|
|
757
|
-
authorization_server:
|
|
734
|
+
authorization_server: import_utils6.zHttpsUrl.optional()
|
|
758
735
|
}).passthrough().optional()
|
|
759
736
|
}).passthrough();
|
|
760
|
-
var zCredentialOfferObjectDraft14 =
|
|
761
|
-
credential_issuer:
|
|
762
|
-
credential_configuration_ids:
|
|
763
|
-
grants:
|
|
737
|
+
var zCredentialOfferObjectDraft14 = import_zod10.default.object({
|
|
738
|
+
credential_issuer: import_utils6.zHttpsUrl,
|
|
739
|
+
credential_configuration_ids: import_zod10.default.array(import_zod10.default.string()),
|
|
740
|
+
grants: import_zod10.default.optional(zCredentialOfferGrants)
|
|
764
741
|
}).passthrough();
|
|
765
|
-
var zCredentialOfferObjectDraft11To14 =
|
|
766
|
-
credential_issuer:
|
|
742
|
+
var zCredentialOfferObjectDraft11To14 = import_zod10.default.object({
|
|
743
|
+
credential_issuer: import_utils6.zHttpsUrl,
|
|
767
744
|
// We don't support the inline offer objects from draft 11
|
|
768
|
-
credentials:
|
|
769
|
-
|
|
745
|
+
credentials: import_zod10.default.array(
|
|
746
|
+
import_zod10.default.string({ message: "Only string credential identifiers are supported for draft 11 credential offers" })
|
|
770
747
|
),
|
|
771
|
-
grants:
|
|
772
|
-
|
|
748
|
+
grants: import_zod10.default.optional(
|
|
749
|
+
import_zod10.default.object({
|
|
773
750
|
// Has extra param in draft 14, but doesn't matter for transform purposes
|
|
774
751
|
authorization_code: zCredentialOfferGrants.shape.authorization_code,
|
|
775
|
-
[import_oauth25.preAuthorizedCodeGrantIdentifier]:
|
|
776
|
-
"pre-authorized_code":
|
|
777
|
-
user_pin_required:
|
|
752
|
+
[import_oauth25.preAuthorizedCodeGrantIdentifier]: import_zod10.default.object({
|
|
753
|
+
"pre-authorized_code": import_zod10.default.string(),
|
|
754
|
+
user_pin_required: import_zod10.default.optional(import_zod10.default.boolean())
|
|
778
755
|
}).passthrough().optional()
|
|
779
756
|
})
|
|
780
757
|
)
|
|
@@ -799,7 +776,7 @@ var zCredentialOfferObjectDraft11To14 = import_zod11.default.object({
|
|
|
799
776
|
}
|
|
800
777
|
return v14;
|
|
801
778
|
}).pipe(zCredentialOfferObjectDraft14);
|
|
802
|
-
var zCredentialOfferObject =
|
|
779
|
+
var zCredentialOfferObject = import_zod10.default.union([
|
|
803
780
|
// First prioritize draft 14 (and 13)
|
|
804
781
|
zCredentialOfferObjectDraft14,
|
|
805
782
|
// Then try parsing draft 11 and transform into draft 14
|
|
@@ -808,13 +785,13 @@ var zCredentialOfferObject = import_zod11.default.union([
|
|
|
808
785
|
|
|
809
786
|
// src/credential-offer/credential-offer.ts
|
|
810
787
|
async function resolveCredentialOffer(credentialOffer, options) {
|
|
811
|
-
const parsedQueryParams = (0,
|
|
788
|
+
const parsedQueryParams = (0, import_utils7.getQueryParams)(credentialOffer);
|
|
812
789
|
let credentialOfferParseResult;
|
|
813
790
|
if (parsedQueryParams.credential_offer_uri) {
|
|
814
|
-
const fetchWithZod = (0,
|
|
791
|
+
const fetchWithZod = (0, import_utils7.createZodFetcher)(options?.fetch);
|
|
815
792
|
const { response, result } = await fetchWithZod(
|
|
816
793
|
zCredentialOfferObject,
|
|
817
|
-
|
|
794
|
+
import_utils7.ContentType.Json,
|
|
818
795
|
parsedQueryParams.credential_offer_uri
|
|
819
796
|
);
|
|
820
797
|
if (!response.ok || !result) {
|
|
@@ -837,7 +814,7 @@ async function resolveCredentialOffer(credentialOffer, options) {
|
|
|
837
814
|
throw new import_oauth26.Oauth2Error(`Credential offer did not contain either 'credential_offer' or 'credential_offer_uri' param.`);
|
|
838
815
|
}
|
|
839
816
|
if (credentialOfferParseResult.error) {
|
|
840
|
-
throw new
|
|
817
|
+
throw new import_utils7.ValidationError(
|
|
841
818
|
`Error parsing credential offer in draft 11, 13 or 14 format extracted from credential offer '${credentialOffer}'`,
|
|
842
819
|
credentialOfferParseResult.error
|
|
843
820
|
);
|
|
@@ -895,7 +872,7 @@ async function createCredentialOffer(options) {
|
|
|
895
872
|
});
|
|
896
873
|
grants[import_oauth26.preAuthorizedCodeGrantIdentifier] = {
|
|
897
874
|
...preAuthorizedCodeGrant,
|
|
898
|
-
"pre-authorized_code": preAuthorizedCodeGrant["pre-authorized_code"] ?? (0,
|
|
875
|
+
"pre-authorized_code": preAuthorizedCodeGrant["pre-authorized_code"] ?? (0, import_utils7.encodeToBase64Url)(await options.callbacks.generateRandom(32))
|
|
899
876
|
};
|
|
900
877
|
const txCode = grants[import_oauth26.preAuthorizedCodeGrantIdentifier].tx_code;
|
|
901
878
|
if (txCode && options.issuerMetadata.originalDraftVersion === "Draft11" /* Draft11 */) {
|
|
@@ -911,7 +888,7 @@ async function createCredentialOffer(options) {
|
|
|
911
888
|
);
|
|
912
889
|
}
|
|
913
890
|
const credentialOfferScheme = options.credentialOfferScheme ?? "openid-credential-offer://";
|
|
914
|
-
const credentialOfferObject = (0,
|
|
891
|
+
const credentialOfferObject = (0, import_utils7.parseWithErrorHandling)(zCredentialOfferObject, {
|
|
915
892
|
credential_issuer: options.issuerMetadata.credentialIssuer.credential_issuer,
|
|
916
893
|
credential_configuration_ids: options.credentialConfigurationIds,
|
|
917
894
|
grants,
|
|
@@ -920,10 +897,10 @@ async function createCredentialOffer(options) {
|
|
|
920
897
|
if (options.issuerMetadata.originalDraftVersion === "Draft11" /* Draft11 */) {
|
|
921
898
|
credentialOfferObject.credentials = credentialOfferObject.credential_configuration_ids;
|
|
922
899
|
}
|
|
923
|
-
const url = new
|
|
924
|
-
url.search = `?${new
|
|
900
|
+
const url = new import_utils7.URL(credentialOfferScheme);
|
|
901
|
+
url.search = `?${new import_utils7.URLSearchParams([
|
|
925
902
|
...url.searchParams.entries(),
|
|
926
|
-
...(0,
|
|
903
|
+
...(0, import_utils7.objectToQueryParams)({
|
|
927
904
|
credential_offer_uri: options.credentialOfferUri,
|
|
928
905
|
// Only add credential_offer is uri is undefined
|
|
929
906
|
credential_offer: options.credentialOfferUri ? void 0 : credentialOfferObject
|
|
@@ -936,7 +913,7 @@ async function createCredentialOffer(options) {
|
|
|
936
913
|
}
|
|
937
914
|
|
|
938
915
|
// src/credential-request/format-payload.ts
|
|
939
|
-
var
|
|
916
|
+
var import_utils8 = require("@openid4vc/utils");
|
|
940
917
|
function getCredentialRequestFormatPayloadForCredentialConfigurationId(options) {
|
|
941
918
|
const credentialConfiguration = options.issuerMetadata.credentialIssuer.credential_configurations_supported[options.credentialConfigurationId];
|
|
942
919
|
if (!credentialConfiguration) {
|
|
@@ -944,19 +921,19 @@ function getCredentialRequestFormatPayloadForCredentialConfigurationId(options)
|
|
|
944
921
|
`Could not find credential configuration with id '${options.credentialConfigurationId}' in metadata of credential issuer '${options.issuerMetadata.credentialIssuer.credential_issuer}'.`
|
|
945
922
|
);
|
|
946
923
|
}
|
|
947
|
-
if ((0,
|
|
924
|
+
if ((0, import_utils8.zIs)(zSdJwtVcCredentialIssuerMetadata, credentialConfiguration)) {
|
|
948
925
|
return {
|
|
949
926
|
format: credentialConfiguration.format,
|
|
950
927
|
vct: credentialConfiguration.vct
|
|
951
928
|
};
|
|
952
929
|
}
|
|
953
|
-
if ((0,
|
|
930
|
+
if ((0, import_utils8.zIs)(zMsoMdocCredentialIssuerMetadata, credentialConfiguration)) {
|
|
954
931
|
return {
|
|
955
932
|
format: credentialConfiguration.format,
|
|
956
933
|
doctype: credentialConfiguration.doctype
|
|
957
934
|
};
|
|
958
935
|
}
|
|
959
|
-
if ((0,
|
|
936
|
+
if ((0, import_utils8.zIs)(zLdpVcCredentialIssuerMetadata, credentialConfiguration)) {
|
|
960
937
|
return {
|
|
961
938
|
format: credentialConfiguration.format,
|
|
962
939
|
credential_definition: {
|
|
@@ -965,7 +942,7 @@ function getCredentialRequestFormatPayloadForCredentialConfigurationId(options)
|
|
|
965
942
|
}
|
|
966
943
|
};
|
|
967
944
|
}
|
|
968
|
-
if ((0,
|
|
945
|
+
if ((0, import_utils8.zIs)(zJwtVcJsonLdCredentialIssuerMetadata, credentialConfiguration)) {
|
|
969
946
|
return {
|
|
970
947
|
format: credentialConfiguration.format,
|
|
971
948
|
credential_definition: {
|
|
@@ -974,7 +951,7 @@ function getCredentialRequestFormatPayloadForCredentialConfigurationId(options)
|
|
|
974
951
|
}
|
|
975
952
|
};
|
|
976
953
|
}
|
|
977
|
-
if ((0,
|
|
954
|
+
if ((0, import_utils8.zIs)(zJwtVcJsonCredentialIssuerMetadata, credentialConfiguration)) {
|
|
978
955
|
return {
|
|
979
956
|
format: credentialConfiguration.format,
|
|
980
957
|
credential_definition: {
|
|
@@ -989,77 +966,77 @@ function getCredentialRequestFormatPayloadForCredentialConfigurationId(options)
|
|
|
989
966
|
|
|
990
967
|
// src/credential-request/retrieve-credentials.ts
|
|
991
968
|
var import_oauth210 = require("@openid4vc/oauth2");
|
|
992
|
-
var
|
|
969
|
+
var import_utils10 = require("@openid4vc/utils");
|
|
993
970
|
|
|
994
971
|
// src/credential-request/z-credential-request.ts
|
|
995
|
-
var
|
|
972
|
+
var import_zod14 = __toESM(require("zod"));
|
|
996
973
|
|
|
997
974
|
// src/credential-request/z-credential-request-common.ts
|
|
998
975
|
var import_oauth29 = require("@openid4vc/oauth2");
|
|
999
|
-
var
|
|
976
|
+
var import_zod13 = __toESM(require("zod"));
|
|
1000
977
|
|
|
1001
978
|
// src/formats/proof-type/jwt/z-jwt-proof-type.ts
|
|
1002
979
|
var import_oauth27 = require("@openid4vc/oauth2");
|
|
1003
|
-
var
|
|
1004
|
-
var
|
|
1005
|
-
var zJwtProofTypeIdentifier =
|
|
980
|
+
var import_utils9 = require("@openid4vc/utils");
|
|
981
|
+
var import_zod11 = __toESM(require("zod"));
|
|
982
|
+
var zJwtProofTypeIdentifier = import_zod11.default.literal("jwt");
|
|
1006
983
|
var jwtProofTypeIdentifier = zJwtProofTypeIdentifier.value;
|
|
1007
|
-
var zCredentialRequestProofJwt =
|
|
984
|
+
var zCredentialRequestProofJwt = import_zod11.default.object({
|
|
1008
985
|
proof_type: zJwtProofTypeIdentifier,
|
|
1009
986
|
jwt: import_oauth27.zCompactJwt
|
|
1010
987
|
});
|
|
1011
988
|
var zCredentialRequestJwtProofTypeHeader = import_oauth27.zJwtHeader.merge(
|
|
1012
|
-
|
|
1013
|
-
key_attestation:
|
|
1014
|
-
typ:
|
|
989
|
+
import_zod11.default.object({
|
|
990
|
+
key_attestation: import_zod11.default.optional(import_oauth27.zCompactJwt),
|
|
991
|
+
typ: import_zod11.default.literal("openid4vci-proof+jwt")
|
|
1015
992
|
})
|
|
1016
993
|
).passthrough().refine(({ kid, jwk }) => jwk === void 0 || kid === void 0, {
|
|
1017
994
|
message: `Both 'jwk' and 'kid' are defined. Only one is allowed`
|
|
1018
995
|
}).refine(({ trust_chain, kid }) => !trust_chain || !kid, {
|
|
1019
996
|
message: `When 'trust_chain' is provided, 'kid' is required`
|
|
1020
997
|
});
|
|
1021
|
-
var zCredentialRequestJwtProofTypePayload =
|
|
998
|
+
var zCredentialRequestJwtProofTypePayload = import_zod11.default.object({
|
|
1022
999
|
...import_oauth27.zJwtPayload.shape,
|
|
1023
|
-
aud:
|
|
1024
|
-
iat:
|
|
1000
|
+
aud: import_utils9.zHttpsUrl,
|
|
1001
|
+
iat: import_utils9.zInteger
|
|
1025
1002
|
}).passthrough();
|
|
1026
1003
|
|
|
1027
1004
|
// src/formats/proof-type/attestation/z-attestation-proof-type.ts
|
|
1028
1005
|
var import_oauth28 = require("@openid4vc/oauth2");
|
|
1029
|
-
var
|
|
1030
|
-
var zAttestationProofTypeIdentifier =
|
|
1006
|
+
var import_zod12 = __toESM(require("zod"));
|
|
1007
|
+
var zAttestationProofTypeIdentifier = import_zod12.default.literal("attestation");
|
|
1031
1008
|
var attestationProofTypeIdentifier = zAttestationProofTypeIdentifier.value;
|
|
1032
|
-
var zCredentialRequestProofAttestation =
|
|
1009
|
+
var zCredentialRequestProofAttestation = import_zod12.default.object({
|
|
1033
1010
|
proof_type: zAttestationProofTypeIdentifier,
|
|
1034
1011
|
attestation: import_oauth28.zCompactJwt
|
|
1035
1012
|
});
|
|
1036
1013
|
var zCredentialRequestAttestationProofTypePayload = zKeyAttestationJwtPayloadForUse("proof_type.attestation");
|
|
1037
1014
|
|
|
1038
1015
|
// src/credential-request/z-credential-request-common.ts
|
|
1039
|
-
var zCredentialRequestProofCommon =
|
|
1040
|
-
proof_type:
|
|
1016
|
+
var zCredentialRequestProofCommon = import_zod13.default.object({
|
|
1017
|
+
proof_type: import_zod13.default.string()
|
|
1041
1018
|
}).passthrough();
|
|
1042
1019
|
var allCredentialRequestProofs = [zCredentialRequestProofJwt, zCredentialRequestProofAttestation];
|
|
1043
|
-
var zCredentialRequestProof =
|
|
1020
|
+
var zCredentialRequestProof = import_zod13.default.union([
|
|
1044
1021
|
zCredentialRequestProofCommon,
|
|
1045
|
-
|
|
1022
|
+
import_zod13.default.discriminatedUnion("proof_type", allCredentialRequestProofs)
|
|
1046
1023
|
]);
|
|
1047
|
-
var zCredentialRequestProofsCommon =
|
|
1048
|
-
var zCredentialRequestProofs =
|
|
1049
|
-
[zJwtProofTypeIdentifier.value]:
|
|
1050
|
-
[zAttestationProofTypeIdentifier.value]:
|
|
1024
|
+
var zCredentialRequestProofsCommon = import_zod13.default.record(import_zod13.default.string(), import_zod13.default.array(import_zod13.default.unknown()));
|
|
1025
|
+
var zCredentialRequestProofs = import_zod13.default.object({
|
|
1026
|
+
[zJwtProofTypeIdentifier.value]: import_zod13.default.optional(import_zod13.default.array(zCredentialRequestProofJwt.shape.jwt)),
|
|
1027
|
+
[zAttestationProofTypeIdentifier.value]: import_zod13.default.optional(import_zod13.default.array(zCredentialRequestProofAttestation.shape.attestation))
|
|
1051
1028
|
});
|
|
1052
|
-
var zCredentialRequestCommon =
|
|
1029
|
+
var zCredentialRequestCommon = import_zod13.default.object({
|
|
1053
1030
|
proof: zCredentialRequestProof.optional(),
|
|
1054
|
-
proofs:
|
|
1055
|
-
|
|
1031
|
+
proofs: import_zod13.default.optional(
|
|
1032
|
+
import_zod13.default.intersection(zCredentialRequestProofsCommon, zCredentialRequestProofs).refine((proofs) => Object.values(proofs).length === 1, {
|
|
1056
1033
|
message: `The 'proofs' object in a credential request should contain exactly one attribute`
|
|
1057
1034
|
})
|
|
1058
1035
|
),
|
|
1059
|
-
credential_response_encryption:
|
|
1036
|
+
credential_response_encryption: import_zod13.default.object({
|
|
1060
1037
|
jwk: import_oauth29.zJwk,
|
|
1061
|
-
alg:
|
|
1062
|
-
enc:
|
|
1038
|
+
alg: import_zod13.default.string(),
|
|
1039
|
+
enc: import_zod13.default.string()
|
|
1063
1040
|
}).passthrough().optional()
|
|
1064
1041
|
}).passthrough().refine(({ proof, proofs }) => !(proof !== void 0 && proofs !== void 0), {
|
|
1065
1042
|
message: `Both 'proof' and 'proofs' are defined. Only one is allowed`
|
|
@@ -1076,27 +1053,27 @@ var allCredentialRequestFormats = [
|
|
|
1076
1053
|
var allCredentialRequestFormatIdentifiers = allCredentialRequestFormats.map(
|
|
1077
1054
|
(format) => format.shape.format.value
|
|
1078
1055
|
);
|
|
1079
|
-
var zAuthorizationDetailsCredentialRequest =
|
|
1080
|
-
credential_identifier:
|
|
1056
|
+
var zAuthorizationDetailsCredentialRequest = import_zod14.default.object({
|
|
1057
|
+
credential_identifier: import_zod14.default.string(),
|
|
1081
1058
|
// Cannot be present if credential identifier is present
|
|
1082
|
-
format:
|
|
1059
|
+
format: import_zod14.default.never({ message: "'format' cannot be defined when 'credential_identifier' is set." }).optional()
|
|
1083
1060
|
});
|
|
1084
|
-
var zCredentialRequestFormatNoCredentialIdentifier =
|
|
1085
|
-
format:
|
|
1086
|
-
credential_identifier:
|
|
1061
|
+
var zCredentialRequestFormatNoCredentialIdentifier = import_zod14.default.object({
|
|
1062
|
+
format: import_zod14.default.string(),
|
|
1063
|
+
credential_identifier: import_zod14.default.never({ message: "'credential_identifier' cannot be defined when 'format' is set." }).optional()
|
|
1087
1064
|
}).passthrough();
|
|
1088
1065
|
var zCredenialRequestDraft14WithFormat = zCredentialRequestCommon.and(zCredentialRequestFormatNoCredentialIdentifier).transform((data, ctx) => {
|
|
1089
1066
|
if (!allCredentialRequestFormatIdentifiers.includes(data.format)) return data;
|
|
1090
|
-
const result =
|
|
1067
|
+
const result = import_zod14.default.object({}).passthrough().and(import_zod14.default.discriminatedUnion("format", allCredentialRequestFormats)).safeParse(data);
|
|
1091
1068
|
if (result.success) {
|
|
1092
1069
|
return result.data;
|
|
1093
1070
|
}
|
|
1094
1071
|
for (const issue of result.error.issues) {
|
|
1095
1072
|
ctx.addIssue(issue);
|
|
1096
1073
|
}
|
|
1097
|
-
return
|
|
1074
|
+
return import_zod14.default.NEVER;
|
|
1098
1075
|
});
|
|
1099
|
-
var zCredentialRequestDraft14 =
|
|
1076
|
+
var zCredentialRequestDraft14 = import_zod14.default.union([
|
|
1100
1077
|
zCredenialRequestDraft14WithFormat,
|
|
1101
1078
|
zCredentialRequestCommon.and(zAuthorizationDetailsCredentialRequest)
|
|
1102
1079
|
]);
|
|
@@ -1113,7 +1090,7 @@ var zCredentialRequestDraft11To14 = zCredentialRequestCommon.and(zCredentialRequ
|
|
|
1113
1090
|
for (const issue of result.error.issues) {
|
|
1114
1091
|
ctx.addIssue(issue);
|
|
1115
1092
|
}
|
|
1116
|
-
return
|
|
1093
|
+
return import_zod14.default.NEVER;
|
|
1117
1094
|
}).pipe(zCredentialRequestDraft14);
|
|
1118
1095
|
var zCredentialRequestDraft14To11 = zCredentialRequestDraft14.refine(
|
|
1119
1096
|
(data) => data.credential_identifier === void 0,
|
|
@@ -1131,15 +1108,15 @@ var zCredentialRequestDraft14To11 = zCredentialRequestDraft14.refine(
|
|
|
1131
1108
|
for (const issue of result.error.issues) {
|
|
1132
1109
|
ctx.addIssue(issue);
|
|
1133
1110
|
}
|
|
1134
|
-
return
|
|
1111
|
+
return import_zod14.default.NEVER;
|
|
1135
1112
|
});
|
|
1136
|
-
var zCredentialRequest =
|
|
1113
|
+
var zCredentialRequest = import_zod14.default.union([zCredentialRequestDraft14, zCredentialRequestDraft11To14]);
|
|
1137
1114
|
|
|
1138
1115
|
// src/credential-request/z-credential-response.ts
|
|
1139
|
-
var
|
|
1116
|
+
var import_zod16 = __toESM(require("zod"));
|
|
1140
1117
|
|
|
1141
1118
|
// ../oauth2/src/common/z-oauth2-error.ts
|
|
1142
|
-
var
|
|
1119
|
+
var import_zod15 = __toESM(require("zod"));
|
|
1143
1120
|
var Oauth2ErrorCodes = /* @__PURE__ */ ((Oauth2ErrorCodes4) => {
|
|
1144
1121
|
Oauth2ErrorCodes4["ServerError"] = "server_error";
|
|
1145
1122
|
Oauth2ErrorCodes4["InvalidTarget"] = "invalid_target";
|
|
@@ -1176,21 +1153,21 @@ var Oauth2ErrorCodes = /* @__PURE__ */ ((Oauth2ErrorCodes4) => {
|
|
|
1176
1153
|
Oauth2ErrorCodes4["WalletUnavailable"] = "wallet_unavailable";
|
|
1177
1154
|
return Oauth2ErrorCodes4;
|
|
1178
1155
|
})(Oauth2ErrorCodes || {});
|
|
1179
|
-
var zOauth2ErrorResponse =
|
|
1180
|
-
error:
|
|
1181
|
-
error_description:
|
|
1182
|
-
error_uri:
|
|
1156
|
+
var zOauth2ErrorResponse = import_zod15.default.object({
|
|
1157
|
+
error: import_zod15.default.union([import_zod15.default.nativeEnum(Oauth2ErrorCodes), import_zod15.default.string()]),
|
|
1158
|
+
error_description: import_zod15.default.string().optional(),
|
|
1159
|
+
error_uri: import_zod15.default.string().optional()
|
|
1183
1160
|
}).passthrough();
|
|
1184
1161
|
|
|
1185
1162
|
// src/credential-request/z-credential-response.ts
|
|
1186
|
-
var zCredentialEncoding =
|
|
1187
|
-
var zCredentialResponse =
|
|
1188
|
-
credential:
|
|
1189
|
-
credentials:
|
|
1190
|
-
transaction_id:
|
|
1191
|
-
c_nonce:
|
|
1192
|
-
c_nonce_expires_in:
|
|
1193
|
-
notification_id:
|
|
1163
|
+
var zCredentialEncoding = import_zod16.default.union([import_zod16.default.string(), import_zod16.default.record(import_zod16.default.string(), import_zod16.default.any())]);
|
|
1164
|
+
var zCredentialResponse = import_zod16.default.object({
|
|
1165
|
+
credential: import_zod16.default.optional(zCredentialEncoding),
|
|
1166
|
+
credentials: import_zod16.default.optional(import_zod16.default.array(zCredentialEncoding)),
|
|
1167
|
+
transaction_id: import_zod16.default.string().optional(),
|
|
1168
|
+
c_nonce: import_zod16.default.string().optional(),
|
|
1169
|
+
c_nonce_expires_in: import_zod16.default.number().int().optional(),
|
|
1170
|
+
notification_id: import_zod16.default.string().optional()
|
|
1194
1171
|
}).passthrough().refine(
|
|
1195
1172
|
(value) => {
|
|
1196
1173
|
const { credential, credentials, transaction_id } = value;
|
|
@@ -1200,10 +1177,10 @@ var zCredentialResponse = import_zod17.default.object({
|
|
|
1200
1177
|
message: `Exactly one of 'credential', 'credentials', or 'transaction_id' MUST be defined.`
|
|
1201
1178
|
}
|
|
1202
1179
|
);
|
|
1203
|
-
var zCredentialErrorResponse =
|
|
1180
|
+
var zCredentialErrorResponse = import_zod16.default.object({
|
|
1204
1181
|
...zOauth2ErrorResponse.shape,
|
|
1205
|
-
c_nonce:
|
|
1206
|
-
c_nonce_expires_in:
|
|
1182
|
+
c_nonce: import_zod16.default.string().optional(),
|
|
1183
|
+
c_nonce_expires_in: import_zod16.default.number().int().optional()
|
|
1207
1184
|
}).passthrough();
|
|
1208
1185
|
|
|
1209
1186
|
// src/credential-request/retrieve-credentials.ts
|
|
@@ -1224,7 +1201,7 @@ async function retrieveCredentialsWithFormat(options) {
|
|
|
1224
1201
|
}
|
|
1225
1202
|
async function retrieveCredentials(options) {
|
|
1226
1203
|
const credentialEndpoint = options.issuerMetadata.credentialIssuer.credential_endpoint;
|
|
1227
|
-
let credentialRequest = (0,
|
|
1204
|
+
let credentialRequest = (0, import_utils10.parseWithErrorHandling)(
|
|
1228
1205
|
zCredentialRequest,
|
|
1229
1206
|
options.credentialRequest,
|
|
1230
1207
|
"Error validating credential request"
|
|
@@ -1244,7 +1221,7 @@ async function retrieveCredentials(options) {
|
|
|
1244
1221
|
}
|
|
1245
1222
|
}
|
|
1246
1223
|
if (options.issuerMetadata.originalDraftVersion === "Draft11" /* Draft11 */) {
|
|
1247
|
-
credentialRequest = (0,
|
|
1224
|
+
credentialRequest = (0, import_utils10.parseWithErrorHandling)(
|
|
1248
1225
|
zCredentialRequestDraft14To11,
|
|
1249
1226
|
credentialRequest,
|
|
1250
1227
|
`Error transforming credential request from ${"Draft14" /* Draft14 */} to ${"Draft11" /* Draft11 */}`
|
|
@@ -1258,19 +1235,19 @@ async function retrieveCredentials(options) {
|
|
|
1258
1235
|
requestOptions: {
|
|
1259
1236
|
method: "POST",
|
|
1260
1237
|
headers: {
|
|
1261
|
-
"Content-Type":
|
|
1238
|
+
"Content-Type": import_utils10.ContentType.Json
|
|
1262
1239
|
},
|
|
1263
1240
|
body: JSON.stringify(credentialRequest)
|
|
1264
1241
|
}
|
|
1265
1242
|
});
|
|
1266
1243
|
if (!resourceResponse.ok) {
|
|
1267
|
-
const credentialErrorResponseResult = (0,
|
|
1244
|
+
const credentialErrorResponseResult = (0, import_utils10.isResponseContentType)(import_utils10.ContentType.Json, resourceResponse.response) ? zCredentialErrorResponse.safeParse(await resourceResponse.response.clone().json()) : void 0;
|
|
1268
1245
|
return {
|
|
1269
1246
|
...resourceResponse,
|
|
1270
1247
|
credentialErrorResponseResult
|
|
1271
1248
|
};
|
|
1272
1249
|
}
|
|
1273
|
-
const credentialResponseResult = (0,
|
|
1250
|
+
const credentialResponseResult = (0, import_utils10.isResponseContentType)(import_utils10.ContentType.Json, resourceResponse.response) ? zCredentialResponse.safeParse(await resourceResponse.response.clone().json()) : void 0;
|
|
1274
1251
|
if (!credentialResponseResult?.success) {
|
|
1275
1252
|
return {
|
|
1276
1253
|
...resourceResponse,
|
|
@@ -1287,12 +1264,12 @@ async function retrieveCredentials(options) {
|
|
|
1287
1264
|
// src/formats/proof-type/jwt/jwt-proof-type.ts
|
|
1288
1265
|
var import_oauth213 = require("@openid4vc/oauth2");
|
|
1289
1266
|
var import_oauth214 = require("@openid4vc/oauth2");
|
|
1290
|
-
var
|
|
1267
|
+
var import_utils12 = require("@openid4vc/utils");
|
|
1291
1268
|
|
|
1292
1269
|
// src/key-attestation/key-attestation.ts
|
|
1293
1270
|
var import_oauth211 = require("@openid4vc/oauth2");
|
|
1294
1271
|
var import_oauth212 = require("@openid4vc/oauth2");
|
|
1295
|
-
var
|
|
1272
|
+
var import_utils11 = require("@openid4vc/utils");
|
|
1296
1273
|
async function verifyKeyAttestationJwt(options) {
|
|
1297
1274
|
const { header, payload } = (0, import_oauth211.decodeJwt)({
|
|
1298
1275
|
jwt: options.keyAttestationJwt,
|
|
@@ -1322,15 +1299,15 @@ async function verifyKeyAttestationJwt(options) {
|
|
|
1322
1299
|
|
|
1323
1300
|
// src/formats/proof-type/jwt/jwt-proof-type.ts
|
|
1324
1301
|
async function createCredentialRequestJwtProof(options) {
|
|
1325
|
-
const header = (0,
|
|
1302
|
+
const header = (0, import_utils12.parseWithErrorHandling)(zCredentialRequestJwtProofTypeHeader, {
|
|
1326
1303
|
...(0, import_oauth213.jwtHeaderFromJwtSigner)(options.signer),
|
|
1327
1304
|
key_attestation: options.keyAttestationJwt,
|
|
1328
1305
|
typ: "openid4vci-proof+jwt"
|
|
1329
1306
|
});
|
|
1330
|
-
const payload = (0,
|
|
1307
|
+
const payload = (0, import_utils12.parseWithErrorHandling)(zCredentialRequestJwtProofTypePayload, {
|
|
1331
1308
|
nonce: options.nonce,
|
|
1332
1309
|
aud: options.credentialIssuer,
|
|
1333
|
-
iat: (0,
|
|
1310
|
+
iat: (0, import_utils12.dateToSeconds)(options.issuedAt),
|
|
1334
1311
|
iss: options.clientId
|
|
1335
1312
|
});
|
|
1336
1313
|
const { jwt, signerJwk } = await options.callbacks.signJwt(options.signer, { header, payload });
|
|
@@ -1403,7 +1380,7 @@ async function verifyCredentialRequestJwtProof(options) {
|
|
|
1403
1380
|
|
|
1404
1381
|
// src/metadata/fetch-issuer-metadata.ts
|
|
1405
1382
|
var import_oauth215 = require("@openid4vc/oauth2");
|
|
1406
|
-
var
|
|
1383
|
+
var import_utils13 = require("@openid4vc/utils");
|
|
1407
1384
|
async function resolveIssuerMetadata(credentialIssuer, options) {
|
|
1408
1385
|
const allowAuthorizationMetadataFromCredentialIssuerMetadata = options?.allowAuthorizationMetadataFromCredentialIssuerMetadata ?? true;
|
|
1409
1386
|
const credentialIssuerMetadataWithDraftVersion = await fetchCredentialIssuerMetadata(credentialIssuer, options?.fetch);
|
|
@@ -1419,7 +1396,7 @@ async function resolveIssuerMetadata(credentialIssuer, options) {
|
|
|
1419
1396
|
}
|
|
1420
1397
|
let authorizationServerMetadata = await (0, import_oauth215.fetchAuthorizationServerMetadata)(authorizationServer, options?.fetch);
|
|
1421
1398
|
if (!authorizationServerMetadata && authorizationServer === credentialIssuer && allowAuthorizationMetadataFromCredentialIssuerMetadata) {
|
|
1422
|
-
authorizationServerMetadata = (0,
|
|
1399
|
+
authorizationServerMetadata = (0, import_utils13.parseWithErrorHandling)(
|
|
1423
1400
|
import_oauth215.zAuthorizationServerMetadata,
|
|
1424
1401
|
{
|
|
1425
1402
|
token_endpoint: credentialIssuerMetadata.token_endpoint,
|
|
@@ -1444,26 +1421,26 @@ async function resolveIssuerMetadata(credentialIssuer, options) {
|
|
|
1444
1421
|
|
|
1445
1422
|
// src/nonce/nonce-request.ts
|
|
1446
1423
|
var import_oauth216 = require("@openid4vc/oauth2");
|
|
1447
|
-
var
|
|
1424
|
+
var import_utils15 = require("@openid4vc/utils");
|
|
1448
1425
|
|
|
1449
1426
|
// src/nonce/z-nonce.ts
|
|
1450
|
-
var
|
|
1451
|
-
var
|
|
1452
|
-
var zNonceResponse =
|
|
1453
|
-
c_nonce:
|
|
1454
|
-
c_nonce_expires_in:
|
|
1427
|
+
var import_utils14 = require("@openid4vc/utils");
|
|
1428
|
+
var import_zod17 = __toESM(require("zod"));
|
|
1429
|
+
var zNonceResponse = import_zod17.default.object({
|
|
1430
|
+
c_nonce: import_zod17.default.string(),
|
|
1431
|
+
c_nonce_expires_in: import_zod17.default.optional(import_utils14.zInteger)
|
|
1455
1432
|
}).passthrough();
|
|
1456
1433
|
|
|
1457
1434
|
// src/nonce/nonce-request.ts
|
|
1458
1435
|
async function requestNonce(options) {
|
|
1459
|
-
const fetchWithZod = (0,
|
|
1436
|
+
const fetchWithZod = (0, import_utils15.createZodFetcher)(options?.fetch);
|
|
1460
1437
|
const nonceEndpoint = options.issuerMetadata.credentialIssuer.nonce_endpoint;
|
|
1461
1438
|
if (!nonceEndpoint) {
|
|
1462
1439
|
throw new Openid4vciError(
|
|
1463
1440
|
`Credential issuer '${options.issuerMetadata.credentialIssuer.credential_issuer}' does not have a nonce endpoint.`
|
|
1464
1441
|
);
|
|
1465
1442
|
}
|
|
1466
|
-
const { response, result } = await fetchWithZod(zNonceResponse,
|
|
1443
|
+
const { response, result } = await fetchWithZod(zNonceResponse, import_utils15.ContentType.Json, nonceEndpoint, {
|
|
1467
1444
|
method: "POST"
|
|
1468
1445
|
});
|
|
1469
1446
|
if (!response.ok || !result) {
|
|
@@ -1474,12 +1451,12 @@ async function requestNonce(options) {
|
|
|
1474
1451
|
);
|
|
1475
1452
|
}
|
|
1476
1453
|
if (!result.success) {
|
|
1477
|
-
throw new
|
|
1454
|
+
throw new import_utils15.ValidationError("Error parsing nonce response", result.error);
|
|
1478
1455
|
}
|
|
1479
1456
|
return result.data;
|
|
1480
1457
|
}
|
|
1481
1458
|
function createNonceResponse(options) {
|
|
1482
|
-
return (0,
|
|
1459
|
+
return (0, import_utils15.parseWithErrorHandling)(zNonceResponse, {
|
|
1483
1460
|
c_nonce: options.cNonce,
|
|
1484
1461
|
c_nonce_expires_in: options.cNonceExpiresIn,
|
|
1485
1462
|
...options.additionalPayload
|
|
@@ -1488,18 +1465,18 @@ function createNonceResponse(options) {
|
|
|
1488
1465
|
|
|
1489
1466
|
// src/notification/notification.ts
|
|
1490
1467
|
var import_oauth217 = require("@openid4vc/oauth2");
|
|
1491
|
-
var
|
|
1468
|
+
var import_utils16 = require("@openid4vc/utils");
|
|
1492
1469
|
|
|
1493
1470
|
// src/notification/z-notification.ts
|
|
1494
|
-
var
|
|
1495
|
-
var zNotificationEvent =
|
|
1496
|
-
var zNotificationRequest =
|
|
1497
|
-
notification_id:
|
|
1471
|
+
var import_zod18 = __toESM(require("zod"));
|
|
1472
|
+
var zNotificationEvent = import_zod18.default.enum(["credential_accepted", "credential_failure", "credential_deleted"]);
|
|
1473
|
+
var zNotificationRequest = import_zod18.default.object({
|
|
1474
|
+
notification_id: import_zod18.default.string(),
|
|
1498
1475
|
event: zNotificationEvent,
|
|
1499
|
-
event_description:
|
|
1476
|
+
event_description: import_zod18.default.optional(import_zod18.default.string())
|
|
1500
1477
|
}).passthrough();
|
|
1501
|
-
var zNotificationErrorResponse =
|
|
1502
|
-
error:
|
|
1478
|
+
var zNotificationErrorResponse = import_zod18.default.object({
|
|
1479
|
+
error: import_zod18.default.enum(["invalid_notification_id", "invalid_notification_request"])
|
|
1503
1480
|
}).passthrough();
|
|
1504
1481
|
|
|
1505
1482
|
// src/notification/notification.ts
|
|
@@ -1510,7 +1487,7 @@ async function sendNotifcation(options) {
|
|
|
1510
1487
|
`Credential issuer '${options.issuerMetadata.credentialIssuer.credential_issuer}' does not have a notification endpiont configured.`
|
|
1511
1488
|
);
|
|
1512
1489
|
}
|
|
1513
|
-
const notificationRequest = (0,
|
|
1490
|
+
const notificationRequest = (0, import_utils16.parseWithErrorHandling)(
|
|
1514
1491
|
zNotificationRequest,
|
|
1515
1492
|
{
|
|
1516
1493
|
event: options.notification.event,
|
|
@@ -1527,13 +1504,13 @@ async function sendNotifcation(options) {
|
|
|
1527
1504
|
requestOptions: {
|
|
1528
1505
|
method: "POST",
|
|
1529
1506
|
headers: {
|
|
1530
|
-
"Content-Type":
|
|
1507
|
+
"Content-Type": import_utils16.ContentType.Json
|
|
1531
1508
|
},
|
|
1532
1509
|
body: JSON.stringify(notificationRequest)
|
|
1533
1510
|
}
|
|
1534
1511
|
});
|
|
1535
1512
|
if (!resourceResponse.ok) {
|
|
1536
|
-
const notificationErrorResponseResult = (0,
|
|
1513
|
+
const notificationErrorResponseResult = (0, import_utils16.isResponseContentType)(import_utils16.ContentType.Json, resourceResponse.response) ? zNotificationErrorResponse.safeParse(await resourceResponse.response.clone().json()) : void 0;
|
|
1537
1514
|
return {
|
|
1538
1515
|
...resourceResponse,
|
|
1539
1516
|
notificationErrorResponseResult
|
|
@@ -1909,12 +1886,12 @@ var Openid4vciClient = class {
|
|
|
1909
1886
|
|
|
1910
1887
|
// src/Openid4vciIssuer.ts
|
|
1911
1888
|
var import_oauth219 = require("@openid4vc/oauth2");
|
|
1912
|
-
var
|
|
1889
|
+
var import_utils19 = require("@openid4vc/utils");
|
|
1913
1890
|
|
|
1914
1891
|
// src/credential-request/credential-response.ts
|
|
1915
|
-
var
|
|
1892
|
+
var import_utils17 = require("@openid4vc/utils");
|
|
1916
1893
|
function createCredentialResponse(options) {
|
|
1917
|
-
const credentialResponse = (0,
|
|
1894
|
+
const credentialResponse = (0, import_utils17.parseWithErrorHandling)(zCredentialResponse, {
|
|
1918
1895
|
c_nonce: options.cNonce,
|
|
1919
1896
|
c_nonce_expires_in: options.cNonceExpiresInSeconds,
|
|
1920
1897
|
credential: options.credential,
|
|
@@ -1929,10 +1906,10 @@ function createCredentialResponse(options) {
|
|
|
1929
1906
|
}
|
|
1930
1907
|
|
|
1931
1908
|
// src/credential-request/parse-credential-request.ts
|
|
1932
|
-
var
|
|
1933
|
-
var
|
|
1909
|
+
var import_utils18 = require("@openid4vc/utils");
|
|
1910
|
+
var import_zod19 = __toESM(require("zod"));
|
|
1934
1911
|
function parseCredentialRequest(options) {
|
|
1935
|
-
const credentialRequest = (0,
|
|
1912
|
+
const credentialRequest = (0, import_utils18.parseWithErrorHandling)(
|
|
1936
1913
|
zCredentialRequest,
|
|
1937
1914
|
options.credentialRequest,
|
|
1938
1915
|
"Error validating credential request"
|
|
@@ -1942,7 +1919,7 @@ function parseCredentialRequest(options) {
|
|
|
1942
1919
|
if (knownProofs.success) {
|
|
1943
1920
|
proofs = knownProofs.data;
|
|
1944
1921
|
}
|
|
1945
|
-
const knownProof =
|
|
1922
|
+
const knownProof = import_zod19.default.union(allCredentialRequestProofs).safeParse(credentialRequest.proof);
|
|
1946
1923
|
if (knownProof.success && knownProof.data.proof_type === jwtProofTypeIdentifier) {
|
|
1947
1924
|
proofs = { [jwtProofTypeIdentifier]: [knownProof.data.jwt] };
|
|
1948
1925
|
} else if (knownProof.success && knownProof.data.proof_type === attestationProofTypeIdentifier) {
|
|
@@ -1958,8 +1935,8 @@ function parseCredentialRequest(options) {
|
|
|
1958
1935
|
if (credentialRequest.format && allCredentialRequestFormatIdentifiers.includes(credentialRequest.format)) {
|
|
1959
1936
|
return {
|
|
1960
1937
|
// Removes all claims that are not specific to this format
|
|
1961
|
-
format: (0,
|
|
1962
|
-
|
|
1938
|
+
format: (0, import_utils18.parseWithErrorHandling)(
|
|
1939
|
+
import_zod19.default.union(allCredentialRequestFormats),
|
|
1963
1940
|
credentialRequest,
|
|
1964
1941
|
"Unable to validate format specific properties from credential request"
|
|
1965
1942
|
),
|
|
@@ -1988,7 +1965,7 @@ var Openid4vciIssuer = class {
|
|
|
1988
1965
|
this.options = options;
|
|
1989
1966
|
}
|
|
1990
1967
|
getCredentialIssuerMetadataDraft11(credentialIssuerMetadata) {
|
|
1991
|
-
return (0,
|
|
1968
|
+
return (0, import_utils19.parseWithErrorHandling)(zCredentialIssuerMetadataWithDraft11, credentialIssuerMetadata);
|
|
1992
1969
|
}
|
|
1993
1970
|
getKnownCredentialConfigurationsSupported(credentialIssuerMetadata) {
|
|
1994
1971
|
return extractKnownCredentialConfigurationSupportedFormats(
|
|
@@ -1999,7 +1976,7 @@ var Openid4vciIssuer = class {
|
|
|
1999
1976
|
* Create issuer metadata and validates the structure is correct
|
|
2000
1977
|
*/
|
|
2001
1978
|
createCredentialIssuerMetadata(credentialIssuerMetadata) {
|
|
2002
|
-
return (0,
|
|
1979
|
+
return (0, import_utils19.parseWithErrorHandling)(
|
|
2003
1980
|
zCredentialIssuerMetadata,
|
|
2004
1981
|
credentialIssuerMetadata,
|
|
2005
1982
|
"Error validating credential issuer metadata"
|
|
@@ -2089,7 +2066,7 @@ var Openid4vciIssuer = class {
|
|
|
2089
2066
|
error: import_oauth219.Oauth2ErrorCodes.InvalidCredentialRequest,
|
|
2090
2067
|
error_description: (
|
|
2091
2068
|
// TODO: error should have a internalErrorMessage and a publicErrorMessage
|
|
2092
|
-
error instanceof
|
|
2069
|
+
error instanceof import_utils19.ValidationError ? error.message : "Invalid request"
|
|
2093
2070
|
)
|
|
2094
2071
|
},
|
|
2095
2072
|
{
|