Skip to content

Commit

Permalink
[Feat/documentation] Docs and refactoring for satosa package (#205)
Browse files Browse the repository at this point in the history
* feat: added policy apply on metadata

* test: added intial tests for TrustEvaluationHelper

* fix: fixed validation issues

* feat: implemented method add_trust_attestation_metadata

* test: added test for add_trust_attestation_metadata

* fix: added metadata association by metadata_type field

* fix: minor fix to test for add_trust_attestation_metadata's data type

* chore: renamed test file

* chore: Removed comment

* fix: fixed x509 verification exception handling

* chore: fix typo

* fix: merged federation and metadata policy implementation

* test: adapted tests

* feat: added final_metadata property

* feat: added chain discovery plus refactoring

* docs: documented file class and functions

* fix: fixed trust_anchor_entity_conf handling

* docs: documented trust_chain_builder.py

* fix: moved implementation of get_http_url in utils.py

* fix: fixed response handling

* docs: documented file class and function plus refactoring

* docs: documented file __init__.py

* docs: added docs for http_client.py

* docs: documented the content of __init__.py

* docs: documented contento of __init__.py

* fix: method name refactoring

* fix: added exception

* fix: refactored method find_jwk

* docs: fixed documentation

* fix: refactoring

* docs: documented content of utils.py

* docs: documented __init__.py content

* fix: Resolved todo (what if the credential is not a JWT?)

* feat: implemented is_jwe_format and is_jws_format

* test: amplied test

* fix: refactored code

* feat: resolved todo (detect if it is encrypted otherwise)

* fix: code refactoring

* docs: documented content of direct_post_response.py

* fix: amplied error messages

* feat: resolved todo (automatic detection of the credential)

* docs: amplied the documentation

* fix: refactored code

* fix: added dependency

* docs: documented content of vp_sd_jwt.py

* fix: refactored code

* docs: documented content of vp.py

* fix: refactoring for better redability

* fix: redability fix

* feat: added methods for handling credential's JWKs

* fix: fixed signatures

* test: fixed test

* docs: documented the content of backend.py

* docs: documented code of dpop.py

* feat: created class BaseHTTPErrorHandler

* feat: created class BaseLogger

* chore: removed unused implementation

* fix: code refactoring

* docs: added doc for _serialize_error

* docs: documented HTTPError and EmptyHTTPError

* docs: fixed doc

* docs: documented content of html_template.py

* docs: documented content of response.py

* docs: documented content of trust.py

* fix: fixed signature

* fix: fixed message passing

---------

Co-authored-by: Giuseppe De Marco <[email protected]>
  • Loading branch information
PascalDR and Giuseppe De Marco authored Dec 15, 2023
1 parent f305d22 commit f82d4d4
Show file tree
Hide file tree
Showing 13 changed files with 719 additions and 592 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 f82d4d4

Please sign in to comment.