Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable secp256k1 and p256 by default #140

Merged
merged 2 commits into from
Apr 9, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions cli/tests/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ use std::process::{Command, Stdio};

static BIN: &str = env!("CARGO_BIN_EXE_didkit");

const DID_KEY_K256: &'static str = "did:key:zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme";
const DID_KEY_P256: &'static str = "did:key:zrurwcJZss4ruepVNu1H3xmSirvNbzgBk9qrCktB6kaewXnJAhYWwtP3bxACqBpzjZdN7TyHNzzGGSSH5qvZsSDir9z";

#[test]
fn generate_key() {
Command::new(BIN)
Expand Down Expand Up @@ -147,6 +150,20 @@ fn didkit_cli() {
assert_ne!(res_result["didDocumentMetadata"], Value::Null);
assert_eq!(res_result["didResolutionMetadata"]["error"], Value::Null);

// Resolve more DIDs
let resolve = Command::new(BIN)
.args(&["did-resolve", DID_KEY_K256])
.stderr(Stdio::inherit())
.output()
.unwrap();
assert!(resolve.status.success());
let resolve = Command::new(BIN)
.args(&["did-resolve", DID_KEY_P256])
.stderr(Stdio::inherit())
.output()
.unwrap();
assert!(resolve.status.success());

// Dereference a DID URL to a verification method
let deref = Command::new(BIN)
.args(&["did-dereference", "-m", &verification_method])
Expand Down
11 changes: 11 additions & 0 deletions http/tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ const DID_KEY_JSON: &'static str = include_str!("../../cli/tests/ed25519-key.jwk
const DID_KEY: &'static str = "did:key:z6MkiVpwA241guqtKWAkohHpcAry7S94QQb6ukW3GcCsugbK";
const VERIFICATION_METHOD: &'static str = "did:key:z6MkiVpwA241guqtKWAkohHpcAry7S94QQb6ukW3GcCsugbK#z6MkiVpwA241guqtKWAkohHpcAry7S94QQb6ukW3GcCsugbK";

const DID_KEY_K256: &'static str = "did:key:zQ3shokFTS3brHcDQrn82RUDfCZESWL1ZdCEJwekUDPQiYBme";
const DID_KEY_P256: &'static str = "did:key:zrurwcJZss4ruepVNu1H3xmSirvNbzgBk9qrCktB6kaewXnJAhYWwtP3bxACqBpzjZdN7TyHNzzGGSSH5qvZsSDir9z";

const ISSUE_CRED_REQ: &str = r#"{
"credential": {
"@context": "https://www.w3.org/2018/credentials/v1",
Expand Down Expand Up @@ -354,6 +357,14 @@ async fn resolve_dereference() {
assert_eq!(res_meta.content_type.unwrap(), TYPE_DID_LD_JSON);
assert_eq!(http_content_type, TYPE_DID_RESOLUTION);

// Resolve more DIDs
let uri = Uri::from_str(&format!("{}/identifiers/{}", base, DID_KEY_K256)).unwrap();
let resp = client.get(uri).await.unwrap();
assert_eq!(resp.status(), 200);
let uri = Uri::from_str(&format!("{}/identifiers/{}", base, DID_KEY_P256)).unwrap();
let resp = client.get(uri).await.unwrap();
assert_eq!(resp.status(), 200);

// Dereference DID URL
let uri_string = format!(
"{}/identifiers/{}",
Expand Down
2 changes: 1 addition & 1 deletion lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ authors = ["Spruce Systems, Inc."]
edition = "2018"

[features]
default = ["ring"]
default = ["ring", "secp256k1", "p256"]
ring = ["ssi/ring"]
wasm = []
http-did = ["ssi/http-did"]
Expand Down