From be361dbe2e92278d5c35571334c5430a667c7552 Mon Sep 17 00:00:00 2001 From: Ajay Jadhav Date: Mon, 19 Oct 2026 10:38:49 +0530 Subject: [PATCH] fix: allow vc+sd-jwt issuance by routing SdJwtVc to sd-jwt signing path - Broaden SdJwt dispatch to also handle vc+sd-jwt (cred +sd-jwt accepts either format; credo passes the format through as typ header). - Preserve original format in thrown error to avoid narrowing to never. --- src/utils/oid4vc-agent.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/utils/oid4vc-agent.ts b/src/utils/oid4vc-agent.ts index b513f424..73b9951d 100644 --- a/src/utils/oid4vc-agent.ts +++ b/src/utils/oid4vc-agent.ts @@ -43,6 +43,7 @@ export function getMixedCredentialRequestToCredentialMapper(): OpenId4VciCredent agentContext, authorization, }) => { + const requestedFormat = credentialConfiguration.format as string const issuanceMetadata = issuanceSession.issuanceMetadata if (!issuanceMetadata?.['credentials']) throw new Error('credential payload is not provided') @@ -98,7 +99,13 @@ export function getMixedCredentialRequestToCredentialMapper(): OpenId4VciCredent ) } - if (credentialConfiguration.format === OpenId4VciCredentialFormatProfile.SdJwtDc) { + // Both `dc+sd-jwt` and `vc+sd-jwt` are signed with the same sd-jwt API. Credo's + // OpenId4VcIssuerService accepts `ClaimFormat.SdJwtDc` sign options for either + // configuration format and passes the format through as the credential `typ` header. + if ( + credentialConfiguration.format === OpenId4VciCredentialFormatProfile.SdJwtDc || + credentialConfiguration.format === OpenId4VciCredentialFormatProfile.SdJwtVc + ) { return handleSdJwtDcFormat( agentContext, credentialConfiguration, @@ -125,7 +132,7 @@ export function getMixedCredentialRequestToCredentialMapper(): OpenId4VciCredent ) as any } - throw new Error('Invalid request format ' + credentialConfiguration.format) + throw new Error('Invalid request format ' + requestedFormat) } }