Skip to content

Commit 76b4fdc

Browse files
authored
Add a canonical JSON impl (#19739)
This comes from https://github.com/erikjohnston/rust-signed-json/blob/main/src/json.rs. We need to be able to serialise canonical JSON in Rust to be able to calculate event IDs once we port the event class to Rust. We could instead make the above a properly published crate, but feels easier to pull it into Synapse utils.
1 parent 5e7cbfe commit 76b4fdc

5 files changed

Lines changed: 861 additions & 1 deletion

File tree

Cargo.lock

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

changelog.d/19739.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add a Rust canonical JSON serializer.

rust/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pythonize = "0.27.0"
4444
regex = "1.6.0"
4545
sha2 = "0.10.8"
4646
serde = { version = "1.0.144", features = ["derive"] }
47-
serde_json = "1.0.85"
47+
serde_json = { version = "1.0.85", features = ["raw_value"] }
4848
ulid = "1.1.2"
4949
icu_segmenter = "2.0.0"
5050
reqwest = { version = "0.12.15", default-features = false, features = [
@@ -56,6 +56,7 @@ http-body-util = "0.1.3"
5656
futures = "0.3.31"
5757
tokio = { version = "1.44.2", features = ["rt", "rt-multi-thread"] }
5858
once_cell = "1.18.0"
59+
itertools = "0.14.0"
5960

6061
[features]
6162
extension-module = ["pyo3/extension-module"]

0 commit comments

Comments
 (0)