@sphereon/ssi-types 0.37.2-next.34 → 0.37.2-next.46

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.cts CHANGED
@@ -335,6 +335,7 @@ declare function encodeMdocIssuerSigned(issuerSigned: MdocIssuerSigned, encoding
335
335
  declare function decodeMdocDeviceResponse(vpToken: MdocOid4vpMdocVpToken): MdocDeviceResponse;
336
336
  declare const mdocDecodedCredentialToUniformCredential: (decoded: MdocDocument, opts?: {
337
337
  maxTimeSkewInMS?: number;
338
+ issuer?: string;
338
339
  }) => IVerifiableCredential;
339
340
 
340
341
  /**
@@ -475,7 +476,7 @@ declare class CredentialMapper {
475
476
  * @param credential
476
477
  * @param hasher Hasher implementation to use for SD-JWT decoding
477
478
  */
478
- static decodeVerifiableCredential(credential: OriginalVerifiableCredential, hasher?: HasherSync): JwtDecodedVerifiableCredential | IVerifiableCredential | SdJwtDecodedVerifiableCredential;
479
+ static decodeVerifiableCredential(credential: OriginalVerifiableCredential, hasher?: HasherSync): JwtDecodedVerifiableCredential | IVerifiableCredential | SdJwtDecodedVerifiableCredential | MdocDocument;
479
480
  /**
480
481
  * Converts a presentation to a wrapped presentation.
481
482
  *
@@ -1348,6 +1349,10 @@ interface SdJwtSimpleRenderingMetadata {
1348
1349
  * OPTIONAL. Metadata for the logo image.
1349
1350
  */
1350
1351
  logo?: SdJwtLogoMetadata;
1352
+ /**
1353
+ * OPTIONAL. Metadata for the background image.
1354
+ */
1355
+ background_image?: SdJwtImageMetadata;
1351
1356
  /**
1352
1357
  * OPTIONAL. Background color for the credential.
1353
1358
  */
@@ -1357,6 +1362,23 @@ interface SdJwtSimpleRenderingMetadata {
1357
1362
  */
1358
1363
  text_color?: string;
1359
1364
  }
1365
+ /**
1366
+ * Represents metadata for an image (logo, background image, etc.).
1367
+ */
1368
+ interface SdJwtImageMetadata {
1369
+ /**
1370
+ * REQUIRED. URI pointing to the image.
1371
+ */
1372
+ uri: string;
1373
+ /**
1374
+ * OPTIONAL. Integrity metadata string for the 'uri' field.
1375
+ */
1376
+ ['uri#integrity']?: string;
1377
+ /**
1378
+ * OPTIONAL. Alternative text for the image.
1379
+ */
1380
+ alt_text?: string;
1381
+ }
1360
1382
  /**
1361
1383
  * Represents metadata for a logo.
1362
1384
  */
@@ -1653,4 +1675,4 @@ declare class BasicEventEmitter extends EventEmitter {
1653
1675
  emit(eventName: string, event: BasicEvent<any, any>, ...args: any[]): boolean;
1654
1676
  }
1655
1677
 
1656
- export { type ActionSubType, ActionType, type AdditionalClaims, type BaseJWK, type BasicEvent, BasicEventEmitter, type BearerTokenArg, type CWT, type ClaimFormat, type CompactJWT, type CompactSdJwtVc, type ConditionWeightedThreshold, type CredentialConstraint, type CredentialEncoding, type CredentialFormat, CredentialMapper, type CredentialProofFormat, CredentialRole, type DIDDocument, type DIDDocumentMetadata, type DIDResolutionMetadata, type DIDResolutionOptions, type DIDResolutionResult, type DataModel, DefaultActionSubType, type Descriptor, type DeviceSignedJson, type DiObject, DocumentFormat, type DocumentJson, type EventData, EventManager, type Extensible, type Format, type Hasher, type HasherSync, ICoseCurve, type ICoseKeyJson, ICoseKeyOperation, ICoseKeyType, ICoseSignatureAlgorithm, type ICredential, type ICredentialContext, type ICredentialContextType, type ICredentialSchema, type ICredentialSchemaType, type ICredentialStatus, type ICredentialSubject, type IError, type IErrorDetails, type IHasProof, type IIssuer, type IIssuerId, type IMetadataImportArgs, type IParsedDID, type IPresentation, type IProof, IProofPurpose, IProofType, type ISimpleLogger, type IValidationResult, type IValidationResults, type IVcdm2Credential, type IVcdmBaseCredential, type IVerifiableCredential, type IVerifiablePresentation, type IVerifyResult, type IVerifySingleResultItem, type IVerifySingleResultLog, type IVerifyStatusResult, InitiatorType, type IssuerAttributeName, type IssuerSignedItemJson, type IssuerSignedJson, type JWK, JWT_PROOF_TYPE_2020, JoseCurve, type JoseCurveString, JoseKeyOperation, type JoseKeyOperationString, JoseSignatureAlgorithm, type JoseSignatureAlgorithmString, type JsonValue, type JsonWebKey, JwkKeyType, type JwkKeyTypeString, type JwtDecodedVerifiableCredential, type JwtDecodedVerifiablePresentation, type JwtObject, type KeyCapabilitySection, type LanguageValueClaim, type LdpObject, LogLevel, LogMethod, Loggers, LoggingEventType, type MdocDecodedPayload, type MdocDeviceResponse, type MdocDocument, type MdocDocumentJson, type MdocIssuerSigned, type MdocOid4vpIssuerSigned, type MdocOid4vpMdocVpToken, type MetadataType, type MsoMdocObject, ObjectUtils, type Optional, type OrPromise, type Original, OriginalType, type OriginalVerifiableCredential, type OriginalVerifiablePresentation, type PresentationFormat, type PresentationSubmission, type RequireOneOf, type SDJWTVCDM2Config, type SdJwtClaimDisplayMetadata, type SdJwtClaimMetadata, type SdJwtClaimPath, type SdJwtClaimSelectiveDisclosure, type SdJwtCredentialInput, type SdJwtDecodedDisclosure, type SdJwtDecodedVerifiableCredential, type SdJwtDecodedVerifiableCredentialPayload, type SdJwtDisclosure, type SdJwtDisclosureFrame, type SdJwtJsonValue, type SdJwtLogoMetadata, type SdJwtObject, type SdJwtPayload, type SdJwtPresentationFrame, type SdJwtSVGTemplateMetadata, type SdJwtSVGTemplateProperties, type SdJwtSignedVerifiableCredentialPayload, type SdJwtSimpleRenderingMetadata, type SdJwtType, type SdJwtTypeDisplayMetadata, type SdJwtTypeHasher, type SdJwtTypeMetadata, type SdJwtTypeRenderingMetadata, type SdJwtVcKbJwtHeader, type SdJwtVcKbJwtPayload, type SdJwtVcType, type SdJwtVcdm2Payload, type SdJwtVpType, type Service, type ServiceEndpoint, type SimpleLogEvent, type SimpleLogOptions, SimpleLogger, SimpleRecordLogger, type SingleOrArray, type StatusListCredential, StatusListCredentialIdMode, StatusListDriverType, type StatusListFetcher, type StatusListIndexingDirection, StatusListType, type StatusPurpose2021, type StatusValidator, SubSystem, type SubjectAttributeName, System, SystemCorrelationIdType, type TypeAttributeName, type UniformVerifiablePresentation, VCDM_CREDENTIAL_CONTEXT_V1, VCDM_CREDENTIAL_CONTEXT_V2, VCDM_CREDENTIAL_CONTEXT_VERSIONS, type VerificationMethod, type W3CVerifiableCredential, type W3CVerifiablePresentation, type WrappedMdocCredential, type WrappedMdocPresentation, type WrappedSdJwtVerifiableCredential, type WrappedSdJwtVerifiablePresentation, type WrappedVerifiableCredential, type WrappedVerifiablePresentation, type WrappedW3CVerifiableCredential, type WrappedW3CVerifiablePresentation, addVcdmContextIfNeeded, decodeMdocDeviceResponse, decodeMdocIssuerSigned, decodeSdJwtVc, decodeSdJwtVcAsync, defaultHasher, encodeMdocIssuerSigned, getMdocDecodedPayload, isLanguageValueObject, isLanguageValueObjects, isVcdm1Credential, isVcdm2Credential, isWrappedMdocCredential, isWrappedMdocPresentation, isWrappedSdJwtVerifiableCredential, isWrappedSdJwtVerifiablePresentation, isWrappedW3CVerifiableCredential, isWrappedW3CVerifiablePresentation, logOptions, mapLanguageValue, mapLanguageValues, mdocDecodedCredentialToUniformCredential, parseDid, sdJwtDecodedCredentialToUniformCredential, sha256, shaHasher, toLanguageValueObject, toLanguageValueObjects };
1678
+ export { type ActionSubType, ActionType, type AdditionalClaims, type BaseJWK, type BasicEvent, BasicEventEmitter, type BearerTokenArg, type CWT, type ClaimFormat, type CompactJWT, type CompactSdJwtVc, type ConditionWeightedThreshold, type CredentialConstraint, type CredentialEncoding, type CredentialFormat, CredentialMapper, type CredentialProofFormat, CredentialRole, type DIDDocument, type DIDDocumentMetadata, type DIDResolutionMetadata, type DIDResolutionOptions, type DIDResolutionResult, type DataModel, DefaultActionSubType, type Descriptor, type DeviceSignedJson, type DiObject, DocumentFormat, type DocumentJson, type EventData, EventManager, type Extensible, type Format, type Hasher, type HasherSync, ICoseCurve, type ICoseKeyJson, ICoseKeyOperation, ICoseKeyType, ICoseSignatureAlgorithm, type ICredential, type ICredentialContext, type ICredentialContextType, type ICredentialSchema, type ICredentialSchemaType, type ICredentialStatus, type ICredentialSubject, type IError, type IErrorDetails, type IHasProof, type IIssuer, type IIssuerId, type IMetadataImportArgs, type IParsedDID, type IPresentation, type IProof, IProofPurpose, IProofType, type ISimpleLogger, type IValidationResult, type IValidationResults, type IVcdm2Credential, type IVcdmBaseCredential, type IVerifiableCredential, type IVerifiablePresentation, type IVerifyResult, type IVerifySingleResultItem, type IVerifySingleResultLog, type IVerifyStatusResult, InitiatorType, type IssuerAttributeName, type IssuerSignedItemJson, type IssuerSignedJson, type JWK, JWT_PROOF_TYPE_2020, JoseCurve, type JoseCurveString, JoseKeyOperation, type JoseKeyOperationString, JoseSignatureAlgorithm, type JoseSignatureAlgorithmString, type JsonValue, type JsonWebKey, JwkKeyType, type JwkKeyTypeString, type JwtDecodedVerifiableCredential, type JwtDecodedVerifiablePresentation, type JwtObject, type KeyCapabilitySection, type LanguageValueClaim, type LdpObject, LogLevel, LogMethod, Loggers, LoggingEventType, type MdocDecodedPayload, type MdocDeviceResponse, type MdocDocument, type MdocDocumentJson, type MdocIssuerSigned, type MdocOid4vpIssuerSigned, type MdocOid4vpMdocVpToken, type MetadataType, type MsoMdocObject, ObjectUtils, type Optional, type OrPromise, type Original, OriginalType, type OriginalVerifiableCredential, type OriginalVerifiablePresentation, type PresentationFormat, type PresentationSubmission, type RequireOneOf, type SDJWTVCDM2Config, type SdJwtClaimDisplayMetadata, type SdJwtClaimMetadata, type SdJwtClaimPath, type SdJwtClaimSelectiveDisclosure, type SdJwtCredentialInput, type SdJwtDecodedDisclosure, type SdJwtDecodedVerifiableCredential, type SdJwtDecodedVerifiableCredentialPayload, type SdJwtDisclosure, type SdJwtDisclosureFrame, type SdJwtImageMetadata, type SdJwtJsonValue, type SdJwtLogoMetadata, type SdJwtObject, type SdJwtPayload, type SdJwtPresentationFrame, type SdJwtSVGTemplateMetadata, type SdJwtSVGTemplateProperties, type SdJwtSignedVerifiableCredentialPayload, type SdJwtSimpleRenderingMetadata, type SdJwtType, type SdJwtTypeDisplayMetadata, type SdJwtTypeHasher, type SdJwtTypeMetadata, type SdJwtTypeRenderingMetadata, type SdJwtVcKbJwtHeader, type SdJwtVcKbJwtPayload, type SdJwtVcType, type SdJwtVcdm2Payload, type SdJwtVpType, type Service, type ServiceEndpoint, type SimpleLogEvent, type SimpleLogOptions, SimpleLogger, SimpleRecordLogger, type SingleOrArray, type StatusListCredential, StatusListCredentialIdMode, StatusListDriverType, type StatusListFetcher, type StatusListIndexingDirection, StatusListType, type StatusPurpose2021, type StatusValidator, SubSystem, type SubjectAttributeName, System, SystemCorrelationIdType, type TypeAttributeName, type UniformVerifiablePresentation, VCDM_CREDENTIAL_CONTEXT_V1, VCDM_CREDENTIAL_CONTEXT_V2, VCDM_CREDENTIAL_CONTEXT_VERSIONS, type VerificationMethod, type W3CVerifiableCredential, type W3CVerifiablePresentation, type WrappedMdocCredential, type WrappedMdocPresentation, type WrappedSdJwtVerifiableCredential, type WrappedSdJwtVerifiablePresentation, type WrappedVerifiableCredential, type WrappedVerifiablePresentation, type WrappedW3CVerifiableCredential, type WrappedW3CVerifiablePresentation, addVcdmContextIfNeeded, decodeMdocDeviceResponse, decodeMdocIssuerSigned, decodeSdJwtVc, decodeSdJwtVcAsync, defaultHasher, encodeMdocIssuerSigned, getMdocDecodedPayload, isLanguageValueObject, isLanguageValueObjects, isVcdm1Credential, isVcdm2Credential, isWrappedMdocCredential, isWrappedMdocPresentation, isWrappedSdJwtVerifiableCredential, isWrappedSdJwtVerifiablePresentation, isWrappedW3CVerifiableCredential, isWrappedW3CVerifiablePresentation, logOptions, mapLanguageValue, mapLanguageValues, mdocDecodedCredentialToUniformCredential, parseDid, sdJwtDecodedCredentialToUniformCredential, sha256, shaHasher, toLanguageValueObject, toLanguageValueObjects };
package/dist/index.d.ts CHANGED
@@ -335,6 +335,7 @@ declare function encodeMdocIssuerSigned(issuerSigned: MdocIssuerSigned, encoding
335
335
  declare function decodeMdocDeviceResponse(vpToken: MdocOid4vpMdocVpToken): MdocDeviceResponse;
336
336
  declare const mdocDecodedCredentialToUniformCredential: (decoded: MdocDocument, opts?: {
337
337
  maxTimeSkewInMS?: number;
338
+ issuer?: string;
338
339
  }) => IVerifiableCredential;
339
340
 
340
341
  /**
@@ -475,7 +476,7 @@ declare class CredentialMapper {
475
476
  * @param credential
476
477
  * @param hasher Hasher implementation to use for SD-JWT decoding
477
478
  */
478
- static decodeVerifiableCredential(credential: OriginalVerifiableCredential, hasher?: HasherSync): JwtDecodedVerifiableCredential | IVerifiableCredential | SdJwtDecodedVerifiableCredential;
479
+ static decodeVerifiableCredential(credential: OriginalVerifiableCredential, hasher?: HasherSync): JwtDecodedVerifiableCredential | IVerifiableCredential | SdJwtDecodedVerifiableCredential | MdocDocument;
479
480
  /**
480
481
  * Converts a presentation to a wrapped presentation.
481
482
  *
@@ -1348,6 +1349,10 @@ interface SdJwtSimpleRenderingMetadata {
1348
1349
  * OPTIONAL. Metadata for the logo image.
1349
1350
  */
1350
1351
  logo?: SdJwtLogoMetadata;
1352
+ /**
1353
+ * OPTIONAL. Metadata for the background image.
1354
+ */
1355
+ background_image?: SdJwtImageMetadata;
1351
1356
  /**
1352
1357
  * OPTIONAL. Background color for the credential.
1353
1358
  */
@@ -1357,6 +1362,23 @@ interface SdJwtSimpleRenderingMetadata {
1357
1362
  */
1358
1363
  text_color?: string;
1359
1364
  }
1365
+ /**
1366
+ * Represents metadata for an image (logo, background image, etc.).
1367
+ */
1368
+ interface SdJwtImageMetadata {
1369
+ /**
1370
+ * REQUIRED. URI pointing to the image.
1371
+ */
1372
+ uri: string;
1373
+ /**
1374
+ * OPTIONAL. Integrity metadata string for the 'uri' field.
1375
+ */
1376
+ ['uri#integrity']?: string;
1377
+ /**
1378
+ * OPTIONAL. Alternative text for the image.
1379
+ */
1380
+ alt_text?: string;
1381
+ }
1360
1382
  /**
1361
1383
  * Represents metadata for a logo.
1362
1384
  */
@@ -1653,4 +1675,4 @@ declare class BasicEventEmitter extends EventEmitter {
1653
1675
  emit(eventName: string, event: BasicEvent<any, any>, ...args: any[]): boolean;
1654
1676
  }
1655
1677
 
1656
- export { type ActionSubType, ActionType, type AdditionalClaims, type BaseJWK, type BasicEvent, BasicEventEmitter, type BearerTokenArg, type CWT, type ClaimFormat, type CompactJWT, type CompactSdJwtVc, type ConditionWeightedThreshold, type CredentialConstraint, type CredentialEncoding, type CredentialFormat, CredentialMapper, type CredentialProofFormat, CredentialRole, type DIDDocument, type DIDDocumentMetadata, type DIDResolutionMetadata, type DIDResolutionOptions, type DIDResolutionResult, type DataModel, DefaultActionSubType, type Descriptor, type DeviceSignedJson, type DiObject, DocumentFormat, type DocumentJson, type EventData, EventManager, type Extensible, type Format, type Hasher, type HasherSync, ICoseCurve, type ICoseKeyJson, ICoseKeyOperation, ICoseKeyType, ICoseSignatureAlgorithm, type ICredential, type ICredentialContext, type ICredentialContextType, type ICredentialSchema, type ICredentialSchemaType, type ICredentialStatus, type ICredentialSubject, type IError, type IErrorDetails, type IHasProof, type IIssuer, type IIssuerId, type IMetadataImportArgs, type IParsedDID, type IPresentation, type IProof, IProofPurpose, IProofType, type ISimpleLogger, type IValidationResult, type IValidationResults, type IVcdm2Credential, type IVcdmBaseCredential, type IVerifiableCredential, type IVerifiablePresentation, type IVerifyResult, type IVerifySingleResultItem, type IVerifySingleResultLog, type IVerifyStatusResult, InitiatorType, type IssuerAttributeName, type IssuerSignedItemJson, type IssuerSignedJson, type JWK, JWT_PROOF_TYPE_2020, JoseCurve, type JoseCurveString, JoseKeyOperation, type JoseKeyOperationString, JoseSignatureAlgorithm, type JoseSignatureAlgorithmString, type JsonValue, type JsonWebKey, JwkKeyType, type JwkKeyTypeString, type JwtDecodedVerifiableCredential, type JwtDecodedVerifiablePresentation, type JwtObject, type KeyCapabilitySection, type LanguageValueClaim, type LdpObject, LogLevel, LogMethod, Loggers, LoggingEventType, type MdocDecodedPayload, type MdocDeviceResponse, type MdocDocument, type MdocDocumentJson, type MdocIssuerSigned, type MdocOid4vpIssuerSigned, type MdocOid4vpMdocVpToken, type MetadataType, type MsoMdocObject, ObjectUtils, type Optional, type OrPromise, type Original, OriginalType, type OriginalVerifiableCredential, type OriginalVerifiablePresentation, type PresentationFormat, type PresentationSubmission, type RequireOneOf, type SDJWTVCDM2Config, type SdJwtClaimDisplayMetadata, type SdJwtClaimMetadata, type SdJwtClaimPath, type SdJwtClaimSelectiveDisclosure, type SdJwtCredentialInput, type SdJwtDecodedDisclosure, type SdJwtDecodedVerifiableCredential, type SdJwtDecodedVerifiableCredentialPayload, type SdJwtDisclosure, type SdJwtDisclosureFrame, type SdJwtJsonValue, type SdJwtLogoMetadata, type SdJwtObject, type SdJwtPayload, type SdJwtPresentationFrame, type SdJwtSVGTemplateMetadata, type SdJwtSVGTemplateProperties, type SdJwtSignedVerifiableCredentialPayload, type SdJwtSimpleRenderingMetadata, type SdJwtType, type SdJwtTypeDisplayMetadata, type SdJwtTypeHasher, type SdJwtTypeMetadata, type SdJwtTypeRenderingMetadata, type SdJwtVcKbJwtHeader, type SdJwtVcKbJwtPayload, type SdJwtVcType, type SdJwtVcdm2Payload, type SdJwtVpType, type Service, type ServiceEndpoint, type SimpleLogEvent, type SimpleLogOptions, SimpleLogger, SimpleRecordLogger, type SingleOrArray, type StatusListCredential, StatusListCredentialIdMode, StatusListDriverType, type StatusListFetcher, type StatusListIndexingDirection, StatusListType, type StatusPurpose2021, type StatusValidator, SubSystem, type SubjectAttributeName, System, SystemCorrelationIdType, type TypeAttributeName, type UniformVerifiablePresentation, VCDM_CREDENTIAL_CONTEXT_V1, VCDM_CREDENTIAL_CONTEXT_V2, VCDM_CREDENTIAL_CONTEXT_VERSIONS, type VerificationMethod, type W3CVerifiableCredential, type W3CVerifiablePresentation, type WrappedMdocCredential, type WrappedMdocPresentation, type WrappedSdJwtVerifiableCredential, type WrappedSdJwtVerifiablePresentation, type WrappedVerifiableCredential, type WrappedVerifiablePresentation, type WrappedW3CVerifiableCredential, type WrappedW3CVerifiablePresentation, addVcdmContextIfNeeded, decodeMdocDeviceResponse, decodeMdocIssuerSigned, decodeSdJwtVc, decodeSdJwtVcAsync, defaultHasher, encodeMdocIssuerSigned, getMdocDecodedPayload, isLanguageValueObject, isLanguageValueObjects, isVcdm1Credential, isVcdm2Credential, isWrappedMdocCredential, isWrappedMdocPresentation, isWrappedSdJwtVerifiableCredential, isWrappedSdJwtVerifiablePresentation, isWrappedW3CVerifiableCredential, isWrappedW3CVerifiablePresentation, logOptions, mapLanguageValue, mapLanguageValues, mdocDecodedCredentialToUniformCredential, parseDid, sdJwtDecodedCredentialToUniformCredential, sha256, shaHasher, toLanguageValueObject, toLanguageValueObjects };
1678
+ export { type ActionSubType, ActionType, type AdditionalClaims, type BaseJWK, type BasicEvent, BasicEventEmitter, type BearerTokenArg, type CWT, type ClaimFormat, type CompactJWT, type CompactSdJwtVc, type ConditionWeightedThreshold, type CredentialConstraint, type CredentialEncoding, type CredentialFormat, CredentialMapper, type CredentialProofFormat, CredentialRole, type DIDDocument, type DIDDocumentMetadata, type DIDResolutionMetadata, type DIDResolutionOptions, type DIDResolutionResult, type DataModel, DefaultActionSubType, type Descriptor, type DeviceSignedJson, type DiObject, DocumentFormat, type DocumentJson, type EventData, EventManager, type Extensible, type Format, type Hasher, type HasherSync, ICoseCurve, type ICoseKeyJson, ICoseKeyOperation, ICoseKeyType, ICoseSignatureAlgorithm, type ICredential, type ICredentialContext, type ICredentialContextType, type ICredentialSchema, type ICredentialSchemaType, type ICredentialStatus, type ICredentialSubject, type IError, type IErrorDetails, type IHasProof, type IIssuer, type IIssuerId, type IMetadataImportArgs, type IParsedDID, type IPresentation, type IProof, IProofPurpose, IProofType, type ISimpleLogger, type IValidationResult, type IValidationResults, type IVcdm2Credential, type IVcdmBaseCredential, type IVerifiableCredential, type IVerifiablePresentation, type IVerifyResult, type IVerifySingleResultItem, type IVerifySingleResultLog, type IVerifyStatusResult, InitiatorType, type IssuerAttributeName, type IssuerSignedItemJson, type IssuerSignedJson, type JWK, JWT_PROOF_TYPE_2020, JoseCurve, type JoseCurveString, JoseKeyOperation, type JoseKeyOperationString, JoseSignatureAlgorithm, type JoseSignatureAlgorithmString, type JsonValue, type JsonWebKey, JwkKeyType, type JwkKeyTypeString, type JwtDecodedVerifiableCredential, type JwtDecodedVerifiablePresentation, type JwtObject, type KeyCapabilitySection, type LanguageValueClaim, type LdpObject, LogLevel, LogMethod, Loggers, LoggingEventType, type MdocDecodedPayload, type MdocDeviceResponse, type MdocDocument, type MdocDocumentJson, type MdocIssuerSigned, type MdocOid4vpIssuerSigned, type MdocOid4vpMdocVpToken, type MetadataType, type MsoMdocObject, ObjectUtils, type Optional, type OrPromise, type Original, OriginalType, type OriginalVerifiableCredential, type OriginalVerifiablePresentation, type PresentationFormat, type PresentationSubmission, type RequireOneOf, type SDJWTVCDM2Config, type SdJwtClaimDisplayMetadata, type SdJwtClaimMetadata, type SdJwtClaimPath, type SdJwtClaimSelectiveDisclosure, type SdJwtCredentialInput, type SdJwtDecodedDisclosure, type SdJwtDecodedVerifiableCredential, type SdJwtDecodedVerifiableCredentialPayload, type SdJwtDisclosure, type SdJwtDisclosureFrame, type SdJwtImageMetadata, type SdJwtJsonValue, type SdJwtLogoMetadata, type SdJwtObject, type SdJwtPayload, type SdJwtPresentationFrame, type SdJwtSVGTemplateMetadata, type SdJwtSVGTemplateProperties, type SdJwtSignedVerifiableCredentialPayload, type SdJwtSimpleRenderingMetadata, type SdJwtType, type SdJwtTypeDisplayMetadata, type SdJwtTypeHasher, type SdJwtTypeMetadata, type SdJwtTypeRenderingMetadata, type SdJwtVcKbJwtHeader, type SdJwtVcKbJwtPayload, type SdJwtVcType, type SdJwtVcdm2Payload, type SdJwtVpType, type Service, type ServiceEndpoint, type SimpleLogEvent, type SimpleLogOptions, SimpleLogger, SimpleRecordLogger, type SingleOrArray, type StatusListCredential, StatusListCredentialIdMode, StatusListDriverType, type StatusListFetcher, type StatusListIndexingDirection, StatusListType, type StatusPurpose2021, type StatusValidator, SubSystem, type SubjectAttributeName, System, SystemCorrelationIdType, type TypeAttributeName, type UniformVerifiablePresentation, VCDM_CREDENTIAL_CONTEXT_V1, VCDM_CREDENTIAL_CONTEXT_V2, VCDM_CREDENTIAL_CONTEXT_VERSIONS, type VerificationMethod, type W3CVerifiableCredential, type W3CVerifiablePresentation, type WrappedMdocCredential, type WrappedMdocPresentation, type WrappedSdJwtVerifiableCredential, type WrappedSdJwtVerifiablePresentation, type WrappedVerifiableCredential, type WrappedVerifiablePresentation, type WrappedW3CVerifiableCredential, type WrappedW3CVerifiablePresentation, addVcdmContextIfNeeded, decodeMdocDeviceResponse, decodeMdocIssuerSigned, decodeSdJwtVc, decodeSdJwtVcAsync, defaultHasher, encodeMdocIssuerSigned, getMdocDecodedPayload, isLanguageValueObject, isLanguageValueObjects, isVcdm1Credential, isVcdm2Credential, isWrappedMdocCredential, isWrappedMdocPresentation, isWrappedSdJwtVerifiableCredential, isWrappedSdJwtVerifiablePresentation, isWrappedW3CVerifiableCredential, isWrappedW3CVerifiablePresentation, logOptions, mapLanguageValue, mapLanguageValues, mdocDecodedCredentialToUniformCredential, parseDid, sdJwtDecodedCredentialToUniformCredential, sha256, shaHasher, toLanguageValueObject, toLanguageValueObjects };
package/dist/index.js CHANGED
@@ -595,27 +595,63 @@ function decodeMdocDeviceResponse(vpToken) {
595
595
  return deviceResponse;
596
596
  }
597
597
  __name(decodeMdocDeviceResponse, "decodeMdocDeviceResponse");
598
+ function bytesToImageDataUri(value, mimeType = "image/jpeg") {
599
+ if (typeof value === "string") {
600
+ if (value.startsWith("data:image/")) return value;
601
+ let b64 = value.replace(/-/g, "+").replace(/_/g, "/");
602
+ const pad = b64.length % 4;
603
+ if (pad) b64 += "=".repeat(4 - pad);
604
+ return `data:${mimeType};base64,${b64}`;
605
+ }
606
+ if (value && typeof value === "object" && ("length" in value || Symbol.iterator in Object(value))) {
607
+ try {
608
+ const int8 = value instanceof Int8Array ? value : new Int8Array(value);
609
+ const base64 = com.sphereon.kmp.encodeTo(int8, com.sphereon.kmp.Encoding.BASE64);
610
+ return `data:${mimeType};base64,${base64}`;
611
+ } catch {
612
+ const bytes = value instanceof Uint8Array ? value : new Uint8Array(value);
613
+ let binary = "";
614
+ for (let i = 0; i < bytes.length; i++) binary += String.fromCharCode(bytes[i]);
615
+ const base64 = typeof btoa === "function" ? btoa(binary) : com.sphereon.kmp.encodeTo(new Int8Array(bytes), com.sphereon.kmp.Encoding.BASE64);
616
+ return `data:${mimeType};base64,${base64}`;
617
+ }
618
+ }
619
+ return String(value);
620
+ }
621
+ __name(bytesToImageDataUri, "bytesToImageDataUri");
598
622
  var mdocDecodedCredentialToUniformCredential = /* @__PURE__ */ __name((decoded, opts) => {
599
623
  const document = decoded.toJson();
600
624
  const json = document.toJsonDTO();
601
- const type = "Personal Identification Data";
602
625
  const MSO = document.MSO;
603
626
  if (!MSO || !json.issuerSigned?.nameSpaces) {
604
627
  throw Error(`Cannot access Mobile Security Object or Issuer Signed items from the Mdoc`);
605
628
  }
606
629
  const nameSpaces = json.issuerSigned.nameSpaces;
607
- if (!("eu.europa.ec.eudi.pid.1" in nameSpaces)) {
608
- throw Error(`Only PID supported at present`);
630
+ const nameSpaceKeys = Object.keys(nameSpaces);
631
+ if (nameSpaceKeys.length === 0) {
632
+ throw Error(`No namespaces found in issuer signed items`);
633
+ }
634
+ const items = [];
635
+ for (const ns of nameSpaceKeys) {
636
+ items.push(...nameSpaces[ns] || []);
609
637
  }
610
- const items = nameSpaces["eu.europa.ec.eudi.pid.1"];
611
- if (!items || items.length === 0) {
638
+ if (items.length === 0) {
612
639
  throw Error(`No issuer signed items were found`);
613
640
  }
641
+ const IMAGE_CLAIMS = /* @__PURE__ */ new Set([
642
+ "portrait",
643
+ "signature_usual_mark"
644
+ ]);
614
645
  const credentialSubject = items.reduce((acc, item) => {
615
646
  if (Array.isArray(item.value)) {
616
647
  acc[item.key] = item.value.map((val) => val.value).join(", ");
617
648
  } else {
618
- acc[item.key] = item.value.value;
649
+ const value = item.value.value;
650
+ if (IMAGE_CLAIMS.has(item.key) && value != null) {
651
+ acc[item.key] = bytesToImageDataUri(value);
652
+ } else {
653
+ acc[item.key] = value;
654
+ }
619
655
  }
620
656
  return acc;
621
657
  }, {});
@@ -628,13 +664,50 @@ var mdocDecodedCredentialToUniformCredential = /* @__PURE__ */ __name((decoded,
628
664
  if (!issuanceDate) {
629
665
  throw Error(`JWT issuance date is required but was not present`);
630
666
  }
667
+ let issuer = opts?.issuer ?? docType;
668
+ if (credentialSubject.issuing_authority) {
669
+ issuer = credentialSubject.issuing_authority;
670
+ }
671
+ try {
672
+ const x5chain = json.issuerSigned?.issuerAuth?.unprotectedHeader?.x5chain ?? json.issuerSigned?.issuerAuth?.protectedHeader?.x5chain;
673
+ if (x5chain && x5chain.length > 0) {
674
+ const b64 = x5chain[0];
675
+ let bytes;
676
+ if (typeof atob === "function") {
677
+ const binaryStr = atob(b64);
678
+ bytes = new Uint8Array(binaryStr.length);
679
+ for (let i = 0; i < binaryStr.length; i++) bytes[i] = binaryStr.charCodeAt(i);
680
+ } else {
681
+ const int8 = com.sphereon.kmp.decodeFrom(b64, com.sphereon.kmp.Encoding.BASE64);
682
+ bytes = new Uint8Array(int8);
683
+ }
684
+ let lastCn;
685
+ for (let i = 0; i < bytes.length - 5; i++) {
686
+ if (bytes[i] === 85 && bytes[i + 1] === 4 && bytes[i + 2] === 3) {
687
+ const tag = bytes[i + 3];
688
+ if (tag === 12 || tag === 19) {
689
+ const len = bytes[i + 4];
690
+ if (i + 5 + len <= bytes.length) {
691
+ const cn = String.fromCharCode(...bytes.slice(i + 5, i + 5 + len));
692
+ lastCn = cn;
693
+ }
694
+ }
695
+ }
696
+ }
697
+ if (lastCn) {
698
+ issuer = lastCn;
699
+ }
700
+ }
701
+ } catch {
702
+ }
631
703
  const credential = {
632
704
  type: [
633
705
  docType
634
706
  ],
635
707
  "@context": [],
708
+ issuer,
636
709
  credentialSubject: {
637
- type,
710
+ type: docType,
638
711
  ...credentialSubject
639
712
  },
640
713
  issuanceDate,
@@ -1030,6 +1103,10 @@ var CredentialMapper = class _CredentialMapper {
1030
1103
  return decodeSdJwtVc(credential, hasher ?? sha2562);
1031
1104
  } else if (_CredentialMapper.isSdJwtDecodedCredential(credential)) {
1032
1105
  return credential;
1106
+ } else if (_CredentialMapper.isMsoMdocOid4VPEncoded(credential)) {
1107
+ return decodeMdocIssuerSigned(credential);
1108
+ } else if (_CredentialMapper.isMsoMdocDecodedCredential(credential)) {
1109
+ return credential;
1033
1110
  } else {
1034
1111
  return credential;
1035
1112
  }