Skip to content

Commit

Permalink
Merge branch 'dev' into elliptic-curve-support
Browse files Browse the repository at this point in the history
  • Loading branch information
Salvatore Laiso committed Dec 18, 2023
2 parents 5908a3a + f82d4d4 commit bcc19a0
Show file tree
Hide file tree
Showing 13 changed files with 725 additions and 600 deletions.
10 changes: 6 additions & 4 deletions pyeudiw/openid4vp/direct_post_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(self, jwt: str, jwks_by_kids: Dict[str, dict], nonce: str = ""):

self._payload: dict = {}
self._vps: list = []
self.credentials_by_issuer: dict = {}
self.credentials_by_issuer: Dict[str, list[dict]] = {}
self._claims_by_issuer: dict = {}

def _decode_payload(self) -> None:
Expand Down Expand Up @@ -109,9 +109,11 @@ def validate(self) -> bool:

return True

def get_presentation_vps(self) -> list[dict]:
def get_presentation_vps(self) -> list[Vp]:
"""
Returns the presentation's verifiable presentations
Returns the presentation's verifiable presentations.
:raises VPNotFound: if no VPs are found.
:returns: the list of vps.
:rtype: list[dict]
Expand All @@ -123,7 +125,7 @@ def get_presentation_vps(self) -> list[dict]:
vps = [_vps] if isinstance(_vps, str) else _vps

if not vps:
raise VPNotFound(f"Vps for response with nonce \"{self.nonce}\" are empty")
raise VPNotFound(f"Vps are empty for response with nonce \"{self.nonce}\"")

for vp in vps:
_vp = Vp(vp)
Expand Down
15 changes: 15 additions & 0 deletions pyeudiw/openid4vp/vp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def __init__(self, jwt: str) -> None:

self.parse_digital_credential()
self.disclosed_user_attributes: dict = {}
self._credential_jwks: list[dict] = []

def _detect_vp_type(self) -> str:
"""
Expand Down Expand Up @@ -54,6 +55,20 @@ def parse_digital_credential(self) -> None:
self.credential_headers = decode_jwt_header(self.payload['vp'])
self.credential_payload = decode_jwt_payload(self.payload['vp'])

def set_credential_jwks(self, credential_jwks: list[dict]) -> None:
"""
Set the credential JWKs for the current istance.
:param credential_jwks: a list containing the credential's JWKs.
:type credential_jwks: list[dict]
"""
self._credential_jwks = credential_jwks

@property
def credential_jwks(self) -> list[dict]:
"""Returns the credential JWKs"""
return self._credential_jwks

@property
def credential_issuer(self) -> str:
"""Returns the credential issuer"""
Expand Down
Loading

0 comments on commit bcc19a0

Please sign in to comment.