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

Allow arbitrary verification methods #1334

Merged
merged 8 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
213 changes: 109 additions & 104 deletions bindings/wasm/docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ if the object is being concurrently modified.</p>
</dd>
<dt><a href="#Credential">Credential</a></dt>
<dd></dd>
<dt><a href="#CustomMethodData">CustomMethodData</a></dt>
<dd><p>A custom verification method data format.</p>
</dd>
<dt><a href="#DIDUrl">DIDUrl</a></dt>
<dd><p>A method agnostic DID Url.</p>
</dd>
Expand Down Expand Up @@ -187,6 +190,27 @@ working with storage backed DID documents.</p>
## Members

<dl>
<dt><a href="#MethodRelationship">MethodRelationship</a></dt>
<dd></dd>
<dt><a href="#SubjectHolderRelationship">SubjectHolderRelationship</a></dt>
<dd><p>Declares how credential subjects must relate to the presentation holder.</p>
<p>See also the <a href="https://www.w3.org/TR/vc-data-model/#subject-holder-relationships">Subject-Holder Relationship</a> section of the specification.</p>
</dd>
<dt><a href="#AlwaysSubject">AlwaysSubject</a></dt>
<dd><p>The holder must always match the subject on all credentials, regardless of their <a href="https://www.w3.org/TR/vc-data-model/#nontransferable-property"><code>nonTransferable</code></a> property.
This variant is the default.</p>
</dd>
<dt><a href="#SubjectOnNonTransferable">SubjectOnNonTransferable</a></dt>
<dd><p>The holder must match the subject only for credentials where the <a href="https://www.w3.org/TR/vc-data-model/#nontransferable-property"><code>nonTransferable</code></a> property is <code>true</code>.</p>
</dd>
<dt><a href="#Any">Any</a></dt>
<dd><p>The holder is not required to have any kind of relationship to any credential subject.</p>
</dd>
<dt><a href="#StatusPurpose">StatusPurpose</a></dt>
<dd><p>Purpose of a <a href="#StatusList2021">StatusList2021</a>.</p>
</dd>
<dt><a href="#StateMetadataEncoding">StateMetadataEncoding</a></dt>
<dd></dd>
<dt><a href="#StatusCheck">StatusCheck</a></dt>
<dd><p>Controls validation behaviour when checking whether or not a credential has been revoked by its
<a href="https://www.w3.org/TR/vc-data-model/#status"><code>credentialStatus</code></a>.</p>
Expand All @@ -204,15 +228,6 @@ working with storage backed DID documents.</p>
<dt><a href="#SkipAll">SkipAll</a></dt>
<dd><p>Skip all status checks.</p>
</dd>
<dt><a href="#StatusPurpose">StatusPurpose</a></dt>
<dd><p>Purpose of a <a href="#StatusList2021">StatusList2021</a>.</p>
</dd>
<dt><a href="#MethodRelationship">MethodRelationship</a></dt>
<dd></dd>
<dt><a href="#CredentialStatus">CredentialStatus</a></dt>
<dd></dd>
<dt><a href="#StateMetadataEncoding">StateMetadataEncoding</a></dt>
<dd></dd>
<dt><a href="#FailFast">FailFast</a></dt>
<dd><p>Declares when validation should return if an error occurs.</p>
</dd>
Expand All @@ -222,25 +237,16 @@ working with storage backed DID documents.</p>
<dt><a href="#FirstError">FirstError</a></dt>
<dd><p>Return after the first error occurs.</p>
</dd>
<dt><a href="#SubjectHolderRelationship">SubjectHolderRelationship</a></dt>
<dd><p>Declares how credential subjects must relate to the presentation holder.</p>
<p>See also the <a href="https://www.w3.org/TR/vc-data-model/#subject-holder-relationships">Subject-Holder Relationship</a> section of the specification.</p>
</dd>
<dt><a href="#AlwaysSubject">AlwaysSubject</a></dt>
<dd><p>The holder must always match the subject on all credentials, regardless of their <a href="https://www.w3.org/TR/vc-data-model/#nontransferable-property"><code>nonTransferable</code></a> property.
This variant is the default.</p>
</dd>
<dt><a href="#SubjectOnNonTransferable">SubjectOnNonTransferable</a></dt>
<dd><p>The holder must match the subject only for credentials where the <a href="https://www.w3.org/TR/vc-data-model/#nontransferable-property"><code>nonTransferable</code></a> property is <code>true</code>.</p>
</dd>
<dt><a href="#Any">Any</a></dt>
<dd><p>The holder is not required to have any kind of relationship to any credential subject.</p>
</dd>
<dt><a href="#CredentialStatus">CredentialStatus</a></dt>
<dd></dd>
</dl>

