Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit ac90bf3

Browse files
committedOct 30, 2024
Add #[repr(transparent)] to Keypair, SecretKey and XOnlyPublicKey
1 parent 337e58f commit ac90bf3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed
 

‎src/key.rs

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ use crate::{
5454
/// [`bincode`]: https://docs.rs/bincode
5555
/// [`cbor`]: https://docs.rs/cbor
5656
/// [cryptographically secure pseudorandom number generator]: https://en.wikipedia.org/wiki/Cryptographically_secure_pseudorandom_number_generator
57+
#[repr(transparent)]
5758
#[derive(Copy, Clone)]
5859
pub struct SecretKey([u8; constants::SECRET_KEY_SIZE]);
5960
impl_display_secret!(SecretKey);
@@ -770,6 +771,7 @@ impl<'de> serde::Deserialize<'de> for PublicKey {
770771
/// ```
771772
/// [`bincode`]: https://docs.rs/bincode
772773
/// [`cbor`]: https://docs.rs/cbor
774+
#[repr(transparent)]
773775
#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)]
774776
pub struct Keypair(ffi::Keypair);
775777
impl_display_secret!(Keypair);
@@ -1088,6 +1090,7 @@ impl CPtr for Keypair {
10881090
/// ```
10891091
/// [`bincode`]: https://docs.rs/bincode
10901092
/// [`cbor`]: https://docs.rs/cbor
1093+
#[repr(transparent)]
10911094
#[derive(Copy, Clone, Debug, PartialOrd, Ord, PartialEq, Eq, Hash)]
10921095
pub struct XOnlyPublicKey(ffi::XOnlyPublicKey);
10931096
impl_fast_comparisons!(XOnlyPublicKey);

0 commit comments

Comments
 (0)
Please sign in to comment.