Skip to content

Commit

Permalink
Switch to JCS #794
Browse files Browse the repository at this point in the history
  • Loading branch information
joepio committed Jan 9, 2024
1 parent 9204c02 commit b9ef29c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
31 changes: 18 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ring = "0.17.6"
rio_api = {version = "0.8", optional = true}
rio_turtle = {version = "0.8", optional = true}
serde = {version = "1", features = ["derive"]}
serde_canonical_json = "1.0.0"
serde_jcs = "0.1.0"
serde_json = "1"
sled = {version = "0.34", optional = true, features = ["no_logs"]}
toml = {version = "0.7", optional = true}
Expand Down
9 changes: 2 additions & 7 deletions lib/src/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,13 +511,8 @@ impl Commit {
commit_resource.remove_propval(urls::SIGNATURE);
let json_obj =
crate::serialize::propvals_to_json_ad_map(commit_resource.get_propvals(), None)?;

let mut ser = serde_json::Serializer::with_formatter(
Vec::new(),
serde_canonical_json::CanonicalFormatter::new(),
);
json_obj.serialize(&mut ser)?;
let json = String::from_utf8(ser.into_inner())?;
let json = serde_jcs::to_string(&json_obj)
.map_err(|e| format!("Failed to serialize Commit: {}", e))?;
Ok(json)
}
}
Expand Down

0 comments on commit b9ef29c

Please sign in to comment.