From bd607e69da846813bb52879f9e8d868614be9860 Mon Sep 17 00:00:00 2001 From: Ryan Tate Date: Wed, 13 Nov 2024 14:10:20 -0800 Subject: [PATCH 1/5] use array as preferred for credential types Signed-off-by: Ryan Tate Co-Authored-By: Joey Silberman Signed-off-by: Ryan Tate --- crates/claims/crates/vc/Cargo.toml | 7 +++++-- crates/claims/crates/vc/src/v1/syntax/presentation.rs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/claims/crates/vc/Cargo.toml b/crates/claims/crates/vc/Cargo.toml index 83cdfd630..369c81936 100644 --- a/crates/claims/crates/vc/Cargo.toml +++ b/crates/claims/crates/vc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ssi-vc" -version = "0.4.0" +version = "0.4.1" edition = "2021" authors = ["Spruce Systems, Inc."] license = "Apache-2.0" @@ -33,7 +33,10 @@ educe.workspace = true base64.workspace = true bitvec = "0.20" flate2 = "1.0" -reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls"] } +reqwest = { version = "0.11", default-features = false, features = [ + "json", + "rustls-tls", +] } ssi-verification-methods.workspace = true ssi-dids-core.workspace = true ssi-data-integrity.workspace = true diff --git a/crates/claims/crates/vc/src/v1/syntax/presentation.rs b/crates/claims/crates/vc/src/v1/syntax/presentation.rs index 909f89420..8f0842a57 100644 --- a/crates/claims/crates/vc/src/v1/syntax/presentation.rs +++ b/crates/claims/crates/vc/src/v1/syntax/presentation.rs @@ -21,7 +21,7 @@ impl RequiredType for PresentationType { } impl TypeSerializationPolicy for PresentationType { - const PREFER_ARRAY: bool = false; + const PREFER_ARRAY: bool = true; } pub type JsonPresentationTypes = Types; From e94aa52e3c641e9c5706d56df58db4cb249f10b6 Mon Sep 17 00:00:00 2001 From: Ryan Tate Date: Fri, 6 Dec 2024 13:53:31 -0800 Subject: [PATCH 2/5] resolve failing cargo test (doctest) Signed-off-by: Ryan Tate --- src/lib.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index f4c0fc536..8895b5cb4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -171,6 +171,7 @@ //! # async fn main() { //! use static_iref::uri; //! use serde::{Serialize, Deserialize}; +//! use ssi::claims::vc::syntax::NonEmptyVec; //! use ssi::prelude::*; //! //! // Defines the shape of our custom claims. @@ -187,10 +188,10 @@ //! Some(uri!("https://example.org/#CredentialId").to_owned()), // id //! uri!("https://example.org/#Issuer").to_owned().into(), // issuer //! DateTime::now(), // issuance date -//! vec![MyCredentialSubject { +//! NonEmptyVec::new(MyCredentialSubject { //! name: "John Smith".to_owned(), //! email: "john.smith@example.org".to_owned() -//! }] +//! }) //! ); //! //! // Create a random signing key, and turn its public part into a DID URL. @@ -221,7 +222,7 @@ //! ).await.expect("signature failed"); //! # } //! ``` -//! +//! //! It is critical that custom claims can be interpreted as Linked-Data. In //! the above example this is done by specifying a serialization URL for each //! field of `MyCredentialSubject`. This can also be done by creating a custom From 1c341f0b2c2c735cc58d54128d697e03e4e7fb10 Mon Sep 17 00:00:00 2001 From: Ryan Tate Date: Fri, 6 Dec 2024 14:01:42 -0800 Subject: [PATCH 3/5] update readme Signed-off-by: Ryan Tate --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 771fc6768..cecbb4230 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,7 @@ yourself. ```rust use static_iref::uri; use serde::{Serialize, Deserialize}; +use ssi::claims::vc::syntax::NonEmptyVec; use ssi::prelude::*; // Defines the shape of our custom claims. @@ -183,10 +184,10 @@ let credential = ssi::claims::vc::v1::JsonCredential::::new Some(uri!("https://example.org/#CredentialId").to_owned()), // id uri!("https://example.org/#Issuer").to_owned().into(), // issuer DateTime::now(), // issuance date - vec![MyCredentialSubject { + NonEmptyVec::new(MyCredentialSubject { name: "John Smith".to_owned(), email: "john.smith@example.org".to_owned() - }] + }) ); // Create a random signing key, and turn its public part into a DID URL. @@ -216,7 +217,7 @@ let vc = cryptosuite.sign( ProofOptions::from_method(verification_method) ).await.expect("signature failed"); ``` - + It is critical that custom claims can be interpreted as Linked-Data. In the above example this is done by specifying a serialization URL for each field of `MyCredentialSubject`. This can also be done by creating a custom From 8ec253119157cb7e165be3dcc9c36c631c4d3a59 Mon Sep 17 00:00:00 2001 From: Ryan Tate Date: Mon, 9 Dec 2024 18:46:15 -0800 Subject: [PATCH 4/5] fix eip resolve_vc_issue_verify unit test Signed-off-by: Ryan Tate --- crates/dids/methods/pkh/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/dids/methods/pkh/src/lib.rs b/crates/dids/methods/pkh/src/lib.rs index c98edf75a..22772dbef 100644 --- a/crates/dids/methods/pkh/src/lib.rs +++ b/crates/dids/methods/pkh/src/lib.rs @@ -1313,7 +1313,7 @@ mod tests { ], "VerifiablePresentation": [ { "name": "@context", "type": "string[]" }, - { "name": "type", "type": "string" }, + { "name": "type", "type": "string[]" }, { "name": "holder", "type": "string" }, { "name": "verifiableCredential", "type": "VerifiableCredential" }, { "name": "proof", "type": "Proof" } From 29bd4592fb6deeb6645f7455fdeeca60e151918c Mon Sep 17 00:00:00 2001 From: Ryan Tate Date: Tue, 10 Dec 2024 08:18:14 -0800 Subject: [PATCH 5/5] Update crates/claims/crates/vc/Cargo.toml --- crates/claims/crates/vc/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/claims/crates/vc/Cargo.toml b/crates/claims/crates/vc/Cargo.toml index 369c81936..a527fe0bc 100644 --- a/crates/claims/crates/vc/Cargo.toml +++ b/crates/claims/crates/vc/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ssi-vc" -version = "0.4.1" +version = "0.4.0" edition = "2021" authors = ["Spruce Systems, Inc."] license = "Apache-2.0"