Skip to content

Commit

Permalink
[zk-token-sdk] Specify version in deprecations in zk-token-sdk (#2011)
Browse files Browse the repository at this point in the history
  • Loading branch information
samkim-crypto authored Jul 4, 2024
1 parent 0deb6fb commit 45a4792
Showing 1 changed file with 6 additions and 6 deletions.
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

0 comments on commit 45a4792

Please sign in to comment.