Skip to content

Commit

Permalink
update data integrity vp token from conversion
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Tate <[email protected]>
  • Loading branch information
Ryanmtate committed Nov 19, 2024
1 parent 453c31d commit dcc962b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/core/response/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use ssi::{
claims::vc::{self, v2::SpecializedJsonCredential},
json_ld::syntax::Object,
one_or_many::OneOrManyRef,
prelude::{AnyDataIntegrity, AnyJsonPresentation},
prelude::{AnyDataIntegrity, AnyJsonPresentation, AnySuite, DataIntegrity},
OneOrMany,
};

Expand Down Expand Up @@ -240,3 +240,17 @@ impl From<AnyJsonPresentation> for VpTokenItem {
Self::JsonObject(obj)
}
}

impl From<DataIntegrity<AnyJsonPresentation, AnySuite>> for VpTokenItem {
fn from(value: DataIntegrity<AnyJsonPresentation, AnySuite>) -> 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)
}
}

0 comments on commit dcc962b

Please sign in to comment.