2020-03-13 14:38:42 -07:00
|
|
|
|
//! Sprout key types
|
2020-03-13 15:58:02 -07:00
|
|
|
|
//!
|
|
|
|
|
//! "The receiving key sk_enc, the incoming viewing key ivk = (apk,
|
|
|
|
|
//! sk_enc), and the shielded payment address addr_pk = (a_pk, pk_enc) are
|
|
|
|
|
//! derived from a_sk, as described in [‘Sprout Key Components’][ps]
|
|
|
|
|
//!
|
|
|
|
|
//! [ps]: https://zips.z.cash/protocol/protocol.pdf#sproutkeycomponents
|
2020-03-13 14:38:42 -07:00
|
|
|
|
|
2020-02-25 15:14:59 -08:00
|
|
|
|
use std::{
|
|
|
|
|
fmt,
|
|
|
|
|
io::{self},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
|
use proptest::{array, collection::vec, prelude::*};
|
|
|
|
|
#[cfg(test)]
|
|
|
|
|
use proptest_derive::Arbitrary;
|
|
|
|
|
|
|
|
|
|
use crate::serialization::{SerializationError, ZcashDeserialize, ZcashSerialize};
|
|
|
|
|
|
2020-03-13 15:58:02 -07:00
|
|
|
|
/// All other Sprout key types derive from the SpendingKey value.
|
|
|
|
|
pub struct SpendingKey;
|
|
|
|
|
|
2020-03-17 15:49:15 -07:00
|
|
|
|
///
|
2020-03-13 15:58:02 -07:00
|
|
|
|
pub struct ReceivingKey;
|
|
|
|
|
|
2020-03-17 15:49:15 -07:00
|
|
|
|
///
|
|
|
|
|
#[derive(Copy, Clone, Eq, PartialEq)]
|
|
|
|
|
pub struct PayingKey(pub [u8; 32]);
|
2020-03-13 15:58:02 -07:00
|
|
|
|
|
2020-03-17 15:49:15 -07:00
|
|
|
|
///
|
|
|
|
|
pub type TransmissionKey = x25519_dalek::PublicKey;
|
2020-03-13 15:58:02 -07:00
|
|
|
|
|
2020-03-17 15:49:15 -07:00
|
|
|
|
///
|
2020-03-13 15:58:02 -07:00
|
|
|
|
pub struct IncomingViewingKey {
|
|
|
|
|
paying_key: PayingKey,
|
|
|
|
|
receiving_key: ReceivingKey,
|
|
|
|
|
}
|
|
|
|
|
|
2020-02-25 15:14:59 -08:00
|
|
|
|
#[cfg(test)]
|
|
|
|
|
proptest! {
|
|
|
|
|
|
2020-02-28 10:07:01 -08:00
|
|
|
|
// #[test]
|
|
|
|
|
// fn test() {}
|
2020-02-25 15:14:59 -08:00
|
|
|
|
}
|