From 216a341b7f51f7eeec53f254aaa236ce8e717d5b Mon Sep 17 00:00:00 2001 From: Jelle Femmo Millenaar Date: Mon, 1 Nov 2021 09:58:18 +0100 Subject: [PATCH] Clean up previous didcomm impl (#470) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Removed messages from the wasm bindings * Revert "Removed messages from the wasm bindings" This reverts commit e66cf82f49a7e698b5140e0270cc6c9a292848a1. * cleaned up identity-comm/src/messages and identity-comm/src/tests (#467) * deleted bindings/wasm/src/message (#468) * build api-reference Co-authored-by: Oliver Anderson Co-authored-by: Eike Haß --- bindings/wasm/docs/api-reference.md | 636 ------------------ bindings/wasm/src/lib.rs | 1 - bindings/wasm/src/message/authentication.rs | 41 -- .../wasm/src/message/credential_issuance.rs | 41 -- .../wasm/src/message/credential_options.rs | 41 -- .../wasm/src/message/credential_revocation.rs | 24 - .../wasm/src/message/credential_schema.rs | 2 - bindings/wasm/src/message/did_discovery.rs | 41 -- bindings/wasm/src/message/did_introduction.rs | 58 -- bindings/wasm/src/message/did_resolution.rs | 41 -- .../wasm/src/message/features_discovery.rs | 41 -- bindings/wasm/src/message/mod.rs | 28 - .../src/message/presentation_verification.rs | 58 -- bindings/wasm/src/message/timing.rs | 85 --- bindings/wasm/src/message/trust_ping.rs | 24 - identity-comm/src/lib.rs | 3 - identity-comm/src/message/macros.rs | 37 - identity-comm/src/message/mod.rs | 9 - identity-comm/src/message/report.rs | 41 -- identity-comm/src/message/timing.rs | 122 ---- .../src/message/types/authentication.rs | 91 --- .../src/message/types/credential_issuance.rs | 91 --- .../src/message/types/credential_options.rs | 88 --- .../message/types/credential_revocation.rs | 54 -- .../src/message/types/credential_schema.rs | 91 --- .../src/message/types/did_discovery.rs | 83 --- .../src/message/types/did_introduction.rs | 140 ---- .../src/message/types/did_resolution.rs | 85 --- .../src/message/types/features_discovery.rs | 80 --- identity-comm/src/message/types/mod.rs | 27 - .../types/presentation_verification.rs | 114 ---- identity-comm/src/message/types/trust_ping.rs | 48 -- identity-comm/tests/message_authentication.rs | 94 --- identity-comm/tests/message_did_resolution.rs | 129 ---- .../tests/message_features_discovery.rs | 127 ---- identity-comm/tests/message_trust_ping.rs | 79 --- identity/src/lib.rs | 1 - 37 files changed, 2796 deletions(-) delete mode 100644 bindings/wasm/src/message/authentication.rs delete mode 100644 bindings/wasm/src/message/credential_issuance.rs delete mode 100644 bindings/wasm/src/message/credential_options.rs delete mode 100644 bindings/wasm/src/message/credential_revocation.rs delete mode 100644 bindings/wasm/src/message/credential_schema.rs delete mode 100644 bindings/wasm/src/message/did_discovery.rs delete mode 100644 bindings/wasm/src/message/did_introduction.rs delete mode 100644 bindings/wasm/src/message/did_resolution.rs delete mode 100644 bindings/wasm/src/message/features_discovery.rs delete mode 100644 bindings/wasm/src/message/mod.rs delete mode 100644 bindings/wasm/src/message/presentation_verification.rs delete mode 100644 bindings/wasm/src/message/timing.rs delete mode 100644 bindings/wasm/src/message/trust_ping.rs delete mode 100644 identity-comm/src/message/macros.rs delete mode 100644 identity-comm/src/message/report.rs delete mode 100644 identity-comm/src/message/timing.rs delete mode 100644 identity-comm/src/message/types/authentication.rs delete mode 100644 identity-comm/src/message/types/credential_issuance.rs delete mode 100644 identity-comm/src/message/types/credential_options.rs delete mode 100644 identity-comm/src/message/types/credential_revocation.rs delete mode 100644 identity-comm/src/message/types/credential_schema.rs delete mode 100644 identity-comm/src/message/types/did_discovery.rs delete mode 100644 identity-comm/src/message/types/did_introduction.rs delete mode 100644 identity-comm/src/message/types/did_resolution.rs delete mode 100644 identity-comm/src/message/types/features_discovery.rs delete mode 100644 identity-comm/src/message/types/mod.rs delete mode 100644 identity-comm/src/message/types/presentation_verification.rs delete mode 100644 identity-comm/src/message/types/trust_ping.rs delete mode 100644 identity-comm/tests/message_authentication.rs delete mode 100644 identity-comm/tests/message_did_resolution.rs delete mode 100644 identity-comm/tests/message_features_discovery.rs delete mode 100644 identity-comm/tests/message_trust_ping.rs diff --git a/bindings/wasm/docs/api-reference.md b/bindings/wasm/docs/api-reference.md index 094ce3d964..d1a8a9de1b 100644 --- a/bindings/wasm/docs/api-reference.md +++ b/bindings/wasm/docs/api-reference.md @@ -1,32 +1,14 @@ ## Classes
-
AuthenticationRequest
-
-
AuthenticationResponse
-
Client
Config
-
CredentialIssuance
-
-
CredentialOptionRequest
-
-
CredentialOptionResponse
-
-
CredentialRevocation
-
-
CredentialSelection
-
DID
DIDUrl
-
DidRequest
-
-
DidResponse
-
DiffChainHistory
Document
@@ -37,42 +19,18 @@
DocumentHistory

A DID Document's history and current state.

-
FeaturesRequest
-
-
FeaturesResponse
-
IntegrationChainHistory
-
Introduction
-
-
IntroductionProposal
-
-
IntroductionResponse
-
KeyCollection
KeyPair
Network
-
PresentationRequest
-
-
PresentationResponse
-
-
ResolutionRequest
-
-
ResolutionResponse
-
Service
Timestamp
-
Timing
-
-
TrustPing
-
-
TrustedIssuer
-
VerifiableCredential
VerifiablePresentation
@@ -98,54 +56,6 @@
- - -## AuthenticationRequest -**Kind**: global class - -* [AuthenticationRequest](#AuthenticationRequest) - * _instance_ - * [.toJSON()](#AuthenticationRequest+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#AuthenticationRequest.fromJSON) ⇒ [AuthenticationRequest](#AuthenticationRequest) - - - -### authenticationRequest.toJSON() ⇒ any -**Kind**: instance method of [AuthenticationRequest](#AuthenticationRequest) - - -### AuthenticationRequest.fromJSON(value) ⇒ [AuthenticationRequest](#AuthenticationRequest) -**Kind**: static method of [AuthenticationRequest](#AuthenticationRequest) - -| Param | Type | -| --- | --- | -| value | any | - - - -## AuthenticationResponse -**Kind**: global class - -* [AuthenticationResponse](#AuthenticationResponse) - * _instance_ - * [.toJSON()](#AuthenticationResponse+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#AuthenticationResponse.fromJSON) ⇒ [AuthenticationResponse](#AuthenticationResponse) - - - -### authenticationResponse.toJSON() ⇒ any -**Kind**: instance method of [AuthenticationResponse](#AuthenticationResponse) - - -### AuthenticationResponse.fromJSON(value) ⇒ [AuthenticationResponse](#AuthenticationResponse) -**Kind**: static method of [AuthenticationResponse](#AuthenticationResponse) - -| Param | Type | -| --- | --- | -| value | any | - ## Client @@ -458,126 +368,6 @@ Creates a new `Client` with default settings for the given `Network`. | --- | --- | | network | [Network](#Network) | - - -## CredentialIssuance -**Kind**: global class - -* [CredentialIssuance](#CredentialIssuance) - * _instance_ - * [.toJSON()](#CredentialIssuance+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#CredentialIssuance.fromJSON) ⇒ [CredentialIssuance](#CredentialIssuance) - - - -### credentialIssuance.toJSON() ⇒ any -**Kind**: instance method of [CredentialIssuance](#CredentialIssuance) - - -### CredentialIssuance.fromJSON(value) ⇒ [CredentialIssuance](#CredentialIssuance) -**Kind**: static method of [CredentialIssuance](#CredentialIssuance) - -| Param | Type | -| --- | --- | -| value | any | - - - -## CredentialOptionRequest -**Kind**: global class - -* [CredentialOptionRequest](#CredentialOptionRequest) - * _instance_ - * [.toJSON()](#CredentialOptionRequest+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#CredentialOptionRequest.fromJSON) ⇒ [CredentialOptionRequest](#CredentialOptionRequest) - - - -### credentialOptionRequest.toJSON() ⇒ any -**Kind**: instance method of [CredentialOptionRequest](#CredentialOptionRequest) - - -### CredentialOptionRequest.fromJSON(value) ⇒ [CredentialOptionRequest](#CredentialOptionRequest) -**Kind**: static method of [CredentialOptionRequest](#CredentialOptionRequest) - -| Param | Type | -| --- | --- | -| value | any | - - - -## CredentialOptionResponse -**Kind**: global class - -* [CredentialOptionResponse](#CredentialOptionResponse) - * _instance_ - * [.toJSON()](#CredentialOptionResponse+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#CredentialOptionResponse.fromJSON) ⇒ [CredentialOptionResponse](#CredentialOptionResponse) - - - -### credentialOptionResponse.toJSON() ⇒ any -**Kind**: instance method of [CredentialOptionResponse](#CredentialOptionResponse) - - -### CredentialOptionResponse.fromJSON(value) ⇒ [CredentialOptionResponse](#CredentialOptionResponse) -**Kind**: static method of [CredentialOptionResponse](#CredentialOptionResponse) - -| Param | Type | -| --- | --- | -| value | any | - - - -## CredentialRevocation -**Kind**: global class - -* [CredentialRevocation](#CredentialRevocation) - * _instance_ - * [.toJSON()](#CredentialRevocation+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#CredentialRevocation.fromJSON) ⇒ [CredentialRevocation](#CredentialRevocation) - - - -### credentialRevocation.toJSON() ⇒ any -**Kind**: instance method of [CredentialRevocation](#CredentialRevocation) - - -### CredentialRevocation.fromJSON(value) ⇒ [CredentialRevocation](#CredentialRevocation) -**Kind**: static method of [CredentialRevocation](#CredentialRevocation) - -| Param | Type | -| --- | --- | -| value | any | - - - -## CredentialSelection -**Kind**: global class - -* [CredentialSelection](#CredentialSelection) - * _instance_ - * [.toJSON()](#CredentialSelection+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#CredentialSelection.fromJSON) ⇒ [CredentialSelection](#CredentialSelection) - - - -### credentialSelection.toJSON() ⇒ any -**Kind**: instance method of [CredentialSelection](#CredentialSelection) - - -### CredentialSelection.fromJSON(value) ⇒ [CredentialSelection](#CredentialSelection) -**Kind**: static method of [CredentialSelection](#CredentialSelection) - -| Param | Type | -| --- | --- | -| value | any | - ## DID @@ -799,54 +589,6 @@ Parses a `DIDUrl` from the input string. | --- | --- | | input | string | - - -## DidRequest -**Kind**: global class - -* [DidRequest](#DidRequest) - * _instance_ - * [.toJSON()](#DidRequest+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#DidRequest.fromJSON) ⇒ [DidRequest](#DidRequest) - - - -### didRequest.toJSON() ⇒ any -**Kind**: instance method of [DidRequest](#DidRequest) - - -### DidRequest.fromJSON(value) ⇒ [DidRequest](#DidRequest) -**Kind**: static method of [DidRequest](#DidRequest) - -| Param | Type | -| --- | --- | -| value | any | - - - -## DidResponse -**Kind**: global class - -* [DidResponse](#DidResponse) - * _instance_ - * [.toJSON()](#DidResponse+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#DidResponse.fromJSON) ⇒ [DidResponse](#DidResponse) - - - -### didResponse.toJSON() ⇒ any -**Kind**: instance method of [DidResponse](#DidResponse) - - -### DidResponse.fromJSON(value) ⇒ [DidResponse](#DidResponse) -**Kind**: static method of [DidResponse](#DidResponse) - -| Param | Type | -| --- | --- | -| value | any | - ## DiffChainHistory @@ -1408,54 +1150,6 @@ Deserializes a [`WasmDocumentHistory`] object from a JSON object. | --- | --- | | json | any | - - -## FeaturesRequest -**Kind**: global class - -* [FeaturesRequest](#FeaturesRequest) - * _instance_ - * [.toJSON()](#FeaturesRequest+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#FeaturesRequest.fromJSON) ⇒ [FeaturesRequest](#FeaturesRequest) - - - -### featuresRequest.toJSON() ⇒ any -**Kind**: instance method of [FeaturesRequest](#FeaturesRequest) - - -### FeaturesRequest.fromJSON(value) ⇒ [FeaturesRequest](#FeaturesRequest) -**Kind**: static method of [FeaturesRequest](#FeaturesRequest) - -| Param | Type | -| --- | --- | -| value | any | - - - -## FeaturesResponse -**Kind**: global class - -* [FeaturesResponse](#FeaturesResponse) - * _instance_ - * [.toJSON()](#FeaturesResponse+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#FeaturesResponse.fromJSON) ⇒ [FeaturesResponse](#FeaturesResponse) - - - -### featuresResponse.toJSON() ⇒ any -**Kind**: instance method of [FeaturesResponse](#FeaturesResponse) - - -### FeaturesResponse.fromJSON(value) ⇒ [FeaturesResponse](#FeaturesResponse) -**Kind**: static method of [FeaturesResponse](#FeaturesResponse) - -| Param | Type | -| --- | --- | -| value | any | - ## IntegrationChainHistory @@ -1502,78 +1196,6 @@ Deserializes a `$ident` object from a JSON object. | --- | --- | | json | any | - - -## Introduction -**Kind**: global class - -* [Introduction](#Introduction) - * _instance_ - * [.toJSON()](#Introduction+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#Introduction.fromJSON) ⇒ [Introduction](#Introduction) - - - -### introduction.toJSON() ⇒ any -**Kind**: instance method of [Introduction](#Introduction) - - -### Introduction.fromJSON(value) ⇒ [Introduction](#Introduction) -**Kind**: static method of [Introduction](#Introduction) - -| Param | Type | -| --- | --- | -| value | any | - - - -## IntroductionProposal -**Kind**: global class - -* [IntroductionProposal](#IntroductionProposal) - * _instance_ - * [.toJSON()](#IntroductionProposal+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#IntroductionProposal.fromJSON) ⇒ [IntroductionProposal](#IntroductionProposal) - - - -### introductionProposal.toJSON() ⇒ any -**Kind**: instance method of [IntroductionProposal](#IntroductionProposal) - - -### IntroductionProposal.fromJSON(value) ⇒ [IntroductionProposal](#IntroductionProposal) -**Kind**: static method of [IntroductionProposal](#IntroductionProposal) - -| Param | Type | -| --- | --- | -| value | any | - - - -## IntroductionResponse -**Kind**: global class - -* [IntroductionResponse](#IntroductionResponse) - * _instance_ - * [.toJSON()](#IntroductionResponse+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#IntroductionResponse.fromJSON) ⇒ [IntroductionResponse](#IntroductionResponse) - - - -### introductionResponse.toJSON() ⇒ any -**Kind**: instance method of [IntroductionResponse](#IntroductionResponse) - - -### IntroductionResponse.fromJSON(value) ⇒ [IntroductionResponse](#IntroductionResponse) -**Kind**: static method of [IntroductionResponse](#IntroductionResponse) - -| Param | Type | -| --- | --- | -| value | any | - ## KeyCollection @@ -1814,102 +1436,6 @@ Parses the provided string to a [`WasmNetwork`]. ### Network.devnet() ⇒ [Network](#Network) **Kind**: static method of [Network](#Network) - - -## PresentationRequest -**Kind**: global class - -* [PresentationRequest](#PresentationRequest) - * _instance_ - * [.toJSON()](#PresentationRequest+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#PresentationRequest.fromJSON) ⇒ [PresentationRequest](#PresentationRequest) - - - -### presentationRequest.toJSON() ⇒ any -**Kind**: instance method of [PresentationRequest](#PresentationRequest) - - -### PresentationRequest.fromJSON(value) ⇒ [PresentationRequest](#PresentationRequest) -**Kind**: static method of [PresentationRequest](#PresentationRequest) - -| Param | Type | -| --- | --- | -| value | any | - - - -## PresentationResponse -**Kind**: global class - -* [PresentationResponse](#PresentationResponse) - * _instance_ - * [.toJSON()](#PresentationResponse+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#PresentationResponse.fromJSON) ⇒ [PresentationResponse](#PresentationResponse) - - - -### presentationResponse.toJSON() ⇒ any -**Kind**: instance method of [PresentationResponse](#PresentationResponse) - - -### PresentationResponse.fromJSON(value) ⇒ [PresentationResponse](#PresentationResponse) -**Kind**: static method of [PresentationResponse](#PresentationResponse) - -| Param | Type | -| --- | --- | -| value | any | - - - -## ResolutionRequest -**Kind**: global class - -* [ResolutionRequest](#ResolutionRequest) - * _instance_ - * [.toJSON()](#ResolutionRequest+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#ResolutionRequest.fromJSON) ⇒ [ResolutionRequest](#ResolutionRequest) - - - -### resolutionRequest.toJSON() ⇒ any -**Kind**: instance method of [ResolutionRequest](#ResolutionRequest) - - -### ResolutionRequest.fromJSON(value) ⇒ [ResolutionRequest](#ResolutionRequest) -**Kind**: static method of [ResolutionRequest](#ResolutionRequest) - -| Param | Type | -| --- | --- | -| value | any | - - - -## ResolutionResponse -**Kind**: global class - -* [ResolutionResponse](#ResolutionResponse) - * _instance_ - * [.toJSON()](#ResolutionResponse+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#ResolutionResponse.fromJSON) ⇒ [ResolutionResponse](#ResolutionResponse) - - - -### resolutionResponse.toJSON() ⇒ any -**Kind**: instance method of [ResolutionResponse](#ResolutionResponse) - - -### ResolutionResponse.fromJSON(value) ⇒ [ResolutionResponse](#ResolutionResponse) -**Kind**: static method of [ResolutionResponse](#ResolutionResponse) - -| Param | Type | -| --- | --- | -| value | any | - ## Service @@ -1973,168 +1499,6 @@ Parses a `Timestamp` from the provided input string. Creates a new `Timestamp` with the current date and time. **Kind**: static method of [Timestamp](#Timestamp) - - -## Timing -**Kind**: global class - -* [Timing](#Timing) - * _instance_ - * [.outTime](#Timing+outTime) ⇒ string \| undefined - * [.outTime](#Timing+outTime) - * [.inTime](#Timing+inTime) ⇒ string \| undefined - * [.inTime](#Timing+inTime) - * [.staleTime](#Timing+staleTime) ⇒ string \| undefined - * [.staleTime](#Timing+staleTime) - * [.expiresTime](#Timing+expiresTime) ⇒ string \| undefined - * [.expiresTime](#Timing+expiresTime) - * [.waitUntilTime](#Timing+waitUntilTime) ⇒ string \| undefined - * [.waitUntilTime](#Timing+waitUntilTime) - * [.delayMilli](#Timing+delayMilli) ⇒ number \| undefined - * [.delayMilli](#Timing+delayMilli) - * [.toJSON()](#Timing+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#Timing.fromJSON) ⇒ [Timing](#Timing) - - - -### timing.outTime ⇒ string \| undefined -**Kind**: instance property of [Timing](#Timing) - - -### timing.outTime -**Kind**: instance property of [Timing](#Timing) - -| Param | Type | -| --- | --- | -| value | string | - - - -### timing.inTime ⇒ string \| undefined -**Kind**: instance property of [Timing](#Timing) - - -### timing.inTime -**Kind**: instance property of [Timing](#Timing) - -| Param | Type | -| --- | --- | -| value | string | - - - -### timing.staleTime ⇒ string \| undefined -**Kind**: instance property of [Timing](#Timing) - - -### timing.staleTime -**Kind**: instance property of [Timing](#Timing) - -| Param | Type | -| --- | --- | -| value | string | - - - -### timing.expiresTime ⇒ string \| undefined -**Kind**: instance property of [Timing](#Timing) - - -### timing.expiresTime -**Kind**: instance property of [Timing](#Timing) - -| Param | Type | -| --- | --- | -| value | string | - - - -### timing.waitUntilTime ⇒ string \| undefined -**Kind**: instance property of [Timing](#Timing) - - -### timing.waitUntilTime -**Kind**: instance property of [Timing](#Timing) - -| Param | Type | -| --- | --- | -| value | string | - - - -### timing.delayMilli ⇒ number \| undefined -**Kind**: instance property of [Timing](#Timing) - - -### timing.delayMilli -**Kind**: instance property of [Timing](#Timing) - -| Param | Type | -| --- | --- | -| value | number | - - - -### timing.toJSON() ⇒ any -**Kind**: instance method of [Timing](#Timing) - - -### Timing.fromJSON(value) ⇒ [Timing](#Timing) -**Kind**: static method of [Timing](#Timing) - -| Param | Type | -| --- | --- | -| value | any | - - - -## TrustPing -**Kind**: global class - -* [TrustPing](#TrustPing) - * _instance_ - * [.toJSON()](#TrustPing+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#TrustPing.fromJSON) ⇒ [TrustPing](#TrustPing) - - - -### trustPing.toJSON() ⇒ any -**Kind**: instance method of [TrustPing](#TrustPing) - - -### TrustPing.fromJSON(value) ⇒ [TrustPing](#TrustPing) -**Kind**: static method of [TrustPing](#TrustPing) - -| Param | Type | -| --- | --- | -| value | any | - - - -## TrustedIssuer -**Kind**: global class - -* [TrustedIssuer](#TrustedIssuer) - * _instance_ - * [.toJSON()](#TrustedIssuer+toJSON) ⇒ any - * _static_ - * [.fromJSON(value)](#TrustedIssuer.fromJSON) ⇒ [TrustedIssuer](#TrustedIssuer) - - - -### trustedIssuer.toJSON() ⇒ any -**Kind**: instance method of [TrustedIssuer](#TrustedIssuer) - - -### TrustedIssuer.fromJSON(value) ⇒ [TrustedIssuer](#TrustedIssuer) -**Kind**: static method of [TrustedIssuer](#TrustedIssuer) - -| Param | Type | -| --- | --- | -| value | any | - ## VerifiableCredential diff --git a/bindings/wasm/src/lib.rs b/bindings/wasm/src/lib.rs index 422fcde305..352156d514 100644 --- a/bindings/wasm/src/lib.rs +++ b/bindings/wasm/src/lib.rs @@ -19,7 +19,6 @@ pub mod common; pub mod credential; pub mod crypto; pub mod did; -pub mod message; pub mod service; pub mod tangle; diff --git a/bindings/wasm/src/message/authentication.rs b/bindings/wasm/src/message/authentication.rs deleted file mode 100644 index 7b0cb11339..0000000000 --- a/bindings/wasm/src/message/authentication.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity::comm; -use wasm_bindgen::prelude::*; - -use crate::error::wasm_error; - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct AuthenticationRequest(pub(crate) comm::AuthenticationRequest); - -#[wasm_bindgen] -impl AuthenticationRequest { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct AuthenticationResponse(pub(crate) comm::AuthenticationResponse); - -#[wasm_bindgen] -impl AuthenticationResponse { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} diff --git a/bindings/wasm/src/message/credential_issuance.rs b/bindings/wasm/src/message/credential_issuance.rs deleted file mode 100644 index e4acb1a324..0000000000 --- a/bindings/wasm/src/message/credential_issuance.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity::comm; -use wasm_bindgen::prelude::*; - -use crate::error::wasm_error; - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct CredentialSelection(pub(crate) comm::CredentialSelection); - -#[wasm_bindgen] -impl CredentialSelection { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct CredentialIssuance(pub(crate) comm::CredentialIssuance); - -#[wasm_bindgen] -impl CredentialIssuance { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} diff --git a/bindings/wasm/src/message/credential_options.rs b/bindings/wasm/src/message/credential_options.rs deleted file mode 100644 index 46ce617715..0000000000 --- a/bindings/wasm/src/message/credential_options.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity::comm; -use wasm_bindgen::prelude::*; - -use crate::error::wasm_error; - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct CredentialOptionRequest(pub(crate) comm::CredentialOptionRequest); - -#[wasm_bindgen] -impl CredentialOptionRequest { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct CredentialOptionResponse(pub(crate) comm::CredentialOptionResponse); - -#[wasm_bindgen] -impl CredentialOptionResponse { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} diff --git a/bindings/wasm/src/message/credential_revocation.rs b/bindings/wasm/src/message/credential_revocation.rs deleted file mode 100644 index b1a80a80b1..0000000000 --- a/bindings/wasm/src/message/credential_revocation.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity::comm; -use wasm_bindgen::prelude::*; - -use crate::error::wasm_error; - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct CredentialRevocation(pub(crate) comm::CredentialRevocation); - -#[wasm_bindgen] -impl CredentialRevocation { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} diff --git a/bindings/wasm/src/message/credential_schema.rs b/bindings/wasm/src/message/credential_schema.rs deleted file mode 100644 index 06e6da804b..0000000000 --- a/bindings/wasm/src/message/credential_schema.rs +++ /dev/null @@ -1,2 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 diff --git a/bindings/wasm/src/message/did_discovery.rs b/bindings/wasm/src/message/did_discovery.rs deleted file mode 100644 index eedd0b3be1..0000000000 --- a/bindings/wasm/src/message/did_discovery.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity::comm; -use wasm_bindgen::prelude::*; - -use crate::error::wasm_error; - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct DidRequest(pub(crate) comm::DidRequest); - -#[wasm_bindgen] -impl DidRequest { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct DidResponse(pub(crate) comm::DidResponse); - -#[wasm_bindgen] -impl DidResponse { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} diff --git a/bindings/wasm/src/message/did_introduction.rs b/bindings/wasm/src/message/did_introduction.rs deleted file mode 100644 index 4809910d1e..0000000000 --- a/bindings/wasm/src/message/did_introduction.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity::comm; -use wasm_bindgen::prelude::*; - -use crate::error::wasm_error; - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct IntroductionProposal(pub(crate) comm::IntroductionProposal); - -#[wasm_bindgen] -impl IntroductionProposal { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct IntroductionResponse(pub(crate) comm::IntroductionResponse); - -#[wasm_bindgen] -impl IntroductionResponse { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct Introduction(pub(crate) comm::Introduction); - -#[wasm_bindgen] -impl Introduction { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} diff --git a/bindings/wasm/src/message/did_resolution.rs b/bindings/wasm/src/message/did_resolution.rs deleted file mode 100644 index 10ba23c05f..0000000000 --- a/bindings/wasm/src/message/did_resolution.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity::comm; -use wasm_bindgen::prelude::*; - -use crate::error::wasm_error; - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct ResolutionRequest(pub(crate) comm::ResolutionRequest); - -#[wasm_bindgen] -impl ResolutionRequest { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct ResolutionResponse(pub(crate) comm::ResolutionResponse); - -#[wasm_bindgen] -impl ResolutionResponse { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} diff --git a/bindings/wasm/src/message/features_discovery.rs b/bindings/wasm/src/message/features_discovery.rs deleted file mode 100644 index 31b5046725..0000000000 --- a/bindings/wasm/src/message/features_discovery.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity::comm; -use wasm_bindgen::prelude::*; - -use crate::error::wasm_error; - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct FeaturesRequest(pub(crate) comm::FeaturesRequest); - -#[wasm_bindgen] -impl FeaturesRequest { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct FeaturesResponse(pub(crate) comm::FeaturesResponse); - -#[wasm_bindgen] -impl FeaturesResponse { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} diff --git a/bindings/wasm/src/message/mod.rs b/bindings/wasm/src/message/mod.rs deleted file mode 100644 index db3b8e0ef8..0000000000 --- a/bindings/wasm/src/message/mod.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -mod authentication; -mod credential_issuance; -mod credential_options; -mod credential_revocation; -mod credential_schema; -mod did_discovery; -mod did_introduction; -mod did_resolution; -mod features_discovery; -mod presentation_verification; -mod timing; -mod trust_ping; - -pub use self::authentication::*; -pub use self::credential_issuance::*; -pub use self::credential_options::*; -pub use self::credential_revocation::*; -pub use self::credential_schema::*; -pub use self::did_discovery::*; -pub use self::did_introduction::*; -pub use self::did_resolution::*; -pub use self::features_discovery::*; -pub use self::presentation_verification::*; -pub use self::timing::*; -pub use self::trust_ping::*; diff --git a/bindings/wasm/src/message/presentation_verification.rs b/bindings/wasm/src/message/presentation_verification.rs deleted file mode 100644 index 387a05b6f0..0000000000 --- a/bindings/wasm/src/message/presentation_verification.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity::comm; -use wasm_bindgen::prelude::*; - -use crate::error::wasm_error; - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct PresentationRequest(pub(crate) comm::PresentationRequest); - -#[wasm_bindgen] -impl PresentationRequest { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct PresentationResponse(pub(crate) comm::PresentationResponse); - -#[wasm_bindgen] -impl PresentationResponse { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct TrustedIssuer(pub(crate) comm::TrustedIssuer); - -#[wasm_bindgen] -impl TrustedIssuer { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} diff --git a/bindings/wasm/src/message/timing.rs b/bindings/wasm/src/message/timing.rs deleted file mode 100644 index a9b9289fc7..0000000000 --- a/bindings/wasm/src/message/timing.rs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity::comm; -use identity::core::Timestamp; -use wasm_bindgen::prelude::*; - -use crate::error::wasm_error; - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct Timing(pub(crate) comm::Timing); - -#[wasm_bindgen] -impl Timing { - #[wasm_bindgen(getter = outTime)] - pub fn out_time(&self) -> Option { - self.0.out_time().map(ToString::to_string) - } - - #[wasm_bindgen(setter = outTime)] - pub fn set_out_time(&mut self, value: &str) { - self.0.set_out_time(Timestamp::parse(value).ok()); - } - - #[wasm_bindgen(getter = inTime)] - pub fn in_time(&self) -> Option { - self.0.in_time().map(ToString::to_string) - } - - #[wasm_bindgen(setter = inTime)] - pub fn set_in_time(&mut self, value: &str) { - self.0.set_in_time(Timestamp::parse(value).ok()); - } - - #[wasm_bindgen(getter = staleTime)] - pub fn stale_time(&self) -> Option { - self.0.stale_time().map(ToString::to_string) - } - - #[wasm_bindgen(setter = staleTime)] - pub fn set_stale_time(&mut self, value: &str) { - self.0.set_stale_time(Timestamp::parse(value).ok()); - } - - #[wasm_bindgen(getter = expiresTime)] - pub fn expires_time(&self) -> Option { - self.0.expires_time().map(ToString::to_string) - } - - #[wasm_bindgen(setter = expiresTime)] - pub fn set_expires_time(&mut self, value: &str) { - self.0.set_expires_time(Timestamp::parse(value).ok()); - } - - #[wasm_bindgen(getter = waitUntilTime)] - pub fn wait_until_time(&self) -> Option { - self.0.wait_until_time().map(ToString::to_string) - } - - #[wasm_bindgen(setter = waitUntilTime)] - pub fn set_wait_until_time(&mut self, value: &str) { - self.0.set_wait_until_time(Timestamp::parse(value).ok()); - } - - #[wasm_bindgen(getter = delayMilli)] - pub fn delay_milli(&self) -> Option { - self.0.delay_milli() - } - - #[wasm_bindgen(setter = delayMilli)] - pub fn set_delay_milli(&mut self, value: u32) { - self.0.set_delay_milli(value); - } - - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} diff --git a/bindings/wasm/src/message/trust_ping.rs b/bindings/wasm/src/message/trust_ping.rs deleted file mode 100644 index c9bb40e598..0000000000 --- a/bindings/wasm/src/message/trust_ping.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity::comm; -use wasm_bindgen::prelude::*; - -use crate::error::wasm_error; - -#[wasm_bindgen(inspectable)] -#[derive(Clone, Debug, PartialEq)] -pub struct TrustPing(pub(crate) comm::TrustPing); - -#[wasm_bindgen] -impl TrustPing { - #[wasm_bindgen(js_name = toJSON)] - pub fn to_json(&self) -> Result { - JsValue::from_serde(&self.0).map_err(wasm_error) - } - - #[wasm_bindgen(js_name = fromJSON)] - pub fn from_json(value: &JsValue) -> Result { - value.into_serde().map_err(wasm_error).map(Self) - } -} diff --git a/identity-comm/src/lib.rs b/identity-comm/src/lib.rs index ab40abb583..8af2f131fb 100644 --- a/identity-comm/src/lib.rs +++ b/identity-comm/src/lib.rs @@ -17,9 +17,6 @@ // clippy::missing_errors_doc, )] -#[macro_use] -extern crate serde; - pub mod envelope; pub mod error; pub mod message; diff --git a/identity-comm/src/message/macros.rs b/identity-comm/src/message/macros.rs deleted file mode 100644 index 8497a7cc8c..0000000000 --- a/identity-comm/src/message/macros.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -macro_rules! impl_message_accessor { - ($name:expr, $field:ident => $ty:ty) => { - paste::paste! { - #[doc = "Sets the value of the `"] - #[doc = $name] - #[doc = "` field"] - pub fn []>(&mut self, value: VALUE) { - self.$field = value.into(); - } - - #[doc = "Returns a reference to the `"] - #[doc = $name] - #[doc = "` field"] - pub fn $field(&self) -> &$ty { - &self.$field - } - - #[doc = "Returns a mutable reference to the `"] - #[doc = $name] - #[doc = "` field"] - pub fn [<$field _mut>](&mut self) -> &mut $ty { - &mut self.$field - } - } - }; - ($field:ident => $ty:ty) => { - impl_message_accessor!(stringify!($field), $field => $ty); - }; - ($($field:ident => $ty:ty)+) => { - $( - impl_message_accessor!($field, $ty); - )+ - }; -} diff --git a/identity-comm/src/message/mod.rs b/identity-comm/src/message/mod.rs index 3c9754ea0e..b0bd58710e 100644 --- a/identity-comm/src/message/mod.rs +++ b/identity-comm/src/message/mod.rs @@ -1,15 +1,6 @@ // Copyright 2020-2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -#[macro_use] -mod macros; - -mod report; -mod timing; mod traits; -mod types; -pub use self::report::*; -pub use self::timing::*; pub use self::traits::*; -pub use self::types::*; diff --git a/identity-comm/src/message/report.rs b/identity-comm/src/message/report.rs deleted file mode 100644 index fa008dd347..0000000000 --- a/identity-comm/src/message/report.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 -//! Provides a type for DIDComm problem reports. -use uuid::Uuid; - -use crate::message::Timing; - -/// A loose analogue of [DIDComm problem reports](https://github.com/decentralized-identity/didcomm-messaging/blob/84e5a7c66c87440d39e93df81e4440855273f987/docs/spec-files/problems.md#problem-reports) -#[derive(Debug, Deserialize, Serialize, Clone, PartialEq)] -pub struct Report { - context: String, - thread: Uuid, - reference: String, - #[serde(skip_serializing_if = "Option::is_none")] - error: Option, - #[serde(skip_serializing_if = "Option::is_none")] - comment: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl Report { - /// Creates a new `Report` message. - pub fn new(context: String, thread: Uuid, reference: String) -> Self { - Self { - context, - thread, - reference, - error: None, - comment: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(reference => String); - impl_message_accessor!(error => Option); - impl_message_accessor!(comment => Option); - impl_message_accessor!(timing => Option); -} diff --git a/identity-comm/src/message/timing.rs b/identity-comm/src/message/timing.rs deleted file mode 100644 index 951074057f..0000000000 --- a/identity-comm/src/message/timing.rs +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity_core::common::Timestamp; - -/// A DIDComm Timing Decorator -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/Field_Definitions.md) -#[derive(Clone, Debug, Deserialize, Serialize, Default, PartialEq)] -pub struct Timing { - #[serde(skip_serializing_if = "Option::is_none")] - out_time: Option, - #[serde(skip_serializing_if = "Option::is_none")] - in_time: Option, - #[serde(skip_serializing_if = "Option::is_none")] - stale_time: Option, - #[serde(skip_serializing_if = "Option::is_none")] - expires_time: Option, - #[serde(skip_serializing_if = "Option::is_none")] - wait_until_time: Option, - #[serde(skip_serializing_if = "Option::is_none")] - delay_milli: Option, -} - -impl Timing { - /// Creates a new `Timing` decorator. - pub fn new() -> Self { - Self { - out_time: None, - in_time: None, - stale_time: None, - expires_time: None, - wait_until_time: None, - delay_milli: None, - } - } - - /// Returns a reference to the `out_time` field. - pub fn out_time(&self) -> Option<&Timestamp> { - self.out_time.as_ref() - } - - /// Returns a mutable reference to the `out_time` field. - pub fn out_time_mut(&mut self) -> Option<&mut Timestamp> { - self.out_time.as_mut() - } - - /// Sets the value of the `out_time` field. - pub fn set_out_time>>(&mut self, value: T) { - self.out_time = value.into(); - } - - /// Returns a reference to the `in_time` field. - pub fn in_time(&self) -> Option<&Timestamp> { - self.in_time.as_ref() - } - - /// Returns a mutable reference to the `in_time` field. - pub fn in_time_mut(&mut self) -> Option<&mut Timestamp> { - self.in_time.as_mut() - } - - /// Sets the value of the `in_time` field. - pub fn set_in_time>>(&mut self, value: T) { - self.in_time = value.into(); - } - - /// Returns a reference to the `stale_time` field. - pub fn stale_time(&self) -> Option<&Timestamp> { - self.stale_time.as_ref() - } - - /// Returns a mutable reference to the `stale_time` field. - pub fn stale_time_mut(&mut self) -> Option<&mut Timestamp> { - self.stale_time.as_mut() - } - - /// Sets the value of the `stale_time` field. - pub fn set_stale_time>>(&mut self, value: T) { - self.stale_time = value.into(); - } - - /// Returns a reference to the `expires_time` field. - pub fn expires_time(&self) -> Option<&Timestamp> { - self.expires_time.as_ref() - } - - /// Returns a mutable reference to the `expires_time` field. - pub fn expires_time_mut(&mut self) -> Option<&mut Timestamp> { - self.expires_time.as_mut() - } - - /// Sets the value of the `expires_time` field. - pub fn set_expires_time>>(&mut self, value: T) { - self.expires_time = value.into(); - } - - /// Returns a reference to the `wait_until_time` field. - pub fn wait_until_time(&self) -> Option<&Timestamp> { - self.wait_until_time.as_ref() - } - - /// Returns a mutable reference to the `wait_until_time` field. - pub fn wait_until_time_mut(&mut self) -> Option<&mut Timestamp> { - self.wait_until_time.as_mut() - } - - /// Sets the value of the `wait_until_time` field. - pub fn set_wait_until_time>>(&mut self, value: T) { - self.wait_until_time = value.into(); - } - - /// Returns the value of the `delay_milli` field. - pub fn delay_milli(&self) -> Option { - self.delay_milli - } - - /// Sets the value of the `delay_milli` field. - pub fn set_delay_milli>>(&mut self, value: T) { - self.delay_milli = value.into(); - } -} diff --git a/identity-comm/src/message/types/authentication.rs b/identity-comm/src/message/types/authentication.rs deleted file mode 100644 index dcce9ac90f..0000000000 --- a/identity-comm/src/message/types/authentication.rs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity_core::common::Url; -use identity_core::crypto::Signature; -use identity_iota::did::IotaDIDUrl; -use uuid::Uuid; - -use crate::message::Timing; - -/// A DIDComm `authentication` Request. -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_authentication.md#authenticationrequest) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct AuthenticationRequest { - context: String, - thread: Uuid, - #[serde(rename = "callbackURL")] - callback_url: Url, - challenge: String, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl AuthenticationRequest { - /// Creates a new `AuthenticationRequest`. - pub fn new(context: String, thread: Uuid, callback_url: Url, challenge: String) -> Self { - Self { - context, - thread, - callback_url, - challenge, - response_requested: None, - id: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(callback_url => Url); - impl_message_accessor!(challenge => String); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(timing => Option); -} - -/// A DIDComm `authentication` Response. -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_authentication.md#authenticationresponse) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct AuthenticationResponse { - context: String, - thread: Uuid, - signature: Signature, - #[serde(rename = "callbackURL", skip_serializing_if = "Option::is_none")] - callback_url: Option, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl AuthenticationResponse { - /// Creates a new `AuthenticationResponse`. - pub fn new(context: String, thread: Uuid, signature: Signature) -> Self { - Self { - context, - thread, - signature, - callback_url: None, - response_requested: None, - id: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(signature => Signature); - impl_message_accessor!(callback_url => Option); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(timing => Option); -} diff --git a/identity-comm/src/message/types/credential_issuance.rs b/identity-comm/src/message/types/credential_issuance.rs deleted file mode 100644 index 5116fb6d9a..0000000000 --- a/identity-comm/src/message/types/credential_issuance.rs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity_core::common::Url; -use identity_iota::did::IotaDIDUrl; -use uuid::Uuid; - -use crate::message::Timing; - -/// A DIDComm `credential-issuance` Request. -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_credential-issuance.md#credentialselection) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct CredentialSelection { - context: String, - thread: Uuid, - #[serde(rename = "callbackURL")] - callback_url: Url, - #[serde(rename = "credentialTypes")] - credential_types: Vec, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl CredentialSelection { - /// Creates a new `CredentialSelection`. - pub fn new(context: String, thread: Uuid, callback_url: Url, credential_types: Vec) -> Self { - Self { - context, - thread, - callback_url, - credential_types, - response_requested: None, - id: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(callback_url => Url); - impl_message_accessor!(credential_types => Vec); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(timing => Option); -} - -/// A DIDComm `credential-issuance` Response. -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_credential-issuance.md#credentialissuance) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct CredentialIssuance { - context: String, - thread: Uuid, - credentials: Vec, - #[serde(rename = "callbackURL", skip_serializing_if = "Option::is_none")] - callback_url: Option, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl CredentialIssuance { - /// Creates a new `CredentialIssuance`. - pub fn new(context: String, thread: Uuid, credentials: Vec) -> Self { - Self { - context, - thread, - credentials, - callback_url: None, - response_requested: None, - id: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(credentials => Vec); - impl_message_accessor!(callback_url => Option); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(timing => Option); -} diff --git a/identity-comm/src/message/types/credential_options.rs b/identity-comm/src/message/types/credential_options.rs deleted file mode 100644 index 30becc5bf7..0000000000 --- a/identity-comm/src/message/types/credential_options.rs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity_core::common::Url; -use identity_iota::did::IotaDIDUrl; -use uuid::Uuid; - -use crate::message::Timing; - -/// A DIDComm `credential-options` Request. -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_credential-options.md#credentialoptionsrequest) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct CredentialOptionRequest { - context: String, - thread: Uuid, - #[serde(rename = "callbackURL")] - callback_url: Url, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl CredentialOptionRequest { - /// Creates a new `CredentialOptionRequest`. - pub fn new(context: String, thread: Uuid, callback_url: Url) -> Self { - Self { - context, - thread, - callback_url, - response_requested: None, - id: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(callback_url => Url); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(timing => Option); -} - -/// A DIDComm `credential-options` Response. -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_credential-options.md#credentialoptionsresponse) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct CredentialOptionResponse { - context: String, - thread: Uuid, - #[serde(rename = "credentialTypes")] - credential_types: Vec, - #[serde(rename = "callbackURL", skip_serializing_if = "Option::is_none")] - callback_url: Option, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl CredentialOptionResponse { - /// Creates a new `CredentialOptionResponse`. - pub fn new(context: String, thread: Uuid, credential_types: Vec) -> Self { - Self { - context, - thread, - credential_types, - callback_url: None, - response_requested: None, - id: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(credential_types => Vec); - impl_message_accessor!(callback_url => Option); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(timing => Option); -} diff --git a/identity-comm/src/message/types/credential_revocation.rs b/identity-comm/src/message/types/credential_revocation.rs deleted file mode 100644 index a45ca19de6..0000000000 --- a/identity-comm/src/message/types/credential_revocation.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity_core::common::Url; -use identity_iota::did::IotaDIDUrl; -use uuid::Uuid; - -use crate::message::Timing; - -/// A DIDComm `credential-revocation` Message -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_credential-revocation.md#revocation) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct CredentialRevocation { - context: String, - thread: Uuid, - #[serde(rename = "credentialId")] - credential_id: String, - #[serde(rename = "callbackURL", skip_serializing_if = "Option::is_none")] - callback_url: Option, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - comment: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl CredentialRevocation { - /// Creates a new `CredentialRevocation`. - pub fn new(context: String, thread: Uuid, credential_id: String) -> Self { - Self { - context, - thread, - credential_id, - callback_url: None, - response_requested: None, - id: None, - comment: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(credential_id => String); - impl_message_accessor!(callback_url => Option); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(comment => Option); - impl_message_accessor!(timing => Option); -} diff --git a/identity-comm/src/message/types/credential_schema.rs b/identity-comm/src/message/types/credential_schema.rs deleted file mode 100644 index 1326fc9e13..0000000000 --- a/identity-comm/src/message/types/credential_schema.rs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity_core::common::Url; -use identity_iota::did::IotaDIDUrl; -use uuid::Uuid; - -use crate::message::Timing; - -/// A DIDComm `credential-schema` Request -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_credential-schema.md#credentialschemarequest) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct CredentialSchemaRequest { - context: String, - thread: Uuid, - #[serde(rename = "callbackURL")] - callback_url: Url, - #[serde(rename = "credentialTypes")] - credential_types: Vec, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl CredentialSchemaRequest { - /// Creates a new `CredentialSchemaRequest`. - pub fn new(context: String, thread: Uuid, callback_url: Url, credential_types: Vec) -> Self { - Self { - context, - thread, - callback_url, - credential_types, - response_requested: None, - id: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(callback_url => Url); - impl_message_accessor!(credential_types => Vec); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(timing => Option); -} - -/// A DIDComm `credential-schema` Response -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_credential-schema.md#credentialschemaresponse) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct CredentialSchemaResponse { - context: String, - thread: String, - schemata: Vec, - #[serde(rename = "callbackURL", skip_serializing_if = "Option::is_none")] - callback_url: Option, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl CredentialSchemaResponse { - /// Creates a new `CredentialSchemaResponse`. - pub fn new(context: String, thread: String, schemata: Vec, callback_url: Option) -> Self { - Self { - context, - thread, - schemata, - callback_url, - response_requested: None, - id: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => String); - impl_message_accessor!(schemata => Vec); - impl_message_accessor!(callback_url => Option); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(timing => Option); -} diff --git a/identity-comm/src/message/types/did_discovery.rs b/identity-comm/src/message/types/did_discovery.rs deleted file mode 100644 index 4e2899c468..0000000000 --- a/identity-comm/src/message/types/did_discovery.rs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity_core::common::Url; -use identity_iota::did::IotaDIDUrl; -use uuid::Uuid; - -use crate::message::Timing; - -/// A DIDComm `did-discovery` Request. -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_did-discovery.md#didrequest) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct DidRequest { - context: String, - thread: Uuid, - #[serde(rename = "callbackURL")] - callback_url: Url, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl DidRequest { - /// Creates a new `DidRequest`. - pub fn new(context: String, thread: Uuid, callback_url: Url) -> Self { - Self { - context, - thread, - callback_url, - response_requested: None, - id: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(callback_url => Url); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(timing => Option); -} - -/// A DIDComm `did-discovery` Response. -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_did-discovery.md#didresponse) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct DidResponse { - context: String, - thread: Uuid, - id: IotaDIDUrl, - #[serde(rename = "callbackURL", skip_serializing_if = "Option::is_none")] - callback_url: Option, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl DidResponse { - /// Creates a new `DidResponse`. - pub fn new(context: String, thread: Uuid, id: IotaDIDUrl) -> Self { - Self { - context, - thread, - id, - callback_url: None, - response_requested: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(id => IotaDIDUrl); - impl_message_accessor!(callback_url => Option); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(timing => Option); -} diff --git a/identity-comm/src/message/types/did_introduction.rs b/identity-comm/src/message/types/did_introduction.rs deleted file mode 100644 index 2982321757..0000000000 --- a/identity-comm/src/message/types/did_introduction.rs +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity_core::common::Url; -use identity_iota::did::IotaDIDUrl; -use uuid::Uuid; - -use crate::message::Timing; - -/// A DIDComm `did-introduction` Request. -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_did-introduction.md#introductionproposal) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct IntroductionProposal { - context: String, - thread: Uuid, - #[serde(rename = "callbackURL")] - callback_url: Url, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - comment: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl IntroductionProposal { - /// Creates a new `IntroductionProposal`. - pub fn new(context: String, thread: Uuid, callback_url: Url) -> Self { - Self { - context, - thread, - callback_url, - response_requested: None, - id: None, - comment: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(callback_url => Url); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(comment => Option); - impl_message_accessor!(timing => Option); -} - -/// A DIDComm `did-introduction` Response. -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_did-introduction.md#introductionresponse) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct IntroductionResponse { - context: String, - thread: Uuid, - consent: bool, - #[serde(rename = "callbackURL", skip_serializing_if = "Option::is_none")] - callback_url: Option, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - comment: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl IntroductionResponse { - /// Creates a new `IntroductionResponse`. - pub fn new(context: String, thread: Uuid, consent: bool) -> Self { - Self { - context, - thread, - consent, - callback_url: None, - response_requested: None, - id: None, - comment: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(consent => bool); - impl_message_accessor!(callback_url => Option); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(comment => Option); - impl_message_accessor!(timing => Option); -} - -/// A DIDComm `introduction` Message -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_did-introduction.md#introduction) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct Introduction { - context: String, - thread: Uuid, - ids: Vec, - #[serde(rename = "callbackURL", skip_serializing_if = "Option::is_none")] - callback_url: Option, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - comment: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl Introduction { - /// Creates a new `Introduction`. - pub fn new(context: String, thread: Uuid, ids: Vec) -> Self { - Self { - context, - thread, - ids, - callback_url: None, - response_requested: None, - id: None, - comment: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(ids => Vec); - impl_message_accessor!(callback_url => Option); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(comment => Option); - impl_message_accessor!(timing => Option); -} diff --git a/identity-comm/src/message/types/did_resolution.rs b/identity-comm/src/message/types/did_resolution.rs deleted file mode 100644 index 6cc9f7f788..0000000000 --- a/identity-comm/src/message/types/did_resolution.rs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity_core::common::Url; -use identity_iota::did::IotaDIDUrl; -use identity_iota::did::IotaDocument; -use uuid::Uuid; - -use crate::message::Timing; - -/// A DIDComm `did-resolution` Request. -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_did-resolution.md#resolutionrequest) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct ResolutionRequest { - context: String, - thread: Uuid, - #[serde(rename = "callbackURL")] - callback_url: Url, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl ResolutionRequest { - /// Creates a new `ResolutionRequest` - pub fn new(context: String, thread: Uuid, callback_url: Url) -> Self { - Self { - context, - thread, - callback_url, - response_requested: None, - id: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(callback_url => Url); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(timing => Option); -} - -/// A DIDComm `did-resolution` Response. -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_did-resolution.md#resolutionresponse) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct ResolutionResponse { - context: String, - thread: Uuid, - #[serde(rename = "didDocument")] - did_document: IotaDocument, - #[serde(rename = "callbackURL", skip_serializing_if = "Option::is_none")] - callback_url: Option, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl ResolutionResponse { - /// Creates a new `ResolutionResponse` - pub fn new(context: String, thread: Uuid, did_document: IotaDocument) -> Self { - Self { - context, - thread, - did_document, - callback_url: None, - response_requested: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(did_document => IotaDocument); - impl_message_accessor!(callback_url => Option); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(timing => Option); -} diff --git a/identity-comm/src/message/types/features_discovery.rs b/identity-comm/src/message/types/features_discovery.rs deleted file mode 100644 index 2f41c544fc..0000000000 --- a/identity-comm/src/message/types/features_discovery.rs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 -//! Provides types loosely representing the request and response roles from the [Discover Features Protocol](https://github.com/decentralized-identity/didcomm-messaging/blob/84e5a7c66c87440d39e93df81e4440855273f987/docs/spec-files/feature_discovery.md#discover-features-protocol-10) - -use identity_core::common::Url; -use identity_iota::did::IotaDIDUrl; -use uuid::Uuid; - -use crate::message::Timing; - -/// Analogue of a [DIDComm `features-discovery` Request](https://github.com/decentralized-identity/didcomm-messaging/blob/84e5a7c66c87440d39e93df81e4440855273f987/docs/spec-files/feature_discovery.md#discover-features-protocol-10) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct FeaturesRequest { - context: String, - thread: Uuid, - #[serde(rename = "callbackURL")] - callback_url: Url, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl FeaturesRequest { - /// Creates a new `FeaturesRequest`. - pub fn new(context: String, thread: Uuid, callback_url: Url) -> Self { - Self { - context, - thread, - callback_url, - response_requested: None, - id: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(callback_url => Url); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(timing => Option); -} - -/// Analogue of a [DIDComm `features-discovery` Response](https://github.com/decentralized-identity/didcomm-messaging/blob/84e5a7c66c87440d39e93df81e4440855273f987/docs/spec-files/feature_discovery.md#discover-features-protocol-10) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct FeaturesResponse { - context: String, - thread: Uuid, - features: Vec, - #[serde(rename = "callbackURL", skip_serializing_if = "Option::is_none")] - callback_url: Option, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl FeaturesResponse { - /// Creates a new `FeaturesResponse`. - pub fn new(context: String, thread: Uuid, features: Vec) -> Self { - Self { - context, - thread, - features, - callback_url: None, - response_requested: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(features => Vec); - impl_message_accessor!(callback_url => Option); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(timing => Option); -} diff --git a/identity-comm/src/message/types/mod.rs b/identity-comm/src/message/types/mod.rs deleted file mode 100644 index ed0ceec20c..0000000000 --- a/identity-comm/src/message/types/mod.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 -//! Provides types for various DIDComm protocols. - -mod authentication; -mod credential_issuance; -mod credential_options; -mod credential_revocation; -mod credential_schema; -mod did_discovery; -mod did_introduction; -mod did_resolution; -mod features_discovery; -mod presentation_verification; -mod trust_ping; - -pub use self::authentication::*; -pub use self::credential_issuance::*; -pub use self::credential_options::*; -pub use self::credential_revocation::*; -pub use self::credential_schema::*; -pub use self::did_discovery::*; -pub use self::did_introduction::*; -pub use self::did_resolution::*; -pub use self::features_discovery::*; -pub use self::presentation_verification::*; -pub use self::trust_ping::*; diff --git a/identity-comm/src/message/types/presentation_verification.rs b/identity-comm/src/message/types/presentation_verification.rs deleted file mode 100644 index 4cf2b36118..0000000000 --- a/identity-comm/src/message/types/presentation_verification.rs +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -use identity_core::common::Url; -use identity_credential::presentation::Presentation; -use identity_iota::did::IotaDIDUrl; -use uuid::Uuid; - -use crate::message::Timing; - -/// A DIDComm `presentation-verification` Request. -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_presentation-verification.md#presentationrequest) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct PresentationRequest { - context: String, - thread: Uuid, - #[serde(rename = "callbackURL")] - callback_url: Url, - #[serde(rename = "trustedIssuers", skip_serializing_if = "Option::is_none")] - trusted_issuers: Option>, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl PresentationRequest { - /// Creates a new `PresentationRequest`. - pub fn new(context: String, thread: Uuid, callback_url: Url) -> Self { - Self { - context, - thread, - callback_url, - trusted_issuers: None, - response_requested: None, - id: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(callback_url => Url); - impl_message_accessor!(trusted_issuers => Option>); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(timing => Option); -} - -/// A DIDComm `presentation-verification` Response. -/// -/// [Reference](https://github.com/iotaledger/identity.rs/blob/dev/docs/DID%20Communications%20Research%20and%20Specification/i_presentation-verification.md#presentationresponse) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct PresentationResponse { - context: String, - thread: Uuid, - #[serde(rename = "verifiablePresentation")] - verifiable_presentation: Presentation, - #[serde(rename = "callbackURL", skip_serializing_if = "Option::is_none")] - callback_url: Option, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl PresentationResponse { - /// Creates a new `PresentationResponse`. - pub fn new(context: String, thread: Uuid, verifiable_presentation: Presentation) -> Self { - Self { - context, - thread, - verifiable_presentation, - callback_url: None, - response_requested: None, - id: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Uuid); - impl_message_accessor!(verifiable_presentation => Presentation); - impl_message_accessor!(callback_url => Option); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(timing => Option); -} - -#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize)] -pub struct TrustedIssuer { - #[serde(rename = "credentialTypes")] - credential_types: Vec, - #[serde(rename = "supportedIssuers")] - supported_issuers: Vec, -} - -impl TrustedIssuer { - /// Creates a new `TrustedIssuer`. - pub fn new() -> Self { - Self { - credential_types: Vec::new(), - supported_issuers: Vec::new(), - } - } - - impl_message_accessor!(credential_types => Vec); - impl_message_accessor!(supported_issuers => Vec); -} diff --git a/identity-comm/src/message/types/trust_ping.rs b/identity-comm/src/message/types/trust_ping.rs deleted file mode 100644 index cac74aa9fc..0000000000 --- a/identity-comm/src/message/types/trust_ping.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 -//! Provides a type used in a `ping message` from the [Trust-Ping Protocol](https://github.com/decentralized-identity/didcomm-messaging/blob/84e5a7c66c87440d39e93df81e4440855273f987/docs/spec-files/trustping.md) - -use identity_core::common::Url; -use identity_iota::did::IotaDIDUrl; -use uuid::Uuid; - -use crate::message::Timing; - -/// A DIDComm `trust-ping` Message. -/// -/// [Reference](https://github.com/decentralized-identity/didcomm-messaging/blob/84e5a7c66c87440d39e93df81e4440855273f987/docs/spec-files/trustping.md) -#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] -pub struct TrustPing { - context: String, - #[serde(skip_serializing_if = "Option::is_none")] - thread: Option, - #[serde(rename = "callbackURL", skip_serializing_if = "Option::is_none")] - callback_url: Option, - #[serde(rename = "responseRequested", skip_serializing_if = "Option::is_none")] - response_requested: Option, - #[serde(skip_serializing_if = "Option::is_none")] - id: Option, - #[serde(skip_serializing_if = "Option::is_none")] - timing: Option, -} - -impl TrustPing { - /// Creates a new `TrustPing`. - pub fn new(context: String) -> Self { - Self { - context, - thread: None, - callback_url: None, - response_requested: None, - id: None, - timing: None, - } - } - - impl_message_accessor!(context => String); - impl_message_accessor!(thread => Option); - impl_message_accessor!(callback_url => Option); - impl_message_accessor!(response_requested => Option); - impl_message_accessor!(id => Option); - impl_message_accessor!(timing => Option); -} diff --git a/identity-comm/tests/message_authentication.rs b/identity-comm/tests/message_authentication.rs deleted file mode 100644 index 3242ebf96f..0000000000 --- a/identity-comm/tests/message_authentication.rs +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -// use core::slice; -// use identity_core::crypto::KeyPair; -// use identity_core::crypto::PublicKey; -// use identity_core::crypto::PrivateKey; -// use libjose::utils::ed25519_to_x25519_public; -// use libjose::utils::ed25519_to_x25519_secret; - -// use super::*; -// use crate::envelope::Encrypted; -// use crate::envelope::EncryptionAlgorithm; -// use crate::envelope::SignatureAlgorithm; -// use crate::error::Result; -// use crate::message::Message; - -// #[test] -// fn test_plaintext_roundtrip() { -// let authentication_request = AuthenticationRequest::new( -// "authentication/1.0/authenticationRequest".to_string(), -// Uuid::new_v4(), -// Url::parse("htpps://example.com").unwrap(), -// "please sign this".to_string(), -// ); -// let plain_envelope_request = authentication_request.pack_plain().unwrap(); -// let request: AuthenticationRequest = plain_envelope_request.unpack().unwrap(); -// assert_eq!(format!("{:?}", request), format!("{:?}", authentication_request)); -// } - -// #[test] -// fn test_signed_roundtrip() { -// let keypair = KeyPair::new_ed25519().unwrap(); - -// let authentication_request = AuthenticationRequest::new( -// "authentication/1.0/authenticationRequest".to_string(), -// Uuid::new_v4(), -// Url::parse("htpps://example.com").unwrap(), -// "please sign this".to_string(), -// ); -// let signed_request = authentication_request -// .pack_non_repudiable(SignatureAlgorithm::EdDSA, &keypair) -// .unwrap(); - -// let request = signed_request -// .unpack::(SignatureAlgorithm::EdDSA, &keypair.public()) -// .unwrap(); - -// assert_eq!(format!("{:?}", request), format!("{:?}", authentication_request)); -// } - -// fn ed25519_to_x25519(keypair: KeyPair) -> Result<(PublicKey, PrivateKey)> { -// Ok(( -// ed25519_to_x25519_public(keypair.public())?.to_vec().into(), -// ed25519_to_x25519_secret(keypair.secret())?.to_vec().into(), -// )) -// } - -// fn ed25519_to_x25519_keypair(keypair: KeyPair) -> Result { -// // This is completely wrong but `type_` is never used around here -// let type_ = keypair.type_(); -// let (public, secret) = ed25519_to_x25519(keypair)?; -// Ok((type_, public, secret).into()) -// } - -// #[test] -// fn test_encrypted_roundtrip() { -// let key_alice = KeyPair::new_ed25519().unwrap(); -// let key_alice = ed25519_to_x25519_keypair(key_alice).unwrap(); - -// let key_bob = KeyPair::new_ed25519().unwrap(); -// let key_bob = ed25519_to_x25519_keypair(key_bob).unwrap(); - -// let authentication_request = AuthenticationRequest::new( -// "authentication/1.0/authenticationRequest".to_string(), -// Uuid::new_v4(), -// Url::parse("htpps://example.com").unwrap(), -// "please sign this".to_string(), -// ); -// let recipients = slice::from_ref(key_alice.public()); - -// let encoded_request: Encrypted = authentication_request -// .pack_auth(EncryptionAlgorithm::A256GCM, recipients, &key_bob) -// .unwrap(); - -// let decoded_request: AuthenticationRequest = encoded_request -// .unpack(EncryptionAlgorithm::A256GCM, key_alice.secret(), key_bob.public()) -// .unwrap(); - -// assert_eq!( -// format!("{:?}", decoded_request), -// format!("{:?}", authentication_request) -// ); -// } diff --git a/identity-comm/tests/message_did_resolution.rs b/identity-comm/tests/message_did_resolution.rs deleted file mode 100644 index 9d4f56317d..0000000000 --- a/identity-comm/tests/message_did_resolution.rs +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -// use core::slice; -// use identity_core::crypto::KeyPair; -// use identity_core::crypto::PublicKey; -// use identity_core::crypto::PrivateKey; -// use libjose::utils::ed25519_to_x25519_public; -// use libjose::utils::ed25519_to_x25519_secret; - -// use super::*; -// use crate::envelope::Encrypted; -// use crate::envelope::EncryptionAlgorithm; -// use crate::envelope::SignatureAlgorithm; -// use crate::error::Result; -// use crate::message::Message; - -// #[test] -// fn test_plaintext_roundtrip() { -// let keypair = KeyPair::new_ed25519().unwrap(); -// let resolution_request = ResolutionRequest::new( -// "did-discovery/1.0/did-resolution/1.0/resolutionRequest".to_string(), -// Uuid::new_v4(), -// Url::parse("https://example.com").unwrap(), -// ); -// let resolotion_respone = ResolutionResponse::new( -// "did-resolution/1.0/resolutionResponse".to_string(), -// Uuid::new_v4(), -// Document::from_keypair(&keypair).unwrap(), -// ); - -// let plain_envelope_request = resolution_request.pack_plain().unwrap(); -// let plain_envelope_response = resolotion_respone.pack_plain().unwrap(); - -// let request: ResolutionRequest = plain_envelope_request.unpack().unwrap(); -// let response: ResolutionResponse = plain_envelope_response.unpack().unwrap(); -// assert_eq!(format!("{:?}", request), format!("{:?}", resolution_request)); -// assert_eq!(format!("{:?}", response), format!("{:?}", resolotion_respone)); -// } - -// #[test] -// fn test_signed_roundtrip() { -// let keypair = KeyPair::new_ed25519().unwrap(); - -// let resolution_request = ResolutionRequest::new( -// "did-discovery/1.0/did-resolution/1.0/resolutionRequest".to_string(), -// Uuid::new_v4(), -// Url::parse("https://example.com").unwrap(), -// ); -// let resolotion_respone = ResolutionResponse::new( -// "did-resolution/1.0/resolutionResponse".to_string(), -// Uuid::new_v4(), -// Document::from_keypair(&keypair).unwrap(), -// ); -// let signed_envelope_request = resolution_request -// .pack_non_repudiable(SignatureAlgorithm::EdDSA, &keypair) -// .unwrap(); - -// let signed_envelope_response = resolotion_respone -// .pack_non_repudiable(SignatureAlgorithm::EdDSA, &keypair) -// .unwrap(); - -// let request = signed_envelope_request -// .unpack::(SignatureAlgorithm::EdDSA, &keypair.public()) -// .unwrap(); - -// let response = signed_envelope_response -// .unpack::(SignatureAlgorithm::EdDSA, &keypair.public()) -// .unwrap(); - -// assert_eq!(format!("{:?}", request), format!("{:?}", resolution_request)); -// assert_eq!(format!("{:?}", response), format!("{:?}", resolotion_respone)); -// } - -// fn ed25519_to_x25519(keypair: KeyPair) -> Result<(PublicKey, PrivateKey)> { -// Ok(( -// ed25519_to_x25519_public(keypair.public())?.to_vec().into(), -// ed25519_to_x25519_secret(keypair.secret())?.to_vec().into(), -// )) -// } - -// fn ed25519_to_x25519_keypair(keypair: KeyPair) -> Result { -// // This is completely wrong but `type_` is never used around here -// let type_ = keypair.type_(); -// let (public, secret) = ed25519_to_x25519(keypair)?; -// Ok((type_, public, secret).into()) -// } - -// #[test] -// fn test_encrypted_roundtrip() { -// let keypair = KeyPair::new_ed25519().unwrap(); -// let key_alice = KeyPair::new_ed25519().unwrap(); -// let key_alice = ed25519_to_x25519_keypair(key_alice).unwrap(); - -// let key_bob = KeyPair::new_ed25519().unwrap(); -// let key_bob = ed25519_to_x25519_keypair(key_bob).unwrap(); - -// let resolution_request = ResolutionRequest::new( -// "did-discovery/1.0/did-resolution/1.0/resolutionRequest".to_string(), -// Uuid::new_v4(), -// Url::parse("https://example.com").unwrap(), -// ); -// let resolotion_respone = ResolutionResponse::new( -// "did-resolution/1.0/resolutionResponse".to_string(), -// Uuid::new_v4(), -// Document::from_keypair(&keypair).unwrap(), -// ); - -// let recipients = slice::from_ref(key_alice.public()); - -// let encrypted_envelope_request: Encrypted = resolution_request -// .pack_auth(EncryptionAlgorithm::A256GCM, recipients, &key_bob) -// .unwrap(); - -// let encrypted_envelope_response: Encrypted = resolotion_respone -// .pack_auth(EncryptionAlgorithm::A256GCM, recipients, &key_bob) -// .unwrap(); - -// let request: ResolutionRequest = encrypted_envelope_request -// .unpack(EncryptionAlgorithm::A256GCM, key_alice.secret(), key_bob.public()) -// .unwrap(); - -// let response: ResolutionResponse = encrypted_envelope_response -// .unpack(EncryptionAlgorithm::A256GCM, key_alice.secret(), key_bob.public()) -// .unwrap(); - -// assert_eq!(format!("{:?}", request), format!("{:?}", resolution_request)); -// assert_eq!(format!("{:?}", response), format!("{:?}", resolotion_respone)); -// } diff --git a/identity-comm/tests/message_features_discovery.rs b/identity-comm/tests/message_features_discovery.rs deleted file mode 100644 index ab85802ba0..0000000000 --- a/identity-comm/tests/message_features_discovery.rs +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -// use core::slice; -// use identity_core::crypto::KeyPair; -// use identity_core::crypto::PublicKey; -// use identity_core::crypto::PrivateKey; -// use libjose::utils::ed25519_to_x25519_public; -// use libjose::utils::ed25519_to_x25519_secret; - -// use super::*; -// use crate::envelope::Encrypted; -// use crate::envelope::EncryptionAlgorithm; -// use crate::envelope::SignatureAlgorithm; -// use crate::error::Result; -// use crate::message::Message; - -// #[test] -// fn test_plaintext_roundtrip() { -// let did_request = FeaturesRequest::new( -// "did-discovery/1.0/didRequest".to_string(), -// Uuid::new_v4(), -// Url::parse("https://example.com").unwrap(), -// ); -// let did_response = FeaturesResponse::new( -// "did-discovery/1.0/didResponse".to_string(), -// Uuid::new_v4(), -// vec!["trust-ping/1.0".to_string(), "did-discovery/1.0".to_string()], -// ); - -// let plain_envelope_request = did_request.pack_plain().unwrap(); -// let plain_envelope_response = did_response.pack_plain().unwrap(); - -// let request: FeaturesRequest = plain_envelope_request.unpack().unwrap(); -// let response: FeaturesResponse = plain_envelope_response.unpack().unwrap(); - -// assert_eq!(format!("{:?}", request), format!("{:?}", did_request)); -// assert_eq!(format!("{:?}", response), format!("{:?}", did_response)); -// } - -// #[test] -// fn test_signed_roundtrip() { -// let keypair = KeyPair::new_ed25519().unwrap(); - -// let did_request = FeaturesRequest::new( -// "did-discovery/1.0/didRequest".to_string(), -// Uuid::new_v4(), -// Url::parse("https://example.com").unwrap(), -// ); -// let did_response = FeaturesResponse::new( -// "did-discovery/1.0/didResponse".to_string(), -// Uuid::new_v4(), -// vec!["trust-ping/1.0".to_string(), "did-discovery/1.0".to_string()], -// ); -// let signed_request = did_request -// .pack_non_repudiable(SignatureAlgorithm::EdDSA, &keypair) -// .unwrap(); - -// let signed_response = did_response -// .pack_non_repudiable(SignatureAlgorithm::EdDSA, &keypair) -// .unwrap(); - -// let request = signed_request -// .unpack::(SignatureAlgorithm::EdDSA, &keypair.public()) -// .unwrap(); - -// let response = signed_response -// .unpack::(SignatureAlgorithm::EdDSA, &keypair.public()) -// .unwrap(); - -// assert_eq!(format!("{:?}", request), format!("{:?}", did_request)); -// assert_eq!(format!("{:?}", response), format!("{:?}", did_response)); -// } - -// fn ed25519_to_x25519(keypair: KeyPair) -> Result<(PublicKey, PrivateKey)> { -// Ok(( -// ed25519_to_x25519_public(keypair.public())?.to_vec().into(), -// ed25519_to_x25519_secret(keypair.secret())?.to_vec().into(), -// )) -// } - -// fn ed25519_to_x25519_keypair(keypair: KeyPair) -> Result { -// // This is completely wrong but `type_` is never used around here -// let type_ = keypair.type_(); -// let (public, secret) = ed25519_to_x25519(keypair)?; -// Ok((type_, public, secret).into()) -// } - -// #[test] -// fn test_encrypted_roundtrip() { -// let key_alice = KeyPair::new_ed25519().unwrap(); -// let key_alice = ed25519_to_x25519_keypair(key_alice).unwrap(); - -// let key_bob = KeyPair::new_ed25519().unwrap(); -// let key_bob = ed25519_to_x25519_keypair(key_bob).unwrap(); - -// let did_request = FeaturesRequest::new( -// "did-discovery/1.0/didRequest".to_string(), -// Uuid::new_v4(), -// Url::parse("https://example.com").unwrap(), -// ); -// let did_response = FeaturesResponse::new( -// "did-discovery/1.0/didResponse".to_string(), -// Uuid::new_v4(), -// vec!["trust-ping/1.0".to_string(), "did-discovery/1.0".to_string()], -// ); -// let recipients = slice::from_ref(key_alice.public()); - -// let encoded_request: Encrypted = did_request -// .pack_auth(EncryptionAlgorithm::A256GCM, recipients, &key_bob) -// .unwrap(); - -// let encoded_response: Encrypted = did_response -// .pack_auth(EncryptionAlgorithm::A256GCM, recipients, &key_bob) -// .unwrap(); - -// let decoded_request: FeaturesRequest = encoded_request -// .unpack(EncryptionAlgorithm::A256GCM, key_alice.secret(), key_bob.public()) -// .unwrap(); - -// let decoded_response: FeaturesResponse = encoded_response -// .unpack(EncryptionAlgorithm::A256GCM, key_alice.secret(), key_bob.public()) -// .unwrap(); - -// assert_eq!(format!("{:?}", decoded_request), format!("{:?}", did_request)); -// assert_eq!(format!("{:?}", decoded_response), format!("{:?}", did_response)); -// } diff --git a/identity-comm/tests/message_trust_ping.rs b/identity-comm/tests/message_trust_ping.rs deleted file mode 100644 index c308937561..0000000000 --- a/identity-comm/tests/message_trust_ping.rs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2020-2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -// use core::slice; -// use identity_core::crypto::KeyPair; -// use identity_core::crypto::PublicKey; -// use identity_core::crypto::PrivateKey; -// use libjose::utils::ed25519_to_x25519_public; -// use libjose::utils::ed25519_to_x25519_secret; - -// use super::*; -// use crate::envelope::Encrypted; -// use crate::envelope::EncryptionAlgorithm; -// use crate::envelope::SignatureAlgorithm; -// use crate::error::Result; -// use crate::message::Message; - -// #[test] -// fn test_plaintext_roundtrip() { -// let ping = TrustPing::new("trust-ping/1.0/ping".to_string()); - -// let plain_envelope_ping = ping.pack_plain().unwrap(); - -// let tp: TrustPing = plain_envelope_ping.unpack().unwrap(); - -// assert_eq!(format!("{:?}", tp), format!("{:?}", ping)); -// } - -// #[test] -// fn test_signed_roundtrip() { -// let keypair = KeyPair::new_ed25519().unwrap(); - -// let ping = TrustPing::new("trust-ping/1.0/ping".to_string()); - -// let signed_envelope_ping = ping.pack_non_repudiable(SignatureAlgorithm::EdDSA, &keypair).unwrap(); - -// let tp = signed_envelope_ping -// .unpack::(SignatureAlgorithm::EdDSA, &keypair.public()) -// .unwrap(); - -// assert_eq!(format!("{:?}", tp), format!("{:?}", ping)); -// } - -// fn ed25519_to_x25519(keypair: KeyPair) -> Result<(PublicKey, PrivateKey)> { -// Ok(( -// ed25519_to_x25519_public(keypair.public())?.to_vec().into(), -// ed25519_to_x25519_secret(keypair.secret())?.to_vec().into(), -// )) -// } - -// fn ed25519_to_x25519_keypair(keypair: KeyPair) -> Result { -// // This is completely wrong but `type_` is never used around here -// let type_ = keypair.type_(); -// let (public, secret) = ed25519_to_x25519(keypair)?; -// Ok((type_, public, secret).into()) -// } - -// #[test] -// fn test_encrypted_roundtrip() { -// let key_alice = KeyPair::new_ed25519().unwrap(); -// let key_alice = ed25519_to_x25519_keypair(key_alice).unwrap(); - -// let key_bob = KeyPair::new_ed25519().unwrap(); -// let key_bob = ed25519_to_x25519_keypair(key_bob).unwrap(); - -// let ping = TrustPing::new("trust-ping/1.0/ping".to_string()); - -// let recipients = slice::from_ref(key_alice.public()); - -// let encoded_envelope_ping: Encrypted = ping -// .pack_auth(EncryptionAlgorithm::A256GCM, recipients, &key_bob) -// .unwrap(); - -// let tp: TrustPing = encoded_envelope_ping -// .unpack(EncryptionAlgorithm::A256GCM, key_alice.secret(), key_bob.public()) -// .unwrap(); - -// assert_eq!(format!("{:?}", tp), format!("{:?}", ping)); -// } diff --git a/identity/src/lib.rs b/identity/src/lib.rs index ba12d4074d..bab3d1b6be 100644 --- a/identity/src/lib.rs +++ b/identity/src/lib.rs @@ -104,7 +104,6 @@ pub mod comm { pub use identity_comm::envelope::*; pub use identity_comm::error::*; pub use identity_comm::message::*; - pub use identity_comm::types::*; } pub mod prelude {