Skip to content

ed25519: change Signature::from_bytes to take sized array#593

Merged
tarcieri merged 1 commit intoRustCrypto:masterfrom
mina86:a
Dec 2, 2022
Merged

ed25519: change Signature::from_bytes to take sized array#593
tarcieri merged 1 commit intoRustCrypto:masterfrom
mina86:a

Conversation

@mina86
Copy link
Copy Markdown
Contributor

@mina86 mina86 commented Dec 2, 2022

Change Signature::from_bytes to take [u8; 64] as argument rather
than &[u8] which:

  • provides consistency with KeypairBytes::from_bytes,
  • encodes the length in type system allowing clients to assert length
    at compile time and
  • removes run-time length check.

At the same time, since there’s already TryFrom<&[u8]> implementation
for Signature, no features are lost and clients who want to create the
signature from a slice can do it via Signature::try_from.

This does change the API but since the crate is currently in 2.0
preview stage, that should be fine since API breaking changes are
allowed by symantic versioning at major version upgrade.

@mina86
Copy link
Copy Markdown
Contributor Author

mina86 commented Dec 2, 2022

Change Signature::from_bytes to take `[u8; 64]` as argument rather
than `&[u8]` which:
- provides consistency with KeypairBytes::from_bytes,
- encodes the length in type system allowing clients to assert length
  at compile time and
- removes run-time length check.

At the same time, since there’s already TryFrom<&[u8]> implementation
for Signature, no features are lost and clients who want to create
the signature from a slice can do it via Signature::try_from.

This does change the API but since the crate is currently in 2.0 preview
stage, that should be fine since API breaking changes are allowed by
symantic versioning at major version upgrade.
@tarcieri tarcieri merged commit 19813cd into RustCrypto:master Dec 2, 2022
@tarcieri
Copy link
Copy Markdown
Member

tarcieri commented Dec 2, 2022

Thank you!

@mina86 mina86 deleted the a branch December 2, 2022 04:11
@tarcieri tarcieri mentioned this pull request Jan 16, 2023
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