zcash_primitives: Remove old Sapling re-exports from `zip32` module
This commit is contained in:
parent
fedc9af1f6
commit
54e8dd35c1
|
@ -188,14 +188,14 @@ impl<P: consensus::Parameters> AddressCodec<P> for UnifiedAddress {
|
||||||
/// let extsk = sapling::spending_key(&[0; 32][..], COIN_TYPE, AccountId::from(0));
|
/// let extsk = sapling::spending_key(&[0; 32][..], COIN_TYPE, AccountId::from(0));
|
||||||
/// let encoded = encode_extended_spending_key(HRP_SAPLING_EXTENDED_SPENDING_KEY, &extsk);
|
/// let encoded = encode_extended_spending_key(HRP_SAPLING_EXTENDED_SPENDING_KEY, &extsk);
|
||||||
/// ```
|
/// ```
|
||||||
/// [`ExtendedSpendingKey`]: zcash_primitives::zip32::ExtendedSpendingKey
|
/// [`ExtendedSpendingKey`]: zcash_primitives::sapling::zip32::ExtendedSpendingKey
|
||||||
pub fn encode_extended_spending_key(hrp: &str, extsk: &ExtendedSpendingKey) -> String {
|
pub fn encode_extended_spending_key(hrp: &str, extsk: &ExtendedSpendingKey) -> String {
|
||||||
bech32_encode(hrp, |w| extsk.write(w))
|
bech32_encode(hrp, |w| extsk.write(w))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Decodes an [`ExtendedSpendingKey`] from a Bech32-encoded string.
|
/// Decodes an [`ExtendedSpendingKey`] from a Bech32-encoded string.
|
||||||
///
|
///
|
||||||
/// [`ExtendedSpendingKey`]: zcash_primitives::zip32::ExtendedSpendingKey
|
/// [`ExtendedSpendingKey`]: zcash_primitives::sapling::zip32::ExtendedSpendingKey
|
||||||
pub fn decode_extended_spending_key(
|
pub fn decode_extended_spending_key(
|
||||||
hrp: &str,
|
hrp: &str,
|
||||||
s: &str,
|
s: &str,
|
||||||
|
@ -210,26 +210,26 @@ pub fn decode_extended_spending_key(
|
||||||
/// ```
|
/// ```
|
||||||
/// use zcash_primitives::{
|
/// use zcash_primitives::{
|
||||||
/// constants::testnet::{COIN_TYPE, HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY},
|
/// constants::testnet::{COIN_TYPE, HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY},
|
||||||
|
/// sapling::zip32::ExtendedFullViewingKey,
|
||||||
/// zip32::AccountId,
|
/// zip32::AccountId,
|
||||||
/// };
|
/// };
|
||||||
/// use zcash_client_backend::{
|
/// use zcash_client_backend::{
|
||||||
/// encoding::encode_extended_full_viewing_key,
|
/// encoding::encode_extended_full_viewing_key,
|
||||||
/// keys::sapling,
|
/// keys::sapling,
|
||||||
/// };
|
/// };
|
||||||
/// use zcash_primitives::zip32::ExtendedFullViewingKey;
|
|
||||||
///
|
///
|
||||||
/// let extsk = sapling::spending_key(&[0; 32][..], COIN_TYPE, AccountId::from(0));
|
/// let extsk = sapling::spending_key(&[0; 32][..], COIN_TYPE, AccountId::from(0));
|
||||||
/// let extfvk = extsk.to_extended_full_viewing_key();
|
/// let extfvk = extsk.to_extended_full_viewing_key();
|
||||||
/// let encoded = encode_extended_full_viewing_key(HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY, &extfvk);
|
/// let encoded = encode_extended_full_viewing_key(HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY, &extfvk);
|
||||||
/// ```
|
/// ```
|
||||||
/// [`ExtendedFullViewingKey`]: zcash_primitives::zip32::ExtendedFullViewingKey
|
/// [`ExtendedFullViewingKey`]: zcash_primitives::sapling::zip32::ExtendedFullViewingKey
|
||||||
pub fn encode_extended_full_viewing_key(hrp: &str, extfvk: &ExtendedFullViewingKey) -> String {
|
pub fn encode_extended_full_viewing_key(hrp: &str, extfvk: &ExtendedFullViewingKey) -> String {
|
||||||
bech32_encode(hrp, |w| extfvk.write(w))
|
bech32_encode(hrp, |w| extfvk.write(w))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Decodes an [`ExtendedFullViewingKey`] from a Bech32-encoded string.
|
/// Decodes an [`ExtendedFullViewingKey`] from a Bech32-encoded string.
|
||||||
///
|
///
|
||||||
/// [`ExtendedFullViewingKey`]: zcash_primitives::zip32::ExtendedFullViewingKey
|
/// [`ExtendedFullViewingKey`]: zcash_primitives::sapling::zip32::ExtendedFullViewingKey
|
||||||
pub fn decode_extended_full_viewing_key(
|
pub fn decode_extended_full_viewing_key(
|
||||||
hrp: &str,
|
hrp: &str,
|
||||||
s: &str,
|
s: &str,
|
||||||
|
|
|
@ -53,7 +53,7 @@ pub mod sapling {
|
||||||
///
|
///
|
||||||
/// let extsk = sapling::spending_key(&[0; 32][..], COIN_TYPE, AccountId::from(0));
|
/// let extsk = sapling::spending_key(&[0; 32][..], COIN_TYPE, AccountId::from(0));
|
||||||
/// ```
|
/// ```
|
||||||
/// [`ExtendedSpendingKey`]: zcash_primitives::zip32::ExtendedSpendingKey
|
/// [`ExtendedSpendingKey`]: zcash_primitives::sapling::zip32::ExtendedSpendingKey
|
||||||
pub fn spending_key(seed: &[u8], coin_type: u32, account: AccountId) -> ExtendedSpendingKey {
|
pub fn spending_key(seed: &[u8], coin_type: u32, account: AccountId) -> ExtendedSpendingKey {
|
||||||
if seed.len() < 32 {
|
if seed.len() < 32 {
|
||||||
panic!("ZIP 32 seeds MUST be at least 32 bytes");
|
panic!("ZIP 32 seeds MUST be at least 32 bytes");
|
||||||
|
|
|
@ -243,7 +243,7 @@ impl fmt::Display for ScanError {
|
||||||
/// [`WalletSaplingOutput`]s, whereas the implementation for [`SaplingIvk`] cannot
|
/// [`WalletSaplingOutput`]s, whereas the implementation for [`SaplingIvk`] cannot
|
||||||
/// do so and will return the unit value in those outputs instead.
|
/// do so and will return the unit value in those outputs instead.
|
||||||
///
|
///
|
||||||
/// [`ExtendedFullViewingKey`]: zcash_primitives::zip32::ExtendedFullViewingKey
|
/// [`ExtendedFullViewingKey`]: zcash_primitives::sapling::zip32::ExtendedFullViewingKey
|
||||||
/// [`SaplingIvk`]: zcash_primitives::sapling::SaplingIvk
|
/// [`SaplingIvk`]: zcash_primitives::sapling::SaplingIvk
|
||||||
/// [`CompactBlock`]: crate::proto::compact_formats::CompactBlock
|
/// [`CompactBlock`]: crate::proto::compact_formats::CompactBlock
|
||||||
/// [`ScanningKey`]: crate::scanning::ScanningKey
|
/// [`ScanningKey`]: crate::scanning::ScanningKey
|
||||||
|
|
|
@ -253,7 +253,7 @@ pub enum OvkPolicy {
|
||||||
/// Transaction outputs will be decryptable by the sender, in addition to the
|
/// Transaction outputs will be decryptable by the sender, in addition to the
|
||||||
/// recipients.
|
/// recipients.
|
||||||
///
|
///
|
||||||
/// [`ExtendedFullViewingKey`]: zcash_primitives::zip32::ExtendedFullViewingKey
|
/// [`ExtendedFullViewingKey`]: zcash_primitives::sapling::zip32::ExtendedFullViewingKey
|
||||||
Sender,
|
Sender,
|
||||||
|
|
||||||
/// Use a custom outgoing viewing key. This might for instance be derived from a
|
/// Use a custom outgoing viewing key. This might for instance be derived from a
|
||||||
|
|
|
@ -9,7 +9,7 @@ pub const COIN_TYPE: u32 = 133;
|
||||||
///
|
///
|
||||||
/// Defined in [ZIP 32].
|
/// Defined in [ZIP 32].
|
||||||
///
|
///
|
||||||
/// [`ExtendedSpendingKey`]: crate::zip32::ExtendedSpendingKey
|
/// [`ExtendedSpendingKey`]: crate::sapling::zip32::ExtendedSpendingKey
|
||||||
/// [ZIP 32]: https://github.com/zcash/zips/blob/master/zip-0032.rst
|
/// [ZIP 32]: https://github.com/zcash/zips/blob/master/zip-0032.rst
|
||||||
pub const HRP_SAPLING_EXTENDED_SPENDING_KEY: &str = "secret-extended-key-main";
|
pub const HRP_SAPLING_EXTENDED_SPENDING_KEY: &str = "secret-extended-key-main";
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ pub const HRP_SAPLING_EXTENDED_SPENDING_KEY: &str = "secret-extended-key-main";
|
||||||
///
|
///
|
||||||
/// Defined in [ZIP 32].
|
/// Defined in [ZIP 32].
|
||||||
///
|
///
|
||||||
/// [`ExtendedFullViewingKey`]: crate::zip32::ExtendedFullViewingKey
|
/// [`ExtendedFullViewingKey`]: crate::sapling::zip32::ExtendedFullViewingKey
|
||||||
/// [ZIP 32]: https://github.com/zcash/zips/blob/master/zip-0032.rst
|
/// [ZIP 32]: https://github.com/zcash/zips/blob/master/zip-0032.rst
|
||||||
pub const HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY: &str = "zxviews";
|
pub const HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY: &str = "zxviews";
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ pub const COIN_TYPE: u32 = 1;
|
||||||
///
|
///
|
||||||
/// It is defined in [the `zcashd` codebase].
|
/// It is defined in [the `zcashd` codebase].
|
||||||
///
|
///
|
||||||
/// [`ExtendedSpendingKey`]: crate::zip32::ExtendedSpendingKey
|
/// [`ExtendedSpendingKey`]: crate::sapling::zip32::ExtendedSpendingKey
|
||||||
/// [the `zcashd` codebase]: <https://github.com/zcash/zcash/blob/128d863fb8be39ee294fda397c1ce3ba3b889cb2/src/chainparams.cpp#L496>
|
/// [the `zcashd` codebase]: <https://github.com/zcash/zcash/blob/128d863fb8be39ee294fda397c1ce3ba3b889cb2/src/chainparams.cpp#L496>
|
||||||
pub const HRP_SAPLING_EXTENDED_SPENDING_KEY: &str = "secret-extended-key-regtest";
|
pub const HRP_SAPLING_EXTENDED_SPENDING_KEY: &str = "secret-extended-key-regtest";
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ pub const HRP_SAPLING_EXTENDED_SPENDING_KEY: &str = "secret-extended-key-regtest
|
||||||
///
|
///
|
||||||
/// It is defined in [the `zcashd` codebase].
|
/// It is defined in [the `zcashd` codebase].
|
||||||
///
|
///
|
||||||
/// [`ExtendedFullViewingKey`]: crate::zip32::ExtendedFullViewingKey
|
/// [`ExtendedFullViewingKey`]: crate::sapling::zip32::ExtendedFullViewingKey
|
||||||
/// [the `zcashd` codebase]: <https://github.com/zcash/zcash/blob/128d863fb8be39ee294fda397c1ce3ba3b889cb2/src/chainparams.cpp#L494>
|
/// [the `zcashd` codebase]: <https://github.com/zcash/zcash/blob/128d863fb8be39ee294fda397c1ce3ba3b889cb2/src/chainparams.cpp#L494>
|
||||||
pub const HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY: &str = "zxviewregtestsapling";
|
pub const HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY: &str = "zxviewregtestsapling";
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ pub const COIN_TYPE: u32 = 1;
|
||||||
///
|
///
|
||||||
/// Defined in [ZIP 32].
|
/// Defined in [ZIP 32].
|
||||||
///
|
///
|
||||||
/// [`ExtendedSpendingKey`]: crate::zip32::ExtendedSpendingKey
|
/// [`ExtendedSpendingKey`]: crate::sapling::zip32::ExtendedSpendingKey
|
||||||
/// [ZIP 32]: https://github.com/zcash/zips/blob/master/zip-0032.rst
|
/// [ZIP 32]: https://github.com/zcash/zips/blob/master/zip-0032.rst
|
||||||
pub const HRP_SAPLING_EXTENDED_SPENDING_KEY: &str = "secret-extended-key-test";
|
pub const HRP_SAPLING_EXTENDED_SPENDING_KEY: &str = "secret-extended-key-test";
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ pub const HRP_SAPLING_EXTENDED_SPENDING_KEY: &str = "secret-extended-key-test";
|
||||||
///
|
///
|
||||||
/// Defined in [ZIP 32].
|
/// Defined in [ZIP 32].
|
||||||
///
|
///
|
||||||
/// [`ExtendedFullViewingKey`]: crate::zip32::ExtendedFullViewingKey
|
/// [`ExtendedFullViewingKey`]: crate::sapling::zip32::ExtendedFullViewingKey
|
||||||
/// [ZIP 32]: https://github.com/zcash/zips/blob/master/zip-0032.rst
|
/// [ZIP 32]: https://github.com/zcash/zips/blob/master/zip-0032.rst
|
||||||
pub const HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY: &str = "zxviewtestsapling";
|
pub const HRP_SAPLING_EXTENDED_FULL_VIEWING_KEY: &str = "zxviewtestsapling";
|
||||||
|
|
||||||
|
|
|
@ -7,14 +7,6 @@ use subtle::{Choice, ConditionallySelectable};
|
||||||
|
|
||||||
pub mod fingerprint;
|
pub mod fingerprint;
|
||||||
|
|
||||||
#[deprecated(note = "Please use the types exported from the `zip32::sapling` module instead.")]
|
|
||||||
pub use crate::sapling::zip32::{
|
|
||||||
sapling_address, sapling_default_address, sapling_derive_internal_fvk, sapling_find_address,
|
|
||||||
DiversifiableFullViewingKey, ExtendedFullViewingKey, ExtendedSpendingKey,
|
|
||||||
ZIP32_SAPLING_FVFP_PERSONALIZATION, ZIP32_SAPLING_INT_PERSONALIZATION,
|
|
||||||
ZIP32_SAPLING_MASTER_PERSONALIZATION,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// A type-safe wrapper for account identifiers.
|
/// A type-safe wrapper for account identifiers.
|
||||||
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
#[derive(Debug, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||||
pub struct AccountId(u32);
|
pub struct AccountId(u32);
|
||||||
|
|
Loading…
Reference in New Issue