Skip to content

Commit

Permalink
Unify error handling.
Browse files Browse the repository at this point in the history
Co-authored-by: Ted Thibodeau Jr <[email protected]>
Co-authored-by: Manu Sporny <[email protected]>
  • Loading branch information
3 people authored Jun 30, 2024
1 parent 72feec7 commit 3f3585f
Showing 1 changed file with 31 additions and 21 deletions.
52 changes: 31 additions & 21 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -688,13 +688,14 @@ <h4>parseBaseProofValue</h4>

<ol class="algorithm">
<li>
Ensure the `proofValue` string starts with
If the `proofValue` string does not start with
<span class="codepoint" translate="no">
<bdi lang="en"><code title="LATIN SMALL LETTER U">u</code></bdi>
(<code class="codepoint">U+0075</code>
<code class="uname">LATIN SMALL LETTER U</code>)</span>,
indicating that it is a `multibase-base64url-no-pad-encoded` value, and throw
an error if it does not.
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
Expand All @@ -721,8 +722,9 @@ <h4>parseBaseProofValue</h4>
|featureOption| to `"pseudonym_hidden_pid"`.
</li>
<li>
If the |decodedProofValue| starts with any other three byte sequence, throw an
error.
If the |decodedProofValue| starts with any other three byte sequence,
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>
</ol>

Expand Down Expand Up @@ -1125,13 +1127,14 @@ <h4>parseDerivedProofValue</h4>

<ol class="algorithm">
<li>
Ensure the `proofValue` string starts with
If the `proofValue` string does not start with
<span class="codepoint" translate="no">
<bdi lang="en"><code title="LATIN SMALL LETTER U">u</code></bdi>
(<code class="codepoint">U+0075</code>,
<code class="uname">LATIN SMALL LETTER U</code>)</span>, indicating that
it is a `multibase-base64url-no-pad-encoded` value, and throw an error if it does
not.
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
Expand Down Expand Up @@ -1161,11 +1164,12 @@ <h4>parseDerivedProofValue</h4>

<li>
Initialize `components` to an array that is the result of CBOR-decoding the
bytes that follow the three-byte BBS disclosure proof header. 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.
bytes that follow the three-byte BBS disclosure proof header. If the result
is not an array of five or six elements —
a byte array, a map of integers to integers,
two arrays of integers, and one or two byte arrays;
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 second element in `components` using the result of calling the
Expand Down Expand Up @@ -1463,13 +1467,15 @@ <h4>Base Proof Configuration (bbs-2023)</h4>
</li>
<li>
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.
|proofConfig|.|cryptosuite| is not set to `bbs-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 the value is not a
valid [[XMLSCHEMA11-2]] datetime, an `INVALID_PROOF_DATETIME` error MUST be
raised.
If |proofConfig|.|created| is set and if the value is not a
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 @@ -1504,9 +1510,13 @@ <h4>Base Proof Serialization (bbs-2023)</h4>
|commitment_with_proof|.
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.
A single <em>digital proof</em> value
|commitment_with_proof| input MUST be supplied; if not supplied,
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>.
The <em>proof options</em> MUST contain a type identifier for the
<a data-cite="vc-data-integrity#dfn-cryptosuite">
cryptographic suite</a> (|type|) and MAY contain a cryptosuite
identifier (|cryptosuite|). A single <em>digital proof</em> value
represented as series of bytes is produced as output.
</p>

Expand Down

0 comments on commit 3f3585f

Please sign in to comment.