w3c / vc-di-ecdsa

Data Integrity specification for ECDSA using NIST-compliant curves
https://w3c.github.io/vc-di-ecdsa/
Other
9 stars 9 forks source link

Unify Error Handling Language #63

Open Wind4Greg opened 2 weeks ago

Wind4Greg commented 2 weeks ago

To unify error handling language across this specification (and if desired 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

  1. INVALID_PROOF_CONFIGURATION used in 3.2.5 Proof Configuration (ecdsa-rdfc-2019), 3.3.5 Proof Configuration (ecdsa-jcs-2019), and 3.6.4 Base Proof Configuration (ecdsa-sd-2023)
  2. INVALID_PROOF_DATETIME used in 3.2.5 Proof Configuration (ecdsa-rdfc-2019), 3.3.5 Proof Configuration (ecdsa-jcs-2019), and 3.6.4 Base Proof Configuration (ecdsa-sd-2023)

Errors without Codes

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

Wind4Greg commented 2 weeks ago

Recommendation: Add INVALID_PROOF_CONFIGURATION, INVALID_PROOF_DATETIME, PROOF_TRANSFORMATION_ERROR, and MALFORMED_PROOF_ERROR to the VC-DI spec as the first three are are used in multiple cryptosuite specs and I propose that we use the MALFORMED_PROOF_ERROR for many ECDSA-SD errors and BBS errors. See below for details.

Error Codes Used but Not in DI Spec

  1. INVALID_PROOF_CONFIGURATION used in 3.2.5 Proof Configuration (ecdsa-rdfc-2019), 3.3.5 Proof Configuration (ecdsa-jcs-2019), and 3.6.4 Base Proof Configuration (ecdsa-sd-2023)
  2. INVALID_PROOF_DATETIME used in 3.2.5 Proof Configuration (ecdsa-rdfc-2019), 3.3.5 Proof Configuration (ecdsa-jcs-2019), and 3.6.4 Base Proof Configuration (ecdsa-sd-2023)
  3. PROOF_TRANSFORMATION_ERROR used in 3.2.3 Transformation (ecdsa-rdfc-2019), 3.3.3 Transformation (ecdsa-jcs-2019), and 3.3.3 Transformation (ecdsa-jcs-2019)

Errors without Codes Suggested Assignments

The rest of these errors could be grouped under the general category of a MALFORMED_PROOF_ERROR: