Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cosmrs: PublicKey JSON serialization support #133

Merged
merged 1 commit into from
Sep 29, 2021

Conversation

tony-iqlusion
Copy link
Member

Adds support for the "Cosmos JSON" PublicKey serialization, e.g.:

{"@type":"/cosmos.crypto.ed25519.PubKey","key":"sEEsVGkXvyewKLWMJbHVDRkBoerW0IIwmj1rHkabtHU="}

Encoding follows Protobub JSON conventions, with binary data encoded as standard (i.e. non-URL safe) Base64. However, note that it's structurally still a bit different from the Protobuf JSON encoding for public keys, and thus entails a custom solution.

Also note that there is unfortunately not yet a general solution for Protobuf JSON encoding for prost::Message:

tokio-rs/prost#75

Comment on lines +21 to +22
serde = { version = "1", features = ["serde_derive"] }
serde_json = "1"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are already transitive hard dependencies, so no point in making them optional

Adds support for the "Cosmos JSON" `PublicKey` serialization, e.g.:

    {"@type":"/cosmos.crypto.ed25519.PubKey","key":"sEEsVGkXvyewKLWMJbHVDRkBoerW0IIwmj1rHkabtHU="}

Encoding follows Protobub JSON conventions, with binary data encoded as
standard (i.e. non-URL safe) Base64. However, note that it's
structurally still a bit different from the Protobuf JSON encoding for
public keys, and thus entails a custom solution.

Also note that there is unfortunately not yet a general solution for
Protobuf JSON encoding for `prost::Message`:

tokio-rs/prost#75
@tony-iqlusion tony-iqlusion force-pushed the tony-iqlusion/public-key-json branch from ddc5f53 to d06935e Compare September 29, 2021 23:04
@tony-iqlusion tony-iqlusion merged commit 21a56c3 into main Sep 29, 2021
@tony-iqlusion tony-iqlusion deleted the tony-iqlusion/public-key-json branch September 29, 2021 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants