@openid4vc/openid4vci 0.3.0 → 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.d.cts +12 -12
- package/dist/index.mjs +23 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -6,12 +6,16 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
return to;
|
|
17
21
|
};
|
|
@@ -68,7 +72,7 @@ const zCredentialOfferObjectDraft11To14 = zod.default.object({
|
|
|
68
72
|
user_pin_required: zod.default.optional(zod.default.boolean())
|
|
69
73
|
}).loose().optional()
|
|
70
74
|
}))
|
|
71
|
-
}).loose().transform(({ credentials, grants
|
|
75
|
+
}).loose().transform(({ credentials, grants, ...rest }) => {
|
|
72
76
|
const v14 = {
|
|
73
77
|
...rest,
|
|
74
78
|
credential_configuration_ids: credentials
|
|
@@ -76,7 +80,7 @@ const zCredentialOfferObjectDraft11To14 = zod.default.object({
|
|
|
76
80
|
if (grants) {
|
|
77
81
|
v14.grants = { ...grants };
|
|
78
82
|
if (grants[__openid4vc_oauth2.preAuthorizedCodeGrantIdentifier]) {
|
|
79
|
-
const { user_pin_required
|
|
83
|
+
const { user_pin_required, ...restGrants } = grants[__openid4vc_oauth2.preAuthorizedCodeGrantIdentifier];
|
|
80
84
|
v14.grants[__openid4vc_oauth2.preAuthorizedCodeGrantIdentifier] = { ...restGrants };
|
|
81
85
|
if (user_pin_required) v14.grants[__openid4vc_oauth2.preAuthorizedCodeGrantIdentifier].tx_code = { input_mode: "text" };
|
|
82
86
|
}
|
|
@@ -125,7 +129,7 @@ function determineAuthorizationServerForCredentialOffer(options) {
|
|
|
125
129
|
return authorizationServer;
|
|
126
130
|
}
|
|
127
131
|
async function createCredentialOffer(options) {
|
|
128
|
-
const { [__openid4vc_oauth2.preAuthorizedCodeGrantIdentifier]: preAuthorizedCodeGrant, [__openid4vc_oauth2.authorizationCodeGrantIdentifier]: authorizationCodeGrant
|
|
132
|
+
const { [__openid4vc_oauth2.preAuthorizedCodeGrantIdentifier]: preAuthorizedCodeGrant, [__openid4vc_oauth2.authorizationCodeGrantIdentifier]: authorizationCodeGrant, ...restGrants } = options.grants;
|
|
129
133
|
const grants = { ...restGrants };
|
|
130
134
|
if (authorizationCodeGrant) {
|
|
131
135
|
determineAuthorizationServerForCredentialOffer({
|
|
@@ -516,14 +520,14 @@ const zJwtVcJsonCredentialIssuerMetadataDraft11 = zod.default.object({
|
|
|
516
520
|
types: zod.default.tuple([zod.default.string()], zod.default.string()),
|
|
517
521
|
credentialSubject: zW3cVcCredentialSubjectDraft14.optional()
|
|
518
522
|
}).loose();
|
|
519
|
-
const zJwtVcJsonCredentialIssuerMetadataDraft11To14 = zJwtVcJsonCredentialIssuerMetadataDraft11.transform(({ types, credentialSubject
|
|
523
|
+
const zJwtVcJsonCredentialIssuerMetadataDraft11To14 = zJwtVcJsonCredentialIssuerMetadataDraft11.transform(({ types, credentialSubject, ...rest }) => ({
|
|
520
524
|
...rest,
|
|
521
525
|
credential_definition: {
|
|
522
526
|
type: types,
|
|
523
527
|
...credentialSubject ? { credentialSubject } : {}
|
|
524
528
|
}
|
|
525
529
|
}));
|
|
526
|
-
const zJwtVcJsonCredentialIssuerMetadataDraft14To11 = zJwtVcJsonCredentialIssuerMetadataDraft14.loose().transform(({ credential_definition: { type
|
|
530
|
+
const zJwtVcJsonCredentialIssuerMetadataDraft14To11 = zJwtVcJsonCredentialIssuerMetadataDraft14.loose().transform(({ credential_definition: { type, ...credentialDefinition }, ...rest }) => ({
|
|
527
531
|
...rest,
|
|
528
532
|
types: type,
|
|
529
533
|
...credentialDefinition
|
|
@@ -537,7 +541,7 @@ const zJwtVcJsonCredentialRequestDraft11 = zod.default.object({
|
|
|
537
541
|
types: zod.default.tuple([zod.default.string()], zod.default.string()),
|
|
538
542
|
credentialSubject: zod.default.optional(zW3cVcCredentialSubjectDraft14)
|
|
539
543
|
}).loose();
|
|
540
|
-
const zJwtVcJsonCredentialRequestDraft11To14 = zJwtVcJsonCredentialRequestDraft11.transform(({ types, credentialSubject
|
|
544
|
+
const zJwtVcJsonCredentialRequestDraft11To14 = zJwtVcJsonCredentialRequestDraft11.transform(({ types, credentialSubject, ...rest }) => {
|
|
541
545
|
return {
|
|
542
546
|
...rest,
|
|
543
547
|
credential_definition: {
|
|
@@ -546,7 +550,7 @@ const zJwtVcJsonCredentialRequestDraft11To14 = zJwtVcJsonCredentialRequestDraft1
|
|
|
546
550
|
}
|
|
547
551
|
};
|
|
548
552
|
});
|
|
549
|
-
const zJwtVcJsonCredentialRequestDraft14To11 = zJwtVcJsonCredentialRequestFormatDraft14.loose().transform(({ credential_definition: { type
|
|
553
|
+
const zJwtVcJsonCredentialRequestDraft14To11 = zJwtVcJsonCredentialRequestFormatDraft14.loose().transform(({ credential_definition: { type, ...credentialDefinition }, ...rest }) => ({
|
|
550
554
|
...rest,
|
|
551
555
|
types: type,
|
|
552
556
|
...credentialDefinition
|
|
@@ -578,7 +582,7 @@ const zJwtVcJsonLdCredentialIssuerMetadataDraft11 = zod.default.object({
|
|
|
578
582
|
types: zod.default.tuple([zod.default.string()], zod.default.string()),
|
|
579
583
|
credentialSubject: zW3cVcCredentialSubjectDraft14.optional()
|
|
580
584
|
}).loose();
|
|
581
|
-
const zJwtVcJsonLdCredentialIssuerMetadataDraft11To14 = zJwtVcJsonLdCredentialIssuerMetadataDraft11.transform(({ "@context": context, types, credentialSubject
|
|
585
|
+
const zJwtVcJsonLdCredentialIssuerMetadataDraft11To14 = zJwtVcJsonLdCredentialIssuerMetadataDraft11.transform(({ "@context": context, types, credentialSubject, ...rest }) => ({
|
|
582
586
|
...rest,
|
|
583
587
|
credential_definition: {
|
|
584
588
|
"@context": context,
|
|
@@ -586,7 +590,7 @@ const zJwtVcJsonLdCredentialIssuerMetadataDraft11To14 = zJwtVcJsonLdCredentialIs
|
|
|
586
590
|
...credentialSubject ? { credentialSubject } : {}
|
|
587
591
|
}
|
|
588
592
|
}));
|
|
589
|
-
const zJwtVcJsonLdCredentialIssuerMetadataDraft14To11 = zJwtVcJsonLdCredentialIssuerMetadataDraft14.loose().transform(({ credential_definition: { type
|
|
593
|
+
const zJwtVcJsonLdCredentialIssuerMetadataDraft14To11 = zJwtVcJsonLdCredentialIssuerMetadataDraft14.loose().transform(({ credential_definition: { type, ...credentialDefinition }, ...rest }) => ({
|
|
590
594
|
...rest,
|
|
591
595
|
...credentialDefinition,
|
|
592
596
|
types: type
|
|
@@ -603,14 +607,14 @@ const zJwtVcJsonLdCredentialRequestDraft11 = zod.default.object({
|
|
|
603
607
|
credentialSubject: zod.default.optional(zW3cVcCredentialSubjectDraft14)
|
|
604
608
|
}).loose()
|
|
605
609
|
}).loose();
|
|
606
|
-
const zJwtVcJsonLdCredentialRequestDraft11To14 = zJwtVcJsonLdCredentialRequestDraft11.transform(({ credential_definition: { types
|
|
610
|
+
const zJwtVcJsonLdCredentialRequestDraft11To14 = zJwtVcJsonLdCredentialRequestDraft11.transform(({ credential_definition: { types, ...restCredentialDefinition }, ...rest }) => ({
|
|
607
611
|
...rest,
|
|
608
612
|
credential_definition: {
|
|
609
613
|
...restCredentialDefinition,
|
|
610
614
|
type: types
|
|
611
615
|
}
|
|
612
616
|
}));
|
|
613
|
-
const zJwtVcJsonLdCredentialRequestDraft14To11 = zJwtVcJsonLdCredentialRequestFormatDraft14.loose().transform(({ credential_definition: { type
|
|
617
|
+
const zJwtVcJsonLdCredentialRequestDraft14To11 = zJwtVcJsonLdCredentialRequestFormatDraft14.loose().transform(({ credential_definition: { type, ...restCredentialDefinition }, ...rest }) => ({
|
|
614
618
|
...rest,
|
|
615
619
|
credential_definition: {
|
|
616
620
|
...restCredentialDefinition,
|
|
@@ -644,7 +648,7 @@ const zLdpVcCredentialIssuerMetadataDraft11 = zod.default.object({
|
|
|
644
648
|
types: zod.default.tuple([zod.default.string()], zod.default.string()),
|
|
645
649
|
credentialSubject: zW3cVcCredentialSubjectDraft14.optional()
|
|
646
650
|
}).loose();
|
|
647
|
-
const zLdpVcCredentialIssuerMetadataDraft11To14 = zLdpVcCredentialIssuerMetadataDraft11.transform(({ "@context": context, types, credentialSubject
|
|
651
|
+
const zLdpVcCredentialIssuerMetadataDraft11To14 = zLdpVcCredentialIssuerMetadataDraft11.transform(({ "@context": context, types, credentialSubject, ...rest }) => ({
|
|
648
652
|
...rest,
|
|
649
653
|
credential_definition: {
|
|
650
654
|
"@context": context,
|
|
@@ -652,7 +656,7 @@ const zLdpVcCredentialIssuerMetadataDraft11To14 = zLdpVcCredentialIssuerMetadata
|
|
|
652
656
|
...credentialSubject ? { credentialSubject } : {}
|
|
653
657
|
}
|
|
654
658
|
}));
|
|
655
|
-
const zLdpVcCredentialIssuerMetadataDraft14To11 = zLdpVcCredentialIssuerMetadataDraft14.loose().transform(({ credential_definition: { type
|
|
659
|
+
const zLdpVcCredentialIssuerMetadataDraft14To11 = zLdpVcCredentialIssuerMetadataDraft14.loose().transform(({ credential_definition: { type, ...credentialDefinition }, ...rest }) => ({
|
|
656
660
|
...rest,
|
|
657
661
|
...credentialDefinition,
|
|
658
662
|
types: type
|
|
@@ -669,14 +673,14 @@ const zLdpVcCredentialRequestDraft11 = zod.default.object({
|
|
|
669
673
|
credentialSubject: zW3cVcCredentialSubjectDraft14.optional()
|
|
670
674
|
})
|
|
671
675
|
}).loose();
|
|
672
|
-
const zLdpVcCredentialRequestDraft11To14 = zLdpVcCredentialRequestDraft11.transform(({ credential_definition: { types
|
|
676
|
+
const zLdpVcCredentialRequestDraft11To14 = zLdpVcCredentialRequestDraft11.transform(({ credential_definition: { types, ...restCredentialDefinition }, ...rest }) => ({
|
|
673
677
|
...rest,
|
|
674
678
|
credential_definition: {
|
|
675
679
|
...restCredentialDefinition,
|
|
676
680
|
type: types
|
|
677
681
|
}
|
|
678
682
|
}));
|
|
679
|
-
const zLdpVcCredentialRequestDraft14To11 = zLdpVcCredentialRequestFormatDraft14.loose().transform(({ credential_definition: { type
|
|
683
|
+
const zLdpVcCredentialRequestDraft14To11 = zLdpVcCredentialRequestFormatDraft14.loose().transform(({ credential_definition: { type, ...restCredentialDefinition }, ...rest }) => ({
|
|
680
684
|
...rest,
|
|
681
685
|
credential_definition: {
|
|
682
686
|
...restCredentialDefinition,
|
|
@@ -774,13 +778,13 @@ const zCredentialConfigurationSupportedDraft11ToV1 = zod.default.object({
|
|
|
774
778
|
background_image: zod.default.object({ url: __openid4vc_utils.zHttpsUrl.or(__openid4vc_utils.zDataUrl).optional() }).loose().optional()
|
|
775
779
|
}).loose()).optional(),
|
|
776
780
|
claims: zod.default.any().optional()
|
|
777
|
-
}).loose().transform(({ cryptographic_suites_supported, display, claims, id, format
|
|
781
|
+
}).loose().transform(({ cryptographic_suites_supported, display, claims, id, format, ...rest }) => ({
|
|
778
782
|
...rest,
|
|
779
783
|
format,
|
|
780
784
|
...cryptographic_suites_supported ? { credential_signing_alg_values_supported: format === zMsoMdocFormatIdentifier.value ? (0, __openid4vc_oauth2.jwaSignatureAlgorithmArrayToFullySpecifiedCoseAlgorithmArray)(cryptographic_suites_supported) : cryptographic_suites_supported } : {},
|
|
781
785
|
...claims || display ? { credential_metadata: {
|
|
782
786
|
...claims ? { claims } : {},
|
|
783
|
-
...display ? { display: display.map(({ logo, background_image
|
|
787
|
+
...display ? { display: display.map(({ logo, background_image, ...displayRest }) => ({
|
|
784
788
|
...displayRest,
|
|
785
789
|
...logo?.url ? { logo: { uri: logo.url } } : {},
|
|
786
790
|
...background_image?.url ? { background_image: { uri: background_image.url } } : {}
|
|
@@ -801,16 +805,16 @@ const zCredentialConfigurationSupportedDraft11ToV1 = zod.default.object({
|
|
|
801
805
|
});
|
|
802
806
|
return zod.default.NEVER;
|
|
803
807
|
}).pipe(zCredentialConfigurationSupportedWithFormats);
|
|
804
|
-
const zCredentialConfigurationSupportedV1ToDraft11 = zCredentialConfigurationSupportedWithFormats.transform(({ credential_metadata
|
|
808
|
+
const zCredentialConfigurationSupportedV1ToDraft11 = zCredentialConfigurationSupportedWithFormats.transform(({ credential_metadata, ...rest }) => ({
|
|
805
809
|
...credential_metadata,
|
|
806
810
|
...rest
|
|
807
|
-
})).and(zod.default.object({ id: zod.default.string() }).loose()).transform(({ id, credential_signing_alg_values_supported, display, proof_types_supported, scope, format
|
|
811
|
+
})).and(zod.default.object({ id: zod.default.string() }).loose()).transform(({ id, credential_signing_alg_values_supported, display, proof_types_supported, scope, format, ...rest }) => ({
|
|
808
812
|
...rest,
|
|
809
813
|
format,
|
|
810
814
|
...credential_signing_alg_values_supported ? { cryptographic_suites_supported: format === zMsoMdocFormatIdentifier.value && typeof credential_signing_alg_values_supported[0] === "number" ? (0, __openid4vc_oauth2.fullySpecifiedCoseAlgorithmArrayToJwaSignatureAlgorithmArray)(credential_signing_alg_values_supported) : credential_signing_alg_values_supported } : {},
|
|
811
|
-
...display ? { display: display.map(({ logo, background_image
|
|
812
|
-
const { uri: logoUri
|
|
813
|
-
const { uri: backgroundImageUri
|
|
815
|
+
...display ? { display: display.map(({ logo, background_image, ...displayRest }) => {
|
|
816
|
+
const { uri: logoUri, ...logoRest } = logo ?? {};
|
|
817
|
+
const { uri: backgroundImageUri, ...backgroundImageRest } = background_image ?? {};
|
|
814
818
|
return {
|
|
815
819
|
...displayRest,
|
|
816
820
|
...logoUri ? { logo: {
|
|
@@ -837,7 +841,7 @@ const zCredentialConfigurationSupportedV1ToDraft11 = zCredentialConfigurationSup
|
|
|
837
841
|
const zCredentialIssuerMetadataDraft11ToV1 = zod.default.object({
|
|
838
842
|
authorization_server: zod.default.string().optional(),
|
|
839
843
|
credentials_supported: zod.default.array(zod.default.object({ id: zod.default.string().optional() }).loose())
|
|
840
|
-
}).loose().transform(({ authorization_server, credentials_supported
|
|
844
|
+
}).loose().transform(({ authorization_server, credentials_supported, ...rest }) => {
|
|
841
845
|
return {
|
|
842
846
|
...rest,
|
|
843
847
|
...authorization_server ? { authorization_servers: [authorization_server] } : {},
|