Skip to content

Commit

Permalink
Support deserialization of single termsOfUse (#538)
Browse files Browse the repository at this point in the history
  • Loading branch information
Voronar authored Nov 1, 2023
1 parent a9f593a commit b99ab4c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions ssi-vc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ssi-core = { path = "../ssi-core", version = "0.1" }
ssi-dids = { path = "../ssi-dids", version = "0.1.1" }
ssi-json-ld = { path = "../ssi-json-ld", version = "0.2", default-features = false }
ssi-ldp = { path = "../ssi-ldp", version = "0.3.0", default-features = false }
serde_with = "2.3.2"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
chrono = { version = "0.4", features = ["serde"] }
Expand Down
3 changes: 3 additions & 0 deletions ssi-vc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod cacao;
pub mod revocation;

use cacao::BindingDelegation;
use serde_with::{formats::PreferMany, serde_as, OneOrMany as SerdeWithOneOrMany};
pub use ssi_core::{one_or_many::OneOrMany, uri::URI};
use ssi_dids::did_resolve::{resolve_key, DIDResolver};
pub use ssi_dids::VerificationRelationship as ProofPurpose;
Expand Down Expand Up @@ -49,6 +50,7 @@ pub const DEFAULT_CONTEXT_V2: &str = "https://www.w3.org/ns/credentials/v2";
// work around https://github.com/w3c/vc-test-suite/issues/103
pub const ALT_DEFAULT_CONTEXT: &str = "https://w3.org/2018/credentials/v1";

#[serde_as]
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)]
#[serde(rename_all = "camelCase")]
pub struct Credential {
Expand All @@ -73,6 +75,7 @@ pub struct Credential {
#[serde(skip_serializing_if = "Option::is_none")]
pub credential_status: Option<Status>,
#[serde(skip_serializing_if = "Option::is_none")]
#[serde_as(deserialize_as = "Option<SerdeWithOneOrMany<_, PreferMany>>")]
pub terms_of_use: Option<Vec<TermsOfUse>>,
#[serde(skip_serializing_if = "Option::is_none")]
pub evidence: Option<OneOrMany<Evidence>>,
Expand Down

0 comments on commit b99ab4c

Please sign in to comment.