Skip to content

Commit

Permalink
Deterministic serialization JSON AD #794
Browse files Browse the repository at this point in the history
Switch to JCS #794
  • Loading branch information
joepio committed Jan 9, 2024
1 parent 9788930 commit d550e66
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ See [STATUS.md](server/STATUS.md) to learn more about which features will remain
- Add `Agent::from_secret` #785
- Make `set_propval` and `set_propval_shortname` chainable #785
- Don't use default agent when fetching with Db #787
- Deterministic serialization JSON AD #794

## [v0.36.1] - 2023-12-06

Expand Down
63 changes: 45 additions & 18 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +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_jcs = "0.1.0"
serde_json = "1"
sled = {version = "0.34", optional = true, features = ["no_logs"]}
toml = {version = "0.7", optional = true}
Expand Down
4 changes: 3 additions & 1 deletion lib/src/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,9 @@ impl Commit {
commit_resource.remove_propval(urls::SIGNATURE);
let json_obj =
crate::serialize::propvals_to_json_ad_map(commit_resource.get_propvals(), None)?;
serde_json::to_string(&json_obj).map_err(|_| "Could not serialize to JSON-AD".into())
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 d550e66

Please sign in to comment.