Skip to content

Commit

Permalink
Fix: Remove optional keybinding jwt if present, before replacing sd h…
Browse files Browse the repository at this point in the history
…ashes with decoded claims

Signed-off-by: George J Padayatti <[email protected]>
  • Loading branch information
georgepadayatti committed Dec 10, 2024
1 parent cf70245 commit f496f58
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions sdjwt/pex.py
Original file line number Diff line number Diff line change
Expand Up @@ -819,14 +819,17 @@ def validate_vp_token(
# Extract the value
vc_token = matches[0].value if matches else None

headers_encoded, claims_encoded, _, _, key_binding_jwt = process_jwt(vc_token)
headers_encoded, claims_encoded, signature, disclosures, key_binding_jwt = process_jwt(vc_token)

_ , vc_claims = decode_header_and_claims(headers_encoded,claims_encoded)


if vc_claims and format == "vc+sd-jwt":
if key_binding_jwt:
temp_vc_token = vc_token.rsplit("~", 1)
disclosures = "~".join(disclosures)
temp_vc_token = f"{headers_encoded}.{claims_encoded}.{signature}"
if disclosures:
temp_vc_token += f"~{disclosures}"
else:
temp_vc_token = vc_token
disclosure_mapping = get_all_disclosures_with_sd_from_token(temp_vc_token)
Expand Down

0 comments on commit f496f58

Please sign in to comment.