zcash_note_encryption: Place pre-ZIP 212 APIs behind a feature flag
Extracted from: 01c768dbeb
This commit is contained in:
parent
f79d84fe59
commit
df05017f1a
|
@ -28,6 +28,7 @@ jubjub = "0.8"
|
||||||
[features]
|
[features]
|
||||||
default = ["std"]
|
default = ["std"]
|
||||||
alloc = []
|
alloc = []
|
||||||
|
pre-zip-212 = []
|
||||||
std = ["alloc", "blake2b_simd/std"]
|
std = ["alloc", "blake2b_simd/std"]
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
|
|
11
src/lib.rs
11
src/lib.rs
|
@ -291,12 +291,21 @@ impl<D: Domain> NoteEncryption<D> {
|
||||||
memo: D::Memo,
|
memo: D::Memo,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let esk = D::derive_esk(¬e).expect("ZIP 212 is active.");
|
let esk = D::derive_esk(¬e).expect("ZIP 212 is active.");
|
||||||
Self::new_with_esk(esk, ovk, note, to, memo)
|
NoteEncryption {
|
||||||
|
epk: D::ka_derive_public(¬e, &esk),
|
||||||
|
esk,
|
||||||
|
note,
|
||||||
|
to,
|
||||||
|
memo,
|
||||||
|
ovk,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// For use only with Sapling. This method is preserved in order that test code
|
/// For use only with Sapling. This method is preserved in order that test code
|
||||||
/// be able to generate pre-ZIP-212 ciphertexts so that tests can continue to
|
/// be able to generate pre-ZIP-212 ciphertexts so that tests can continue to
|
||||||
/// cover pre-ZIP-212 transaction decryption.
|
/// cover pre-ZIP-212 transaction decryption.
|
||||||
|
#[cfg(feature = "pre-zip-212")]
|
||||||
|
#[cfg_attr(docsrs, doc(cfg(feature = "pre-zip-212")))]
|
||||||
pub fn new_with_esk(
|
pub fn new_with_esk(
|
||||||
esk: D::EphemeralSecretKey,
|
esk: D::EphemeralSecretKey,
|
||||||
ovk: Option<D::OutgoingViewingKey>,
|
ovk: Option<D::OutgoingViewingKey>,
|
||||||
|
|
Loading…
Reference in New Issue