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

VC 'termOfUse' property type deserialization tweak #538

Merged
merged 1 commit into from
Nov 1, 2023
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
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
Loading