Skip to main content

Crate orbinum_encrypted_memo

Crate orbinum_encrypted_memo 

Source
Expand description

Encrypted memo primitives for private transactions with ChaCha20Poly1305 AEAD

§Features

  • Encryption: Per-note key derivation from viewing key + commitment
  • Disclosure: Selective disclosure proof structures (Groth16)
  • Key Derivation: SHA-256 based with domain separation

§Architecture

Clean Architecture — domain layer only, no FRAME dependencies:

  • value_objects: Immutable keys and constants
  • entities: MemoData entity + MemoError
  • ports: Abstract interfaces (MemoEncryptor, KeyDeriver)
  • aggregates: KeySet, disclosure structures
  • services: Concrete implementations of the ports

§Example

use fp_encrypted_memo::{MemoData, KeySet, encrypt_memo, decrypt_memo};

let keys = KeySet::from_spending_key(spending_key);
let memo = MemoData::new(1000, owner_pk, blinding, 0);
let encrypted = encrypt_memo(&memo, &commitment, keys.viewing_key.as_bytes(), &nonce)?;
let decrypted = decrypt_memo(&encrypted, &commitment, keys.viewing_key.as_bytes())?;

Re-exports§

pub use domain::value_objects::constants::EDDSA_KEY_DOMAIN;
pub use domain::value_objects::constants::KEY_DOMAIN;
pub use domain::value_objects::constants::MAC_SIZE;
pub use domain::value_objects::constants::MAX_ENCRYPTED_MEMO_SIZE;
pub use domain::value_objects::constants::MEMO_DATA_SIZE;
pub use domain::value_objects::constants::MIN_ENCRYPTED_MEMO_SIZE;
pub use domain::value_objects::constants::NONCE_SIZE;
pub use domain::value_objects::constants::NULLIFIER_KEY_DOMAIN;
pub use domain::value_objects::constants::VIEWING_KEY_DOMAIN;
pub use domain::value_objects::EdDSAKey;
pub use domain::value_objects::NullifierKey;
pub use domain::value_objects::ViewingKey;
pub use domain::entities::error::MemoError;
pub use domain::entities::is_valid_encrypted_memo;
pub use domain::entities::memo_data::MemoData;
pub use domain::aggregates::keyset::KeySet;
pub use domain::aggregates::disclosure::DisclosureMask;
pub use domain::aggregates::disclosure::DisclosureProof;
pub use domain::aggregates::disclosure::DisclosurePublicSignals;
pub use domain::aggregates::disclosure::PartialMemoData;
pub use domain::ports::KeyDeriver;
pub use domain::ports::MemoEncryptor;
pub use domain::services::encryption::decrypt_memo;
pub use domain::services::encryption::encrypt_memo;
pub use domain::services::encryption::try_decrypt_memo;
pub use domain::services::encryption::encrypt_memo_random;
pub use domain::services::key_derivation::derive_eddsa_key_from_spending;
pub use domain::services::key_derivation::derive_nullifier_key_from_spending;
pub use domain::services::key_derivation::derive_viewing_key_from_spending;

Modules§

domain
Domain Layer