-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Storage and Trust package refactoring (#284) #305
Conversation
|
||
def _add_entry( | ||
def _upsert_entry( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should be implemented also in the base_storage
pyeudiw/storage/mongo_storage.py
Outdated
|
||
if not document_status.acknowledged: | ||
raise StorageEntryUpdateFailed( | ||
"Trust Anchor matched count is ZERO" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use a more eloquent error message
pyeudiw/storage/mongo_storage.py
Outdated
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEAFAULT_JWK_ENDPOINT = "/.well-known/jwt-vc-issuer" | ||
DEAFAULT_METADATA_ENDPOINT = "/.well-known/openid-credential-issuer" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEAFAULT_JWK_ENDPOINT = "/.well-known/jwt-vc-issuer" | |
DEAFAULT_METADATA_ENDPOINT = "/.well-known/openid-credential-issuer" | |
DEFAULT_SDJWTVC_METADATA_ENDPOINT = "/.well-known/jwt-vc-issuer" | |
DEFAULT_OPENID4VCI_METADATA_ENDPOINT = "/.well-known/openid-credential-issuer" |
"ssl": os.getenv("PYEUDIW_HTTPC_SSL", True) | ||
}, | ||
"session": { | ||
"timeout": os.getenv("PYEUDIW_HTTPC_TIMEOUT", 6) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ENV vars should be included in the docs, in a section about env vars
jwk_endpoint: str = DEAFAULT_JWK_ENDPOINT, | ||
metadata_endpoint: str = DEAFAULT_METADATA_ENDPOINT, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jwk_endpoint: str = DEAFAULT_JWK_ENDPOINT, | |
metadata_endpoint: str = DEAFAULT_METADATA_ENDPOINT, | |
jwk_endpoint: str = DEFAULT_SDJWTVC_METADATA_ENDPOINT, | |
metadata_endpoint: str = DEFAULT_OPENID4VCI_METADATA_ENDPOINT, |
issuer_normalized = issuer if issuer[-1] != '/' else issuer[:-1] | ||
return issuer_normalized + metadata_path_component | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* feat: removed sd-jwt external library dependency * feat: added tests * switch from jwcrypto to cryptojwt * feat: add documentation * fix: flat old layers * Update pyeudiw/sd_jwt/common.py Co-authored-by: Giuseppe De Marco <demarcog83@gmail.com> * Update docs/SD-JWT.md Co-authored-by: Giuseppe De Marco <demarcog83@gmail.com> * Update pyeudiw/openid4vp/authorization_response.py Co-authored-by: Giuseppe De Marco <demarcog83@gmail.com> * Update pyeudiw/sd_jwt/holder.py Co-authored-by: Giuseppe De Marco <demarcog83@gmail.com> * fix: old types and continue flatting * fix: removing translation layer for jwcrypto library * wip: issues are confined on sd_jwt folder * wip: holder fixed * wip: json serialization format management --------- Co-authored-by: Giuseppe De Marco <demarcog83@gmail.com>
I think that this function eudi-wallet-it-python/pyeudiw/jwt/parse.py Lines 49 to 57 in 5c3c95e
should be clearly delegated to the trust model implementation(s). Not only the key identifier might not exist in some trust model, but the methods stubs We tried to provide a one and only trust evaluator that is completely agnostic to the token representation, but IMO this cannot work. This is also hinted in this exception, which is basically impossible to overcome as the given function is completely detached from any object ably to parse or vallidate a trust source (i.e. trust proof/attestation)
Moreover, only a the trust model can know which parts of a token header can be treated as trust attestation or proof that a public key is valid, hence a I am keen to conclude that the trust model SHOULD be able to parse token headers . For example, only a federation trust model can know the fact that it can find relevant information in, say, the claim I think that it is best to catch two birds with one stone. The trust aware interface (TrustHandler, TrustEvaluator or whatever it might be called) might implement a functionality similar to the following.
we could also work a more abtract and modular description that emphasize the trust attestation / proof / source, such as
but the core idea is the same: the trust implementation should be able to parse and process token header in order to yield valid cryptographic material for that token. I don't love the conclusion, as it basically means that we might struggle in extending the project if/when we need to process verifiable credentials that are not in the form of a sd-jwt, but I honeslty fail to see a way to overome these issues. @peppelinux waiting an input on the topic by you. |
- Replaced hardcoded MongoDB credentials with dynamic env variable. - Added fallback to 'satosa:thatpassword' for unauthenticated setups. - Updated config to parse username/password inline. - Documented usage and default behavior.
…ws tests from library repo
…auth settings using PYEUDIW_MONGO_TEST_AUTH_INLINE env
Commenting to note that something unexpected happened here. For exmaple, all these imports eudi-wallet-it-python/pyeudiw/tests/satosa/__init__.py Lines 12 to 17 in 1e97344
will fail, and so will the expressions that rely on those imports. We should either reopen #281 or somehow handle failing unit tests. |
Closed in favor of #315 |
fix: variable name for more redability
fix: use already existent functions for unsafe parse
fix: wrong key
feat: decode_jwt_element refactoring
chore: removed unused functions
fix: merged functions
fix: find_vp_token_key refactoring
test: added tests for jwt package
fix: added boundary check
feat: added as_public_dict
feat: refactoring
tests: added federation to the config
chore: added todo
feat: implemented methods for trust source
fix: method name
chore: module initialization
feat: implemented TrustSourceData model
chore: initialized module
feat: implemented TrustHandlerInterface
feat: initial implementation of metadata handler
fix: class name
feat: initial implementation of DirectTrustJWTHandler
feat: refactoring of CombinedTrustEvaluator
Update pyeudiw/jwt/verification.py
feat: added trust source methods and refactoring
feat: merged implementations
chore: moved type
chore: updated config
fix: update mongo tests
fix: fixed model
chore: removed unused code
chore: removed unused function
chore: string interpolation
feat: dinamyc backend refactoring
feat: updated inteface
feat: added dummy Federation handler
fix: CombinedTrustEvaluator instantiation
tests: added tests for trust module
fix: parameter handling
chore: removed unused files
feat: db code refactoring
feat: migrated tests
fix: minor fixs
chore: removed unused code
fix: handle exception properly
fix: test
feat: complete refactoring of satosa backend tests
fix: key handling
feat: added error class
chore: fix for test passing
feat: integrated tests
feat: merged implementations
fix: display error message
fix: possible fix to sd_hash (needs more checks)
fix: collection name
fix: minor fixs
fix: test
chore: remove unused (to re-integrate)
feat: helper function
fix: test
fix: empty behavior
Update pyeudiw/sd_jwt/sd_jwt.py
Update pyeudiw/openid4vp/vp_sd_jwt_vc.py
Update pyeudiw/storage/db_engine.py
Update pyeudiw/tests/trust/test_dynamic.py
fix: naming
chore; added integration test in CI
fix: path
fix: escaping
fix: added dependency
Apply suggestions from code review
feat: upodated and refactored trust package