## Functions

<dl>
<dt><a href="#start">start()</a></dt>
<dd><p>Initializes the console error panic hook for better error messages</p>
</dd>
<dt><a href="#encodeB64">encodeB64(data)</a> ⇒ <code>string</code></dt>
<dd><p>Encode the given bytes in url-safe base64.</p>
</dd>
Expand All @@ -255,9 +261,6 @@ This variant is the default.</p>
<p>This function does not check whether <code>alg = EdDSA</code> in the protected header. Callers are expected to assert this
prior to calling the function.</p>
</dd>
<dt><a href="#start">start()</a></dt>
<dd><p>Initializes the console error panic hook for better error messages</p>
</dd>
</dl>

<a name="CoreDID"></a>
Expand Down Expand Up @@ -1138,6 +1141,21 @@ Deserializes an instance from a JSON object.
| --- | --- |
| json | <code>any</code> |

<a name="CustomMethodData"></a>

## CustomMethodData
A custom verification method data format.

**Kind**: global class
<a name="new_CustomMethodData_new"></a>

### new CustomMethodData(name, data)

| Param | Type |
| --- | --- |
| name | <code>string</code> |
| data | <code>any</code> |

<a name="DIDUrl"></a>

## DIDUrl
Expand Down Expand Up @@ -4343,7 +4361,7 @@ Supported verification method data formats.

