diff --git a/src/note_encryption.rs b/src/note_encryption.rs index 7aed1831..9ef73c26 100644 --- a/src/note_encryption.rs +++ b/src/note_encryption.rs @@ -92,6 +92,11 @@ impl OrchardDomain { rho: *act.nullifier(), } } + + /// Constructs a domain from a nullifier. + pub fn for_nullifier(nullifier: Nullifier) -> Self { + OrchardDomain { rho: nullifier } + } } impl Domain for OrchardDomain { @@ -307,6 +312,23 @@ impl ShieldedOutput for CompactAction { } } +impl CompactAction { + /// Create a CompactAction from its constituent parts + pub fn from_parts( + nullifier: Nullifier, + cmx: ExtractedNoteCommitment, + ephemeral_key: EphemeralKeyBytes, + enc_ciphertext: [u8; 52], + ) -> Self { + Self { + nullifier, + cmx, + ephemeral_key, + enc_ciphertext, + } + } +} + #[cfg(test)] mod tests { use rand::rngs::OsRng;