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

Add TryFrom<[u8; 32]> implementations for Scalar and EdwardsPoint #11

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

thomaseizinger
Copy link

First patch is a minor cleanup.
Second patch adds the functionality claimed in the title.

Instead of importing `Debug` directly and fully-qualifying fmt via
`::core::fmt` in other places, we bring the whole `core::fmt` module
into scope and refer to `Formatter` and `Result` as `fmt::Formatter`
and `fmt::Result`.
Although not strictly required by trait-bounds, we introduce a
dedicated error type in case the conversion fails. If the `std`
feature is enabled, this error type implements `std::error::Error`.

Having a dedicated error type improves ergonomics a lot as many
uses of `TryFrom` imply `TryFrom::Error: std::error::Error`.

We don't alter the original APIs of `Scalar` and `EdwardsPoint` to
maintain backwards compatible.
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.

1 participant