From 6003cf0f68fb97b1e834a40fb95756ccf31ecb72 Mon Sep 17 00:00:00 2001
From: Alberto Solavagione
A custom verification method data format.
+A method agnostic DID Url.
Purpose of a StatusList2021.
+Declares how credential subjects must relate to the presentation holder.
See also the Subject-Holder Relationship section of the specification.
@@ -203,9 +207,8 @@ This variant is the default.The holder is not required to have any kind of relationship to any credential subject.
Purpose of a StatusList2021.
-Declares when validation should return if an error occurs.
Return after the first error occurs.
Controls validation behaviour when checking whether or not a credential has been revoked by its
credentialStatus
.
Skip all status checks.
Initializes the console error panic hook for better error messages
-Verify a JWS signature secured with the EdDSA
algorithm and curve Ed25519
.
This function is useful when one is composing a IJwsVerifier
that delegates
@@ -258,6 +258,9 @@ prior to calling the function.
Uint8Array
Decode the given url-safe base64-encoded slice into its raw bytes.
Initializes the console error panic hook for better error messages
+any
|
+
+
+## CustomMethodData
+A custom verification method data format.
+
+**Kind**: global class
+
+* [CustomMethodData](#CustomMethodData)
+ * [new CustomMethodData(name, data)](#new_CustomMethodData_new)
+ * _instance_
+ * [.clone()](#CustomMethodData+clone) ⇒ [CustomMethodData
](#CustomMethodData)
+ * [.toJSON()](#CustomMethodData+toJSON) ⇒ any
+ * _static_
+ * [.fromJSON(json)](#CustomMethodData.fromJSON) ⇒ [CustomMethodData
](#CustomMethodData)
+
+
+
+### new CustomMethodData(name, data)
+
+| Param | Type |
+| --- | --- |
+| name | string
|
+| data | any
|
+
+
+
+### customMethodData.clone() ⇒ [CustomMethodData
](#CustomMethodData)
+Deep clones the object.
+
+**Kind**: instance method of [CustomMethodData
](#CustomMethodData)
+
+
+### customMethodData.toJSON() ⇒ any
+Serializes this to a JSON object.
+
+**Kind**: instance method of [CustomMethodData
](#CustomMethodData)
+
+
+### CustomMethodData.fromJSON(json) ⇒ [CustomMethodData
](#CustomMethodData)
+Deserializes an instance from a JSON object.
+
+**Kind**: static method of [CustomMethodData
](#CustomMethodData)
+
+| Param | Type |
+| --- | --- |
+| json | any
|
+
## DIDUrl
@@ -1967,7 +2017,7 @@ if the object is being concurrently modified.
* _instance_
* [.id()](#IotaDocument+id) ⇒ [IotaDID
](#IotaDID)
* [.controller()](#IotaDocument+controller) ⇒ [Array.<IotaDID>
](#IotaDID)
- * [.setController(controllers)](#IotaDocument+setController)
+ * [.setController(controller)](#IotaDocument+setController)
* [.alsoKnownAs()](#IotaDocument+alsoKnownAs) ⇒ Array.<string>
* [.setAlsoKnownAs(urls)](#IotaDocument+setAlsoKnownAs)
* [.properties()](#IotaDocument+properties) ⇒ Map.<string, any>
@@ -2042,7 +2092,7 @@ during resolution and are omitted when publishing.
**Kind**: instance method of [IotaDocument
](#IotaDocument)
-### iotaDocument.setController(controllers)
+### iotaDocument.setController(controller)
Sets the controllers of the document.
Note: Duplicates will be ignored.
@@ -2052,7 +2102,7 @@ Use `null` to remove all controllers.
| Param | Type |
| --- | --- |
-| controllers | [CoreDID
](#CoreDID) \| [Array.<CoreDID>
](#CoreDID) \| null
|
+| controller | [Array.<IotaDID>
](#IotaDID) \| null
|
@@ -4343,6 +4393,7 @@ Supported verification method data formats.
* [MethodData](#MethodData)
* _instance_
+ * [.tryCustom()](#MethodData+tryCustom) ⇒ [CustomMethodData
](#CustomMethodData)
* [.tryDecode()](#MethodData+tryDecode) ⇒ Uint8Array
* [.tryPublicKeyJwk()](#MethodData+tryPublicKeyJwk) ⇒ [Jwk
](#Jwk)
* [.toJSON()](#MethodData+toJSON) ⇒ any
@@ -4351,8 +4402,15 @@ Supported verification method data formats.
* [.newBase58(data)](#MethodData.newBase58) ⇒ [MethodData
](#MethodData)
* [.newMultibase(data)](#MethodData.newMultibase) ⇒ [MethodData
](#MethodData)
* [.newJwk(key)](#MethodData.newJwk) ⇒ [MethodData
](#MethodData)
+ * [.newCustom(name, data)](#MethodData.newCustom) ⇒ [MethodData
](#MethodData)
* [.fromJSON(json)](#MethodData.fromJSON) ⇒ [MethodData
](#MethodData)
+
+
+### methodData.tryCustom() ⇒ [CustomMethodData
](#CustomMethodData)
+Returns the wrapped custom method data format is `Custom`.
+
+**Kind**: instance method of [MethodData
](#MethodData)
### methodData.tryDecode() ⇒ Uint8Array
@@ -4419,6 +4477,18 @@ An error is thrown if the given `key` contains any private components.
| --- | --- |
| key | [Jwk
](#Jwk) |
+
+
+### MethodData.newCustom(name, data) ⇒ [MethodData
](#MethodData)
+Creates a new custom [MethodData](#MethodData).
+
+**Kind**: static method of [MethodData
](#MethodData)
+
+| Param | Type |
+| --- | --- |
+| name | string
|
+| data | any
|
+
### MethodData.fromJSON(json) ⇒ [MethodData
](#MethodData)
@@ -4570,6 +4640,7 @@ Supported verification method types.
* [.Ed25519VerificationKey2018()](#MethodType.Ed25519VerificationKey2018) ⇒ [MethodType
](#MethodType)
* [.X25519KeyAgreementKey2019()](#MethodType.X25519KeyAgreementKey2019) ⇒ [MethodType
](#MethodType)
* [.JsonWebKey()](#MethodType.JsonWebKey) ⇒ [MethodType
](#MethodType)
+ * [.custom(type_)](#MethodType.custom) ⇒ [MethodType
](#MethodType)
* [.fromJSON(json)](#MethodType.fromJSON) ⇒ [MethodType
](#MethodType)
@@ -4605,6 +4676,17 @@ A verification method for use with JWT verification as prescribed by the [Jwk](#
in the `publicKeyJwk` entry.
**Kind**: static method of [MethodType
](#MethodType)
+
+
+### MethodType.custom(type_) ⇒ [MethodType
](#MethodType)
+A custom method.
+
+**Kind**: static method of [MethodType
](#MethodType)
+
+| Param | Type |
+| --- | --- |
+| type_ | string
|
+
### MethodType.fromJSON(json) ⇒ [MethodType
](#MethodType)
@@ -5006,11 +5088,9 @@ Representation of an SD-JWT of the format
* [.jwt()](#SdJwt+jwt) ⇒ string
* [.disclosures()](#SdJwt+disclosures) ⇒ Array.<string>
* [.keyBindingJwt()](#SdJwt+keyBindingJwt) ⇒ string
\| undefined
- * [.toJSON()](#SdJwt+toJSON) ⇒ any
* [.clone()](#SdJwt+clone) ⇒ [SdJwt
](#SdJwt)
* _static_
* [.parse(sd_jwt)](#SdJwt.parse) ⇒ [SdJwt
](#SdJwt)
- * [.fromJSON(json)](#SdJwt.fromJSON) ⇒ [SdJwt
](#SdJwt)
@@ -5053,12 +5133,6 @@ The disclosures part.
### sdJwt.keyBindingJwt() ⇒ string
\| undefined
The optional key binding JWT.
-**Kind**: instance method of [SdJwt
](#SdJwt)
-
-
-### sdJwt.toJSON() ⇒ any
-Serializes this to a JSON object.
-
**Kind**: instance method of [SdJwt
](#SdJwt)
@@ -5080,17 +5154,6 @@ Returns `DeserializationError` if parsing fails.
| --- | --- |
| sd_jwt | string
|
-
-
-### SdJwt.fromJSON(json) ⇒ [SdJwt
](#SdJwt)
-Deserializes an instance from a JSON object.
-
-**Kind**: static method of [SdJwt
](#SdJwt)
-
-| Param | Type |
-| --- | --- |
-| json | any
|
-
## SdJwtCredentialValidator
@@ -5967,6 +6030,7 @@ A DID Document Verification Method.
**Kind**: global class
* [VerificationMethod](#VerificationMethod)
+ * [new VerificationMethod(id, controller, type_, data)](#new_VerificationMethod_new)
* _instance_
* [.id()](#VerificationMethod+id) ⇒ [DIDUrl
](#DIDUrl)
* [.setId(id)](#VerificationMethod+setId)
@@ -5984,6 +6048,19 @@ A DID Document Verification Method.
* [.newFromJwk(did, key, [fragment])](#VerificationMethod.newFromJwk) ⇒ [VerificationMethod
](#VerificationMethod)
* [.fromJSON(json)](#VerificationMethod.fromJSON) ⇒ [VerificationMethod
](#VerificationMethod)
+
+
+### new VerificationMethod(id, controller, type_, data)
+Create a custom [VerificationMethod](#VerificationMethod).
+
+
+| Param | Type |
+| --- | --- |
+| id | [DIDUrl
](#DIDUrl) |
+| controller | [CoreDID
](#CoreDID) |
+| type_ | [MethodType
](#MethodType) |
+| data | [MethodData
](#MethodData) |
+
### verificationMethod.id() ⇒ [DIDUrl
](#DIDUrl)
@@ -6119,9 +6196,11 @@ Deserializes an instance from a JSON object.
| --- | --- |
| json | any
|
-
+
+
+## StatusPurpose
+Purpose of a [StatusList2021](#StatusList2021).
-## CredentialStatus
**Kind**: global variable
@@ -6150,11 +6229,9 @@ The holder must match the subject only for credentials where the [`nonTransferab
The holder is not required to have any kind of relationship to any credential subject.
**Kind**: global variable
-
-
-## StatusPurpose
-Purpose of a [StatusList2021](#StatusList2021).
+
+## StateMetadataEncoding
**Kind**: global variable
@@ -6173,6 +6250,14 @@ Return all errors that occur during validation.
## FirstError
Return after the first error occurs.
+**Kind**: global variable
+
+
+## MethodRelationship
+**Kind**: global variable
+
+
+## CredentialStatus
**Kind**: global variable
@@ -6205,20 +6290,6 @@ Validate the status if supported, skip any unsupported
Skip all status checks.
**Kind**: global variable
-
-
-## StateMetadataEncoding
-**Kind**: global variable
-
-
-## MethodRelationship
-**Kind**: global variable
-
-
-## start()
-Initializes the console error panic hook for better error messages
-
-**Kind**: global function
## verifyEd25519(alg, signingInput, decodedSignature, publicKey)
@@ -6263,3 +6334,9 @@ Decode the given url-safe base64-encoded slice into its raw bytes.
| --- | --- |
| data | Uint8Array
|
+
+
+## start()
+Initializes the console error panic hook for better error messages
+
+**Kind**: global function
diff --git a/bindings/wasm/src/sd_jwt/wasm_sd_jwt.rs b/bindings/wasm/src/sd_jwt/wasm_sd_jwt.rs
index 7b4f201206..c55de229e6 100644
--- a/bindings/wasm/src/sd_jwt/wasm_sd_jwt.rs
+++ b/bindings/wasm/src/sd_jwt/wasm_sd_jwt.rs
@@ -77,5 +77,4 @@ impl WasmSdJwt {
}
}
-impl_wasm_json!(WasmSdJwt, SdJwt);
impl_wasm_clone!(WasmSdJwt, SdJwt);
diff --git a/bindings/wasm/src/verification/wasm_method_data.rs b/bindings/wasm/src/verification/wasm_method_data.rs
index 5bba4aa5a9..58a9c65820 100644
--- a/bindings/wasm/src/verification/wasm_method_data.rs
+++ b/bindings/wasm/src/verification/wasm_method_data.rs
@@ -1,6 +1,7 @@
// Copyright 2020-2023 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
+use identity_iota::verification::CustomMethodData;
use identity_iota::verification::MethodData;
use wasm_bindgen::prelude::*;
@@ -45,6 +46,27 @@ impl WasmMethodData {
Ok(Self(MethodData::PublicKeyJwk(key.0.clone())))
}
+ /// Creates a new custom {@link MethodData}.
+ #[wasm_bindgen(js_name = newCustom)]
+ pub fn new_custom(name: String, data: JsValue) -> ResultA method agnostic DID Url.
A cryptographically verified decoded token from a JWS.
Contains the decoded headers and the raw claims.
@@ -67,11 +71,32 @@ if the object is being concurrently modified.An extension interface that provides helper functions for publication and resolution of DID documents in Alias Outputs.
A JSON Proof Token (JPT).
+Options to declare validation criteria for Jpt.
+Utility functions for validating JPT credentials.
+Options to declare validation criteria for a Jpt presentation.
+Utility functions for verifying JPT presentations.
+The result of a key generation in JwkStorage
.
A wrapper around a JSON Web Signature (JWS).
A compressed bitmap for managing credential revocation.
Information used to determine the current status of a Credential.
+Representation of an SD-JWT of the format
<Issuer-signed JWT>~<Disclosure 1>~<Disclosure 2>~...~<Disclosure N>~<optional KB-JWT>
.
Purpose of a StatusList2021.
-Declares how credential subjects must relate to the presentation holder.
-See also the Subject-Holder Relationship section of the specification.
-The holder must always match the subject on all credentials, regardless of their nonTransferable
property.
-This variant is the default.
The holder must match the subject only for credentials where the nonTransferable
property is true
.
The holder is not required to have any kind of relationship to any credential subject.
-Declares when validation should return if an error occurs.
Purpose of a StatusList2021.
+Controls validation behaviour when checking whether or not a credential has been revoked by its
credentialStatus
.
Skip all status checks.
Declares how credential subjects must relate to the presentation holder.
+See also the Subject-Holder Relationship section of the specification.
+The holder must always match the subject on all credentials, regardless of their nonTransferable
property.
+This variant is the default.
The holder must match the subject only for credentials where the nonTransferable
property is true
.
The holder is not required to have any kind of relationship to any credential subject.
+string
Encode the given bytes in url-safe base64.
+Uint8Array
Decode the given url-safe base64-encoded slice into its raw bytes.
+Verify a JWS signature secured with the EdDSA
algorithm and curve Ed25519
.
This function is useful when one is composing a IJwsVerifier
that delegates
@@ -252,12 +286,6 @@ This variant is the default.
This function does not check whether alg = EdDSA
in the protected header. Callers are expected to assert this
prior to calling the function.
string
Encode the given bytes in url-safe base64.
-Uint8Array
Decode the given url-safe base64-encoded slice into its raw bytes.
-Initializes the console error panic hook for better error messages
any
|
+
+
+## DecodedJptCredential
+**Kind**: global class
+
+* [DecodedJptCredential](#DecodedJptCredential)
+ * [.clone()](#DecodedJptCredential+clone) ⇒ [DecodedJptCredential
](#DecodedJptCredential)
+ * [.credential()](#DecodedJptCredential+credential) ⇒ [Credential
](#Credential)
+ * [.customClaims()](#DecodedJptCredential+customClaims) ⇒ Map.<string, any>
+
+
+
+### decodedJptCredential.clone() ⇒ [DecodedJptCredential
](#DecodedJptCredential)
+Deep clones the object.
+
+**Kind**: instance method of [DecodedJptCredential
](#DecodedJptCredential)
+
+
+### decodedJptCredential.credential() ⇒ [Credential
](#Credential)
+Returns the [Credential](#Credential) embedded into this JPT.
+
+**Kind**: instance method of [DecodedJptCredential
](#DecodedJptCredential)
+
+
+### decodedJptCredential.customClaims() ⇒ Map.<string, any>
+Returns the custom claims parsed from the JPT.
+
+**Kind**: instance method of [DecodedJptCredential
](#DecodedJptCredential)
+
+
+## DecodedJptPresentation
+**Kind**: global class
+
+* [DecodedJptPresentation](#DecodedJptPresentation)
+ * [.clone()](#DecodedJptPresentation+clone) ⇒ [DecodedJptPresentation
](#DecodedJptPresentation)
+ * [.credential()](#DecodedJptPresentation+credential) ⇒ [Credential
](#Credential)
+ * [.customClaims()](#DecodedJptPresentation+customClaims) ⇒ Map.<string, any>
+ * [.aud()](#DecodedJptPresentation+aud) ⇒ string
\| undefined
+
+
+
+### decodedJptPresentation.clone() ⇒ [DecodedJptPresentation
](#DecodedJptPresentation)
+Deep clones the object.
+
+**Kind**: instance method of [DecodedJptPresentation
](#DecodedJptPresentation)
+
+
+### decodedJptPresentation.credential() ⇒ [Credential
](#Credential)
+Returns the [Credential](#Credential) embedded into this JPT.
+
+**Kind**: instance method of [DecodedJptPresentation
](#DecodedJptPresentation)
+
+
+### decodedJptPresentation.customClaims() ⇒ Map.<string, any>
+Returns the custom claims parsed from the JPT.
+
+**Kind**: instance method of [DecodedJptPresentation
](#DecodedJptPresentation)
+
+
+### decodedJptPresentation.aud() ⇒ string
\| undefined
+Returns the `aud` property parsed from the JWT claims.
+
+**Kind**: instance method of [DecodedJptPresentation
](#DecodedJptPresentation)
## DecodedJws
@@ -2797,6 +2888,292 @@ Fetches the `IAliasOutput` associated with the given DID.
| client | IIotaIdentityClient
|
| did | [IotaDID
](#IotaDID) |
+
+
+## Jpt
+A JSON Proof Token (JPT).
+
+**Kind**: global class
+
+* [Jpt](#Jpt)
+ * [new Jpt(jpt_string)](#new_Jpt_new)
+ * [.toString()](#Jpt+toString) ⇒ string
+ * [.clone()](#Jpt+clone) ⇒ [Jpt
](#Jpt)
+
+
+
+### new Jpt(jpt_string)
+Creates a new [Jpt](#Jpt).
+
+
+| Param | Type |
+| --- | --- |
+| jpt_string | string
|
+
+
+
+### jpt.toString() ⇒ string
+**Kind**: instance method of [Jpt
](#Jpt)
+
+
+### jpt.clone() ⇒ [Jpt
](#Jpt)
+Deep clones the object.
+
+**Kind**: instance method of [Jpt
](#Jpt)
+
+
+## JptCredentialValidationOptions
+Options to declare validation criteria for [Jpt](#Jpt).
+
+**Kind**: global class
+
+* [JptCredentialValidationOptions](#JptCredentialValidationOptions)
+ * [new JptCredentialValidationOptions([opts])](#new_JptCredentialValidationOptions_new)
+ * _instance_
+ * [.clone()](#JptCredentialValidationOptions+clone) ⇒ [JptCredentialValidationOptions
](#JptCredentialValidationOptions)
+ * [.toJSON()](#JptCredentialValidationOptions+toJSON) ⇒ any
+ * _static_
+ * [.fromJSON(json)](#JptCredentialValidationOptions.fromJSON) ⇒ [JptCredentialValidationOptions
](#JptCredentialValidationOptions)
+
+
+
+### new JptCredentialValidationOptions([opts])
+Creates a new default istance.
+
+
+| Param | Type |
+| --- | --- |
+| [opts] | IJptCredentialValidationOptions
\| undefined
|
+
+
+
+### jptCredentialValidationOptions.clone() ⇒ [JptCredentialValidationOptions
](#JptCredentialValidationOptions)
+Deep clones the object.
+
+**Kind**: instance method of [JptCredentialValidationOptions
](#JptCredentialValidationOptions)
+
+
+### jptCredentialValidationOptions.toJSON() ⇒ any
+Serializes this to a JSON object.
+
+**Kind**: instance method of [JptCredentialValidationOptions
](#JptCredentialValidationOptions)
+
+
+### JptCredentialValidationOptions.fromJSON(json) ⇒ [JptCredentialValidationOptions
](#JptCredentialValidationOptions)
+Deserializes an instance from a JSON object.
+
+**Kind**: static method of [JptCredentialValidationOptions
](#JptCredentialValidationOptions)
+
+| Param | Type |
+| --- | --- |
+| json | any
|
+
+
+
+## JptCredentialValidator
+**Kind**: global class
+
+
+### JptCredentialValidator.validate(credential_jpt, issuer, options, fail_fast) ⇒ [DecodedJptCredential
](#DecodedJptCredential)
+**Kind**: static method of [JptCredentialValidator
](#JptCredentialValidator)
+
+| Param | Type |
+| --- | --- |
+| credential_jpt | [Jpt
](#Jpt) |
+| issuer | [CoreDocument
](#CoreDocument) |
+| options | [JptCredentialValidationOptions
](#JptCredentialValidationOptions) |
+| fail_fast | [FailFast
](#FailFast) |
+
+
+
+## JptCredentialValidatorUtils
+Utility functions for validating JPT credentials.
+
+**Kind**: global class
+
+* [JptCredentialValidatorUtils](#JptCredentialValidatorUtils)
+ * [.extractIssuer(credential)](#JptCredentialValidatorUtils.extractIssuer) ⇒ [CoreDID
](#CoreDID)
+ * [.extractIssuerFromIssuedJpt(credential)](#JptCredentialValidatorUtils.extractIssuerFromIssuedJpt) ⇒ [CoreDID
](#CoreDID)
+ * [.checkTimeframesWithValidityTimeframe2024(credential, validity_timeframe, status_check)](#JptCredentialValidatorUtils.checkTimeframesWithValidityTimeframe2024)
+ * [.checkRevocationWithValidityTimeframe2024(credential, issuer, status_check)](#JptCredentialValidatorUtils.checkRevocationWithValidityTimeframe2024)
+ * [.checkTimeframesAndRevocationWithValidityTimeframe2024(credential, issuer, validity_timeframe, status_check)](#JptCredentialValidatorUtils.checkTimeframesAndRevocationWithValidityTimeframe2024)
+
+
+
+### JptCredentialValidatorUtils.extractIssuer(credential) ⇒ [CoreDID
](#CoreDID)
+Utility for extracting the issuer field of a [`Credential`](`Credential`) as a DID.
+# Errors
+Fails if the issuer field is not a valid DID.
+
+**Kind**: static method of [JptCredentialValidatorUtils
](#JptCredentialValidatorUtils)
+
+| Param | Type |
+| --- | --- |
+| credential | [Credential
](#Credential) |
+
+
+
+### JptCredentialValidatorUtils.extractIssuerFromIssuedJpt(credential) ⇒ [CoreDID
](#CoreDID)
+Utility for extracting the issuer field of a credential in JPT representation as DID.
+# Errors
+If the JPT decoding fails or the issuer field is not a valid DID.
+
+**Kind**: static method of [JptCredentialValidatorUtils
](#JptCredentialValidatorUtils)
+
+| Param | Type |
+| --- | --- |
+| credential | [Jpt
](#Jpt) |
+
+
+
+### JptCredentialValidatorUtils.checkTimeframesWithValidityTimeframe2024(credential, validity_timeframe, status_check)
+**Kind**: static method of [JptCredentialValidatorUtils
](#JptCredentialValidatorUtils)
+
+| Param | Type |
+| --- | --- |
+| credential | [Credential
](#Credential) |
+| validity_timeframe | [Timestamp
](#Timestamp) \| undefined
|
+| status_check | [StatusCheck
](#StatusCheck) |
+
+
+
+### JptCredentialValidatorUtils.checkRevocationWithValidityTimeframe2024(credential, issuer, status_check)
+Checks whether the credential status has been revoked.
+
+Only supports `RevocationTimeframe2024`.
+
+**Kind**: static method of [JptCredentialValidatorUtils
](#JptCredentialValidatorUtils)
+
+| Param | Type |
+| --- | --- |
+| credential | [Credential
](#Credential) |
+| issuer | [CoreDocument
](#CoreDocument) |
+| status_check | [StatusCheck
](#StatusCheck) |
+
+
+
+### JptCredentialValidatorUtils.checkTimeframesAndRevocationWithValidityTimeframe2024(credential, issuer, validity_timeframe, status_check)
+Checks whether the credential status has been revoked or the timeframe interval is INVALID
+
+Only supports `RevocationTimeframe2024`.
+
+**Kind**: static method of [JptCredentialValidatorUtils
](#JptCredentialValidatorUtils)
+
+| Param | Type |
+| --- | --- |
+| credential | [Credential
](#Credential) |
+| issuer | [CoreDocument
](#CoreDocument) |
+| validity_timeframe | [Timestamp
](#Timestamp) \| undefined
|
+| status_check | [StatusCheck
](#StatusCheck) |
+
+
+
+## JptPresentationValidationOptions
+Options to declare validation criteria for a [Jpt](#Jpt) presentation.
+
+**Kind**: global class
+
+* [JptPresentationValidationOptions](#JptPresentationValidationOptions)
+ * [new JptPresentationValidationOptions([opts])](#new_JptPresentationValidationOptions_new)
+ * _instance_
+ * [.clone()](#JptPresentationValidationOptions+clone) ⇒ [JptPresentationValidationOptions
](#JptPresentationValidationOptions)
+ * [.toJSON()](#JptPresentationValidationOptions+toJSON) ⇒ any
+ * _static_
+ * [.fromJSON(json)](#JptPresentationValidationOptions.fromJSON) ⇒ [JptPresentationValidationOptions
](#JptPresentationValidationOptions)
+
+
+
+### new JptPresentationValidationOptions([opts])
+
+| Param | Type |
+| --- | --- |
+| [opts] | IJptPresentationValidationOptions
\| undefined
|
+
+
+
+### jptPresentationValidationOptions.clone() ⇒ [JptPresentationValidationOptions
](#JptPresentationValidationOptions)
+Deep clones the object.
+
+**Kind**: instance method of [JptPresentationValidationOptions
](#JptPresentationValidationOptions)
+
+
+### jptPresentationValidationOptions.toJSON() ⇒ any
+Serializes this to a JSON object.
+
+**Kind**: instance method of [JptPresentationValidationOptions
](#JptPresentationValidationOptions)
+
+
+### JptPresentationValidationOptions.fromJSON(json) ⇒ [JptPresentationValidationOptions
](#JptPresentationValidationOptions)
+Deserializes an instance from a JSON object.
+
+**Kind**: static method of [JptPresentationValidationOptions
](#JptPresentationValidationOptions)
+
+| Param | Type |
+| --- | --- |
+| json | any
|
+
+
+
+## JptPresentationValidator
+**Kind**: global class
+
+
+### JptPresentationValidator.validate(presentation_jpt, issuer, options, fail_fast) ⇒ [DecodedJptPresentation
](#DecodedJptPresentation)
+Decodes and validates a Presented [Credential](#Credential) issued as a JPT (JWP Presented Form). A
+[DecodedJptPresentation](#DecodedJptPresentation) is returned upon success.
+
+The following properties are validated according to `options`:
+- the holder's proof on the JWP,
+- the expiration date,
+- the issuance date,
+- the semantic structure.
+
+**Kind**: static method of [JptPresentationValidator
](#JptPresentationValidator)
+
+| Param | Type |
+| --- | --- |
+| presentation_jpt | [Jpt
](#Jpt) |
+| issuer | [CoreDocument
](#CoreDocument) |
+| options | [JptPresentationValidationOptions
](#JptPresentationValidationOptions) |
+| fail_fast | [FailFast
](#FailFast) |
+
+
+
+## JptPresentationValidatorUtils
+Utility functions for verifying JPT presentations.
+
+**Kind**: global class
+
+* [JptPresentationValidatorUtils](#JptPresentationValidatorUtils)
+ * [.extractIssuerFromPresentedJpt(presentation)](#JptPresentationValidatorUtils.extractIssuerFromPresentedJpt) ⇒ [CoreDID
](#CoreDID)
+ * [.checkTimeframesWithValidityTimeframe2024(credential, validity_timeframe, status_check)](#JptPresentationValidatorUtils.checkTimeframesWithValidityTimeframe2024)
+
+
+
+### JptPresentationValidatorUtils.extractIssuerFromPresentedJpt(presentation) ⇒ [CoreDID
](#CoreDID)
+Utility for extracting the issuer field of a credential in JPT representation as DID.
+# Errors
+If the JPT decoding fails or the issuer field is not a valid DID.
+
+**Kind**: static method of [JptPresentationValidatorUtils
](#JptPresentationValidatorUtils)
+
+| Param | Type |
+| --- | --- |
+| presentation | [Jpt
](#Jpt) |
+
+
+
+### JptPresentationValidatorUtils.checkTimeframesWithValidityTimeframe2024(credential, validity_timeframe, status_check)
+Check timeframe interval in credentialStatus with `RevocationTimeframeStatus`.
+
+**Kind**: static method of [JptPresentationValidatorUtils
](#JptPresentationValidatorUtils)
+
+| Param | Type |
+| --- | --- |
+| credential | [Credential
](#Credential) |
+| validity_timeframe | [Timestamp
](#Timestamp) \| undefined
|
+| status_check | [StatusCheck
](#StatusCheck) |
+
## Jwk
@@ -3013,6 +3390,51 @@ Deserializes an instance from a JSON object.
| --- | --- |
| json | any
|
+
+
+## JwpVerificationOptions
+**Kind**: global class
+
+* [JwpVerificationOptions](#JwpVerificationOptions)
+ * _instance_
+ * [.clone()](#JwpVerificationOptions+clone) ⇒ [JwpVerificationOptions
](#JwpVerificationOptions)
+ * [.toJSON()](#JwpVerificationOptions+toJSON) ⇒ any
+ * _static_
+ * [.fromJSON(json)](#JwpVerificationOptions.fromJSON) ⇒ [JwpVerificationOptions
](#JwpVerificationOptions)
+ * [.new([opts])](#JwpVerificationOptions.new) ⇒ [JwpVerificationOptions
](#JwpVerificationOptions)
+
+
+
+### jwpVerificationOptions.clone() ⇒ [JwpVerificationOptions
](#JwpVerificationOptions)
+Deep clones the object.
+
+**Kind**: instance method of [JwpVerificationOptions
](#JwpVerificationOptions)
+
+
+### jwpVerificationOptions.toJSON() ⇒ any
+Serializes this to a JSON object.
+
+**Kind**: instance method of [JwpVerificationOptions
](#JwpVerificationOptions)
+
+
+### JwpVerificationOptions.fromJSON(json) ⇒ [JwpVerificationOptions
](#JwpVerificationOptions)
+Deserializes an instance from a JSON object.
+
+**Kind**: static method of [JwpVerificationOptions
](#JwpVerificationOptions)
+
+| Param | Type |
+| --- | --- |
+| json | any
|
+
+
+
+### JwpVerificationOptions.new([opts]) ⇒ [JwpVerificationOptions
](#JwpVerificationOptions)
+**Kind**: static method of [JwpVerificationOptions
](#JwpVerificationOptions)
+
+| Param | Type |
+| --- | --- |
+| [opts] | IJwpVerificationOptions
\| undefined
|
+
## Jws
@@ -5072,6 +5494,85 @@ if it is a valid Revocation Bitmap Service.
| --- | --- |
| service | [Service
](#Service) |
+
+
+## RevocationTimeframeStatus
+Information used to determine the current status of a [Credential](#Credential).
+
+**Kind**: global class
+
+* [RevocationTimeframeStatus](#RevocationTimeframeStatus)
+ * [new RevocationTimeframeStatus(id, index, duration, [start_validity])](#new_RevocationTimeframeStatus_new)
+ * _instance_
+ * [.clone()](#RevocationTimeframeStatus+clone) ⇒ [RevocationTimeframeStatus
](#RevocationTimeframeStatus)
+ * [.toJSON()](#RevocationTimeframeStatus+toJSON) ⇒ any
+ * [.startValidityTimeframe()](#RevocationTimeframeStatus+startValidityTimeframe) ⇒ [Timestamp
](#Timestamp)
+ * [.endValidityTimeframe()](#RevocationTimeframeStatus+endValidityTimeframe) ⇒ [Timestamp
](#Timestamp)
+ * [.id()](#RevocationTimeframeStatus+id) ⇒ string
+ * [.index()](#RevocationTimeframeStatus+index) ⇒ number
+ * _static_
+ * [.fromJSON(json)](#RevocationTimeframeStatus.fromJSON) ⇒ [RevocationTimeframeStatus
](#RevocationTimeframeStatus)
+
+
+
+### new RevocationTimeframeStatus(id, index, duration, [start_validity])
+Creates a new `RevocationTimeframeStatus`.
+
+
+| Param | Type |
+| --- | --- |
+| id | string
|
+| index | number
|
+| duration | [Duration
](#Duration) |
+| [start_validity] | [Timestamp
](#Timestamp) \| undefined
|
+
+
+
+### revocationTimeframeStatus.clone() ⇒ [RevocationTimeframeStatus
](#RevocationTimeframeStatus)
+Deep clones the object.
+
+**Kind**: instance method of [RevocationTimeframeStatus
](#RevocationTimeframeStatus)
+
+
+### revocationTimeframeStatus.toJSON() ⇒ any
+Serializes this to a JSON object.
+
+**Kind**: instance method of [RevocationTimeframeStatus
](#RevocationTimeframeStatus)
+
+
+### revocationTimeframeStatus.startValidityTimeframe() ⇒ [Timestamp
](#Timestamp)
+Get startValidityTimeframe value.
+
+**Kind**: instance method of [RevocationTimeframeStatus
](#RevocationTimeframeStatus)
+
+
+### revocationTimeframeStatus.endValidityTimeframe() ⇒ [Timestamp
](#Timestamp)
+Get endValidityTimeframe value.
+
+**Kind**: instance method of [RevocationTimeframeStatus
](#RevocationTimeframeStatus)
+
+
+### revocationTimeframeStatus.id() ⇒ string
+Return the URL fo the `RevocationBitmapStatus`.
+
+**Kind**: instance method of [RevocationTimeframeStatus
](#RevocationTimeframeStatus)
+
+
+### revocationTimeframeStatus.index() ⇒ number
+Return the index of the credential in the issuer's revocation bitmap if it can be decoded.
+
+**Kind**: instance method of [RevocationTimeframeStatus
](#RevocationTimeframeStatus)
+
+
+### RevocationTimeframeStatus.fromJSON(json) ⇒ [RevocationTimeframeStatus
](#RevocationTimeframeStatus)
+Deserializes an instance from a JSON object.
+
+**Kind**: static method of [RevocationTimeframeStatus
](#RevocationTimeframeStatus)
+
+| Param | Type |
+| --- | --- |
+| json | any
|
+
## SdJwt
@@ -6196,43 +6697,6 @@ Deserializes an instance from a JSON object.
| --- | --- |
| json | any
|
-
-
-## StatusPurpose
-Purpose of a [StatusList2021](#StatusList2021).
-
-**Kind**: global variable
-
-
-## 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
-
-
-## 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
-
-
-## 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
-
-
-## Any
-The holder is not required to have any kind of relationship to any credential subject.
-
-**Kind**: global variable
-
-
-## StateMetadataEncoding
-**Kind**: global variable
## FailFast
@@ -6258,6 +6722,16 @@ Return after the first error occurs.
## CredentialStatus
+**Kind**: global variable
+
+
+## StateMetadataEncoding
+**Kind**: global variable
+
+
+## StatusPurpose
+Purpose of a [StatusList2021](#StatusList2021).
+
**Kind**: global variable
@@ -6290,28 +6764,33 @@ Validate the status if supported, skip any unsupported
Skip all status checks.
**Kind**: global variable
-
+
-## verifyEd25519(alg, signingInput, decodedSignature, publicKey)
-Verify a JWS signature secured with the `EdDSA` algorithm and curve `Ed25519`.
+## SubjectHolderRelationship
+Declares how credential subjects must relate to the presentation holder.
-This function is useful when one is composing a `IJwsVerifier` that delegates
-`EdDSA` verification with curve `Ed25519` to this function.
+See also the [Subject-Holder Relationship](https://www.w3.org/TR/vc-data-model/#subject-holder-relationships) section of the specification.
-# Warning
+**Kind**: global variable
+
-This function does not check whether `alg = EdDSA` in the protected header. Callers are expected to assert this
-prior to calling the function.
+## 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 function
+**Kind**: global variable
+
-| Param | Type |
-| --- | --- |
-| alg | JwsAlgorithm
|
-| signingInput | Uint8Array
|
-| decodedSignature | Uint8Array
|
-| publicKey | [Jwk
](#Jwk) |
+## 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
+
+## Any
+The holder is not required to have any kind of relationship to any credential subject.
+
+**Kind**: global variable
## encodeB64(data) ⇒ string
@@ -6334,6 +6813,28 @@ Decode the given url-safe base64-encoded slice into its raw bytes.
| --- | --- |
| data | Uint8Array
|
+
+
+## verifyEd25519(alg, signingInput, decodedSignature, publicKey)
+Verify a JWS signature secured with the `EdDSA` algorithm and curve `Ed25519`.
+
+This function is useful when one is composing a `IJwsVerifier` that delegates
+`EdDSA` verification with curve `Ed25519` to this function.
+
+# Warning
+
+This function does not check whether `alg = EdDSA` in the protected header. Callers are expected to assert this
+prior to calling the function.
+
+**Kind**: global function
+
+| Param | Type |
+| --- | --- |
+| alg | JwsAlgorithm
|
+| signingInput | Uint8Array
|
+| decodedSignature | Uint8Array
|
+| publicKey | [Jwk
](#Jwk) |
+
## start()
diff --git a/bindings/wasm/src/credential/jpt_credential_validator/jpt_credential_validation_options.rs b/bindings/wasm/src/credential/jpt_credential_validator/jpt_credential_validation_options.rs
index e7881671b2..55ff8bd0b2 100644
--- a/bindings/wasm/src/credential/jpt_credential_validator/jpt_credential_validation_options.rs
+++ b/bindings/wasm/src/credential/jpt_credential_validator/jpt_credential_validation_options.rs
@@ -45,8 +45,8 @@ extern "C" {
#[wasm_bindgen(typescript_custom_section)]
const I_JPT_CREDENTIAL_VALIDATION_OPTIONS: &'static str = r#"
-/** Holds options to create a new {@link JwtPresentationValidationOptions}. */
-interface IJwtPresentationValidationOptions {
+/** Holds options to create a new {@link JptCredentialValidationOptions}. */
+interface IJptCredentialValidationOptions {
/**
* Declare that the credential is **not** considered valid if it expires before this {@link Timestamp}.
* Uses the current datetime during validation if not set.
diff --git a/bindings/wasm/src/credential/jpt_presentiation_validation/jpt_presentation_validation_options.rs b/bindings/wasm/src/credential/jpt_presentiation_validation/jpt_presentation_validation_options.rs
index abc290cd32..4be235cb3d 100644
--- a/bindings/wasm/src/credential/jpt_presentiation_validation/jpt_presentation_validation_options.rs
+++ b/bindings/wasm/src/credential/jpt_presentiation_validation/jpt_presentation_validation_options.rs
@@ -44,8 +44,8 @@ extern "C" {
#[wasm_bindgen(typescript_custom_section)]
const I_JPT_PRESENTATION_VALIDATION_OPTIONS: &'static str = r#"
-/** Holds options to create a new {@link JwtPresentationValidationOptions}. */
-interface IJwtPresentationValidationOptions {
+/** Holds options to create a new {@link JptPresentationValidationOptions}. */
+interface IJptPresentationValidationOptions {
/**
* The nonce to be placed in the Presentation Protected Header.
*/
From 592bd9c949bef3071dc5233647997244ec6ef70f Mon Sep 17 00:00:00 2001
From: Enrico Marconi An extension interface that provides helper functions for publication and resolution of DID documents in Alias Outputs.
A JSON Proof Token (JPT).
The result of a key generation in JwkStorage
.
Options to be set in the JWT claims of a verifiable presentation.
+pack
and unpack
instead.
Supported verification method types.
Represents a cryptographic proof that can be used to validate verifiable credentials and presentations.
@@ -159,6 +174,8 @@ can be utilized to implement standards or user-defined proofs. The presence of tNote that this proof is not related to JWT and can be used in combination or as an alternative to it.
Convenience type for resolving DID documents from different DID methods.
Also provides methods for resolving DID Documents associated with @@ -187,6 +204,23 @@ verifiable Credentials and Pre with their corresponding disclosure digests.
Note: digests are created using the sha-256 algorithm.
Used to construct a JwpPresentedBuilder and handle the selective disclosure of attributes
+A DID Document Service used to enable trusted interactions associated with a DID subject.
Declares when validation should return if an error occurs.
-Return all errors that occur during validation.
-Return after the first error occurs.
-Purpose of a StatusList2021.
-Controls validation behaviour when checking whether or not a credential has been revoked by its
credentialStatus
.
Skip all status checks.
Declares how credential subjects must relate to the presentation holder.
See also the Subject-Holder Relationship section of the specification.
@@ -267,17 +291,29 @@ This variant is the default.The holder is not required to have any kind of relationship to any credential subject.
Purpose of a StatusList2021.
+Declares when validation should return if an error occurs.
+Return all errors that occur during validation.
+Return after the first error occurs.
+string
Encode the given bytes in url-safe base64.
-Uint8Array
Decode the given url-safe base64-encoded slice into its raw bytes.
-Verify a JWS signature secured with the EdDSA
algorithm and curve Ed25519
.
This function is useful when one is composing a IJwsVerifier
that delegates
@@ -289,6 +325,12 @@ prior to calling the function.
Initializes the console error panic hook for better error messages
string
Encode the given bytes in url-safe base64.
+Uint8Array
Decode the given url-safe base64-encoded slice into its raw bytes.
+DecodedJptCredential
](#DecodedJptCredential)
* [.credential()](#DecodedJptCredential+credential) ⇒ [Credential
](#Credential)
* [.customClaims()](#DecodedJptCredential+customClaims) ⇒ Map.<string, any>
+ * [.decodedJwp()](#DecodedJptCredential+decodedJwp) ⇒ [JwpIssued
](#JwpIssued)
@@ -1390,6 +1433,10 @@ Returns the [Credential](#Credential) embedded into this JPT.
### decodedJptCredential.customClaims() ⇒ Map.<string, any>
Returns the custom claims parsed from the JPT.
+**Kind**: instance method of [DecodedJptCredential
](#DecodedJptCredential)
+
+
+### decodedJptCredential.decodedJwp() ⇒ [JwpIssued
](#JwpIssued)
**Kind**: instance method of [DecodedJptCredential
](#DecodedJptCredential)
@@ -2149,6 +2196,11 @@ if the object is being concurrently modified.
* [.createJws(storage, fragment, payload, options)](#IotaDocument+createJws) ⇒ [Promise.<Jws>
](#Jws)
* [.createCredentialJwt(storage, fragment, credential, options, [custom_claims])](#IotaDocument+createCredentialJwt) ⇒ [Promise.<Jwt>
](#Jwt)
* [.createPresentationJwt(storage, fragment, presentation, signature_options, presentation_options)](#IotaDocument+createPresentationJwt) ⇒ [Promise.<Jwt>
](#Jwt)
+ * [.generateMethodJwp(storage, alg, fragment, scope)](#IotaDocument+generateMethodJwp) ⇒ Promise.<string>
+ * [.createIssuedJwp(storage, fragment, jpt_claims, options)](#IotaDocument+createIssuedJwp) ⇒ Promise.<string>
+ * [.createPresentedJwp(presentation, method_id, options)](#IotaDocument+createPresentedJwp) ⇒ Promise.<string>
+ * [.createCredentialJpt(credential, storage, fragment, options, [custom_claims])](#IotaDocument+createCredentialJpt) ⇒ [Promise.<Jpt>
](#Jpt)
+ * [.createPresentationJpt(presentation, method_id, options)](#IotaDocument+createPresentationJpt) ⇒ [Promise.<Jpt>
](#Jpt)
* _static_
* [.newWithId(id)](#IotaDocument.newWithId) ⇒ [IotaDocument
](#IotaDocument)
* [.unpackFromOutput(did, aliasOutput, allowEmpty)](#IotaDocument.unpackFromOutput) ⇒ [IotaDocument
](#IotaDocument)
@@ -2654,6 +2706,65 @@ private key backed by the `storage` in accordance with the passed `options`.
| signature_options | [JwsSignatureOptions
](#JwsSignatureOptions) |
| presentation_options | [JwtPresentationOptions
](#JwtPresentationOptions) |
+
+
+### iotaDocument.generateMethodJwp(storage, alg, fragment, scope) ⇒ Promise.<string>
+**Kind**: instance method of [IotaDocument
](#IotaDocument)
+
+| Param | Type |
+| --- | --- |
+| storage | [Storage
](#Storage) |
+| alg | [ProofAlgorithm
](#ProofAlgorithm) |
+| fragment | string
\| undefined
|
+| scope | [MethodScope
](#MethodScope) |
+
+
+
+### iotaDocument.createIssuedJwp(storage, fragment, jpt_claims, options) ⇒ Promise.<string>
+**Kind**: instance method of [IotaDocument
](#IotaDocument)
+
+| Param | Type |
+| --- | --- |
+| storage | [Storage
](#Storage) |
+| fragment | string
|
+| jpt_claims | JptClaims
|
+| options | [JwpCredentialOptions
](#JwpCredentialOptions) |
+
+
+
+### iotaDocument.createPresentedJwp(presentation, method_id, options) ⇒ Promise.<string>
+**Kind**: instance method of [IotaDocument
](#IotaDocument)
+
+| Param | Type |
+| --- | --- |
+| presentation | [SelectiveDisclosurePresentation
](#SelectiveDisclosurePresentation) |
+| method_id | string
|
+| options | [JwpPresentationOptions
](#JwpPresentationOptions) |
+
+
+
+### iotaDocument.createCredentialJpt(credential, storage, fragment, options, [custom_claims]) ⇒ [Promise.<Jpt>
](#Jpt)
+**Kind**: instance method of [IotaDocument
](#IotaDocument)
+
+| Param | Type |
+| --- | --- |
+| credential | [Credential
](#Credential) |
+| storage | [Storage
](#Storage) |
+| fragment | string
|
+| options | [JwpCredentialOptions
](#JwpCredentialOptions) |
+| [custom_claims] | Map.<string, any>
\| undefined
|
+
+
+
+### iotaDocument.createPresentationJpt(presentation, method_id, options) ⇒ [Promise.<Jpt>
](#Jpt)
+**Kind**: instance method of [IotaDocument
](#IotaDocument)
+
+| Param | Type |
+| --- | --- |
+| presentation | [SelectiveDisclosurePresentation
](#SelectiveDisclosurePresentation) |
+| method_id | string
|
+| options | [JwpPresentationOptions
](#JwpPresentationOptions) |
+
### IotaDocument.newWithId(id) ⇒ [IotaDocument
](#IotaDocument)
@@ -2888,6 +2999,94 @@ Fetches the `IAliasOutput` associated with the given DID.
| client | IIotaIdentityClient
|
| did | [IotaDID
](#IotaDID) |
+
+
+## IssuerProtectedHeader
+**Kind**: global class
+
+* [IssuerProtectedHeader](#IssuerProtectedHeader)
+ * [.typ](#IssuerProtectedHeader+typ) ⇒ string
\| undefined
+ * [.typ](#IssuerProtectedHeader+typ)
+ * [.alg](#IssuerProtectedHeader+alg) ⇒ [ProofAlgorithm
](#ProofAlgorithm)
+ * [.alg](#IssuerProtectedHeader+alg)
+ * [.kid](#IssuerProtectedHeader+kid) ⇒ string
\| undefined
+ * [.kid](#IssuerProtectedHeader+kid)
+ * [.cid](#IssuerProtectedHeader+cid) ⇒ string
\| undefined
+ * [.cid](#IssuerProtectedHeader+cid)
+ * [.claims()](#IssuerProtectedHeader+claims) ⇒ Array.<string>
+
+
+
+### issuerProtectedHeader.typ ⇒ string
\| undefined
+JWP type (JPT).
+
+**Kind**: instance property of [IssuerProtectedHeader
](#IssuerProtectedHeader)
+
+
+### issuerProtectedHeader.typ
+JWP type (JPT).
+
+**Kind**: instance property of [IssuerProtectedHeader
](#IssuerProtectedHeader)
+
+| Param | Type |
+| --- | --- |
+| [arg0] | string
\| undefined
|
+
+
+
+### issuerProtectedHeader.alg ⇒ [ProofAlgorithm
](#ProofAlgorithm)
+Algorithm used for the JWP.
+
+**Kind**: instance property of [IssuerProtectedHeader
](#IssuerProtectedHeader)
+
+
+### issuerProtectedHeader.alg
+Algorithm used for the JWP.
+
+**Kind**: instance property of [IssuerProtectedHeader
](#IssuerProtectedHeader)
+
+| Param | Type |
+| --- | --- |
+| arg0 | [ProofAlgorithm
](#ProofAlgorithm) |
+
+
+
+### issuerProtectedHeader.kid ⇒ string
\| undefined
+ID for the key used for the JWP.
+
+**Kind**: instance property of [IssuerProtectedHeader
](#IssuerProtectedHeader)
+
+
+### issuerProtectedHeader.kid
+ID for the key used for the JWP.
+
+**Kind**: instance property of [IssuerProtectedHeader
](#IssuerProtectedHeader)
+
+| Param | Type |
+| --- | --- |
+| [arg0] | string
\| undefined
|
+
+
+
+### issuerProtectedHeader.cid ⇒ string
\| undefined
+Not handled for now. Will be used in the future to resolve external claims
+
+**Kind**: instance property of [IssuerProtectedHeader
](#IssuerProtectedHeader)
+
+
+### issuerProtectedHeader.cid
+Not handled for now. Will be used in the future to resolve external claims
+
+**Kind**: instance property of [IssuerProtectedHeader
](#IssuerProtectedHeader)
+
+| Param | Type |
+| --- | --- |
+| [arg0] | string
\| undefined
|
+
+
+
+### issuerProtectedHeader.claims() ⇒ Array.<string>
+**Kind**: instance method of [IssuerProtectedHeader
](#IssuerProtectedHeader)
## Jpt
@@ -2980,7 +3179,7 @@ Deserializes an instance from a JSON object.
| Param | Type |
| --- | --- |
| credential_jpt | [Jpt
](#Jpt) |
-| issuer | [CoreDocument
](#CoreDocument) |
+| issuer | [CoreDocument
](#CoreDocument) \| IToCoreDocument
|
| options | [JptCredentialValidationOptions
](#JptCredentialValidationOptions) |
| fail_fast | [FailFast
](#FailFast) |
@@ -3047,7 +3246,7 @@ Only supports `RevocationTimeframe2024`.
| Param | Type |
| --- | --- |
| credential | [Credential
](#Credential) |
-| issuer | [CoreDocument
](#CoreDocument) |
+| issuer | [CoreDocument
](#CoreDocument) \| IToCoreDocument
|
| status_check | [StatusCheck
](#StatusCheck) |
@@ -3062,7 +3261,7 @@ Only supports `RevocationTimeframe2024`.
| Param | Type |
| --- | --- |
| credential | [Credential
](#Credential) |
-| issuer | [CoreDocument
](#CoreDocument) |
+| issuer | [CoreDocument
](#CoreDocument) \| IToCoreDocument
|
| validity_timeframe | [Timestamp
](#Timestamp) \| undefined
|
| status_check | [StatusCheck
](#StatusCheck) |
@@ -3133,7 +3332,7 @@ The following properties are validated according to `options`:
| Param | Type |
| --- | --- |
| presentation_jpt | [Jpt
](#Jpt) |
-| issuer | [CoreDocument
](#CoreDocument) |
+| issuer | [CoreDocument
](#CoreDocument) \| IToCoreDocument
|
| options | [JptPresentationValidationOptions
](#JptPresentationValidationOptions) |
| fail_fast | [FailFast
](#FailFast) |
@@ -3390,6 +3589,172 @@ Deserializes an instance from a JSON object.
| --- | --- |
| json | any
|
+
+
+## JwpCredentialOptions
+**Kind**: global class
+
+* [JwpCredentialOptions](#JwpCredentialOptions)
+ * _instance_
+ * [.kid](#JwpCredentialOptions+kid) ⇒ string
\| undefined
+ * [.kid](#JwpCredentialOptions+kid)
+ * [.toJSON()](#JwpCredentialOptions+toJSON) ⇒ any
+ * _static_
+ * [.fromJSON(value)](#JwpCredentialOptions.fromJSON) ⇒ [JwpCredentialOptions
](#JwpCredentialOptions)
+
+
+
+### jwpCredentialOptions.kid ⇒ string
\| undefined
+**Kind**: instance property of [JwpCredentialOptions
](#JwpCredentialOptions)
+
+
+### jwpCredentialOptions.kid
+**Kind**: instance property of [JwpCredentialOptions
](#JwpCredentialOptions)
+
+| Param | Type |
+| --- | --- |
+| [arg0] | string
\| undefined
|
+
+
+
+### jwpCredentialOptions.toJSON() ⇒ any
+**Kind**: instance method of [JwpCredentialOptions
](#JwpCredentialOptions)
+
+
+### JwpCredentialOptions.fromJSON(value) ⇒ [JwpCredentialOptions
](#JwpCredentialOptions)
+**Kind**: static method of [JwpCredentialOptions
](#JwpCredentialOptions)
+
+| Param | Type |
+| --- | --- |
+| value | any
|
+
+
+
+## JwpIssued
+**Kind**: global class
+
+* [JwpIssued](#JwpIssued)
+ * _instance_
+ * [.toJSON()](#JwpIssued+toJSON) ⇒ any
+ * [.clone()](#JwpIssued+clone) ⇒ [JwpIssued
](#JwpIssued)
+ * [.encode(serialization)](#JwpIssued+encode) ⇒ string
+ * [.setProof(proof)](#JwpIssued+setProof)
+ * [.getProof()](#JwpIssued+getProof) ⇒ Uint8Array
+ * [.getPayloads()](#JwpIssued+getPayloads) ⇒ [Payloads
](#Payloads)
+ * [.setPayloads(payloads)](#JwpIssued+setPayloads)
+ * [.getIssuerProtectedHeader()](#JwpIssued+getIssuerProtectedHeader) ⇒ [IssuerProtectedHeader
](#IssuerProtectedHeader)
+ * _static_
+ * [.fromJSON(json)](#JwpIssued.fromJSON) ⇒ [JwpIssued
](#JwpIssued)
+
+
+
+### jwpIssued.toJSON() ⇒ any
+Serializes this to a JSON object.
+
+**Kind**: instance method of [JwpIssued
](#JwpIssued)
+
+
+### jwpIssued.clone() ⇒ [JwpIssued
](#JwpIssued)
+Deep clones the object.
+
+**Kind**: instance method of [JwpIssued
](#JwpIssued)
+
+
+### jwpIssued.encode(serialization) ⇒ string
+**Kind**: instance method of [JwpIssued
](#JwpIssued)
+
+| Param | Type |
+| --- | --- |
+| serialization | [SerializationType
](#SerializationType) |
+
+
+
+### jwpIssued.setProof(proof)
+**Kind**: instance method of [JwpIssued
](#JwpIssued)
+
+| Param | Type |
+| --- | --- |
+| proof | Uint8Array
|
+
+
+
+### jwpIssued.getProof() ⇒ Uint8Array
+**Kind**: instance method of [JwpIssued
](#JwpIssued)
+
+
+### jwpIssued.getPayloads() ⇒ [Payloads
](#Payloads)
+**Kind**: instance method of [JwpIssued
](#JwpIssued)
+
+
+### jwpIssued.setPayloads(payloads)
+**Kind**: instance method of [JwpIssued
](#JwpIssued)
+
+| Param | Type |
+| --- | --- |
+| payloads | [Payloads
](#Payloads) |
+
+
+
+### jwpIssued.getIssuerProtectedHeader() ⇒ [IssuerProtectedHeader
](#IssuerProtectedHeader)
+**Kind**: instance method of [JwpIssued
](#JwpIssued)
+
+
+### JwpIssued.fromJSON(json) ⇒ [JwpIssued
](#JwpIssued)
+Deserializes an instance from a JSON object.
+
+**Kind**: static method of [JwpIssued
](#JwpIssued)
+
+| Param | Type |
+| --- | --- |
+| json | any
|
+
+
+
+## JwpPresentationOptions
+Options to be set in the JWT claims of a verifiable presentation.
+
+**Kind**: global class
+
+* [JwpPresentationOptions](#JwpPresentationOptions)
+ * [.audience](#JwpPresentationOptions+audience) ⇒ string
\| undefined
+ * [.audience](#JwpPresentationOptions+audience)
+ * [.nonce](#JwpPresentationOptions+nonce) ⇒ string
\| undefined
+ * [.nonce](#JwpPresentationOptions+nonce)
+
+
+
+### jwpPresentationOptions.audience ⇒ string
\| undefined
+Sets the audience for presentation (`aud` property in JWP Presentation Header).
+
+**Kind**: instance property of [JwpPresentationOptions
](#JwpPresentationOptions)
+
+
+### jwpPresentationOptions.audience
+Sets the audience for presentation (`aud` property in JWP Presentation Header).
+
+**Kind**: instance property of [JwpPresentationOptions
](#JwpPresentationOptions)
+
+| Param | Type |
+| --- | --- |
+| [arg0] | string
\| undefined
|
+
+
+
+### jwpPresentationOptions.nonce ⇒ string
\| undefined
+The nonce to be placed in the Presentation Protected Header.
+
+**Kind**: instance property of [JwpPresentationOptions
](#JwpPresentationOptions)
+
+
+### jwpPresentationOptions.nonce
+The nonce to be placed in the Presentation Protected Header.
+
+**Kind**: instance property of [JwpPresentationOptions
](#JwpPresentationOptions)
+
+| Param | Type |
+| --- | --- |
+| [arg0] | string
\| undefined
|
+
## JwpVerificationOptions
@@ -5120,56 +5485,193 @@ Deserializes an instance from a JSON object.
| --- | --- |
| json | any
|
-
+
-## Presentation
+## PayloadEntry
**Kind**: global class
-* [Presentation](#Presentation)
- * [new Presentation(values)](#new_Presentation_new)
- * _instance_
- * [.context()](#Presentation+context) ⇒ Array.<(string\|Record.<string, any>)>
- * [.id()](#Presentation+id) ⇒ string
\| undefined
- * [.type()](#Presentation+type) ⇒ Array.<string>
- * [.verifiableCredential()](#Presentation+verifiableCredential) ⇒ [Array.<UnknownCredential>
](#UnknownCredential)
- * [.holder()](#Presentation+holder) ⇒ string
- * [.refreshService()](#Presentation+refreshService) ⇒ Array.<RefreshService>
- * [.termsOfUse()](#Presentation+termsOfUse) ⇒ Array.<Policy>
- * [.proof()](#Presentation+proof) ⇒ [Proof
](#Proof) \| undefined
- * [.setProof([proof])](#Presentation+setProof)
- * [.properties()](#Presentation+properties) ⇒ Map.<string, any>
- * [.toJSON()](#Presentation+toJSON) ⇒ any
- * [.clone()](#Presentation+clone) ⇒ [Presentation
](#Presentation)
- * _static_
- * [.BaseContext()](#Presentation.BaseContext) ⇒ string
- * [.BaseType()](#Presentation.BaseType) ⇒ string
- * [.fromJSON(json)](#Presentation.fromJSON) ⇒ [Presentation
](#Presentation)
+* [PayloadEntry](#PayloadEntry)
+ * [.1](#PayloadEntry+1) ⇒ [PayloadType
](#PayloadType)
+ * [.1](#PayloadEntry+1)
+ * [.value](#PayloadEntry+value)
+ * [.value](#PayloadEntry+value) ⇒ any
-
+
-### new Presentation(values)
-Constructs a new presentation.
+### payloadEntry.1 ⇒ [PayloadType
](#PayloadType)
+**Kind**: instance property of [PayloadEntry
](#PayloadEntry)
+
+### payloadEntry.1
+**Kind**: instance property of [PayloadEntry
](#PayloadEntry)
| Param | Type |
| --- | --- |
-| values | IPresentation
|
+| arg0 | [PayloadType
](#PayloadType) |
-
+
-### presentation.context() ⇒ Array.<(string\|Record.<string, any>)>
-Returns a copy of the JSON-LD context(s) applicable to the presentation.
+### payloadEntry.value
+**Kind**: instance property of [PayloadEntry
](#PayloadEntry)
-**Kind**: instance method of [Presentation
](#Presentation)
-
+| Param | Type |
+| --- | --- |
+| value | any
|
-### presentation.id() ⇒ string
\| undefined
-Returns a copy of the unique `URI` identifying the presentation.
+
-**Kind**: instance method of [Presentation
](#Presentation)
-
+### payloadEntry.value ⇒ any
+**Kind**: instance property of [PayloadEntry
](#PayloadEntry)
+
-### presentation.type() ⇒ Array.<string>
+## Payloads
+**Kind**: global class
+
+* [Payloads](#Payloads)
+ * [new Payloads(entries)](#new_Payloads_new)
+ * _instance_
+ * [.toJSON()](#Payloads+toJSON) ⇒ any
+ * [.clone()](#Payloads+clone) ⇒ [Payloads
](#Payloads)
+ * [.getValues()](#Payloads+getValues) ⇒ Array.<any>
+ * [.getUndisclosedIndexes()](#Payloads+getUndisclosedIndexes) ⇒ Uint32Array
+ * [.getDisclosedIndexes()](#Payloads+getDisclosedIndexes) ⇒ Uint32Array
+ * [.getUndisclosedPayloads()](#Payloads+getUndisclosedPayloads) ⇒ Array.<any>
+ * [.getDisclosedPayloads()](#Payloads+getDisclosedPayloads) ⇒ [Payloads
](#Payloads)
+ * [.setUndisclosed(index)](#Payloads+setUndisclosed)
+ * [.replacePayloadAtIndex(index, value)](#Payloads+replacePayloadAtIndex) ⇒ any
+ * _static_
+ * [.fromJSON(json)](#Payloads.fromJSON) ⇒ [Payloads
](#Payloads)
+ * [.newFromValues(values)](#Payloads.newFromValues) ⇒ [Payloads
](#Payloads)
+
+
+
+### new Payloads(entries)
+
+| Param | Type |
+| --- | --- |
+| entries | [Array.<PayloadEntry>
](#PayloadEntry) |
+
+
+
+### payloads.toJSON() ⇒ any
+Serializes this to a JSON object.
+
+**Kind**: instance method of [Payloads
](#Payloads)
+
+
+### payloads.clone() ⇒ [Payloads
](#Payloads)
+Deep clones the object.
+
+**Kind**: instance method of [Payloads
](#Payloads)
+
+
+### payloads.getValues() ⇒ Array.<any>
+**Kind**: instance method of [Payloads
](#Payloads)
+
+
+### payloads.getUndisclosedIndexes() ⇒ Uint32Array
+**Kind**: instance method of [Payloads
](#Payloads)
+
+
+### payloads.getDisclosedIndexes() ⇒ Uint32Array
+**Kind**: instance method of [Payloads
](#Payloads)
+
+
+### payloads.getUndisclosedPayloads() ⇒ Array.<any>
+**Kind**: instance method of [Payloads
](#Payloads)
+
+
+### payloads.getDisclosedPayloads() ⇒ [Payloads
](#Payloads)
+**Kind**: instance method of [Payloads
](#Payloads)
+
+
+### payloads.setUndisclosed(index)
+**Kind**: instance method of [Payloads
](#Payloads)
+
+| Param | Type |
+| --- | --- |
+| index | number
|
+
+
+
+### payloads.replacePayloadAtIndex(index, value) ⇒ any
+**Kind**: instance method of [Payloads
](#Payloads)
+
+| Param | Type |
+| --- | --- |
+| index | number
|
+| value | any
|
+
+
+
+### Payloads.fromJSON(json) ⇒ [Payloads
](#Payloads)
+Deserializes an instance from a JSON object.
+
+**Kind**: static method of [Payloads
](#Payloads)
+
+| Param | Type |
+| --- | --- |
+| json | any
|
+
+
+
+### Payloads.newFromValues(values) ⇒ [Payloads
](#Payloads)
+**Kind**: static method of [Payloads
](#Payloads)
+
+| Param | Type |
+| --- | --- |
+| values | Array.<any>
|
+
+
+
+## Presentation
+**Kind**: global class
+
+* [Presentation](#Presentation)
+ * [new Presentation(values)](#new_Presentation_new)
+ * _instance_
+ * [.context()](#Presentation+context) ⇒ Array.<(string\|Record.<string, any>)>
+ * [.id()](#Presentation+id) ⇒ string
\| undefined
+ * [.type()](#Presentation+type) ⇒ Array.<string>
+ * [.verifiableCredential()](#Presentation+verifiableCredential) ⇒ [Array.<UnknownCredential>
](#UnknownCredential)
+ * [.holder()](#Presentation+holder) ⇒ string
+ * [.refreshService()](#Presentation+refreshService) ⇒ Array.<RefreshService>
+ * [.termsOfUse()](#Presentation+termsOfUse) ⇒ Array.<Policy>
+ * [.proof()](#Presentation+proof) ⇒ [Proof
](#Proof) \| undefined
+ * [.setProof([proof])](#Presentation+setProof)
+ * [.properties()](#Presentation+properties) ⇒ Map.<string, any>
+ * [.toJSON()](#Presentation+toJSON) ⇒ any
+ * [.clone()](#Presentation+clone) ⇒ [Presentation
](#Presentation)
+ * _static_
+ * [.BaseContext()](#Presentation.BaseContext) ⇒ string
+ * [.BaseType()](#Presentation.BaseType) ⇒ string
+ * [.fromJSON(json)](#Presentation.fromJSON) ⇒ [Presentation
](#Presentation)
+
+
+
+### new Presentation(values)
+Constructs a new presentation.
+
+
+| Param | Type |
+| --- | --- |
+| values | IPresentation
|
+
+
+
+### presentation.context() ⇒ Array.<(string\|Record.<string, any>)>
+Returns a copy of the JSON-LD context(s) applicable to the presentation.
+
+**Kind**: instance method of [Presentation
](#Presentation)
+
+
+### presentation.id() ⇒ string
\| undefined
+Returns a copy of the unique `URI` identifying the presentation.
+
+**Kind**: instance method of [Presentation
](#Presentation)
+
+
+### presentation.type() ⇒ Array.<string>
Returns a copy of the URIs defining the type of the presentation.
**Kind**: instance method of [Presentation
](#Presentation)
@@ -5257,6 +5759,85 @@ Deserializes an instance from a JSON object.
| --- | --- |
| json | any
|
+
+
+## PresentationProtectedHeader
+**Kind**: global class
+
+* [PresentationProtectedHeader](#PresentationProtectedHeader)
+ * [.alg](#PresentationProtectedHeader+alg) ⇒ [PresentationProofAlgorithm
](#PresentationProofAlgorithm)
+ * [.alg](#PresentationProtectedHeader+alg)
+ * [.kid](#PresentationProtectedHeader+kid) ⇒ string
\| undefined
+ * [.kid](#PresentationProtectedHeader+kid)
+ * [.aud](#PresentationProtectedHeader+aud) ⇒ string
\| undefined
+ * [.aud](#PresentationProtectedHeader+aud)
+ * [.nonce](#PresentationProtectedHeader+nonce) ⇒ string
\| undefined
+ * [.nonce](#PresentationProtectedHeader+nonce)
+
+
+
+### presentationProtectedHeader.alg ⇒ [PresentationProofAlgorithm
](#PresentationProofAlgorithm)
+**Kind**: instance property of [PresentationProtectedHeader
](#PresentationProtectedHeader)
+
+
+### presentationProtectedHeader.alg
+**Kind**: instance property of [PresentationProtectedHeader
](#PresentationProtectedHeader)
+
+| Param | Type |
+| --- | --- |
+| arg0 | [PresentationProofAlgorithm
](#PresentationProofAlgorithm) |
+
+
+
+### presentationProtectedHeader.kid ⇒ string
\| undefined
+ID for the key used for the JWP.
+
+**Kind**: instance property of [PresentationProtectedHeader
](#PresentationProtectedHeader)
+
+
+### presentationProtectedHeader.kid
+ID for the key used for the JWP.
+
+**Kind**: instance property of [PresentationProtectedHeader
](#PresentationProtectedHeader)
+
+| Param | Type |
+| --- | --- |
+| [arg0] | string
\| undefined
|
+
+
+
+### presentationProtectedHeader.aud ⇒ string
\| undefined
+Who have received the JPT.
+
+**Kind**: instance property of [PresentationProtectedHeader
](#PresentationProtectedHeader)
+
+
+### presentationProtectedHeader.aud
+Who have received the JPT.
+
+**Kind**: instance property of [PresentationProtectedHeader
](#PresentationProtectedHeader)
+
+| Param | Type |
+| --- | --- |
+| [arg0] | string
\| undefined
|
+
+
+
+### presentationProtectedHeader.nonce ⇒ string
\| undefined
+For replay attacks.
+
+**Kind**: instance property of [PresentationProtectedHeader
](#PresentationProtectedHeader)
+
+
+### presentationProtectedHeader.nonce
+For replay attacks.
+
+**Kind**: instance property of [PresentationProtectedHeader
](#PresentationProtectedHeader)
+
+| Param | Type |
+| --- | --- |
+| [arg0] | string
\| undefined
|
+
## Proof
@@ -5326,6 +5907,146 @@ Deserializes an instance from a JSON object.
| --- | --- |
| json | any
|
+
+
+## ProofUpdateCtx
+**Kind**: global class
+
+* [ProofUpdateCtx](#ProofUpdateCtx)
+ * [.old_start_validity_timeframe](#ProofUpdateCtx+old_start_validity_timeframe) ⇒ Uint8Array
+ * [.old_start_validity_timeframe](#ProofUpdateCtx+old_start_validity_timeframe)
+ * [.new_start_validity_timeframe](#ProofUpdateCtx+new_start_validity_timeframe) ⇒ Uint8Array
+ * [.new_start_validity_timeframe](#ProofUpdateCtx+new_start_validity_timeframe)
+ * [.old_end_validity_timeframe](#ProofUpdateCtx+old_end_validity_timeframe) ⇒ Uint8Array
+ * [.old_end_validity_timeframe](#ProofUpdateCtx+old_end_validity_timeframe)
+ * [.new_end_validity_timeframe](#ProofUpdateCtx+new_end_validity_timeframe) ⇒ Uint8Array
+ * [.new_end_validity_timeframe](#ProofUpdateCtx+new_end_validity_timeframe)
+ * [.index_start_validity_timeframe](#ProofUpdateCtx+index_start_validity_timeframe) ⇒ number
+ * [.index_start_validity_timeframe](#ProofUpdateCtx+index_start_validity_timeframe)
+ * [.index_end_validity_timeframe](#ProofUpdateCtx+index_end_validity_timeframe) ⇒ number
+ * [.index_end_validity_timeframe](#ProofUpdateCtx+index_end_validity_timeframe)
+ * [.number_of_signed_messages](#ProofUpdateCtx+number_of_signed_messages) ⇒ number
+ * [.number_of_signed_messages](#ProofUpdateCtx+number_of_signed_messages)
+
+
+
+### proofUpdateCtx.old\_start\_validity\_timeframe ⇒ Uint8Array
+Old `startValidityTimeframe` value
+
+**Kind**: instance property of [ProofUpdateCtx
](#ProofUpdateCtx)
+
+
+### proofUpdateCtx.old\_start\_validity\_timeframe
+Old `startValidityTimeframe` value
+
+**Kind**: instance property of [ProofUpdateCtx
](#ProofUpdateCtx)
+
+| Param | Type |
+| --- | --- |
+| arg0 | Uint8Array
|
+
+
+
+### proofUpdateCtx.new\_start\_validity\_timeframe ⇒ Uint8Array
+New `startValidityTimeframe` value to be signed
+
+**Kind**: instance property of [ProofUpdateCtx
](#ProofUpdateCtx)
+
+
+### proofUpdateCtx.new\_start\_validity\_timeframe
+New `startValidityTimeframe` value to be signed
+
+**Kind**: instance property of [ProofUpdateCtx
](#ProofUpdateCtx)
+
+| Param | Type |
+| --- | --- |
+| arg0 | Uint8Array
|
+
+
+
+### proofUpdateCtx.old\_end\_validity\_timeframe ⇒ Uint8Array
+Old `endValidityTimeframe` value
+
+**Kind**: instance property of [ProofUpdateCtx
](#ProofUpdateCtx)
+
+
+### proofUpdateCtx.old\_end\_validity\_timeframe
+Old `endValidityTimeframe` value
+
+**Kind**: instance property of [ProofUpdateCtx
](#ProofUpdateCtx)
+
+| Param | Type |
+| --- | --- |
+| arg0 | Uint8Array
|
+
+
+
+### proofUpdateCtx.new\_end\_validity\_timeframe ⇒ Uint8Array
+New `endValidityTimeframe` value to be signed
+
+**Kind**: instance property of [ProofUpdateCtx
](#ProofUpdateCtx)
+
+
+### proofUpdateCtx.new\_end\_validity\_timeframe
+New `endValidityTimeframe` value to be signed
+
+**Kind**: instance property of [ProofUpdateCtx
](#ProofUpdateCtx)
+
+| Param | Type |
+| --- | --- |
+| arg0 | Uint8Array
|
+
+
+
+### proofUpdateCtx.index\_start\_validity\_timeframe ⇒ number
+Index of `startValidityTimeframe` claim inside the array of Claims
+
+**Kind**: instance property of [ProofUpdateCtx
](#ProofUpdateCtx)
+
+
+### proofUpdateCtx.index\_start\_validity\_timeframe
+Index of `startValidityTimeframe` claim inside the array of Claims
+
+**Kind**: instance property of [ProofUpdateCtx
](#ProofUpdateCtx)
+
+| Param | Type |
+| --- | --- |
+| arg0 | number
|
+
+
+
+### proofUpdateCtx.index\_end\_validity\_timeframe ⇒ number
+Index of `endValidityTimeframe` claim inside the array of Claims
+
+**Kind**: instance property of [ProofUpdateCtx
](#ProofUpdateCtx)
+
+
+### proofUpdateCtx.index\_end\_validity\_timeframe
+Index of `endValidityTimeframe` claim inside the array of Claims
+
+**Kind**: instance property of [ProofUpdateCtx
](#ProofUpdateCtx)
+
+| Param | Type |
+| --- | --- |
+| arg0 | number
|
+
+
+
+### proofUpdateCtx.number\_of\_signed\_messages ⇒ number
+Number of signed messages, number of payloads in a JWP
+
+**Kind**: instance property of [ProofUpdateCtx
](#ProofUpdateCtx)
+
+
+### proofUpdateCtx.number\_of\_signed\_messages
+Number of signed messages, number of payloads in a JWP
+
+**Kind**: instance property of [ProofUpdateCtx
](#ProofUpdateCtx)
+
+| Param | Type |
+| --- | --- |
+| arg0 | number
|
+
## Resolver
@@ -5509,7 +6230,7 @@ Information used to determine the current status of a [Credential](#Credential).
* [.startValidityTimeframe()](#RevocationTimeframeStatus+startValidityTimeframe) ⇒ [Timestamp
](#Timestamp)
* [.endValidityTimeframe()](#RevocationTimeframeStatus+endValidityTimeframe) ⇒ [Timestamp
](#Timestamp)
* [.id()](#RevocationTimeframeStatus+id) ⇒ string
- * [.index()](#RevocationTimeframeStatus+index) ⇒ number
+ * [.index()](#RevocationTimeframeStatus+index) ⇒ number
\| undefined
* _static_
* [.fromJSON(json)](#RevocationTimeframeStatus.fromJSON) ⇒ [RevocationTimeframeStatus
](#RevocationTimeframeStatus)
@@ -5558,8 +6279,8 @@ Return the URL fo the `RevocationBitmapStatus`.
**Kind**: instance method of [RevocationTimeframeStatus
](#RevocationTimeframeStatus)
-### revocationTimeframeStatus.index() ⇒ number
-Return the index of the credential in the issuer's revocation bitmap if it can be decoded.
+### revocationTimeframeStatus.index() ⇒ number
\| undefined
+Return the index of the credential in the issuer's revocation bitmap
**Kind**: instance method of [RevocationTimeframeStatus
](#RevocationTimeframeStatus)
@@ -5910,6 +6631,93 @@ If path is an empty slice, decoys will be added to the top level.
| path | string
|
| number_of_decoys | number
|
+
+
+## SelectiveDisclosurePresentation
+Used to construct a JwpPresentedBuilder and handle the selective disclosure of attributes
+- @context MUST NOT be blinded
+- id MUST be blinded
+- type MUST NOT be blinded
+- issuer MUST NOT be blinded
+- issuanceDate MUST be blinded (if Timeframe Revocation mechanism is used)
+- expirationDate MUST be blinded (if Timeframe Revocation mechanism is used)
+- credentialSubject (User have to choose which attribute must be blinded)
+- credentialSchema MUST NOT be blinded
+- credentialStatus MUST NOT be blinded
+- refreshService MUST NOT be blinded (probably will be used for Timeslot Revocation mechanism)
+- termsOfUse NO reason to use it in ZK VC (will be in any case blinded)
+- evidence (User have to choose which attribute must be blinded)
+
+**Kind**: global class
+
+* [SelectiveDisclosurePresentation](#SelectiveDisclosurePresentation)
+ * [new SelectiveDisclosurePresentation(issued_jwp)](#new_SelectiveDisclosurePresentation_new)
+ * [.concealInSubject(path)](#SelectiveDisclosurePresentation+concealInSubject)
+ * [.concealInEvidence(path)](#SelectiveDisclosurePresentation+concealInEvidence)
+ * [.setPresentationHeader(header)](#SelectiveDisclosurePresentation+setPresentationHeader)
+
+
+
+### new SelectiveDisclosurePresentation(issued_jwp)
+Initialize a presentation starting from an Issued JWP.
+The properties `jti`, `nbf`, `issuanceDate`, `expirationDate` and `termsOfUse` are concealed by default.
+
+
+| Param | Type |
+| --- | --- |
+| issued_jwp | [JwpIssued
](#JwpIssued) |
+
+
+
+### selectiveDisclosurePresentation.concealInSubject(path)
+Selectively disclose "credentialSubject" attributes.
+# Example
+```
+{
+ "id": 1234,
+ "name": "Alice",
+ "mainCourses": ["Object-oriented Programming", "Mathematics"],
+ "degree": {
+ "type": "BachelorDegree",
+ "name": "Bachelor of Science and Arts",
+ },
+ "GPA": "4.0",
+}
+```
+If you want to undisclose for example the Mathematics course and the name of the degree:
+```
+undisclose_subject("mainCourses[1]");
+undisclose_subject("degree.name");
+```
+
+**Kind**: instance method of [SelectiveDisclosurePresentation
](#SelectiveDisclosurePresentation)
+
+| Param | Type |
+| --- | --- |
+| path | string
|
+
+
+
+### selectiveDisclosurePresentation.concealInEvidence(path)
+Undiscloses "evidence" attributes.
+
+**Kind**: instance method of [SelectiveDisclosurePresentation
](#SelectiveDisclosurePresentation)
+
+| Param | Type |
+| --- | --- |
+| path | string
|
+
+
+
+### selectiveDisclosurePresentation.setPresentationHeader(header)
+Sets presentation protected header.
+
+**Kind**: instance method of [SelectiveDisclosurePresentation
](#SelectiveDisclosurePresentation)
+
+| Param | Type |
+| --- | --- |
+| header | [PresentationProtectedHeader
](#PresentationProtectedHeader) |
+
## Service
@@ -6697,41 +7505,13 @@ Deserializes an instance from a JSON object.
| --- | --- |
| json | any
|
-
-
-## FailFast
-Declares when validation should return if an error occurs.
-
-**Kind**: global variable
-
-
-## AllErrors
-Return all errors that occur during validation.
-
-**Kind**: global variable
-
-
-## FirstError
-Return after the first error occurs.
+
+## PresentationProofAlgorithm
**Kind**: global variable
-
-
-## MethodRelationship
-**Kind**: global variable
-
-
-## CredentialStatus
-**Kind**: global variable
-
-
-## StateMetadataEncoding
-**Kind**: global variable
-
-
-## StatusPurpose
-Purpose of a [StatusList2021](#StatusList2021).
+
+## ProofAlgorithm
**Kind**: global variable
@@ -6763,6 +7543,14 @@ Validate the status if supported, skip any unsupported
## SkipAll
Skip all status checks.
+**Kind**: global variable
+
+
+## SerializationType
+**Kind**: global variable
+
+
+## MethodRelationship
**Kind**: global variable
@@ -6791,28 +7579,42 @@ The holder must match the subject only for credentials where the [`nonTransferab
The holder is not required to have any kind of relationship to any credential subject.
**Kind**: global variable
-
+
-## encodeB64(data) ⇒ string
-Encode the given bytes in url-safe base64.
+## CredentialStatus
+**Kind**: global variable
+
-**Kind**: global function
+## StatusPurpose
+Purpose of a [StatusList2021](#StatusList2021).
-| Param | Type |
-| --- | --- |
-| data | Uint8Array
|
+**Kind**: global variable
+
-
+## StateMetadataEncoding
+**Kind**: global variable
+
-## decodeB64(data) ⇒ Uint8Array
-Decode the given url-safe base64-encoded slice into its raw bytes.
+## FailFast
+Declares when validation should return if an error occurs.
-**Kind**: global function
+**Kind**: global variable
+
-| Param | Type |
-| --- | --- |
-| data | Uint8Array
|
+## AllErrors
+Return all errors that occur during validation.
+
+**Kind**: global variable
+
+
+## FirstError
+Return after the first error occurs.
+**Kind**: global variable
+
+
+## PayloadType
+**Kind**: global variable
## verifyEd25519(alg, signingInput, decodedSignature, publicKey)
@@ -6841,3 +7643,25 @@ prior to calling the function.
Initializes the console error panic hook for better error messages
**Kind**: global function
+
+
+## encodeB64(data) ⇒ string
+Encode the given bytes in url-safe base64.
+
+**Kind**: global function
+
+| Param | Type |
+| --- | --- |
+| data | Uint8Array
|
+
+
+
+## decodeB64(data) ⇒ Uint8Array
+Decode the given url-safe base64-encoded slice into its raw bytes.
+
+**Kind**: global function
+
+| Param | Type |
+| --- | --- |
+| data | Uint8Array
|
+
diff --git a/bindings/wasm/examples/src/1_advanced/8_zkp.ts b/bindings/wasm/examples/src/1_advanced/8_zkp.ts
new file mode 100644
index 0000000000..55d0c82fca
--- /dev/null
+++ b/bindings/wasm/examples/src/1_advanced/8_zkp.ts
@@ -0,0 +1,226 @@
+import {
+ Credential,
+ FailFast,
+ IotaDID,
+ IotaDocument,
+ IotaIdentityClient,
+ JptCredentialValidationOptions,
+ JptCredentialValidator,
+ JptCredentialValidatorUtils,
+ JptPresentationValidationOptions,
+ JptPresentationValidator,
+ JptPresentationValidatorUtils,
+ JwkMemStore,
+ JwpCredentialOptions,
+ JwpPresentationOptions,
+ KeyIdMemStore,
+ MethodScope,
+ ProofAlgorithm,
+ SelectiveDisclosurePresentation,
+ Storage,
+} from "@iota/identity-wasm/node";
+import {
+ type Address,
+ AliasOutput,
+ Client,
+ MnemonicSecretManager,
+ SecretManager,
+ SecretManagerType,
+ Utils,
+} from "@iota/sdk-wasm/node";
+import { API_ENDPOINT, ensureAddressHasFunds } from "../util";
+
+/** Creates a DID Document and publishes it in a new Alias Output.
+
+Its functionality is equivalent to the "create DID" example
+and exists for convenient calling from the other examples. */
+export async function createDid(client: Client, secretManager: SecretManagerType, storage: Storage): Promise<{
+ address: Address;
+ document: IotaDocument;
+ fragment: string;
+}> {
+ const didClient = new IotaIdentityClient(client);
+ const networkHrp: string = await didClient.getNetworkHrp();
+
+ const secretManagerInstance = new SecretManager(secretManager);
+ const walletAddressBech32 = (await secretManagerInstance.generateEd25519Addresses({
+ accountIndex: 0,
+ range: {
+ start: 0,
+ end: 1,
+ },
+ bech32Hrp: networkHrp,
+ }))[0];
+
+ console.log("Wallet address Bech32:", walletAddressBech32);
+
+ await ensureAddressHasFunds(client, walletAddressBech32);
+
+ const address: Address = Utils.parseBech32Address(walletAddressBech32);
+
+ // Create a new DID document with a placeholder DID.
+ // The DID will be derived from the Alias Id of the Alias Output after publishing.
+ const document = new IotaDocument(networkHrp);
+
+ const fragment = await document.generateMethodJwp(
+ storage,
+ ProofAlgorithm.BLS12381_SHA256,
+ undefined,
+ MethodScope.VerificationMethod(),
+ );
+ // Construct an Alias Output containing the DID document, with the wallet address
+ // set as both the state controller and governor.
+ const aliasOutput: AliasOutput = await didClient.newDidOutput(address, document);
+
+ // Publish the Alias Output and get the published DID document.
+ const published = await didClient.publishDidOutput(secretManager, aliasOutput);
+
+ return { address, document: published, fragment };
+}
+export async function zkp() {
+ // ===========================================================================
+ // Step 1: Create identity for the issuer.
+ // ===========================================================================
+
+ // Create a new client to interact with the IOTA ledger.
+ const client = new Client({
+ primaryNode: API_ENDPOINT,
+ localPow: true,
+ });
+
+ // Creates a new wallet and identity (see "0_create_did" example).
+ const issuerSecretManager: MnemonicSecretManager = {
+ mnemonic: Utils.generateMnemonic(),
+ };
+ const issuerStorage: Storage = new Storage(
+ new JwkMemStore(),
+ new KeyIdMemStore(),
+ );
+ let { document: issuerDocument, fragment: issuerFragment } = await createDid(
+ client,
+ issuerSecretManager,
+ issuerStorage,
+ );
+
+ // ===========================================================================
+ // Step 2: Issuer creates and signs a Verifiable Credential with BBS algorithm.
+ // ===========================================================================
+
+ // Create a credential subject indicating the degree earned by Alice.
+ const subject = {
+ name: "Alice",
+ mainCourses: ["Object-oriented Programming", "Mathematics"],
+ degree: {
+ type: "BachelorDegree",
+ name: "Bachelor of Science and Arts",
+ },
+ GPA: 4.0,
+ };
+
+ // Build credential using the above subject and issuer.
+ const credential = new Credential({
+ id: "https:/example.edu/credentials/3732",
+ issuer: issuerDocument.id(),
+ type: "UniversityDegreeCredential",
+ credentialSubject: subject,
+ });
+ const credentialJpt = await issuerDocument
+ .createCredentialJpt(
+ credential,
+ issuerStorage,
+ issuerFragment,
+ new JwpCredentialOptions(),
+ );
+ // Validate the credential's proof using the issuer's DID Document, the credential's semantic structure,
+ // that the issuance date is not in the future and that the expiration date is not in the past:
+ const decodedJpt = JptCredentialValidator.validate(
+ credentialJpt,
+ issuerDocument,
+ new JptCredentialValidationOptions(),
+ FailFast.FirstError,
+ );
+
+ // ===========================================================================
+ // Step 3: Issuer sends the Verifiable Credential to the holder.
+ // ===========================================================================
+ console.log("Sending credential (as JPT) to the holder: " + credentialJpt.toString());
+
+ // ============================================================================================
+ // Step 4: Holder resolve Issuer's DID, retrieve Issuer's document and validate the Credential
+ // ============================================================================================
+ const identityClient = new IotaIdentityClient(client);
+
+ // Holder resolves issuer's DID.
+ let issuerDid = IotaDID.parse(JptCredentialValidatorUtils.extractIssuerFromIssuedJpt(credentialJpt).toString());
+ let issuerDoc = await identityClient.resolveDid(issuerDid);
+
+ // Holder validates the credential and retrieve the JwpIssued, needed to construct the JwpPresented
+ let decodedCredential = JptCredentialValidator.validate(
+ credentialJpt,
+ issuerDoc,
+ new JptCredentialValidationOptions(),
+ FailFast.FirstError,
+ );
+
+ // ===========================================================================
+ // Step 5: Verifier sends the holder a challenge and requests a Presentation.
+ //
+ // Please be aware that when we mention "Presentation," we are not alluding to the Verifiable Presentation standard as defined by W3C (https://www.w3.org/TR/vc-data-model/#presentations).
+ // Instead, our reference is to a JWP Presentation (https://datatracker.ietf.org/doc/html/draft-ietf-jose-json-web-proof#name-presented-form), which differs from the W3C standard.
+ // ===========================================================================
+
+ // A unique random challenge generated by the requester per presentation can mitigate replay attacks.
+ const challenge = "475a7984-1bb5-4c4c-a56f-822bccd46440";
+
+ // =========================================================================================================
+ // Step 6: Holder engages in the Selective Disclosure of credential's attributes.
+ // =========================================================================================================
+ const methodId = decodedCredential
+ .decodedJwp()
+ .getIssuerProtectedHeader()
+ .kid!;
+ const selectiveDisclosurePresentation = new SelectiveDisclosurePresentation(decodedCredential.decodedJwp());
+ selectiveDisclosurePresentation.concealInSubject("mainCourses[1]");
+ selectiveDisclosurePresentation.concealInSubject("degree.name");
+
+ // =======================================================================================================================================
+ // Step 7: Holder needs Issuer's Public Key to compute the Signature Proof of Knowledge and construct the Presentation
+ // JPT.
+ // =======================================================================================================================================
+
+ // Construct a JPT(JWP in the Presentation form) representing the Selectively Disclosed Verifiable Credential
+ const presentationOptions = new JwpPresentationOptions();
+ presentationOptions.nonce = challenge;
+ const presentationJpt = await issuerDoc
+ .createPresentationJpt(
+ selectiveDisclosurePresentation,
+ methodId,
+ presentationOptions,
+ );
+
+ // ===========================================================================
+ // Step 8: Holder sends a Presentation JPT to the Verifier.
+ // ===========================================================================
+
+ console.log("Sending presentation (as JPT) to the verifier: " + presentationJpt.toString());
+
+ // ===========================================================================
+ // Step 9: Verifier receives the Presentation and verifies it.
+ // ===========================================================================
+
+ // Verifier resolve Issuer DID
+ const issuerDidV = IotaDID.parse(
+ JptPresentationValidatorUtils.extractIssuerFromPresentedJpt(presentationJpt).toString(),
+ );
+ const issuerDocV = await identityClient.resolveDid(issuerDidV);
+
+ const presentationValidationOptions = new JptPresentationValidationOptions({ nonce: challenge });
+ const decodedPresentedCredential = JptPresentationValidator.validate(
+ presentationJpt,
+ issuerDocV,
+ presentationValidationOptions,
+ FailFast.FirstError,
+ );
+
+ console.log("Presented credential successfully validated: " + decodedPresentedCredential.credential());
+}
diff --git a/bindings/wasm/examples/src/1_advanced/9_zkp_revocation.ts b/bindings/wasm/examples/src/1_advanced/9_zkp_revocation.ts
new file mode 100644
index 0000000000..e8c3d586a1
--- /dev/null
+++ b/bindings/wasm/examples/src/1_advanced/9_zkp_revocation.ts
@@ -0,0 +1,281 @@
+import {
+ Credential,
+ Duration,
+ FailFast,
+ IotaDID,
+ IotaDocument,
+ IotaIdentityClient,
+ JptCredentialValidationOptions,
+ JptCredentialValidator,
+ JptCredentialValidatorUtils,
+ JptPresentationValidationOptions,
+ JptPresentationValidator,
+ JptPresentationValidatorUtils,
+ JwkMemStore,
+ JwpCredentialOptions,
+ JwpPresentationOptions,
+ KeyIdMemStore,
+ MethodScope,
+ ProofAlgorithm,
+ RevocationBitmap,
+ RevocationTimeframeStatus,
+ SelectiveDisclosurePresentation,
+ Status,
+ StatusCheck,
+ Storage,
+ Timestamp,
+} from "@iota/identity-wasm/node";
+import {
+ type Address,
+ AliasOutput,
+ Client,
+ MnemonicSecretManager,
+ SecretManager,
+ SecretManagerType,
+ Utils,
+} from "@iota/sdk-wasm/node";
+import { API_ENDPOINT, ensureAddressHasFunds } from "../util";
+
+/** Creates a DID Document and publishes it in a new Alias Output.
+
+Its functionality is equivalent to the "create DID" example
+and exists for convenient calling from the other examples. */
+export async function createDid(client: Client, secretManager: SecretManagerType, storage: Storage): Promise<{
+ address: Address;
+ document: IotaDocument;
+ fragment: string;
+}> {
+ const didClient = new IotaIdentityClient(client);
+ const networkHrp: string = await didClient.getNetworkHrp();
+
+ const secretManagerInstance = new SecretManager(secretManager);
+ const walletAddressBech32 = (await secretManagerInstance.generateEd25519Addresses({
+ accountIndex: 0,
+ range: {
+ start: 0,
+ end: 1,
+ },
+ bech32Hrp: networkHrp,
+ }))[0];
+
+ console.log("Wallet address Bech32:", walletAddressBech32);
+
+ await ensureAddressHasFunds(client, walletAddressBech32);
+
+ const address: Address = Utils.parseBech32Address(walletAddressBech32);
+
+ // Create a new DID document with a placeholder DID.
+ // The DID will be derived from the Alias Id of the Alias Output after publishing.
+ const document = new IotaDocument(networkHrp);
+
+ const fragment = await document.generateMethodJwp(
+ storage,
+ ProofAlgorithm.BLS12381_SHA256,
+ undefined,
+ MethodScope.VerificationMethod(),
+ );
+ const revocationBitmap = new RevocationBitmap();
+ const serviceId = document.id().toUrl().join("#my-revocation-service");
+ const service = revocationBitmap.toService(serviceId);
+
+ document.insertService(service);
+ // Construct an Alias Output containing the DID document, with the wallet address
+ // set as both the state controller and governor.
+ const aliasOutput: AliasOutput = await didClient.newDidOutput(address, document);
+
+ // Publish the Alias Output and get the published DID document.
+ const published = await didClient.publishDidOutput(secretManager, aliasOutput);
+
+ return { address, document: published, fragment };
+}
+export async function zkp_revocation() {
+ // Create a new client to interact with the IOTA ledger.
+ const client = new Client({
+ primaryNode: API_ENDPOINT,
+ localPow: true,
+ });
+
+ // Creates a new wallet and identity (see "0_create_did" example).
+ const issuerSecretManager: MnemonicSecretManager = {
+ mnemonic: Utils.generateMnemonic(),
+ };
+ const issuerStorage: Storage = new Storage(
+ new JwkMemStore(),
+ new KeyIdMemStore(),
+ );
+ let { document: issuerDocument, fragment: issuerFragment } = await createDid(
+ client,
+ issuerSecretManager,
+ issuerStorage,
+ );
+ const holderSecretManager: MnemonicSecretManager = {
+ mnemonic: Utils.generateMnemonic(),
+ };
+ const holderStorage: Storage = new Storage(
+ new JwkMemStore(),
+ new KeyIdMemStore(),
+ );
+ let { document: holderDocument, fragment: holderFragment } = await createDid(
+ client,
+ holderSecretManager,
+ holderStorage,
+ );
+ // =========================================================================================
+ // Step 1: Create a new RevocationTimeframeStatus containing the current validityTimeframe
+ // =======================================================================================
+
+ const timeframeId = issuerDocument.id().toUrl().join("#my-revocation-service");
+ let revocationTimeframeStatus = new RevocationTimeframeStatus(
+ timeframeId.toString(),
+ 5,
+ Duration.minutes(1),
+ Timestamp.nowUTC(),
+ );
+
+ // Create a credential subject indicating the degree earned by Alice.
+ const subject = {
+ name: "Alice",
+ mainCourses: ["Object-oriented Programming", "Mathematics"],
+ degree: {
+ type: "BachelorDegree",
+ name: "Bachelor of Science and Arts",
+ },
+ GPA: 4.0,
+ };
+
+ // Build credential using the above subject and issuer.
+ const credential = new Credential({
+ id: "https:/example.edu/credentials/3732",
+ issuer: issuerDocument.id(),
+ type: "UniversityDegreeCredential",
+ credentialSubject: subject,
+ credentialStatus: revocationTimeframeStatus as any as Status,
+ });
+ const credentialJpt = await issuerDocument
+ .createCredentialJpt(
+ credential,
+ issuerStorage,
+ issuerFragment,
+ new JwpCredentialOptions(),
+ );
+ // Validate the credential's proof using the issuer's DID Document, the credential's semantic structure,
+ // that the issuance date is not in the future and that the expiration date is not in the past:
+ const decodedJpt = JptCredentialValidator.validate(
+ credentialJpt,
+ issuerDocument,
+ new JptCredentialValidationOptions(),
+ FailFast.FirstError,
+ );
+
+ console.log("Sending credential (as JPT) to the holder: " + credentialJpt.toString());
+
+ // Holder validates the credential and retrieve the JwpIssued, needed to construct the JwpPresented
+ let decodedCredential = JptCredentialValidator.validate(
+ credentialJpt,
+ issuerDocument,
+ new JptCredentialValidationOptions(),
+ FailFast.FirstError,
+ );
+
+ // ===========================================================================
+ // Credential's Status check
+ // ===========================================================================
+ JptCredentialValidatorUtils.checkTimeframesAndRevocationWithValidityTimeframe2024(
+ decodedCredential.credential(),
+ issuerDocument,
+ undefined,
+ StatusCheck.Strict,
+ );
+
+ // A unique random challenge generated by the requester per presentation can mitigate replay attacks.
+ const challenge = "475a7984-1bb5-4c4c-a56f-822bccd46440";
+
+ const methodId = decodedCredential
+ .decodedJwp()
+ .getIssuerProtectedHeader()
+ .kid!;
+
+ const selectiveDisclosurePresentation = new SelectiveDisclosurePresentation(decodedCredential.decodedJwp());
+ selectiveDisclosurePresentation.concealInSubject("mainCourses[1]");
+ selectiveDisclosurePresentation.concealInSubject("degree.name");
+
+ // Construct a JPT(JWP in the Presentation form) representing the Selectively Disclosed Verifiable Credential
+ const presentationOptions = new JwpPresentationOptions();
+ presentationOptions.nonce = challenge;
+ const presentationJpt = await issuerDocument
+ .createPresentationJpt(
+ selectiveDisclosurePresentation,
+ methodId,
+ presentationOptions,
+ );
+
+ console.log("Sending presentation (as JPT) to the verifier: " + presentationJpt.toString());
+
+ // ===========================================================================
+ // Step 2: Verifier receives the Presentation and verifies it.
+ // ===========================================================================
+
+ const presentationValidationOptions = new JptPresentationValidationOptions({ nonce: challenge });
+ const decodedPresentedCredential = JptPresentationValidator.validate(
+ presentationJpt,
+ issuerDocument,
+ presentationValidationOptions,
+ FailFast.FirstError,
+ );
+
+ JptPresentationValidatorUtils.checkTimeframesWithValidityTimeframe2024(
+ decodedPresentedCredential.credential(),
+ undefined,
+ StatusCheck.Strict,
+ );
+
+ console.log("Presented credential successfully validated: " + decodedPresentedCredential.credential());
+
+ // ===========================================================================
+ // Step 2b: Waiting for the next validityTimeframe, will result in the Credential timeframe interval NOT valid
+ // ===========================================================================
+
+ try {
+ const now = new Date();
+ const timeInTwoMinutes = new Date(now.setMinutes(now.getMinutes() + 2));
+ JptPresentationValidatorUtils.checkTimeframesWithValidityTimeframe2024(
+ decodedPresentedCredential.credential(),
+ Timestamp.parse(timeInTwoMinutes.toISOString()),
+ StatusCheck.Strict,
+ );
+ } catch (_) {
+ console.log("successfully expired!");
+ }
+
+ // ===========================================================================
+ // Issuer decides to Revoke Holder's Credential
+ // ===========================================================================
+
+ console.log("Issuer decides to revoke the Credential");
+
+ const identityClient = new IotaIdentityClient(client);
+
+ // Update the RevocationBitmap service in the issuer's DID Document.
+ // This revokes the credential's unique index.
+ issuerDocument.revokeCredentials("my-revocation-service", 5);
+ let aliasOutput = await identityClient.updateDidOutput(issuerDocument);
+ const rent = await identityClient.getRentStructure();
+ aliasOutput = await client.buildAliasOutput({
+ ...aliasOutput,
+ amount: Utils.computeStorageDeposit(aliasOutput, rent),
+ aliasId: aliasOutput.getAliasId(),
+ unlockConditions: aliasOutput.getUnlockConditions(),
+ });
+ issuerDocument = await identityClient.publishDidOutput(issuerSecretManager, aliasOutput);
+
+ // Holder checks if his credential has been revoked by the Issuer
+ try {
+ JptCredentialValidatorUtils.checkRevocationWithValidityTimeframe2024(
+ decodedCredential.credential(),
+ issuerDocument,
+ StatusCheck.Strict,
+ );
+ } catch (_) {
+ console.log("Credential revoked!");
+ }
+}
diff --git a/bindings/wasm/examples/src/main.ts b/bindings/wasm/examples/src/main.ts
index 145980e649..0a074d3fd2 100644
--- a/bindings/wasm/examples/src/main.ts
+++ b/bindings/wasm/examples/src/main.ts
@@ -17,6 +17,8 @@ import { customResolution } from "./1_advanced/4_custom_resolution";
import { domainLinkage } from "./1_advanced/5_domain_linkage";
import { sdJwt } from "./1_advanced/6_sd_jwt";
import { statusList2021 } from "./1_advanced/7_status_list_2021";
+import { zkp } from "./1_advanced/8_zkp";
+import { zkp_revocation } from "./1_advanced/9_zkp_revocation";
async function main() {
// Extract example name.
@@ -58,6 +60,10 @@ async function main() {
return await sdJwt();
case "7_status_list_2021":
return await statusList2021();
+ case "8_zkp":
+ return await zkp();
+ case "9_zkp_revocation":
+ return await zkp_revocation();
default:
throw "Unknown example name: '" + argument + "'";
}
diff --git a/bindings/wasm/examples/src/tests/8_zkp.ts b/bindings/wasm/examples/src/tests/8_zkp.ts
new file mode 100644
index 0000000000..52d5b72bc4
--- /dev/null
+++ b/bindings/wasm/examples/src/tests/8_zkp.ts
@@ -0,0 +1,8 @@
+import { zkp } from "../1_advanced/8_zkp";
+
+// Only verifies that no uncaught exceptions are thrown, including syntax errors etc.
+describe("Test node examples", function() {
+ it("zkp", async () => {
+ await zkp();
+ });
+});
diff --git a/bindings/wasm/examples/src/tests/9_zkp_revocation.ts b/bindings/wasm/examples/src/tests/9_zkp_revocation.ts
new file mode 100644
index 0000000000..96075765f3
--- /dev/null
+++ b/bindings/wasm/examples/src/tests/9_zkp_revocation.ts
@@ -0,0 +1,8 @@
+import { zkp_revocation } from "../1_advanced/9_zkp_revocation";
+
+// Only verifies that no uncaught exceptions are thrown, including syntax errors etc.
+describe("Test node examples", function() {
+ it("zkp_revocation", async () => {
+ await zkp_revocation();
+ });
+});
diff --git a/bindings/wasm/lib/jwk_storage.ts b/bindings/wasm/lib/jwk_storage.ts
index 2c1156e5ac..235abcc8ce 100644
--- a/bindings/wasm/lib/jwk_storage.ts
+++ b/bindings/wasm/lib/jwk_storage.ts
@@ -1,5 +1,5 @@
import * as ed from "@noble/ed25519";
-import { decodeB64, encodeB64, Jwk, JwkGenOutput, JwkStorage } from "~identity_wasm";
+import { decodeB64, encodeB64, Jwk, JwkGenOutput, JwkStorage, ProofAlgorithm, ProofUpdateCtx } from "~identity_wasm";
import { EdCurve, JwkType, JwsAlgorithm } from "./jose";
type Ed25519PrivateKey = Uint8Array;
@@ -18,6 +18,10 @@ export class JwkMemStore implements JwkStorage {
return "Ed25519";
}
+ private _get_key(keyId: string): Jwk | undefined {
+ return this._keys.get(keyId);
+ }
+
public async generate(keyType: string, algorithm: JwsAlgorithm): Promise