Skip to content

Commit

Permalink
Re-export everything through identity crate
Browse files Browse the repository at this point in the history
  • Loading branch information
l1h3r committed Feb 2, 2021
1 parent c18f869 commit 1e3ec2f
Show file tree
Hide file tree
Showing 14 changed files with 120 additions and 53 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
matrix:
project:
[
identity,
identity-core,
identity-credential,
identity-did,
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/clippy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
matrix:
project:
[
identity,
identity-core,
identity-credential,
identity-did,
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
matrix:
project:
[
identity,
identity-core,
identity-credential,
identity-did,
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[workspace]
members = [
"identity",
"identity-core",
"identity-credential",
"identity-did",
Expand Down
5 changes: 1 addition & 4 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand Down
34 changes: 17 additions & 17 deletions examples/credential.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
29 changes: 14 additions & 15 deletions examples/diff_chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
18 changes: 9 additions & 9 deletions examples/resolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<()> {
Expand Down
2 changes: 1 addition & 1 deletion identity-credential/src/credential/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions identity-credential/src/presentation/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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!({
Expand Down
4 changes: 2 additions & 2 deletions identity-did/src/document/document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,10 @@ impl<T, U, V> ResolveMethod<U> for Document<T, U, V> {
#[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;
Expand Down
2 changes: 1 addition & 1 deletion identity-iota/src/did/document_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
17 changes: 17 additions & 0 deletions identity/Cargo.toml
Original file line number Diff line number Diff line change
@@ -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" }
50 changes: 50 additions & 0 deletions identity/src/lib.rs
Original file line number Diff line number Diff line change
@@ -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::*;
}

0 comments on commit 1e3ec2f

Please sign in to comment.