diff --git a/Cargo.toml b/Cargo.toml
index 54e3ace491..1564d0b248 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,11 +4,13 @@ members = [
"identity",
"identity-comm",
"identity-account",
+ "identity-account-storage",
"identity-core",
"identity-credential",
"identity-did",
"identity-diff",
"identity-iota",
+ "identity-iota-core",
"examples",
]
diff --git a/bindings/wasm/docs/api-reference.md b/bindings/wasm/docs/api-reference.md
index 43bc517b31..a21dcd47b4 100644
--- a/bindings/wasm/docs/api-reference.md
+++ b/bindings/wasm/docs/api-reference.md
@@ -285,6 +285,8 @@ Serializes a `Credential` object as a JSON object.
### credential.clone() ⇒ [Credential
](#Credential)
+Deep clones the object.
+
**Kind**: instance method of [Credential
](#Credential)
@@ -355,6 +357,8 @@ Serializes a `CredentialValidationOptions` as a JSON object.
### credentialValidationOptions.clone() ⇒ [CredentialValidationOptions
](#CredentialValidationOptions)
+Deep clones the object.
+
**Kind**: instance method of [CredentialValidationOptions
](#CredentialValidationOptions)
@@ -583,6 +587,8 @@ Serializes a `DID` as a JSON object.
### did.clone() ⇒ [DID
](#DID)
+Deep clones the object.
+
**Kind**: instance method of [DID
](#DID)
@@ -728,6 +734,8 @@ Serializes a `DIDUrl` as a JSON object.
### didUrl.clone() ⇒ [DIDUrl
](#DIDUrl)
+Deep clones the object.
+
**Kind**: instance method of [DIDUrl
](#DIDUrl)
@@ -892,6 +900,8 @@ Serializes a `DiffMessage` as a JSON object.
### diffMessage.clone() ⇒ [DiffMessage
](#DiffMessage)
+Deep clones the object.
+
**Kind**: instance method of [DiffMessage
](#DiffMessage)
@@ -1419,6 +1429,8 @@ Serializes a `Document` as a JSON object.
### document.clone() ⇒ [Document
](#Document)
+Deep clones the object.
+
**Kind**: instance method of [Document
](#Document)
@@ -1545,6 +1557,8 @@ Serializes `DocumentHistory` as a JSON object.
### documentHistory.clone() ⇒ [DocumentHistory
](#DocumentHistory)
+Deep clones the object.
+
**Kind**: instance method of [DocumentHistory
](#DocumentHistory)
@@ -1596,6 +1610,8 @@ Returns a reference to the `proof`.
### documentMetadata.clone() ⇒ [DocumentMetadata
](#DocumentMetadata)
+Deep clones the object.
+
**Kind**: instance method of [DocumentMetadata
](#DocumentMetadata)
@@ -1887,6 +1903,8 @@ Serializes a `KeyCollection` object as a JSON object.
### keyCollection.clone() ⇒ [KeyCollection
](#KeyCollection)
+Deep clones the object.
+
**Kind**: instance method of [KeyCollection
](#KeyCollection)
@@ -1953,6 +1971,8 @@ Serializes a `KeyPair` object as a JSON object.
### keyPair.clone() ⇒ [KeyPair
](#KeyPair)
+Deep clones the object.
+
**Kind**: instance method of [KeyPair
](#KeyPair)
@@ -2014,6 +2034,8 @@ Serializes a `MethodScope` object as a JSON object.
### methodScope.clone() ⇒ [MethodScope
](#MethodScope)
+Deep clones the object.
+
**Kind**: instance method of [MethodScope
](#MethodScope)
@@ -2075,6 +2097,8 @@ Serializes a `MethodType` object as a JSON object.
### methodType.clone() ⇒ [MethodType
](#MethodType)
+Deep clones the object.
+
**Kind**: instance method of [MethodType
](#MethodType)
@@ -2136,6 +2160,8 @@ Serializes a `Network` as a JSON object.
### network.clone() ⇒ [Network
](#Network)
+Deep clones the object.
+
**Kind**: instance method of [Network
](#Network)
@@ -2209,6 +2235,8 @@ Returns a copy of the credentials contained in the presentation.
### presentation.clone() ⇒ [Presentation
](#Presentation)
+Deep clones the object.
+
**Kind**: instance method of [Presentation
](#Presentation)
@@ -2258,6 +2286,8 @@ Serializes a `PresentationValidationOptions` as a JSON object.
### presentationValidationOptions.clone() ⇒ [PresentationValidationOptions
](#PresentationValidationOptions)
+Deep clones the object.
+
**Kind**: instance method of [PresentationValidationOptions
](#PresentationValidationOptions)
@@ -2384,6 +2414,8 @@ Serializes a `ProofPurpose` object as a JSON object.
### proofPurpose.clone() ⇒ [ProofPurpose
](#ProofPurpose)
+Deep clones the object.
+
**Kind**: instance method of [ProofPurpose
](#ProofPurpose)
@@ -2459,6 +2491,8 @@ Serializes a `Receipt` as a JSON object.
### receipt.clone() ⇒ [Receipt
](#Receipt)
+Deep clones the object.
+
**Kind**: instance method of [Receipt
](#Receipt)
@@ -2573,6 +2607,8 @@ Serializes a `Document` object as a JSON object.
### resolvedDocument.clone() ⇒ [ResolvedDocument
](#ResolvedDocument)
+Deep clones the object.
+
**Kind**: instance method of [ResolvedDocument
](#ResolvedDocument)
@@ -2852,6 +2888,8 @@ Serializes a `Service` object as a JSON object.
### service.clone() ⇒ [Service
](#Service)
+Deep clones the object.
+
**Kind**: instance method of [Service
](#Service)
@@ -2894,6 +2932,8 @@ Throws an error if any of the options are invalid.
### signatureOptions.clone() ⇒ [SignatureOptions
](#SignatureOptions)
+Deep clones the object.
+
**Kind**: instance method of [SignatureOptions
](#SignatureOptions)
@@ -3060,6 +3100,8 @@ Serializes a `VerificationMethod` object as a JSON object.
### verificationMethod.clone() ⇒ [VerificationMethod
](#VerificationMethod)
+Deep clones the object.
+
**Kind**: instance method of [VerificationMethod
](#VerificationMethod)
@@ -3124,6 +3166,8 @@ Serializes a `VerifierOptions` as a JSON object.
### verifierOptions.clone() ⇒ [VerifierOptions
](#VerifierOptions)
+Deep clones the object.
+
**Kind**: instance method of [VerifierOptions
](#VerifierOptions)
diff --git a/bindings/wasm/src/chain/document_history.rs b/bindings/wasm/src/chain/document_history.rs
index 72673af492..3831b52bc6 100644
--- a/bindings/wasm/src/chain/document_history.rs
+++ b/bindings/wasm/src/chain/document_history.rs
@@ -2,9 +2,9 @@
// SPDX-License-Identifier: Apache-2.0
use identity::iota::ChainHistory;
-use identity::iota::DiffMessage;
use identity::iota::DocumentHistory;
use identity::iota::ResolvedIotaDocument;
+use identity::iota_core::DiffMessage;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
diff --git a/bindings/wasm/src/did/wasm_did.rs b/bindings/wasm/src/did/wasm_did.rs
index d1e899ef74..59d1a1e408 100644
--- a/bindings/wasm/src/did/wasm_did.rs
+++ b/bindings/wasm/src/did/wasm_did.rs
@@ -3,7 +3,7 @@
use identity::core::decode_b58;
use identity::did::DID;
-use identity::iota::IotaDID;
+use identity::iota_core::IotaDID;
use wasm_bindgen::prelude::*;
use crate::crypto::WasmKeyPair;
diff --git a/bindings/wasm/src/did/wasm_did_url.rs b/bindings/wasm/src/did/wasm_did_url.rs
index e3eb910945..153aad7c09 100644
--- a/bindings/wasm/src/did/wasm_did_url.rs
+++ b/bindings/wasm/src/did/wasm_did_url.rs
@@ -1,7 +1,7 @@
// Copyright 2020-2022 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
-use identity::iota::IotaDIDUrl;
+use identity::iota_core::IotaDIDUrl;
use wasm_bindgen::prelude::*;
use crate::did::WasmDID;
diff --git a/bindings/wasm/src/did/wasm_diff_message.rs b/bindings/wasm/src/did/wasm_diff_message.rs
index a3693a9319..b7a94e646e 100644
--- a/bindings/wasm/src/did/wasm_diff_message.rs
+++ b/bindings/wasm/src/did/wasm_diff_message.rs
@@ -4,9 +4,8 @@
use std::str::FromStr;
use identity::core::ToJson;
-use identity::iota::DiffMessage;
-use identity::iota::MessageId;
-use identity::iota::TangleRef;
+use identity::iota_core::DiffMessage;
+use identity::iota_core::MessageId;
use wasm_bindgen::prelude::*;
use crate::did::WasmDID;
@@ -51,7 +50,9 @@ impl WasmDiffMessage {
/// Sets the message_id of the DID Document diff.
#[wasm_bindgen(setter = messageId)]
pub fn set_message_id(&mut self, message_id: &str) -> Result<()> {
- let message_id: MessageId = MessageId::from_str(message_id).wasm_result()?;
+ let message_id: MessageId = MessageId::from_str(message_id)
+ .map_err(identity::iota_core::Error::InvalidMessage)
+ .wasm_result()?;
self.0.set_message_id(message_id);
Ok(())
}
@@ -65,7 +66,9 @@ impl WasmDiffMessage {
/// Sets the Tangle message id of the previous DID Document diff.
#[wasm_bindgen(setter = previousMessageId)]
pub fn set_previous_message_id(&mut self, message_id: &str) -> Result<()> {
- let previous_message_id: MessageId = MessageId::from_str(message_id).wasm_result()?;
+ let previous_message_id: MessageId = MessageId::from_str(message_id)
+ .map_err(identity::iota_core::Error::InvalidMessage)
+ .wasm_result()?;
self.0.set_previous_message_id(previous_message_id);
Ok(())
}
diff --git a/bindings/wasm/src/did/wasm_document.rs b/bindings/wasm/src/did/wasm_document.rs
index 6432c53ac7..06c86760f8 100644
--- a/bindings/wasm/src/did/wasm_document.rs
+++ b/bindings/wasm/src/did/wasm_document.rs
@@ -17,12 +17,12 @@ use identity::crypto::PublicKey;
use identity::crypto::SignatureOptions;
use identity::did::verifiable::VerifiableProperties;
use identity::did::MethodScope;
-use identity::iota::Error;
-use identity::iota::IotaDID;
-use identity::iota::IotaDocument;
-use identity::iota::IotaVerificationMethod;
-use identity::iota::MessageId;
-use identity::iota::NetworkName;
+use identity::iota_core::Error;
+use identity::iota_core::IotaDID;
+use identity::iota_core::IotaDocument;
+use identity::iota_core::IotaVerificationMethod;
+use identity::iota_core::MessageId;
+use identity::iota_core::NetworkName;
use wasm_bindgen::prelude::*;
use crate::common::WasmTimestamp;
@@ -537,7 +537,9 @@ impl WasmDocument {
.0
.diff(
&other.0,
- MessageId::from_str(message_id).wasm_result()?,
+ MessageId::from_str(message_id)
+ .map_err(identity::iota_core::Error::InvalidMessage)
+ .wasm_result()?,
key.0.private(),
&method_query,
)
@@ -583,7 +585,9 @@ impl WasmDocument {
/// This is the Base58-btc encoded SHA-256 digest of the hex-encoded message id.
#[wasm_bindgen(js_name = diffIndex)]
pub fn diff_index(message_id: &str) -> Result {
- let message_id = MessageId::from_str(message_id).wasm_result()?;
+ let message_id = MessageId::from_str(message_id)
+ .map_err(identity::iota_core::Error::InvalidMessage)
+ .wasm_result()?;
IotaDocument::diff_index(&message_id).wasm_result()
}
@@ -633,7 +637,9 @@ impl WasmDocument {
/// Sets the previous integration chain message id.
#[wasm_bindgen(setter = metadataPreviousMessageId)]
pub fn set_metadata_previous_message_id(&mut self, value: &str) -> Result<()> {
- let message_id: MessageId = MessageId::from_str(value).wasm_result()?;
+ let message_id: MessageId = MessageId::from_str(value)
+ .map_err(identity::iota_core::Error::InvalidMessage)
+ .wasm_result()?;
self.0.metadata.previous_message_id = message_id;
Ok(())
}
diff --git a/bindings/wasm/src/did/wasm_document_metadata.rs b/bindings/wasm/src/did/wasm_document_metadata.rs
index a62f99f4c0..587e6dc09b 100644
--- a/bindings/wasm/src/did/wasm_document_metadata.rs
+++ b/bindings/wasm/src/did/wasm_document_metadata.rs
@@ -1,11 +1,10 @@
-// Copyright 2020-2021 IOTA Stiftung
+// Copyright 2020-2022 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
-use identity::iota::IotaDocumentMetadata;
-
-use crate::common::WasmTimestamp;
+use identity::iota_core::IotaDocumentMetadata;
use wasm_bindgen::prelude::*;
+use crate::common::WasmTimestamp;
use crate::error::Result;
use crate::error::WasmResult;
diff --git a/bindings/wasm/src/did/wasm_resolved_document.rs b/bindings/wasm/src/did/wasm_resolved_document.rs
index 58e9240622..2f1a6c6f0c 100644
--- a/bindings/wasm/src/did/wasm_resolved_document.rs
+++ b/bindings/wasm/src/did/wasm_resolved_document.rs
@@ -1,8 +1,8 @@
// Copyright 2020-2022 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
-use identity::iota::MessageId;
use identity::iota::ResolvedIotaDocument;
+use identity::iota_core::MessageId;
use std::str::FromStr;
use crate::did::WasmDiffMessage;
@@ -86,7 +86,9 @@ impl WasmResolvedDocument {
/// Sets the diff chain message id.
#[wasm_bindgen(setter = diffMessageId)]
pub fn set_diff_message_id(&mut self, value: &str) -> Result<()> {
- let message_id: MessageId = MessageId::from_str(value).wasm_result()?;
+ let message_id: MessageId = MessageId::from_str(value)
+ .map_err(identity::iota_core::Error::InvalidMessage)
+ .wasm_result()?;
self.0.diff_message_id = message_id;
Ok(())
}
@@ -100,7 +102,9 @@ impl WasmResolvedDocument {
/// Sets the integration chain message id.
#[wasm_bindgen(setter = integrationMessageId)]
pub fn set_integration_message_id(&mut self, value: &str) -> Result<()> {
- let message_id: MessageId = MessageId::from_str(value).wasm_result()?;
+ let message_id: MessageId = MessageId::from_str(value)
+ .map_err(identity::iota_core::Error::InvalidMessage)
+ .wasm_result()?;
self.0.integration_message_id = message_id;
Ok(())
}
diff --git a/bindings/wasm/src/did/wasm_service.rs b/bindings/wasm/src/did/wasm_service.rs
index 2611b3127f..3f39366005 100644
--- a/bindings/wasm/src/did/wasm_service.rs
+++ b/bindings/wasm/src/did/wasm_service.rs
@@ -2,8 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
use identity::did::ServiceEndpoint;
-use identity::iota::IotaDIDUrl;
-use identity::iota::IotaService;
+use identity::iota_core::IotaDIDUrl;
+use identity::iota_core::IotaService;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
diff --git a/bindings/wasm/src/did/wasm_verification_method.rs b/bindings/wasm/src/did/wasm_verification_method.rs
index e5419e02a8..ebbb18ea9f 100644
--- a/bindings/wasm/src/did/wasm_verification_method.rs
+++ b/bindings/wasm/src/did/wasm_verification_method.rs
@@ -5,8 +5,8 @@ use identity::core::decode_b58;
use identity::crypto::merkle_key::Blake2b256;
use identity::crypto::merkle_key::Sha256;
use identity::crypto::PublicKey;
-use identity::iota::IotaDID;
-use identity::iota::IotaVerificationMethod;
+use identity::iota_core::IotaDID;
+use identity::iota_core::IotaVerificationMethod;
use wasm_bindgen::prelude::*;
use crate::crypto::Digest;
diff --git a/bindings/wasm/src/error.rs b/bindings/wasm/src/error.rs
index 9c1697775c..b41c4edfec 100644
--- a/bindings/wasm/src/error.rs
+++ b/bindings/wasm/src/error.rs
@@ -91,6 +91,7 @@ impl_wasm_error_from!(
identity::credential::Error,
identity::did::Error,
identity::did::DIDError,
+ identity::iota_core::Error,
identity::iota::ValidationError
);
@@ -171,15 +172,6 @@ impl From for WasmError<'_> {
}
}
-impl From for WasmError<'_> {
- fn from(error: identity::iota::BeeMessageError) -> Self {
- Self {
- name: Cow::Borrowed("bee_message::Error"),
- message: Cow::Owned(error.to_string()),
- }
- }
-}
-
impl From for WasmError<'_> {
fn from(error: identity::iota::CompoundCredentialValidationError) -> Self {
Self {
diff --git a/bindings/wasm/src/tangle/client.rs b/bindings/wasm/src/tangle/client.rs
index 91d51a60bc..4a84a01bfa 100644
--- a/bindings/wasm/src/tangle/client.rs
+++ b/bindings/wasm/src/tangle/client.rs
@@ -7,12 +7,12 @@ use std::rc::Rc;
use futures::executor;
use identity::iota::Client;
use identity::iota::ClientBuilder;
-use identity::iota::DiffMessage;
-use identity::iota::IotaDID;
-use identity::iota::IotaDocument;
-use identity::iota::MessageId;
use identity::iota::ResolvedIotaDocument;
use identity::iota::TangleResolve;
+use identity::iota_core::DiffMessage;
+use identity::iota_core::IotaDID;
+use identity::iota_core::IotaDocument;
+use identity::iota_core::MessageId;
use js_sys::Promise;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
@@ -88,7 +88,9 @@ impl WasmClient {
/// Publishes a `DiffMessage` to the Tangle.
#[wasm_bindgen(js_name = publishDiff)]
pub fn publish_diff(&self, message_id: &str, diff: &WasmDiffMessage) -> Result {
- let message: MessageId = MessageId::from_str(message_id).wasm_result()?;
+ let message: MessageId = MessageId::from_str(message_id)
+ .map_err(identity::iota_core::Error::InvalidMessage)
+ .wasm_result()?;
let diff: DiffMessage = diff.0.clone();
let client: Rc = self.client.clone();
diff --git a/bindings/wasm/src/tangle/client_config.rs b/bindings/wasm/src/tangle/client_config.rs
index 030495732d..f7057f26d1 100644
--- a/bindings/wasm/src/tangle/client_config.rs
+++ b/bindings/wasm/src/tangle/client_config.rs
@@ -5,7 +5,7 @@ use std::time::Duration;
use identity::iota::ClientBuilder;
use identity::iota::DIDMessageEncoding;
-use identity::iota::Network;
+use identity::iota_core::Network;
use wasm_bindgen::prelude::*;
use crate::error::WasmResult;
@@ -240,7 +240,7 @@ mod tests {
use identity::core::Object;
use identity::iota::ClientBuilder;
use identity::iota::DIDMessageEncoding;
- use identity::iota::Network;
+ use identity::iota_core::Network;
use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue;
use wasm_bindgen_test::*;
diff --git a/bindings/wasm/src/tangle/explorer.rs b/bindings/wasm/src/tangle/explorer.rs
index aaf58578e3..dd1588018f 100644
--- a/bindings/wasm/src/tangle/explorer.rs
+++ b/bindings/wasm/src/tangle/explorer.rs
@@ -4,8 +4,8 @@
use std::str::FromStr;
use identity::iota::ExplorerUrl;
-use identity::iota::IotaDID;
-use identity::iota::MessageId;
+use identity::iota_core::IotaDID;
+use identity::iota_core::MessageId;
use wasm_bindgen::prelude::*;
use crate::did::UWasmDID;
@@ -44,7 +44,9 @@ impl WasmExplorerUrl {
/// E.g. https://explorer.iota.org/mainnet/message/{message_id}
#[wasm_bindgen(js_name = messageUrl)]
pub fn message_url(&self, message_id: &str) -> Result {
- let message_id = MessageId::from_str(message_id).wasm_result()?;
+ let message_id = MessageId::from_str(message_id)
+ .map_err(identity::iota_core::Error::InvalidMessage)
+ .wasm_result()?;
self.0.message_url(&message_id).map(|url| url.to_string()).wasm_result()
}
diff --git a/bindings/wasm/src/tangle/network.rs b/bindings/wasm/src/tangle/network.rs
index 079eb8604a..79df7080e3 100644
--- a/bindings/wasm/src/tangle/network.rs
+++ b/bindings/wasm/src/tangle/network.rs
@@ -1,7 +1,7 @@
// Copyright 2020-2022 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
-use identity::iota::Network;
+use identity::iota_core::Network;
use wasm_bindgen::prelude::*;
use crate::error::Result;
diff --git a/bindings/wasm/src/tangle/resolver.rs b/bindings/wasm/src/tangle/resolver.rs
index 8e1e42b805..c56759b974 100644
--- a/bindings/wasm/src/tangle/resolver.rs
+++ b/bindings/wasm/src/tangle/resolver.rs
@@ -8,11 +8,11 @@ use futures::executor;
use identity::core::Url;
use identity::iota::Client;
use identity::iota::ClientBuilder;
-use identity::iota::IotaDID;
-use identity::iota::NetworkName;
use identity::iota::ResolvedIotaDocument;
use identity::iota::Resolver;
use identity::iota::ResolverBuilder;
+use identity::iota_core::IotaDID;
+use identity::iota_core::NetworkName;
use js_sys::Promise;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
diff --git a/bindings/wasm/tests/wasm.rs b/bindings/wasm/tests/wasm.rs
index 478c97fa96..5571245b67 100644
--- a/bindings/wasm/tests/wasm.rs
+++ b/bindings/wasm/tests/wasm.rs
@@ -1,11 +1,14 @@
// Copyright 2020-2022 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
+use std::borrow::Cow;
+
use identity::core::FromJson;
use identity::core::Object;
use identity::core::Timestamp;
use identity::core::ToJson;
-use identity::iota::IotaDID;
+use identity::iota_core::IotaDID;
+use identity_wasm::common::WasmTimestamp;
use identity_wasm::credential::WasmCredential;
use identity_wasm::credential::WasmCredentialValidationOptions;
use identity_wasm::credential::WasmCredentialValidator;
@@ -13,25 +16,22 @@ use identity_wasm::credential::WasmFailFast;
use identity_wasm::credential::WasmPresentation;
use identity_wasm::credential::WasmPresentationValidationOptions;
use identity_wasm::credential::WasmPresentationValidator;
-use identity_wasm::crypto::WasmSignatureOptions;
-use identity_wasm::did::WasmVerifierOptions;
-use js_sys::Array;
-use std::borrow::Cow;
-use wasm_bindgen::prelude::*;
-use wasm_bindgen::JsCast;
-use wasm_bindgen_test::*;
-
-use identity_wasm::common::WasmTimestamp;
use identity_wasm::crypto::Digest;
use identity_wasm::crypto::KeyType;
use identity_wasm::crypto::WasmKeyCollection;
use identity_wasm::crypto::WasmKeyPair;
+use identity_wasm::crypto::WasmSignatureOptions;
use identity_wasm::did::WasmDID;
use identity_wasm::did::WasmDIDUrl;
use identity_wasm::did::WasmDocument;
use identity_wasm::did::WasmMethodScope;
use identity_wasm::did::WasmVerificationMethod;
+use identity_wasm::did::WasmVerifierOptions;
use identity_wasm::error::WasmError;
+use js_sys::Array;
+use wasm_bindgen::prelude::*;
+use wasm_bindgen::JsCast;
+use wasm_bindgen_test::*;
#[wasm_bindgen_test]
fn test_keypair() {
diff --git a/examples/Cargo.toml b/examples/Cargo.toml
index a1eab817d2..fb8ece9d80 100644
--- a/examples/Cargo.toml
+++ b/examples/Cargo.toml
@@ -8,7 +8,7 @@ publish = false
identity = { path = "../identity", features = ["account"] }
pretty_env_logger = { version = "0.4" }
rand = { version = "0.8" }
-tokio = { version = "1.10", features = ["full"] }
+tokio = { version = "1.17.0", features = ["full"] }
[[example]]
name = "getting_started"
diff --git a/examples/account/config.rs b/examples/account/config.rs
index 25e69ebf93..8fe4217ff8 100644
--- a/examples/account/config.rs
+++ b/examples/account/config.rs
@@ -11,8 +11,8 @@ use identity::account::IdentitySetup;
use identity::account::Result;
use identity::iota::ClientBuilder;
use identity::iota::ExplorerUrl;
-use identity::iota::IotaDID;
-use identity::iota::Network;
+use identity::iota_core::IotaDID;
+use identity::iota_core::Network;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/examples/account/create_did.rs b/examples/account/create_did.rs
index b12a10c711..b99fb6581a 100644
--- a/examples/account/create_did.rs
+++ b/examples/account/create_did.rs
@@ -10,7 +10,7 @@ use identity::account::AccountStorage;
use identity::account::IdentitySetup;
use identity::account::Result;
use identity::iota::ExplorerUrl;
-use identity::iota::IotaDID;
+use identity::iota_core::IotaDID;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/examples/account/lazy.rs b/examples/account/lazy.rs
index e8c5664022..e2f6eb7584 100644
--- a/examples/account/lazy.rs
+++ b/examples/account/lazy.rs
@@ -10,7 +10,7 @@ use identity::account::IdentitySetup;
use identity::account::Result;
use identity::core::Url;
use identity::iota::ExplorerUrl;
-use identity::iota::IotaDID;
+use identity::iota_core::IotaDID;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/examples/account/manipulate_did.rs b/examples/account/manipulate_did.rs
index 95ccdbe7b5..b9fe007e0e 100644
--- a/examples/account/manipulate_did.rs
+++ b/examples/account/manipulate_did.rs
@@ -12,7 +12,7 @@ use identity::account::Result;
use identity::core::Url;
use identity::did::MethodRelationship;
use identity::iota::ExplorerUrl;
-use identity::iota::IotaDID;
+use identity::iota_core::IotaDID;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/examples/account/multiple_identities.rs b/examples/account/multiple_identities.rs
index 53909547b0..789aa1aaa6 100644
--- a/examples/account/multiple_identities.rs
+++ b/examples/account/multiple_identities.rs
@@ -11,7 +11,7 @@ use identity::account::AccountStorage;
use identity::account::IdentitySetup;
use identity::account::Result;
use identity::iota::ExplorerUrl;
-use identity::iota::IotaDID;
+use identity::iota_core::IotaDID;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/examples/account/signing.rs b/examples/account/signing.rs
index 681734cb70..07f7977034 100644
--- a/examples/account/signing.rs
+++ b/examples/account/signing.rs
@@ -19,8 +19,8 @@ use identity::crypto::SignatureOptions;
use identity::did::verifiable::VerifierOptions;
use identity::did::DID;
use identity::iota::ExplorerUrl;
-use identity::iota::IotaDID;
use identity::iota::ResolvedIotaDocument;
+use identity::iota_core::IotaDID;
#[tokio::main]
async fn main() -> Result<()> {
diff --git a/examples/account/unchecked.rs b/examples/account/unchecked.rs
index e94484f581..42503e8585 100644
--- a/examples/account/unchecked.rs
+++ b/examples/account/unchecked.rs
@@ -11,7 +11,7 @@ use identity::account::IdentitySetup;
use identity::account::Result;
use identity::core::Timestamp;
use identity::iota::ExplorerUrl;
-use identity::iota::IotaDID;
+use identity::iota_core::IotaDID;
use identity::prelude::IotaDocument;
#[tokio::main]
diff --git a/examples/low-level-api/common.rs b/examples/low-level-api/common.rs
index 7a70bd3d3c..0ae348d73f 100644
--- a/examples/low-level-api/common.rs
+++ b/examples/low-level-api/common.rs
@@ -8,17 +8,14 @@
use identity::core::json;
use identity::core::FromJson;
use identity::core::Timestamp;
-
use identity::core::Url;
use identity::credential::Credential;
use identity::credential::CredentialBuilder;
use identity::credential::Subject;
-
use identity::did::MethodScope;
use identity::did::DID;
-
-use identity::iota::IotaVerificationMethod;
use identity::iota::Receipt;
+use identity::iota_core::IotaVerificationMethod;
use identity::prelude::*;
/// Helper that takes two DID Documents (identities) for issuer and subject, and
diff --git a/examples/low-level-api/diff_chain.rs b/examples/low-level-api/diff_chain.rs
index d4eedd17a4..6786ccda11 100644
--- a/examples/low-level-api/diff_chain.rs
+++ b/examples/low-level-api/diff_chain.rs
@@ -12,10 +12,10 @@ use identity::core::Timestamp;
use identity::core::ToJson;
use identity::did::Service;
use identity::did::DID;
-use identity::iota::DiffMessage;
use identity::iota::ExplorerUrl;
-use identity::iota::IotaService;
use identity::iota::Receipt;
+use identity::iota_core::DiffMessage;
+use identity::iota_core::IotaService;
use identity::prelude::*;
mod create_did;
diff --git a/examples/low-level-api/manipulate_did.rs b/examples/low-level-api/manipulate_did.rs
index af0d02ef1d..ce78667580 100644
--- a/examples/low-level-api/manipulate_did.rs
+++ b/examples/low-level-api/manipulate_did.rs
@@ -13,9 +13,9 @@ use identity::did::MethodScope;
use identity::did::Service;
use identity::did::DID;
use identity::iota::ExplorerUrl;
-use identity::iota::IotaService;
-use identity::iota::IotaVerificationMethod;
use identity::iota::Receipt;
+use identity::iota_core::IotaService;
+use identity::iota_core::IotaVerificationMethod;
use identity::prelude::*;
mod create_did;
diff --git a/examples/low-level-api/merkle_key.rs b/examples/low-level-api/merkle_key.rs
index 06c18426db..2266a6fec7 100644
--- a/examples/low-level-api/merkle_key.rs
+++ b/examples/low-level-api/merkle_key.rs
@@ -5,13 +5,6 @@
//!
//! cargo run --example merkle_key
-use identity::iota::CredentialValidationOptions;
-use identity::iota::CredentialValidator;
-use identity::iota::Resolver;
-
-use rand::rngs::OsRng;
-use rand::Rng;
-
use identity::core::Timestamp;
use identity::credential::Credential;
use identity::crypto::merkle_key::Sha256;
@@ -20,11 +13,15 @@ use identity::crypto::KeyCollection;
use identity::crypto::PrivateKey;
use identity::crypto::PublicKey;
use identity::did::MethodScope;
-
-use identity::iota::IotaDID;
-use identity::iota::IotaVerificationMethod;
+use identity::iota::CredentialValidationOptions;
+use identity::iota::CredentialValidator;
use identity::iota::Receipt;
+use identity::iota::Resolver;
+use identity::iota_core::IotaDID;
+use identity::iota_core::IotaVerificationMethod;
use identity::prelude::*;
+use rand::rngs::OsRng;
+use rand::Rng;
mod common;
mod create_did;
diff --git a/examples/low-level-api/private_tangle.rs b/examples/low-level-api/private_tangle.rs
index bd50c80581..9175a3006e 100644
--- a/examples/low-level-api/private_tangle.rs
+++ b/examples/low-level-api/private_tangle.rs
@@ -12,8 +12,8 @@
use identity::iota::ClientBuilder;
use identity::iota::DIDMessageEncoding;
use identity::iota::ExplorerUrl;
-use identity::iota::Network;
use identity::iota::Receipt;
+use identity::iota_core::Network;
use identity::prelude::*;
#[tokio::main]
diff --git a/examples/low-level-api/resolution.rs b/examples/low-level-api/resolution.rs
index 34966bd939..2743330d57 100644
--- a/examples/low-level-api/resolution.rs
+++ b/examples/low-level-api/resolution.rs
@@ -16,9 +16,9 @@ use identity::did::resolution::Resource;
use identity::did::resolution::SecondaryResource;
use identity::did::CoreDID;
use identity::did::DID;
-use identity::iota::IotaDID;
-use identity::iota::IotaDIDUrl;
use identity::iota::Receipt;
+use identity::iota_core::IotaDID;
+use identity::iota_core::IotaDIDUrl;
use identity::prelude::*;
mod create_did;
diff --git a/examples/low-level-api/resolve_history.rs b/examples/low-level-api/resolve_history.rs
index d88b1d2412..eddbe309d9 100644
--- a/examples/low-level-api/resolve_history.rs
+++ b/examples/low-level-api/resolve_history.rs
@@ -15,13 +15,13 @@ use identity::did::Service;
use identity::did::DID;
use identity::iota::ChainHistory;
use identity::iota::Client;
-use identity::iota::DiffMessage;
use identity::iota::DocumentHistory;
-use identity::iota::IotaDocument;
-use identity::iota::IotaService;
-use identity::iota::IotaVerificationMethod;
use identity::iota::Receipt;
use identity::iota::Result;
+use identity::iota_core::DiffMessage;
+use identity::iota_core::IotaDocument;
+use identity::iota_core::IotaService;
+use identity::iota_core::IotaVerificationMethod;
mod create_did;
diff --git a/examples/low-level-api/revoke_vc.rs b/examples/low-level-api/revoke_vc.rs
index e54e55c818..6de991d8b2 100644
--- a/examples/low-level-api/revoke_vc.rs
+++ b/examples/low-level-api/revoke_vc.rs
@@ -21,11 +21,11 @@ use identity::did::DID;
use identity::iota::CredentialValidationOptions;
use identity::iota::CredentialValidator;
use identity::iota::ExplorerUrl;
-use identity::iota::IotaVerificationMethod;
use identity::iota::Receipt;
use identity::iota::Resolver;
use identity::iota::Result;
+use identity::iota_core::IotaVerificationMethod;
use identity::prelude::*;
mod common;
diff --git a/identity-account-storage/Cargo.toml b/identity-account-storage/Cargo.toml
new file mode 100644
index 0000000000..c1b65697e8
--- /dev/null
+++ b/identity-account-storage/Cargo.toml
@@ -0,0 +1,56 @@
+[package]
+name = "identity-account-storage"
+version = "0.5.0-dev.4"
+authors = ["IOTA Stiftung"]
+edition = "2021"
+homepage = "https://www.iota.org"
+keywords = ["iota", "tangle", "identity"]
+license = "Apache-2.0"
+readme = "../README.md"
+repository = "https://github.com/iotaledger/identity.rs"
+description = "Secure storage for Decentralized Identifiers and Verifiable Credentials."
+
+[dependencies]
+actix = { version = "0.12.0", optional = true }
+async-trait = { version = "0.1", default-features = false }
+futures = { version = "0.3", optional = true }
+hashbrown = { version = "0.11", features = ["serde"] }
+identity-core = { version = "=0.5.0-dev.4", path = "../identity-core", default-features = false }
+identity-did = { version = "=0.5.0-dev.4", path = "../identity-did", default-features = false }
+identity-iota-core = { version = "=0.5.0-dev.4", path = "../identity-iota-core", default-features = false }
+once_cell = { version = "1.7", default-features = false, features = ["std"] }
+parking_lot = { version = "0.12" }
+serde = { version = "1.0", default-features = false, features = ["alloc", "derive"] }
+strum = { version = "0.24.0", default-features = false, features = ["std", "derive"] }
+thiserror = { version = "1.0" }
+tokio = { version = "1.17.0", default-features = false, features = ["sync"], optional = true }
+zeroize = { version = "1.4" }
+
+[dependencies.iota-crypto]
+version = "0.7"
+features = ["blake2b", "ed25519", "hmac", "pbkdf", "sha", "slip10", "std"]
+
+[dependencies.iota_stronghold]
+git = "https://github.com/iotaledger/stronghold.rs"
+rev = "969df405661ba4977f2cf30e9909cef7e30cefa2"
+optional = true
+
+[dependencies.stronghold_engine]
+git = "https://github.com/iotaledger/stronghold.rs"
+rev = "969df405661ba4977f2cf30e9909cef7e30cefa2"
+optional = true
+
+[dev-dependencies]
+rand = { version = "0.8" }
+rusty-fork = { version = "0.3" }
+tokio = { version = "1.17.0", default-features = false, features = ["macros", "rt", "rt-multi-thread", "sync"] }
+
+[features]
+default = ["stronghold"]
+stronghold = [
+ "iota_stronghold",
+ "stronghold_engine",
+ "actix",
+ "tokio/rt-multi-thread",
+ "futures",
+]
diff --git a/identity-account/src/crypto/mod.rs b/identity-account-storage/src/crypto/mod.rs
similarity index 67%
rename from identity-account/src/crypto/mod.rs
rename to identity-account-storage/src/crypto/mod.rs
index 48e4e90f23..a08fb953c6 100644
--- a/identity-account/src/crypto/mod.rs
+++ b/identity-account-storage/src/crypto/mod.rs
@@ -1,4 +1,4 @@
-// Copyright 2020-2021 IOTA Stiftung
+// Copyright 2020-2022 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
mod remote;
diff --git a/identity-account/src/crypto/remote.rs b/identity-account-storage/src/crypto/remote.rs
similarity index 97%
rename from identity-account/src/crypto/remote.rs
rename to identity-account-storage/src/crypto/remote.rs
index 1925996a68..63a9000f22 100644
--- a/identity-account/src/crypto/remote.rs
+++ b/identity-account-storage/src/crypto/remote.rs
@@ -1,4 +1,4 @@
-// Copyright 2020-2021 IOTA Stiftung
+// Copyright 2020-2022 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
use core::marker::PhantomData;
@@ -14,7 +14,7 @@ use identity_core::crypto::SignatureValue;
use identity_core::error::Error;
use identity_core::error::Result;
use identity_core::utils::encode_b58;
-use identity_iota::did::IotaDID;
+use identity_iota_core::did::IotaDID;
use crate::storage::Storage;
use crate::types::KeyLocation;
diff --git a/identity-account-storage/src/error.rs b/identity-account-storage/src/error.rs
new file mode 100644
index 0000000000..dec31777bf
--- /dev/null
+++ b/identity-account-storage/src/error.rs
@@ -0,0 +1,60 @@
+// Copyright 2020-2022 IOTA Stiftung
+// SPDX-License-Identifier: Apache-2.0
+
+//! Errors that may occur when working with Identity Accounts.
+
+/// Alias for a `Result` with the error type [`Error`].
+pub type Result = ::core::result::Result;
+
+/// This type represents all possible errors that can occur in the library.
+#[derive(Debug, thiserror::Error, strum::IntoStaticStr)]
+pub enum Error {
+ /// Caused by errors from the [identity_core] crate.
+ #[error(transparent)]
+ CoreError(#[from] identity_core::Error),
+ /// Caused by errors from the [identity_did] crate.
+ #[error(transparent)]
+ DIDError(#[from] identity_did::Error),
+ /// Caused by attempting to perform an invalid IO operation.
+ #[error(transparent)]
+ IoError(#[from] std::io::Error),
+ /// Caused by errors from the [iota_stronghold] crate.
+ #[cfg(feature = "stronghold")]
+ #[error(transparent)]
+ StrongholdError(#[from] crate::stronghold::StrongholdError),
+
+ /// Caused by attempting to increment a generation above the maximum value.
+ #[error("Generation overflow")]
+ GenerationOverflow,
+ /// Caused by attempting to decrement a generation below the minimum value.
+ #[error("Generation underflow")]
+ GenerationUnderflow,
+ /// Caused by providing bytes that cannot be used as a private key of the
+ /// [`KeyType`][identity_core::crypto::KeyType].
+ #[error("Invalid Private Key: {0}")]
+ InvalidPrivateKey(String),
+ /// Caused by attempting to find a key in storage that does not exist.
+ #[error("key not found")]
+ KeyNotFound,
+ /// Caused by attempting to find an identity key vault that does not exist.
+ #[error("Key vault not found")]
+ KeyVaultNotFound,
+ /// Caused by attempting to read a poisoned shared resource.
+ #[error("Shared resource poisoned: read")]
+ SharedReadPoisoned,
+ /// Caused by attempting to write a poisoned shared resource.
+ #[error("Shared resource poisoned: write")]
+ SharedWritePoisoned,
+}
+
+#[doc(hidden)]
+pub trait PleaseDontMakeYourOwnResult {
+ #[allow(clippy::wrong_self_convention)]
+ fn to_result(self) -> Result;
+}
+
+impl From for Error {
+ fn from(error: identity_did::did::DIDError) -> Self {
+ identity_did::Error::from(error).into()
+ }
+}
diff --git a/identity-account/src/identity/chain_state.rs b/identity-account-storage/src/identity/chain_state.rs
similarity index 92%
rename from identity-account/src/identity/chain_state.rs
rename to identity-account-storage/src/identity/chain_state.rs
index 30fd554f4b..20cd82c265 100644
--- a/identity-account/src/identity/chain_state.rs
+++ b/identity-account-storage/src/identity/chain_state.rs
@@ -1,11 +1,11 @@
-// Copyright 2020-2021 IOTA Stiftung
+// Copyright 2020-2022 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
+use identity_iota_core::tangle::MessageId;
+use identity_iota_core::tangle::MessageIdExt;
+use serde::Deserialize;
use serde::Serialize;
-use identity_iota::tangle::MessageId;
-use identity_iota::tangle::MessageIdExt;
-
/// Holds the last published message ids of the integration and diff chains.
#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub struct ChainState {
diff --git a/identity-account/src/identity/identity_state.rs b/identity-account-storage/src/identity/identity_state.rs
similarity index 95%
rename from identity-account/src/identity/identity_state.rs
rename to identity-account-storage/src/identity/identity_state.rs
index e1d1fb2240..3fb308f207 100644
--- a/identity-account/src/identity/identity_state.rs
+++ b/identity-account-storage/src/identity/identity_state.rs
@@ -1,17 +1,17 @@
-// Copyright 2020-2021 IOTA Stiftung
+// Copyright 2020-2022 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
use hashbrown::HashMap;
-use serde::Serialize;
-
use identity_core::common::Fragment;
use identity_core::crypto::SetSignature;
use identity_core::crypto::SignatureOptions;
use identity_did::did::DID;
use identity_did::verification::MethodType;
-use identity_iota::did::IotaDID;
-use identity_iota::did::IotaDIDUrl;
-use identity_iota::document::IotaDocument;
+use identity_iota_core::did::IotaDID;
+use identity_iota_core::did::IotaDIDUrl;
+use identity_iota_core::document::IotaDocument;
+use serde::Deserialize;
+use serde::Serialize;
use crate::crypto::RemoteEd25519;
use crate::crypto::RemoteKey;
diff --git a/identity-account-storage/src/identity/mod.rs b/identity-account-storage/src/identity/mod.rs
new file mode 100644
index 0000000000..75aa222865
--- /dev/null
+++ b/identity-account-storage/src/identity/mod.rs
@@ -0,0 +1,8 @@
+// Copyright 2020-2022 IOTA Stiftung
+// SPDX-License-Identifier: Apache-2.0
+
+mod chain_state;
+mod identity_state;
+
+pub use self::chain_state::*;
+pub use self::identity_state::*;
diff --git a/identity-account-storage/src/lib.rs b/identity-account-storage/src/lib.rs
new file mode 100644
index 0000000000..87575428c6
--- /dev/null
+++ b/identity-account-storage/src/lib.rs
@@ -0,0 +1,28 @@
+// Copyright 2020-2022 IOTA Stiftung
+// SPDX-License-Identifier: Apache-2.0
+
+#![forbid(unsafe_code)]
+#![allow(clippy::upper_case_acronyms)]
+#![warn(
+ rust_2018_idioms,
+ unreachable_pub,
+ // missing_docs,
+ // rustdoc::missing_crate_level_docs,
+ rustdoc::broken_intra_doc_links,
+ rustdoc::private_intra_doc_links,
+ rustdoc::private_doc_tests,
+ clippy::missing_safety_doc,
+ // clippy::missing_errors_doc
+)]
+
+pub mod crypto;
+pub mod error;
+pub mod identity;
+pub mod storage;
+#[cfg(feature = "stronghold")]
+pub mod stronghold;
+pub mod types;
+pub mod utils;
+
+pub use self::error::Error;
+pub use self::error::Result;
diff --git a/identity-account/src/storage/memstore.rs b/identity-account-storage/src/storage/memstore.rs
similarity index 98%
rename from identity-account/src/storage/memstore.rs
rename to identity-account-storage/src/storage/memstore.rs
index 6e9b84568b..6cf346617a 100644
--- a/identity-account/src/storage/memstore.rs
+++ b/identity-account-storage/src/storage/memstore.rs
@@ -1,4 +1,4 @@
-// Copyright 2020-2021 IOTA Stiftung
+// Copyright 2020-2022 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
use core::fmt::Debug;
@@ -13,7 +13,7 @@ use identity_core::crypto::PrivateKey;
use identity_core::crypto::PublicKey;
use identity_core::crypto::Sign;
use identity_did::verification::MethodType;
-use identity_iota::did::IotaDID;
+use identity_iota_core::did::IotaDID;
use std::convert::TryFrom;
use std::sync::RwLockReadGuard;
use std::sync::RwLockWriteGuard;
diff --git a/identity-account/src/storage/mod.rs b/identity-account-storage/src/storage/mod.rs
similarity index 85%
rename from identity-account/src/storage/mod.rs
rename to identity-account-storage/src/storage/mod.rs
index e8a12f17bc..ac2b990f8a 100644
--- a/identity-account/src/storage/mod.rs
+++ b/identity-account-storage/src/storage/mod.rs
@@ -1,4 +1,4 @@
-// Copyright 2020-2021 IOTA Stiftung
+// Copyright 2020-2022 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
mod memstore;
diff --git a/identity-account/src/storage/stronghold.rs b/identity-account-storage/src/storage/stronghold.rs
similarity index 99%
rename from identity-account/src/storage/stronghold.rs
rename to identity-account-storage/src/storage/stronghold.rs
index 1d8f58e151..f62a5f47fc 100644
--- a/identity-account/src/storage/stronghold.rs
+++ b/identity-account-storage/src/storage/stronghold.rs
@@ -9,7 +9,7 @@ use identity_core::crypto::PrivateKey;
use identity_core::crypto::PublicKey;
use identity_did::did::DID;
use identity_did::verification::MethodType;
-use identity_iota::did::IotaDID;
+use identity_iota_core::did::IotaDID;
use iota_stronghold::procedures::Chain;
use iota_stronghold::procedures::Ed25519Sign;
use iota_stronghold::procedures::Slip10Derive;
diff --git a/identity-account/src/storage/traits.rs b/identity-account-storage/src/storage/traits.rs
similarity index 98%
rename from identity-account/src/storage/traits.rs
rename to identity-account-storage/src/storage/traits.rs
index c547e0ef42..24993ef650 100644
--- a/identity-account/src/storage/traits.rs
+++ b/identity-account-storage/src/storage/traits.rs
@@ -1,10 +1,10 @@
-// Copyright 2020-2021 IOTA Stiftung
+// Copyright 2020-2022 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
use core::fmt::Debug;
use identity_core::crypto::PrivateKey;
use identity_core::crypto::PublicKey;
-use identity_iota::did::IotaDID;
+use identity_iota_core::did::IotaDID;
use crate::error::Result;
use crate::identity::ChainState;
diff --git a/identity-account/src/stronghold/context.rs b/identity-account-storage/src/stronghold/context.rs
similarity index 100%
rename from identity-account/src/stronghold/context.rs
rename to identity-account-storage/src/stronghold/context.rs
diff --git a/identity-account/src/stronghold/error.rs b/identity-account-storage/src/stronghold/error.rs
similarity index 93%
rename from identity-account/src/stronghold/error.rs
rename to identity-account-storage/src/stronghold/error.rs
index bd9b5df1c7..5042448e5e 100644
--- a/identity-account/src/stronghold/error.rs
+++ b/identity-account-storage/src/stronghold/error.rs
@@ -1,8 +1,6 @@
// Copyright 2020-2022 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
-use iota_stronghold::procedures::ProcedureError;
-
pub type IotaStrongholdResult = Result;
/// Caused by errors from the [`iota_stronghold`] crate.
@@ -18,12 +16,13 @@ pub enum StrongholdError {
StrongholdFatalEngineError(#[from] iota_stronghold::FatalEngineError),
#[error(transparent)]
StrongholdMailboxError(#[from] iota_stronghold::MailboxError),
+ /// Caused by receiving an unexpected return value from a Stronghold procedure.
+ #[error("Stronghold procedure returned unexpected type")]
+ StrongholdProcedureFailure(#[from] iota_stronghold::procedures::ProcedureError),
/// Caused by attempting to perform an invalid IO operation.
#[error(transparent)]
IoError(#[from] std::io::Error),
- /// Caused by receiving an unexpected return value from a Stronghold procedure.
- #[error("Stronghold procedure returned unexpected type")]
- StrongholdProcedureFailure(#[from] ProcedureError),
+
/// Caused by attempting to access a Stronghold snapshot without a password.
#[error("Stronghold snapshot password not found")]
StrongholdPasswordNotSet,
diff --git a/identity-account/src/stronghold/hint.rs b/identity-account-storage/src/stronghold/hint.rs
similarity index 100%
rename from identity-account/src/stronghold/hint.rs
rename to identity-account-storage/src/stronghold/hint.rs
diff --git a/identity-account/src/stronghold/mod.rs b/identity-account-storage/src/stronghold/mod.rs
similarity index 90%
rename from identity-account/src/stronghold/mod.rs
rename to identity-account-storage/src/stronghold/mod.rs
index ff8ef78225..80c5594faf 100644
--- a/identity-account/src/stronghold/mod.rs
+++ b/identity-account-storage/src/stronghold/mod.rs
@@ -1,4 +1,4 @@
-// Copyright 2020-2021 IOTA Stiftung
+// Copyright 2020-2022 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0
mod context;
diff --git a/identity-account/src/stronghold/records.rs b/identity-account-storage/src/stronghold/records.rs
similarity index 98%
rename from identity-account/src/stronghold/records.rs
rename to identity-account-storage/src/stronghold/records.rs
index bd06db0cf8..6392d96f7d 100644
--- a/identity-account/src/stronghold/records.rs
+++ b/identity-account-storage/src/stronghold/records.rs
@@ -57,14 +57,14 @@ impl Records<'_> {
}
pub async fn all(&self) -> IotaStrongholdResult>>> {
- Ok(self.index().await?.load_all(&self.store).await?)
+ self.index().await?.load_all(&self.store).await
}
pub async fn get(&self, record_id: &[u8]) -> IotaStrongholdResult