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

fix: serializing and deserializing keys #80

Closed
wants to merge 1 commit into from

Conversation

st3iny
Copy link

@st3iny st3iny commented Oct 19, 2024

Problem

Serializing a key will create produce a byte array. However, a string is expected when deserializing because of the try_from container attribute. This will cause the deserialization to never succeed.

Error message: invalid type: sequence, expected a borrowed string

Actual serialized data: public_key = [235, 184, 242, 187, 12, 37, 226, 203, 78, 98, 101, 18, 30, 55, 163, 254, 57, 26, 130, 22, 203, 42, 222, 28, 77, 164, 163, 52, 55, 176, 144, 120] (toml)

Solution

I fixed this by adding another attribute into="String" to the container. Unfortunately, setting into="&str" won't work because it is not owned.

I also added a simple unit test to prevent regressions.

@moubctez
Copy link
Contributor

Fixed in #82

@moubctez moubctez closed this Dec 12, 2024
@st3iny st3iny deleted the fix/key-serde branch December 12, 2024 18:50
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