Skip to content

chore: Nonce::from_bytes() returns Self instead of Option<Self> #206

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tvolk131
Copy link

@tvolk131 tvolk131 commented Feb 9, 2025

Point::from_slice() only returns None if it is passed a byte slice that isn't exactly 33 bytes long. Since Nonce::from_bytes() always passes in 33 bytes, we can guarantee to the caller that this never fails.

@nickfarrow
Copy link
Collaborator

Hey @tvolk131, I asked Lloyd about this one and it due to the fact that not every 33 byte array will render a valid Point, see Point::from_bytes. For example, the first byte must be either 0x02 or 0x03 to indicate that the y-coordinate is even/odd.

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