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

Unify Error Handling #168

Closed
Wind4Greg opened this issue Jun 7, 2024 · 3 comments
Closed

Unify Error Handling #168

Wind4Greg opened this issue Jun 7, 2024 · 3 comments
Assignees

Comments

@Wind4Greg
Copy link
Collaborator

Similar to issues w3c/vc-di-ecdsa#63 and w3c/vc-di-eddsa#82 to unify error handling language across this specification and other cryptosuite specifications I'd recommend:

  1. Use appropriate error handling language as in DI specification, e.g., "an error MUST be raised and SHOULD convey an error type of ERROR_CODE_NAME." where ERROR_CODE_NAME is defined in the DI specification.
  2. Use standardized error codes from DI Specification, and if needed add new codes to DI specification
  3. Check for non-rigorous error handling language and if it needs to be updated (errors without codes that need codes)

Below I show codes used but not in the DI specification and error conditions without codes. Thoughts/Opinions?

Error Codes Used but Not in DI Spec

Codes used: INVALID_PROOF_CONFIGURATION and INVALID_PROOF_DATETIME.

  • line 1465: "If |proofConfig|.|type| is not set to DataIntegrityProof and/or |proofConfig|.|cryptosuite| is not set to bbs-2023, an INVALID_PROOF_CONFIGURATION error MUST be raised." From section Base Proof Configuration (bbs-2023)
  • line 1470: "If |proofConfig|.|created| is set and if the value is not a valid [[XMLSCHEMA11-2]] datetime, an INVALID_PROOF_DATETIME error MUST be raised." From section Base Proof Configuration (bbs-2023).

Errors without Codes

These seemed to me to need codes and rigorous handling language. Line numbers are approximate. Need to assign to existing error codes or come up with new codes.

  • line 691: "Ensure the proofValue string starts with u indicating that it is a multibase-base64url-no-pad-encoded value, and throw an error if it does not." From section parseBaseProofValue.
  • line 724: "If the |decodedProofValue| starts with any other three byte sequence, throw an error." From section parseBaseProofValue.
  • line 1133: "indicating that it is a multibase-base64url-no-pad-encoded value, and throw an error if it does not." From section parseDerivedProofValue.
  • line 1164: "Ensure the result is an array of five or six elements — a byte array, a map of integers to integers, an array of integers, another array of integers, and one or two byte arrays; otherwise, throw an error." From section parseDerivedProofValue.
  • line 1505: "If |featureOption| is set to "anonymous_holder_binding" or "pseudonym_hidden_pid", the |commitment_with_proof| input MUST be supplied; if not supplied, an error SHOULD be returned." From section Base Proof Serialization (bbs-2023).
@Wind4Greg
Copy link
Collaborator Author

Recommendations: Add INVALID_PROOF_CONFIGURATION, INVALID_PROOF_DATETIME, and MALFORMED_PROOF_ERROR codes to the VC-DI spec as these are used here and multiple other cryptosuites.

Error Codes Used but Not in DI Spec

Codes used: INVALID_PROOF_CONFIGURATION and INVALID_PROOF_DATETIME.

  • line 1465: "If |proofConfig|.|type| is not set to DataIntegrityProof and/or |proofConfig|.|cryptosuite| is not set to bbs-2023, an INVALID_PROOF_CONFIGURATION error MUST be raised." From section Base Proof Configuration (bbs-2023)
  • line 1470: "If |proofConfig|.|created| is set and if the value is not a valid [[XMLSCHEMA11-2]] datetime, an INVALID_PROOF_DATETIME error MUST be raised." From section Base Proof Configuration (bbs-2023).

Errors without Codes Suggested Assignments

The following could be grouped under the general category of a MALFORMED_PROOF_ERROR:

  • line 691: "Ensure the proofValue string starts with u indicating that it is a multibase-base64url-no-pad-encoded value, and throw an error if it does not." From section parseBaseProofValue.
  • line 724: "If the |decodedProofValue| starts with any other three byte sequence, throw an error." From section parseBaseProofValue.
  • line 1133: "indicating that it is a multibase-base64url-no-pad-encoded value, and throw an error if it does not." From section parseDerivedProofValue.
  • line 1164: "Ensure the result is an array of five or six elements — a byte array, a map of integers to integers, an array of integers, another array of integers, and one or two byte arrays; otherwise, throw an error." From section parseDerivedProofValue.

The following seems like an INVALID_PROOF_CONFIGURATION error.

  • line 1505: "If |featureOption| is set to "anonymous_holder_binding" or "pseudonym_hidden_pid", the |commitment_with_proof| input MUST be supplied; if not supplied, an error SHOULD be returned." From section Base Proof Serialization (bbs-2023).

@msporny
Copy link
Member

msporny commented Jun 17, 2024

We might want to just re-categorize everything under the following broad error categories:

  • TRANSFORMATION_ERROR
  • PROOF_GENERATION_ERROR
  • PROOF_VERIFICATION_ERROR

and then have the detail text explain exactly what went wrong.

@msporny
Copy link
Member

msporny commented Jun 30, 2024

PRs w3c/vc-data-integrity#274 and #174 have been merged. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants