diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 3276faad..88bcfbdb 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -16,10 +16,6 @@ exclude = [ "/tests" ] -[features] -default = ["ring"] -ring = ["ssi/ring"] - [dependencies] chrono = { version = "0.4", features = ["serde"] } tokio = { version = "1.0", features = ["macros", "rt-multi-thread"] } @@ -27,11 +23,6 @@ didkit = { version = "0.4", path = "../lib", features = ["http-did"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" clap = { version = "3.0", features = ["derive", "env"] } -did-method-key = { version = "0.1", path = "../../ssi/did-key" } -ssi = { version = "0.4", path = "../../ssi", default-features = false } -thiserror = "1.0" -bytes = "1.0" -base64 = "0.12" sshkeys = "0.3" anyhow = "1.0" diff --git a/cli/src/main.rs b/cli/src/main.rs index c8ccdce1..222791a0 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -11,18 +11,19 @@ use serde::Serialize; use serde_json::Value; use sshkeys::PublicKey; -use did_method_key::DIDKey; -use didkit::generate_proof; use didkit::{ - dereference, get_verification_method, runtime, DIDCreate, DIDDeactivate, DIDDocumentOperation, - DIDMethod, DIDRecover, DIDResolver, DIDUpdate, DereferencingInputMetadata, Error, - LinkedDataProofOptions, Metadata, ProofFormat, ResolutionInputMetadata, ResolutionResult, - Source, VerifiableCredential, VerifiablePresentation, VerificationRelationship, DIDURL, - DID_METHODS, JWK, URI, + dereference, generate_proof, get_verification_method, runtime, + ssi::{ + self, + did::{DIDMethodTransaction, Service, ServiceEndpoint}, + one_or_many::OneOrMany, + }, + DIDCreate, DIDDeactivate, DIDDocumentOperation, DIDMethod, DIDRecover, DIDResolver, DIDUpdate, + DereferencingInputMetadata, Error, LinkedDataProofOptions, Metadata, ProofFormat, + ResolutionInputMetadata, ResolutionResult, Source, VerifiableCredential, + VerifiablePresentation, VerificationRelationship, DIDURL, DID_METHODS, JWK, URI, }; use didkit_cli::opts::ResolverOptions; -use ssi::did::{DIDMethodTransaction, Service, ServiceEndpoint}; -use ssi::one_or_many::OneOrMany; #[derive(StructOpt, Debug)] pub enum DIDKit { @@ -747,8 +748,8 @@ fn main() -> AResult<()> { // Deprecated in favor of KeyToDID eprintln!("didkit: use key-to-did instead of key-to-did-key"); let jwk = key.get_jwk(); - let did = DIDKey - .generate(&Source::Key(&jwk)) + let did = DID_METHODS + .generate(&Source::KeyAndPattern(&jwk, "key")) .ok_or(Error::UnableToGenerateDID) .unwrap(); println!("{}", did); diff --git a/cli/tests/cli.rs b/cli/tests/cli.rs index 40d70020..c64f62e0 100644 --- a/cli/tests/cli.rs +++ b/cli/tests/cli.rs @@ -2,6 +2,8 @@ use serde_json::Value; use std::io::Write; use std::process::{Command, Stdio}; +use didkit::ssi; + static BIN: &str = env!("CARGO_BIN_EXE_didkit"); const DID_KEY_K256: &'static str = "did:key:zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme"; diff --git a/http/Cargo.toml b/http/Cargo.toml index c7b8ef98..e7bcce1a 100644 --- a/http/Cargo.toml +++ b/http/Cargo.toml @@ -17,7 +17,6 @@ exclude = [ ] [features] -default = ["ring"] ring = ["ssi/ring"] [dependencies] diff --git a/lib/Cargo.toml b/lib/Cargo.toml index d9e48e44..09d011c1 100644 --- a/lib/Cargo.toml +++ b/lib/Cargo.toml @@ -19,13 +19,14 @@ include = [ ] [features] -default = ["w3c", "eip"] +default = ["w3c", "ed25519", "rsa", "ripemd-160", "eip", "tezos"] -w3c = ["ssi/w3c", "secp256k1", "secp256r1", "ed25519", "rsa"] -secp256k1 = ["ssi/secp256k1", "did-tz/secp256k1", "did-method-key/secp256k1", "did-ion/secp256k1"] -secp256r1 = ["ssi/secp256r1", "did-tz/secp256r1", "did-webkey/secp256r1", "did-method-key/secp256r1", "did-ion/secp256r1"] -ed25519 = ["ssi/ed25519", "did-tz/ed25519", "did-ion/ed25519"] -rsa = ["ssi/rsa", "did-ion/rsa"] +w3c = ["ssi/w3c"] +secp256k1 = ["ssi/secp256k1"] +secp256r1 = ["ssi/secp256r1"] +ed25519 = ["ssi/ed25519"] +rsa = ["ssi/rsa"] +ripemd-160 = ["ssi/ripemd-160"] aleo = ["ssi/aleo"] eip = ["ssi/eip"] @@ -34,14 +35,13 @@ solana = ["ssi/solana"] http-did = ["ssi/http-did"] -wasm = [] ring = ["ssi/ring"] openssl = ["ssi/openssl"] [dependencies] ssi = { version = "0.4", path = "../../ssi", default-features = false } did-method-key = { version = "^0.1.2", path = "../../ssi/did-key", default-features = false } -did-tz = { version = "^0.1.1", path = "../../ssi/did-tezos", default-features = false } +did-tz = { version = "^0.1.1", path = "../../ssi/did-tezos" } did-ethr = { version = "0.1", path = "../../ssi/did-ethr", default-features = false } did-pkh = { version = "0.1", path = "../../ssi/did-pkh", default-features = false } #did-sol = { version = "0.0.1", path = "../../ssi/did-sol" } diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 439eb9f4..40db7a62 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -1,12 +1,12 @@ -#[cfg(not(feature = "wasm"))] +#[cfg(not(target_arch = "wasm32"))] pub mod c; mod did_methods; pub mod error; -#[cfg(not(feature = "wasm"))] +#[cfg(not(target_arch = "wasm32"))] pub mod jni; -#[cfg(not(feature = "wasm"))] +#[cfg(not(target_arch = "wasm32"))] pub mod runtime; -#[cfg(not(any(feature = "wasm", target_os = "windows")))] +#[cfg(not(any(target_arch = "wasm32", target_os = "windows")))] pub mod ssh_agent; #[macro_use] @@ -14,10 +14,14 @@ extern crate lazy_static; pub use crate::did_methods::DID_METHODS; pub use crate::error::Error; + +pub use ssi; +pub use ssi::did::VerificationRelationship; pub use ssi::did::{ DIDCreate, DIDDeactivate, DIDDocumentOperation, DIDMethod, DIDRecover, DIDUpdate, Document, Source, DIDURL, }; +pub use ssi::did_resolve::resolve_key; #[cfg(feature = "http-did")] pub use ssi::did_resolve::HTTPDIDResolver; pub use ssi::did_resolve::{ @@ -27,7 +31,6 @@ pub use ssi::did_resolve::{ }; pub use ssi::jsonld::ContextLoader; pub use ssi::jwk::JWK; -pub use ssi::did_resolve::resolve_key; pub use ssi::ldp::ProofPreparation; pub use ssi::tzkey::jwk_from_tezos_key; pub use ssi::vc::get_verification_method; @@ -35,7 +38,6 @@ pub use ssi::vc::Credential as VerifiableCredential; pub use ssi::vc::CredentialOrJWT; pub use ssi::vc::LinkedDataProofOptions; pub use ssi::vc::Presentation as VerifiablePresentation; -pub use ssi::did::VerificationRelationship; pub use ssi::vc::VerificationResult; pub use ssi::vc::URI; pub use ssi::zcap::{Delegation, Invocation}; @@ -109,7 +111,7 @@ impl FromStr for ProofFormat { #[derive(thiserror::Error, Debug)] pub enum GenerateProofError { - #[cfg(not(any(feature = "wasm", target_os = "windows")))] + #[cfg(not(any(target_arch = "wasm32", target_os = "windows")))] #[error("Unable to sign: {0}")] Sign(#[from] crate::ssh_agent::SignError), #[error("SSI Linked Data Proof: {0}")] @@ -132,15 +134,15 @@ pub async fn generate_proof( ) -> Result { use ssi::ldp::LinkedDataProofs; let proof = match ssh_agent_sock_path_opt { - #[cfg(feature = "wasm")] - Some(sock_path) => { + #[cfg(target_arch = "wasm32")] + Some(_) => { return Err(GenerateProofError::NoWASM); } #[cfg(target_os = "windows")] - Some(sock_path) => { + Some(_) => { return Err(GenerateProofError::NoWindows); } - #[cfg(not(any(feature = "wasm", target_os = "windows")))] + #[cfg(not(any(target_arch = "wasm32", target_os = "windows")))] Some(sock_path) => { use tokio::net::UnixStream; let mut ssh_agent_sock = UnixStream::connect(sock_path).await?; diff --git a/lib/web/Cargo.toml b/lib/web/Cargo.toml index 05bb0a1c..82b4cda8 100644 --- a/lib/web/Cargo.toml +++ b/lib/web/Cargo.toml @@ -16,28 +16,6 @@ chrono = { version = "0.4", features = ["wasmbind"] } [dependencies.didkit] path = "../" -default-features = false -features = ["wasm", "w3c", "tezos", "eip"] - -# TODO remove dependency on ssi -[dependencies.ssi] -path = "../../../ssi" -default-features = false -features = ["w3c", "tezos", "eip"] - -[dependencies.did-method-key] -path = "../../../ssi/did-key" -default-features = false -features = ["secp256k1", "secp256r1"] - -[dependencies.did-tz] -path = "../../../ssi/did-tezos" -default-features = false -features = ["secp256k1", "ed25519", "secp256r1"] - -[dependencies.did-webkey] -path = "../../../ssi/did-webkey" -default-features = false [dev-dependencies] wasm-bindgen-test = "0.2" diff --git a/lib/web/src/lib.rs b/lib/web/src/lib.rs index 38ea8b4f..697b7e3a 100644 --- a/lib/web/src/lib.rs +++ b/lib/web/src/lib.rs @@ -9,6 +9,7 @@ use didkit::error::Error; #[cfg(doc)] use didkit::error::{didkit_error_code, didkit_error_message}; use didkit::get_verification_method; +use didkit::ssi; use didkit::LinkedDataProofOptions; use didkit::ProofPreparation; use didkit::Source;