Tidied up some note encryption types

This commit is contained in:
Deirdre Connolly 2020-02-22 18:22:28 -05:00 committed by Deirdre Connolly
parent 8aefadd00f
commit a6a3a640ca
3 changed files with 16 additions and 6 deletions

View File

@ -3,8 +3,6 @@ mod memo;
mod sapling;
mod sprout;
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct Diversifier(pub [u8; 11]);
/// The randomness used in the Pedersen Hash for note commitment.
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct NoteCommitmentRandomness(pub [u8; 32]);

View File

@ -5,19 +5,28 @@ use proptest::{arbitrary::Arbitrary, collection::vec, prelude::*};
use crate::serialization::{SerializationError, ZcashDeserialize, ZcashSerialize};
use super::{Diversifier, Memo, NoteCommitmentRandomness};
use super::*;
/// A _Diversifier_, an 11 byte value used to randomize the
/// recipient's final public shielded payment address to create a
/// _diversified payment address_.
///
/// When used, this value is mapped to an affine JubJub group element.
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct Diversifier(pub [u8; 11]);
pub struct Note {
value: u64,
diversifier: Diversifier,
}
/// The decrypted form of encrypted Sapling notes on the blockchain.
pub struct NotePlaintext {
diversifier: Diversifier,
value: u64,
// TODO: refine as jub-jub appropriate in the base field.
note_committment_randomness: NoteCommitmentRandomness,
memo: Memo,
memo: memo::Memo,
}
/// A ciphertext component for encrypted output notes.

View File

@ -8,15 +8,18 @@ use proptest::{collection::vec, prelude::*};
use crate::serialization::{SerializationError, ZcashDeserialize, ZcashSerialize};
use super::*;
pub struct Note {}
/// The decrypted form of encrypted Sprout notes on the blockchain.
pub struct NotePlaintext {
value: u64,
// TODO: refine type
rho: [u8; 32],
// TODO: refine as jub-jub appropriate in the base field.
note_committment_randomness: NoteCommitmentRandomness,
memo: Memo,
memo: memo::Memo,
}
/// A ciphertext component for encrypted output notes.