Skip to content

Commit

Permalink
Fix L3-iGrant/api#777: Failed to validate vp token with key binding jwt
Browse files Browse the repository at this point in the history
  • Loading branch information
albinpa committed Dec 10, 2024
1 parent 2980faa commit bf168a0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions sdjwt/pex.py
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,13 @@ def validate_vp_token(
# Extract the value
vc_token = matches[0].value if matches else None

vc_headers, vc_claims = decode_header_and_claims_in_jwt(vc_token)
try:
_, vc_claims = decode_header_and_claims_in_jwt(vc_token)
temp_vc_token = vc_token
except Exception as e:
vc_token_with_disclosures, key_binding_jwt = vc_token.rsplit("~", 1)
_, vc_claims = decode_header_and_claims_in_jwt(vc_token_with_disclosures)
temp_vc_token = vc_token_with_disclosures

if vc_claims and format == "vc+sd-jwt":
disclosure_mapping = get_all_disclosures_with_sd_from_token(vc_token)
Expand Down Expand Up @@ -804,7 +810,7 @@ def validate_vp_token(
if "vc+sd-jwt" in credential_format:
is_valid, err = validate_vc_token_for_sd_jwt(
json.dumps(input_descriptor),
credential_token=vc_token,
credential_token=temp_vc_token,
limit_disclosure=True if limit_disclosure else False,
)
if is_valid:
Expand Down

0 comments on commit bf168a0

Please sign in to comment.