Skip to content

Commit d550e66

Browse files
committed
Deterministic serialization JSON AD #794
Switch to JCS #794
1 parent 9788930 commit d550e66

File tree

4 files changed

+50
-19
lines changed

4 files changed

+50
-19
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ See [STATUS.md](server/STATUS.md) to learn more about which features will remain
1515
- Add `Agent::from_secret` #785
1616
- Make `set_propval` and `set_propval_shortname` chainable #785
1717
- Don't use default agent when fetching with Db #787
18+
- Deterministic serialization JSON AD #794
1819

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

Cargo.lock

Lines changed: 45 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ ring = "0.17.6"
2828
rio_api = {version = "0.8", optional = true}
2929
rio_turtle = {version = "0.8", optional = true}
3030
serde = {version = "1", features = ["derive"]}
31+
serde_jcs = "0.1.0"
3132
serde_json = "1"
3233
sled = {version = "0.34", optional = true, features = ["no_logs"]}
3334
toml = {version = "0.7", optional = true}

lib/src/commit.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,9 @@ impl Commit {
511511
commit_resource.remove_propval(urls::SIGNATURE);
512512
let json_obj =
513513
crate::serialize::propvals_to_json_ad_map(commit_resource.get_propvals(), None)?;
514-
serde_json::to_string(&json_obj).map_err(|_| "Could not serialize to JSON-AD".into())
514+
let json = serde_jcs::to_string(&json_obj)
515+
.map_err(|e| format!("Failed to serialize Commit: {}", e))?;
516+
Ok(json)
515517
}
516518
}
517519

0 commit comments

Comments
 (0)