@sphereon/oid4vci-common 0.20.2-next.2 → 0.20.2-next.21

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.ts CHANGED
@@ -362,8 +362,13 @@ type CredentialConfigurationSupportedCommonV1_0_15 = {
362
362
  credential_signing_alg_values_supported?: string[];
363
363
  proof_types_supported?: ProofTypesSupported;
364
364
  display?: CredentialsSupportedDisplay[];
365
+ credential_metadata?: CredentialMetadataV1_0_15;
365
366
  [x: string]: unknown;
366
367
  };
368
+ interface CredentialMetadataV1_0_15 {
369
+ display?: CredentialsSupportedDisplay[];
370
+ claims?: ClaimsDescriptionV1_0_15[];
371
+ }
367
372
  interface CredentialConfigurationSupportedSdJwtVcV1_0_15 extends CredentialConfigurationSupportedCommonV1_0_15 {
368
373
  format: 'dc+sd-jwt' | 'vc+sd-jwt';
369
374
  vct: string;
@@ -649,8 +654,211 @@ interface IStateManager<T extends StateType> {
649
654
  stopCleanupRoutine(): Promise<void>;
650
655
  }
651
656
 
657
+ interface ProofTypesV1_0 {
658
+ jwt?: ProofTypeV1_0;
659
+ di_vp?: ProofTypeV1_0;
660
+ attestation?: ProofTypeV1_0;
661
+ }
662
+ interface ProofTypeV1_0 {
663
+ proof_signing_alg_values_supported: string[];
664
+ key_attestations_required?: KeyAttestationsRequiredV1_0_15;
665
+ }
666
+ type ProofTypesSupportedV1_0 = {
667
+ [key: string]: ProofTypeV1_0;
668
+ };
669
+ type CredentialConfigurationSupportedCommonV1_0 = {
670
+ format: OID4VCICredentialFormat | string;
671
+ scope?: string;
672
+ cryptographic_binding_methods_supported?: string[];
673
+ cryptographic_suites_supported?: string[];
674
+ credential_signing_alg_values_supported?: string[];
675
+ proof_types_supported?: ProofTypesSupportedV1_0;
676
+ display?: CredentialsSupportedDisplay[];
677
+ credential_metadata?: CredentialMetadataV1_0;
678
+ [x: string]: unknown;
679
+ };
680
+ interface CredentialConfigurationSupportedSdJwtVcV1_0 extends CredentialConfigurationSupportedCommonV1_0 {
681
+ format: 'dc+sd-jwt' | 'vc+sd-jwt';
682
+ vct: string;
683
+ claims?: ClaimsDescriptionV1_0[];
684
+ order?: string[];
685
+ }
686
+ interface CredentialConfigurationSupportedJwtVcJsonV1_0 extends CredentialConfigurationSupportedCommonV1_0 {
687
+ format: 'jwt_vc_json' | 'jwt_vc';
688
+ credential_definition: CredentialDefinitionJwtVcJsonV1_0_15;
689
+ claims?: ClaimsDescriptionV1_0[];
690
+ order?: string[];
691
+ }
692
+ interface CredentialConfigurationSupportedJwtVcJsonLdAndLdpVcV1_0 extends CredentialConfigurationSupportedCommonV1_0 {
693
+ format: 'ldp_vc' | 'jwt_vc_json-ld';
694
+ credential_definition: CredentialDefinitionJwtVcJsonLdAndLdpVcV1_0_15;
695
+ claims?: ClaimsDescriptionV1_0[];
696
+ order?: string[];
697
+ }
698
+ interface CredentialConfigurationSupportedMsoMdocV1_0 extends CredentialConfigurationSupportedCommonV1_0 {
699
+ format: 'mso_mdoc';
700
+ doctype: string;
701
+ claims?: ClaimsDescriptionV1_0[];
702
+ order?: string[];
703
+ }
704
+ type CredentialConfigurationSupportedV1_0 = CredentialConfigurationSupportedCommonV1_0 & (CredentialConfigurationSupportedSdJwtVcV1_0 | CredentialConfigurationSupportedJwtVcJsonV1_0 | CredentialConfigurationSupportedJwtVcJsonLdAndLdpVcV1_0 | CredentialConfigurationSupportedMsoMdocV1_0);
705
+ interface ClaimsDescriptionV1_0 {
706
+ path: (string | number | null)[];
707
+ mandatory?: boolean;
708
+ display?: CredentialsSupportedDisplay[];
709
+ }
710
+ interface CredentialMetadataV1_0 {
711
+ display?: CredentialsSupportedDisplay[];
712
+ claims?: ClaimsDescriptionV1_0[];
713
+ }
714
+ interface IssuerMetadataV1_0 {
715
+ credential_configurations_supported: Record<string, CredentialConfigurationSupportedV1_0>;
716
+ credential_issuer: string;
717
+ credential_endpoint: string;
718
+ token_endpoint?: string;
719
+ nonce_endpoint?: string;
720
+ authorization_servers?: string[];
721
+ authorization_endpoint?: string;
722
+ deferred_credential_endpoint?: string;
723
+ notification_endpoint?: string;
724
+ credential_response_encryption?: ResponseEncryption;
725
+ batch_credential_issuance_supported?: boolean;
726
+ credential_issuer_public_key?: object;
727
+ display?: MetadataDisplay[];
728
+ authorization_challenge_endpoint?: string;
729
+ signed_metadata?: string;
730
+ [x: string]: unknown;
731
+ }
732
+ type CredentialRequestV1_0ResponseEncryption = {
733
+ jwk: JWK;
734
+ alg: AlgValue;
735
+ enc: EncValue;
736
+ };
737
+ interface CredentialRequestV1_0Common extends ExperimentalSubjectIssuance {
738
+ credential_configuration_id: string;
739
+ credential_identifiers?: string[];
740
+ credential_response_encryption?: CredentialRequestV1_0ResponseEncryption;
741
+ proof?: ProofOfPossession;
742
+ proofs?: ProofOfPossessionMap;
743
+ }
744
+ type CredentialRequestV1_0 = CredentialRequestV1_0Common;
745
+ interface CredentialResponseV1_0 extends ExperimentalSubjectIssuance {
746
+ credential?: string | object;
747
+ transaction_id?: string;
748
+ acceptance_token?: string;
749
+ interval?: number;
750
+ c_nonce?: string;
751
+ c_nonce_expires_in?: number;
752
+ notification_id?: string;
753
+ }
754
+ interface DeferredCredentialResponseV1_0 {
755
+ credential: string | object;
756
+ acceptance_token?: string;
757
+ interval?: number;
758
+ c_nonce?: string;
759
+ c_nonce_expires_in?: number;
760
+ notification_id?: string;
761
+ }
762
+ interface TokenResponseV1_0 {
763
+ access_token: string;
764
+ token_type: string;
765
+ expires_in?: number;
766
+ refresh_token?: string;
767
+ scope?: string;
768
+ authorization_details?: AuthorizationDetailsV1_0[];
769
+ c_nonce?: string;
770
+ c_nonce_expires_in?: number;
771
+ }
772
+ interface AuthorizationDetailsV1_0 {
773
+ type: 'openid_credential';
774
+ credential_configuration_id: string;
775
+ credential_identifiers?: string[];
776
+ locations?: string[];
777
+ [x: string]: unknown;
778
+ }
779
+ interface NonceRequestV1_0 {
780
+ }
781
+ interface NonceResponseV1_0 {
782
+ c_nonce: string;
783
+ c_nonce_expires_in: number;
784
+ }
785
+ interface CredentialErrorResponseV1_0 {
786
+ error: string;
787
+ error_description?: string;
788
+ error_uri?: string;
789
+ c_nonce?: string;
790
+ c_nonce_expires_in?: number;
791
+ }
792
+ interface CredentialOfferV1_0 {
793
+ credential_offer?: CredentialOfferPayloadV1_0;
794
+ credential_offer_uri?: string;
795
+ }
796
+ interface CredentialOfferPayloadV1_0 {
797
+ credential_issuer: string;
798
+ credential_configuration_ids: string[];
799
+ grants?: Grant;
800
+ client_id?: string;
801
+ }
802
+ interface CredentialOfferRESTRequestV1_0 extends Partial<CredentialOfferPayloadV1_0> {
803
+ redirectUri?: string;
804
+ baseUri?: string;
805
+ scheme?: string;
806
+ correlationId?: string;
807
+ sessionLifeTimeInSec?: number;
808
+ pinLength?: number;
809
+ qrCodeOpts?: QRCodeOpts;
810
+ client_id?: string;
811
+ credentialDataSupplierInput?: CredentialDataSupplierInput;
812
+ statusListOpts?: Array<StatusListOpts>;
813
+ offerMode?: CredentialOfferMode;
814
+ }
815
+ interface CredentialIssuerMetadataOptsV1_0 {
816
+ credential_endpoint: string;
817
+ nonce_endpoint?: string;
818
+ deferred_credential_endpoint?: string;
819
+ notification_endpoint?: string;
820
+ credential_response_encryption?: ResponseEncryption;
821
+ batch_credential_issuance_supported?: boolean;
822
+ credential_issuer_public_key?: object;
823
+ credential_identifiers_supported?: boolean;
824
+ credential_configurations_supported: Record<string, CredentialConfigurationSupportedV1_0>;
825
+ credential_issuer: string;
826
+ authorization_servers?: string[];
827
+ signed_metadata?: string;
828
+ display?: MetadataDisplay[];
829
+ authorization_challenge_endpoint?: string;
830
+ token_endpoint?: string;
831
+ credential_supplier_config?: CredentialSupplierConfig;
832
+ }
833
+ interface CredentialIssuerMetadataV1_0 extends CredentialIssuerMetadataOptsV1_0, Partial<AuthorizationServerMetadata> {
834
+ authorization_servers?: string[];
835
+ credential_endpoint: string;
836
+ credential_configurations_supported: Record<string, CredentialConfigurationSupportedV1_0>;
837
+ credential_issuer: string;
838
+ credential_response_encryption_alg_values_supported?: string;
839
+ credential_response_encryption_enc_values_supported?: string;
840
+ require_credential_response_encryption?: boolean;
841
+ credential_identifiers_supported?: boolean;
842
+ nonce_endpoint?: string;
843
+ }
844
+ declare const credentialIssuerMetadataFieldNamesV1_0: Array<keyof CredentialIssuerMetadataOptsV1_0>;
845
+ interface EndpointMetadataResultV1_0 extends EndpointMetadata {
846
+ authorizationServerType: AuthorizationServerType;
847
+ authorizationServerMetadata?: AuthorizationServerMetadata;
848
+ credentialIssuerMetadata?: Partial<AuthorizationServerMetadata> & IssuerMetadataV1_0;
849
+ }
850
+ interface NotificationResponseV1_0 {
851
+ }
852
+ interface NotificationErrorResponseV1_0 {
853
+ error: 'invalid_notification_id' | 'invalid_notification_request';
854
+ error_description?: string;
855
+ }
856
+ interface AuthorizationServerMetadataV1_0 extends AuthorizationServerMetadata {
857
+ 'pre-authorized_grant_anonymous_access_supported'?: boolean;
858
+ }
859
+
652
860
  type InputCharSet = 'numeric' | 'text';
653
- type KeyProofType = 'jwt' | 'cwt' | 'ldp_vp';
861
+ type KeyProofType = 'jwt' | 'cwt' | 'ldp_vp' | 'di_vp';
654
862
  type PoPMode = 'pop' | 'JWT';
655
863
  type CredentialOfferMode = 'VALUE' | 'REFERENCE';
656
864
  /**
@@ -778,7 +986,7 @@ interface CredentialSupportedMsoMdoc extends CommonCredentialSupported {
778
986
  claims?: IssuerCredentialSubject;
779
987
  order?: string[];
780
988
  }
781
- type CredentialConfigurationSupported = CredentialConfigurationSupportedV1_0_15 | (CommonCredentialSupported & (CredentialSupportedJwtVcJson | CredentialSupportedJwtVcJsonLdAndLdpVc | CredentialSupportedSdJwtVc | CredentialSupportedMsoMdoc));
989
+ type CredentialConfigurationSupported = CredentialConfigurationSupportedV1_0_15 | CredentialConfigurationSupportedV1_0 | (CommonCredentialSupported & (CredentialSupportedJwtVcJson | CredentialSupportedJwtVcJsonLdAndLdpVc | CredentialSupportedSdJwtVc | CredentialSupportedMsoMdoc));
782
990
  type CredentialsSupportedLegacy = CommonCredentialSupported & (CredentialSupportedJwtVcJson | CredentialSupportedJwtVcJsonLdAndLdpVc | CredentialSupportedSdJwtVc | CredentialSupportedSdJwtVcV13 | CredentialSupportedMsoMdoc);
783
991
  interface CommonCredentialOfferFormat {
784
992
  format: OID4VCICredentialFormat | string;
@@ -830,7 +1038,8 @@ interface ErrorResponse {
830
1038
  error_uri?: string;
831
1039
  state?: string;
832
1040
  }
833
- type CredentialRequest = CredentialRequestV1_0_15;
1041
+ type CredentialRequest = CredentialRequestV1_0_15 | CredentialRequestV1_0;
1042
+ type AuthorizationDetails = AuthorizationDetailsV1_0_15 | AuthorizationDetailsV1_0;
834
1043
  interface CommonCredentialRequest extends ExperimentalSubjectIssuance {
835
1044
  format: OID4VCICredentialFormat;
836
1045
  proof?: ProofOfPossession;
@@ -952,8 +1161,15 @@ interface GrantUrnIetf {
952
1161
  }
953
1162
  declare const PRE_AUTH_CODE_LITERAL = "pre-authorized_code";
954
1163
  declare const PRE_AUTH_GRANT_LITERAL = "urn:ietf:params:oauth:grant-type:pre-authorized_code";
955
- type EndpointMetadataResult = EndpointMetadataResultV1_0_15;
956
- type IssuerMetadata = IssuerMetadataV1_0_15;
1164
+ type EndpointMetadataResult = EndpointMetadataResultV1_0_15 | EndpointMetadataResultV1_0;
1165
+ type IssuerMetadata = IssuerMetadataV1_0_15 | IssuerMetadataV1_0;
1166
+ type SignedMetadataVerifyCallback = (args: {
1167
+ signedMetadata: string;
1168
+ issuer: string;
1169
+ }) => Promise<{
1170
+ verified: boolean;
1171
+ metadata: Record<string, unknown>;
1172
+ }>;
957
1173
  type NotificationEventType = 'credential_accepted' | 'credential_failure' | 'credential_deleted';
958
1174
  interface NotificationRequest {
959
1175
  notification_id: string;
@@ -978,6 +1194,7 @@ interface StatusListOpts {
978
1194
 
979
1195
  declare enum OpenId4VCIVersion {
980
1196
  VER_1_0_15 = 1015,
1197
+ VER_1_0 = 1100,
981
1198
  VER_UNKNOWN
982
1199
  }
983
1200
  declare enum DefaultURISchemes {
@@ -986,10 +1203,12 @@ declare enum DefaultURISchemes {
986
1203
  }
987
1204
 
988
1205
  interface CredentialResponse extends ExperimentalSubjectIssuance {
1206
+ credential?: string | object;
989
1207
  credentials?: Array<CredentialResponseCredentialV1_0_15>;
990
1208
  format?: OID4VCICredentialFormat;
991
1209
  transaction_id?: string;
992
1210
  acceptance_token?: string;
1211
+ interval?: number;
993
1212
  c_nonce?: string;
994
1213
  c_nonce_expires_in?: number;
995
1214
  notification_id?: string;
@@ -1003,9 +1222,9 @@ interface CredentialOfferRequestWithBaseUrl extends UniformCredentialOfferReques
1003
1222
  preAuthorizedCode?: string;
1004
1223
  userPinRequired: boolean;
1005
1224
  }
1006
- type CredentialOffer = CredentialOfferV1_0_15;
1007
- type CredentialOfferPayloadLatest = CredentialOfferPayloadV1_0_15;
1008
- type CredentialOfferPayload = CredentialOfferPayloadV1_0_15 & {
1225
+ type CredentialOffer = CredentialOfferV1_0_15 | CredentialOfferV1_0;
1226
+ type CredentialOfferPayloadLatest = CredentialOfferPayloadV1_0;
1227
+ type CredentialOfferPayload = (CredentialOfferPayloadV1_0_15 | CredentialOfferPayloadV1_0) & {
1009
1228
  [x: string]: any;
1010
1229
  };
1011
1230
  interface AssertedUniformCredentialOffer extends UniformCredentialOffer {
@@ -1020,12 +1239,18 @@ interface UniformCredentialOfferRequest extends AssertedUniformCredentialOffer {
1020
1239
  version: OpenId4VCIVersion;
1021
1240
  supportedFlows: AuthzFlowType[];
1022
1241
  }
1023
- type UniformCredentialOfferPayload = CredentialOfferPayloadV1_0_15;
1024
- interface ProofOfPossession {
1242
+ type UniformCredentialOfferPayload = CredentialOfferPayloadV1_0_15 | CredentialOfferPayloadV1_0;
1243
+ interface JwtProofOfPossession {
1025
1244
  proof_type: 'jwt';
1026
1245
  jwt: string;
1027
1246
  [x: string]: unknown;
1028
1247
  }
1248
+ interface CwtProofOfPossession {
1249
+ proof_type: 'cwt';
1250
+ cwt: string;
1251
+ [x: string]: unknown;
1252
+ }
1253
+ type ProofOfPossession = JwtProofOfPossession | CwtProofOfPossession;
1029
1254
  type SearchValue = {
1030
1255
  [Symbol.replace](string: string, replacer: (substring: string, ...args: any[]) => string): string;
1031
1256
  };
@@ -1051,6 +1276,7 @@ interface Jwt {
1051
1276
  }
1052
1277
  interface ProofOfPossessionCallbacks {
1053
1278
  signCallback: JWTSignerCallback;
1279
+ cwtSignCallback?: CWTSignerCallback;
1054
1280
  verifyCallback?: JWTVerifyCallback;
1055
1281
  }
1056
1282
  /**
@@ -1105,6 +1331,15 @@ interface JWTPayload {
1105
1331
  [s: string]: unknown;
1106
1332
  }
1107
1333
  type JWTSignerCallback = (jwt: Jwt, kid?: string, noIssPayloadUpdate?: boolean) => Promise<string>;
1334
+ type CWTSignerCallback = (args: {
1335
+ iss?: string;
1336
+ aud: string;
1337
+ nonce?: string;
1338
+ alg?: string;
1339
+ jwk?: JWK;
1340
+ kid?: string;
1341
+ coseKey?: unknown;
1342
+ }) => Promise<string>;
1108
1343
  type JWTVerifyCallback = (args: {
1109
1344
  jwt: string;
1110
1345
  kid?: string;
@@ -1745,6 +1980,15 @@ declare const adjustUrl: <T extends string | URL>(urlOrPath: T, opts?: {
1745
1980
  * - Optional, clientId of the party requesting the credential
1746
1981
  */
1747
1982
  declare const createProofOfPossession: <DIDDoc extends object = never>(popMode: PoPMode, callbacks: ProofOfPossessionCallbacks, jwtProps?: JwtProps, existingJwt?: Jwt) => Promise<ProofOfPossession>;
1983
+ declare const createCwtProofOfPossession: (callbacks: ProofOfPossessionCallbacks, opts: {
1984
+ iss?: string;
1985
+ aud: string;
1986
+ nonce?: string;
1987
+ alg?: string;
1988
+ jwk?: JWK;
1989
+ kid?: string;
1990
+ coseKey?: unknown;
1991
+ }) => Promise<CwtProofOfPossession>;
1748
1992
  declare const isJWS: (token: string) => boolean;
1749
1993
  declare const extractBearerToken: (authorizationHeader?: string) => string | undefined;
1750
1994
  declare const validateJWT: <DIDDoc extends object = never>(jwt?: string, opts?: {
@@ -1774,6 +2018,24 @@ declare const generateCodeVerifier: (length?: number) => string;
1774
2018
  declare const createCodeChallenge: (codeVerifier: string, codeChallengeMethod?: CodeChallengeMethod) => string;
1775
2019
  declare const assertValidCodeVerifier: (codeVerifier: string) => void;
1776
2020
 
2021
+ /**
2022
+ * Process the signed_metadata JWT from issuer metadata.
2023
+ *
2024
+ * Per OID4VCI spec, signed_metadata is a signed JWT containing Credential Issuer
2025
+ * metadata parameters as claims. When present and verified, the signed claims
2026
+ * take precedence over unsigned metadata fields.
2027
+ *
2028
+ * @param opts.metadata - The fetched issuer metadata (may contain signed_metadata)
2029
+ * @param opts.issuer - The credential_issuer URL for JWT validation
2030
+ * @param opts.signedMetadataVerifyCallback - Callback to verify and decode the signed JWT
2031
+ * @returns The metadata with signed claims merged in (signed claims override unsigned)
2032
+ */
2033
+ declare function processSignedMetadata<T extends IssuerMetadata>(opts: {
2034
+ metadata: T;
2035
+ issuer: string;
2036
+ signedMetadataVerifyCallback?: SignedMetadataVerifyCallback;
2037
+ }): Promise<T>;
2038
+
1777
2039
  type EventNames = CredentialOfferEventNames | NotificationStatusEventNames | LogEvents | CredentialEventNames;
1778
2040
  declare enum CredentialOfferEventNames {
1779
2041
  OID4VCI_OFFER_CREATED = "OID4VCI_OFFER_CREATED",
@@ -1794,4 +2056,4 @@ declare const EVENTS: EventManager;
1794
2056
  declare const VCI_LOGGERS: Loggers;
1795
2057
  declare const VCI_LOG_COMMON: _sphereon_ssi_types.ISimpleLogger<unknown>;
1796
2058
 
1797
- export { ACCESS_TOKEN_ISSUER_REQUIRED_ERROR, ALG_ERROR, AUD_ERROR, type AccessTokenFromAuthorizationResponseOpts, type AccessTokenRequest, type AccessTokenRequestOpts, type AccessTokenResponse, Alg, type AlgValue, type AssertedUniformCredentialOffer, type AuthorizationChallengeCodeResponse, AuthorizationChallengeError, type AuthorizationChallengeErrorResponse, type AuthorizationChallengeRequestOpts, type AuthorizationDetailsJwtVcJson, type AuthorizationDetailsJwtVcJsonLdAndLdpVc, type AuthorizationDetailsMsoMdoc, type AuthorizationDetailsSdJwtVc, type AuthorizationDetailsV1_0_15, type AuthorizationGrantResponse, type AuthorizationRequest, type AuthorizationRequestJwtVcJson, type AuthorizationRequestJwtVcJsonLdAndLdpVc, type AuthorizationRequestMsoMdoc, type AuthorizationRequestOpts, type AuthorizationRequestSdJwtVc, type AuthorizationResponse, type AuthorizationServerClientOpts, type AuthorizationServerMetadata, type AuthorizationServerMetadataV1_0_15, type AuthorizationServerOpts, type AuthorizationServerType, AuthzFlowType, BAD_PARAMS, type BatchCredentialIssuance, type CNonceState, CODE_VERIFIER_DEFAULT_LENGTH, CREDENTIAL_MISSING_ERROR, type ClaimsDescriptionV1_0_15, type ClientAuthMethod, type ClientMetadata, type ClientResponseType, CodeChallengeMethod, type CommonAuthorizationChallengeRequest, type CommonAuthorizationDetails, type CommonAuthorizationRequest, type CommonCredentialOfferFormat, type CommonCredentialRequest, type CommonCredentialResponse, type CommonCredentialSupported, type CompactJWSHeaderParameters, type ComponentOptions, type CreateCredentialOfferURIResult, CreateRequestObjectMode, type CredentialConfigurationSupported, type CredentialConfigurationSupportedCommonV1_0_15, type CredentialConfigurationSupportedJwtVcJsonLdAndLdpVcV1_0_15, type CredentialConfigurationSupportedJwtVcJsonV1_0_15, type CredentialConfigurationSupportedMsoMdocV1_0_15, type CredentialConfigurationSupportedSdJwtVcV1_0_15, type CredentialConfigurationSupportedV1_0_15, type CredentialDataSupplierInput, type CredentialDefinitionJwtVcJsonLdAndLdpVcV1_0_15, type CredentialDefinitionJwtVcJsonV1_0_15, type CredentialErrorResponseV1_0_15, CredentialEventNames, type CredentialIssuerMetadata, type CredentialIssuerMetadataOpts, type CredentialIssuerMetadataOptsV1_0_15, type CredentialIssuerMetadataV1_0_15, type CredentialOffer, CredentialOfferEventNames, type CredentialOfferFormatJwtVcJson, type CredentialOfferFormatJwtVcJsonLdAndLdpVc, type CredentialOfferFormatMsoMdoc, type CredentialOfferFormatSdJwtVc, type CredentialOfferFormatSdJwtVcv13, type CredentialOfferFormatV1_0_11, type CredentialOfferMode, type CredentialOfferPayload, type CredentialOfferPayloadLatest, type CredentialOfferPayloadV1_0_15, type CredentialOfferRESTRequestV1_0_15, type CredentialOfferRequestWithBaseUrl, type CredentialOfferSession, type CredentialOfferV1_0_15, type CredentialRequest, type CredentialRequestJwtVcJson, type CredentialRequestJwtVcJsonLdAndLdpVc, type CredentialRequestMsoMdoc, type CredentialRequestSdJwtVc, type CredentialRequestV1_0_15, type CredentialRequestV1_0_15Common, type CredentialRequestV1_0_15CredentialConfigurationId, type CredentialRequestV1_0_15CredentialIdentifier, type CredentialRequestV1_0_15ResponseEncryption, type CredentialResponse, type CredentialResponseCredentialV1_0_15, type CredentialResponseJwtVc, type CredentialResponseLdpVc, type CredentialResponseSdJwtVc, type CredentialResponseV1_0_15, type CredentialSubjectDisplay, type CredentialSupplierConfig, type CredentialSupportedBrief, type CredentialSupportedJwtVcJson, type CredentialSupportedJwtVcJsonLdAndLdpVc, type CredentialSupportedMsoMdoc, type CredentialSupportedSdJwtVc, type CredentialSupportedSdJwtVcV13, type CredentialsSupportedDisplay, type CredentialsSupportedLegacy, DID_NO_DIDDOC_ERROR, type DPoPResponseParams, type DecodeURIAsJsonOpts, DefaultURISchemes, type DeferredCredentialResponseV1_0_15, EVENTS, EXPERIMENTAL_SUBJECT_PROOF_MODE_ENABLED, EXPIRED_PRE_AUTHORIZED_CODE, type EncValue, type EncodeJsonAsURIOpts, Encoding, type EndpointMetadata, type EndpointMetadataResult, type EndpointMetadataResultV1_0_15, type ErrorResponse, type EventNames, type ExperimentalSubjectIssuance, GRANTS_MUST_NOT_BE_UNDEFINED, type Grant, type GrantAuthorizationCode, GrantTypes, type GrantUrnIetf, IAT_ERROR, INVALID_PRE_AUTHORIZED_CODE, ISSUER_CONFIG_ERROR, ISS_MUST_BE_CLIENT_ID, ISS_PRESENT_IN_PRE_AUTHORIZED_CODE_CONTEXT, type IStateManager, type ImageInfo, type InputCharSet, IssueStatus, type IssueStatusResponse, type IssuerCredentialSubject, type IssuerCredentialSubjectDisplay, type IssuerMetadata, type IssuerMetadataV1_0_15, type IssuerOpts, type JWSHeaderParameters, JWS_NOT_VALID, type JWTHeader, type JWTHeaderParameters, type JWTPayload, type JWTSignerCallback, type JWTVerifyCallback, JWT_SIGNER_CALLBACK_REQUIRED_ERROR, JWT_VERIFY_CONFIG_ERROR, type JoseHeaderParameters, type JsonLdIssuerCredentialDefinition, JsonURIMode, type Jwt, type JwtProps, type JwtVerifyResult, KID_DID_NO_DID_ERROR, KID_JWK_X5C_ERROR, type KeyAttestationJWT, type KeyAttestationsRequiredV1_0_15, type KeyProofType, type LogEvents, type LogoAndColor, type MetadataDisplay, NONCE_ERROR, NONCE_LENGTH, NONCE_STATE_MANAGER_REQUIRED_ERROR, NO_ISS_IN_AUTHORIZATION_CODE_CONTEXT, NO_JWT_PROVIDED, type NameAndLocale, type NonceRequestV1_0_15, type NonceResponseV1_0_15, type NotificationError, type NotificationErrorResponse, type NotificationErrorResponseV1_0_15, type NotificationEventType, type NotificationRequest, type NotificationResponseResult, type NotificationResponseV1_0_15, NotificationStatusEventNames, type OAuthGrantType, type OAuthResponseMode, type OAuthResponseType, type OAuthScope, type OID4VCICredentialFormat, type OpenIDResponse, OpenId4VCIVersion, PARMode, PIN_NOT_MATCH_ERROR, PIN_VALIDATION_ERROR, type PKCECodeChallengeMethod, type PKCEOpts, PRE_AUTHORIZED_CODE_REQUIRED_ERROR, PRE_AUTH_CODE_LITERAL, PRE_AUTH_GRANT_LITERAL, PROOF_CANT_BE_CONSTRUCTED, type PoPMode, type ProofOfPossession, type ProofOfPossessionCallbacks, type ProofOfPossessionMap, type ProofType, type ProofTypeV1_0_15, type ProofTypesSupported, type ProofTypesV1_0_15, type PushedAuthorizationResponse, type QRCodeOpts, type RequestObjectOpts, type ResponseEncryption, ResponseType, type RevocationEndpointAuthMethod, type RevocationEndpointAuthSigningAlg, STATE_MANAGER_REQUIRED_ERROR, STATE_MISSING_ERROR, type SearchValue, type StateType, type StatusListOpts, type SubjectProofMode, type SubjectProofNotificationEventsSupported, TYP_ERROR, type TokenEndpointAuthMethod, type TokenEndpointAuthSigningAlg, TokenError, TokenErrorResponse, type TokenResponseV1_0_15, type TxCode, type TxCodeAndPinRequired, type Typ, UNKNOWN_CLIENT_ERROR, UNSUPPORTED_GRANT_TYPE_ERROR, type URIState, URL_NOT_VALID, USER_PIN_NOT_REQUIRED_ERROR, USER_PIN_REQUIRED_ERROR, USER_PIN_TX_CODE_SPEC_ERROR, type UniformCredentialOffer, type UniformCredentialOfferPayload, type UniformCredentialOfferRequest, VCI_LOGGERS, VCI_LOG_COMMON, WRONG_METADATA_FORMAT, type WalletAttestationJWT, WellKnownEndpoints, acquireDeferredCredential, adjustUrl, assertValidCodeVerifier, assertedUniformCredentialOffer, authorizationServerMetadataFieldNames, convertJsonToURI, convertURIToJsonObject, createCodeChallenge, createProofOfPossession, credentialIssuerMetadataFieldNamesV1_0_15, type credential_identifiers, decodeJsonProperties, determineFlowType, determineGrantTypes, determineSpecVersionFromOffer, determineSpecVersionFromScheme, determineSpecVersionFromURI, determineVersionsFromIssuerMetadata, extractBearerToken, formPost, generateCodeVerifier, generateNonce, generateRandomString, getClientIdFromCredentialOfferPayload, getCredentialConfigurationIdsFromOfferV1_0_15, getCredentialOfferPayload, getFormatForVersion, getIssuerDisplays, getIssuerFromCredentialOfferPayload, getIssuerName, getJson, getNumberOrUndefined, getScheme, getStateFromCredentialOfferPayload, getSupportedCredential, getSupportedCredentials, getTypesFromAuthorizationDetails, getTypesFromCredentialSupported, getTypesFromObject, getURIComponentsAsArray, getUniformFormat, isCredentialOfferVersion, isDeferredCredentialIssuancePending, isDeferredCredentialResponse, isFormat, isJWS, isNotFormat, isPreAuthCode, isValidURL, isW3cCredentialSupported, normalizeOfferInput, post, resolveCredentialOfferURI, supportedOID4VCICredentialFormat, toAuthorizationResponsePayload, toUniformCredentialOfferPayload, toUniformCredentialOfferRequest, trimBoth, trimEnd, trimStart, validateJWT };
2059
+ export { ACCESS_TOKEN_ISSUER_REQUIRED_ERROR, ALG_ERROR, AUD_ERROR, type AccessTokenFromAuthorizationResponseOpts, type AccessTokenRequest, type AccessTokenRequestOpts, type AccessTokenResponse, Alg, type AlgValue, type AssertedUniformCredentialOffer, type AuthorizationChallengeCodeResponse, AuthorizationChallengeError, type AuthorizationChallengeErrorResponse, type AuthorizationChallengeRequestOpts, type AuthorizationDetails, type AuthorizationDetailsJwtVcJson, type AuthorizationDetailsJwtVcJsonLdAndLdpVc, type AuthorizationDetailsMsoMdoc, type AuthorizationDetailsSdJwtVc, type AuthorizationDetailsV1_0, type AuthorizationDetailsV1_0_15, type AuthorizationGrantResponse, type AuthorizationRequest, type AuthorizationRequestJwtVcJson, type AuthorizationRequestJwtVcJsonLdAndLdpVc, type AuthorizationRequestMsoMdoc, type AuthorizationRequestOpts, type AuthorizationRequestSdJwtVc, type AuthorizationResponse, type AuthorizationServerClientOpts, type AuthorizationServerMetadata, type AuthorizationServerMetadataV1_0, type AuthorizationServerMetadataV1_0_15, type AuthorizationServerOpts, type AuthorizationServerType, AuthzFlowType, BAD_PARAMS, type BatchCredentialIssuance, type CNonceState, CODE_VERIFIER_DEFAULT_LENGTH, CREDENTIAL_MISSING_ERROR, type CWTSignerCallback, type ClaimsDescriptionV1_0, type ClaimsDescriptionV1_0_15, type ClientAuthMethod, type ClientMetadata, type ClientResponseType, CodeChallengeMethod, type CommonAuthorizationChallengeRequest, type CommonAuthorizationDetails, type CommonAuthorizationRequest, type CommonCredentialOfferFormat, type CommonCredentialRequest, type CommonCredentialResponse, type CommonCredentialSupported, type CompactJWSHeaderParameters, type ComponentOptions, type CreateCredentialOfferURIResult, CreateRequestObjectMode, type CredentialConfigurationSupported, type CredentialConfigurationSupportedCommonV1_0, type CredentialConfigurationSupportedCommonV1_0_15, type CredentialConfigurationSupportedJwtVcJsonLdAndLdpVcV1_0, type CredentialConfigurationSupportedJwtVcJsonLdAndLdpVcV1_0_15, type CredentialConfigurationSupportedJwtVcJsonV1_0, type CredentialConfigurationSupportedJwtVcJsonV1_0_15, type CredentialConfigurationSupportedMsoMdocV1_0, type CredentialConfigurationSupportedMsoMdocV1_0_15, type CredentialConfigurationSupportedSdJwtVcV1_0, type CredentialConfigurationSupportedSdJwtVcV1_0_15, type CredentialConfigurationSupportedV1_0, type CredentialConfigurationSupportedV1_0_15, type CredentialDataSupplierInput, type CredentialDefinitionJwtVcJsonLdAndLdpVcV1_0_15, type CredentialDefinitionJwtVcJsonV1_0_15, type CredentialErrorResponseV1_0, type CredentialErrorResponseV1_0_15, CredentialEventNames, type CredentialIssuerMetadata, type CredentialIssuerMetadataOpts, type CredentialIssuerMetadataOptsV1_0, type CredentialIssuerMetadataOptsV1_0_15, type CredentialIssuerMetadataV1_0, type CredentialIssuerMetadataV1_0_15, type CredentialMetadataV1_0, type CredentialMetadataV1_0_15, type CredentialOffer, CredentialOfferEventNames, type CredentialOfferFormatJwtVcJson, type CredentialOfferFormatJwtVcJsonLdAndLdpVc, type CredentialOfferFormatMsoMdoc, type CredentialOfferFormatSdJwtVc, type CredentialOfferFormatSdJwtVcv13, type CredentialOfferFormatV1_0_11, type CredentialOfferMode, type CredentialOfferPayload, type CredentialOfferPayloadLatest, type CredentialOfferPayloadV1_0, type CredentialOfferPayloadV1_0_15, type CredentialOfferRESTRequestV1_0, type CredentialOfferRESTRequestV1_0_15, type CredentialOfferRequestWithBaseUrl, type CredentialOfferSession, type CredentialOfferV1_0, type CredentialOfferV1_0_15, type CredentialRequest, type CredentialRequestJwtVcJson, type CredentialRequestJwtVcJsonLdAndLdpVc, type CredentialRequestMsoMdoc, type CredentialRequestSdJwtVc, type CredentialRequestV1_0, type CredentialRequestV1_0Common, type CredentialRequestV1_0ResponseEncryption, type CredentialRequestV1_0_15, type CredentialRequestV1_0_15Common, type CredentialRequestV1_0_15CredentialConfigurationId, type CredentialRequestV1_0_15CredentialIdentifier, type CredentialRequestV1_0_15ResponseEncryption, type CredentialResponse, type CredentialResponseCredentialV1_0_15, type CredentialResponseJwtVc, type CredentialResponseLdpVc, type CredentialResponseSdJwtVc, type CredentialResponseV1_0, type CredentialResponseV1_0_15, type CredentialSubjectDisplay, type CredentialSupplierConfig, type CredentialSupportedBrief, type CredentialSupportedJwtVcJson, type CredentialSupportedJwtVcJsonLdAndLdpVc, type CredentialSupportedMsoMdoc, type CredentialSupportedSdJwtVc, type CredentialSupportedSdJwtVcV13, type CredentialsSupportedDisplay, type CredentialsSupportedLegacy, type CwtProofOfPossession, DID_NO_DIDDOC_ERROR, type DPoPResponseParams, type DecodeURIAsJsonOpts, DefaultURISchemes, type DeferredCredentialResponseV1_0, type DeferredCredentialResponseV1_0_15, EVENTS, EXPERIMENTAL_SUBJECT_PROOF_MODE_ENABLED, EXPIRED_PRE_AUTHORIZED_CODE, type EncValue, type EncodeJsonAsURIOpts, Encoding, type EndpointMetadata, type EndpointMetadataResult, type EndpointMetadataResultV1_0, type EndpointMetadataResultV1_0_15, type ErrorResponse, type EventNames, type ExperimentalSubjectIssuance, GRANTS_MUST_NOT_BE_UNDEFINED, type Grant, type GrantAuthorizationCode, GrantTypes, type GrantUrnIetf, IAT_ERROR, INVALID_PRE_AUTHORIZED_CODE, ISSUER_CONFIG_ERROR, ISS_MUST_BE_CLIENT_ID, ISS_PRESENT_IN_PRE_AUTHORIZED_CODE_CONTEXT, type IStateManager, type ImageInfo, type InputCharSet, IssueStatus, type IssueStatusResponse, type IssuerCredentialSubject, type IssuerCredentialSubjectDisplay, type IssuerMetadata, type IssuerMetadataV1_0, type IssuerMetadataV1_0_15, type IssuerOpts, type JWSHeaderParameters, JWS_NOT_VALID, type JWTHeader, type JWTHeaderParameters, type JWTPayload, type JWTSignerCallback, type JWTVerifyCallback, JWT_SIGNER_CALLBACK_REQUIRED_ERROR, JWT_VERIFY_CONFIG_ERROR, type JoseHeaderParameters, type JsonLdIssuerCredentialDefinition, JsonURIMode, type Jwt, type JwtProofOfPossession, type JwtProps, type JwtVerifyResult, KID_DID_NO_DID_ERROR, KID_JWK_X5C_ERROR, type KeyAttestationJWT, type KeyAttestationsRequiredV1_0_15, type KeyProofType, type LogEvents, type LogoAndColor, type MetadataDisplay, NONCE_ERROR, NONCE_LENGTH, NONCE_STATE_MANAGER_REQUIRED_ERROR, NO_ISS_IN_AUTHORIZATION_CODE_CONTEXT, NO_JWT_PROVIDED, type NameAndLocale, type NonceRequestV1_0, type NonceRequestV1_0_15, type NonceResponseV1_0, type NonceResponseV1_0_15, type NotificationError, type NotificationErrorResponse, type NotificationErrorResponseV1_0, type NotificationErrorResponseV1_0_15, type NotificationEventType, type NotificationRequest, type NotificationResponseResult, type NotificationResponseV1_0, type NotificationResponseV1_0_15, NotificationStatusEventNames, type OAuthGrantType, type OAuthResponseMode, type OAuthResponseType, type OAuthScope, type OID4VCICredentialFormat, type OpenIDResponse, OpenId4VCIVersion, PARMode, PIN_NOT_MATCH_ERROR, PIN_VALIDATION_ERROR, type PKCECodeChallengeMethod, type PKCEOpts, PRE_AUTHORIZED_CODE_REQUIRED_ERROR, PRE_AUTH_CODE_LITERAL, PRE_AUTH_GRANT_LITERAL, PROOF_CANT_BE_CONSTRUCTED, type PoPMode, type ProofOfPossession, type ProofOfPossessionCallbacks, type ProofOfPossessionMap, type ProofType, type ProofTypeV1_0, type ProofTypeV1_0_15, type ProofTypesSupported, type ProofTypesSupportedV1_0, type ProofTypesV1_0, type ProofTypesV1_0_15, type PushedAuthorizationResponse, type QRCodeOpts, type RequestObjectOpts, type ResponseEncryption, ResponseType, type RevocationEndpointAuthMethod, type RevocationEndpointAuthSigningAlg, STATE_MANAGER_REQUIRED_ERROR, STATE_MISSING_ERROR, type SearchValue, type SignedMetadataVerifyCallback, type StateType, type StatusListOpts, type SubjectProofMode, type SubjectProofNotificationEventsSupported, TYP_ERROR, type TokenEndpointAuthMethod, type TokenEndpointAuthSigningAlg, TokenError, TokenErrorResponse, type TokenResponseV1_0, type TokenResponseV1_0_15, type TxCode, type TxCodeAndPinRequired, type Typ, UNKNOWN_CLIENT_ERROR, UNSUPPORTED_GRANT_TYPE_ERROR, type URIState, URL_NOT_VALID, USER_PIN_NOT_REQUIRED_ERROR, USER_PIN_REQUIRED_ERROR, USER_PIN_TX_CODE_SPEC_ERROR, type UniformCredentialOffer, type UniformCredentialOfferPayload, type UniformCredentialOfferRequest, VCI_LOGGERS, VCI_LOG_COMMON, WRONG_METADATA_FORMAT, type WalletAttestationJWT, WellKnownEndpoints, acquireDeferredCredential, adjustUrl, assertValidCodeVerifier, assertedUniformCredentialOffer, authorizationServerMetadataFieldNames, convertJsonToURI, convertURIToJsonObject, createCodeChallenge, createCwtProofOfPossession, createProofOfPossession, credentialIssuerMetadataFieldNamesV1_0, credentialIssuerMetadataFieldNamesV1_0_15, type credential_identifiers, decodeJsonProperties, determineFlowType, determineGrantTypes, determineSpecVersionFromOffer, determineSpecVersionFromScheme, determineSpecVersionFromURI, determineVersionsFromIssuerMetadata, extractBearerToken, formPost, generateCodeVerifier, generateNonce, generateRandomString, getClientIdFromCredentialOfferPayload, getCredentialConfigurationIdsFromOfferV1_0_15, getCredentialOfferPayload, getFormatForVersion, getIssuerDisplays, getIssuerFromCredentialOfferPayload, getIssuerName, getJson, getNumberOrUndefined, getScheme, getStateFromCredentialOfferPayload, getSupportedCredential, getSupportedCredentials, getTypesFromAuthorizationDetails, getTypesFromCredentialSupported, getTypesFromObject, getURIComponentsAsArray, getUniformFormat, isCredentialOfferVersion, isDeferredCredentialIssuancePending, isDeferredCredentialResponse, isFormat, isJWS, isNotFormat, isPreAuthCode, isValidURL, isW3cCredentialSupported, normalizeOfferInput, post, processSignedMetadata, resolveCredentialOfferURI, supportedOID4VCICredentialFormat, toAuthorizationResponsePayload, toUniformCredentialOfferPayload, toUniformCredentialOfferRequest, trimBoth, trimEnd, trimStart, validateJWT };
package/dist/index.js CHANGED
@@ -181,6 +181,26 @@ var credentialIssuerMetadataFieldNamesV1_0_15 = [
181
181
  "authorization_challenge_endpoint"
182
182
  ];
183
183
 
184
+ // lib/types/v1_0.types.ts
185
+ var credentialIssuerMetadataFieldNamesV1_0 = [
186
+ "credential_issuer",
187
+ "credential_configurations_supported",
188
+ "credential_endpoint",
189
+ "nonce_endpoint",
190
+ "deferred_credential_endpoint",
191
+ "notification_endpoint",
192
+ "credential_response_encryption",
193
+ "batch_credential_issuance_supported",
194
+ "credential_issuer_public_key",
195
+ "authorization_servers",
196
+ "token_endpoint",
197
+ "display",
198
+ "credential_supplier_config",
199
+ "credential_identifiers_supported",
200
+ "signed_metadata",
201
+ "authorization_challenge_endpoint"
202
+ ];
203
+
184
204
  // lib/types/ServerMetadata.ts
185
205
  var authorizationServerMetadataFieldNames = [
186
206
  "issuer",
@@ -256,6 +276,7 @@ var WRONG_METADATA_FORMAT = "Wrong metadata format";
256
276
  // lib/types/OpenID4VCIVersions.types.ts
257
277
  var OpenId4VCIVersion = /* @__PURE__ */ (function(OpenId4VCIVersion2) {
258
278
  OpenId4VCIVersion2[OpenId4VCIVersion2["VER_1_0_15"] = 1015] = "VER_1_0_15";
279
+ OpenId4VCIVersion2[OpenId4VCIVersion2["VER_1_0"] = 1100] = "VER_1_0";
259
280
  OpenId4VCIVersion2[OpenId4VCIVersion2["VER_UNKNOWN"] = Number.MAX_VALUE] = "VER_UNKNOWN";
260
281
  return OpenId4VCIVersion2;
261
282
  })({});
@@ -435,7 +456,8 @@ var adjustUrl = /* @__PURE__ */ __name((urlOrPath, opts) => {
435
456
  // lib/functions/CredentialResponseUtil.ts
436
457
  function isDeferredCredentialResponse(credentialResponse) {
437
458
  const orig = credentialResponse.successBody;
438
- return credentialResponse.origResponse.status % 200 <= 2 && !!orig && !orig.credentials && (!!orig.acceptance_token || !!orig.transaction_id);
459
+ const hasNoCredential = !orig?.credentials && !orig?.credential;
460
+ return credentialResponse.origResponse.status % 200 <= 2 && !!orig && hasNoCredential && (!!orig.acceptance_token || !!orig.transaction_id);
439
461
  }
440
462
  __name(isDeferredCredentialResponse, "isDeferredCredentialResponse");
441
463
  function assertNonFatalError(credentialResponse) {
@@ -473,7 +495,7 @@ async function acquireDeferredCredential({ bearerToken, transactionId, deferredC
473
495
  deferredCredentialEndpoint
474
496
  });
475
497
  const DEFAULT_SLEEP_IN_MS = 5e3;
476
- while (!credentialResponse.successBody?.credentials && deferredCredentialAwait) {
498
+ while (!credentialResponse.successBody?.credentials && !credentialResponse.successBody?.credential && deferredCredentialAwait) {
477
499
  assertNonFatalError(credentialResponse);
478
500
  const pending = isDeferredCredentialIssuancePending(credentialResponse);
479
501
  console.log(`Issuance still pending?: ${pending}`);
@@ -513,7 +535,7 @@ var logger2 = Loggers2.DEFAULT.get("sphereon:oid4vci:offer");
513
535
  function determineSpecVersionFromURI(uri) {
514
536
  let version = determineSpecVersionFromScheme(uri, OpenId4VCIVersion.VER_UNKNOWN) ?? OpenId4VCIVersion.VER_UNKNOWN;
515
537
  if (version === OpenId4VCIVersion.VER_UNKNOWN) {
516
- version = OpenId4VCIVersion.VER_1_0_15;
538
+ version = OpenId4VCIVersion.VER_1_0;
517
539
  }
518
540
  return version;
519
541
  }
@@ -645,7 +667,7 @@ var getStateFromCredentialOfferPayload = /* @__PURE__ */ __name((credentialOffer
645
667
  }, "getStateFromCredentialOfferPayload");
646
668
  function determineSpecVersionFromOffer(offer) {
647
669
  if (isCredentialOfferV1_0_15(offer)) {
648
- return OpenId4VCIVersion.VER_1_0_15;
670
+ return OpenId4VCIVersion.VER_1_0;
649
671
  }
650
672
  return OpenId4VCIVersion.VER_UNKNOWN;
651
673
  }
@@ -1025,19 +1047,22 @@ function getTypesFromAuthorizationDetails(authDetails, opts) {
1025
1047
  __name(getTypesFromAuthorizationDetails, "getTypesFromAuthorizationDetails");
1026
1048
  function getTypesFromCredentialSupported(credentialSupported, opts) {
1027
1049
  let types = [];
1028
- if (credentialSupported.format === "jwt_vc_json" || credentialSupported.format === "jwt_vc" || credentialSupported.format === "jwt_vc_json-ld" || credentialSupported.format === "ldp_vc") {
1050
+ const format = credentialSupported.format;
1051
+ if (format === "jwt_vc_json" || format === "jwt_vc" || format === "jwt_vc_json-ld" || format === "ldp_vc") {
1029
1052
  types = getTypesFromObject(credentialSupported) ?? [];
1030
- } else if (credentialSupported.format === "dc+sd-jwt" || credentialSupported.format === "vc+sd-jwt") {
1053
+ } else if (format === "dc+sd-jwt" || format === "vc+sd-jwt") {
1031
1054
  types = [
1032
1055
  credentialSupported.vct
1033
1056
  ];
1034
- } else if (credentialSupported.format === "mso_mdoc") {
1057
+ } else if (format === "mso_mdoc") {
1035
1058
  types = [
1036
1059
  credentialSupported.doctype
1037
1060
  ];
1061
+ } else {
1062
+ throw Error(`Unsupported credential format '${format}'`);
1038
1063
  }
1039
1064
  if (!types || types.length === 0) {
1040
- throw Error("Could not deduce types from credential supported");
1065
+ throw Error(`Could not deduce types from credential supported (format '${format}')`);
1041
1066
  }
1042
1067
  if (opts?.filterVerifiableCredential) {
1043
1068
  return types.filter((type) => type !== "VerifiableCredential");
@@ -1070,7 +1095,37 @@ __name(getSupportedCredentials, "getSupportedCredentials");
1070
1095
  function determineVersionsFromIssuerMetadata(issuerMetadata) {
1071
1096
  const versions = /* @__PURE__ */ new Set();
1072
1097
  if ("credential_configurations_supported" in issuerMetadata) {
1073
- versions.add(OpenId4VCIVersion.VER_1_0_15);
1098
+ let is1_0Final = false;
1099
+ if ("batch_credential_issuance_supported" in issuerMetadata && typeof issuerMetadata.batch_credential_issuance_supported === "boolean") {
1100
+ is1_0Final = true;
1101
+ }
1102
+ if ("credential_issuer_public_key" in issuerMetadata) {
1103
+ is1_0Final = true;
1104
+ }
1105
+ if (!is1_0Final) {
1106
+ const configs = issuerMetadata.credential_configurations_supported;
1107
+ if (configs) {
1108
+ for (const config of Object.values(configs)) {
1109
+ if ("cryptographic_suites_supported" in config) {
1110
+ is1_0Final = true;
1111
+ break;
1112
+ }
1113
+ if (config.proof_types_supported && "di_vp" in config.proof_types_supported) {
1114
+ is1_0Final = true;
1115
+ break;
1116
+ }
1117
+ }
1118
+ }
1119
+ }
1120
+ if (is1_0Final) {
1121
+ versions.add(OpenId4VCIVersion.VER_1_0);
1122
+ } else {
1123
+ if ("batch_credential_issuance" in issuerMetadata && typeof issuerMetadata.batch_credential_issuance === "object") {
1124
+ versions.add(OpenId4VCIVersion.VER_1_0_15);
1125
+ } else {
1126
+ versions.add(OpenId4VCIVersion.VER_1_0);
1127
+ }
1128
+ }
1074
1129
  }
1075
1130
  if (versions.size === 0) {
1076
1131
  versions.add(OpenId4VCIVersion.VER_UNKNOWN);
@@ -1227,6 +1282,16 @@ var createProofOfPossession = /* @__PURE__ */ __name(async (popMode, callbacks,
1227
1282
  ${jwt}`);
1228
1283
  return proof;
1229
1284
  }, "createProofOfPossession");
1285
+ var createCwtProofOfPossession = /* @__PURE__ */ __name(async (callbacks, opts) => {
1286
+ if (!callbacks.cwtSignCallback) {
1287
+ throw new Error("No CWT signer callback supplied");
1288
+ }
1289
+ const cwt = await callbacks.cwtSignCallback(opts);
1290
+ return {
1291
+ proof_type: "cwt",
1292
+ cwt
1293
+ };
1294
+ }, "createCwtProofOfPossession");
1230
1295
  var partiallyValidateJWS = /* @__PURE__ */ __name((jws) => {
1231
1296
  if (jws.split(".").length !== 3 || !jws.startsWith("ey")) {
1232
1297
  throw new Error(JWS_NOT_VALID);
@@ -1393,6 +1458,32 @@ var assertValidCodeVerifier = /* @__PURE__ */ __name((codeVerifier) => {
1393
1458
  }
1394
1459
  }, "assertValidCodeVerifier");
1395
1460
 
1461
+ // lib/functions/SignedMetadataUtils.ts
1462
+ async function processSignedMetadata(opts) {
1463
+ const { metadata, issuer, signedMetadataVerifyCallback } = opts;
1464
+ if (!metadata.signed_metadata) {
1465
+ return metadata;
1466
+ }
1467
+ if (!signedMetadataVerifyCallback) {
1468
+ VCI_LOG_COMMON.warning(`Issuer ${issuer} provides signed_metadata but no signedMetadataVerifyCallback was provided. Signed metadata will not be verified or applied.`);
1469
+ return metadata;
1470
+ }
1471
+ const result = await signedMetadataVerifyCallback({
1472
+ signedMetadata: metadata.signed_metadata,
1473
+ issuer
1474
+ });
1475
+ if (!result.verified) {
1476
+ throw Error(`Signed metadata verification failed for issuer ${issuer}`);
1477
+ }
1478
+ VCI_LOG_COMMON.info(`Signed metadata verified for issuer ${issuer}, applying signed claims`);
1479
+ const { iss: _iss, iat: _iat, exp: _exp, nbf: _nbf, jti: _jti, aud: _aud, sub: _sub, ...metadataClaims } = result.metadata;
1480
+ return {
1481
+ ...metadata,
1482
+ ...metadataClaims
1483
+ };
1484
+ }
1485
+ __name(processSignedMetadata, "processSignedMetadata");
1486
+
1396
1487
  // lib/experimental/holder-vci.ts
1397
1488
  var EXPERIMENTAL_SUBJECT_PROOF_MODE_ENABLED = process.env.EXPERIMENTAL_SUBJECT_PROOF_MODE?.trim().toLowerCase() === "true";
1398
1489
 
@@ -1491,7 +1582,9 @@ export {
1491
1582
  convertJsonToURI,
1492
1583
  convertURIToJsonObject,
1493
1584
  createCodeChallenge,
1585
+ createCwtProofOfPossession,
1494
1586
  createProofOfPossession,
1587
+ credentialIssuerMetadataFieldNamesV1_0,
1495
1588
  credentialIssuerMetadataFieldNamesV1_0_15,
1496
1589
  decodeJsonProperties,
1497
1590
  determineFlowType,
@@ -1534,6 +1627,7 @@ export {
1534
1627
  isW3cCredentialSupported,
1535
1628
  normalizeOfferInput,
1536
1629
  post,
1630
+ processSignedMetadata,
1537
1631
  resolveCredentialOfferURI,
1538
1632
  supportedOID4VCICredentialFormat,
1539
1633
  toAuthorizationResponsePayload,