pyeudiw.storage package
Submodules
pyeudiw.storage.base_cache module
- class pyeudiw.storage.base_cache.BaseCache[source]
Bases:
BaseDBInterface class for cache storage.
- overwrite(object_name: str, value_gen_fn: Callable[[], str]) dict[source]
Overwrite an object in the cache.
- Parameters:
object_name (str) – the name of the object to overwrite.
value_gen_fn (Callable[[], str]) – the function to call to generate the new value.
- Returns:
the overwritten object.
- Return type:
dict
- set(data: dict) dict[source]
Set an object in the cache.
- Parameters:
data (dict) – the data to set.
- Returns:
the setted object.
- Return type:
dict
- try_retrieve(object_name: str, on_not_found: Callable[[], str]) tuple[dict, RetrieveStatus][source]
Try to retrieve an object from the cache. If the object is not found, call the on_not_found function.
- Parameters:
object_name (str) – the name of the object to retrieve.
on_not_found (Callable[[], str]) – the function to call if the object is not found.
- Returns:
a tuple with the retrieved object and a status.
- Return type:
tuple[dict, RetrieveStatus]
pyeudiw.storage.base_db module
pyeudiw.storage.base_storage module
- class pyeudiw.storage.base_storage.BaseStorage[source]
Bases:
BaseDBInterface class for storage.
- add_dpop_proof_and_attestation(document_id, dpop_proof: dict, attestation: dict) UpdateResult[source]
Add a dpop proof and an attestation to the session.
- Parameters:
document_id (str) – the document id.
dpop_proof (dict) – the dpop proof.
attestation (dict) – the attestation.
- Returns:
the result of the update operation.
- Return type:
UpdateResult
- add_empty_trust_anchor(entity_id: str) str[source]
Add an empty trust anchor.
- Parameters:
entity_id (str) – the entity id.
- Returns:
the document id.
- Return type:
str
- add_or_update_trust_attestation(entity_id: str, attestation: list[str], exp: <module 'datetime' from '/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/datetime.py'>) str[source]
Add or update a trust attestation.
- Parameters:
entity_id (str) – the entity id.
attestation (list[str]) – the attestation.
exp (datetime) – the expiration date.
- Returns:
the document id.
- Return type:
str
- add_trust_anchor(entity_id: str, entity_configuration: str, exp: <module 'datetime' from '/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/datetime.py'>, trust_type: ~pyeudiw.storage.base_storage.TrustType)[source]
Add a trust anchor.
- Parameters:
entity_id (str) – the entity id.
entity_configuration (str) – the entity configuration.
exp (datetime) – the expiration date.
trust_type (TrustType) – the trust type.
- Returns:
the document id.
- Return type:
str
- add_trust_attestation(entity_id: str, attestation: list[str], exp: <module 'datetime' from '/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/datetime.py'>, trust_type: ~pyeudiw.storage.base_storage.TrustType, jwks: dict) str[source]
Add a trust attestation.
- Parameters:
entity_id (str) – the entity id.
attestation (list[str]) – the attestation.
exp (datetime) – the expiration date.
trust_type (TrustType) – the trust type.
jwks (dict) – cached jwks
- Returns:
the document id.
- Return type:
str
- add_trust_attestation_metadata(entity_id: str, metadata_type: str, metadata: dict) str[source]
Add a trust attestation metadata.
- Parameters:
entity_id (str) – the entity id.
metadata_type (str) – the metadata type.
- Returns:
the document id.
- Return type:
str
- add_trust_source(entity_id: str, trust_source: dict) str[source]
Add a trust source.
- Parameters:
entity_id (str) – the entity id.
trust_source (dict) – the trust source.
- Returns:
the document id.
- Return type:
str
- exists_by_state_and_session_id(state: str, session_id: str = '') bool[source]
Check if a session exists by state and session id.
- Parameters:
state (str) – the state.
session_id (str) – the session id.
- Returns:
True if the session exists, False otherwise.
- Return type:
bool
- get_by_nonce_state(state: str, nonce: str) dict | None[source]
Get a session by nonce and state.
- Parameters:
state (str) – the state.
nonce (str) – the nonce.
- Returns:
the session.
- Return type:
Union[dict, None]
- get_by_session_id(session_id: str) dict | None[source]
Get a session by session id.
- Parameters:
session_id (str) – the session id.
- Returns:
the session.
- Return type:
Union[dict, None]
- get_by_state(state: str) dict | None[source]
Get a session by state.
- Parameters:
state (str) – the state.
- Returns:
the session.
- Return type:
Union[dict, None]
- get_by_state_and_session_id(state: str, session_id: str = '') dict | None[source]
Get a session by state and session id.
- Parameters:
state (str) – the state.
session_id (str) – the session id.
- Returns:
the session.
- Return type:
Union[dict, None]
- get_trust_anchor(entity_id: str) dict | None[source]
Get a trust anchor.
- Parameters:
entity_id (str) – the entity id.
- Returns:
the trust anchor.
- Return type:
Union[dict, None]
- get_trust_attestation(entity_id: str) dict | None[source]
Get a trust attestation.
- Parameters:
entity_id (str) – the entity id.
- Returns:
the trust attestation.
- Return type:
Union[dict, None]
- get_trust_source(entity_id: str) dict | None[source]
Get a trust source.
- Parameters:
entity_id (str) – the entity id.
- Returns:
the trust source.
- Return type:
Union[dict, None]
- has_session_retention_ttl() bool[source]
Check if the session has a retention ttl.
- Returns:
True if the session has a retention ttl, False otherwise.
- Return type:
bool
- has_trust_anchor(entity_id: str) bool[source]
Check if a trust anchor exists.
- Parameters:
entity_id (str) – the entity id.
- Returns:
True if the trust anchor exists, False otherwise.
- Return type:
bool
- has_trust_attestation(entity_id: str) bool[source]
Check if a trust attestation exists.
- Parameters:
entity_id (str) – the entity id.
- Returns:
True if the trust attestation exists, False otherwise.
- Return type:
bool
- init_session(document_id: str, session_id: str, state: str, remote_flow_typ: str) str[source]
Initialize a session.
- Parameters:
document_id (str) – the document id.
session_id – the satosa session id that initiated the authentication flow.
state (str) – a unique identifier of the authentication flow
remote_flow_typ (str) – a value that discriminates between different authentication flow
- property is_connected: bool
Check if the storage is connected.
- Returns:
True if the storage is connected, False otherwise.
- Return type:
bool
- search_session_by_field(field: str, value: str) dict[source]
Search for a session by a specific field and value.
- Parameters:
field (str) – the field to search by.
value (str) – the value to search for.
- Returns:
the session data if found, otherwise an empty dict.
- Return type:
dict
- set_finalized(document_id: str) UpdateResult[source]
Set the session as finalized.
- Parameters:
document_id (str) – the document id.
- Returns:
the result of the update operation.
- Return type:
UpdateResult
- set_session_retention_ttl(ttl: int) None[source]
Set the database retention ttl.
- Parameters:
ttl (int | None) – the ttl.
- update_request_object(document_id: str, request_object: dict) UpdateResult[source]
Update the request object of the session.
- Parameters:
document_id (str) – the document id.
request_object (dict) – the request object.
- Returns:
the result of the update operation.
- Return type:
UpdateResult
- update_response_object(nonce: str, state: str, response_object: dict, isError: bool = False) UpdateResult[source]
Update the response object of the session.
- Parameters:
nonce (str) – the nonce.
state (str) – the state.
response_object (dict) – the response object.
isError (bool) – if the response is an error response.
- Returns:
the result of the update operation.
- Return type:
UpdateResult
- update_trust_anchor(entity_id: str, entity_configuration: str, exp: <module 'datetime' from '/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/datetime.py'>, trust_type: ~pyeudiw.storage.base_storage.TrustType) str[source]
Update a trust anchor.
- Parameters:
entity_id (str) – the entity id.
entity_configuration (str) – the entity configuration.
exp (datetime) – the expiration date.
trust_type (TrustType) – the trust type.
- Returns:
the document id.
- Return type:
str
- update_trust_attestation(entity_id: str, attestation: list[str], exp: <module 'datetime' from '/opt/hostedtoolcache/Python/3.12.12/x64/lib/python3.12/datetime.py'>, trust_type: ~pyeudiw.storage.base_storage.TrustType, jwks: dict) str[source]
Update a trust attestation.
- Parameters:
entity_id (str) – the entity id.
attestation (list[str]) – the attestation.
exp (datetime) – the expiration date.
trust_type (TrustType) – the trust type.
jwks (dict) – cached jwks
- Returns:
the document id.
- Return type:
str
pyeudiw.storage.credential_entity module
- class pyeudiw.storage.credential_entity.CredentialEntity(*, user_id: str, incremental_id: int = <factory>, revoked: bool = False, identifier: str)[source]
Bases:
BaseModelData model representing a user credential entity for credential issuance.
- identifier: str
- incremental_id: int
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- revoked: bool
- user_id: str
pyeudiw.storage.credential_storage module
- class pyeudiw.storage.credential_storage.CredentialStorage(conf: dict, url: str, connection_params=None)[source]
Bases:
MongoStorageA storage class extending MongoStorage to manage user credentials for OpenID4VCI interactions.
This class provides methods to initialize, retrieve, and update session data stored in a MongoDB database.
- get_by_field(field_name: str, field_value: str) CredentialEntity[source]
- get_by_fields(query: dict) CredentialEntity[source]
- get_credential_by_user_id(user_id: str) CredentialEntity[source]
- property is_connected: bool
Check if the storage is connected.
- Returns:
True if the storage is connected, False otherwise.
- Return type:
bool
pyeudiw.storage.db_engine module
- class pyeudiw.storage.db_engine.DBEngine(config: dict)[source]
Bases:
BaseStorage,BaseCache,BaseLoggerDB Engine class.
- add_dpop_proof_and_attestation(document_id, dpop_proof: dict, attestation: dict)[source]
Add a dpop proof and an attestation to the session.
- Parameters:
document_id (str) – the document id.
dpop_proof (dict) – the dpop proof.
attestation (dict) – the attestation.
- Returns:
the result of the update operation.
- Return type:
UpdateResult
- add_empty_trust_anchor(entity_id: str) str[source]
Add an empty trust anchor.
- Parameters:
entity_id (str) – the entity id.
- Returns:
the document id.
- Return type:
str
- add_or_update_trust_attestation(entity_id: str, attestation: list[str] = [], exp: datetime = None, trust_type: TrustType = TrustType.FEDERATION, jwks: list[dict] = []) str[source]
Add or update a trust attestation.
- Parameters:
entity_id (str) – the entity id.
attestation (list[str]) – the attestation.
exp (datetime) – the expiration date.
- Returns:
the document id.
- Return type:
str
- add_trust_anchor(entity_id: str, entity_configuration: str, exp: datetime, trust_type: TrustType = TrustType.FEDERATION) str[source]
Add a trust anchor.
- Parameters:
entity_id (str) – the entity id.
entity_configuration (str) – the entity configuration.
exp (datetime) – the expiration date.
trust_type (TrustType) – the trust type.
- Returns:
the document id.
- Return type:
str
- add_trust_attestation(entity_id: str, attestation: list[str] = [], exp: datetime = None, trust_type: TrustType = TrustType.FEDERATION, jwks: list[dict] = []) str[source]
Add a trust attestation.
- Parameters:
entity_id (str) – the entity id.
attestation (list[str]) – the attestation.
exp (datetime) – the expiration date.
trust_type (TrustType) – the trust type.
jwks (dict) – cached jwks
- Returns:
the document id.
- Return type:
str
- add_trust_attestation_metadata(entity_id: str, metadat_type: str, metadata: dict) str[source]
Add a trust attestation metadata.
- Parameters:
entity_id (str) – the entity id.
metadata_type (str) – the metadata type.
- Returns:
the document id.
- Return type:
str
- add_trust_source(trust_source: dict) str[source]
Add a trust source.
- Parameters:
entity_id (str) – the entity id.
trust_source (dict) – the trust source.
- Returns:
the document id.
- Return type:
str
- exists_by_state_and_session_id(state: str, session_id: str = '') bool[source]
Check if a session exists by state and session id.
- Parameters:
state (str) – the state.
session_id (str) – the session id.
- Returns:
True if the session exists, False otherwise.
- Return type:
bool
- get(method: str, *args, **kwargs) dict | None[source]
Perform a get operation on the storages.
- Parameters:
method (str) – the method to call.
args (Any) – the arguments to pass to the method.
kwargs (Any) – the keyword arguments to pass to the method.
- Raises:
EntryNotFound – if the entry is not found on any storage.
- Returns:
the result of the first elment found on DBs.
- Return type:
Union[dict, None]
- get_by_nonce_state(state: str, nonce: str) dict | None[source]
Get a session by nonce and state.
- Parameters:
state (str) – the state.
nonce (str) – the nonce.
- Returns:
the session.
- Return type:
Union[dict, None]
- get_by_session_id(session_id: str) dict | None[source]
Get a session by session id.
- Parameters:
session_id (str) – the session id.
- Returns:
the session.
- Return type:
Union[dict, None]
- get_by_state(state: str) dict | None[source]
Get a session by state.
- Parameters:
state (str) – the state.
- Returns:
the session.
- Return type:
Union[dict, None]
- get_by_state_and_session_id(state: str, session_id: str = '') dict | None[source]
Get a session by state and session id.
- Parameters:
state (str) – the state.
session_id (str) – the session id.
- Returns:
the session.
- Return type:
Union[dict, None]
- get_trust_anchor(entity_id: str) dict | None[source]
Get a trust anchor.
- Parameters:
entity_id (str) – the entity id.
- Returns:
the trust anchor.
- Return type:
Union[dict, None]
- get_trust_attestation(entity_id: str) dict | None[source]
Get a trust attestation.
- Parameters:
entity_id (str) – the entity id.
- Returns:
the trust attestation.
- Return type:
Union[dict, None]
- get_trust_source(entity_id: str) dict[source]
Get a trust source.
- Parameters:
entity_id (str) – the entity id.
- Returns:
the trust source.
- Return type:
Union[dict, None]
- has_trust_anchor(entity_id: str) bool[source]
Check if a trust anchor exists.
- Parameters:
entity_id (str) – the entity id.
- Returns:
True if the trust anchor exists, False otherwise.
- Return type:
bool
- has_trust_attestation(entity_id: str) bool[source]
Check if a trust attestation exists.
- Parameters:
entity_id (str) – the entity id.
- Returns:
True if the trust attestation exists, False otherwise.
- Return type:
bool
- init_session(session_id: str, state: str, remote_flow_typ: str) str[source]
Initialize a session.
- Parameters:
document_id (str) – the document id.
session_id – the satosa session id that initiated the authentication flow.
state (str) – a unique identifier of the authentication flow
remote_flow_typ (str) – a value that discriminates between different authentication flow
- property is_connected
Check if the storage is connected.
- Returns:
True if the storage is connected, False otherwise.
- Return type:
bool
- overwrite(object_name: str, value_gen_fn: Callable[[], str]) dict[source]
Overwrite an object in the cache.
- Parameters:
object_name (str) – the name of the object to overwrite.
value_gen_fn (Callable[[], str]) – the function to call to generate the new value.
- Returns:
the overwritten object.
- Return type:
dict
- search_session_by_field(field: str, value: str) dict | None[source]
Search for a session by a specific field and value.
- Parameters:
field (str) – the field to search by.
value (str) – the value to search for.
- Returns:
the session data if found, otherwise an empty dict.
- Return type:
dict
- set_finalized(document_id: str)[source]
Set the session as finalized.
- Parameters:
document_id (str) – the document id.
- Returns:
the result of the update operation.
- Return type:
UpdateResult
- try_retrieve(object_name: str, on_not_found: Callable[[], str]) dict[source]
Try to retrieve an object from the cache. If the object is not found, call the on_not_found function.
- Parameters:
object_name (str) – the name of the object to retrieve.
on_not_found (Callable[[], str]) – the function to call if the object is not found.
- Returns:
a tuple with the retrieved object and a status.
- Return type:
tuple[dict, RetrieveStatus]
- update_request_object(document_id: str, request_object: dict) int[source]
Update the request object of the session.
- Parameters:
document_id (str) – the document id.
request_object (dict) – the request object.
- Returns:
the result of the update operation.
- Return type:
UpdateResult
- update_response_object(nonce: str, state: str, response_object: dict, isError: bool = False) int[source]
Update the response object of the session.
- Parameters:
nonce (str) – the nonce.
state (str) – the state.
response_object (dict) – the response object.
isError (bool) – if the response is an error response.
- Returns:
the result of the update operation.
- Return type:
UpdateResult
- update_trust_anchor(entity_id: str, entity_configuration: dict, exp: datetime, trust_type: TrustType = TrustType.FEDERATION) str[source]
Update a trust anchor.
- Parameters:
entity_id (str) – the entity id.
entity_configuration (str) – the entity configuration.
exp (datetime) – the expiration date.
trust_type (TrustType) – the trust type.
- Returns:
the document id.
- Return type:
str
- update_trust_attestation(entity_id: str, attestation: list[str] = [], exp: datetime = None, trust_type: TrustType = TrustType.FEDERATION, jwks: list[dict] = []) str[source]
Update a trust attestation.
- Parameters:
entity_id (str) – the entity id.
attestation (list[str]) – the attestation.
exp (datetime) – the expiration date.
trust_type (TrustType) – the trust type.
jwks (dict) – cached jwks
- Returns:
the document id.
- Return type:
str
- upsert_session(session_id: str, data: dict) int[source]
Upsert a session by session id.
- Parameters:
session_id (str) – the session id.
data (dict) – the data to upsert.
- Returns:
a tuple containing the document id and the updated data.
- Return type:
tuple[str, dict]
- write(method: str, *args, **kwargs)[source]
Perform a write operation on the storages.
- Parameters:
method (str) – the method to call.
args (Any) – the arguments to pass to the method.
kwargs (Any) – the keyword arguments to pass to the method.
- Raises:
StorageWriteError – if the write operation fails on all the storages.
- Returns:
the number of replicas where the write operation is successful.
- Return type:
int
pyeudiw.storage.exceptions module
pyeudiw.storage.mongo_cache module
- class pyeudiw.storage.mongo_cache.MongoCache(conf: dict, url: str, connection_params: dict = None)[source]
Bases:
BaseCacheMongoDB cache implementation.
- overwrite(object_name: str, value_gen_fn: Callable[[], str]) dict[source]
Overwrite an object in the cache.
- Parameters:
object_name (str) – the name of the object to overwrite.
value_gen_fn (Callable[[], str]) – the function to call to generate the new value.
- Returns:
the overwritten object.
- Return type:
dict
- set(data: dict) dict[source]
Set an object in the cache.
- Parameters:
data (dict) – the data to set.
- Returns:
the setted object.
- Return type:
dict
- try_retrieve(object_name: str, on_not_found: Callable[[], str]) tuple[dict, RetrieveStatus][source]
Try to retrieve an object from the cache. If the object is not found, call the on_not_found function.
- Parameters:
object_name (str) – the name of the object to retrieve.
on_not_found (Callable[[], str]) – the function to call if the object is not found.
- Returns:
a tuple with the retrieved object and a status.
- Return type:
tuple[dict, RetrieveStatus]
pyeudiw.storage.mongo_storage module
- class pyeudiw.storage.mongo_storage.MongoStorage(conf: dict, url: str, connection_params: dict = {})[source]
Bases:
BaseStorage- add_dpop_proof_and_attestation(document_id: str, dpop_proof: dict, attestation: dict) UpdateResult[source]
Add a dpop proof and an attestation to the session.
- Parameters:
document_id (str) – the document id.
dpop_proof (dict) – the dpop proof.
attestation (dict) – the attestation.
- Returns:
the result of the update operation.
- Return type:
UpdateResult
- add_empty_trust_anchor(entity_id: str) str[source]
Add an empty trust anchor.
- Parameters:
entity_id (str) – the entity id.
- Returns:
the document id.
- Return type:
str
- add_trust_anchor(entity_id: str, entity_configuration: str, exp: datetime, trust_type: TrustType)[source]
Add a trust anchor.
- Parameters:
entity_id (str) – the entity id.
entity_configuration (str) – the entity configuration.
exp (datetime) – the expiration date.
trust_type (TrustType) – the trust type.
- Returns:
the document id.
- Return type:
str
- add_trust_attestation(entity_id: str, attestation: list[str], exp: datetime, trust_type: TrustType, jwks: list[dict]) str[source]
Add a trust attestation.
- Parameters:
entity_id (str) – the entity id.
attestation (list[str]) – the attestation.
exp (datetime) – the expiration date.
trust_type (TrustType) – the trust type.
jwks (dict) – cached jwks
- Returns:
the document id.
- Return type:
str
- add_trust_attestation_metadata(entity_id: str, metadata_type: str, metadata: dict)[source]
Add a trust attestation metadata.
- Parameters:
entity_id (str) – the entity id.
metadata_type (str) – the metadata type.
- Returns:
the document id.
- Return type:
str
- add_trust_source(trust_source: dict) str[source]
Add a trust source.
- Parameters:
entity_id (str) – the entity id.
trust_source (dict) – the trust source.
- Returns:
the document id.
- Return type:
str
- get_by_nonce_state(nonce: str, state: str | None) dict[source]
Get a session by nonce and state.
- Parameters:
state (str) – the state.
nonce (str) – the nonce.
- Returns:
the session.
- Return type:
Union[dict, None]
- get_by_session_id(session_id: str) dict | None[source]
Get a session by session id.
- Parameters:
session_id (str) – the session id.
- Returns:
the session.
- Return type:
Union[dict, None]
- get_by_state_and_session_id(state: str, session_id: str = '') dict | None[source]
Get a session by state and session id.
- Parameters:
state (str) – the state.
session_id (str) – the session id.
- Returns:
the session.
- Return type:
Union[dict, None]
- get_trust_anchor(entity_id: str) dict | None[source]
Get a trust anchor.
- Parameters:
entity_id (str) – the entity id.
- Returns:
the trust anchor.
- Return type:
Union[dict, None]
- get_trust_attestation(entity_id: str) dict | None[source]
Get a trust attestation.
- Parameters:
entity_id (str) – the entity id.
- Returns:
the trust attestation.
- Return type:
Union[dict, None]
- get_trust_source(entity_id: str) dict | None[source]
Get a trust source.
- Parameters:
entity_id (str) – the entity id.
- Returns:
the trust source.
- Return type:
Union[dict, None]
- has_session_retention_ttl() bool[source]
Check if the session has a retention ttl.
- Returns:
True if the session has a retention ttl, False otherwise.
- Return type:
bool
- has_trust_anchor(entity_id: str) bool[source]
Check if a trust anchor exists.
- Parameters:
entity_id (str) – the entity id.
- Returns:
True if the trust anchor exists, False otherwise.
- Return type:
bool
- has_trust_attestation(entity_id: str) bool[source]
Check if a trust attestation exists.
- Parameters:
entity_id (str) – the entity id.
- Returns:
True if the trust attestation exists, False otherwise.
- Return type:
bool
- init_session(document_id: str, session_id: str, state: str, remote_flow_typ: str) str[source]
Initialize a session.
- Parameters:
document_id (str) – the document id.
session_id – the satosa session id that initiated the authentication flow.
state (str) – a unique identifier of the authentication flow
remote_flow_typ (str) – a value that discriminates between different authentication flow
- property is_connected: bool
Check if the storage is connected.
- Returns:
True if the storage is connected, False otherwise.
- Return type:
bool
- search_session_by_field(field: str, value: str) dict[source]
Search for a session by a specific field and value.
- Parameters:
field (str) – the field to search by.
value (str) – the value to search for.
- Returns:
the session data if found, otherwise an empty dict.
- Return type:
dict
- set_finalized(document_id: str)[source]
Set the session as finalized.
- Parameters:
document_id (str) – the document id.
- Returns:
the result of the update operation.
- Return type:
UpdateResult
- set_session_retention_ttl(ttl: int) None[source]
Set the database retention ttl.
- Parameters:
ttl (int | None) – the ttl.
- update_request_object(document_id: str, request_object: dict) UpdateResult[source]
Update the request object of the session.
- Parameters:
document_id (str) – the document id.
request_object (dict) – the request object.
- Returns:
the result of the update operation.
- Return type:
UpdateResult
- update_response_object(nonce: str, state: str, internal_response: dict, isError: bool = False) UpdateResult[source]
Update the response object of the session.
- Parameters:
nonce (str) – the nonce.
state (str) – the state.
response_object (dict) – the response object.
isError (bool) – if the response is an error response.
- Returns:
the result of the update operation.
- Return type:
UpdateResult
- update_trust_anchor(entity_id: str, entity_configuration: str, exp: datetime, trust_type: TrustType) str[source]
Update a trust anchor.
- Parameters:
entity_id (str) – the entity id.
entity_configuration (str) – the entity configuration.
exp (datetime) – the expiration date.
trust_type (TrustType) – the trust type.
- Returns:
the document id.
- Return type:
str
- update_trust_attestation(entity_id: str, attestation: list[str], exp: datetime, trust_type: TrustType, jwks: list[dict]) str[source]
Update a trust attestation.
- Parameters:
entity_id (str) – the entity id.
attestation (list[str]) – the attestation.
exp (datetime) – the expiration date.
trust_type (TrustType) – the trust type.
jwks (dict) – cached jwks
- Returns:
the document id.
- Return type:
str
pyeudiw.storage.user_credential_db_engine module
- class pyeudiw.storage.user_credential_db_engine.UserCredentialEngine(config: dict)[source]
Bases:
objectEngine for managing User and Credential storage operations.
This class provides a wrapper around the configured storage backend, typically a MongoDB-based engine, used for persisting and retrieving user and credential related data. It lazily initializes the DB engine and ensures it is connected when accessed.
- property db_credential_storage_engine: CredentialStorage
Lazily initialized access to MongoDB storage engine.
- Returns:
CredentialStorage: The initialized DB engine instance.
- property db_user_storage_engine: UserStorage
Lazily initialized access to MongoDB storage engine.
- Returns:
UserStorage: The initialized DB engine instance.
pyeudiw.storage.user_entity module
- class pyeudiw.storage.user_entity.UserEntity(*, name: str, surname: str, dateOfBirth: str, fiscal_code: str, countyOfBirth: str, placeOfBirth: str, portrait: str | None = None, mail: str)[source]
Bases:
BaseModelData model representing a user entity for credential issuance.
This model contains the core identity attributes typically included in digital credentials, such as personal details and place of birth.
- Attributes:
name (str): The user’s given (first) name. surname (str): The user’s family (last) name. dateOfBirth (str): The user’s date of birth in ISO format (YYYY-MM-DD). fiscal_code (str): The user’s unique personal identifier, such as a fiscal code. countyOfBirth (str): The ISO country code of the user’s place of birth (e.g., “IT”). placeOfBirth (str): The locality (city, town) where the user was born. portrait (Optional[str]): An optional base64-encoded image of the user’s portrait.
- countyOfBirth: str
- dateOfBirth: str
- fiscal_code: str
- mail: str
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- name: str
- placeOfBirth: str
- portrait: str | None
- surname: str
pyeudiw.storage.user_storage module
- class pyeudiw.storage.user_storage.UserStorage(conf: dict, url: str, connection_params=None)[source]
Bases:
MongoStorageA storage class extending MongoStorage to manage user for OpenID4VCI interactions.
This class provides methods to initialize, retrieve, and update session data stored in a MongoDB database.
- get_by_field(field_name: str, field_value: str) tuple[str, UserEntity][source]
- get_by_fields(query: dict) tuple[str, UserEntity][source]
- get_by_fiscal_code(fiscal_code: str) tuple[str, UserEntity][source]
- property is_connected: bool
Check if the storage is connected.
- Returns:
True if the storage is connected, False otherwise.
- Return type:
bool
- set_session_retention_ttl(ttl: int) None[source]
Set the database retention ttl.
- Parameters:
ttl (int | None) – the ttl.
- upsert_user(user_entity: UserEntity | dict) str[source]