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 #64

Merged
merged 5 commits into from
Jun 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 54 additions & 32 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -732,8 +732,9 @@ <h4>Transformation (ecdsa-rdfc-2019)</h4>
<li>
If |options|.|type| is not set to the string
`DataIntegrityProof` and |options|.|cryptosuite| is not
set to the string `ecdsa-rdfc-2019` then a `PROOF_TRANSFORMATION_ERROR` MUST be
raised.
set to the string `ecdsa-rdfc-2019`,
an error MUST be raised and SHOULD convey an error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_TRANSFORMATION_ERROR">PROOF_TRANSFORMATION_ERROR</a>.
</li>
<li>
Let |canonicalDocument| be the result of applying the
Expand Down Expand Up @@ -822,12 +823,14 @@ <h4>Proof Configuration (ecdsa-rdfc-2019)</h4>
<li>
If |proofConfig|.|type| is not set to `DataIntegrityProof` and/or
|proofConfig|.|cryptosuite| is not set to `ecdsa-rdfc-2019`, an
`INVALID_PROOF_CONFIGURATION` error MUST be raised.
error MUST be raised and SHOULD convey an error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_GENERATION_ERROR">PROOF_GENERATION_ERROR</a>.
</li>
<li>
If |proofConfig|.|created| is set and if the value is not a
valid [[XMLSCHEMA11-2]] datetime, an `INVALID_PROOF_DATETIME` error MUST be
raised.
valid [[XMLSCHEMA11-2]] datetime, an error MUST be
raised and SHOULD convey an error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_GENERATION_ERROR">PROOF_GENERATION_ERROR</a>.
</li>
<li>
Set |proofConfig|.|@context| to
Expand Down Expand Up @@ -1060,8 +1063,9 @@ <h4>Transformation (ecdsa-jcs-2019)</h4>
<li>
If |options|.|type| is not set to the string
`DataIntegrityProof` and |options|.|cryptosuite| is not
set to the string `ecdsa-jcs-2019`, then a `PROOF_TRANSFORMATION_ERROR` MUST be
raised.
set to the string `ecdsa-jcs-2019`, an error MUST be raised and SHOULD
convey an error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_TRANSFORMATION_ERROR">PROOF_TRANSFORMATION_ERROR</a>.
</li>
<li>
Let |canonicalDocument| be the result of applying the
Expand Down Expand Up @@ -1148,13 +1152,15 @@ <h4>Proof Configuration (ecdsa-jcs-2019)</h4>
</li>
<li>
If |proofConfig|.|type| is not set to `DataIntegrityProof` and/or
|proofConfig|.|cryptosuite| is not set to `ecdsa-jcs-2019`, an
`INVALID_PROOF_CONFIGURATION` error MUST be raised.
|proofConfig|.|cryptosuite| is not set to `ecdsa-jcs-2019`,
an error MUST be raised and SHOULD convey an error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_GENERATION_ERROR">PROOF_GENERATION_ERROR</a>.
</li>
<li>
If |proofConfig|.|created| is set and if the value is not a
valid [[XMLSCHEMA11-2]] datetime, an `INVALID_PROOF_DATETIME` error MUST be
raised.
valid [[XMLSCHEMA11-2]] datetime, an error MUST be raised and SHOULD convey
an error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_GENERATION_ERROR">PROOF_GENERATION_ERROR</a>.
</li>
<li>
Let |canonicalProofConfig| be the result of applying the
Expand Down Expand Up @@ -1778,7 +1784,9 @@ <h4>selectPaths</h4>
Set |parentValue| to |value|.
</li>
<li>
Set |value| to |parentValue.|path|. If |value| is now undefined, throw an error
Set |value| to |parentValue.|path|. If |value| is now undefined,
an error MUST be raised and SHOULD convey an error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_GENERATION_ERROR">PROOF_GENERATION_ERROR</a>,
indicating that the JSON pointer does not match the given |document|.
</li>
<li>
Expand Down Expand Up @@ -2197,16 +2205,20 @@ <h4>parseBaseProofValue</h4>

