Skip to content

feat(pollux): wire SD-JWT requiredClaimKeys from presentation request to verify - #644

Open
abhigyan1102 wants to merge 1 commit into
hyperledger-identus:mainfrom
abhigyan1102:feat/sdjwt-required-claims-verification
Open

feat(pollux): wire SD-JWT requiredClaimKeys from presentation request to verify#644
abhigyan1102 wants to merge 1 commit into
hyperledger-identus:mainfrom
abhigyan1102:feat/sdjwt-required-claims-verification

Conversation

@abhigyan1102

@abhigyan1102 abhigyan1102 commented May 21, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes #366 Presentation Verification: SD-JWT Required Claims.

The Problem

During SD-JWT presentation verification, requiredClaimKeys was hardcoded to [] in the DIF PresentationVerify handler. This meant @sd-jwt/core never enforced that required claims were actually disclosed by the holder, allowing presentations with missing mandatory fields to pass signature verification.

Root Cause

The verifier's input_descriptors.constraints.fields specifies which claims must be disclosed, but these were never extracted and forwarded to SDJWT.verify().

Changes

PresentationVerify.ts (~30 lines):

  • New extractRequiredClaimKeys() method extracts non-optional fields from inputDescriptor.constraints.fields,converting JSONPaths to the dot-path format
    used by @sd-jwt/core's listKeys() (e.g. $.vc.credentialSubject.firstname
    vc.credentialSubject.firstname)
  • Updated getCredential() to accept inputDescriptor and forward extracted keys
    to SDJWT.verify({ requiredClaimKeys })
  • Updated processDescriptorItem() to thread inputDescriptor through

PresentationVerify.test.ts (3 new tests + 3 updated assertions):

New:

  • Should fail verification when required claims are not disclosed
  • Should pass verification when all required claims are disclosed
  • Should not include optional fields in required claim keys

Updated: 3 existing SDJWT tests now verify against the earlier rejection layer (required claims enforcement at @sd-jwt/core level instead of validateField).

Backward Compatibility

When no inputDescriptor is available, requiredClaimKeys defaults to [] preserving existing behavior for non-DIF verification paths.

Testing

All 23 tests pass locally (14 JWT + 9 SDJWT including 3 new requiredClaimKeys tests).

Related

Builds on PR #624 (SD-JWT Key Binding JWT) which addressed the same presentation flow.

… to verify

Extract required claim keys from the presentation request's
input_descriptors.constraints.fields and forward them to
SDJWT.verify() during presentation verification. Previously
hardcoded to [], which meant @sd-jwt/core never enforced that
required claims were actually disclosed by the holder.

Fixes hyperledger-identus#366

Signed-off-by: Abhigyan Singh <abhigyansingh664@gmail.com>
@abhigyan1102
abhigyan1102 requested a review from a team as a code owner May 21, 2026 03:45
@sonarqubecloud

Copy link
Copy Markdown

@abhigyan1102

Copy link
Copy Markdown
Contributor Author

@elribonazo can you review this one!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Presentation Verification - SDJWT Required Claims

1 participant