* [MethodData](#MethodData)
* _instance_
* [.tryBlockchainAccountId()](#MethodData+tryBlockchainAccountId) ⇒ <code>string</code>
* [.tryCustom()](#MethodData+tryCustom) ⇒ [<code>CustomMethodData</code>](#CustomMethodData)
* [.tryDecode()](#MethodData+tryDecode) ⇒ <code>Uint8Array</code>
* [.tryPublicKeyJwk()](#MethodData+tryPublicKeyJwk) ⇒ [<code>Jwk</code>](#Jwk)
* [.toJSON()](#MethodData+toJSON) ⇒ <code>any</code>
Expand All @@ -4352,13 +4370,13 @@ Supported verification method data formats.
* [.newBase58(data)](#MethodData.newBase58) ⇒ [<code>MethodData</code>](#MethodData)
* [.newMultibase(data)](#MethodData.newMultibase) ⇒ [<code>MethodData</code>](#MethodData)
* [.newJwk(key)](#MethodData.newJwk) ⇒ [<code>MethodData</code>](#MethodData)
* [.newBlockchainAccountId(data)](#MethodData.newBlockchainAccountId) ⇒ [<code>MethodData</code>](#MethodData)
* [.newCustom(name, data)](#MethodData.newCustom) ⇒ [<code>MethodData</code>](#MethodData)
* [.fromJSON(json)](#MethodData.fromJSON) ⇒ [<code>MethodData</code>](#MethodData)

<a name="MethodData+tryBlockchainAccountId"></a>
<a name="MethodData+tryCustom"></a>

### methodData.tryBlockchainAccountId() ⇒ <code>string</code>
Returns the wrapped blockchain account id if the format is `BlockchainAccountId`.
### methodData.tryCustom() ⇒ [<code>CustomMethodData</code>](#CustomMethodData)
Returns the wrapped custom method data format is `Custom`.

**Kind**: instance method of [<code>MethodData</code>](#MethodData)
<a name="MethodData+tryDecode"></a>
Expand Down Expand Up @@ -4427,16 +4445,17 @@ An error is thrown if the given `key` contains any private components.
| --- | --- |
| key | [<code>Jwk</code>](#Jwk) |

<a name="MethodData.newBlockchainAccountId"></a>
<a name="MethodData.newCustom"></a>

### MethodData.newBlockchainAccountId(data) ⇒ [<code>MethodData</code>](#MethodData)
### MethodData.newCustom(name, data) ⇒ [<code>MethodData</code>](#MethodData)
Creates a new [MethodData](#MethodData) variant in CAIP-10 format.
UMR1352 marked this conversation as resolved.
Show resolved Hide resolved

**Kind**: static method of [<code>MethodData</code>](#MethodData)

| Param | Type |
| --- | --- |
| data | <code>string</code> |
| name | <code>string</code> |
| data | <code>any</code> |

<a name="MethodData.fromJSON"></a>

Expand Down Expand Up @@ -4589,7 +4608,7 @@ Supported verification method types.
* [.Ed25519VerificationKey2018()](#MethodType.Ed25519VerificationKey2018) ⇒ [<code>MethodType</code>](#MethodType)
* [.X25519KeyAgreementKey2019()](#MethodType.X25519KeyAgreementKey2019) ⇒ [<code>MethodType</code>](#MethodType)
* [.JsonWebKey()](#MethodType.JsonWebKey) ⇒ [<code>MethodType</code>](#MethodType)
* [.EcdsaSecp256k1RecoverySignature2020()](#MethodType.EcdsaSecp256k1RecoverySignature2020) ⇒ [<code>MethodType</code>](#MethodType)
* [.custom(type_)](#MethodType.custom) ⇒ [<code>MethodType</code>](#MethodType)
* [.fromJSON(json)](#MethodType.fromJSON) ⇒ [<code>MethodType</code>](#MethodType)

<a name="MethodType+toString"></a>
Expand Down Expand Up @@ -4625,12 +4644,17 @@ A verification method for use with JWT verification as prescribed by the [Jwk](#
in the `publicKeyJwk` entry.

**Kind**: static method of [<code>MethodType</code>](#MethodType)
<a name="MethodType.EcdsaSecp256k1RecoverySignature2020"></a>
<a name="MethodType.custom"></a>

### MethodType.EcdsaSecp256k1RecoverySignature2020() ⇒ [<code>MethodType</code>](#MethodType)
The `EcdsaSecp256k1RecoverySignature2020` method type.
### MethodType.custom(type_) ⇒ [<code>MethodType</code>](#MethodType)
A custom method.

**Kind**: static method of [<code>MethodType</code>](#MethodType)

| Param | Type |
| --- | --- |
| type_ | <code>string</code> |

<a name="MethodType.fromJSON"></a>

### MethodType.fromJSON(json) ⇒ [<code>MethodType</code>](#MethodType)
Expand Down Expand Up @@ -5032,11 +5056,9 @@ Representation of an SD-JWT of the format
* [.jwt()](#SdJwt+jwt) ⇒ <code>string</code>
* [.disclosures()](#SdJwt+disclosures) ⇒ <code>Array.&lt;string&gt;</code>
* [.keyBindingJwt()](#SdJwt+keyBindingJwt) ⇒ <code>string</code> \| <code>undefined</code>
* [.toJSON()](#SdJwt+toJSON) ⇒ <code>any</code>
* [.clone()](#SdJwt+clone) ⇒ [<code>SdJwt</code>](#SdJwt)
* _static_
* [.parse(sd_jwt)](#SdJwt.parse) ⇒ [<code>SdJwt</code>](#SdJwt)
* [.fromJSON(json)](#SdJwt.fromJSON) ⇒ [<code>SdJwt</code>](#SdJwt)

<a name="new_SdJwt_new"></a>

Expand Down Expand Up @@ -5079,12 +5101,6 @@ The disclosures part.
### sdJwt.keyBindingJwt() ⇒ <code>string</code> \| <code>undefined</code>
The optional key binding JWT.

**Kind**: instance method of [<code>SdJwt</code>](#SdJwt)
<a name="SdJwt+toJSON"></a>

### sdJwt.toJSON() ⇒ <code>any</code>
Serializes this to a JSON object.

**Kind**: instance method of [<code>SdJwt</code>](#SdJwt)
<a name="SdJwt+clone"></a>

Expand All @@ -5106,17 +5122,6 @@ Returns `DeserializationError` if parsing fails.
| --- | --- |
| sd_jwt | <code>string</code> |

<a name="SdJwt.fromJSON"></a>

### SdJwt.fromJSON(json) ⇒ [<code>SdJwt</code>](#SdJwt)
Deserializes an instance from a JSON object.

**Kind**: static method of [<code>SdJwt</code>](#SdJwt)

| Param | Type |
| --- | --- |
| json | <code>any</code> |

<a name="SdJwtCredentialValidator"></a>

## SdJwtCredentialValidator
Expand Down Expand Up @@ -6159,6 +6164,47 @@ Deserializes an instance from a JSON object.
| --- | --- |
| json | <code>any</code> |

<a name="MethodRelationship"></a>

## MethodRelationship
**Kind**: global variable
<a name="SubjectHolderRelationship"></a>

## SubjectHolderRelationship
Declares how credential subjects must relate to the presentation holder.

See also the [Subject-Holder Relationship](https://www.w3.org/TR/vc-data-model/#subject-holder-relationships) section of the specification.

**Kind**: global variable
<a name="AlwaysSubject"></a>

## AlwaysSubject
The holder must always match the subject on all credentials, regardless of their [`nonTransferable`](https://www.w3.org/TR/vc-data-model/#nontransferable-property) property.
This variant is the default.

**Kind**: global variable
<a name="SubjectOnNonTransferable"></a>

## SubjectOnNonTransferable
The holder must match the subject only for credentials where the [`nonTransferable`](https://www.w3.org/TR/vc-data-model/#nontransferable-property) property is `true`.

**Kind**: global variable
<a name="Any"></a>

## Any
The holder is not required to have any kind of relationship to any credential subject.

**Kind**: global variable
<a name="StatusPurpose"></a>

## StatusPurpose
Purpose of a [StatusList2021](#StatusList2021).

**Kind**: global variable
<a name="StateMetadataEncoding"></a>

## StateMetadataEncoding
**Kind**: global variable
<a name="StatusCheck"></a>

## StatusCheck
Expand Down Expand Up @@ -6189,24 +6235,6 @@ Validate the status if supported, skip any unsupported
## SkipAll
Skip all status checks.

**Kind**: global variable
<a name="StatusPurpose"></a>

## StatusPurpose
Purpose of a [StatusList2021](#StatusList2021).

**Kind**: global variable
<a name="MethodRelationship"></a>

## MethodRelationship
**Kind**: global variable
<a name="CredentialStatus"></a>

## CredentialStatus
**Kind**: global variable
<a name="StateMetadataEncoding"></a>

## StateMetadataEncoding
**Kind**: global variable
<a name="FailFast"></a>

Expand All @@ -6226,33 +6254,16 @@ Return all errors that occur during validation.
Return after the first error occurs.

**Kind**: global variable
<a name="SubjectHolderRelationship"></a>

## SubjectHolderRelationship
Declares how credential subjects must relate to the presentation holder.

See also the [Subject-Holder Relationship](https://www.w3.org/TR/vc-data-model/#subject-holder-relationships) section of the specification.

**Kind**: global variable
<a name="AlwaysSubject"></a>

## AlwaysSubject
The holder must always match the subject on all credentials, regardless of their [`nonTransferable`](https://www.w3.org/TR/vc-data-model/#nontransferable-property) property.
This variant is the default.

**Kind**: global variable
<a name="SubjectOnNonTransferable"></a>

## SubjectOnNonTransferable
The holder must match the subject only for credentials where the [`nonTransferable`](https://www.w3.org/TR/vc-data-model/#nontransferable-property) property is `true`.
<a name="CredentialStatus"></a>

## CredentialStatus
**Kind**: global variable
<a name="Any"></a>
<a name="start"></a>

## Any
The holder is not required to have any kind of relationship to any credential subject.
## start()
Initializes the console error panic hook for better error messages

**Kind**: global variable
**Kind**: global function
<a name="encodeB64"></a>

## encodeB64(data) ⇒ <code>string</code>
Expand Down Expand Up @@ -6297,9 +6308,3 @@ prior to calling the function.
| decodedSignature | <code>Uint8Array</code> |
| publicKey | [<code>Jwk</code>](#Jwk) |

<a name="start"></a>

## start()
Initializes the console error panic hook for better error messages

**Kind**: global function
Loading
Loading