diff --git a/Cargo.toml b/Cargo.toml index 0963749..f84ec68 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -30,7 +30,7 @@ reqwest = { version = "0.12.5", features = ["rustls-tls"] } serde = "1.0.188" serde_json = "1.0.107" serde_urlencoded = "0.7.1" -ssi = { version = "0.10", features = ["secp256r1"] } +ssi = { version = "0.10.1", features = ["secp256r1"] } tokio = "1.32.0" tracing = "0.1.37" url = { version = "2.4.1", features = ["serde"] } diff --git a/src/core/response/parameters.rs b/src/core/response/parameters.rs index c997283..a5ab4e7 100644 --- a/src/core/response/parameters.rs +++ b/src/core/response/parameters.rs @@ -4,7 +4,13 @@ use crate::core::object::TypedParameter; use anyhow::Error; use serde::{Deserialize, Serialize}; use serde_json::Value as Json; -use ssi::{claims::vc, one_or_many::OneOrManyRef, prelude::AnyJsonPresentation, OneOrMany}; +use ssi::{ + claims::vc::{self, v2::SpecializedJsonCredential}, + json_ld::syntax::Object, + one_or_many::OneOrManyRef, + prelude::AnyJsonPresentation, + OneOrMany, +}; #[derive(Debug, Clone)] pub struct IdToken(pub String); @@ -187,6 +193,20 @@ impl From for VpTokenItem { } } +impl From>> for VpTokenItem { + fn from(value: vc::v2::syntax::JsonPresentation>) -> Self { + let serde_json::Value::Object(obj) = serde_json::to_value(value) + // SAFETY: by definition a VCDM2.0 presentation is a JSON object. + .unwrap() + else { + // SAFETY: by definition a VCDM2.0 presentation is a JSON object. + unreachable!() + }; + + Self::JsonObject(obj) + } +} + impl From for VpTokenItem { fn from(value: AnyJsonPresentation) -> Self { let serde_json::Value::Object(obj) = serde_json::to_value(value)