diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index a2694c4a22..af86ec8926 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -20,6 +20,7 @@ jobs: matrix: project: [ + identity, identity-core, identity-credential, identity-did, diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml index 5df557fe7f..299d923eab 100644 --- a/.github/workflows/clippy.yml +++ b/.github/workflows/clippy.yml @@ -20,6 +20,7 @@ jobs: matrix: project: [ + identity, identity-core, identity-credential, identity-did, diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 2453f5553d..c146e7ca29 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -20,6 +20,7 @@ jobs: matrix: project: [ + identity, identity-core, identity-credential, identity-did, diff --git a/Cargo.toml b/Cargo.toml index 20230f44db..923777665e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] members = [ + "identity", "identity-core", "identity-credential", "identity-did", diff --git a/examples/Cargo.toml b/examples/Cargo.toml index 9d2cc3b083..504e811308 100644 --- a/examples/Cargo.toml +++ b/examples/Cargo.toml @@ -5,10 +5,7 @@ edition = "2018" publish = false [dependencies] -identity-core = { path = "../identity-core" } -identity-credential = { path = "../identity-credential" } -identity-did = { path = "../identity-did" } -identity-iota = { path = "../identity-iota" } +identity = { path = "../identity" } smol = { version = "0.1.18", features = ["tokio02"] } smol-potat = { version = "0.3" } diff --git a/examples/credential.rs b/examples/credential.rs index 8cdf742919..be77118d6b 100644 --- a/examples/credential.rs +++ b/examples/credential.rs @@ -7,23 +7,23 @@ //! //! cargo run --example credential -use identity_core::common::Url; -use identity_core::common::Value; -use identity_core::convert::FromJson; -use identity_core::convert::ToJson; -use identity_core::crypto::KeyPair; -use identity_core::json; -use identity_credential::credential::CredentialBuilder; -use identity_credential::credential::Credential; -use identity_credential::credential::Subject; -use identity_credential::credential::VerifiableCredential; -use identity_did::did::DID; -use identity_did::verification::MethodScope; -use identity_iota::client::Client; -use identity_iota::credential::CredentialValidation; -use identity_iota::credential::CredentialValidator; -use identity_iota::did::IotaDocument; -use identity_iota::error::Result; +use identity::core::json; +use identity::core::FromJson; +use identity::core::ToJson; +use identity::core::Url; +use identity::core::Value; +use identity::credential::Credential; +use identity::credential::CredentialBuilder; +use identity::credential::Subject; +use identity::credential::VerifiableCredential; +use identity::crypto::KeyPair; +use identity::did::MethodScope; +use identity::did::DID; +use identity::iota::Client; +use identity::iota::CredentialValidation; +use identity::iota::CredentialValidator; +use identity::iota::IotaDocument; +use identity::iota::Result; // A helper function to generate and new DID Document/KeyPair, sign the // document, publish it to the Tangle, and return the Document/KeyPair. diff --git a/examples/diff_chain.rs b/examples/diff_chain.rs index d278ea6d33..602de58c1f 100644 --- a/examples/diff_chain.rs +++ b/examples/diff_chain.rs @@ -6,21 +6,20 @@ //! //! cargo run --example diff_chain -use identity_core::crypto::KeyPair; -use identity_did::verification::MethodBuilder; -use identity_did::verification::MethodData; -use identity_did::verification::MethodRef; -use identity_did::verification::MethodScope; -use identity_did::verification::MethodType; -use identity_iota::chain::AuthChain; -use identity_iota::chain::DocumentChain; -use identity_iota::client::Client; -use identity_iota::client::ClientBuilder; -use identity_iota::client::Network; -use identity_iota::did::DocumentDiff; -use identity_iota::did::IotaDocument; -use identity_iota::error::Result; -use identity_iota::tangle::MessageId; +use identity::crypto::KeyPair; +use identity::did::MethodBuilder; +use identity::did::MethodData; +use identity::did::MethodRef; +use identity::did::MethodType; +use identity::iota::AuthChain; +use identity::iota::Client; +use identity::iota::ClientBuilder; +use identity::iota::DocumentChain; +use identity::iota::DocumentDiff; +use identity::iota::IotaDocument; +use identity::iota::MessageId; +use identity::iota::Network; +use identity::iota::Result; use std::thread::sleep; use std::time::Duration; diff --git a/examples/resolution.rs b/examples/resolution.rs index 86a2b2acbe..0d0f819195 100644 --- a/examples/resolution.rs +++ b/examples/resolution.rs @@ -6,15 +6,15 @@ //! //! cargo run --example resolution -use identity_core::crypto::KeyPair; -use identity_did::resolution::dereference; -use identity_did::resolution::resolve; -use identity_did::resolution::Dereference; -use identity_did::resolution::Resolution; -use identity_iota::client::Client; -use identity_iota::did::IotaDID; -use identity_iota::did::IotaDocument; -use identity_iota::error::Result; +use identity::crypto::KeyPair; +use identity::did::resolution::dereference; +use identity::did::resolution::resolve; +use identity::did::resolution::Dereference; +use identity::did::resolution::Resolution; +use identity::iota::Client; +use identity::iota::IotaDID; +use identity::iota::IotaDocument; +use identity::iota::Result; #[smol_potat::main] async fn main() -> Result<()> { diff --git a/identity-credential/src/credential/builder.rs b/identity-credential/src/credential/builder.rs index 41b128cd9d..2f01eee330 100644 --- a/identity-credential/src/credential/builder.rs +++ b/identity-credential/src/credential/builder.rs @@ -199,8 +199,8 @@ mod tests { use serde_json::json; use serde_json::Value; - use crate::credential::CredentialBuilder; use crate::credential::Credential; + use crate::credential::CredentialBuilder; use crate::credential::Subject; fn subject() -> Subject { diff --git a/identity-credential/src/presentation/builder.rs b/identity-credential/src/presentation/builder.rs index 2033688b1e..a7bd2411e3 100644 --- a/identity-credential/src/presentation/builder.rs +++ b/identity-credential/src/presentation/builder.rs @@ -139,21 +139,21 @@ mod tests { use identity_core::crypto::KeyPair; use identity_core::utils::encode_b58; use identity_did::did::DID; - use identity_did::document::DocumentBuilder; use identity_did::document::Document; - use identity_did::verification::MethodBuilder; + use identity_did::document::DocumentBuilder; use identity_did::verification::Method; + use identity_did::verification::MethodBuilder; use identity_did::verification::MethodData; use identity_did::verification::MethodType; use serde_json::json; use serde_json::Value; - use crate::credential::CredentialBuilder; use crate::credential::Credential; + use crate::credential::CredentialBuilder; use crate::credential::Subject; use crate::credential::VerifiableCredential; - use crate::presentation::PresentationBuilder; use crate::presentation::Presentation; + use crate::presentation::PresentationBuilder; fn subject() -> Subject { let json: Value = json!({ diff --git a/identity-did/src/document/document.rs b/identity-did/src/document/document.rs index 7e4cb2c5f1..45a20be11b 100644 --- a/identity-did/src/document/document.rs +++ b/identity-did/src/document/document.rs @@ -334,10 +334,10 @@ impl ResolveMethod for Document { #[cfg(test)] mod tests { use crate::did::DID; - use crate::document::DocumentBuilder; use crate::document::Document; - use crate::verification::MethodBuilder; + use crate::document::DocumentBuilder; use crate::verification::Method; + use crate::verification::MethodBuilder; use crate::verification::MethodData; use crate::verification::MethodScope; use crate::verification::MethodType; diff --git a/identity-iota/src/did/document_builder.rs b/identity-iota/src/did/document_builder.rs index 782cea7d85..9e71cbe14b 100644 --- a/identity-iota/src/did/document_builder.rs +++ b/identity-iota/src/did/document_builder.rs @@ -4,8 +4,8 @@ use identity_core::crypto::KeyPair; use identity_did::document::DocumentBuilder; use identity_did::verifiable::Document as VerifiableDocument; -use identity_did::verification::MethodBuilder; use identity_did::verification::Method; +use identity_did::verification::MethodBuilder; use identity_did::verification::MethodData; use identity_did::verification::MethodType; diff --git a/identity/Cargo.toml b/identity/Cargo.toml new file mode 100644 index 0000000000..a85dec0c8f --- /dev/null +++ b/identity/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "identity" +version = "0.1.0" +authors = ["IOTA Identity"] +edition = "2018" +description = "Tools for working with Self-sovereign Identity." +readme = "../README.md" +repository = "https://github.com/iotaledger/identity.rs" +license = "Apache-2.0" +keywords = ["iota", "tangle", "identity"] +homepage = "https://www.iota.org" + +[dependencies] +identity-core = { version = "=0.1.0", path = "../identity-core" } +identity-credential = { version = "=0.1.0", path = "../identity-credential" } +identity-did = { version = "=0.1.0", path = "../identity-did" } +identity-iota = { version = "=0.1.0", path = "../identity-iota" } diff --git a/identity/src/lib.rs b/identity/src/lib.rs new file mode 100644 index 0000000000..d7382f1cee --- /dev/null +++ b/identity/src/lib.rs @@ -0,0 +1,50 @@ +// Copyright 2020-2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +pub mod core { + pub use identity_core::common::*; + pub use identity_core::convert::*; + pub use identity_core::error::*; + pub use identity_core::utils::*; + + #[doc(inline)] + pub use identity_core::diff; + + #[doc(inline)] + pub use identity_core::json; +} + +pub mod crypto { + pub use identity_core::crypto::*; +} + +pub mod credential { + pub use identity_credential::credential::*; + pub use identity_credential::error::*; + pub use identity_credential::presentation::*; +} + +pub mod did { + pub use identity_did::document::*; + pub use identity_did::error::*; + pub use identity_did::service::*; + pub use identity_did::utils::*; + pub use identity_did::verification::*; + + pub use identity_did::did::did; + pub use identity_did::did::Error as DIDError; + pub use identity_did::did::DID; + + pub use identity_did::resolution; + pub use identity_did::verifiable; +} + +pub mod iota { + pub use identity_iota::chain::*; + pub use identity_iota::client::*; + pub use identity_iota::credential::*; + pub use identity_iota::did::*; + pub use identity_iota::error::*; + pub use identity_iota::tangle::*; + pub use identity_iota::utils::*; +}