pyeudiw.duckle_ql package
Submodules
pyeudiw.duckle_ql.attribute_mapper module
- pyeudiw.duckle_ql.attribute_mapper.extract_claims(data: Dict[str, Any], paths: List[Dict[str, List[str]]]) Dict[str, Any][source]
Extracts values from a dictionary (nested or flat) based on the provided paths.
- Parameters:
data – The input dictionary (can be nested or flat).
paths – A list of dictionaries, each containing a “path” key with a list of key sequences to extract claims from.
raise_missing – If True, raises an exception when one or more claims are missing (default is True).
- Returns:
A dictionary with the extracted values, preserving the nested structure if applicable.
- Raises:
ValueError – If any claim is missing and raise_missing is set to True.
- pyeudiw.duckle_ql.attribute_mapper.flatten_namespace(data: Dict[str, Any]) Dict[str, Any][source]
Flattens a nested dictionary by removing the top-level namespaces.
- Parameters:
data – A nested dictionary where each top-level key corresponds to a namespace.
- Returns:
A flattened dictionary containing all keys/values merged from all namespaces.
pyeudiw.duckle_ql.credential module
- class pyeudiw.duckle_ql.credential.Claim(*, path: List[str])[source]
Bases:
BaseModelRepresents a single claim with a JSON path.
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- path: List[str]
- class pyeudiw.duckle_ql.credential.Credential(*, id: str, format: str, meta: Meta, claims: List[Claim])[source]
Bases:
BaseModelDefines a single credential request.
- format: str
- id: str
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pyeudiw.duckle_ql.credential.CredentialsRequest(*, credentials: List[Credential])[source]
Bases:
BaseModelRoot model containing a list of credential requests.
- credentials: List[Credential]
- model_config = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
pyeudiw.duckle_ql.handler module
- class pyeudiw.duckle_ql.handler.DuckleHandler(trust_evaluator: CombinedTrustEvaluator, sig_alg_supported: list[str] = None, **kwargs)[source]
Bases:
BaseVPParserHandler for processing Verifiable Presentations using DCQL.
- parse(token: dict) Dict[str, Any][source]
Parse the Duckle Verifiable Presentation.
- Returns:
A dictionary representing the parsed presentation.
- Return type:
dict
- validate(token: dict, verifier_id: str, verifier_nonce: str) None[source]
Parse the Duckle token, validating the signature and claims.
- Parameters:
token (str) – The Duckle token string.
verifier_id (str) – The verifier’s ID (used for the audience claim).
verifier_nonce (str) – The verifier’s nonce.
- Raises:
InvalidVPToken – If the signature or claims are invalid.
pyeudiw.duckle_ql.parser_validator module
Parser and validator for DCQL (Duckle) Verifiable Presentation requests.
This module provides ParserValidator to detect and validate VP tokens when the backend is configured with config.dcql_query (DCQL flow).
- class pyeudiw.duckle_ql.parser_validator.ParserValidator(token: Any, handlers: dict, config: dict)[source]
Bases:
objectValidates Verifiable Presentation tokens for the DCQL (Duckle) flow.
Use is_active_duckle_request() to check if the current request is a DCQL request (i.e. config.dcql_query is set). When active, parse() and validate() use the DuckleHandler to process the VP token.
- is_active_duckle_request() bool[source]
Return True if the backend is configured for DCQL (Duckle) flow (config.dcql_query present) and the token is a single object (DCQL VP format), not a list of encoded VPs (PE format).
- validate(verifier_id: str, verifier_nonce: str) None[source]
Validate the DCQL presentation data using the DuckleHandler.
- Raises:
MissingHandler – If the handler for the format is not found.
VPTokenDescriptorMapMismatch – If the number of VP tokens does not match the number of descriptors.
ParseError – If parsing fails.