Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions zk-token-sdk/src/encryption/elgamal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ impl ElGamalKeypair {
&self.secret
}

#[deprecated(note = "please use `into()` instead")]
#[deprecated(since = "2.0.0", note = "please use `into()` instead")]
#[allow(deprecated)]
pub fn to_bytes(&self) -> [u8; ELGAMAL_KEYPAIR_LEN] {
let mut bytes = [0u8; ELGAMAL_KEYPAIR_LEN];
Expand All @@ -230,7 +230,7 @@ impl ElGamalKeypair {
bytes
}

#[deprecated(note = "please use `try_from()` instead")]
#[deprecated(since = "2.0.0", note = "please use `try_from()` instead")]
#[allow(deprecated)]
pub fn from_bytes(bytes: &[u8]) -> Option<Self> {
if bytes.len() != ELGAMAL_KEYPAIR_LEN {
Expand Down Expand Up @@ -367,12 +367,12 @@ impl ElGamalPubkey {
&self.0
}

#[deprecated(note = "please use `into()` instead")]
#[deprecated(since = "2.0.0", note = "please use `into()` instead")]
pub fn to_bytes(&self) -> [u8; ELGAMAL_PUBKEY_LEN] {
self.0.compress().to_bytes()
}

#[deprecated(note = "please use `try_from()` instead")]
#[deprecated(since = "2.0.0", note = "please use `try_from()` instead")]
pub fn from_bytes(bytes: &[u8]) -> Option<ElGamalPubkey> {
if bytes.len() != ELGAMAL_PUBKEY_LEN {
return None;
Expand Down Expand Up @@ -544,12 +544,12 @@ impl ElGamalSecretKey {
self.0.as_bytes()
}

#[deprecated(note = "please use `into()` instead")]
#[deprecated(since = "2.0.0", note = "please use `into()` instead")]
pub fn to_bytes(&self) -> [u8; ELGAMAL_SECRET_KEY_LEN] {
self.0.to_bytes()
}

#[deprecated(note = "please use `try_from()` instead")]
#[deprecated(since = "2.0.0", note = "please use `try_from()` instead")]
pub fn from_bytes(bytes: &[u8]) -> Option<ElGamalSecretKey> {
match bytes.try_into() {
Ok(bytes) => Scalar::from_canonical_bytes(bytes).map(ElGamalSecretKey),
Expand Down