Expose `orchard::note_encryption::{CompactAction, OrchardNoteEncryption}`

This also removes the `orchard::OrchardDomain` re-export, which is now
available at `orchard::note_encryption::OrchardDomain`.
This commit is contained in:
Jack Grigg 2021-08-06 01:01:12 +01:00
parent d0baa18fc6
commit 2283310236
2 changed files with 11 additions and 4 deletions

View File

@ -23,7 +23,7 @@ pub mod circuit;
mod constants; mod constants;
pub mod keys; pub mod keys;
pub mod note; pub mod note;
mod note_encryption; pub mod note_encryption;
pub mod primitives; pub mod primitives;
mod spec; mod spec;
pub mod tree; pub mod tree;
@ -36,5 +36,4 @@ pub use address::Address;
pub use bundle::Bundle; pub use bundle::Bundle;
pub use circuit::Proof; pub use circuit::Proof;
pub use note::Note; pub use note::Note;
pub use note_encryption::OrchardDomain;
pub use tree::Anchor; pub use tree::Anchor;

View File

@ -1,6 +1,6 @@
//! In-band secret distribution for Orchard bundles. //! In-band secret distribution for Orchard bundles.
use std::convert::TryInto; use std::{convert::TryInto, fmt};
use blake2b_simd::{Hash, Params}; use blake2b_simd::{Hash, Params};
use halo2::arithmetic::FieldExt; use halo2::arithmetic::FieldExt;
@ -242,6 +242,7 @@ impl Domain for OrchardDomain {
} }
} }
/// Implementation of in-band secret distribution for Orchard bundles.
pub type OrchardNoteEncryption = zcash_note_encryption::NoteEncryption<OrchardDomain>; pub type OrchardNoteEncryption = zcash_note_encryption::NoteEncryption<OrchardDomain>;
impl<T> ShieldedOutput<OrchardDomain> for Action<T> { impl<T> ShieldedOutput<OrchardDomain> for Action<T> {
@ -258,12 +259,19 @@ impl<T> ShieldedOutput<OrchardDomain> for Action<T> {
} }
} }
struct CompactAction { /// A compact Action for light clients.
pub struct CompactAction {
ephemeral_key: EphemeralKeyBytes, ephemeral_key: EphemeralKeyBytes,
cmx: ExtractedNoteCommitment, cmx: ExtractedNoteCommitment,
enc_ciphertext: [u8; 52], enc_ciphertext: [u8; 52],
} }
impl fmt::Debug for CompactAction {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "CompactAction")
}
}
impl<T> From<&Action<T>> for CompactAction { impl<T> From<&Action<T>> for CompactAction {
fn from(action: &Action<T>) -> Self { fn from(action: &Action<T>) -> Self {
CompactAction { CompactAction {