<ol class="algorithm">
<li>
Ensure the |proofValue| string starts with `u`, indicating that it is a
multibase-base64url-no-pad-encoded value, throwing an error if it does not.
If the |proofValue| string does not start with `u`, indicating that it is
a multibase-base64url-no-pad-encoded value, an error MUST be raised
and SHOULD convey an error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_VERIFICATION_ERROR">PROOF_VERIFICATION_ERROR</a>.
</li>
<li>
Initialize |decodedProofValue| to the result of base64url-no-pad-decoding the
substring after the leading `u` in |proofValue|.
</li>
<li>
Ensure that the |decodedProofValue| starts with the ECDSA-SD base proof header
bytes 0xd9, 0x5d, and 0x00, throwing an error if it does not.
If the |decodedProofValue| does not start with the ECDSA-SD base proof
header bytes `0xd9`, `0x5d`, and `0x00`, an error MUST be raised and SHOULD
convey an error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_VERIFICATION_ERROR">PROOF_VERIFICATION_ERROR</a>.
</li>
<li>
Initialize |components| to an array that is the result of CBOR-decoding the
Expand Down Expand Up @@ -2469,23 +2481,29 @@ <h4>parseDerivedProofValue</h4>
<ol class="algorithm">
<li>
Ensure the |proofValue| string starts with `u`, indicating that it is a
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Ensure the |proofValue| string starts with `u`, indicating that it is a

multibase-base64url-no-pad-encoded value, throwing an error if it does not.
If the |proofValue| string does not start with `u`, indicating that it is a
multibase-base64url-no-pad-encoded value, an error MUST be raised
and SHOULD convey an error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_VERIFICATION_ERROR">PROOF_VERIFICATION_ERROR</a>.
</li>
<li>
Initialize |decodedProofValue| to the result of base64url-no-pad-decoding the
substring after the leading `u` in |proofValue|.
</li>
<li>
Ensure that the |decodedProofValue| starts with the ECDSA-SD disclosure proof
header bytes `0xd9`, `0x5d`, and `0x01`, throwing an error if it does not.
If the |decodedProofValue| does not start with the ECDSA-SD disclosure proof
header bytes `0xd9`, `0x5d`, and `0x01`, an error MUST be raised
and SHOULD convey an error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_VERIFICATION_ERROR">PROOF_VERIFICATION_ERROR</a>.
</li>
<li>
Initialize |components| to an array that is the result of CBOR-decoding the
bytes that follow the three-byte ECDSA-SD disclosure proof header. Ensure the
result is an array of five elements. Ensure the result is an array of five
elements: a byte array of length 64, a byte array of length 36, an array of byte
arrays, each of length 64, a map of integers to byte arrays of length 32, and an
array of integers, throwing an error if not.
Initialize |components| to an array that is the result of CBOR-decoding the bytes
that follow the three-byte ECDSA-SD disclosure proof header. If the result is not
an array of the following five elements — a byte array of length 64; a byte array
of length 36; an array of byte arrays, each of length 64; a map of integers to
byte arrays, each of length 32; and an array of integers — an error MUST be raised
and SHOULD convey an error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_VERIFICATION_ERROR">PROOF_VERIFICATION_ERROR</a>.
</li>
<li>
Replace the fourth element in |components| using the result of calling the
Expand Down Expand Up @@ -2772,13 +2790,15 @@ <h4>Base Proof Configuration (ecdsa-sd-2023)</h4>
</li>
<li>
If |proofConfig|.|type| is not set to `DataIntegrityProof` and/or
|proofConfig|.|cryptosuite| is not set to `ecdsa-sd-2023`, an
`INVALID_PROOF_CONFIGURATION` error MUST be raised.
|proofConfig|.|cryptosuite| is not set to `ecdsa-sd-2023`,
an error MUST be raised and SHOULD convey an error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_GENERATION_ERROR">PROOF_GENERATION_ERROR</a>.
</li>
<li>
If |proofConfig|.|created| is set and if the value is not a
valid [[XMLSCHEMA11-2]] datetime, an `INVALID_PROOF_DATETIME` error MUST be
raised.
valid [[XMLSCHEMA11-2]] datetime, an error MUST be raised and SHOULD convey an
error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_GENERATION_ERROR">PROOF_GENERATION_ERROR</a>.
</li>
<li>
Set |proofConfig|.|@context| to
Expand Down Expand Up @@ -2934,9 +2954,11 @@ <h4>Verify Derived Proof (ecdsa-sd-2023)</h4>
custom JSON-LD API options, such as a document loader.
</li>
<li>
If the length of |signatures| does not match the length of |nonMandatory|, throw
an error indicating that the signature count does not match the non-mandatory
message count.
If the length of |signatures| does not match the length of |nonMandatory|,
an error MUST be raised and SHOULD convey an error type of
<a data-cite="VC-DATA-INTEGRITY#PROOF_VERIFICATION_ERROR">PROOF_VERIFICATION_ERROR</a>,
indicating that the signature count does not match
the non-mandatory message count.
</li>
<li>
Initialize |publicKeyBytes| to the public key bytes expressed in |publicKey|.
Expand Down