Skip to content
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

Send Problem report when CredEx not found #2577

Conversation

usingtechnology
Copy link
Contributor

@usingtechnology usingtechnology commented Oct 31, 2023

See #2549

Address the situation when an issuer sends an offer and then deletes that offer (credential exchange) before the holder accepts it. When this is an indy credential exchange, a Problem Report is sent; when this is a json-ld exchange, the holder's accept actually becomes an unbound request for the credential and the flow carries on.

A discussion is warranted to see if we want to implement something more global? Seems like at any point in any protocol one side may not find their record and the other side should be notified of the abandonment. Maybe it is already done and this was just a gap...

Added BDD tests to address the deletion and followup acceptance for indy and json-ld and also the holder sending a request for credential to issuer. Again, indy is not allowed, json-ld can flow into a credential issuance.

usingtechnology and others added 4 commits October 30, 2023 18:06
Signed-off-by: Jason Sherman <tools@usingtechnolo.gy>
Signed-off-by: Jason Sherman <tools@usingtechnolo.gy>
Signed-off-by: Jason Sherman <tools@usingtechnolo.gy>
@usingtechnology usingtechnology marked this pull request as ready for review November 1, 2023 02:13
Comment on lines 415 to 422
format_handlers = []
format_handlers_without_offer = []
for format in cred_request_message.formats:
f = V20CredFormat.Format.get(format.format)
if f:
format_handlers.append(f)
if f.handler(self.profile).can_receive_request_without_offer():
format_handlers_without_offer.append(f)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good case for a list comprehension:

handlers = [
    handler(self.profile)
    for format in cred_request_message.formats
    if (handler := V20CredFormat.Format.get(format.format))
]
handlers_without_offer = [
    handler for handler in handlers
    if handler.can_receive_request_without_offer()
]

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like it; will do.

"debug.auto_respond_credential_request"
),
)
if len(format_handlers_without_offer):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick but I'd say it's more idiomatic to just do if format_handlers_without_offer:

usingtechnology and others added 5 commits November 2, 2023 09:52
Signed-off-by: Jason Sherman <tools@usingtechnolo.gy>
Signed-off-by: Jason Sherman <tools@usingtechnolo.gy>
Signed-off-by: Jason Sherman <tools@usingtechnolo.gy>
Signed-off-by: Jason Sherman <tools@usingtechnolo.gy>
Copy link

sonarcloud bot commented Nov 2, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@usingtechnology
Copy link
Contributor Author

@dbluhm - just bumping this for another review. added your suggestions and then put a similar exception handling in the v1 code.

Copy link
Member

@dbluhm dbluhm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@usingtechnology usingtechnology merged commit df2f03b into hyperledger:main Nov 3, 2023
9 checks passed
@usingtechnology usingtechnology deleted the issue-2549-cred-request-deleted branch November 3, 2023 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants